Class NodeSection

java.lang.Object
QueueNet.NodeSection
Direct Known Subclasses:
PipeSection

public abstract class NodeSection extends Object
This class implements a generic section of a NetNode.
Author:
Francesco Radaelli, Stefano Omini
  • Field Details

    • NO_ADDRESS

      public static final byte NO_ADDRESS
      Section without address.
      See Also:
    • INPUT

      public static final byte INPUT
      Input section address
      See Also:
    • SERVICE

      public static final byte SERVICE
      Service section address.
      See Also:
    • OUTPUT

      public static final byte OUTPUT
      Output section address.
      See Also:
    • MSG_NOT_PROCESSED

      public static final int MSG_NOT_PROCESSED
      Message passed has not been processed (general event).
      See Also:
    • MSG_PROCESSED

      public static final int MSG_PROCESSED
      Message passed has been processed (all events).
      See Also:
    • EXCEPTION_MEASURE_DOES_NOT_EXIST

      public static final int EXCEPTION_MEASURE_DOES_NOT_EXIST
      Exception ID: Required measure does not exist.
      See Also:
    • EXCEPTION_PROPERTY_NOT_AVAILABLE

      public static final int EXCEPTION_PROPERTY_NOT_AVAILABLE
      Exception ID: Required property is not available.
      See Also:
    • PROPERTY_ID_ARRIVING_JOBS

      public static final int PROPERTY_ID_ARRIVING_JOBS
      Property ID: number of jobs arriving at this section
      See Also:
    • PROPERTY_ID_DEPARTING_JOBS

      public static final int PROPERTY_ID_DEPARTING_JOBS
      Property ID: number of jobs departing from this section
      See Also:
    • PROPERTY_ID_RESIDENT_JOBS

      public static final int PROPERTY_ID_RESIDENT_JOBS
      Property ID: number of jobs inside this section
      See Also:
    • PROPERTY_ID_RESIDENCE_TIME

      public static final int PROPERTY_ID_RESIDENCE_TIME
      Property ID: residence time
      See Also:
    • PROPERTY_ID_UTILIZATION

      public static final int PROPERTY_ID_UTILIZATION
      Property ID: utilization
      See Also:
    • PROPERTY_ID_AVERAGE_UTILIZATION

      public static final int PROPERTY_ID_AVERAGE_UTILIZATION
      Property ID: average utilization
      See Also:
    • jobsList

      protected JobInfoList jobsList
    • logger

      protected JSimLogger logger
  • Constructor Details

    • NodeSection

      public NodeSection(byte id)
      Creates a new instance of this NodeSection. Note that, while building a new node section, node owner informations are not available. To set node section properties depending on the owner node ones, the "nodeLiked(...)" protected method should be used.
      Parameters:
      id - NodeSection identifier.
    • NodeSection

      public NodeSection(byte id, boolean auto)
      Creates a new instance of this NodeSection. Note that, while building a new node section, node owner informations are not available. To set node section properties depending on the owner node ones, the "nodeLiked(...)" protected method should be used.
      Parameters:
      id - NodeSection identifier.
      auto - Auto refresh of the jobsList attribute.
    • NodeSection

      public NodeSection(byte id, boolean auto, boolean nodeAuto)
      Creates a new instance of this NodeSection. Note that, while building a new node section, node owner informations are not available. To set node section properties depending on the owner node ones, the "nodeLiked(...)" protected method should be used.
      Parameters:
      id - NodeSection identifier.
      auto - Auto refresh of the jobsList attribute.
      nodeAuto - Auto refresh the jobsList attribute at node level
  • Method Details

    • nodeLinked

      protected void nodeLinked(NetNode node) throws NetException
      This method should be overridden to implement a specific behaviour of the node section when the node section itself is linked to the owner node. This method should be used to set node section properties depending on the owner node ones.
      Parameters:
      node - Owner node.
      Throws:
      NetException
    • getSectionID

      public byte getSectionID()
      Gets the id of the node section.
      Returns:
      node section identifier.
    • analyze

      public void analyze(int measureName, JobClass jobClass, Measure measurement) throws NetException
      Throws:
      NetException
    • analyze

      public void analyze(int name, JobClass jobClass, Measure measurement, boolean isServerType, int serverTypeId) throws NetException
      Analyzes a measure in the node section. Override this method to analyze a measure depending on the node section implementation. Note that the first 256 identifiers are reserved by NodeSection class.
      Parameters:
      name - name of the measure to be activated (see measures constants).
      jobClass - Job class to be analyzed.
      measurement - Set of measure to be activated.
      isServerType - the is server type
      serverTypeId - the server type id
      Throws:
      NetException
    • getOwnerNode

      public NetNode getOwnerNode()
      Gets the owner node of this section.
      Returns:
      Owner node.
    • isMyOwnerNode

      public boolean isMyOwnerNode(NetNode node)
      Checks if the specified node is the owner node of this section. Note that this method could be called only after that the owner node has been linked to this section.
      Parameters:
      node - node to be checked.
      Returns:
      True if the node is the owner node, false otherwise.
    • getJobClasses

      public JobClassList getJobClasses()
      Gets the list of the job classes of the owner queue network.
      Returns:
      Queue network job classes.
    • getClassCompatibilities

      public Boolean[][] getClassCompatibilities()
      Returns class compatibilities for specific node
    • getServerTypes

      public List<Server.ServerType> getServerTypes()
      Returns server types for specific node
    • getJobInfoList

      public JobInfoList getJobInfoList()
      Gets the job info list of this section.
      Returns:
      Job info list.
    • getIntSectionProperty

      public int getIntSectionProperty(int id) throws NetException
      Gets an integer type property of this node. Note that the first 256 identifiers are reserved by NodeSection class.
      Parameters:
      id - Property identifier (see properties constants).
      Returns:
      Property value.
      Throws:
      NetException - if the requested property is not available.
    • getIntSectionProperty

      public int getIntSectionProperty(int id, JobClass jobClass) throws NetException
      Gets an integer type property of this node depending on a specified job class. Note that the first 256 identifiers are reserved by NodeSection class.
      Parameters:
      id - Property identifier (see properties constants).
      jobClass - jobClass.
      Returns:
      Property value.
      Throws:
      NetException - if the requested property is not available.
    • getDoubleSectionProperty

      public double getDoubleSectionProperty(int id) throws NetException
      Gets a double type property of this node. Note that the first 256 identifiers are reserved by NodeSection class.
      Parameters:
      id - Property identifier (see properties constants).
      Returns:
      Property value.
      Throws:
      NetException - if the requested property is not available.
    • getDoubleSectionProperty

      public double getDoubleSectionProperty(int id, JobClass jobClass) throws NetException
      Gets a double type property of this node depending on a specified job class. Note that the first 256 identifiers are reserved by NodeSection class.
      Parameters:
      id - Property identifier (see properties constants).
      jobClass - jobClass.
      Returns:
      Property value.
      Throws:
      NetException - if the requested property is not available.
    • getParameter

      public Parameter getParameter(int id) throws NetException
      Gets a parameter type property of this node. Note that the first 256 identifiers are reserved by NodeSection class.
      Parameters:
      id - Property identifier.
      Returns:
      Property value.
      Throws:
      NetException - if the requested property is not available.
    • getParameter

      public Parameter getParameter(int id, JobClass jobClass) throws NetException
      Gets a parameter type property of this node depending on a specified job class. Note that the first 256 identifiers are reserved by NodeSection class.
      Parameters:
      id - Property identifier.
      jobClass - jobClass.
      Returns:
      Property value.
      Throws:
      NetException - if the requested property is not available.
    • getObject

      public Object getObject(int id) throws NetException
      Gets an object type property of this node. Note that the first 256 identifiers are reserved by NodeSection class.
      Parameters:
      id - Property identifier.
      Returns:
      Property value.
      Throws:
      NetException - if the requested property is not available.
    • getObject

      public Object getObject(int id, JobClass jobClass) throws NetException
      Gets an object type property of this node depending on a specified job class. Note that the first 256 identifiers are reserved by NodeSection class.
      Parameters:
      id - Property identifier.
      jobClass - the jobClass which property refers to.
      Returns:
      Property value.
      Throws:
      NetException - if the requested property is not available.
    • isEnabled

      public boolean isEnabled(int id) throws NetException
      Checks if a property of this node is enabled. Note that the first 256 identifiers are reserved by NodeSection class.
      Parameters:
      id - Property identifier.
      Returns:
      Property value.
      Throws:
      NetException - if the requested property is not available.
    • isEnabled

      public boolean isEnabled(int id, JobClass jobClass) throws NetException
      Checks if a property of this node is enabled depending on a specified job class. Note that the first 256 identifiers are reserved by NodeSection class.
      Parameters:
      id - Property identifier.
      jobClass - jobClass.
      Returns:
      Property value.
      Throws:
      NetException - if the requested property is not available.
    • process

      protected abstract int process(NetMessage message) throws NetException, IncorrectDistributionParameterException
      This method should be overridden to implement a specific NetMessage processor.
      Parameters:
      message - message to be processed.
      Returns:
      message processing result.
      Throws:
      NetException
      IncorrectDistributionParameterException
    • send

      protected RemoveToken send(int event, Object data, double delay, byte destinationSection, NetNode destination)
      Sends an event to a section of a node.
      Parameters:
      event - event to be sent.
      data - data to be attached to the message.
      delay - Scheduling delay.
      destinationSection - destination section.
      destination - destination node.
      Returns:
      a token to remove sent event.
    • send

      protected RemoveToken send(int event, Object data, double delay, NetNode destination)
      Sends an event to the input section of a node.
      Parameters:
      event - event to be sent.
      data - data to be attached to the message.
      delay - Scheduling delay.
      destination - destination node.
      Returns:
      a token to remove sent event.
    • send

      protected RemoveToken send(int event, Object data, double delay, byte destinationSection)
      Sends an event to a section of this node.
      Parameters:
      event - event to be sent.
      data - data to be attached to the message.
      delay - Scheduling delay.
      destinationSection - Destination section.
      Returns:
      a token to remove sent event.
    • sendMe

      protected RemoveToken sendMe(int event, Object data, double delay)
      Sends an event to this section.
      Parameters:
      event - event to be sent.
      data - data to be attached to the message.
      delay - Scheduling delay.
      Returns:
      a token to remove sent event.
    • send

      protected RemoveToken send(Job job, double delay, byte destinationSection, NetNode destination)
      Sends a job to a section of a node.
      Parameters:
      job - job to be attached to the message.
      delay - Scheduling delay.
      destinationSection - destination section.
      destination - destination node.
      Returns:
      a token to remove sent event.
    • send

      protected RemoveToken send(Job job, double delay, NetNode destination)
      Sends a job to the input section of a node.
      Parameters:
      job - job to be attached to the message.
      delay - Scheduling delay.
      destination - destination node.
      Returns:
      a token to remove sent event.
    • send

      protected RemoveToken send(Job job, double delay, byte destinationSection)
      Sends a job to a section of this node.
      Parameters:
      job - job to be attached to the message.
      delay - Scheduling delay.
      destinationSection - Destination section.
      Returns:
      a token to remove sent event.
    • sendMe

      protected RemoveToken sendMe(Job job, double delay)
      Sends a job to this section.
      Parameters:
      job - job to be attached to the message.
      delay - Scheduling delay.
      Returns:
      a token to remove sent event.
    • removeMessage

      protected boolean removeMessage(RemoveToken token)
      Removes a message previously sent.
      Parameters:
      token - the token to remove the message.
      Returns:
      true if message was removed, false otherwise.
    • isMine

      protected boolean isMine(NetMessage message)
      Checks if a message has been sent by this section. Note that this method could be called only after that the owner node has been linked to this section.
      Parameters:
      message - message to be checked.
      Returns:
      True if the message has been sent by this section, false otherwise.
    • redirect

      protected RemoveToken redirect(Job job, double delay, byte destinationSection, NetNode destination) throws NetException
      Redirects a job to a section of a node without updating measures.
      Parameters:
      job - job to be attached to the message.
      delay - Scheduling delay.
      destinationSection - destination section.
      destination - destination node.
      Returns:
      a token to remove sent event.
      Throws:
      NetException
    • sendAckAfterDrop

      protected RemoveToken sendAckAfterDrop(Job job, double delay, byte destinationSection, NetNode destination) throws NetException
      Sends an "ack" event to a section of a node to inform it that the job previously sent has been dropped.
      Parameters:
      job - job to be attached to the message.
      delay - Scheduling delay.
      destinationSection - destination section.
      destination - destination node.
      Returns:
      a token to remove sent event.
      Throws:
      NetException
    • updateVisitPath

      protected void updateVisitPath(Job job)
      Updates the visit path of this job.
      Parameters:
      job - job whose visit path is to be updated.
    • analyzeJoin

      public void analyzeJoin(int name, JobClass jobClass, Measure measurement) throws NetException
      Throws:
      NetException
    • analyzeFCR

      public void analyzeFCR(int name, Measure measurement) throws NetException
      Throws:
      NetException
    • analyzeFJ

      public void analyzeFJ(int name, JobClass jobClass, Measure measurement) throws NetException
      Throws:
      NetException
    • analyzeTransition

      public void analyzeTransition(int name, String modeName, Measure measurement) throws NetException
      Throws:
      NetException