text:
FROM nvidia/cuda:9.2-base-ubuntu16.04

# Install some basic utilities
RUN apt-get update && apt-get install -y \
    curl \
    ca-certificates \
    sudo \
    git \
    bzip2 \
    libx11-6 \
 && rm -rf /var/lib/apt/lists/*

# Create a working directory
RUN mkdir /app
WORKDIR /var

# Create a non-root user and switch to it

# All users can use /home/user as their home directory
ENV HOME=/var
RUN chmod 777 /var

# Install Miniconda
RUN curl -so ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh \
 && chmod +x ~/miniconda.sh \
 && ~/miniconda.sh -b -p ~/miniconda \
 && rm ~/miniconda.sh
ENV PATH=/var/miniconda/bin:$PATH
ENV CONDA_AUTO_UPDATE_CONDA=false

# Create a Python 3.6 environment
RUN /var/miniconda/bin/conda create -y --name py36 python=3.6.9 \
 && /var/miniconda/bin/conda clean -ya
ENV CONDA_DEFAULT_ENV=py36
ENV CONDA_PREFIX=/var/miniconda/envs/$CONDA_DEFAULT_ENV
ENV PATH=$CONDA_PREFIX/bin:$PATH
RUN /var/miniconda/bin/conda install conda-build=3.18.9=py36_3 \
 && /var/miniconda/bin/conda clean -ya

# CUDA 9.2-specific steps
RUN conda install -y -c pytorch \
    cudatoolkit=9.2 \
    "pytorch=1.2.0=py3.6_cuda9.2.148_cudnn7.6.2_0" \
    "torchvision=0.4.0=py36_cu92" \
 && conda clean -ya

# Install HDF5 Python bindings
RUN conda install -y h5py=2.8.0 \
 && conda clean -ya
RUN pip install h5py-cache==1.0

# Install Torchnet, a high-level framework for PyTorch
RUN pip install torchnet==0.0.4


text:
import React from 'react';
import Button from 'antd/lib/button';
import 'antd/lib/button/style/css';

export const Counter = props => (

Counter: {props.counter}

    <Button onClick={props.increment}>
      Increment
    </Button>
    {' '}
    <Button onClick={props.doubleAsync}>
      Double (Async)
    </Button>

);

Counter.propTypes = {
  counter: React.PropTypes.number.isRequired,
  doubleAsync: React.PropTypes.func.isRequired,
  increment: React.PropTypes.func.isRequired,
};

export default Counter;

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Club\ClubsBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * PersonasRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class PersonasRepository extends EntityRepository
{
}


text:
u"""
Fixer for from __future__ import with_statement
"""

from lib2to3 import fixer_base
from ..fixer_util import future_import

class FixWith(fixer_base.BaseFix):

    PATTERN = u"with_stmt"

    def transform(self, node, results):
        future_import(u"with_statement", node)


text:
package org.motechproject.nms.region.service.impl;

import org.motechproject.event.MotechEvent;
import org.motechproject.event.listener.EventRelay;
import org.motechproject.event.listener.annotations.MotechListener;
import org.motechproject.nms.region.domain.Circle;
import org.motechproject.nms.region.domain.District;
import org.motechproject.nms.region.domain.Language;
import org.motechproject.nms.region.domain.NationalDefaultLanguage;
import org.motechproject.nms.region.domain.State;
import org.motechproject.nms.region.repository.LanguageDataService;
import org.motechproject.nms.region.repository.NationalDefaultLanguageDataService;
import org.motechproject.nms.region.service.DistrictService;
import org.motechproject.nms.region.service.LanguageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashSet;
import java.util.Set;

@Service("languageService")
public class LanguageServiceImpl implements LanguageService {

    public static final int NATIONAL_DEFAULT_CODE = 0;
    public static final String LANGUAGE_CACHE_EVICT_MESSAGE = "nms.region.cache.evict.language";

    private LanguageDataService languageDataService;
    private NationalDefaultLanguageDataService nationalDefaultLanguageDataService;
    private DistrictService districtService;
    private EventRelay eventRelay;

    @Autowired
    public LanguageServiceImpl(LanguageDataService languageDataService,
                               NationalDefaultLanguageDataService nationalDefaultLanguageDataService,
                               DistrictService districtService, EventRelay eventRelay) {
        this.languageDataService = languageDataService;
        this.nationalDefaultLanguageDataService = nationalDefaultLanguageDataService;
        this.districtService = districtService;
        this.eventRelay = eventRelay;
    }

    /**
     * Given a languageCode returns the object if one exists
     * @param code the code for the language record
     * @return The language Record if it exists
     */
    @Override
    @Cacheable(value = "language", key = "#p0.concat('-0')")
    public Language getForCode(String code) {
        return languageDataService.findByCode(code);
    }

    /**
     * Given a language name returns the object if one exists
     * @param name the language name
     * @return The language Record if it exists
     */
    @Override
    @Cacheable(value = "language", key = "'0-'.concat(#p0)")
    public Language getForName(String name) {
        return languageDataService.findByName(name);
    }

    @Override
    @Cacheable(value = "languages", key = "#p0")
    public Set<Language> getAllForCircle(final Circle circle) {
        Set<Language> languages = new HashSet<>();

        if (circle != null) {
            for (District district : circle.getDistricts()) {
                Language language = district.getLanguage();
                if (language != null) {
                    languages.add(language);
                }
            }
        }

        return languages;
    }

    @Override
    @Cacheable(value = "languages", key = "'all-languages'")
    public Set<Language> getAll() {
        return new HashSet<>(languageDataService.retrieveAll());
    }

    @Override
    @Cacheable(value = "language", key = "'national-default'")
    public Language getNationalDefaultLanguage() {
        Language language = null;

        NationalDefaultLanguage nationalDefaultLanguage;
        nationalDefaultLanguage = nationalDefaultLanguageDataService.findByCode(NATIONAL_DEFAULT_CODE);

        if (nationalDefaultLanguage != null) {
            language = nationalDefaultLanguage.getLanguage();
        }

        return language;
    }

    @Override
    public Set<State> getAllStatesForLanguage(Language language) {
        Set<State> states = new HashSet<>();
        Set<District> districts = districtService.getAllForLanguage(language);

        for (District district: districts) {
            states.add(district.getState());
        }

        return states;
    }

    public void broadcastCacheEvictMessage(Language language) {
        eventRelay.broadcastEventMessage(new MotechEvent(LANGUAGE_CACHE_EVICT_MESSAGE));
    }

    @MotechListener(subjects = { LANGUAGE_CACHE_EVICT_MESSAGE })
    @Transactional
    @CacheEvict(value = {"language", "languages" }, allEntries = true)
    public void cacheEvict(MotechEvent event) {
    }
}


text:
#ifndef __CCNOTIFICATIONCENTER_H__
#define __CCNOTIFICATIONCENTER_H__

#include "cocoa/CCObject.h"
#include "cocoa/CCArray.h"

NS_CC_BEGIN
/**
 * @js NA
 */
class CC_DLL CCNotificationCenter : public CCObject
{
public:
    /** CCNotificationCenter constructor */
    CCNotificationCenter();

    /** CCNotificationCenter destructor */
    ~CCNotificationCenter();

    /** Gets the single instance of CCNotificationCenter. */
    static CCNotificationCenter *sharedNotificationCenter(void);

    /** Destroys the single instance of CCNotificationCenter. */
    static void purgeNotificationCenter(void);

    /** @brief Adds an observer for the specified target.
     *  @param target The target which wants to observe notification events.
     *  @param selector The callback function which will be invoked when the specified notification event was posted.
     *  @param name The name of this notification.
     *  @param obj The extra parameter which will be passed to the callback function.
     */
    void addObserver(CCObject *target,
                     SEL_CallFuncO selector,
                     const char *name,
                     CCObject *obj);

    /** @brief Removes the observer by the specified target and name.
     *  @param target The target of this notification.
     *  @param name The name of this notification.
     */
    void removeObserver(CCObject *target,const char *name);

    /** @brief Removes all notifications registered by this target
     *  @param target The target of this notification.
     *  @returns the number of observers removed
     */
    int removeAllObservers(CCObject *target);

    /** @brief Registers one hander for script binding.
     *  @note Only supports Lua Binding now.
     *  @param handler The lua handler.
     */
    void registerScriptObserver(CCObject *target,int handler,const char* name);

    /** Unregisters script observer */
    void unregisterScriptObserver(CCObject *target,const char* name);

    /** @brief Posts one notification event by name.
     *  @param name The name of this notification.
     */
    void postNotification(const char *name);

    /** @brief Posts one notification event by name.
     *  @param name The name of this notification.
     *  @param object The extra parameter.
     */
    void postNotification(const char *name, CCObject *object);

    /** @brief Gets script handler.
     *  @note Only supports Lua Binding now.
     *  @return The script handle.
     */
    inline int getScriptHandler() { return m_scriptHandler; };

    /** @brief Gets observer script handler.
     *  @param name The name of this notification.
     *  @return The observer script handle.
     */
    int getObserverHandlerByName(const char* name);
private:
    // internal functions

    // Check whether the observer exists by the specified target and name.
    bool observerExisted(CCObject *target,const char *name);

    // variables
    //
    CCArray *m_observers;
    int     m_scriptHandler;
};

/**
 * @js NA
 * @lua NA
 */
class CC_DLL CCNotificationObserver : public CCObject
{
public:
    /** @brief CCNotificationObserver constructor
     *  @param target The target which wants to observer notification events.
     *  @param selector The callback function which will be invoked when the specified notification event was posted.
     *  @param name The name of this notification.
     *  @param obj The extra parameter which will be passed to the callback function.
     */
    CCNotificationObserver(CCObject *target,
                           SEL_CallFuncO selector,
                           const char *name,
                           CCObject *obj);

    /** CCNotificationObserver destructor function */
    ~CCNotificationObserver();

    /** Invokes the callback function of this observer */
    void performSelector(CCObject *obj);
private:
    CC_PROPERTY_READONLY(CCObject *, m_target, Target);
    CC_PROPERTY_READONLY(SEL_CallFuncO, m_selector, Selector);
    CC_PROPERTY_READONLY(char *, m_name, Name);
    CC_PROPERTY_READONLY(CCObject *, m_object, Object);
    CC_PROPERTY(int, m_nHandler,Handler);
};

NS_CC_END

#endif//__CCNOTIFICATIONCENTER_H__


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>org.gradle.plugins.ide.eclipse.model (Gradle API 2.8)</title>
<meta name="date" content="2015-10-20">
<link rel="stylesheet" type="text/css" href="../../../../../../javadoc.css" title="Style">

org.gradle.plugins.ide.eclipse.model

Interfaces

ClasspathEntry

FileReference

Classes

Jdt


text:
using LmpClient.Events.Base;
using System;

// ReSharper disable All
#pragma warning disable IDE1006

namespace LmpClient.Events
{
    public class ExternalSeatEvent : LmpBaseEvent
    {
        public static EventData<Vessel, Guid, string> onExternalSeatBoard;
        public static EventData<Vessel, KerbalEVA> onExternalSeatUnboard;
    }
}


text:
'use strict';
(function(app){
	app.config(function($stateProvider, $urlRouterProvider){
		$stateProvider
			.state('base',{
				url:'/base',
				templateUrl:'views/basePage.html',
				controller:"baseCtrl"
			});

			$urlRouterProvider.otherwise('/base');
	});
})(angular.module('baseModule'));


text:
package java.nio;

import com.jtransc.JTranscBits;

public final class ByteOrder {
	private static final boolean isLittleEndian = JTranscBits.isLittleEndian();
	public static final ByteOrder BIG_ENDIAN = new ByteOrder("BIG_ENDIAN", isLittleEndian);
	public static final ByteOrder LITTLE_ENDIAN = new ByteOrder("LITTLE_ENDIAN", !isLittleEndian);
	private static final ByteOrder NATIVE_ORDER = isLittleEndian ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN;

	public static ByteOrder nativeOrder() {
		return NATIVE_ORDER;
	}

	final private String name;
	final boolean needsSwap;

	private ByteOrder(String name, boolean needsSwap) {
		this.name = name;
		this.needsSwap = needsSwap;
	}

