test_class.file: singa-simulation/src/test/java/bio/singa/simulation/model/modules/displacement/implementations/VesicleTransportTest.java
test_class.identifier: VesicleTransportTest
test_case.body: @Test
      void testVesicleTransport() {
          ComparableQuantity<Length> systemExtend = Quantities.getQuantity(6, MICRO(METRE));
          Environment.setSystemExtend(systemExtend);
          Environment.setSimulationExtend(600);
          Environment.setNodeSpacingToDiameter(systemExtend, 10);
  
          ComparableQuantity<Time> timeStep = Quantities.getQuantity(1, MILLI(SECOND));
          UnitRegistry.setTime(timeStep);
  
          Simulation simulation = new Simulation();
  
          // define graphs
          AutomatonGraph graph = AutomatonGraphs.createRectangularAutomatonGraph(10, 1);
          simulation.setGraph(graph);
  
          SimpleEntity myo = SimpleEntity.create("MYO").build();
  
          Vector2D initialVesiclePosition = new Vector2D(50, 30);
          Vesicle vesicle = new Vesicle(initialVesiclePosition, Quantities.getQuantity(150, NANO(METRE)));
          vesicle.setState(TAGGED_FOR_EXOCYTOSIS);
          vesicle.getConcentrationContainer().initialize(CellTopology.MEMBRANE,
                  myo,
                  Quantities.getQuantity(1, MICRO_MOLE_PER_LITRE));
  
          // add vesicle layer
          VesicleLayer layer = new VesicleLayer(simulation);
          layer.addVesicle(vesicle);
          simulation.setVesicleLayer(layer);
  
          // membrane layer
          MembraneLayer membraneLayer = new MembraneLayer();
  
          // add filament layer
          ArrayList<Vector2D> track = new ArrayList<>();
          track.add(new Vector2D(50, 30));
          track.add(new Vector2D(150, 30));
          track.add(new Vector2D(200, 30));
          track.add(new Vector2D(250, 30));
          track.add(new Vector2D(300, 30));
          track.add(new Vector2D(350, 30));
          track.add(new Vector2D(400, 30));
          track.add(new Vector2D(500, 30));
          track.add(new Vector2D(550, 30));
          LineLikeAgent actinFilament = new LineLikeAgent(LineLikeAgent.ACTIN, track, NeumannRectangularDirection.EAST);
          LineLikeAgentLayer lineLikeAgentLayer = new LineLikeAgentLayer(simulation, membraneLayer);
          lineLikeAgentLayer.addFilament(actinFilament);
          simulation.setLineLayer(lineLikeAgentLayer);
  
          // 2b attachment to actin
          LineLikeAgentAttachment vesicleActinAttachment = new LineLikeAgentAttachment();
          vesicleActinAttachment.setIdentifier("attach vesicle to actin");
          vesicleActinAttachment.setFeature(new AttachedMotor(myo));
          vesicleActinAttachment.setFeature(new AttachedFilament(ACTIN));
          vesicleActinAttachment.setFeature(new MotorPullDirection(PLUS));
          vesicleActinAttachment.setFeature(new AttachmentDistance(Quantities.getQuantity(45, NANO(METRE))));
          simulation.addModule(vesicleActinAttachment);
  
          // 2c directed transport at actin
          VesicleTransport transportAtActinFilaments = new VesicleTransport();
          transportAtActinFilaments.setIdentifier("transport vesicle along actin filament");
          ComparableQuantity<Speed> speed = Quantities.getQuantity(600.0, NANOMETRE_PER_SECOND);
          transportAtActinFilaments.setFeature(new MotorMovementVelocity(speed));
          transportAtActinFilaments.setFeature(new AppliedVesicleState(ACTIN_ATTACHED));
          simulation.addModule(transportAtActinFilaments);
  
          simulation.nextEpoch();
          // first check attachment to vesicle module
          assertEquals(VesicleStateRegistry.ACTIN_ATTACHED, vesicle.getState());
          assertTrue(ListHelper.haveSameElements(Arrays.asList(graph.getNode(0, 0), graph.getNode(1, 0)),
                  vesicle.getAssociatedNodes().keySet()));
  
          Quantity<Time> timeBefore = TimeStepManager.getElapsedTime();
          simulation.nextEpoch();
          Quantity<Time> timeAfter = TimeStepManager.getElapsedTime();
  
          // check distance travelled should be 600 nm/s
          Quantity<Length> distance = Environment.convertSimulationToSystemScale(vesicle.getPosition().subtract(initialVesiclePosition).getMagnitude()).to(NANO(METRE));
          Quantity<Time> duration = timeAfter.subtract(timeBefore).to(SECOND);
          assertEquals(speed.getValue().doubleValue(), distance.divide(duration).getValue().doubleValue(), 1e-10);
  
      }
