text:
<?php
namespace Elastica\Test\Aggregation;

use Elastica\Aggregation\Min;
use Elastica\Document;
use Elastica\Query;

class MinTest extends BaseAggregationTest
{
    protected function _getIndexForTest()
    {
        $index = $this->_createIndex();

        $index->getType('test')->addDocuments([
            new Document(1, ['price' => 5]),
            new Document(2, ['price' => 8]),
            new Document(3, ['price' => 1]),
            new Document(4, ['price' => 3]),
        ]);

        $index->refresh();

        return $index;
    }

    /**
     * @group functional
     */
    public function testMinAggregation()
    {
        $agg = new Min('min_price');
        $agg->setField('price');

        $query = new Query();
        $query->addAggregation($agg);
        $results = $this->_getIndexForTest()->search($query)->getAggregation('min_price');

        $this->assertEquals(1, $results['value']);
    }
}


text:
namespace Zirpl.FluentReflection.Queries
{
    internal sealed class AccessibilityCriteriaBuilder :
        IAccessibilityCriteriaBuilder,
        ICSharpAccessibilityCriteriaBuilder
    {
        private readonly AccessibilityCriteria _memberAccessibilityCriteria;

        internal AccessibilityCriteriaBuilder(AccessibilityCriteria memberAccessibilityCriteria)
        {
            _memberAccessibilityCriteria = memberAccessibilityCriteria;
        }

        ICSharpAccessibilityCriteriaBuilder IAccessibilityCriteriaBuilder.CSharp()
        {
            return this;
        }

        ICSharpAccessibilityCriteriaBuilder ICSharpAccessibilityCriteriaBuilder.Public()
        {
            _memberAccessibilityCriteria.Public = true;
            return this;
        }

        ICSharpAccessibilityCriteriaBuilder ICSharpAccessibilityCriteriaBuilder.Private()
        {
            _memberAccessibilityCriteria.Private = true;
            return this;
        }

        ICSharpAccessibilityCriteriaBuilder ICSharpAccessibilityCriteriaBuilder.Protected()
        {
            _memberAccessibilityCriteria.Family = true;
            return this;
        }

        ICSharpAccessibilityCriteriaBuilder ICSharpAccessibilityCriteriaBuilder.Internal()
        {
            _memberAccessibilityCriteria.Assembly = true;
            return this;
        }

        ICSharpAccessibilityCriteriaBuilder ICSharpAccessibilityCriteriaBuilder.ProtectedOrInternal()
        {
            _memberAccessibilityCriteria.FamilyOrAssembly = true;
            return this;
        }

        public void NotPrivate()
        {
            _memberAccessibilityCriteria.Public = true;
            _memberAccessibilityCriteria.Family = true;
            _memberAccessibilityCriteria.Assembly = true;
            _memberAccessibilityCriteria.FamilyOrAssembly = true;
        }

        public void NotPublic()
        {
            _memberAccessibilityCriteria.Private = true;
            _memberAccessibilityCriteria.Family = true;
            _memberAccessibilityCriteria.Assembly = true;
            _memberAccessibilityCriteria.FamilyOrAssembly = true;
        }

        public void All()
        {
            _memberAccessibilityCriteria.Public = true;
            _memberAccessibilityCriteria.Private = true;
            _memberAccessibilityCriteria.Family = true;
            _memberAccessibilityCriteria.Assembly = true;
            _memberAccessibilityCriteria.FamilyOrAssembly = true;
        }

        IAccessibilityCriteriaBuilder IAccessibilityCriteriaBuilder.Public()
        {
            _memberAccessibilityCriteria.Public = true;
            return this;
        }

        IAccessibilityCriteriaBuilder IAccessibilityCriteriaBuilder.Private()
        {
            _memberAccessibilityCriteria.Private = true;
            return this;
        }

        IAccessibilityCriteriaBuilder IAccessibilityCriteriaBuilder.Family()
        {
            _memberAccessibilityCriteria.Family = true;
            return this;
        }

        IAccessibilityCriteriaBuilder IAccessibilityCriteriaBuilder.Assembly()
        {
            _memberAccessibilityCriteria.Assembly = true;
            return this;
        }

        IAccessibilityCriteriaBuilder IAccessibilityCriteriaBuilder.FamilyOrAssembly()
        {
            _memberAccessibilityCriteria.FamilyOrAssembly = true;
            return this;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.flowable.cmmn.test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;

import java.util.Date;
import java.util.List;

import org.flowable.cmmn.engine.CmmnEngine;
import org.flowable.cmmn.engine.CmmnEngines;
import org.flowable.cmmn.engine.test.impl.CmmnJobTestHelper;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngineConfiguration;
import org.flowable.engine.impl.test.JobTestHelper;
import org.flowable.job.api.Job;
import org.flowable.job.service.JobServiceConfiguration;
import org.flowable.job.service.impl.asyncexecutor.AsyncExecutor;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * @author Joram Barrez
 */
public class CmmnEngineConfiguratorAsyncJobTest {

    private ProcessEngine processEngine;
    private CmmnEngine cmmnEngine;

    @Before
    public void setup() {
        processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("flowable.async.cfg.xml").buildProcessEngine();
        cmmnEngine = CmmnEngines.getDefaultCmmnEngine();
    }

    @After
    public void cleanup() {
        processEngine.getManagementService().createHistoryJobQuery().list()
            .forEach(historyJob -> processEngine.getManagementService().deleteHistoryJob(historyJob.getId()));

        cmmnEngine.close();
        processEngine.close();
    }

    @Test
    public void testSharedAsyncExecutor() throws Exception {
        // The async executor should be the same instance
        AsyncExecutor processEngineAsyncExecutor = processEngine.getProcessEngineConfiguration().getAsyncExecutor();
        AsyncExecutor cmmnEngineAsyncExecutor = cmmnEngine.getCmmnEngineConfiguration().getAsyncExecutor();
        assertNotNull(processEngineAsyncExecutor);
        assertNotNull(cmmnEngineAsyncExecutor);

        // Contrary to the asyncHistoryExecutor, the async executors are not shared between the engines (by default)
        assertNotSame(processEngineAsyncExecutor, cmmnEngineAsyncExecutor);

        assertNull(processEngineAsyncExecutor.getJobServiceConfiguration().getJobExecutionScope());
        assertEquals(JobServiceConfiguration.JOB_EXECUTION_SCOPE_CMMN, cmmnEngineAsyncExecutor.getJobServiceConfiguration().getJobExecutionScope());

        // Deploy and start test processes/cases
        // Trigger one plan item instance to start the process
        processEngine.getRepositoryService().createDeployment().addClasspathResource("org/flowable/cmmn/test/CmmnEngineConfiguratorAsyncJobTest.taskAndTimer.bpmn20.xml").deploy();
        cmmnEngine.getCmmnRepositoryService().createDeployment().addClasspathResource("org/flowable/cmmn/test/CmmnEngineConfiguratorAsyncJobTest.processAndTimer.cmmn.xml").deploy();

        // Starting the case instance starts the process task. The process has an async job at the beginning
        cmmnEngine.getCmmnRuntimeService().createCaseInstanceBuilder().caseDefinitionKey("timerAndProcess").start();
        Job job = processEngine.getManagementService().createJobQuery().singleResult();
        assertNull(job.getScopeType());
        JobTestHelper.waitForJobExecutorToProcessAllJobs(processEngine.getProcessEngineConfiguration(), processEngine.getManagementService(), 10000L, 100L);

        // There should now be two timers, one for the case and one for the process
        List<Job> timerJobs = processEngine.getManagementService().createTimerJobQuery().list();
        timerJobs.forEach(timerJob -> {
            if (timerJob.getScopeId() != null) { // cmmn
                assertEquals(JobServiceConfiguration.JOB_EXECUTION_SCOPE_CMMN, timerJob.getScopeType());
            } else {
                assertNull(timerJob.getScopeType());
            }

            processEngine.getManagementService().moveTimerToExecutableJob(timerJob.getId());
        });

        // Can't use the JobTestHelper's, so manually starting the executors
        processEngineAsyncExecutor.start();
        cmmnEngineAsyncExecutor.start();

        try {
            long startTime = new Date().getTime();
            while (processEngine.getManagementService().createJobQuery().count() > 0
                    && (new Date().getTime() - startTime > 10000)) {
                Thread.sleep(100L);
            }
        } finally {
            processEngineAsyncExecutor.shutdown();
            cmmnEngineAsyncExecutor.shutdown();
        }

        // There should be one user task which is async (from the case)
        job = processEngine.getManagementService().createJobQuery().singleResult();
        assertEquals(JobServiceConfiguration.JOB_EXECUTION_SCOPE_CMMN, job.getScopeType());
        CmmnJobTestHelper.waitForJobExecutorToProcessAllJobs(cmmnEngine, 10000L, 100L, true);

        // There should be two user tasks now: one after the timer of the case and one after the timer of the process
        assertEquals(2, processEngine.getTaskService().createTaskQuery().count());
        assertEquals(2, cmmnEngine.getCmmnTaskService().createTaskQuery().count());

    }

}


text:
import React from 'react';

import { mount } from 'enzyme';

import * as keys from '../../src/keys';

import DayPickerInput, { HIDE_TIMEOUT } from '../../src/DayPickerInput';
import DayPicker from '../../src/DayPicker';

describe('DayPickerInput', () => {
  describe('events', () => {
    describe('click', () => {
      it('should show the overlay when the input is clicked', () => {
        const wrapper = mount(<DayPickerInput />);
        wrapper.find('input').simulate('click');
        expect(wrapper.find('.DayPicker')).toBeDefined();
      });
      it('should call `onClick` event handler', () => {
        const onClick = jest.fn();
        const wrapper = mount(<DayPickerInput onClick={onClick} />);
        wrapper.find('input').simulate('click');
        expect(onClick).toHaveBeenCalledTimes(1);
      });
    });

    describe('focus', () => {
      it('should show the overlay when the input is focused', () => {
        const wrapper = mount(<DayPickerInput />);
        wrapper.find('input').simulate('focus');
        expect(wrapper.find('.DayPicker')).toBeDefined();
      });
      it('should call `onFocus` event handler', () => {
        const onFocus = jest.fn();
        const wrapper = mount(<DayPickerInput onFocus={onFocus} />);
        wrapper.find('input').simulate('focus');
        expect(onFocus).toHaveBeenCalledTimes(1);
      });
    });

    describe('blur', () => {
      it('should hide the overlay when the input is blurred', () => {
        const wrapper = mount(<DayPickerInput value="12/15/2017" />);
        wrapper.find('input').simulate('focus');
        wrapper.find('input').simulate('blur');
        expect(wrapper.find('.DayPicker')).toHaveLength(0);
      });
      it('should call `onBlur` event handler', () => {
        const onBlur = jest.fn();
        const wrapper = mount(<DayPickerInput onBlur={onBlur} />);
        wrapper.find('input').simulate('blur');
        expect(onBlur).toHaveBeenCalledTimes(1);
      });
      it('should focus the input if blur after clicking the overlay', () => {
        const wrapper = mount(<DayPickerInput />);
        wrapper.find('.DayPickerInput').simulate('mousedown');
        const instance = wrapper.instance();
        expect(instance.clickedInside).toBe(true);
        expect(instance.clickTimeout).not.toBeNull();
        wrapper.find('input').simulate('blur');
        expect(document.activeElement).toEqual(instance.input);
      });
    });

    describe('change', () => {
      it('should call `onChange` event handler', () => {
        const onChange = jest.fn();
        const wrapper = mount(<DayPickerInput onChange={onChange} />);
        wrapper.find('input').simulate('change');
        expect(onChange).toHaveBeenCalledTimes(1);
      });
      it('should update the input if its value is empty', () => {
        const wrapper = mount(<DayPickerInput />);
        wrapper.find('input').simulate('change', { target: { value: ' ' } });
        wrapper.update();
        expect(wrapper.find('input')).toHaveProp('value', ' ');
      });
      it("should call `onDayChange` if the input's value is empty", () => {
        const onDayChange = jest.fn();
        const wrapper = mount(<DayPickerInput onDayChange={onDayChange} />);
        const input = wrapper.find('input');
        input.simulate('change', { target: { value: '' } });
        expect(onDayChange).toHaveBeenCalledWith(undefined, {});
      });
      it("should update the input's value if the value is not a valid date", () => {
        const wrapper = mount(<DayPickerInput />);
        const input = wrapper.find('input');
        input.simulate('change', { target: { value: 'foo' } });
        expect(wrapper.find('input')).toHaveProp('value', 'foo');
      });
      it('should not call `onDayChange` if the value is not a valid date', () => {
        const onDayChange = jest.fn();
        const wrapper = mount(<DayPickerInput onDayChange={onDayChange} />);
        const input = wrapper.find('input');
        input.simulate('change', { target: { value: 'foo' } });
        expect(onDayChange).not.toHaveBeenCalled();
      });
      it("should update the input's value and the displayed month", () => {
        const wrapper = mount(<DayPickerInput />);
        const input = wrapper.find('input');
        wrapper.instance().showDayPicker();
        wrapper.update();
        input.simulate('change', { target: { value: '12/16/2013' } });
        expect(wrapper.find('.DayPicker-Caption').first()).toHaveText(
          'December 2013'
        );
        input.simulate('change', { target: { value: '11/10/2015' } });
        expect(wrapper.find('.DayPicker-Caption').first()).toHaveText(
          'November 2015'
        );
      });
      it('should call `onDayChange` with modifiers', () => {
        const onDayChange = jest.fn();
        const testDay = new Date(2015, 11, 20);
        const wrapper = mount(
          <DayPickerInput
            dayPickerProps={{
              modifiers: { foo: testDay },
              selectedDays: testDay,
              disabledDays: testDay,
            }}
            onDayChange={onDayChange}
          />
        );
        const input = wrapper.find('input');
        wrapper.instance().showDayPicker();
        wrapper.update();
        input.simulate('change', { target: { value: '12/20/2015' } });
        expect(onDayChange).toHaveBeenCalledTimes(1);
        expect(onDayChange.mock.calls[0][0].format('L')).toBe('12/20/2015');
        expect(onDayChange.mock.calls[0][1]).toEqual({
          foo: true,
          selected: true,
          disabled: true,
        });
      });
    });
    describe('keyup', () => {
      it('should hide the overlay on ESC', () => {
        const wrapper = mount(<DayPickerInput />);
        wrapper.instance().showDayPicker();
        wrapper.update();
        wrapper.find('input').simulate('keyup', { keyCode: keys.ESC });
        expect(wrapper.state('showOverlay')).toBe(false);
      });
      it('should call `onKeyUp` event handler', () => {
        const onKeyUp = jest.fn();
        const wrapper = mount(<DayPickerInput onKeyUp={onKeyUp} />);
        wrapper.find('input').simulate('keyup');
        expect(onKeyUp).toHaveBeenCalledTimes(1);
      });
    });
    describe('dayclick', () => {
      it('should call `onDayClick` event handler', () => {
        const onDayClick = jest.fn();
        const wrapper = mount(
          <DayPickerInput dayPickerProps={{ onDayClick }} />
        );
        wrapper.instance().showDayPicker();
        wrapper.update();
        wrapper
          .find('.DayPicker-Day')
          .at(6)
          .simulate('click');
        expect(onDayClick).toHaveBeenCalledTimes(1);
      });
      it('should select and display the clicked day', () => {
        const wrapper = mount(
          <DayPickerInput dayPickerProps={{ month: new Date(2017, 1) }} />
        );
        wrapper.instance().showDayPicker();
        wrapper.update();
        wrapper
          .find('.DayPicker-Day')
          .at(10)
          .simulate('click');
        expect(wrapper.find('input')).toHaveProp('value', '02/08/2017');
        expect(wrapper.find('.DayPicker-Caption')).toHaveText('February 2017');
        expect(wrapper.find('.DayPicker-Day--selected')).toHaveText('8');
      });
      it('should call `onDayChange` when clicking on a day', () => {
        const onDayChange = jest.fn();
        const wrapper = mount(
          <DayPickerInput
            onDayChange={onDayChange}
            dayPickerProps={{
              month: new Date(2017, 1),
              modifiers: { foo: new Date(2017, 1, 8) },
            }}
          />
        );
        wrapper.instance().showDayPicker();
        wrapper.update();
        wrapper
          .find('.DayPicker-Day')
          .at(10)
          .simulate('click');
        expect(onDayChange.mock.calls[0][0].format('L')).toBe('02/08/2017');
        expect(onDayChange.mock.calls[0][1]).toEqual({ foo: true });
      });
      it('should work also when `format` is an array', () => {
        const onDayChange = jest.fn();
        const wrapper = mount(
          <DayPickerInput
            onDayChange={onDayChange}
            format={['L', 'LL']}
            dayPickerProps={{
              month: new Date(2017, 1),
            }}
          />
        );
        wrapper.instance().showDayPicker();
        wrapper.update();
        wrapper
          .find('.DayPicker-Day')
          .at(10)
          .simulate('click');
        expect(onDayChange.mock.calls[0][0].format('L')).toBe('02/08/2017');
      });
      it('should hide the day picker when clicking on a day', done => {
        const wrapper = mount(<DayPickerInput />);
        wrapper.instance().showDayPicker();
        wrapper.update();
        wrapper
          .find('.DayPicker-Day')
          .at(10)
          .simulate('click');
        expect(wrapper.instance().hideTimeout).not.toBeNull();
        setTimeout(() => {
          wrapper.update();
          expect(wrapper.find(DayPicker)).toHaveLength(0);
          done();
        }, HIDE_TIMEOUT + 50);
      });
      it('should not hide the day picker if `hideOnDayClick` is false', () => {
        const wrapper = mount(<DayPickerInput hideOnDayClick={false} />);
        wrapper.instance().showDayPicker();
        wrapper.update();
        wrapper
          .find('.DayPicker-Day')
          .at(10)
          .simulate('click');
        expect(wrapper.instance().hideTimeout).toBeNull();
        expect(wrapper.find('.DayPicker')).toBeDefined();
      });
      it('should unselect the clicked day if already selected', () => {
        const wrapper = mount(
          <DayPickerInput
            value="02/08/2017"
            clickUnselectsDay
            dayPickerProps={{
              month: new Date(2017, 1),
              selectedDays: new Date(2017, 1, 8),
            }}
          />
        );
        wrapper.instance().showDayPicker();
        wrapper.update();
        wrapper
          .find('.DayPicker-Day')
          .at(10)
          .simulate('click');
        expect(wrapper.find('input')).toHaveProp('value', '');
        expect(wrapper.find('.DayPicker-Day--selected')).toHaveLength(0);
      });
      it('should call `onDayChange` when clicking a selected day', () => {
        const onDayChange = jest.fn();
        const wrapper = mount(
          <DayPickerInput
            value="02/08/2017"
            onDayChange={onDayChange}
            clickUnselectsDay
            dayPickerProps={{
              month: new Date(2017, 1),
              selectedDays: new Date(2017, 1, 8),
              modifiers: { foo: new Date(2017, 1, 8) },
            }}
          />
        );
        wrapper.instance().showDayPicker();
        wrapper.update();
        wrapper
          .find('.DayPicker-Day')
          .at(10)
          .simulate('click');
        expect(onDayChange).toHaveBeenCalledWith(undefined, {
          selected: true,
          foo: true,
        });
      });
      it('should not call `onDayChange` if the day is disabled', () => {
        const onDayChange = jest.fn();
        const wrapper = mount(
          <DayPickerInput
            value="02/08/2017"
            onDayChange={onDayChange}
            dayPickerProps={{
              month: new Date(2017, 1),
              disabledDays: new Date(2017, 1, 8),
            }}
          />
        );
        wrapper.instance().showDayPicker();
        wrapper.update();
        wrapper
          .find('.DayPicker-Day')
          .at(10)
          .simulate('click');
        expect(onDayChange).not.toHaveBeenCalled();
      });
    });
  });
});


text:
// -*- C++ -*-

//=============================================================================
/**
 *  @file   LogRecordStore.h
 *
 *  $Id: LogRecordStore.h 935 2008-12-10 21:47:27Z mitza $
 *
 *  @author Matthew Braun <mjb2@cs.wustl.edu>
 *  @author Pradeep Gore <pradeep@cs.wustl.edu>
 *  @author David A. Hanvey <d.hanvey@qub.ac.uk>
 */
//=============================================================================

#ifndef TAO_LOG_RECORD_STORE_H
#define TAO_LOG_RECORD_STORE_H

#include /**/ "ace/pre.h"
#include /**/ "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "orbsvcs/DsLogAdminC.h"
#include "orbsvcs/Log/log_serv_export.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @class TAO_LogRecordStore
 *
 * @brief Abstract base class for storing DsLogAdmin::LogRecord's
 *
 * Implements a Table Data Gateway(144) for log records, and a Row
 * Data Gateway(152) for log channel parameters.
 */
class TAO_Log_Serv_Export TAO_LogRecordStore
{
 public:

  // = Initialization and termination methods

  /// Destructor.
  virtual ~TAO_LogRecordStore (void);

  /// Initialization.
  virtual int open (void) = 0;

  /// Close the record store.
  virtual int close (void) = 0;

  // = Log Parameters

  /// Gets the administrative state of the log
  virtual DsLogAdmin::AdministrativeState
    get_administrative_state (void) const = 0;

  /// Sets the administrative state of the log
  virtual void
    set_administrative_state (DsLogAdmin::AdministrativeState state) = 0;

  /// Get the capacity alarm thresholds
  virtual DsLogAdmin::CapacityAlarmThresholdList*
    get_capacity_alarm_thresholds (void) const = 0;

  /// Set the capacity alarm thresholds
  virtual void
    set_capacity_alarm_thresholds (const DsLogAdmin::CapacityAlarmThresholdList& thresholds) = 0;

  /// Gets the forwarding state
  virtual DsLogAdmin::ForwardingState
    get_forwarding_state (void) const = 0;

  /// Sets the forwarding state
  virtual void
    set_forwarding_state (DsLogAdmin::ForwardingState state) = 0;

  /// Get the log duration
  virtual DsLogAdmin::TimeInterval get_interval (void) const = 0;

  /// Set the log duration.
  virtual void
    set_interval (const DsLogAdmin::TimeInterval& interval) = 0;

  /// Get the log full action
  virtual DsLogAdmin::LogFullActionType
    get_log_full_action (void) const = 0;

  /// Set the log full action
  virtual void
    set_log_full_action(DsLogAdmin::LogFullActionType action) = 0;

  /// Get the list of the QoS properties supported by the log.
  virtual DsLogAdmin::QoSList*
    get_log_qos (void) const = 0;

  /// Set the list of the QoS properties supported by the log.
  virtual void
    set_log_qos (const DsLogAdmin::QoSList& qos) = 0;

  /// Gets the max record life
  virtual CORBA::ULong
    get_max_record_life (void) const = 0;

  /// Sets the max record life
  virtual void
    set_max_record_life (CORBA::ULong life) = 0;

  /// Get the current set value of the max size of the log data.
  virtual CORBA::ULongLong
    get_max_size (void) const = 0;

  /// Set the max size of log data. size == 0, => infinite.
  virtual void
    set_max_size (CORBA::ULongLong size) = 0;

  /// Get the weekly scheduling parameters
  virtual DsLogAdmin::WeekMask*
    get_week_mask (void) = 0;

  /// Set the weekly scheduling parameters.
  virtual void
    set_week_mask (const DsLogAdmin::WeekMask& masks) = 0;

  // = LogRecordStore status methods

  /// Gets the current size of the log data.
  virtual CORBA::ULongLong
    get_current_size (void) = 0;

  /// Get the number of records in the log right now.
  virtual CORBA::ULongLong
    get_n_records (void) = 0;

  // = LogRecordStore gauge

  /// Gets the current value of the "gauge" that measures the total
  /// size of the records written to the log.
  virtual CORBA::ULongLong
    get_gauge(void) = 0;

  /// Resets the "gauge" to 0
  virtual void
    reset_gauge(void) = 0;

  // = Record logging, retrieval, update and removal methods.

  /// Insert rec into storage.
  /// Returns 0 on success -1 on failure and 1 if the log is full.
  virtual int
    log (const DsLogAdmin::LogRecord &rec) = 0;

  /// Deletes "old" records from the store.
  virtual int
    purge_old_records (void) = 0;

  /// Set single record attributes.
  virtual void
    set_record_attribute (DsLogAdmin::RecordId id,
                          const DsLogAdmin::NVList & attr_list) = 0;

  /// Set the attributes of all records that matches the
  /// constraints with same attr_list.
  virtual CORBA::ULong
    set_records_attribute (const char * grammar,
                           const char * c,
                           const DsLogAdmin::NVList & attr_list) = 0;

  /// Get the attributes of the record with id <id>. Raises
  /// DsLogAdmin::InvalidRecordId
  virtual DsLogAdmin::NVList*
    get_record_attribute (DsLogAdmin::RecordId id) = 0;

  /// Ensure changes have been flushed to persistent media
  /// Returns 0 on success, -1 on failure
  virtual int
    flush (void) = 0;

  /// Returns all records in the log that match the given constraint
  /// <c>.
  virtual DsLogAdmin::RecordList*
    query (const char * grammar,
           const char * c,
           DsLogAdmin::Iterator_out i) = 0;

  /// Retrieve <how_many> records from time <from_time> using iterator
  /// <i>.
  virtual DsLogAdmin::RecordList*
    retrieve (DsLogAdmin::TimeT from_time,
              CORBA::Long how_many,
              DsLogAdmin::Iterator_out i) = 0;

  /// Returns the number of records matching constraint <c>.
  virtual CORBA::ULong
    match (const char * grammar,
           const char * c) = 0;

  /// Delete records matching constraint <c>.
  virtual CORBA::ULong
    delete_records (const char * grammar,
                    const char * c) = 0;

  /// Delete records matching ids in <ids>
  virtual CORBA::ULong
    delete_records_by_id (const DsLogAdmin::RecordIdList & ids) = 0;

  virtual CORBA::ULong
    remove_old_records (void) = 0;

  /// Read-Write Lock
  virtual ACE_SYNCH_RW_MUTEX& lock() = 0;

protected:
  /// Constructor.
  TAO_LogRecordStore (void);

private:
};

TAO_END_VERSIONED_NAMESPACE_DECL

#include /**/ "ace/post.h"
#endif /*TAO_LOG_RECORD_STORE_H*/


text:
using System;
using System.Collections.Generic;
using System.Text;
using Arch.CMessaging.Client.Newtonsoft.Json.Linq;

namespace Avro
{
    /// <summary>
    /// Class for map schemas
    /// </summary>
    public class MapSchema : UnnamedSchema
    {
        /// <summary>
        /// Schema for map values type
        /// </summary>
        public Schema ValueSchema { get; set; }

        public static MapSchema CreateMap(Schema type)
        {
            return new MapSchema(type,null);
        }

        /// <summary>
        /// Static function to return new instance of map schema
        /// </summary>
        /// <param name="jtok">JSON object for the map schema</param>
        /// <param name="names">list of named schemas already read</param>
        /// <param name="encspace">enclosing namespace of the map schema</param>
        /// <returns></returns>
        internal static MapSchema NewInstance(JToken jtok, PropertyMap props, SchemaNames names, string encspace)
        {
            JToken jvalue = jtok["values"];
            if (null == jvalue) throw new AvroTypeException("Map does not have 'values'");

            return new MapSchema(Schema.ParseJson(jvalue, names, encspace), props);
        }

        /// <summary>
        /// Constructor for map schema class
        /// </summary>
        /// <param name="valueSchema">schema for map values type</param>
        private MapSchema(Schema valueSchema, PropertyMap props) : base(Type.Map, props)
        {
            if (null == valueSchema) throw new ArgumentNullException("valueSchema", "valueSchema cannot be null.");
            this.ValueSchema = valueSchema;
        }

        /// <summary>
        /// Writes map schema in JSON format
        /// </summary>
        /// <param name="writer">JSON writer</param>
        /// <param name="names">list of named schemas already written</param>
        /// <param name="encspace">enclosing namespace of the map schema</param>
		protected internal override void WriteJsonFields(Arch.CMessaging.Client.Newtonsoft.Json.JsonTextWriter writer, SchemaNames names, string encspace)
        {
            writer.WritePropertyName("values");
            ValueSchema.WriteJson(writer, names, encspace);
        }

        /// <summary>
        /// Checks if this schema can read data written by the given schema. Used for decoding data.
        /// </summary>
        /// <param name="writerSchema">writer schema</param>
        /// <returns>true if this and writer schema are compatible based on the AVRO specification, false otherwise</returns>
        public override bool CanRead(Schema writerSchema)
        {
            if (writerSchema.Tag != Tag) return false;

            MapSchema that = writerSchema as MapSchema;
            return ValueSchema.CanRead(that.ValueSchema);
        }

        /// <summary>
        /// Compares equality of two map schemas
        /// </summary>
        /// <param name="obj">map schema to compare against this schema</param>
        /// <returns>true if two schemas are equal, false otherwise</returns>
        public override bool Equals(object obj)
        {
            if (this == obj) return true;

            if (obj != null && obj is MapSchema)
            {
                MapSchema that = obj as MapSchema;
                if (ValueSchema.Equals(that.ValueSchema))
                    return areEqual(that.Props, this.Props);
            }
            return false;
        }

        /// <summary>
        /// Hashcode function
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            return 29 * ValueSchema.GetHashCode() + getHashCode(Props);
        }
    }
}


text:
<?php

namespace AppBundle\Service\Crud\Helper;

use AppBundle\Service\Crud\Exception\EntityNotFound;
use AppBundle\Service\Crud\Strategy\Resolver;

/**
 * Trait provides a default behavior for classes, implementing \AppBundle\Service\Crud\DeleteInterface
 *
 * @author Alexandr Sibov<cyberdelia1987@gmail.com>
 * @method Resolver getStrategyResolver()
 */
trait DeleteTrait
{
    /**
     * @inheritdoc
     */
    public function delete($identity)
    {
        $this->getStrategyResolver()->delete($identity);
    }
}


text:
package org.gdl2.runtime;

import org.gdl2.cdshooks.Action;
import org.gdl2.cdshooks.Card;
import org.gdl2.cdshooks.Link;
import org.gdl2.datatypes.DvCodedText;
import org.gdl2.model.Guideline;
import org.hamcrest.Matchers;
import org.hl7.fhir.dstu3.model.Appointment;
import org.hl7.fhir.dstu3.model.Goal;
import org.hl7.fhir.dstu3.model.MedicationRequest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.testng.Assert.assertNotNull;

public class CreateCdsHooksCardsTest extends TestCommon {
    private Interpreter interpreter;
    private List<DataInstance> input;
    private List<Guideline> guidelines;

    @BeforeMethod
    public void setUp() {
        input = new ArrayList<>();
        interpreter = buildInterpreterWithFhirPluginAndCurrentDateTime("2013-04-20T14:00:00Z");
    }

    @Test
    public void can_create_cdshooks_card_single_suggestion_with_specific_reference_uuid_and_appointment_dates() throws Exception {
        guidelines = loadSingleGuideline("cdshooks_card_single_suggestion_test.v0.1.gdl2");
        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, input);
        assertThat(cardList.size(), is(1));
        Card card = cardList.get(0);
        assertThat(card.getSource().getLabel(), is("NICE guideline"));
        assertThat(card.getSource().getUrl().toString(), is("https://www.nice.org.uk/guidance/CG181"));
        assertThat(card.getSuggestions().size(), is(1));

        assertThat(card.getSuggestions().get(0).getUuid(), is(UUID.fromString("5f6ad92d-3b39-4766-831d-23586f7999e3")));
        assertThat(card.getSuggestions().get(0).getActions().get(0).getType(), is(Action.ActionType.CREATE));
        Object object = card.getSuggestions().get(0).getActions().get(0).getResource();
        assertThat("Appointment expected", object instanceof Appointment);
        Appointment appointment = (Appointment) object;
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        assertThat(appointment.getRequestedPeriod().get(0).getStart(), Matchers.is(dateFormat.parse("2013-04-20")));
        assertThat(appointment.getRequestedPeriod().get(0).getEnd(), Matchers.is(dateFormat.parse("2013-04-25")));
    }

    @Test
    public void can_create_cdshooks_card_with_english_term_text() throws Exception {
        guidelines = loadSingleGuideline("cdshooks_card_single_suggestion_term_text.gdl2");
        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, input);
        assertThat(cardList.size(), is(1));
        Card card = cardList.get(0);
        Object object = card.getSuggestions().get(0).getActions().get(0).getResource();
        assertThat("Appointment expected", object instanceof Appointment);
        Appointment appointment = (Appointment) object;
        assertThat(appointment.getDescription(), is("english text"));
    }

