java.lang.Object
org.bzdev.devqsim.SimObject
org.bzdev.drama.generic.GenericSimObject<S,A,C,D,DM,F,G>
org.bzdev.drama.generic.GenericTaskObject<S,A,C,D,DM,F,G>
org.bzdev.drama.generic.GenericCondition<DramaSimulation,Actor,Condition,Domain,DomainMember,DramaFactory,Group>
org.bzdev.drama.Condition
org.bzdev.bikeshare.HubCondition
- All Implemented Interfaces:
NamedObjectOps
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.
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 Summary
Modifier and TypeMethodDescriptionboolean
protected Object
clone()
final boolean
delete()
final boolean
Get the last hub that was changed.boolean
Determine if the last hub that was changed has bicycles in its overflow area.boolean
Determine if the last hub that was changed has more bicycles stored at the hub's preferred location than the upper trigger valueGet the set of hubs whose bicycle count at the preferred location is between or at the lower and upper triggers.boolean
Determine if the last hub that was changed has fewer bicycles at the hub's preferred location than the lower trigger value.final String
getName()
protected Simulation
Get the set containing the hubs whose bicycle count in the overflow area is nonzero.Get the set containing the hubs whose bicycle count at the preferred location exceeds the value of the upper trigger.Get the set containing the hubs whose bicycle count at the preferred location is below the value of the lower trigger.protected void
hubChanged
(Hub hub, int nb, int eb, int ofb) Notify a HubCondition of a change.final boolean
boolean
void
printState
(String iPrefix, String prefix, boolean printName, PrintWriter out) Print the state for an instance of HubCondition.Methods inherited from class org.bzdev.drama.generic.GenericCondition
completeNotification, domainSet, hasObserver, impactsDomain, notifyObservers, observerCollection, onDelete, printConfiguration
Methods inherited from class org.bzdev.drama.generic.GenericTaskObject
cancelDefaultCall, cancelDefaultTask, defaultCall, defaultTask, scheduleDefaultCall, scheduleDefaultTask, scheduleDefaultTask
Methods inherited from class org.bzdev.drama.generic.GenericSimObject
getSimulation
Methods inherited from class org.bzdev.devqsim.SimObject
addSimulationListener, addTraceSet, bindCallable, bindCallable, bindCallable, bindCallable, bindRunnable, bindRunnable, bindRunnable, bindRunnable, callableObject, callableScript, callScriptFunction, callScriptMethod, clearTraceSets, evalScript, getEventListenerList, getScriptObject, getTraceSets, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printConfiguration, printState, printState, printState, printState, printState, printState, putScriptObject, removeSimulationListener, removeTraceSet, runnableObject, runnableScript, scheduleCall, scheduleCall, scheduleCall, scheduleCall, scheduleCallObject, scheduleScript, scheduleTask, scheduleTask, scheduleTask, scheduleTask, scheduleTaskObject, scheduleTaskScript, startImmediateTask, startImmediateTask, trace, trace, unscheduledTaskThread, unscheduledTaskThread, update, update, usesTraceSet
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bzdev.obnaming.NamedObjectOps
canDelete, delete, deletePending, getName, isDeleted, isInterned
-
Method Details
-
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
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
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
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
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
-
printState
Print the state for an instance of HubCondition. The documentation for methodSimObject.printState(String,String,boolean,java.io.PrintWriter)
contains a description of how this method is used and how to override it. The methodGenericSimObject.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 classGenericSimObject<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 stringprefix
- a prefix string (typically whitespace) to put at the start of each line other than the initial line that is printed when printName is trueprintName
- requests printing the name of an objectout
- the output print writer
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
isInterned
public boolean isInterned()- Specified by:
isInterned
in interfaceNamedObjectOps
-
getObjectNamer
-
getName
- Specified by:
getName
in interfaceNamedObjectOps
-
canDelete
public boolean canDelete()- Specified by:
canDelete
in interfaceNamedObjectOps
-
delete
public final boolean delete()- Specified by:
delete
in interfaceNamedObjectOps
-
isDeleted
public final boolean isDeleted()- Specified by:
isDeleted
in interfaceNamedObjectOps
-
deletePending
public final boolean deletePending()- Specified by:
deletePending
in interfaceNamedObjectOps
-