- java.lang.Object
-
- fr.inria.mochy.core.trajectory.Trajectory
-
public class Trajectory extends Object
It contains one or multiple Segment object(s) to simulate the journey of a token on a graph with the time in the abscissa and the distance in ordinate
-
-
Constructor Summary
Constructors Constructor Description Trajectory()
Trajectory(ArrayList<Segment> segments)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Float
absciss(float y)
return the absciss of the y value on the trajectoryvoid
addSegment(Segment segment)
add the segment parameter to the segments of the trajectory if the segment parameter has a previous link segment : add it to its next segmentvoid
followFrom(float x, Trajectory trajectory)
after a truncate is done, the trajectory can be updated to follow a trajectory set in parameter from a x abscissa value also set in parameterTrajectory
getBlockTraj()
float
getHeadway()
ArrayList<Segment>
getSegments()
Float
isBlockedBy(Trajectory trajectoryParam)
return the abscissa of the point where the current Trajectory is blocked by the one set in parameter and its headway else, if it is not blocked : return nullboolean
isSinglePoint()
void
leftShift(float delta)
advance the time to the delta value as specified in parameter -it performs a shift to the segments on the left by decreasing the abscissa values -it deletes the segments with P1.x < 0 -it truncate the segments with P0.x < 0 return true if the trajectory has no more segmentsFloat
ordinate(float x)
return the ordinate of the x abscissa value on the trajectoryvoid
recover()
after a trajectory has been followed to preserve headways the segments of this trajectory can get to the origin segmentsvoid
setBlockTraj(Trajectory blockTraj)
void
setHeadway(float value)
void
truncateFrom(float x)
truncate the trajectory from the x parameter value truncate the segment in which x is in its interval remove the segments which begin after xTrajectory
upwardShift()
create a new Trajectory object based on the current Trajectory with new values of ordinate increased by the headway value and a last segment with an ordinate of headway where the current trajectory ordinate is 0
-
-
-
Method Detail
-
addSegment
public void addSegment(Segment segment)
add the segment parameter to the segments of the trajectory if the segment parameter has a previous link segment : add it to its next segment
-
getHeadway
public float getHeadway()
-
setHeadway
public void setHeadway(float value)
-
ordinate
public Float ordinate(float x)
return the ordinate of the x abscissa value on the trajectory
-
absciss
public Float absciss(float y)
return the absciss of the y value on the trajectory
-
upwardShift
public Trajectory upwardShift()
create a new Trajectory object based on the current Trajectory with new values of ordinate increased by the headway value and a last segment with an ordinate of headway where the current trajectory ordinate is 0
-
getBlockTraj
public Trajectory getBlockTraj()
-
setBlockTraj
public void setBlockTraj(Trajectory blockTraj)
-
isBlockedBy
public Float isBlockedBy(Trajectory trajectoryParam)
return the abscissa of the point where the current Trajectory is blocked by the one set in parameter and its headway else, if it is not blocked : return null
-
leftShift
public void leftShift(float delta)
advance the time to the delta value as specified in parameter -it performs a shift to the segments on the left by decreasing the abscissa values -it deletes the segments with P1.x < 0 -it truncate the segments with P0.x < 0 return true if the trajectory has no more segments
-
truncateFrom
public void truncateFrom(float x)
truncate the trajectory from the x parameter value truncate the segment in which x is in its interval remove the segments which begin after x
-
followFrom
public void followFrom(float x, Trajectory trajectory)
after a truncate is done, the trajectory can be updated to follow a trajectory set in parameter from a x abscissa value also set in parameter
-
recover
public void recover()
after a trajectory has been followed to preserve headways the segments of this trajectory can get to the origin segments
-
isSinglePoint
public boolean isSinglePoint()
-
-