    @Test
    public void can_create_cdshooks_card_with_swedish_term_text() throws Exception {
        guidelines = loadSingleGuideline("cdshooks_card_single_suggestion_term_text.gdl2");
        interpreter = new Interpreter(
                RuntimeConfiguration.builder()
                        .currentDateTime(ZonedDateTime.now())
                        .language("sv")
                        .objectCreatorPlugin(new FhirDstu3ResourceCreator())
                        .build());
        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, input);
        assertThat(cardList.size(), is(1));
        Card card = cardList.get(0);
        Object object = card.getSuggestions().get(0).getActions().get(0).getResource();
        assertThat("Appointment expected", object instanceof Appointment);
        Appointment appointment = (Appointment) object;
        assertThat(appointment.getDescription(), is("svensk text"));
    }

    @Test
    public void can_create_cdshooks_card_with_referenced_link() throws Exception {
        guidelines = loadSingleGuideline("cdshooks_card_referenced_link_test.v0.1.gdl2");
        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, input);
        assertThat(cardList.size(), is(1));
        Card card = cardList.get(0);
        assertLink(card.getLinks().get(0), "NICE guideline", "https://www.nice.org.uk/guidance/CG181", "absolute");
    }

    @Test
    public void can_create_cdshooks_card_with_smart_link() throws Exception {
        guidelines = loadSingleGuideline("cdshooks_card_smart_link_test.v0.1.gdl2");
        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, input);
        assertThat(cardList.size(), is(1));
        Card card = cardList.get(0);
        assertThat(card.getLinks().size(), is(1));
        assertLink(card.getLinks().get(0), "Smart app label", "https://cambiocds.com/test-app", "smart");
    }

    @Test
    public void can_create_cdshooks_card_with_referenced_link_and_smart_link() throws Exception {
        guidelines = loadSingleGuideline("cdshooks_card_referenced_and_smart_link_test.v0.1.gdl2");
        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, input);
        assertThat(cardList.size(), is(1));
        Card card = cardList.get(0);
        assertThat(card.getLinks().size(), is(2));
        assertLink(card.getLinks().get(0), "NICE guideline", "https://www.nice.org.uk/guidance/CG181", "absolute");
        assertLink(card.getLinks().get(1), "Smart app label", "https://cambiocds.com/test-app", "smart");
    }

    private void assertLink(Link link, String label, String url, String type) {
        assertThat(link.getLabel(), is(label));
        assertThat(link.getUrl().toString(), is(url));
        assertThat(link.getType().toString().toLowerCase(), is(type));
    }

    @Test
    public void can_create_cdshooks_card_without_side_effect() throws Exception {
        guidelines = loadSingleGuideline("cdshooks_card_single_suggestion_test.v0.1.gdl2");
        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, input);
        assertThat(cardList.get(0).getSuggestions().get(0).getActions().size(), is(1));
        assertNotNull(guidelines.get(0).getDefinition().getRules().get("gt0034")
                .getCards().get(0).getSuggestions().get(0).getActions().get(0).getResourceTemplate());
    }

    @Test
    public void can_create_cdshooks_card_three_suggestions() throws Exception {
        guidelines = loadSingleGuideline("cdshooks_card_three_suggestions_test.v0.1.gdl2");
        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, input);
        assertThat(cardList.size(), is(1));
        Card card = cardList.get(0);
        assertThat(card.getSource().getLabel(), is("NICE guideline"));
        assertThat(card.getSource().getUrl().toString(), is("https://www.nice.org.uk/guidance/CG181"));
        assertThat(card.getSuggestions().size(), is(3));
        assertThat(card.getSuggestions().get(0).getLabel(), is("suggestion one"));
        assertThat(card.getSuggestions().get(1).getLabel(), is("suggestion two"));
        assertThat(card.getSuggestions().get(2).getLabel(), is("suggestion three"));

        assertThat(card.getSuggestions().get(0).getActions().size(), is(1));
        assertThat("MedicationRequest expected", card.getSuggestions().get(0).getActions().get(0).getResource() instanceof MedicationRequest);
        assertThat(card.getSuggestions().get(1).getActions().size(), is(1));
        assertThat("Goal expected", card.getSuggestions().get(1).getActions().get(0).getResource() instanceof Goal);
        assertThat(card.getSuggestions().get(2).getActions().size(), is(1));
        assertThat("Appointment expected", card.getSuggestions().get(2).getActions().get(0).getResource() instanceof Appointment);
    }

    @Test
    public void can_create_cdshooks_card_dynamic_summary_detail() throws Exception {
        input.add(new DataInstance.Builder()
                .modelId("org.hl7.fhir.dstu3.model.MedicationStatement")
                .addValue("/medicationCodeableConcept/coding[0]", DvCodedText.valueOf("ATC::C10AA05|Statin|"))
                .build());
        guidelines = loadSingleGuideline("cdshooks_card_dynamic_summary_detail_test.v0.1.gdl2");
        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, input);
        assertThat(cardList.size(), is(1));
        Card card = cardList.get(0);
        assertThat(card.getSummary(), is("card summary: Statin"));
        assertThat(card.getDetail(), is("card detail: ATC::C10AA05|Statin|"));
    }

    @Test
    public void can_create_cdshooks_card_dynamic_summary_detail_with_classic_mode() throws Exception {
        interpreter = new Interpreter(ZonedDateTime.parse("2013-04-20T14:00:00Z"));
        input.add(new DataInstance.Builder()
                .modelId("org.hl7.fhir.dstu3.model.MedicationStatement")
                .addValue("/medicationCodeableConcept/coding[0]", DvCodedText.valueOf("ATC::C10AA05|Statin|"))
                .build());
        guidelines = loadSingleGuideline("cdshooks_card_dynamic_summary_detail_classic_mode_test.v0.1.gdl2");
        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, input);
        assertThat(cardList.size(), is(1));
        Card card = cardList.get(0);
        assertThat(card.getSummary(), is("card summary: Statin"));
    }

    @Test
    public void can_create_multiple_cards_by_different_rules() throws Exception {
        guidelines = loadSingleGuideline("cdshooks_multiple_cards_test.v0.1.gdl2");
        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, input);
        assertThat(cardList.size(), is(2));
        assertThat(cardList.get(0).getSummary(), is("card 1"));
        assertThat(cardList.get(1).getSummary(), is("card 2"));
    }

    @Test
    public void can_get_card_with_swedish_summary_detail() throws Exception {
        interpreter = new Interpreter("sv");
        guidelines = loadSingleGuideline("BSA_Calculation_cdshooks_test.v1.gdl2");
        ArrayList<DataInstance> dataInstances = new ArrayList<>();
        dataInstances.add(toWeight("72.0,kg"));
        dataInstances.add(toHeight("180.0,cm"));

        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, dataInstances);
        assertThat(cardList.size(), Matchers.is(1));
        assertThat(cardList.get(0).getSummary(), Matchers.is("BSA sammanfattning"));
        assertThat(cardList.get(0).getDetail(), Matchers.is("Beskrivning av kroppsytan"));
        assertThat(cardList.get(0).getSuggestions().get(0).getLabel(), Matchers.is("Förslagetikett"));
        assertThat(cardList.get(0).getSuggestions().get(0).getActions().get(0).getDescription(), Matchers.is("Åtgärds beskrivning"));
        assertThat(cardList.get(0).getLinks().get(0).getLabel(), Matchers.is("Länk etikett"));
    }

    @Test
    public void can_get_card_with_english_summary_detail_when_unsupported_language_requested() throws Exception {
        interpreter = new Interpreter("no");
        guidelines = loadSingleGuideline("BSA_Calculation_cdshooks_test.v1.gdl2");
        ArrayList<DataInstance> dataInstances = new ArrayList<>();
        dataInstances.add(toWeight("72.0,kg"));
        dataInstances.add(toHeight("180.0,cm"));

        List<Card> cardList = interpreter.executeCdsHooksGuidelines(guidelines, dataInstances);
        assertThat(cardList.size(), Matchers.is(1));
        assertThat(cardList.get(0).getSummary(), Matchers.is("BSA summary"));
        assertThat(cardList.get(0).getDetail(), Matchers.is("Body surface area description"));
        assertThat(cardList.get(0).getSuggestions().get(0).getLabel(), Matchers.is("Suggestion label"));
        assertThat(cardList.get(0).getSuggestions().get(0).getActions().get(0).getDescription(), Matchers.is("Action description"));
        assertThat(cardList.get(0).getLinks().get(0).getLabel(), Matchers.is("Link label"));
    }

    private Interpreter buildInterpreterWithFhirPluginAndCurrentDateTime(String datetime) {
        return new Interpreter(
                RuntimeConfiguration.builder()
                        .currentDateTime(datetime == null ? ZonedDateTime.now() : ZonedDateTime.parse(datetime))
                        .objectCreatorPlugin(new FhirDstu3ResourceCreator())
                        .build());
    }
}