	public String toString() {
		return name;
	}
}


text:
<title>SAME_TYPE_AS - The GNU Fortran Compiler</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="The GNU Fortran Compiler">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Intrinsic-Procedures.html#Intrinsic-Procedures" title="Intrinsic Procedures">
<link rel="prev" href="RSHIFT.html#RSHIFT" title="RSHIFT">
<link rel="next" href="SCALE.html#SCALE" title="SCALE">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: SCALE,
Previous: RSHIFT,
Up: Intrinsic Procedures

8.209 SAME_TYPE_AS —  Query dynamic types for equality

Description:
Query dynamic types for equality.

Standard:
Fortran 2003 and later

Class:
Inquiry function

Syntax:
RESULT = SAME_TYPE_AS(A, B)

Arguments:

<var>A</var> 	Shall be an object of extensible declared type or
unlimited polymorphic.

<var>B</var> 	Shall be an object of extensible declared type or
unlimited polymorphic.

Return value:
The return value is a scalar of type default logical. It is true if and
only if the dynamic type of A is the same as the dynamic type of B.

See also:
EXTENDS_TYPE_OF


text:
package com.icedcap.itbookfinder;

import android.app.Application;
import android.app.DownloadManager;
import android.content.IntentFilter;
import android.content.pm.PackageManager;

import com.icedcap.itbookfinder.broadcast.DownloadBroadcast;

/**
 * Created by shuqi on 16-4-2.
 */
public class ItBookApplication extends Application {
    public static String jsonFilePath;

    @Override
    public void onCreate() {
        super.onCreate();

        jsonFilePath = getFilesDir().getPath();
//        registerReceiver(new DownloadBroadcast(), new IntentFilter(
//                DownloadManager.ACTION_DOWNLOAD_COMPLETE));
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
    }
}


text:
package liu.study.api.java.nio;

import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;

public class IOServer {

	public static void main(String[] args) {
		ServerSocket serverSocket = null;
		byte[] buf = new byte[1024];
		int len = -1;
		try {
			serverSocket = new ServerSocket(8123);
			while(true){
				Socket socket = serverSocket.accept();
				InetAddress inetAddress = socket.getInetAddress();
				int port = socket.getPort();
				System.out.println("inetAddress:"+inetAddress+" port:"+port);
				InputStream inputStream = socket.getInputStream();
				while((len=inputStream.read(buf))>0){
					System.out.print(new String(buf,0,len));

				}
				System.out.println("receive :");
			}

		} catch (IOException e) {
			e.printStackTrace();
		}finally {
			if(null!=serverSocket){
				try {
					serverSocket.close();
				} catch (Exception e2) {

				}
			}
		}

	}
}


text:
set -e
cd source
mvn -P gsp generate-resources -Dmaven.repo.local=../m2/rootfs/usr/share/maven/ref/repository
mvn clean verify sonar:sonar -Dmaven.repo.local=../m2/rootfs/usr/share/maven/ref/repository \
-Dsonar.host.url=${SONAR_URL} -Dsonar.analysis.mode=preview \
-Dsonar.gitlab.url=${GITLAB_URL} -Dsonar.gitlab.user_token=${GITLAB_USER_TOKEN} \
-Dsonar.gitlab.project_id=${GITLAB_PROJECT_ID} -Dsonar.gitlab.commit_sha=$(git rev-parse HEAD) -Dsonar.gitlab.ref_name=$(git symbolic-ref --short HEAD)


text:
module Fog
  module Compute
    class VcloudDirector
      class Real
        extend Fog::Deprecation
        deprecate :get_tasks_list, :get_task_list

        # Retrieve a list of this organization's queued, running, or recently
        # completed tasks.
        #
        # @param [String] id Object identifier of the organization.
        # @return [Excon::Response]
        #   * body<~Hash>:
        #     * :href<~String> - The URI of the entity.
        #     * :type<~String> - The MIME type of the entity.
        #     * :id<~String> - The entity identifier, expressed in URN format.
        #       The value of this attribute uniquely identifies the entity,
        #       persists for the life of the entity, and is never reused.
        #     * :name<~String> - The name of the entity.
        #     * :Task<~Array<Hash>>:
        #       * :href<~String> - The URI of the entity.
        #       * :type<~String> - The MIME type of the entity.
        #       * :id<~String> - The entity identifier, expressed in URN
        #         format. The value of this attribute uniquely identifies the
        #         entity, persists for the life of the entity, and is never
        #         reused.
        #       * :operationKey<~String> - Optional unique identifier to
        #         support idempotent semantics for create and delete
        #         operations.
        #       * :name<~String> - The name of the entity.
        #       * :cancelRequested<~String> - Whether user has requested this
        #         processing to be canceled.
        #       * :endTime<~String> - The date and time that processing of the
        #         task was completed. May not be present if the task is still
        #         being executed.
        #       * :expiryTime<~String> - The date and time at which the task
        #         resource will be destroyed and no longer available for
        #         retrieval. May not be present if the task has not been
        #         executed or is still being executed.
        #       * :operation<~String> - A message describing the operation that
        #         is tracked by this task.
        #       * :operationName<~String> - The short name of the operation
        #         that is tracked by this task.
        #       * :serviceNamespace<~String> - Identifier of the service that
        #         created the task.
        #       * :startTime<~String> - The date and time the system started
        #         executing the task. May not be present if the task has not
        #         been executed yet.
        #       * :status<~String> - The execution status of the task.
        #       * :Link<~Array<Hash>>:
        #       * :Description<~String> - Optional description.
        #       * :Owner<~Hash> - Reference to the owner of the task. This is
        #         typically the object that the task is creating or updating.
        #         * :href<~String> - Contains the URI to the entity.
        #         * :name<~String> - Contains the name of the entity.
        #         * :type<~String> - Contains the type of the entity.
        #       * :Error<~Hash> - Represents error information from a failed
        #         task.
        #         * :majorErrorCode<~String> - The class of the error.  Matches
        #           the HTTP status code.
        #         * :message<~String> - An one line, human-readable message
        #           describing the error that occurred.
        #         * :minorErrorCode<~String> - Resource-specific error code.
        #         * :stackTrace<~String> - The stack trace of the exception.
        #         * :vendorSpecificErrorCode<~String> - A vendor- or
        #           implementation-specific error code that can reference
        #           specific modules or source lines for diagnostic purposes.
        #       * :User<~Hash> - The user who started the task.
        #         * :href<~String> - Contains the URI to the entity.
        #         * :name<~String> - Contains the name of the entity.
        #         * :type<~String> - Contains the type of the entity.
        #       * :Organization<~Hash> - The organization to which the :User
        #         belongs.
        #         * :href<~String> - Contains the URI to the entity.
        #         * :name<~String> - Contains the name of the entity.
        #         * :type<~String> - Contains the type of the entity.
        #       * :Progress<~String> - Read-only indicator of task progress as
        #         an approximate percentage between 0 and 100. Not available
        #         for all tasks.
        #       * :Params
        #       * :Details<~String> - Detailed message about the task. Also
        #         contained by the :Owner entity when task status is
        #         preRunning.
        #
        # @raise [Fog::Compute::VcloudDirector::BadRequest]
        # @raise [Fog::Compute::VcloudDirector::Forbidden]
        #
        # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-TaskList.html
        # @since vCloud API version 0.9
        def get_task_list(id)
          response = request(
            :expects    => 200,
            :idempotent => true,
            :method     => 'GET',
            :parser     => Fog::ToHashDocument.new,
            :path       => "tasksList/#{id}"
          )
          ensure_list! response.body, :Task
          response
        end
      end

      class Mock
        def get_task_list(id)
          unless id == data[:org][:uuid]
            raise Fog::Compute::VcloudDirector::Forbidden.new(
              "No access to entity \"com.vmware.vcloud.entity.org:#{id}\"."
            )
          end

          body = {
            :xmlns => xmlns,
            :xmlns_xsi => xmlns_xsi,
            :xsi_schemaLocation => xsi_schema_location,
            :href => make_href("tasksList/#{id}"),
            :type => "application/vnd.vmware.vcloud.tasksList+xml",
            :name => "Tasks Lists",
            :Task => data[:tasks].keys.map {|task_id| task_body(task_id)}
          }

          Excon::Response.new(
            :status => 200,
            :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
            :body => body
          )
        end
      end
    end
  end
end


text:
  <ion-content
    has-header="true"
    has-footer="true"
    scroll="true"
    padding="true"
    on-refresh="onRefresh()"
    on-refresh-opening="onRefreshOpening(amount)"
    refresh-complete="refreshComplete"
     animate-nav="true"
    >

    <refresher></refresher>

            {{message.created_by}}:
            {{message.created_at | date: 'short' }}

          {{message.content}}

  </ion-content>

      <form ui-keypress="{13:'submitAddMessage($event)'}" data-ng-submit="submitAddMessage()" >

          <input type="text" placeholder="your message ..." data-ng-model="newMessage">
          <button class="button button-positive">Send</button>

      </form>


text:
#include "config.h"

#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <stdint.h>
#include <cmocka.h>
#include <cmocka_private.h>

#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
#include <fcntl.h>

/**************************************
 *** assert_return_code
 **************************************/
static void test_assert_return_code_fail(void **state)
{
    int fd;

    (void)state; /* unused */

    fd = open("this_file_doesnt_exist.cmocka", 0);
    assert_return_code(fd, errno);

    if (fd >= 0) {
        close(fd);
    }
}

int main(void) {
    const struct CMUnitTest tests[] = {
        cmocka_unit_test(test_assert_return_code_fail),
    };

    return cmocka_run_group_tests(tests, NULL, NULL);
}


text:
#include "mitkGeometry3D.h"
#include "mitkTimeGeometry.h"

#include "mitkInteractionConst.h"
#include "mitkRotationOperation.h"
#include <mitkImageCast.h>
#include <mitkMatrixConvert.h>

#include "mitkTestingMacros.h"
#include <fstream>
#include <mitkVector.h>

#include "mitkImageGenerator.h"
#include "mitkPointSet.h"
#include <limits>
#include <mitkStandaloneDataStorage.h>

static const mitk::ScalarType test_eps = 1E-6; /* some reference values in the test seem
to have been calculated with float precision. Thus, set this to float precision epsilon.*/
static const mitk::ScalarType test_eps_square = 1E-3;

class mitkTimeGeometryTestClass
{
public:
  void Translation_Image_MovedOrigin(unsigned int DimX, unsigned int DimY, unsigned int DimZ, unsigned int DimT)
  {
    // DimX, DimY, DimZ,
    mitk::Image::Pointer image =
      mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(DimX, DimY, DimZ, DimT, 0.5, 0.33, 0.78, 100);
    mitk::BaseGeometry::Pointer geometry = image->GetTimeGeometry()->GetGeometryForTimeStep(0);
    mitk::Point3D imageOrigin = geometry->GetOrigin();
    mitk::Point3D expectedOrigin;
    expectedOrigin[0] = 0;
    expectedOrigin[1] = 0;
    expectedOrigin[2] = 0;
    MITK_TEST_CONDITION(mitk::Equal(imageOrigin, expectedOrigin), "Original origin match expected origin");

    expectedOrigin[0] = 0.325;
    expectedOrigin[1] = 0.487;
    expectedOrigin[2] = 0.78;

    mitk::Vector3D translationVector;
    translationVector[0] = expectedOrigin[0];
    translationVector[1] = expectedOrigin[1];
    translationVector[2] = expectedOrigin[2];

    for (mitk::TimeStepType timeStep = 0; timeStep < image->GetTimeGeometry()->CountTimeSteps(); ++timeStep)
    {
      image->GetTimeGeometry()->GetGeometryForTimeStep(timeStep)->Translate(translationVector);
    }
    imageOrigin = image->GetGeometry(0)->GetOrigin();
    MITK_TEST_CONDITION(mitk::Equal(imageOrigin, expectedOrigin), "Translated origin match expected origin");

    expectedOrigin[0] = 2 * translationVector[0];
    expectedOrigin[1] = 2 * translationVector[1];
    expectedOrigin[2] = 2 * translationVector[2];

    for (mitk::TimeStepType timeStep = 0; timeStep < image->GetTimeGeometry()->CountTimeSteps(); ++timeStep)
    {
      image->GetTimeGeometry()->GetGeometryForTimeStep(timeStep)->Translate(translationVector);
    }
    imageOrigin = image->GetGeometry(0)->GetOrigin();
    MITK_TEST_CONDITION(mitk::Equal(imageOrigin, expectedOrigin), "Translated origin match expected origin");
  }

