public interface IJunction
This interface is for Junctions that IJunctionListener
s can register
with and listen to for updates to their set of attached
PlantComponent
s.
Normally, components that extend ICEObject
will use its methods to
notify listeners of changes. However, its methods are "blanket" notifications
that just mean something has changed, but not what.
In the interest of speeding up reactions to changes in Junction's pipes, this
interface provides methods to add and remove individual pipes as well as a
notify method that should call the appropriate notification method for all
registered IJunctionListeners.
Modifier and Type | Method and Description |
---|---|
void |
addInput(PlantComponent input)
Adds a PlantComponent as input to the Junction.
|
void |
addOutput(PlantComponent output)
Adds an output PlantComponent to the Junction.
|
java.util.ArrayList<PlantComponent> |
getInputs()
Gets the PlantComponents, usually Pipes or HeatExchangers, that are input
for the Junction.
|
java.util.ArrayList<PlantComponent> |
getOutputs()
Gets the PlantComponents, usually Pipes or HeatExchangers, that are
output for the Junction.
|
boolean |
isInput(PlantComponent component)
This method is used to determine if a component is connected to the
Junction as input or output.
|
void |
notifyJunctionListeners(java.util.List<PlantComponent> components,
boolean added)
Notifies all registered
IJunctionListener s of any added or
removed pipes in a separate notifier thread. |
void |
registerJunctionListener(IJunctionListener listener)
Registers an IJunctionListener to listen to the Junction for pipe add and
remove events, as well as any other specialized events that may be too
complex for a regular IUpdateableListener to interpret.
|
void |
removeInput(PlantComponent input)
Removes an input PlantComponent from the Junction.
|
void |
removeOutput(PlantComponent output)
Removes an output PlantComponent from the Junction.
|
void |
unregisterJunctionListener(IJunctionListener listener)
Unregisters an IJunctionListener from the Junction.
|
void registerJunctionListener(IJunctionListener listener)
listener
- The listener to register. Duplicate listeners are not
accepted.void unregisterJunctionListener(IJunctionListener listener)
listener
- The listener to unregister.void notifyJunctionListeners(java.util.List<PlantComponent> components, boolean added)
IJunctionListener
s of any added or
removed pipes in a separate notifier thread.components
- The PlantComponents that have been added or removed from the
Junction.added
- Whether the components were added or removed.boolean isInput(PlantComponent component)
component
- The PlantComponent that is either input or output.java.util.ArrayList<PlantComponent> getInputs()
java.util.ArrayList<PlantComponent> getOutputs()
void addInput(PlantComponent input)
input
- The PlantComponent that will be input for the Junction.void removeInput(PlantComponent input)
input
- The PlantComponent that should be removed from the Junction.void addOutput(PlantComponent output)
output
- The PlantComponent that should be removed from the Junction.void removeOutput(PlantComponent output)
output
- The PlantComponent that should be removed from the Junction.