text:
class ApplicationController < ActionController::Base
  # By default, only respond to HTML requests.
  #
  respond_to :html

  # Note some extra data to be recorded by lograge.
  #
  def append_info_to_payload(payload)
    super
    payload[:host] = request.host
  end

  # Fun with threads! Check if this process' worker thread for scheduled
  # tasks is alive.
  #
  if Rails.env.production?
    before_filter do
      ScheduledTasks.keepalive!
    end
  end

  concerning :ErrorHandling do
    included do
      rescue_from ActiveRecord::RecordNotFound, with: :render_404

      rescue_from CanCan::AccessDenied do |exception|
        @error = exception.message
        @page_title = "Error"

        respond_to do |format|
          format.html { render 'error', status: 403, formats: [:html] }
          format.json { render json: { error: 'Unauthorized' }, status: 403 }
        end
      end
    end

    def render_404
      @error = "Not found. I'm sorry."
      @page_title = "Not Found"
      render 'error', status: 404, formats: [:html]
    end
  end

  before_filter do
    if current_site.blank?
      if Rails.env.production?
        redirect_to ENV['PANTS_FALLBACK_URL'] || User.first.domain.with_http
      else
        # Enable host-less development access
        @current_site = User.first
      end
    elsif current_site.domain != request.host
      redirect_to(host: current_site.domain, status: 302)
    end
  end

  before_filter do
    I18n.locale = current_site.locale || 'en'
  end

  def discovery
    # Renders some JSON with information relevant to API clients.
    respond_to do |format|
      format.json {}
    end
  end

  concerning :CurrentUser do
    included do
      helper_method :current_user
    end

    def current_user
      @current_user ||= begin
        if session[:current_user].present?
          User.find_by!(domain: session[:current_user])
        elsif params[:token].present?
          data = ApiTokens.verify(params[:token])
          if current_site.id == data[:site] && Time.now < data[:expires]
            User.find(data[:user])
          else
            raise "Invalid API token"
          end
        elsif cookies[:login_user].present? && cookies[:login_domain] == current_site.domain
          user = User.find_by!(domain: cookies[:login_user])
          session[:current_user] = user.domain
          user
        end
      rescue ActiveRecord::RecordNotFound
        logout_user
      end
    end

    def logout_user
      session[:current_user] = nil
      cookies.delete(:login_user, domain: current_site.domain)
      cookies.delete(:login_domain, domain: current_site.domain)
    end
  end

  concerning :CurrentSite do
    included do
      helper_method :current_site
    end

    def current_site
      @current_site ||= load_current_site
    end

    def load_current_site
      parts = request.subdomains + [request.domain]
      while parts.any? && (site = User.hosted.find_by(domain: parts.join('.'))).nil?
        parts.shift
      end

      site
    end
  end

  concerning :PageTitle do
    included do
      attr_writer :page_title
      helper_method :page_title, :page_title=
    end

    def page_title
      @page_title ||= t(".page_title", default: '')
    end
  end

  concerning :CanonicalUrls do
    def with_canonical_url(url)
      if request.url != url
        flash.keep
        redirect_to(url, status: 301)
      else
        yield
      end
    end
  end

  def current_ability
    @current_ability ||= Ability.new(current_user, current_site)
  end