  void Rotate_Image_RotatedPoint(mitk::BaseData *baseData,
                                 unsigned int /*DimX*/,
                                 unsigned int /*DimY*/,
                                 unsigned int /*DimZ*/,
                                 unsigned int /*DimT*/)
  {
    mitk::StandaloneDataStorage::Pointer ds = mitk::StandaloneDataStorage::New();
    mitk::DataNode::Pointer dataNode = mitk::DataNode::New();

    // DimX, DimY, DimZ,
    dataNode->SetData(baseData);
    ds->Add(dataNode);
    mitk::BaseGeometry::Pointer geometry = baseData->GetTimeGeometry()->GetGeometryForTimeStep(0);
    mitk::Point3D expectedPoint;
    expectedPoint[0] = 3 * 0.5;
    expectedPoint[1] = 3 * 0.33;
    expectedPoint[2] = 3 * 0.78;
    mitk::Point3D originalPoint;
    originalPoint[0] = 3;
    originalPoint[1] = 3;
    originalPoint[2] = 3;
    mitk::Point3D worldPoint;
    geometry->IndexToWorld(originalPoint, worldPoint);
    MITK_TEST_CONDITION(mitk::Equal(worldPoint, expectedPoint, test_eps),
                        "Index-to-World without rotation as expected ");

    mitk::Point3D pointOfRotation;
    pointOfRotation[0] = 0;
    pointOfRotation[1] = 0;
    pointOfRotation[2] = 0;
    mitk::Vector3D vectorOfRotation;
    vectorOfRotation[0] = 1;
    vectorOfRotation[1] = 0.5;
    vectorOfRotation[2] = 0.2;
    mitk::ScalarType angleOfRotation = 73.0;
    auto rotation = new mitk::RotationOperation(mitk::OpROTATE, pointOfRotation, vectorOfRotation, angleOfRotation);

    baseData->GetTimeGeometry()->ExecuteOperation(rotation);
    delete rotation;

    expectedPoint[0] = 2.6080379;
    expectedPoint[1] = -0.75265157;
    expectedPoint[2] = 1.1564401;

    baseData->GetGeometry(0)->IndexToWorld(originalPoint, worldPoint);
    MITK_TEST_CONDITION(mitk::Equal(worldPoint, expectedPoint, test_eps), "Rotation returns expected values ");
  }

  void Scale_Image_ScaledPoint(unsigned int DimX, unsigned int DimY, unsigned int DimZ, unsigned int DimT)
  {
    // DimX, DimY, DimZ,
    mitk::Image::Pointer image =
      mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(DimX, DimY, DimZ, DimT, 0.5, 0.33, 0.78, 100);
    mitk::BaseGeometry::Pointer geometry = image->GetTimeGeometry()->GetGeometryForTimeStep(0);
    mitk::Point3D expectedPoint;
    expectedPoint[0] = 3 * 0.5;
    expectedPoint[1] = 3 * 0.33;
    expectedPoint[2] = 3 * 0.78;
    mitk::Point3D originalPoint;
    originalPoint[0] = 3;
    originalPoint[1] = 3;
    originalPoint[2] = 3;
    mitk::Point3D worldPoint;
    geometry->IndexToWorld(originalPoint, worldPoint);
    MITK_TEST_CONDITION(mitk::Equal(worldPoint, expectedPoint, test_eps),
                        "Index-to-World with old Scaling as expected ");

    mitk::Vector3D newSpacing;
    newSpacing[0] = 2;
    newSpacing[1] = 1.254;
    newSpacing[2] = 0.224;
    image->SetSpacing(newSpacing);
    expectedPoint[0] = 3 * 2;
    expectedPoint[1] = 3 * 1.254;
    expectedPoint[2] = 3 * 0.224;

    image->GetGeometry(0)->IndexToWorld(originalPoint, worldPoint);
    MITK_TEST_CONDITION(mitk::Equal(worldPoint, expectedPoint),
                        "Index-toWorld with new Scaling returns expected values ");
  }

