Class HubCondition

All Implemented Interfaces:
NamedObjectOps

public class HubCondition extends Condition
Condition class for tracking the status of a set of hubs A hub condition keeps track of sets of hubs that
  • have more bicycles at a hub's preferred location than the value of the hub's upper trigger.
  • have fewer bicycles at a hub's preferred location than the value of the hub's lower trigger.
  • have bicycles in a hub's overflow area.
  • have no more and no fewer bicycles at a hub's preferred location than the values of the hub's upper and lower triggers respectively.
A hub condition also keeps track of the last hub that changed its status (its membership in the sets listed above).

Normally a bub condition does not have to be created explicitly as a system domain will automatically create a condition and arrange for it to be configured.

  • Method Details

    • getChangedHub

      public Hub getChangedHub()
      Get the last hub that was changed.
      Returns:
      the last hub that was changed
    • getInOverSet

      public boolean getInOverSet()
      Determine if the last hub that was changed has more bicycles stored at the hub's preferred location than the upper trigger value
      Returns:
      true if the last hub that was changed has more bicycles stored at this hub's preferred location than the upper trigger value; false otherwise
    • getInOverflowSet

      public boolean getInOverflowSet()
      Determine if the last hub that was changed has bicycles in its overflow area.
      Returns:
      true if the last hub that was changed has bicycles in its overflow area; false otherwise
    • getInUnderSet

      public boolean getInUnderSet()
      Determine if the last hub that was changed has fewer bicycles at the hub's preferred location than the lower trigger value.
      Returns:
      true if the last hub that was changed has fewer bicycles at the hub's preferred location than the lower trigger value; false otherwise
    • getOverSet

      public Set<Hub> getOverSet()
      Get the set containing the hubs whose bicycle count at the preferred location exceeds the value of the upper trigger.
      Returns:
      the set containing the hubs whose bicycle count at the preferred location exceeds the value of the upper trigger
    • getOverflowSet

      public Set<Hub> getOverflowSet()
      Get the set containing the hubs whose bicycle count in the overflow area is nonzero.
      Returns:
      the set containing the hubs whose bicycle count in the overflow area is nonzero
    • getUnderSet

      public Set<Hub> getUnderSet()
      Get the set containing the hubs whose bicycle count at the preferred location is below the value of the lower trigger.
      Returns:
      the set containing the hubs whose bicycle count at the preferred location is below the value of the lower trigger
    • getInRangeSet

      public Set<Hub> getInRangeSet()
      Get the set of hubs whose bicycle count at the preferred location is between or at the lower and upper triggers.
      Returns:
      the set of hubs whose bicycle count at the preferred location is between or at the lower and upper triggers
    • hubChanged

      protected void hubChanged(Hub hub, int nb, int eb, int ofb)
      Notify a HubCondition of a change.
      Parameters:
      hub - the latest hub that changed its counts
      nb - the number of bicycles needed to get the bicycle count at the preferred location in range
      eb - the number of bicycles that should be removed from the preferred location to get the bicycle count at the preferred location in range
      ofb - the number of bicycles in the overflow region
    • printState

      public void printState(String iPrefix, String prefix, boolean printName, PrintWriter out)
      Print the state for an instance of HubCondition. The documentation for method SimObject.printState(String,String,boolean,java.io.PrintWriter) contains a description of how this method is used and how to override it. The method GenericSimObject.printState(String,String,boolean,java.io.PrintWriter) describes the data that will be printed for the superclass of this class. The data that will be printed when this method is called are the following.

      For class HubCondition:

      • last changed hub. The last hub that was changed.
      • inOverSet. True if the last hub that was changed has more bicycles stored at the hub's preferred location than the upper-trigger value.
      • inOverflowSet. True if the last hub that was changed has bicycles in its overflow area.
      • inUnderSet. True if the last hub that was changed has fewer bicycles at the hub's preferred location than the lower trigger value.
      • overSet. Get the set of hubs for which the number of bicycles at a hub's preferred location exceed the hub's upper trigger value.
      • overflowSet. Get the set of hubs for which the number of bicycles in the overflow area is nonzero.
      • underSet. Get the set of hubs for which the number of bicycles at a hub's preferred location is less than the lower trigger value.
      • inRangeSet. Get the set of hubs for which the number of bicycles at a hub's preferred location is between or at the lower and upper triggers.
      Overrides:
      printState in class GenericSimObject<DramaSimulation,Actor,Condition,Domain,DomainMember,DramaFactory,Group>
      Parameters:
      iPrefix - the prefix to use for an initial line when printName is true with null treated as an empty string
      prefix - a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is true
      printName - requests printing the name of an object
      out - the output print writer
    • clone

      protected Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • isInterned

      public boolean isInterned()
      Specified by:
      isInterned in interface NamedObjectOps
    • getObjectNamer

      protected Simulation getObjectNamer()
    • getName

      public final String getName()
      Specified by:
      getName in interface NamedObjectOps
    • canDelete

      public boolean canDelete()
      Specified by:
      canDelete in interface NamedObjectOps
    • delete

      public final boolean delete()
      Specified by:
      delete in interface NamedObjectOps
    • isDeleted

      public final boolean isDeleted()
      Specified by:
      isDeleted in interface NamedObjectOps
    • deletePending

      public final boolean deletePending()
      Specified by:
      deletePending in interface NamedObjectOps