end


text:
.ChopList {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  direction: ltr;
  position: relative;
  will-change: transform;
  overflow: auto;
  margin: auto;
}

.Burger {
  visibility: hidden;
}

.innerScrollContainer {
  position: absolute;
  width: 100%;
  overflow: hidden;

  display: flex;
  transform: translateZ(0);
}

.innerScrollList {
  display: flex;
}

.scrollHorizontal {
  flex-direction: row;
  height: 100%;
}

.scrollVertical {
  flex-direction: column;
  width: 100%;
}


text:
#include "gep/memory/MemoryUtils.h"
#include <limits>

namespace gep
{
    GEP_API unsigned int hashOf( const void* buf, size_t len, unsigned int seed = 0 );

    struct StdHashPolicy
    {
        template <class T>
        static unsigned int hash(const T& el)
        {
            return hashOf(&el, sizeof(T));
        }
    };

    struct StringHashPolicy
    {
        static unsigned int hash(const char* str)
        {
            return hashOf(str, strlen(str));
        }

        static unsigned int hash(const std::string& str)
        {
            return hashOf(str.c_str(), str.length());
        }
    };

    struct HashMethodPolicy
    {
        template <class T>
        static unsigned int hash(const T& el)
        {
            return el.hash();
        }
    };

    struct HashMethodPointerPolicy
    {
        template <class T>
        static unsigned hash(const T* el)
        {
            return el->hash();
        }
    };

