Package barsuift.simLife.condition

Examples of barsuift.simLife.condition.CyclicConditionState


        int stepSize = speed.getSpeed();

        MockUniverse mockUniverse = new MockUniverse();
        synchronizerCore = new MockInstrumentedSynchronizerCore(new SynchronizerCoreState(speed));
        mockUniverse.setSynchronizer(synchronizerCore);
        ConditionalTaskState conditionalTaskState = new ConditionalTaskState(new CyclicConditionState(1, 0),
                new BoundConditionState(4, 0));
        taskCore = new MockConditionalTask(conditionalTaskState);
        synchronizerCore.schedule(taskCore);

        synchronizer3D = new MockInstrumentedSynchronizer3D(new Synchronizer3DState(stepSize));
        ((MockUniverse3D) mockUniverse.getUniverse3D()).setSynchronizer(synchronizer3D);
        ConditionalTaskState conditionalTask3DState = new ConditionalTaskState(new CyclicConditionState(1, 0),
                new BoundConditionState(60, 0));
        task3D = new MockSplitConditionalTask(new SplitConditionalTaskState(conditionalTask3DState, stepSize));
        synchronizer3D.schedule(task3D);

        state = new MainSynchronizerState();
View Full Code Here


        }
        return prop;
    }

    public ConditionalTaskState createConditionalTaskState(Class<? extends ConditionalTask> clazz) {
        CyclicConditionState executionCondition = createCyclicConditionState(clazz);
        BoundConditionState endingCondition = createBoundConditionState(clazz);
        return new ConditionalTaskState(executionCondition, endingCondition);
    }
View Full Code Here

    private CyclicConditionState createCyclicConditionState(Class<? extends SynchronizedTask> clazz) {
        String boundStr = getProperty(clazz.getSimpleName() + CYCLE_SUFFIX);
        int bound = (boundStr.length() == 0) ? DEFAULT_CYCLE : Integer.parseInt(boundStr);
        int count = 0;
        return new CyclicConditionState(bound, count);
    }
View Full Code Here

    private BoundConditionState endingCondition;

    public ConditionalTaskState() {
        super();
        this.executionCondition = new CyclicConditionState();
        this.endingCondition = new BoundConditionState();
    }
View Full Code Here

    }

    private void setUpWithBound(int bound) {
        state = new Synchronizer3DState(10);
        synchro = new BasicSynchronizer3D(state);
        ConditionalTaskState conditionalTaskState = new ConditionalTaskState(new CyclicConditionState(1, 0),
                new BoundConditionState(bound, 0));
        task = new MockSplitConditionalTask(new SplitConditionalTaskState(conditionalTaskState, 10));
        synchro.schedule(task);

        CyclicBarrier barrier = new CyclicBarrier(2);
View Full Code Here

        assertEquals(35, synchro.getState().getStepSize());
    }

    public void testSchedule() throws Exception {
        // create mocks with no bound to be sure they won't stop before the end of the test
        ConditionalTaskState conditionalTaskState = new ConditionalTaskState(new CyclicConditionState(1, 0),
                new BoundConditionState(0, 0));
        SplitConditionalTaskState splitConditionalTaskState = new SplitConditionalTaskState(conditionalTaskState, 10);
        MockSplitConditionalTask mockRun1 = new MockSplitConditionalTask(splitConditionalTaskState);
        MockSplitConditionalTask mockRun2 = new MockSplitConditionalTask(splitConditionalTaskState);
        MockSplitConditionalTask mockRun3 = new MockSplitConditionalTask(splitConditionalTaskState);
View Full Code Here

TOP

Related Classes of barsuift.simLife.condition.CyclicConditionState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.