  void GetMinimumTimePoint_4DBaseData_Zero(mitk::BaseData *baseData, unsigned int /*DimT*/)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::TimePointType expectedTimePoint = geometry->GetMinimumTimePoint();
    MITK_TEST_CONDITION(mitk::Equal(expectedTimePoint, 0), "Returns correct minimum time point ");
  }

  void GetMaximumTimePoint_4DBaseData_DimT(mitk::BaseData *baseData, unsigned int DimT)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::TimePointType expectedTimePoint = geometry->GetMaximumTimePoint();
    MITK_TEST_CONDITION(mitk::Equal(expectedTimePoint, DimT), "Returns correct maximum time point ");
  }

  void CountTimeSteps_Image_ReturnDimT(
    mitk::BaseData *baseData, unsigned int /*DimX*/, unsigned int /*DimY*/, unsigned int /*DimZ*/, unsigned int DimT)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::TimeStepType expectedTimeSteps = geometry->CountTimeSteps();
    MITK_TEST_CONDITION(mitk::Equal(expectedTimeSteps, DimT), "Returns correct number of time Steps ");
  }

  void GetMinimumTimePoint_3DImage_Min(mitk::BaseData *baseData,
                                       unsigned int /*DimX*/,
                                       unsigned int /*DimY*/,
                                       unsigned int /*DimZ*/,
                                       unsigned int /*DimT*/)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::TimePointType expectedTimePoint = geometry->GetMinimumTimePoint();
    MITK_TEST_CONDITION(mitk::Equal(expectedTimePoint, -std::numeric_limits<mitk::TimePointType>().max()),
                        "Returns correct minimum time point ");
  }

  void GetMaximumTimePoint_3DImage_Max(mitk::BaseData *baseData,
                                       unsigned int /*DimX*/,
                                       unsigned int /*DimY*/,
                                       unsigned int /*DimZ*/,
                                       unsigned int /*DimT*/)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::TimePointType expectedTimePoint = geometry->GetMaximumTimePoint();
    MITK_INFO << expectedTimePoint;
    MITK_INFO << std::numeric_limits<mitk::TimePointType>().max();
    MITK_TEST_CONDITION(mitk::Equal(expectedTimePoint, std::numeric_limits<mitk::TimePointType>().max()),
                        "Returns correct maximum time point ");
  }

  void GetTimeBounds_4DImage_ZeroAndDimT(unsigned int DimX, unsigned int DimY, unsigned int DimZ, unsigned int DimT)
  {
    mitk::Image::Pointer image =
      mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(DimX, DimY, DimZ, DimT, 0.5, 0.33, 0.78, 100);
    mitk::TimeGeometry::Pointer geometry = image->GetTimeGeometry();
    mitk::TimeBounds expectedTimeBounds = geometry->GetTimeBounds();
    MITK_TEST_CONDITION(mitk::Equal(expectedTimeBounds[0], 0), "Returns correct minimum time point ");
    MITK_TEST_CONDITION(mitk::Equal(expectedTimeBounds[1], DimT), "Returns correct maximum time point ");
  }

  void GetTimeBounds_3DImage_ZeroAndDimT(mitk::BaseData *baseData,
                                         unsigned int /*DimX*/,
                                         unsigned int /*DimY*/,
                                         unsigned int /*DimZ*/,
                                         unsigned int /*DimT*/)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::TimeBounds expectedTimeBounds = geometry->GetTimeBounds();
    MITK_TEST_CONDITION(mitk::Equal(expectedTimeBounds[0], -std::numeric_limits<mitk::TimePointType>().max()),
                        "Returns correct minimum time point ");
    MITK_TEST_CONDITION(mitk::Equal(expectedTimeBounds[1], std::numeric_limits<mitk::TimePointType>().max()),
                        "Returns correct maximum time point ");
  }

  void IsValidTimePoint_ImageValidTimePoint_True(
    mitk::BaseData *baseData, unsigned int /*DimX*/, unsigned int /*DimY*/, unsigned int /*DimZ*/, unsigned int DimT)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    bool isValid = geometry->IsValidTimePoint(DimT - 1);
    MITK_TEST_CONDITION(mitk::Equal(isValid, true), "Is valid time Point correct minimum time point ");
  }

  void IsValidTimePoint_ImageNegativInvalidTimePoint_False(unsigned int DimX,
                                                           unsigned int DimY,
                                                           unsigned int DimZ,
                                                           unsigned int DimT)
  {
    mitk::Image::Pointer image =
      mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(DimX, DimY, DimZ, DimT, 0.5, 0.33, 0.78, 100);
    mitk::TimeGeometry::Pointer geometry = image->GetTimeGeometry();
    bool isValid = geometry->IsValidTimePoint(-static_cast<int>(DimT));
    MITK_TEST_CONDITION(mitk::Equal(isValid, false), "Is invalid time Point correct minimum time point ");
  }

  void IsValidTimePoint_ImageInvalidTimePoint_False(unsigned int DimX,
                                                    unsigned int DimY,
                                                    unsigned int DimZ,
                                                    unsigned int DimT)
  {
    mitk::Image::Pointer image =
      mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(DimX, DimY, DimZ, DimT, 0.5, 0.33, 0.78, 100);
    mitk::TimeGeometry::Pointer geometry = image->GetTimeGeometry();
    bool isValid = geometry->IsValidTimePoint(DimT + 1);
    MITK_TEST_CONDITION(mitk::Equal(isValid, false), "Is invalid time Point correct minimum time point ");
  }

  void IsValidTimeStep_ImageValidTimeStep_True(
    mitk::BaseData *baseData, unsigned int /*DimX*/, unsigned int /*DimY*/, unsigned int /*DimZ*/, unsigned int DimT)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    bool isValid = geometry->IsValidTimeStep(DimT - 1);
    MITK_TEST_CONDITION(mitk::Equal(isValid, true), "Is valid time Point correct minimum time point ");
  }

  void IsValidTimeStep_ImageNegativInvalidTimeStep_False(
    mitk::BaseData *baseData, unsigned int /*DimX*/, unsigned int /*DimY*/, unsigned int /*DimZ*/, unsigned int DimT)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    bool isValid = geometry->IsValidTimeStep(-static_cast<int>(DimT));
    MITK_TEST_CONDITION(mitk::Equal(isValid, false), "Is invalid time Point correct minimum time point ");
  }

  void IsValidTimeStep_ImageInvalidTimeStep_False(
    mitk::BaseData *baseData, unsigned int /*DimX*/, unsigned int /*DimY*/, unsigned int /*DimZ*/, unsigned int DimT)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    bool isValid = geometry->IsValidTimeStep(DimT);
    MITK_TEST_CONDITION(mitk::Equal(isValid, false), "Is invalid time Point correct minimum time point ");
  }

  void TimeStepToTimePoint_ImageValidTimeStep_TimePoint(
    mitk::BaseData *baseData, unsigned int /*DimX*/, unsigned int /*DimY*/, unsigned int /*DimZ*/, unsigned int DimT)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::TimePointType timePoint = geometry->TimeStepToTimePoint(DimT - 1);
    MITK_TEST_CONDITION(mitk::Equal(timePoint, DimT - 1), "Calculated right time Point for Time Step ");
  }

  void TimeStepToTimePoint_ImageInvalidTimeStep_TimePoint(
    mitk::BaseData *baseData, unsigned int /*DimX*/, unsigned int /*DimY*/, unsigned int /*DimZ*/, unsigned int DimT)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::TimePointType timePoint = geometry->TimeStepToTimePoint(DimT + 1);
    MITK_TEST_CONDITION(mitk::Equal(timePoint, DimT + 1), "Calculated right time Point for invalid Time Step ");
  }

  void TimePointToTimeStep_ImageValidTimePoint_TimePoint(
    mitk::BaseData *baseData, unsigned int /*DimX*/, unsigned int /*DimY*/, unsigned int /*DimZ*/, unsigned int DimT)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::TimeStepType timePoint = geometry->TimePointToTimeStep(DimT - 0.5);
    MITK_TEST_CONDITION(mitk::Equal(timePoint, DimT - 1), "Calculated right time step for valid time point");
  }

  void TimePointToTimeStep_4DImageInvalidTimePoint_TimePoint(unsigned int DimX,
                                                             unsigned int DimY,
                                                             unsigned int DimZ,
                                                             unsigned int DimT)
  {
    mitk::Image::Pointer image =
      mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(DimX, DimY, DimZ, DimT, 0.5, 0.33, 0.78, 100);
    mitk::TimeGeometry::Pointer geometry = image->GetTimeGeometry();
    mitk::TimeStepType timePoint = geometry->TimePointToTimeStep(DimT + 1.5);
    MITK_TEST_CONDITION(mitk::Equal(timePoint, DimT + 1), "Calculated right time step for invalid time point");
  }

  void TimePointToTimeStep_4DImageNegativInvalidTimePoint_TimePoint(unsigned int DimX,
                                                                    unsigned int DimY,
                                                                    unsigned int DimZ,
                                                                    unsigned int DimT)
  {
    mitk::Image::Pointer image =
      mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(DimX, DimY, DimZ, DimT, 0.5, 0.33, 0.78, 100);
    mitk::TimeGeometry::Pointer geometry = image->GetTimeGeometry();
    mitk::TimePointType negativTimePoint = (-1.0 * DimT) - 1.5;
    mitk::TimeStepType timePoint = geometry->TimePointToTimeStep(negativTimePoint);
    MITK_TEST_CONDITION(mitk::Equal(timePoint, 0), "Calculated right time step for negative invalid time point");
  }

  void GetGeometryForTimeStep_BaseDataValidTimeStep_CorrectGeometry(mitk::BaseData *baseData,
                                                                    mitk::ScalarType inputX,
                                                                    mitk::ScalarType inputY,
                                                                    mitk::ScalarType inputZ,
                                                                    mitk::ScalarType outputX,
                                                                    mitk::ScalarType outputY,
                                                                    mitk::ScalarType outputZ,
                                                                    unsigned int DimT)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::BaseGeometry::Pointer geometry3D = geometry->GetGeometryForTimeStep(DimT - 1);
    MITK_TEST_CONDITION(geometry3D.IsNotNull(), "Non-zero geometry returned");

    mitk::Point3D expectedPoint;
    expectedPoint[0] = outputX;
    expectedPoint[1] = outputY;
    expectedPoint[2] = outputZ;
    mitk::Point3D originalPoint;
    originalPoint[0] = inputX;
    originalPoint[1] = inputY;
    originalPoint[2] = inputZ;
    mitk::Point3D worldPoint;
    geometry3D->IndexToWorld(originalPoint, worldPoint);
    MITK_TEST_CONDITION(mitk::Equal(worldPoint, expectedPoint, test_eps), "Geometry transformation matches expectation. ");
  }

  void GetGeometryForTimeStep_ImageInvalidTimeStep_NullPointer(
    mitk::BaseData *baseData, unsigned int /*DimX*/, unsigned int /*DimY*/, unsigned int /*DimZ*/, unsigned int DimT)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::BaseGeometry::Pointer geometry3D = geometry->GetGeometryForTimeStep(DimT + 1);
    MITK_TEST_CONDITION(geometry3D.IsNull(), "Null-Pointer geometry returned");
  }

  void GetGeometryForTimePoint_BaseDataValidTimePoint_CorrectGeometry(mitk::BaseData *baseData,
                                                                      mitk::ScalarType inputX,
                                                                      mitk::ScalarType inputY,
                                                                      mitk::ScalarType inputZ,
                                                                      mitk::ScalarType outputX,
                                                                      mitk::ScalarType outputY,
                                                                      mitk::ScalarType outputZ,
                                                                      unsigned int DimT)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::BaseGeometry::Pointer geometry3D = geometry->GetGeometryForTimePoint(DimT - 0.5);
    MITK_TEST_CONDITION(geometry3D.IsNotNull(), "Non-zero geometry returned");

    mitk::Point3D expectedPoint;
    expectedPoint[0] = outputX;
    expectedPoint[1] = outputY;
    expectedPoint[2] = outputZ;
    mitk::Point3D originalPoint;
    originalPoint[0] = inputX;
    originalPoint[1] = inputY;
    originalPoint[2] = inputZ;
    mitk::Point3D worldPoint;
    geometry3D->IndexToWorld(originalPoint, worldPoint);
    MITK_TEST_CONDITION(mitk::Equal(worldPoint, expectedPoint, test_eps), "Geometry transformation matches expectation. ");
  }

  void GetGeometryForTimePoint_4DImageInvalidTimePoint_NullPointer(unsigned int DimX,
                                                                   unsigned int DimY,
                                                                   unsigned int DimZ,
                                                                   unsigned int DimT)
  {
    mitk::Image::Pointer image =
      mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(DimX, DimY, DimZ, DimT, 0.5, 0.33, 0.78, 100);
    mitk::TimeGeometry::Pointer geometry = image->GetTimeGeometry();
    mitk::BaseGeometry::Pointer geometry3D = geometry->GetGeometryForTimePoint(DimT + 1);
    MITK_TEST_CONDITION(geometry3D.IsNull(), "Null-Pointer geometry returned with invalid time point");
  }

  void GetGeometryForTimePoint_4DImageNEgativInvalidTimePoint_NullPointer(unsigned int DimX,
                                                                          unsigned int DimY,
                                                                          unsigned int DimZ,
                                                                          unsigned int DimT)
  {
    mitk::Image::Pointer image =
      mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(DimX, DimY, DimZ, DimT, 0.5, 0.33, 0.78, 100);
    mitk::TimeGeometry::Pointer geometry = image->GetTimeGeometry();
    mitk::TimePointType timePoint = (-1.0 * (DimT)) - 1;
    mitk::BaseGeometry::Pointer geometry3D = geometry->GetGeometryForTimePoint(timePoint);
    MITK_TEST_CONDITION(geometry3D.IsNull(), "Null-Pointer geometry returned with invalid negative time point");
  }

  void GetGeometryCloneForTimeStep_BaseDataValidTimeStep_CorrectGeometry(mitk::BaseData *baseData, unsigned int DimT)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::BaseGeometry::Pointer geometry3D = geometry->GetGeometryCloneForTimeStep(DimT - 1);
    MITK_TEST_CONDITION(geometry3D.IsNotNull(), "Non-zero geometry returned");

    mitk::Point3D expectedPoint;
    mitk::Point3D originalPoint;
    originalPoint[0] = 3;
    originalPoint[1] = 3;
    originalPoint[2] = 3;
    mitk::Point3D worldPoint;
    geometry3D->IndexToWorld(originalPoint, expectedPoint);

    mitk::Vector3D translationVector;
    translationVector[0] = 5;
    translationVector[1] = 8;
    translationVector[2] = 7;
    geometry3D->Translate(translationVector);

    geometry3D = geometry->GetGeometryForTimeStep(DimT - 1);
    geometry3D->IndexToWorld(originalPoint, worldPoint);
    MITK_TEST_CONDITION(mitk::Equal(worldPoint, expectedPoint), "Geometry transformation not changed. ");
  }

  void GetGeometryCloneForTimeStep_ImageInvalidTimeStep_NullPointer(
    mitk::BaseData *baseData, unsigned int /*DimX*/, unsigned int /*DimY*/, unsigned int /*DimZ*/, unsigned int DimT)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::BaseGeometry::Pointer geometry3D = geometry->GetGeometryCloneForTimeStep(DimT + 1);
    MITK_TEST_CONDITION(geometry3D.IsNull(), "Null-Pointer geometry returned");
  }

  void SetTimeStepGeometry_BaseDataValidTimeStep_CorrectGeometry(mitk::BaseData *baseData,
                                                                 mitk::ScalarType scaleX,
                                                                 mitk::ScalarType scaleY,
                                                                 mitk::ScalarType scaleZ,
                                                                 unsigned int DimT)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    mitk::BaseGeometry::Pointer geometry3D = geometry->GetGeometryCloneForTimeStep(DimT - 1);
    MITK_TEST_CONDITION(geometry3D.IsNotNull(), "Non-zero geometry returned");

    mitk::Vector3D translationVector;
    translationVector[0] = 5;
    translationVector[1] = 8;
    translationVector[2] = 7;
    geometry3D->Translate(translationVector);

    geometry->SetTimeStepGeometry(geometry3D, DimT - 1);

    mitk::Point3D expectedPoint;
    expectedPoint[0] = 3 * scaleX + 5;
    expectedPoint[1] = 3 * scaleY + 8;
    expectedPoint[2] = 3 * scaleZ + 7;
    mitk::Point3D originalPoint;
    originalPoint[0] = 3;
    originalPoint[1] = 3;
    originalPoint[2] = 3;
    mitk::Point3D worldPoint;
    geometry->GetGeometryForTimeStep(DimT - 1)->IndexToWorld(originalPoint, worldPoint);
    MITK_TEST_CONDITION(mitk::Equal(worldPoint, expectedPoint, test_eps), "Geometry transformation matches expectation. ");
  }

  void Expand_BaseDataDoubleSize_SizeChanged(mitk::BaseData *baseData, unsigned int DimT)
  {
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();
    MITK_TEST_CONDITION(geometry->CountTimeSteps() == DimT, "Number of time Steps matches expectation. ");

    geometry->Expand(DimT * 2);
    MITK_TEST_CONDITION(geometry->CountTimeSteps() == DimT * 2, "Number of time Steps matches expectation. ");

    mitk::BaseGeometry::Pointer geometry3D = geometry->GetGeometryForTimeStep(DimT * 2 - 1);
    MITK_TEST_CONDITION(geometry3D.IsNotNull(), "Non-zero geometry is generated. ");
  }

  void CheckBounds_BaseData_PointsAsExpected(mitk::BaseData *baseData,
                                             mitk::ScalarType minX,
                                             mitk::ScalarType minY,
                                             mitk::ScalarType minZ,
                                             mitk::ScalarType maxX,
                                             mitk::ScalarType maxY,
                                             mitk::ScalarType maxZ)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();

    mitk::Point3D expectedPoint;

    expectedPoint[0] = minX;
    expectedPoint[1] = minY;
    expectedPoint[2] = minZ;
    mitk::Point3D point = geometry->GetCornerPointInWorld(0);
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 0 as expected ");
    point = geometry->GetCornerPointInWorld(true, true, true);
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 0 as expected ");

    point = geometry->GetCornerPointInWorld(1);
    expectedPoint[0] = minX;
    expectedPoint[1] = minY;
    expectedPoint[2] = maxZ;
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "GBounding Point 1 as expected ");
    point = geometry->GetCornerPointInWorld(true, true, false);
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 1 as expected ");

    point = geometry->GetCornerPointInWorld(2);
    expectedPoint[0] = minX;
    expectedPoint[1] = maxY;
    expectedPoint[2] = minZ;
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 2 as expected ");
    point = geometry->GetCornerPointInWorld(true, false, true);
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 2 as expected ");

    point = geometry->GetCornerPointInWorld(3);
    expectedPoint[0] = minX;
    expectedPoint[1] = maxY;
    expectedPoint[2] = maxZ;
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 3 as expected  ");
    point = geometry->GetCornerPointInWorld(true, false, false);
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 3 as expected ");

    point = geometry->GetCornerPointInWorld(4);
    expectedPoint[0] = maxX;
    expectedPoint[1] = minY;
    expectedPoint[2] = minZ;
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 4 as expected  ");
    point = geometry->GetCornerPointInWorld(false, true, true);
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 4 as expected ");

    point = geometry->GetCornerPointInWorld(5);
    expectedPoint[0] = maxX;
    expectedPoint[1] = minY;
    expectedPoint[2] = maxZ;
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 5 as expected  ");
    point = geometry->GetCornerPointInWorld(false, true, false);
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 5 as expected ");

    point = geometry->GetCornerPointInWorld(6);
    expectedPoint[0] = maxX;
    expectedPoint[1] = maxY;
    expectedPoint[2] = minZ;
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 6 as expected  ");
    point = geometry->GetCornerPointInWorld(false, false, true);
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 6 as expected ");

    point = geometry->GetCornerPointInWorld(7);
    expectedPoint[0] = maxX;
    expectedPoint[1] = maxY;
    expectedPoint[2] = maxZ;
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 7 as expected  ");
    point = geometry->GetCornerPointInWorld(false, false, false);
    MITK_TEST_CONDITION(mitk::Equal(expectedPoint, point, test_eps), "Bounding Point 7 as expected ");
  }

  void CheckLength_BaseData_AsExpected(mitk::BaseData *baseData, double length, double squareLength)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();

    double dimension = geometry->GetDiagonalLengthInWorld();
    MITK_TEST_CONDITION(mitk::Equal(dimension, length, test_eps), "Length  as expected ");

    dimension = geometry->GetDiagonalLength2InWorld();
    MITK_TEST_CONDITION(mitk::Equal(dimension, squareLength, test_eps_square), "Square length as expected ");
  }

  void CheckPointInside_BaseDataPointInside_True(mitk::BaseData *baseData,
                                                 mitk::ScalarType pointX,
                                                 mitk::ScalarType pointY,
                                                 mitk::ScalarType pointZ)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();

    mitk::Point3D expectedPoint;

    expectedPoint[0] = pointX;
    expectedPoint[1] = pointY;
    expectedPoint[2] = pointZ;
    bool isInside = geometry->IsWorldPointInside(expectedPoint);
    MITK_TEST_CONDITION(isInside, "Point is inside Image...");
  }

  void CheckPointInside_BaseDataPointOutside_False(mitk::BaseData *baseData,
                                                   mitk::ScalarType pointX,
                                                   mitk::ScalarType pointY,
                                                   mitk::ScalarType pointZ)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();

    mitk::Point3D expectedPoint;

    expectedPoint[0] = pointX;
    expectedPoint[1] = pointY;
    expectedPoint[2] = pointZ;
    bool isInside = geometry->IsWorldPointInside(expectedPoint);
    MITK_TEST_CONDITION(!isInside, "Point is outside Image...");
  }

  void CheckBounds_Image_AsSet(unsigned int DimX, unsigned int DimY, unsigned int DimZ, unsigned int DimT)
  {
    mitk::Image::Pointer image =
      mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(DimX, DimY, DimZ, DimT, 0.5, 0.33, 0.78, 100);
    mitk::TimeGeometry::Pointer geometry = image->GetTimeGeometry();

    mitk::BoundingBox::BoundsArrayType bound = geometry->GetBoundsInWorld();
    bool isEqual = true;
    isEqual = isEqual && mitk::Equal(bound[0], -0.5 * 0.5, test_eps);
    isEqual = isEqual && mitk::Equal(bound[1], 29.5 * 0.5, test_eps);
    isEqual = isEqual && mitk::Equal(bound[2], -0.5 * 0.33, test_eps);
    isEqual = isEqual && mitk::Equal(bound[3], 24.5 * 0.33, test_eps);
    isEqual = isEqual && mitk::Equal(bound[4], -0.5 * 0.78, test_eps);
    isEqual = isEqual && mitk::Equal(bound[5], 19.5 * 0.78, test_eps);

    MITK_TEST_CONDITION(isEqual, "Bounds as precalculated...");
  }

  void CheckBounds_BaseData_AsSet(mitk::BaseData *baseData,
                                  mitk::ScalarType minBoundX,
                                  mitk::ScalarType maxBoundX,
                                  mitk::ScalarType minBoundY,
                                  mitk::ScalarType maxBoundY,
                                  mitk::ScalarType minBoundZ,
                                  mitk::ScalarType maxBoundZ)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();

    mitk::BoundingBox::BoundsArrayType bound = geometry->GetBoundsInWorld();
    bool isEqual = true;
    isEqual = isEqual && mitk::Equal(bound[0], minBoundX);
    isEqual = isEqual && mitk::Equal(bound[1], maxBoundX);
    isEqual = isEqual && mitk::Equal(bound[2], minBoundY);
    isEqual = isEqual && mitk::Equal(bound[3], maxBoundY);
    isEqual = isEqual && mitk::Equal(bound[4], minBoundZ);
    isEqual = isEqual && mitk::Equal(bound[5], maxBoundZ);

    MITK_TEST_CONDITION(isEqual, "Bounds as precalculated...");
  }

  void CheckExtent_BaseData_AsSet(mitk::BaseData *baseData, double extentX, double extentY, double extentZ)
  {
    baseData->Update();
    mitk::TimeGeometry::Pointer geometry = baseData->GetTimeGeometry();

    bool isEqual = true;
    isEqual = isEqual && mitk::Equal(geometry->GetExtentInWorld(0), extentX, test_eps); // 30*0.5);
    isEqual = isEqual && mitk::Equal(geometry->GetExtentInWorld(1), extentY, test_eps); // 25*0.33);
    isEqual = isEqual && mitk::Equal(geometry->GetExtentInWorld(2), extentZ, test_eps); // 20*0.78);

    MITK_TEST_CONDITION(isEqual, "Extent as precalculated...");
  }

  mitk::PointSet::Pointer makePointset()
  {
    mitk::PointSet::Pointer pointSet = mitk::PointSet::New();
    mitk::Point3D pointA, pointB, pointC;
    pointA.Fill(1);
    pointB.Fill(2);
    pointC.Fill(3);
    pointSet->SetPoint(1, pointA);
    pointSet->SetPoint(2, pointB);
    pointSet->SetPoint(3, pointC);
    pointSet->Update();
    MITK_INFO << pointSet->GetPoint(0);
    MITK_INFO << pointSet->GetPoint(1);
    MITK_INFO << pointSet->GetPoint(2);
    MITK_INFO << pointSet->GetPoint(3);

    mitk::PointSet::Pointer pointSet2 = pointSet->Clone();
    MITK_INFO << pointSet2->GetPoint(0);
    MITK_INFO << pointSet2->GetPoint(1);
    MITK_INFO << pointSet2->GetPoint(2);
    MITK_INFO << pointSet2->GetPoint(3);

    return pointSet;
  }
};