    struct PointerHashPolicy
    {
        inline static unsigned int hash(const void* ptr)
        {
            // We can savely devide the pointer by the architectures default alignment because almost all pointers will be aligned
            // Pointers that are not aligned will cause a hash collision
            #ifdef _M_X64 //x64
            return (reinterpret_cast<unsigned int>(ptr) / 8) % 0xFFFFFFFF;
            #else //X86
            return reinterpret_cast<unsigned int>(ptr) / 4;
            #endif
        }
    };

    struct DontHashPolicy
    {
        template <typename T>
        inline static unsigned int hash(T value)
        {
            return value;
        }
    };

    template <class K, class V, class HashPolicy>
    class HashmapImpl
    {
      public:
        struct Pair {
            K key;
            V value;
            Pair(const K& key, const V& value) :
                key(key), value(value) {}
            Pair(K&& key, V&& value) :
                key(key), value(value) {}
        };

      private:
        enum class State : char {
          Free, // 0
          Deleted, // 1
          Data // 2
        };

        Pair* m_data;
        State* m_states;
        size_t m_reserved;
        size_t m_fullCount;
        size_t m_numDeletedEntries;
        IAllocator* m_allocator;

        static const int INITIAL_SIZE = 4;

        size_t insertEntry(const K& key, const V& value)
        {
            size_t index = getFreeIndex(key);
            new (m_data+index) Pair(key, value);
            if (m_states[index] == State::Deleted)
            {
                m_numDeletedEntries--;
            }
            m_states[index] = State::Data;
            return index;
        }