test_case.class_method_signature: VesicleTransportTest.testVesicleTransport()
test_case.full_signature: @Test void testVesicleTransport()
test_case.identifier: testVesicleTransport
test_case.invocations: getQuantity MICRO setSystemExtend setSimulationExtend setNodeSpacingToDiameter getQuantity MILLI setTime createRectangularAutomatonGraph setGraph build create getQuantity NANO setState initialize getConcentrationContainer getQuantity addVesicle setVesicleLayer add add add add add add add add add addFilament setLineLayer setIdentifier setFeature setFeature setFeature setFeature getQuantity NANO addModule setIdentifier getQuantity setFeature setFeature addModule nextEpoch assertEquals getState assertTrue haveSameElements asList getNode getNode keySet getAssociatedNodes getElapsedTime nextEpoch getElapsedTime to convertSimulationToSystemScale getMagnitude subtract getPosition NANO to subtract assertEquals doubleValue getValue doubleValue getValue divide
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void testVesicleTransport()
focal_class.file: singa-simulation/src/main/java/bio/singa/simulation/model/modules/displacement/implementations/VesicleTransport.java
focal_class.identifier: VesicleTransport
focal_class.class_method_signature: VesicleTransport.VesicleTransport()
focal_class.full_signature: public  VesicleTransport()
focal_class.identifier: VesicleTransport
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  VesicleTransport()
focal_class.class_method_signature: VesicleTransport.isAttachedToFilament(Vesicle vesicle)
focal_class.full_signature: private boolean isAttachedToFilament(Vesicle vesicle)
focal_class.identifier: isAttachedToFilament
focal_class.modifiers: private
focal_class.parameters: (Vesicle vesicle)
focal_class.return: boolean
focal_class.signature: boolean isAttachedToFilament(Vesicle vesicle)
focal_class.class_method_signature: VesicleTransport.calculateDisplacement(Vesicle vesicle)
focal_class.full_signature: public DisplacementDelta calculateDisplacement(Vesicle vesicle)
focal_class.identifier: calculateDisplacement
focal_class.modifiers: public
focal_class.parameters: (Vesicle vesicle)
focal_class.return: DisplacementDelta
focal_class.signature: DisplacementDelta calculateDisplacement(Vesicle vesicle)
focal_class.class_method_signature: VesicleTransport.scoutMinusEnd(ListIterator<Vector2D> segmentIterator)
focal_class.full_signature: private Pair<Vector2D> scoutMinusEnd(ListIterator<Vector2D> segmentIterator)
focal_class.identifier: scoutMinusEnd
focal_class.modifiers: private
focal_class.parameters: (ListIterator<Vector2D> segmentIterator)
focal_class.return: Pair<Vector2D>
focal_class.signature: Pair<Vector2D> scoutMinusEnd(ListIterator<Vector2D> segmentIterator)
focal_class.class_method_signature: VesicleTransport.scoutPlusEnd(ListIterator<Vector2D> segmentIterator)
focal_class.full_signature: private Pair<Vector2D> scoutPlusEnd(ListIterator<Vector2D> segmentIterator)
focal_class.identifier: scoutPlusEnd
focal_class.modifiers: private
focal_class.parameters: (ListIterator<Vector2D> segmentIterator)
focal_class.return: Pair<Vector2D>
focal_class.signature: Pair<Vector2D> scoutPlusEnd(ListIterator<Vector2D> segmentIterator)
focal_class.superclass: extends DisplacementBasedModule
focal_method.body: public VesicleTransport() {
          // delta function
          addDeltaFunction(this::calculateDisplacement, this::isAttachedToFilament);
          // feature
          getRequiredFeatures().add(MotorMovementVelocity.class);
          getRequiredFeatures().add(AppliedVesicleState.class);
      }
focal_method.class_method_signature: VesicleTransport.VesicleTransport()
focal_method.full_signature: public  VesicleTransport()
focal_method.identifier: VesicleTransport
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.signature:  VesicleTransport()