int mitkTimeGeometryTest(int /*argc*/, char * /*argv*/ [])
{
  MITK_TEST_BEGIN(mitkTimeGeometryTest);

  mitkTimeGeometryTestClass testClass;

  MITK_TEST_OUTPUT(<< "Test for 3D image");
  mitk::Image::Pointer image =
    mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(30, 25, 20, 1, 0.5, 0.33, 0.78, 100);
  testClass.Translation_Image_MovedOrigin(30, 25, 20, 1);
  testClass.Rotate_Image_RotatedPoint(image->Clone(), 30, 25, 20, 1);
  testClass.Scale_Image_ScaledPoint(30, 25, 20, 1);
  testClass.CountTimeSteps_Image_ReturnDimT(image->Clone(), 30, 25, 20, 1);
  testClass.GetMinimumTimePoint_3DImage_Min(image->Clone(), 30, 25, 20, 1);
  testClass.GetMaximumTimePoint_3DImage_Max(image->Clone(), 30, 25, 20, 1);
  testClass.GetTimeBounds_3DImage_ZeroAndDimT(image->Clone(), 30, 25, 20, 1);
  testClass.IsValidTimePoint_ImageValidTimePoint_True(image->Clone(), 30, 25, 20, 1);
  testClass.IsValidTimeStep_ImageValidTimeStep_True(image->Clone(), 30, 25, 20, 1);
  testClass.IsValidTimeStep_ImageNegativInvalidTimeStep_False(image->Clone(), 30, 25, 20, 1);
  testClass.IsValidTimeStep_ImageInvalidTimeStep_False(image->Clone(), 30, 25, 20, 1);
  testClass.TimeStepToTimePoint_ImageValidTimeStep_TimePoint(image->Clone(), 30, 25, 20, 1);
  testClass.TimeStepToTimePoint_ImageInvalidTimeStep_TimePoint(image->Clone(), 30, 25, 20, 1);
  testClass.TimePointToTimeStep_ImageValidTimePoint_TimePoint(image->Clone(), 30, 25, 20, 1);
  testClass.GetGeometryForTimeStep_BaseDataValidTimeStep_CorrectGeometry(
    image->Clone(), 3, 3, 3, 3 * 0.5, 3 * 0.33, 3 * 0.78, 1);
  testClass.GetGeometryForTimeStep_ImageInvalidTimeStep_NullPointer(image->Clone(), 30, 25, 20, 1);
  testClass.GetGeometryForTimePoint_BaseDataValidTimePoint_CorrectGeometry(
    image->Clone(), 3, 3, 3, 3 * 0.5, 3 * 0.33, 3 * 0.78, 1);
  testClass.GetGeometryCloneForTimeStep_BaseDataValidTimeStep_CorrectGeometry(image->Clone(), 1);
  testClass.GetGeometryCloneForTimeStep_ImageInvalidTimeStep_NullPointer(image->Clone(), 30, 25, 20, 1);
  testClass.SetTimeStepGeometry_BaseDataValidTimeStep_CorrectGeometry(image->Clone(), 0.5, 0.33, 0.78, 1);
  testClass.Expand_BaseDataDoubleSize_SizeChanged(image->Clone(), 1);
  testClass.CheckBounds_BaseData_PointsAsExpected(
    image->Clone(), -0.5 * 0.5, -0.5 * 0.33, -0.5 * 0.78, 29.5 * 0.5, 24.5 * 0.33, 19.5 * 0.78);
  testClass.CheckLength_BaseData_AsExpected(image->Clone(), 23.160796233014466, 536.42248214721712);
  testClass.CheckPointInside_BaseDataPointInside_True(image->Clone(), 10, 5, 5);
  testClass.CheckPointInside_BaseDataPointOutside_False(image->Clone(), 100, 500, 100);
  testClass.CheckBounds_Image_AsSet(30, 25, 20, 1);
  testClass.CheckExtent_BaseData_AsSet(image->Clone(), 30 * 0.5, 25 * 0.33, 20 * 0.78);

  MITK_TEST_OUTPUT(<< "Test for 2D image");
  image = mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(30, 25, 1, 1, 0.5, 0.33, 0.78, 100);
  testClass.Translation_Image_MovedOrigin(30, 25, 1, 1);
  testClass.Rotate_Image_RotatedPoint(image->Clone(), 30, 25, 1, 1);
  testClass.Scale_Image_ScaledPoint(30, 25, 1, 1);
  testClass.CountTimeSteps_Image_ReturnDimT(image->Clone(), 30, 25, 1, 1);
  testClass.GetMinimumTimePoint_3DImage_Min(image->Clone(), 30, 25, 1, 1);
  testClass.GetMaximumTimePoint_3DImage_Max(image->Clone(), 30, 25, 1, 1);
  testClass.GetTimeBounds_3DImage_ZeroAndDimT(image->Clone(), 30, 25, 1, 1);
  testClass.IsValidTimePoint_ImageValidTimePoint_True(image->Clone(), 30, 25, 1, 1);
  testClass.IsValidTimeStep_ImageValidTimeStep_True(image->Clone(), 30, 25, 1, 1);
  testClass.IsValidTimeStep_ImageNegativInvalidTimeStep_False(image->Clone(), 30, 25, 1, 1);
  testClass.IsValidTimeStep_ImageInvalidTimeStep_False(image->Clone(), 30, 25, 1, 1);
  testClass.TimeStepToTimePoint_ImageValidTimeStep_TimePoint(image->Clone(), 30, 25, 1, 1);
  testClass.TimeStepToTimePoint_ImageInvalidTimeStep_TimePoint(image->Clone(), 30, 25, 1, 1);
  testClass.TimePointToTimeStep_ImageValidTimePoint_TimePoint(image->Clone(), 30, 25, 1, 1);
  testClass.GetGeometryForTimeStep_BaseDataValidTimeStep_CorrectGeometry(
    image->Clone(), 3, 3, 3, 3 * 0.5, 3 * 0.33, 3 * 0.78, 1);
  testClass.GetGeometryForTimeStep_ImageInvalidTimeStep_NullPointer(image->Clone(), 30, 25, 1, 1);
  testClass.GetGeometryForTimePoint_BaseDataValidTimePoint_CorrectGeometry(
    image->Clone(), 3, 3, 3, 3 * 0.5, 3 * 0.33, 3 * 0.78, 1);
  testClass.GetGeometryCloneForTimeStep_BaseDataValidTimeStep_CorrectGeometry(image->Clone(), 1);
  testClass.GetGeometryCloneForTimeStep_ImageInvalidTimeStep_NullPointer(image->Clone(), 30, 25, 1, 1);
  testClass.SetTimeStepGeometry_BaseDataValidTimeStep_CorrectGeometry(image->Clone(), 0.5, 0.33, 0.78, 1);
  testClass.Expand_BaseDataDoubleSize_SizeChanged(image->Clone(), 1);
  testClass.CheckBounds_BaseData_PointsAsExpected(
    image->Clone(), -0.5 * 0.5, -0.5 * 0.33, -0.5 * 0.78, 29.5 * 0.5, 24.5 * 0.33, 0.5 * 0.78);
  testClass.CheckLength_BaseData_AsExpected(image->Clone(), 17.1368287615, 293.6709);
  testClass.CheckPointInside_BaseDataPointInside_True(image->Clone(), 10, 5, 0);
  testClass.CheckPointInside_BaseDataPointOutside_False(image->Clone(), 100, 500, 0.5);
  testClass.CheckExtent_BaseData_AsSet(image->Clone(), 30 * 0.5, 25 * 0.33, 1 * 0.78);

  MITK_TEST_OUTPUT(<< "Test for 3D+time image");
  image = mitk::ImageGenerator::GenerateRandomImage<mitk::ScalarType>(30, 25, 20, 5, 0.5, 0.33, 0.78, 100);
  testClass.Translation_Image_MovedOrigin(30, 25, 20, 5);             // Test with 3D+t-Image
  testClass.Rotate_Image_RotatedPoint(image->Clone(), 30, 25, 20, 5); // Test with 3D+t-Image
  testClass.Scale_Image_ScaledPoint(30, 25, 20, 5);                   // Test with 3D+t-Image
  testClass.CountTimeSteps_Image_ReturnDimT(image->Clone(), 30, 25, 20, 5);
  testClass.GetMinimumTimePoint_4DBaseData_Zero(image->Clone(), 5);
  testClass.GetMaximumTimePoint_4DBaseData_DimT(image->Clone(), 5);
  testClass.GetTimeBounds_4DImage_ZeroAndDimT(30, 25, 20, 5);
  testClass.IsValidTimePoint_ImageValidTimePoint_True(image->Clone(), 30, 25, 20, 5);
  testClass.IsValidTimePoint_ImageNegativInvalidTimePoint_False(30, 25, 20, 5);
  testClass.IsValidTimePoint_ImageInvalidTimePoint_False(30, 25, 20, 5);
  testClass.IsValidTimeStep_ImageValidTimeStep_True(image->Clone(), 30, 25, 20, 5);
  testClass.IsValidTimeStep_ImageNegativInvalidTimeStep_False(image->Clone(), 30, 25, 20, 5);
  testClass.IsValidTimeStep_ImageInvalidTimeStep_False(image->Clone(), 30, 25, 20, 5);
  testClass.TimeStepToTimePoint_ImageValidTimeStep_TimePoint(image->Clone(), 30, 25, 20, 5);
  testClass.TimeStepToTimePoint_ImageInvalidTimeStep_TimePoint(image->Clone(), 30, 25, 20, 5);
  testClass.TimePointToTimeStep_ImageValidTimePoint_TimePoint(image->Clone(), 30, 25, 20, 5);
  testClass.TimePointToTimeStep_4DImageInvalidTimePoint_TimePoint(30, 25, 20, 5);
  testClass.TimePointToTimeStep_4DImageNegativInvalidTimePoint_TimePoint(30, 25, 20, 5);
  testClass.GetGeometryForTimeStep_BaseDataValidTimeStep_CorrectGeometry(
    image->Clone(), 3, 3, 3, 3 * 0.5, 3 * 0.33, 3 * 0.78, 5);
  testClass.GetGeometryForTimeStep_ImageInvalidTimeStep_NullPointer(image->Clone(), 30, 25, 20, 5);
  testClass.GetGeometryForTimePoint_BaseDataValidTimePoint_CorrectGeometry(
    image->Clone(), 3, 3, 3, 3 * 0.5, 3 * 0.33, 3 * 0.78, 5);
  testClass.GetGeometryForTimePoint_4DImageInvalidTimePoint_NullPointer(30, 25, 20, 5);
  testClass.GetGeometryForTimePoint_4DImageNEgativInvalidTimePoint_NullPointer(30, 25, 20, 5);
  testClass.GetGeometryCloneForTimeStep_BaseDataValidTimeStep_CorrectGeometry(image->Clone(), 5);
  testClass.GetGeometryCloneForTimeStep_ImageInvalidTimeStep_NullPointer(image->Clone(), 30, 25, 20, 5);
  testClass.SetTimeStepGeometry_BaseDataValidTimeStep_CorrectGeometry(image->Clone(), 0.5, 0.33, 0.78, 5);
  testClass.Expand_BaseDataDoubleSize_SizeChanged(image->Clone(), 5);
  testClass.CheckBounds_BaseData_PointsAsExpected(
    image->Clone(), -0.5 * 0.5, -0.5 * 0.33, -0.5 * 0.78, 29.5 * 0.5, 24.5 * 0.33, 19.5 * 0.78);
  testClass.CheckLength_BaseData_AsExpected(image->Clone(), 23.160796233014466, 536.42248214721712);
  testClass.CheckPointInside_BaseDataPointInside_True(image->Clone(), 10, 5, 5);
  testClass.CheckPointInside_BaseDataPointOutside_False(image->Clone(), 100, 100, 500);
  testClass.CheckBounds_Image_AsSet(30, 25, 20, 5);
  testClass.CheckExtent_BaseData_AsSet(image->Clone(), 30 * 0.5, 25 * 0.33, 20 * 0.78);

  /*
    MITK_TEST_OUTPUT(<< "Test for 2D+time image");
    testClass.Translation_Image_MovedOrigin(30,25,1 ,5); // Test with 2D+t-Image
    testClass.Rotate_Image_RotatedPoint(30,25,1 ,5); // Test with 2D+t-Image
    testClass.Scale_Image_ScaledPoint(30,25,1 ,5); // Test with 2D+t-Image
  */

  mitk::PointSet::Pointer pointSet = mitk::PointSet::New();
  mitk::Point3D pointA, pointB, pointC;
  pointA.Fill(1);
  pointB.Fill(2);
  pointC.Fill(3);
  pointSet->SetPoint(0, pointA);
  pointSet->SetPoint(1, pointB);
  pointSet->SetPoint(2, pointC);
  testClass.CountTimeSteps_Image_ReturnDimT(pointSet->Clone(), 30, 25, 20, 1);
  // testClass.GetMinimumTimePoint_3DImage_Min(pointSet->Clone(),30,25,20,1);
  // testClass.GetMaximumTimePoint_3DImage_Max(pointSet->Clone(),30,25,20,1);
  // testClass.GetTimeBounds_3DImage_ZeroAndDimT(pointSet->Clone(),30,25,20,1);
  testClass.IsValidTimePoint_ImageValidTimePoint_True(pointSet->Clone(), 30, 25, 20, 1);
  testClass.IsValidTimeStep_ImageValidTimeStep_True(pointSet->Clone(), 30, 25, 20, 1);
  testClass.IsValidTimeStep_ImageNegativInvalidTimeStep_False(pointSet->Clone(), 30, 25, 20, 1);
  testClass.IsValidTimeStep_ImageInvalidTimeStep_False(pointSet->Clone(), 30, 25, 20, 1);
  testClass.TimeStepToTimePoint_ImageValidTimeStep_TimePoint(pointSet->Clone(), 30, 25, 20, 1);
  testClass.TimeStepToTimePoint_ImageInvalidTimeStep_TimePoint(pointSet->Clone(), 30, 25, 20, 1);
  testClass.TimePointToTimeStep_ImageValidTimePoint_TimePoint(pointSet->Clone(), 30, 25, 20, 1);
  testClass.GetGeometryForTimeStep_BaseDataValidTimeStep_CorrectGeometry(pointSet->Clone(), 3, 3, 3, 3, 3, 3, 1);
  testClass.GetGeometryForTimeStep_ImageInvalidTimeStep_NullPointer(pointSet->Clone(), 30, 25, 20, 1);
  testClass.GetGeometryForTimePoint_BaseDataValidTimePoint_CorrectGeometry(pointSet->Clone(), 3, 3, 3, 3, 3, 3, 1);
  testClass.GetGeometryCloneForTimeStep_BaseDataValidTimeStep_CorrectGeometry(pointSet->Clone(), 1);
  testClass.GetGeometryCloneForTimeStep_ImageInvalidTimeStep_NullPointer(pointSet->Clone(), 30, 25, 20, 1);
  testClass.SetTimeStepGeometry_BaseDataValidTimeStep_CorrectGeometry(pointSet->Clone(), 1, 1, 1, 1);
  testClass.Expand_BaseDataDoubleSize_SizeChanged(pointSet->Clone(), 1);
  testClass.CheckBounds_BaseData_PointsAsExpected(pointSet->Clone(), 1, 1, 1, 3, 3, 3);
  testClass.CheckLength_BaseData_AsExpected(pointSet->Clone(), 3.46410161, 12);
  testClass.CheckPointInside_BaseDataPointInside_True(pointSet->Clone(), 2, 2, 3);
  testClass.CheckPointInside_BaseDataPointOutside_False(pointSet->Clone(), 4, 5, 1);
  testClass.CheckBounds_BaseData_AsSet(pointSet->Clone(), 1, 3, 1, 3, 1, 3);
  testClass.CheckExtent_BaseData_AsSet(pointSet->Clone(), 2, 2, 2);

  MITK_TEST_END();

  return EXIT_SUCCESS;
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.mediaservices.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Class to specify DRM configurations of CommonEncryptionCbcs scheme in Streaming Policy. */
@Fluent
public final class CbcsDrmConfiguration {
    /*
     * FairPlay configurations
     */
    @JsonProperty(value = "fairPlay")
    private StreamingPolicyFairPlayConfiguration fairPlay;

    /*
     * PlayReady configurations
     */
    @JsonProperty(value = "playReady")
    private StreamingPolicyPlayReadyConfiguration playReady;

    /*
     * Widevine configurations
     */
    @JsonProperty(value = "widevine")
    private StreamingPolicyWidevineConfiguration widevine;

    /**
     * Get the fairPlay property: FairPlay configurations.
     *
     * @return the fairPlay value.
     */
    public StreamingPolicyFairPlayConfiguration fairPlay() {
        return this.fairPlay;
    }

    /**
     * Set the fairPlay property: FairPlay configurations.
     *
     * @param fairPlay the fairPlay value to set.
     * @return the CbcsDrmConfiguration object itself.
     */
    public CbcsDrmConfiguration withFairPlay(StreamingPolicyFairPlayConfiguration fairPlay) {
        this.fairPlay = fairPlay;
        return this;
    }

    /**
     * Get the playReady property: PlayReady configurations.
     *
     * @return the playReady value.
     */
    public StreamingPolicyPlayReadyConfiguration playReady() {
        return this.playReady;
    }

    /**
     * Set the playReady property: PlayReady configurations.
     *
     * @param playReady the playReady value to set.
     * @return the CbcsDrmConfiguration object itself.
     */
    public CbcsDrmConfiguration withPlayReady(StreamingPolicyPlayReadyConfiguration playReady) {
        this.playReady = playReady;
        return this;
    }

    /**
     * Get the widevine property: Widevine configurations.
     *
     * @return the widevine value.
     */
    public StreamingPolicyWidevineConfiguration widevine() {
        return this.widevine;
    }

    /**
     * Set the widevine property: Widevine configurations.
     *
     * @param widevine the widevine value to set.
     * @return the CbcsDrmConfiguration object itself.
     */
    public CbcsDrmConfiguration withWidevine(StreamingPolicyWidevineConfiguration widevine) {
        this.widevine = widevine;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (fairPlay() != null) {
            fairPlay().validate();
        }
        if (playReady() != null) {
            playReady().validate();
        }
        if (widevine() != null) {
            widevine().validate();
        }
    }
}


text:
package main.me.thedome.aesencryptor.utils;

import main.me.thedome.aesencryptor.crypto.CryptoMethods;

/**
 * Package main.me.thedome.aesencryptor.utils
 * Created on 03/2018.
 */

public class PercentageDisplay extends Thread {

	private final Logger logger = Logger.getInstance();
	private boolean running = true; // Whether the thread is running
	private CryptoMethods superClass;

	public PercentageDisplay(CryptoMethods superClass) {
		this.superClass = superClass;
	}

	@Override
	public synchronized void start() {
		super.start();
		running = true;
	}

	@Override
	public void run() {
		while (running) {
			// Log the percent while we are running

			int tmpPer = (int) Math.round(superClass.percentage * 10000) / 100;
			logger.percent(tmpPer);
			try {
				Thread.sleep(1000); // Sleep 200ms to prevent spamming
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}

	public void stopThread() {
		running = false;
	}
}


text:
package com.cognizant.cognizantits.qcconnection.qcupdation;

import com4j.DISPID;
import com4j.DefaultValue;
import com4j.IID;
import com4j.Optional;
import com4j.VTID;

@IID("{1F73BDFF-AC15-47FF-8264-88ADE733AAB7}")
public abstract interface IReqFactory2
  extends IReqFactory
{
  @DISPID(19)
  @VTID(27)
  public abstract IList getFilteredChildrenList(int paramInt, @Optional @DefaultValue("0") ITDFilter paramITDFilter);
}

/* Location:           D:\Prabu\jars\QC.jar
 * Qualified Name:     qcupdation.IReqFactory2
 * JD-Core Version:    0.7.0.1
 */


text:
<?php

declare(strict_types=1);

namespace OAuth2Framework\Component\MetadataEndpoint;

use function Safe\json_encode;
use Jose\Component\Core\JWK;
use Jose\Component\Core\Util\JsonConverter;
use Jose\Component\Signature\JWSBuilder;
use Jose\Component\Signature\Serializer\CompactSerializer;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

class MetadataEndpoint implements MiddlewareInterface
{
    private ResponseFactoryInterface $responseFactory;

    private Metadata $metadata;

    private ?JWK $signatureKey = null;

    private ?string $signatureAlgorithm = null;

    private ?JWSBuilder $jwsBuilder = null;

    public function __construct(ResponseFactoryInterface $responseFactory, Metadata $metadata)
    {
        $this->responseFactory = $responseFactory;
        $this->metadata = $metadata;
    }

    public function enableSignature(JWSBuilder $jwsBuilder, string $signatureAlgorithm, JWK $signatureKey): void
    {
        $this->jwsBuilder = $jwsBuilder;
        $this->signatureKey = $signatureKey;
        $this->signatureAlgorithm = $signatureAlgorithm;
    }

    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $data = $this->metadata->all();
        if (null !== $this->jwsBuilder) {
            $data['signed_metadata'] = $this->sign($data);
        }
        $response = $this->responseFactory->createResponse();
        $response->getBody()->write(json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));

        return $response->withHeader('Content-Type', 'application/json; charset=UTF-8');
    }

    private function sign(array $metadata): string
    {
        $header = [
            'alg' => $this->signatureAlgorithm,
        ];
        $jws = $this->jwsBuilder
            ->create()
            ->withPayload(JsonConverter::encode($metadata))
            ->addSignature($this->signatureKey, $header)
            ->build()
        ;
        $serializer = new CompactSerializer();

        return $serializer->serialize($jws, 0);
    }
}


text:
%Simulation illustrating the type II behaviour. The first cell is the maual
%which triggers waves of propagation across the rest of the thread.

%These are optimal paramters
preStretch = 2.5;
nCells = 30;
cellLengthAtPrestretch = 20e-3 * preStretch;
spacingAtPrestretch = 40e-3 * preStretch;
electrodeType = ElectrodeTypeEnum.LocallyControlled;

%Define the switching models
rOn = 3.7; rOff = 2.6;
switchingModelLocal = TypeIIModel(rOn, rOff);

tEnd = 10; period = 2;
switchingModelExternal = CyclicSwitchModel(tEnd, period);

%initialises a thread with equally spaced, locally controlled electrodes
thread = Thread.ConstructThreadWithSpacedElectrodes( ...
                preStretch, ...
                cellLengthAtPrestretch, ...
                nCells, ...
                spacingAtPrestretch, ...
                switchingModelLocal, ...
                switchingModelExternal, ...
                GentParams.Koh2012, ...
                @(x)FiberConstrainedElement(x, 1));

% thread.RCCircuit.SourceVoltage = 5500;
thread.RCCircuit.Resistance = 1e7;

%%Uncomment this to plot the thread! (it is currently in prestretch config)
%thread.Plot(false);
%return

%Make a simulator object and run for 7s
sim = SimulateThread(mfilename, thread);
sim.RunSim(30);

%View the output
viewer = SimViewer(sim.Name);

close all;

figure
viewer.PlotMaterial;

figure
viewer.PlotGlobal;


text:
import datetime
import re
import os

from django import forms

from ietf.doc.models import Document, DocAlias, State
from ietf.name.models import IntendedStdLevelName, DocRelationshipName
from ietf.group.models import Group
from ietf.person.models import Person, Email
from ietf.person.fields import SearchableEmailField
from ietf.secr.groups.forms import get_person

# ---------------------------------------------
# Select Choices
# ---------------------------------------------
WITHDRAW_CHOICES = (('ietf','Withdraw by IETF'),('author','Withdraw by Author'))

# ---------------------------------------------
# Custom Fields
# ---------------------------------------------
class DocumentField(forms.FileField):
    '''A validating document upload field'''

    def __init__(self, unique=False, *args, **kwargs):
        self.extension = kwargs.pop('extension')
        self.filename = kwargs.pop('filename')
        self.rev = kwargs.pop('rev')
        super(DocumentField, self).__init__(*args, **kwargs)

    def clean(self, data, initial=None):
        file = super(DocumentField, self).clean(data,initial)
        if file:
            # validate general file format
            m = re.search(r'.*-\d{2}\.(txt|pdf|ps|xml)', file.name)
            if not m:
                raise forms.ValidationError('File name must be in the form base-NN.[txt|pdf|ps|xml]')

            # ensure file extension is correct
            base,ext = os.path.splitext(file.name)
            if ext != self.extension:
                raise forms.ValidationError('Incorrect file extension: %s' % ext)

            # if this isn't a brand new submission we need to do some extra validations
            if self.filename:
                # validate filename
                if base[:-3] != self.filename:
                    raise forms.ValidationError, "Filename: %s doesn't match Draft filename." % base[:-3]
                # validate revision
                next_revision = str(int(self.rev)+1).zfill(2)
                if base[-2:] != next_revision:
                    raise forms.ValidationError, "Expected revision # %s" % (next_revision)

        return file

class GroupModelChoiceField(forms.ModelChoiceField):
    '''
    Custom ModelChoiceField sets queryset to include all active workgroups and the
    individual submission group, none.  Displays group acronyms as choices.  Call it without the
    queryset argument, for example:

    group = GroupModelChoiceField(required=True)
    '''
    def __init__(self, *args, **kwargs):
        kwargs['queryset'] = Group.objects.filter(type__in=('wg','individ'),state__in=('bof','proposed','active')).order_by('acronym')
        super(GroupModelChoiceField, self).__init__(*args, **kwargs)

    def label_from_instance(self, obj):
        return obj.acronym

class AliasModelChoiceField(forms.ModelChoiceField):
    '''
    Custom ModelChoiceField, just uses Alias name in the select choices as opposed to the
    more confusing alias -> doc format used by DocAlias.__unicode__
    '''
    def label_from_instance(self, obj):
        return obj.name

# ---------------------------------------------
# Forms
# ---------------------------------------------
class AddModelForm(forms.ModelForm):
    start_date = forms.DateField()
    group = GroupModelChoiceField(required=True,help_text='Use group "none" for Individual Submissions.')

    class Meta:
        model = Document
        fields = ('title','group','stream','start_date','pages','abstract','internal_comments')

    # use this method to set attrs which keeps other meta info from model.
    def __init__(self, *args, **kwargs):
        super(AddModelForm, self).__init__(*args, **kwargs)
        self.fields['title'].label='Document Name'
        self.fields['title'].widget=forms.Textarea()
        self.fields['start_date'].initial=datetime.date.today
        self.fields['pages'].label='Number of Pages'
        self.fields['internal_comments'].label='Comments'

class AuthorForm(forms.Form):
    '''
    The generic javascript for populating the email list based on the name selected expects to
    see an id_email field
    '''
    person = forms.CharField(max_length=50,widget=forms.TextInput(attrs={'class':'name-autocomplete'}),help_text="To see a list of people type the first name, or last name, or both.")
    email = forms.CharField(widget=forms.Select(),help_text="Select an email.")

    # check for id within parenthesis to ensure name was selected from the list
    def clean_person(self):
        person = self.cleaned_data.get('person', '')
        m = re.search(r'(\d+)', person)
        if person and not m:
            raise forms.ValidationError("You must select an entry from the list!")

        # return person object
        return get_person(person)

    # check that email exists and return the Email object
    def clean_email(self):
        email = self.cleaned_data['email']
        try:
            obj = Email.objects.get(address=email)
        except Email.ObjectDoesNoExist:
            raise forms.ValidationError("Email address not found!")

        # return email object
        return obj

class EditModelForm(forms.ModelForm):
    #expiration_date = forms.DateField(required=False)
    state = forms.ModelChoiceField(queryset=State.objects.filter(type='draft'),empty_label=None)
    iesg_state = forms.ModelChoiceField(queryset=State.objects.filter(type='draft-iesg'),required=False)
    group = GroupModelChoiceField(required=True)
    review_by_rfc_editor = forms.BooleanField(required=False)
    shepherd = SearchableEmailField(required=False, only_users=True)

    class Meta:
        model = Document
        fields = ('title','group','ad','shepherd','notify','stream','review_by_rfc_editor','name','rev','pages','intended_std_level','std_level','abstract','internal_comments')

    # use this method to set attrs which keeps other meta info from model.
    def __init__(self, *args, **kwargs):
        super(EditModelForm, self).__init__(*args, **kwargs)
        self.fields['ad'].queryset = Person.objects.filter(role__name='ad').distinct()
        self.fields['title'].label='Document Name'
        self.fields['title'].widget=forms.Textarea()
        self.fields['rev'].widget.attrs['size'] = 2
        self.fields['abstract'].widget.attrs['cols'] = 72
        self.initial['state'] = self.instance.get_state().pk
        if self.instance.get_state('draft-iesg'):
            self.initial['iesg_state'] = self.instance.get_state('draft-iesg').pk

        # setup special fields
        if self.instance:
            # setup replaced
            self.fields['review_by_rfc_editor'].initial = bool(self.instance.tags.filter(slug='rfc-rev'))

    def save(self, force_insert=False, force_update=False, commit=True):
        m = super(EditModelForm, self).save(commit=False)
        state = self.cleaned_data['state']
        iesg_state = self.cleaned_data['iesg_state']

        if 'state' in self.changed_data:
            m.set_state(state)

        # note we're not sending notices here, is this desired
        if 'iesg_state' in self.changed_data:
            if iesg_state == None:
                m.unset_state('draft-iesg')
            else:
                m.set_state(iesg_state)

        if 'review_by_rfc_editor' in self.changed_data:
            if self.cleaned_data.get('review_by_rfc_editor',''):
                m.tags.add('rfc-rev')
            else:
                m.tags.remove('rfc-rev')

        m.time = datetime.datetime.now()
        # handle replaced by

        if commit:
            m.save()
        return m

    # field must contain filename of existing draft
    def clean_replaced_by(self):
        name = self.cleaned_data.get('replaced_by', '')
        if name and not Document.objects.filter(name=name):
            raise forms.ValidationError("ERROR: Draft does not exist")
        return name

    def clean(self):
        super(EditModelForm, self).clean()
        cleaned_data = self.cleaned_data
        """
        expiration_date = cleaned_data.get('expiration_date','')
        status = cleaned_data.get('status','')
        replaced = cleaned_data.get('replaced',False)
        replaced_by = cleaned_data.get('replaced_by','')
        replaced_status_object = IDStatus.objects.get(status_id=5)
        expired_status_object = IDStatus.objects.get(status_id=2)
        # this condition seems to be valid
        #if expiration_date and status != expired_status_object:
        #    raise forms.ValidationError('Expiration Date set but status is %s' % (status))
        if status == expired_status_object and not expiration_date:
            raise forms.ValidationError('Status is Expired but Expirated Date is not set')
        if replaced and status != replaced_status_object:
            raise forms.ValidationError('You have checked Replaced but status is %s' % (status))
        if replaced and not replaced_by:
            raise forms.ValidationError('You have checked Replaced but Replaced By field is empty')
        """
        return cleaned_data

class EmailForm(forms.Form):
    # max_lengths come from db limits, cc is not limited
    to = forms.CharField(max_length=255)
    cc = forms.CharField(required=False)
    subject = forms.CharField(max_length=255)
    body = forms.CharField(widget=forms.Textarea())

class ExtendForm(forms.Form):
    expiration_date = forms.DateField()

class ReplaceForm(forms.Form):
    replaced = AliasModelChoiceField(DocAlias.objects.none(),empty_label=None,help_text='This document may have more than one alias.  Be sure to select the correct alias to replace.')
    replaced_by = forms.CharField(max_length=100,help_text='Enter the filename of the Draft which replaces this one.')

    def __init__(self, *args, **kwargs):
        self.draft = kwargs.pop('draft')
        super(ReplaceForm, self).__init__(*args, **kwargs)
        self.fields['replaced'].queryset = DocAlias.objects.filter(document=self.draft)

    # field must contain filename of existing draft
    def clean_replaced_by(self):
        name = self.cleaned_data.get('replaced_by', '')
        try:
            doc = Document.objects.get(name=name)
        except Document.DoesNotExist:
            raise forms.ValidationError("ERROR: Draft does not exist: %s" % name)
        if name == self.draft.name:
            raise forms.ValidationError("ERROR: A draft can't replace itself")
        return doc

class BaseRevisionModelForm(forms.ModelForm):
    class Meta:
        model = Document
        fields = ('title','pages','abstract')

class RevisionModelForm(forms.ModelForm):
    class Meta:
        model = Document
        fields = ('title','pages','abstract')

    # use this method to set attrs which keeps other meta info from model.
    def __init__(self, *args, **kwargs):
        super(RevisionModelForm, self).__init__(*args, **kwargs)
        self.fields['title'].label='Document Name'
        self.fields['title'].widget=forms.Textarea()
        self.fields['pages'].label='Number of Pages'

class RfcModelForm(forms.ModelForm):
    rfc_number = forms.IntegerField()
    rfc_published_date = forms.DateField(initial=datetime.datetime.now)
    group = GroupModelChoiceField(required=True)

    class Meta:
        model = Document
        fields = ('title','group','pages','std_level','internal_comments')

    # use this method to set attrs which keeps other meta info from model.
    def __init__(self, *args, **kwargs):
        super(RfcModelForm, self).__init__(*args, **kwargs)
        self.fields['title'].widget = forms.Textarea()
        self.fields['std_level'].required = True

    def save(self, force_insert=False, force_update=False, commit=True):
        obj = super(RfcModelForm, self).save(commit=False)

        # create DocAlias
        DocAlias.objects.create(document=self.instance,name="rfc%d" % self.cleaned_data['rfc_number'])

        if commit:
            obj.save()
        return obj

    def clean_rfc_number(self):
        rfc_number = self.cleaned_data['rfc_number']
        if DocAlias.objects.filter(name='rfc' + str(rfc_number)):
            raise forms.ValidationError("RFC %d already exists" % rfc_number)
        return rfc_number

class RfcObsoletesForm(forms.Form):
    relation = forms.ModelChoiceField(queryset=DocRelationshipName.objects.filter(slug__in=('updates','obs')),required=False)
    rfc = forms.IntegerField(required=False)

    # ensure that RFC exists
    def clean_rfc(self):
        rfc = self.cleaned_data.get('rfc','')
        if rfc:
            if not Document.objects.filter(docalias__name="rfc%s" % rfc):
                raise forms.ValidationError("RFC does not exist")
        return rfc

    def clean(self):
        super(RfcObsoletesForm, self).clean()
        cleaned_data = self.cleaned_data
        relation = cleaned_data.get('relation','')
        rfc = cleaned_data.get('rfc','')
        if (relation and not rfc) or (rfc and not relation):
            raise forms.ValidationError('You must select a relation and enter RFC #')
        return cleaned_data

class SearchForm(forms.Form):
    intended_std_level = forms.ModelChoiceField(queryset=IntendedStdLevelName.objects,label="Intended Status",required=False)
    document_title = forms.CharField(max_length=80,label='Document Title',required=False)
    group = forms.CharField(max_length=12,required=False)
    filename = forms.CharField(max_length=80,required=False)
    state = forms.ModelChoiceField(queryset=State.objects.filter(type='draft'),required=False)
    revision_date_start = forms.DateField(label='Revision Date (start)',required=False)
    revision_date_end = forms.DateField(label='Revision Date (end)',required=False)

class UploadForm(forms.Form):
    txt = DocumentField(label=u'.txt format', required=True,extension='.txt',filename=None,rev=None)
    xml = DocumentField(label=u'.xml format', required=False,extension='.xml',filename=None,rev=None)
    pdf = DocumentField(label=u'.pdf format', required=False,extension='.pdf',filename=None,rev=None)
    ps = DocumentField(label=u'.ps format', required=False,extension='.ps',filename=None,rev=None)

    def __init__(self, *args, **kwargs):
        if 'draft' in kwargs:
            self.draft = kwargs.pop('draft')
        else:
            self.draft = None
        super(UploadForm, self).__init__(*args, **kwargs)
        if self.draft:
            for field in self.fields.itervalues():
                field.filename = self.draft.name
                field.rev = self.draft.rev

    def clean(self):
        # Checks that all files have the same base
        if any(self.errors):
            # Don't bother validating unless each field is valid on its own
            return
        txt = self.cleaned_data['txt']
        xml = self.cleaned_data['xml']
        pdf = self.cleaned_data['pdf']
        ps = self.cleaned_data['ps']

        # we only need to do these validations for new drafts
        if not self.draft:
            names = []
            for file in (txt,xml,pdf,ps):
                if file:
                    base = os.path.splitext(file.name)[0]
                    if base not in names:
                        names.append(base)

            if len(names) > 1:
                raise forms.ValidationError, "All files must have the same base name"

            # ensure that the basename is unique
            base = os.path.splitext(txt.name)[0]
            if Document.objects.filter(name=base[:-3]):
                raise forms.ValidationError, "This document filename already exists: %s" % base[:-3]

            # ensure that rev is 00
            if base[-2:] != '00':
                raise forms.ValidationError, "New Drafts must start with 00 revision number."

        return self.cleaned_data

class WithdrawForm(forms.Form):
    type = forms.CharField(widget=forms.Select(choices=WITHDRAW_CHOICES),help_text='Select which type of withdraw to perform.')


text:
package org.apache.kylin.engine.mr.invertedindex;

import java.io.IOException;

import org.apache.commons.cli.Options;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
import org.apache.hadoop.util.ToolRunner;
import org.apache.kylin.common.KylinConfig;
import org.apache.kylin.engine.mr.IMRInput;
import org.apache.kylin.engine.mr.MRUtil;
import org.apache.kylin.engine.mr.common.AbstractHadoopJob;
import org.apache.kylin.engine.mr.common.BatchConstants;
import org.apache.kylin.invertedindex.IIInstance;
import org.apache.kylin.invertedindex.IIManager;
import org.apache.kylin.invertedindex.IISegment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 */
public class InvertedIndexJob extends AbstractHadoopJob {
    protected static final Logger logger = LoggerFactory.getLogger(InvertedIndexJob.class);

    @Override
    public int run(String[] args) throws Exception {
        Options options = new Options();

        try {
            options.addOption(OPTION_JOB_NAME);
            options.addOption(OPTION_II_NAME);
            options.addOption(OPTION_OUTPUT_PATH);
            parseOptions(options, args);

            job = Job.getInstance(getConf(), getOptionValue(OPTION_JOB_NAME));
            String iiname = getOptionValue(OPTION_II_NAME);
            Path output = new Path(getOptionValue(OPTION_OUTPUT_PATH));

            // ----------------------------------------------------------------------------

            logger.info("Starting: " + job.getJobName());

            IIInstance ii = getII(iiname);
            short sharding = ii.getDescriptor().getSharding();

            setJobClasspath(job);

            setupMapper(ii.getFirstSegment());
            setupReducer(output, sharding);
            attachMetadata(ii);

            return waitForCompletion(job);

        } catch (Exception e) {
            printUsage(options);
            throw e;
        } finally {
            if (job != null)
                cleanupTempConfFile(job.getConfiguration());
        }

    }

    private IIInstance getII(String iiName) {
        IIManager mgr = IIManager.getInstance(KylinConfig.getInstanceFromEnv());
        IIInstance ii = mgr.getII(iiName);
        if (ii == null)
            throw new IllegalArgumentException("No Inverted Index found by name " + iiName);
        return ii;
    }

    private void attachMetadata(IIInstance ii) throws IOException {

        Configuration conf = job.getConfiguration();
        attachKylinPropsAndMetadata(ii, conf);

        IISegment seg = ii.getFirstSegment();
        conf.set(BatchConstants.CFG_II_NAME, ii.getName());
        conf.set(BatchConstants.CFG_II_SEGMENT_NAME, seg.getName());
    }

    private void setupMapper(IISegment segment) throws IOException {

        IMRInput.IMRTableInputFormat flatTableInputFormat = MRUtil.getBatchCubingInputSide(segment).getFlatTableInputFormat();
        flatTableInputFormat.configureJob(job);

        job.setMapperClass(InvertedIndexMapper.class);
        job.setMapOutputKeyClass(LongWritable.class);
        job.setPartitionerClass(InvertedIndexPartitioner.class);
    }

    private void setupReducer(Path output, short sharding) throws IOException {
        job.setReducerClass(InvertedIndexReducer.class);
        job.setOutputFormatClass(SequenceFileOutputFormat.class);
        job.setOutputKeyClass(ImmutableBytesWritable.class);
        job.setOutputValueClass(ImmutableBytesWritable.class);

        job.setNumReduceTasks(sharding);

        FileOutputFormat.setOutputPath(job, output);

        job.getConfiguration().set(BatchConstants.CFG_OUTPUT_PATH, output.toString());

        deletePath(job.getConfiguration(), output);
    }

    public static void main(String[] args) throws Exception {
        InvertedIndexJob job = new InvertedIndexJob();
        int exitCode = ToolRunner.run(job, args);
        System.exit(exitCode);
    }
}


text:
require 'google/apis/games_configuration_v1configuration/service.rb'
require 'google/apis/games_configuration_v1configuration/classes.rb'
require 'google/apis/games_configuration_v1configuration/representations.rb'
require 'google/apis/games_configuration_v1configuration/gem_version.rb'

module Google
  module Apis
    # Google Play Game Services Publishing API
    #
    # The Google Play Game Services Publishing API allows developers to configure
    # their games in Game Services.
    #
    # @see https://developers.google.com/games/
    module GamesConfigurationV1configuration
      # Version of the Google Play Game Services Publishing API this client connects to.
      # This is NOT the gem version.
      VERSION = 'V1configuration'

      # View and manage your Google Play Developer account
      AUTH_ANDROIDPUBLISHER = 'https://www.googleapis.com/auth/androidpublisher'
    end
  end
end