        size_t moveEntry(K& key, V& value)
        {
            size_t index = getFreeIndex(key);
            new (m_data+index) Pair(std::move(key), std::move(value));
            m_states[index] = State::Data;
            return index;
        }

        void moveEntry(const Pair& data)
        {
            new (m_data + getFreeIndex(data.key)) Pair(std::move(data));
        }

        size_t getFreeIndex(const K& key) const
        {
            size_t index = HashPolicy::hash(key) % m_reserved;
            while(m_states[index] == State::Data)
            {
                index++;
                if(index == m_reserved)
                {
                    index = 0;
                }
            }
            return index;
        }

        size_t getIndex(const K& key) const
        {
            if(m_reserved > 0)
            {
                size_t index = HashPolicy::hash(key) % m_reserved;
                size_t searched = 0;
                while(m_states[index] != State::Free && searched < m_reserved)
                {
                    if(m_states[index] == State::Data && m_data[index].key == key)
                        return index;
                    index++;
                    if(index == m_reserved)
                    {
                        index = 0;
                    }
                    searched++;
                }
            }
            return std::numeric_limits<size_t>::max();
        }

        void doRemove(size_t index)
        {
            size_t nextIndex = (index + 1) % m_reserved;
            if(m_states[nextIndex] != State::Free)
            {
                m_states[index] = State::Deleted;
                m_numDeletedEntries++;
            }
            else
            {
                m_states[index] = State::Free;
            }

            m_data[index].~Pair();
            m_fullCount--;
        }

