protected void convertDimensions(double multiplier) { if (mouthpiece != null) { mouthpiece.convertDimensions(multiplier); } if (borePoint != null) { for (BorePoint aPoint : borePoint) { aPoint.convertDimensions(multiplier); } } if (hole != null) { for (Hole aHole : hole) { aHole.convertDimensions(multiplier); } } if (termination != null) { termination.convertDimensions(multiplier); } }
@Test public void phaseTermination() { Termination termination = new StepCountTermination(4); AbstractPhaseScope phaseScope = mock(AbstractPhaseScope.class); when(phaseScope.getNextStepIndex()).thenReturn(0); assertEquals(false, termination.isPhaseTerminated(phaseScope)); assertEquals(0.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0); when(phaseScope.getNextStepIndex()).thenReturn(1); assertEquals(false, termination.isPhaseTerminated(phaseScope)); assertEquals(0.25, termination.calculatePhaseTimeGradient(phaseScope), 0.0); when(phaseScope.getNextStepIndex()).thenReturn(2); assertEquals(false, termination.isPhaseTerminated(phaseScope)); assertEquals(0.5, termination.calculatePhaseTimeGradient(phaseScope), 0.0); when(phaseScope.getNextStepIndex()).thenReturn(3); assertEquals(false, termination.isPhaseTerminated(phaseScope)); assertEquals(0.75, termination.calculatePhaseTimeGradient(phaseScope), 0.0); when(phaseScope.getNextStepIndex()).thenReturn(4); assertEquals(true, termination.isPhaseTerminated(phaseScope)); assertEquals(1.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0); when(phaseScope.getNextStepIndex()).thenReturn(5); assertEquals(true, termination.isPhaseTerminated(phaseScope)); assertEquals(1.0, termination.calculatePhaseTimeGradient(phaseScope), 0.0); }
protected void processTermination(SortedPositionList<BorePoint> borePointList) { BorePoint lastPoint = borePointList.getLast(); termination.setBoreDiameter(lastPoint.getBoreDiameter()); termination.setBorePosition(lastPoint.getBorePosition()); }