Class InducedIdleEventNode

All Implemented Interfaces:
IOptimizationElement, INode, Serializable

public class InducedIdleEventNode extends EventNode
This class
Since:
31/01/2020
Version:
31/01/2020
Author:
DNA
See Also:
  • Field Details

  • Constructor Details

    • InducedIdleEventNode

      public InducedIdleEventNode(String nodeId, IOpeningHours openingHour, Duration duration, boolean isCausingIdleTimeCost)
      The constructor of an InducedIdleEventNode.

      The ID is the input nodeId plus the time of creation and a number that no other InducedIdleEventNode of the JVM gets (see getId()).

      Parameters:
      nodeId - the string ID of the Node
      openingHour - the iOpeningHour
      duration - the duration of the idle time
    • InducedIdleEventNode

      public InducedIdleEventNode(INode2NodeRelation rel, IOpeningHours openingHour, Duration duration, boolean isCausingIdleTimeCost)
      The constructor of an InducedIdleEventNode to add to the Node ID the Relations to another Node.
      Parameters:
      rel - the iNode2NodeRelation
      openingHour - the iOpeningHour
      duration - the duration of the idle time
  • Method Details

    • ofExistingId

      public static InducedIdleEventNode ofExistingId(String existingId, IOpeningHours openingHour, Duration duration, boolean isCausingIdleTimeCost)
      Creates an InducedIdleEventNode that keeps an existing ID, for example the ID of a node read from a JSON snapshot, so the routes of the snapshot still find it. No InducedIdleEventNode created later gets this ID. The creation time stamp is not set (see setCreationTimeStamp(long)).
      Parameters:
      existingId - the complete ID of the node
      openingHour - the iOpeningHour
      duration - the duration of the idle time
      isCausingIdleTimeCost - whether the idle time causes cost
      Returns:
      the node with the existing ID
    • getPartialNodeId

      public static String getPartialNodeId(String masterNodeId, String relatedNodeId)
      Gets the Node ID and adds the masterNodeId and the relatedNodeId.

      Used in InducedIdleEventNode(INode2NodeRelation, IOpeningHours, Duration) to add the IDs of the MasterNode and the RelatedNode to the to the ID of the InducedIdleEventNode

      Parameters:
      masterNodeId - the string ID of the MasterNode
      relatedNodeId - the string ID of the RelatedNode
      Returns:
      the ID in conjunction with the Master- and RelatedNode ID
    • getId

      public String getId()
      Gets the ID: the ID given to the constructor, the time it was created and its number, for example IDLE_EVENT_RELATION_(A -> B) CREATED::<creationTimeStamp> SEQ::<number>. The number is unique in the JVM: a number of the sequence, or inside an InducedIdleEventNode.IdScope the number of the scope and the count in it (SEQ::<number>.<count>).

      A node that keeps an existing ID (see ofExistingId(String, IOpeningHours, Duration, boolean)) returns that ID unchanged.

      Specified by:
      getId in interface IOptimizationElement
      Overrides:
      getId in class AbstractOptimizationElement
      Returns:
      the ID String
    • getShrinkedCopy

      public static InducedIdleEventNode getShrinkedCopy(InducedIdleEventNode baseEvent, long shinkMillis, long safetyAdditionalDuration, boolean isCausingIdleTimeCost)
      Gets a copy of the input Node where the input shinkMillis and safetyAdditionalDuration are substracted or added respectively from/to the end of the timeWindow of the OpeningHours in seconds.
      Parameters:
      baseEvent - the node to shrink
      shinkMillis - the long milliseconds to substract from the end of the OpeningHours
      safetyAdditionalDuration - the long milliseconds to add to the end of the OpeningHours
      Returns:
      a copy of the Node with the changed TimeWindow
    • setMasterNodeId

      public void setMasterNodeId(String connectedMasterNodeId)
      Sets the input ID as the MasterNode.

      This method does not actually set up Relations but only sets the input String in the class variable

      Parameters:
      connectedMasterNodeId - the string ID of the MasterNode
    • setRelatedNodeId

      public void setRelatedNodeId(String connectedRelatedNodeId)
      Sets the input ID as the RelatedNode

      This method does not actually set up Relations but only sets the input String in the class variable

      Parameters:
      connectedRelatedNodeId - the string ID of the MasterNode
    • setCreationTimeStamp

      public void setCreationTimeStamp(long creationTimeStamp)
      Sets the input in the form of System.currentTimeMillis() as the TimeStamp when the InducedIdleEventNode was created.

      The ID of a created node shows the new TimeStamp and keeps its number. A node with an existing ID keeps that ID.

      Parameters:
      creationTimeStamp - the long TimeStamp
    • getMasterNodeId

      public Optional<String> getMasterNodeId()
      Gets the ID of the MasterNode.
      Returns:
      the optional ID
    • getRelatedNodeId

      public Optional<String> getRelatedNodeId()
      Gets the ID of the RelatedNode.
      Returns:
      the optional ID
    • getCreationTimeStamp

      public Optional<Long> getCreationTimeStamp()
      Gets the TimeStamp of the creation of the InducedIdleEventNode as created by System.currentTimeMillis().
      Returns:
      the timestamp in milliseconds
    • hasRouteDependentVisitDuration

      public boolean hasRouteDependentVisitDuration()
      Description copied from interface: INode
      Checks for route dependent visit duration.
      Specified by:
      hasRouteDependentVisitDuration in interface INode
      Overrides:
      hasRouteDependentVisitDuration in class AbstractNode
      Returns:
      true, if successful