        void copy(const HashmapImpl<K, V, HashPolicy>& other)
        {
            m_allocator = other.m_allocator;
            m_data = (Pair*)m_allocator->allocateMemory(sizeof(Pair) * other.m_reserved);
            m_states = (State*)m_allocator->allocateMemory(other.m_reserved);
            m_reserved = other.m_reserved;
            m_fullCount = other.m_fullCount;
            m_numDeletedEntries = other.m_fullCount;
            memcpy(m_states, other.m_states, other.m_reserved);
            for(size_t i=0; i<m_reserved; i++)
            {
                if(m_states[i] == State::Data)
                {
                    new (m_data + i) Pair (other.m_data[i]);
                }
            }
        }

        void move(HashmapImpl<K, V, HashPolicy>& other)
        {
            m_allocator = other.m_allocator;
            m_data = other.m_data;
            other.m_data = nullptr;
            m_states = other.m_states;
            other.m_states = nullptr;
            m_fullCount = other.m_fullCount;
            other.m_fullCount = 0;
            m_numDeletedEntries = other.m_numDeletedEntries;
            other.m_numDeletedEntries = 0;
            m_reserved = other.m_reserved;
            other.m_reserved = 0;
        }

        void destroy()
        {
            if(m_data != nullptr)
            {
                for(size_t i=0; i<m_reserved; i++)
                {
                    if(m_states[i] == State::Data)
                    {
                        m_data[i].~Pair();
                    }
                }
                m_allocator->freeMemory(m_states);
                m_allocator->freeMemory(m_data);
            }
        }

      public:

        struct Iterator
        {
        private:
            size_t index;
            HashmapImpl<K, V, HashPolicy>* m_pBackptr;

        public:
            Iterator(size_t index, HashmapImpl<K, V, HashPolicy>* pBackptr)
                : index(index), m_pBackptr(pBackptr)
            {}

            inline bool operator == (const Iterator& rh) const
            {
                return m_pBackptr == rh.m_pBackptr && index == rh.index;
            }
            inline bool operator != (const Iterator& rh) const
            {
                return !operator == (rh);
            }
            Iterator& operator++()
            {
                do
                {
                    index++;
                    if(index > m_pBackptr->m_reserved)
                    {
                        index = m_pBackptr->m_reserved;
                        break;
                    }
                }
                while(m_pBackptr->m_states[index] != State::Data);
                return *this;
            }
            Pair* operator->() const
            {
                GEP_ASSERT(index < m_pBackptr->m_reserved, "iterator out of bounds");
                return &m_pBackptr->m_data[index];
            }
            Pair& operator*() const
            {
                GEP_ASSERT(index < m_pBackptr->m_reserved, "iterator out of bounds");
                return m_pBackptr->m_data[index];
            }
        };

        struct KeyIterator
        {
        private:
            Iterator it;
        public:
            KeyIterator(Iterator it)
                : it(it)
            {}

            inline bool operator != (const KeyIterator& rh) const
            {
                return it != rh.it;
            }
            inline bool operator == (const KeyIterator& rh) const
            {
                return it == rh.it;
            }
            KeyIterator& operator++()
            {
                ++it;
                return *this;
            }
            K* operator->() const
            {
                return &it->key;
            }
            K& operator*() const
            {
                return it->key;
            }
        };

        struct ValueIterator
        {
        private:
            Iterator it;
        public:
            ValueIterator(Iterator it)
                : it(it)
            {}

            inline bool operator != (const ValueIterator& rh) const
            {
                return it != rh.it;
            }
            inline bool operator == (const ValueIterator& rh) const
            {
                return it == rh.it;
            }
            ValueIterator& operator++()
            {
                ++it;
                return *this;
            }
            V* operator->() const
            {
                return &it->value;
            }
            V& operator*() const
            {
                return it->value;
            }
        };

        struct KeyRange
        {
        private:
            KeyIterator m_begin, m_end;
        public:
            KeyRange(KeyIterator begin, KeyIterator end) : m_begin(begin), m_end(end) {}
            KeyIterator begin() { return m_begin; }
            KeyIterator end() { return m_end; }
        };

        struct ValueRange
        {
        private:
            ValueIterator m_begin, m_end;
        public:
            ValueRange(ValueIterator begin, ValueIterator end) : m_begin(begin), m_end(end) {}
            ValueIterator begin() { return m_begin; }
            ValueIterator end() { return m_end; }
        };

        /// \brief constructor
        HashmapImpl(IAllocator* allocator)
        {
            m_allocator = allocator;
            m_data = (Pair*)allocator->allocateMemory(sizeof(Pair) * INITIAL_SIZE);
            m_states = (State*)allocator->allocateMemory(INITIAL_SIZE);
            m_reserved = INITIAL_SIZE;
            m_fullCount = 0;
            m_numDeletedEntries = 0;
            memset(m_states, 0, m_reserved);
        }

        /// \brief copy constructor
        HashmapImpl(const HashmapImpl<K, V, HashPolicy>& other)
        {
            copy(other);
        }

        /// \brief move constructor
        HashmapImpl(HashmapImpl<K, V, HashPolicy>&& other)
        {
            move(other);
        }

        ~HashmapImpl()
        {
            destroy();
        }

        /// \brief assignment operator
        HashmapImpl<K, V, HashPolicy>& operator = (const HashmapImpl<K, V, HashPolicy>& rh)
        {
            if(this == &rh) // handle self assignment
                return *this;
            destroy();
            copy(rh);
            return *this;
        }

