Class Signal
-
- All Implemented Interfaces:
-
java.io.Serializable,jline.lang.Copyable
public class Signal extends JobClass implements Serializable
A signal placeholder class that automatically resolves to OpenSignal or ClosedSignal.
Signal is a placeholder class that users can use in both open and closed networks. The resolution to the concrete type (OpenSignal or ClosedSignal) happens during model finalization when getStruct() is called. This provides a simplified API where users don't need to explicitly choose between OpenSignal and ClosedSignal.
Resolution rules:
- If the network has a Source node: resolves to OpenSignal
- If the network has no Source node: resolves to ClosedSignal
For explicit control, users can directly use OpenSignal or ClosedSignal.
Signal types:
- NEGATIVE: Removes a job from the destination queue
- CATASTROPHE: Resets the destination queue to empty state
- REPLY: Triggers a reply action (unblocks servers waiting for reply)
Reference: Gelenbe, E. (1991). "Product-form queueing networks with negative and positive customers", Journal of Applied Probability
-
-
Field Summary
Fields Modifier and Type Field Description public SignalTypesignalTypepublic JobClasstargetJobClasspublic DiscreteDistributionremovalDistributionpublic RemovalPolicyremovalPolicypublic Networkmodelprotected JobClassTypetypeprotected intpriorityprotected booleancompletesprotected Stationrefstatprotected booleanisrefclassprotected intindexprotected doubledeadlinepublic Array<Integer>attributepublic intreplySignalClassIndexpublic Distributionpatiencepublic ImpatienceTypeimpatienceTypepublic BalkingStrategybalkingStrategypublic List<BalkingThreshold>balkingThresholdspublic DistributionretrialDelayDistributionpublic intmaxRetrialAttemptsprotected Stringname
-
Constructor Summary
Constructors Constructor Description Signal(Network model, String name, SignalType signalType, int priority, DiscreteDistribution removalDistribution, RemovalPolicy removalPolicy)Creates a new signal placeholder with full configuration for batch removal. Signal(Network model, String name, SignalType signalType, int priority)Creates a new signal placeholder with the specified type and priority. Signal(Network model, String name, SignalType signalType)Creates a new signal placeholder with the specified type and default priority (0).
-
Method Summary
Modifier and Type Method Description SignalTypegetSignalType()Gets the signal type for this signal class. voidsetSignalType(SignalType signalType)Sets the signal type for this signal class. JobClassgetTargetJobClass()Gets the associated job class. DiscreteDistributiongetRemovalDistribution()Gets the removal distribution for this negative signal. voidsetRemovalDistribution(DiscreteDistribution removalDistribution)Sets the removal distribution for this negative signal. RemovalPolicygetRemovalPolicy()Gets the removal policy for this negative signal. voidsetRemovalPolicy(RemovalPolicy removalPolicy)Sets the removal policy for this negative signal. NetworkgetModel()Gets the network model this signal belongs to. JobClassresolve(boolean isOpen, Station refstat)Resolves this Signal placeholder to OpenSignal or ClosedSignal. SignalforJobClass(JobClass jobClass)Associates this signal with a job class. intgetTargetJobClassIndex()Gets the index of the associated job class. booleanisCatastrophe()Returns whether this signal is a catastrophe (removes all jobs). voidprintSummary()Prints a summary of this signal class configuration. -
Methods inherited from class jline.lang.JobClass
expectsReply, getAttribute, getBalkingStrategy, getBalkingThresholds, getCompletes, getDeadline, getImpatienceType, getIndex, getJobClassType, getMaxRetrialAttempts, getNumberOfJobs, getPatience, getPriority, getReferenceStation, getReplySignalClassIndex, getRetrialDelayDistribution, hasBalking, hasImmediateFeedback, hasPatience, hasRetrial, isReferenceClass, isReferenceStation, setAttribute, setBalking, setBalking, setCompletes, setDeadline, setImmediateFeedback, setPatience, setPatience, setPriority, setReferenceClass, setReferenceStation, setReplySignalClassIndex, setRetrial, setRetrial -
Methods inherited from class jline.lang.Element
getName, setName -
Methods inherited from class jline.lang.Copyable
copy -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Signal
Signal(Network model, String name, SignalType signalType, int priority, DiscreteDistribution removalDistribution, RemovalPolicy removalPolicy)
Creates a new signal placeholder with full configuration for batch removal.- Parameters:
model- the network model to add this class toname- the name for this signal classsignalType- the type of signal (NEGATIVE, CATASTROPHE, or REPLY)priority- the priority level for signals in this classremovalDistribution- the distribution for number of jobs to remove (null for exactly 1)removalPolicy- the policy for selecting which jobs to remove
-
Signal
Signal(Network model, String name, SignalType signalType, int priority)
Creates a new signal placeholder with the specified type and priority.- Parameters:
model- the network model to add this class toname- the name for this signal classsignalType- the type of signal (NEGATIVE, CATASTROPHE, or REPLY)priority- the priority level for signals in this class
-
Signal
Signal(Network model, String name, SignalType signalType)
Creates a new signal placeholder with the specified type and default priority (0).- Parameters:
model- the network model to add this class toname- the name for this signal classsignalType- the type of signal (NEGATIVE, CATASTROPHE, or REPLY) - REQUIRED
-
-
Method Detail
-
getSignalType
SignalType getSignalType()
Gets the signal type for this signal class.
- Returns:
the signal type
-
setSignalType
void setSignalType(SignalType signalType)
Sets the signal type for this signal class.
- Parameters:
signalType- the new signal type
-
getTargetJobClass
JobClass getTargetJobClass()
Gets the associated job class.
- Returns:
the JobClass associated with this signal, or null if none
-
getRemovalDistribution
DiscreteDistribution getRemovalDistribution()
Gets the removal distribution for this negative signal.
The removal distribution determines how many positive customers are removed when this signal arrives at a queue. If null, exactly one customer is removed (default G-network behavior).
- Returns:
the removal distribution, or null for single removal
-
setRemovalDistribution
void setRemovalDistribution(DiscreteDistribution removalDistribution)
Sets the removal distribution for this negative signal.
- Parameters:
removalDistribution- the distribution for number of removals
-
getRemovalPolicy
RemovalPolicy getRemovalPolicy()
Gets the removal policy for this negative signal.
The removal policy determines which customers are selected for removal when this signal arrives at a queue.
- Returns:
the removal policy (RANDOM, FCFS, or LCFS)
-
setRemovalPolicy
void setRemovalPolicy(RemovalPolicy removalPolicy)
Sets the removal policy for this negative signal.
- Parameters:
removalPolicy- the policy for selecting customers to remove
-
getModel
Network getModel()
Gets the network model this signal belongs to.
- Returns:
the network model
-
resolve
JobClass resolve(boolean isOpen, Station refstat)
Resolves this Signal placeholder to OpenSignal or ClosedSignal.
- Parameters:
isOpen- true if the network is open (has Source node)refstat- reference station for closed networks (ignored for open)- Returns:
the resolved OpenSignal or ClosedSignal instance
-
forJobClass
Signal forJobClass(JobClass jobClass)
Associates this signal with a job class.
For REPLY signals, this specifies which job class's servers will be unblocked when this signal arrives.
- Parameters:
jobClass- the JobClass to associate with this signal- Returns:
this Signal instance (for method chaining)
-
getTargetJobClassIndex
int getTargetJobClassIndex()
Gets the index of the associated job class.
- Returns:
the index of the associated JobClass, or -1 if none
-
isCatastrophe
boolean isCatastrophe()
Returns whether this signal is a catastrophe (removes all jobs).
- Returns:
true if signalType is CATASTROPHE
-
printSummary
void printSummary()
Prints a summary of this signal class configuration.
-
-
-
-