public class Block extends TrackSegment
Modifier and Type | Field and Description |
---|---|
int |
blockNo
blockNo Stores the block number, which is by default -1
|
int |
direction
direction Direction of the block.
|
java.util.ArrayList<Link> |
downLinks |
static double |
minimumBlockLength |
SpeedRestrictionList |
speedRestrictionList
speedRestrictionList
|
java.util.ArrayList<Link> |
upLinks |
endMilePost, maximumPossibleSpeed, startMilePost
BLOCK_ENTITY, LINK_ENTITY, LOOP_ENTITY
Constructor and Description |
---|
Block() |
Block(Block block) |
Block(double startMilepost,
double endMilepost) |
Block(int i) |
Modifier and Type | Method and Description |
---|---|
double |
addTinyBlocksToEmptyBlock(Link previousLink,
Block iterBlock,
Train train,
Link nextIterLink,
double milepost,
boolean enteredOnYellow) |
boolean |
allowsTrain(Train currTrain,
double arrivalTime,
java.lang.String TRAIN_TYPE_ALLOWED_ON_THIRD_LINE) |
RunTimeReturn |
calculateWarnerVelocityProfile(Train train,
int signal,
double arrivalTime,
Block nextBlock,
RunTimeReturn runtimereturn,
double finalVelocity,
double warnerDistance,
SimulationInstance simulationInstance,
int maxSignalAspectsToBeConsidered) |
boolean |
checkLastBlock(int i,
int j) |
BlockDirectionInInterval |
getBlockDirectionInInterval() |
java.lang.String |
getBlockName() |
int |
getBlockNo() |
Signal |
getBlockSignal(int direction) |
double |
getDepartureTimeFromTrainNo(int trainNo) |
double |
getEarliestArrivalTime(double d,
double d1,
int i) |
double |
getEarliestArrivalTime(double arrivalTime,
int trainDirection) |
Block |
getEmptyBlockWithTinyBlocksAdded(Train train,
int signal,
Link previousLink,
Link nextLink,
double profileStartingMilePost,
boolean enteredOnYellow,
boolean enteringNextBlockOnYellow)
Add the tiny blocks of the blocks from the startBlock till the signal
value number of the blocks into the emptyBlock.
|
double |
getEndMilePost(int direction) |
GradientList |
getGradientList() |
java.lang.String |
getGradientsString() |
java.util.HashMap<java.lang.Integer,java.lang.Boolean> |
getHasPathToBlockMap(int direction) |
Interval |
getLastIntervalByTrain(Train train) |
java.lang.String |
getLinkCrossoversString(int direction) |
java.lang.String |
getLinkLengthsString(int direction) |
java.lang.String |
getLinkListString(int direction) |
java.lang.String |
getLinkPrioritiesString(int direction) |
static java.util.logging.Logger |
getLogger() |
double |
getMilePostsByNextLink(Link nextLink,
Train train,
double profileStartingMilePost) |
double |
getMilePostsByPreviousLink(Link previousLink,
Train train,
double profileStartingMilePost) |
Block |
getNextBlock(Train train)
1) It finds a preferred loop or a block as per whether the currentblock
has next block as a loop or block.
|
Block |
getNextBlockByDirection(int direction) |
Link |
getNextLink(Train train) |
LinkList |
getNextLinks() |
LinkList |
getNextLinks(int trainDirection) |
TinyBlockList |
getNightsfsr() |
RunTimeReturn |
getNonOverlappingRunTimeReturn(Train train,
VelocityProfileArray velocityProfileArray,
double startMilePost,
double endMilePost,
double linkMilePost,
Link previousLink) |
RunTimeReturn |
getNonOverlappingRunTimeSignal(Train train,
int signal,
double startVelocity,
double endVelocity,
Link previousLink,
Link nextLink,
double profileStartingMilePost,
boolean enteredOnYellow)
1) It does some signal handling.
|
double |
getOccupancyTimeByTrain(Train train) |
IntervalArray |
getOnlyActualOccupancies() |
double |
getOverlapDistance(int trainDirection) |
RunTimeReturn |
getOverlappingRunTimeReturn(Train train,
VelocityProfileArray velocityprofilearray,
OverlapParameters overlapParameters)
Get the
RunTimeReturn for the block and the overlapping part of
the train after it just exits the block. |
Block |
getPath(Block block,
Train Train,
int numberOfSignalAspects) |
LinkList |
getPreviousLinks() |
RunTimeReturn |
getRunTimeVelocity(Train Train,
double d,
double d1) |
TinyBlockList |
getSfsr() |
int |
getSignal(Train train,
double arrivalTime,
boolean consideringHalts,
int maxSignalAspectsToBeConsidered,
SimulationInstance simulationInstance) |
int |
getSignalFailFlag() |
SignalFailure |
getSignalFailure() |
java.lang.String |
getSpeedLimitEndMilePostsString() |
java.lang.String |
getSpeedLimitsString() |
java.lang.String |
getSpeedLimitStartMilePostsString() |
SpeedRestrictionList |
getSpeedRestrictionList() |
java.lang.String |
getSpeedRestrictionsString() |
double |
getStartMilePost(int direction) |
java.util.ArrayList<java.lang.Integer> |
getTrainNoFromOccupancy(double time,
double timeInterval) |
VelocityProfileArray |
getVelocityProfileArray(Train train,
int signal,
double startVelocity,
double endVelocity,
Link nextLink,
Link previousLink,
double profileStartingMilePost,
boolean enteredOnYellow,
boolean enteringNextBlockOnYellow) |
boolean |
hasError() |
boolean |
hasPath(int trainEndLoopNo,
int trainDirection) |
boolean |
hasPathTo(Block nextBlock,
int direction) |
boolean |
isDirectionOk(Train Train,
double arrivalTime) |
int |
isFree(double d,
double d1,
double d2,
double d3,
int i) |
boolean |
isLoop() |
boolean |
isSignalFailed(double time) |
boolean |
isSignalRed(double d) |
boolean |
isWarner() |
void |
printOccupancies(int trainNo) |
void |
readCommonBlockLoopProperties(java.io.StreamTokenizer streamTokenizer) |
SpeedRestriction |
readSpeedRes(java.io.StreamTokenizer streamtokenizer) |
void |
reserve(Train train,
double arrivalTime,
double departureTime,
boolean actualOccupancy) |
Gradient |
returnGradientFormat(double startMilePost,
double endMilePost) |
double |
returnMaxSpeedBetweenMilePosts(double start,
double end) |
void |
setBlockDirectionInInterval(BlockDirectionInInterval blockDirectionInInterval) |
void |
setBlockName(java.lang.String blockName) |
void |
setBlockNo(int blockNo) |
void |
setBlockSignal(int direction,
Signal signal) |
void |
setEndMilePost(double endMilePost) |
void |
setEndMilePost(int trainDirection,
double milepost) |
void |
setEndMilePostDirectly(double endMilePost) |
void |
setGradientList(GradientList gradientList) |
static void |
setLogger(java.util.logging.Logger logger) |
void |
setNextLinks(LinkList nextBlocks) |
void |
setNightsfsr(TinyBlockList nightsfsr) |
void |
setPreviousLinks(LinkList previousBlocks) |
void |
setSfsr(TinyBlockList sfsr) |
void |
setSignalFailFlag(int signalFailFlag) |
void |
setSignalFailure(SignalFailure signalFailure) |
void |
setSpeedRestrictionList(SpeedRestrictionList speedRestrictionList) |
void |
setStartMilePost(int trainDirection,
double milepost) |
void |
setWarner(boolean warner) |
java.util.ArrayList<Block> |
splitBlock(double newMilepost) |
SplitProfileForWarner |
splitProfileForWarnerDistance(Train train,
VelocityProfileArray originalProfile,
Block largeBlock,
double warnerDistance)
Split the profile of the block into two profiles one for the warner
distance and other for the rest of the block.
|
StatusTraverseBlock |
traverseBlock(Train train,
double arrivalTime,
double departureTime,
double startVelocity,
Link previousLink,
Link nextFastestLink,
double profileStartingMilePost,
SimulationInstance simulationInstance,
int nextReferenceLoopNumber) |
boolean |
waitingPermitted() |
double |
whenFree(double startTime,
double endTime)
Consider the block occupancies and determine if the block is free during
the interval specified by the startTime and endTime.
|
getDirection, getEndMilePost, getLength, getMaximumPossibleSpeed, getOccupanciesToDisplay, getOccupy, getStartMilePost, getTinyBlockList, isFree, isFree, setDirection, setLength, setMaximumPossibleSpeed, setOccupied, setOccupied, setOccupy, setStartMilePost, setTinyBlockList
getEntityType, isBlock, isLink, setEntityType
public static final double minimumBlockLength
public int blockNo
public int direction
public SpeedRestrictionList speedRestrictionList
public java.util.ArrayList<Link> upLinks
public java.util.ArrayList<Link> downLinks
public Block(double startMilepost, double endMilepost)
public Block()
public Block(int i)
i
- loop controllerpublic Block(Block block)
public java.util.HashMap<java.lang.Integer,java.lang.Boolean> getHasPathToBlockMap(int direction)
public void setEndMilePost(double endMilePost)
setEndMilePost
in class TrackSegment
public void setSpeedRestrictionList(SpeedRestrictionList speedRestrictionList)
public SpeedRestrictionList getSpeedRestrictionList()
public java.lang.String getSpeedRestrictionsString()
public java.lang.String getGradientsString()
public SpeedRestriction readSpeedRes(java.io.StreamTokenizer streamtokenizer) throws java.io.IOException, SimulatorException
streamtokenizer
- SpeedRestriction
java.io.IOException
- : deals with input/output errorsSimulatorException
- : deals with Simulation errorspublic java.util.ArrayList<java.lang.Integer> getTrainNoFromOccupancy(double time, double timeInterval)
timeInterval
- : stores the time intervalpublic int isFree(double d, double d1, double d2, double d3, int i)
public double whenFree(double startTime, double endTime)
startTime
- endTime
- public void reserve(Train train, double arrivalTime, double departureTime, boolean actualOccupancy)
trainNo
- : stores the train numberarrivalTime
- : stores the arrival timedepartureTime
- : stores the departure timeactualOccupancy
- : details about the actual occupancy of the trainpublic double getStartMilePost(int direction)
direction
- public double getEndMilePost(int direction)
direction
- public double getDepartureTimeFromTrainNo(int trainNo)
i
- public LinkList getNextLinks(int trainDirection)
trainDirection
- public boolean waitingPermitted()
public Block getNextBlock(Train train)
trainDirection
- Train
- public Block getNextBlockByDirection(int direction)
i
- public boolean checkLastBlock(int i, int j)
i
- j
- public boolean isSignalRed(double d)
d
- public boolean hasPathTo(Block nextBlock, int direction)
public boolean hasPath(int trainEndLoopNo, int trainDirection)
block
- trainEndLoopNo
- trainDirection
- public double getEarliestArrivalTime(double arrivalTime, int trainDirection)
arrivalTime
- trainDirection
- public double getEarliestArrivalTime(double d, double d1, int i)
d
- d1
- i
- public int getSignal(Train train, double arrivalTime, boolean consideringHalts, int maxSignalAspectsToBeConsidered, SimulationInstance simulationInstance)
Train
- noOfColor
- arrivalTime
- maxSignalAspectsToBeConsidered
- direction
- public Block getPath(Block block, Train Train, int numberOfSignalAspects)
block
- Train
- numberOfSignalAspects
- public Block getEmptyBlockWithTinyBlocksAdded(Train train, int signal, Link previousLink, Link nextLink, double profileStartingMilePost, boolean enteredOnYellow, boolean enteringNextBlockOnYellow)
emptyBlock
- startBlock
- Train
- signal
- previousLink
- nextLink
- profileStartingMilePost
- enteredOnYellow
- enteringNextBlockOnYellow
- afterSighting
- public void setStartMilePost(int trainDirection, double milepost)
public void setEndMilePost(int trainDirection, double milepost)
public double getMilePostsByNextLink(Link nextLink, Train train, double profileStartingMilePost)
public double getMilePostsByPreviousLink(Link previousLink, Train train, double profileStartingMilePost)
public RunTimeReturn getNonOverlappingRunTimeSignal(Train train, int signal, double startVelocity, double endVelocity, Link previousLink, Link nextLink, double profileStartingMilePost, boolean enteredOnYellow)
Train
- signal
- d
- startVelocity1
- endVelocity1
- previousLink
- nextLink
- profileStartingMilePost
- enteredOnYellow
- public RunTimeReturn getNonOverlappingRunTimeReturn(Train train, VelocityProfileArray velocityProfileArray, double startMilePost, double endMilePost, double linkMilePost, Link previousLink)
Train
- velocityProfileArray
- linkMilePost
- RunTimeReturn
from the beginning of the block till only
the end of the block and not the overlapping part of the train
when the train just exits the block.public RunTimeReturn getOverlappingRunTimeReturn(Train train, VelocityProfileArray velocityprofilearray, OverlapParameters overlapParameters)
RunTimeReturn
for the block and the overlapping part of
the train after it just exits the block.Train
- velocityprofilearray
- RunTimeReturn
from the beginning of the block till the
overlapping part of the trainpublic RunTimeReturn calculateWarnerVelocityProfile(Train train, int signal, double arrivalTime, Block nextBlock, RunTimeReturn runtimereturn, double finalVelocity, double warnerDistance, SimulationInstance simulationInstance, int maxSignalAspectsToBeConsidered)
Train
- signal
- arrivalTime
- nextBlock
- runtimereturn
- finalVelocity
- numberOfSignalAspects
- warnerDistance
- maxSignalAspectsToBeConsidered
- public SplitProfileForWarner splitProfileForWarnerDistance(Train train, VelocityProfileArray originalProfile, Block largeBlock, double warnerDistance)
Train
- originalProfile
- largeBlock
- warnerDistance
- public RunTimeReturn getRunTimeVelocity(Train Train, double d, double d1)
Train
- d
- d1
- public StatusTraverseBlock traverseBlock(Train train, double arrivalTime, double departureTime, double startVelocity, Link previousLink, Link nextFastestLink, double profileStartingMilePost, SimulationInstance simulationInstance, int nextReferenceLoopNumber)
Train
- arrivalTime
- departureTime
- startVelocity
- nextFastestLink
- nextReferenceLoopNumber
- simulationType
- numberOfSignalAspects
- link
- StatusTraverseBlock
public boolean isLoop()
public boolean isSignalFailed(double time)
time
- public boolean isDirectionOk(Train Train, double arrivalTime)
Train
- arrivalTime
- public double addTinyBlocksToEmptyBlock(Link previousLink, Block iterBlock, Train train, Link nextIterLink, double milepost, boolean enteredOnYellow)
iterLink
- tinyBlockArray
- Train
- iterBlock
- nextIterLink
- milepost
- enteredOnYellow
- public boolean allowsTrain(Train currTrain, double arrivalTime, java.lang.String TRAIN_TYPE_ALLOWED_ON_THIRD_LINE)
public int getBlockNo()
public void setBlockNo(int blockNo)
public java.lang.String getBlockName()
public void setBlockName(java.lang.String blockName)
public Signal getBlockSignal(int direction)
public void setBlockSignal(int direction, Signal signal)
public boolean isWarner()
public void setWarner(boolean warner)
public TinyBlockList getSfsr()
public void setSfsr(TinyBlockList sfsr)
public TinyBlockList getNightsfsr()
public void setNightsfsr(TinyBlockList nightsfsr)
public LinkList getNextLinks()
public void setNextLinks(LinkList nextBlocks)
public LinkList getPreviousLinks()
public void setPreviousLinks(LinkList previousBlocks)
public int getSignalFailFlag()
public void setSignalFailFlag(int signalFailFlag)
public BlockDirectionInInterval getBlockDirectionInInterval()
public void setBlockDirectionInInterval(BlockDirectionInInterval blockDirectionInInterval)
public static java.util.logging.Logger getLogger()
public static void setLogger(java.util.logging.Logger logger)
public SignalFailure getSignalFailure()
public void setSignalFailure(SignalFailure signalFailure)
public void printOccupancies(int trainNo)
public double returnMaxSpeedBetweenMilePosts(double start, double end)
public Gradient returnGradientFormat(double startMilePost, double endMilePost)
public GradientList getGradientList()
public void setGradientList(GradientList gradientList)
public java.util.ArrayList<Block> splitBlock(double newMilepost)
public double getOverlapDistance(int trainDirection)
public double getOccupancyTimeByTrain(Train train)
public IntervalArray getOnlyActualOccupancies()
public VelocityProfileArray getVelocityProfileArray(Train train, int signal, double startVelocity, double endVelocity, Link nextLink, Link previousLink, double profileStartingMilePost, boolean enteredOnYellow, boolean enteringNextBlockOnYellow)
public void setEndMilePostDirectly(double endMilePost)
public void readCommonBlockLoopProperties(java.io.StreamTokenizer streamTokenizer) throws java.io.IOException
java.io.IOException
public java.lang.String getLinkListString(int direction)
public java.lang.String getLinkPrioritiesString(int direction)
public java.lang.String getLinkCrossoversString(int direction)
public java.lang.String getLinkLengthsString(int direction)
public java.lang.String getSpeedLimitsString()
public java.lang.String getSpeedLimitStartMilePostsString()
public java.lang.String getSpeedLimitEndMilePostsString()