        /// \brief move assignment operator
        HashmapImpl<K, V, HashPolicy>& operator = (HashmapImpl<K, V, HashPolicy>&& rh)
        {
            if(this == &rh) // handle self assignment
                return *this;
            destroy();
            move(rh);
            return *this;
        }

        /// \brief [] operator
        V& operator[](const K& key)
        {
          size_t index = getIndex(key);
          if(index == std::numeric_limits<size_t>::max()) //not in the HashmapImpl yet
          {
            m_fullCount++;
            auto pseudoFullCount = m_fullCount + m_numDeletedEntries;
            if(pseudoFullCount > ((m_reserved * 3) / 4) || pseudoFullCount >= m_reserved)
            {
              Pair* oldData = m_data;
              State* oldStates = m_states;
              size_t oldLength = m_reserved;
              m_reserved = (oldLength == 0) ? 4 : oldLength * 2;
              m_data = (Pair*)m_allocator->allocateMemory(m_reserved * sizeof(Pair));
              m_states = (State*)m_allocator->allocateMemory(m_reserved);
              memset(m_states, (int)State::Free, m_reserved);

              //rehash all values
              for(size_t i=0; i < oldLength; i++)
              {
                  if(oldStates[i] == State::Data)
                  {
                      //move from the old to the new array
                      moveEntry(oldData[i].key, oldData[i].value);
                      //destroy the element in the old array
                      oldData[i].~Pair();
                  }
              }
              m_allocator->freeMemory(oldData);
              m_allocator->freeMemory(oldStates);
            }
            index = insertEntry(key, V());
          }
          return m_data[index].value;
        }

        /// \brief const version of operator []
        const V& operator[](const K& key) const
        {
            size_t index = getIndex(key);
            if(index != std::numeric_limits<size_t>::max())
            {
                return m_data[index].value;
            }

            GEP_ASSERT(0,"not found");
            throw std::exception("key not found");
        }

        /// \brief checks if a element does exist within the HashmapImpl
        bool exists(const K& key) const
        {
            return getIndex(key) != std::numeric_limits<size_t>::max();
        }

        /// \brief tries to retrieve a element from the HashmapImpl. On success outValue will be filled and SUCCESS will be returned, otherwise it will return FAILURE
        Result tryGet(const K& key, V& outValue) const
        {
            size_t index = getIndex(key);
            if(index != std::numeric_limits<size_t>::max())
            {
                outValue = m_data[index].value;
                return SUCCESS;
            }
            return FAILURE;
        }

        /// \brief removes a entry from the HashmapImpl
        Result remove(const K& key)
        {
            size_t index = getIndex(key);
            if(index == std::numeric_limits<size_t>::max())
                return FAILURE;

            doRemove(index);
            return SUCCESS;
        }

        /// \brief removes all entries from the HashmapImpl
        void clear()
        {
            for(size_t i=0; i < m_reserved; i++)
            {
                if(m_states[i] == State::Data)
                {
                    m_data[i].~Pair();
                    m_states[i] = State::Free;
                }
            }
            m_fullCount = 0;
        }

        /// \brief returns a begin iterator
        inline Iterator begin()
        {
            return ++(Iterator(-1, this));
        }

        /// \brief returns a end iterator
        inline Iterator end()
        {
            return Iterator(m_reserved, this);
        }

        /// \brief returns a range for iterating the keys
        inline KeyRange keys()
        {
            return KeyRange(KeyIterator(begin()), KeyIterator(end()));
        }

        /// \brief returns a range for iterating the values
        inline ValueRange values()
        {
            return ValueRange(ValueIterator(begin()), ValueIterator(end()));
        }

        /// \brief returns how many elements are inside the HashmapImpl
        inline size_t count() const
        {
            return m_fullCount;
        }

        inline size_t removeWhere(std::function<bool(K&, V&)> condition)
        {
            size_t removed = 0;
            for (size_t index = 0; index < m_reserved; ++index)
            {
                State state = m_states[index];
                Pair& entry = m_data[index];
                if (m_states[index] == State::Data && condition(entry.key, entry.value))
                {
                    doRemove(index);
                    ++removed;
                }
            }
            return removed;
        }

        void ifExists(const K& key, std::function<void(V&)> doIfTrue, std::function<void()> doIfFalse = nullptr)
        {
            auto index = getIndex(key);
            if(index != std::numeric_limits<size_t>::max())
                doIfTrue(m_data[index].value);
            else if(doIfFalse)
                doIfFalse();
        }

        // For testing
        bool isPseudoFull()
        {
            for(size_t i = 0; i < m_reserved; ++i)
            {
                if (m_states[i] == State::Free)
                {
                    return false;
                }
            }
            return true;

        }
    };

    /// \brief Hashmap indirection to deal with allocator policies and avoid code bloat
    // note: this is already fully implemented, you don't need to change anything here
    template <class K, class V, class HashPolicy = StdHashPolicy, class AllocatorPolicy = StdAllocatorPolicy>
    struct Hashmap : public HashmapImpl<K, V, HashPolicy>
    {
    public:
        inline Hashmap() : HashmapImpl(AllocatorPolicy::getAllocator())
        {
        }

        inline Hashmap(IAllocator* allocator) : HashmapImpl(allocator)
        {
        }

        inline Hashmap(const Hashmap<K, V, HashPolicy, AllocatorPolicy>& rh) : HashmapImpl(rh)
        {
        }

        inline Hashmap(const HashmapImpl<K, V, HashPolicy>& rh) : HashmapImpl(rh)
        {
        }

        inline Hashmap(Hashmap<K, V, HashPolicy, AllocatorPolicy>&& rh) : HashmapImpl(std::move(rh))
        {
        }

        inline Hashmap(HashmapImpl<K, V, HashPolicy>&& rh) : HashmapImpl(std::move(rh))
        {
        }

        inline Hashmap<K, V, HashPolicy, AllocatorPolicy>& operator = (const Hashmap<K, V, HashPolicy, AllocatorPolicy>& rh)
        {
            return static_cast<Hashmap<K, V, HashPolicy, AllocatorPolicy>&>(HashmapImpl<K, V, HashPolicy>::operator=(rh));
        }

        inline Hashmap<K, V, HashPolicy, AllocatorPolicy>& operator = (const HashmapImpl<K, V, HashPolicy>& rh)
        {
            return static_cast<Hashmap<K, V, HashPolicy, AllocatorPolicy>&>(HashmapImpl<K, V, HashPolicy>::operator=(rh));
        }

        inline Hashmap<K, V, HashPolicy, AllocatorPolicy>& operator = (Hashmap<K, V, HashPolicy, AllocatorPolicy>&& rh)
        {
            return static_cast<Hashmap<K, V, HashPolicy, AllocatorPolicy>&>(HashmapImpl<K, V, HashPolicy>::operator=(std::move(rh)));
        }

        inline Hashmap<K, V, HashPolicy, AllocatorPolicy>& operator = (HashmapImpl<K, V, HashPolicy>&& rh)
        {
            return static_cast<Hashmap<K, V, HashPolicy, AllocatorPolicy>&>(HashmapImpl<K, V, HashPolicy>::operator=(std::move(rh)));
        }
    };
}


text:
package com.citelic.game.entity.player.content.dialogue.impl.items;

import com.citelic.game.entity.player.content.dialogue.Dialogue;
import com.citelic.game.entity.player.content.transportation.ItemTransportation;

public class ItemTransportationD extends Dialogue {

    @Override
    public void start() {
	String[] locations = (String[]) parameters[0];
	sendOptionsDialogue("Where would you like to teleport to", locations);
    }

    @Override
    public void run(int interfaceId, int componentId) {
	String[] locations = (String[]) parameters[0];
	ItemTransportation.sendTeleport(player, player.getInventory().getItems().lookup((Integer) parameters[1]), componentId == OPTION_1 ? 0 : componentId - 12, false, locations.length - 1);
	end();
    }

    @Override
    public void finish() {
    }
}