ABLE 2.3.0 07/13/2005 14:21:00

com.ibm.able.beans.petrinet
Class AblePetriNet

java.lang.Object
  extended bycom.ibm.able.AbleObject
      extended bycom.ibm.able.AbleDefaultAgent
          extended bycom.ibm.able.beans.petrinet.AblePetriNet
All Implemented Interfaces:
AbleAgent, AbleBean, AbleBeanContainer, AbleDataBufferManager, AbleEventListener, AbleEventListenerManager, AbleEventQueueManager, AbleEventQueueProcessor, AblePropertyChangeManager, AbleSerializable, AbleUserDefinedFunctionManager, java.util.EventListener, java.beans.PropertyChangeListener, java.io.Serializable

public class AblePetriNet
extends AbleDefaultAgent
implements java.io.Serializable

This class represents a Petri net. For more information refer to the PetriNetAgent details or PetriNetTutorial.

See Also:
Serialized Form

Field Summary
protected  java.util.Vector myArcs
           
protected  java.lang.ClassLoader myClassLoader
          Classloader to use to dynamically load and create user data types.
protected  java.util.Vector myInitializationExpressions
           
protected  java.util.Vector myPlaces
           
protected  AbleRuleSet myRuleSet
           
protected  java.util.Vector myTransitions
           
 
Fields inherited from class com.ibm.able.AbleDefaultAgent
activeDataSource, defaultName, eventConnections, myBeans, numEpochs, processList, processListOK, userDefinedFunctions
 
Fields inherited from class com.ibm.able.AbleObject
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, properties, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace
 
Constructor Summary
AblePetriNet()
          Construct an instance of a Petri net
AblePetriNet(java.lang.String theName)
          Construct an instance of a Petri net
 
Method Summary
 void addArc(AblePetriArc theArc)
           
 void addBean(AbleBean theAbleBean)
          Adds a bean to this container/agent.
 void addDestBufferConnection(AbleBufferConnection theAbleBufferConnection)
          Adds a destination buffer connection.
 void addPlace(AblePetriPlace thePlace)
           
 void addSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
          Adds a source buffer connection.
 void addTransition(AblePetriTransition theTransition)
           
protected  void buildProcessList()
          Examine the list of contained beans AbleDefaultAgent.myBeans for dataflow connections, building a sequential processing list.
protected  void createRuleSet()
           
 java.util.Vector getArcs()
           
 java.lang.ClassLoader getClassLoader()
          Retrieve the Classloader used to load and create user data types
 java.util.Vector getDestBufferConnections()
          Returns the list of all destination (output) buffer connections.
 java.lang.String getExpressionText()
           
 AbleInferenceEngine getInferenceEngine()
           
 java.util.Vector getPlaces()
           
 AbleRule getRule(java.lang.String theRuleLabel)
           
 AbleRuleSet getRuleSet()
           
 java.util.Vector getSourceBufferConnections()
          Returns a list of all source (input) buffer connections.
 java.util.Vector getTransitions()
           
 AbleVariable getVariable(java.lang.String theVarName)
           
 java.util.Vector getVariables()
           
 java.lang.String getVariablesText()
           
 void init()
          Initialize the agent.
 void process()
          Performs the main, synchronous, standard processing function performed by this bean.
 void processTimerEvent()
          If running in autonomous mode, let the sleepTime control the rate we fire transitions
 void removeAllBeans()
          Removes all beans from this container.
 void removeArc(AblePetriArc theArc)
           
 void removeBean(AbleBean theAbleBean)
          Removes a bean from this container, and sets the bean's parent to null.
 void removeDestBufferConnection(AbleBufferConnection theAbleBufferConnection)
          Remove a destination buffer connection.
 void removePlace(AblePetriPlace thePlace)
           
 void removeSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
          Removes a source buffer connection.
 void removeTransition(AblePetriTransition theTransition)
           
 void setClassLoader(java.lang.ClassLoader theClassLoader)
          Set the Classloader to be used to load and create user data types
 void setExpressionText(java.lang.String text)
           
 void setVariablesText(java.lang.String text)
           
 java.lang.String toString()
           
 
Methods inherited from class com.ibm.able.AbleDefaultAgent
addBeans, addEventConnection, addUserDefinedFunction, clsNm, containsBean, containsBean, containsUserDefinedFunction, debugTrace, generateUniqueName, getBean, getBeans, getDataSource, getEventConnections, getNumEpochs, getProcessList, getUserDefinedFunction, getUserDefinedFunctions, handleAbleEvent, initAllBeans, invokeUserDefinedFunction, isActiveDataSource, propertyChange, quitAll, quitEnabledEventProcessing, removeAllConnections, removeAllEventConnections, removeBean, removeBeans, removeEventConnection, removeUserDefinedFunction, reset, resetAllBeans, resumeAll, setActiveDataSource, setDataFlowEnabled, setProcessList, setUserDefinedFunctions, suspendAll
 
Methods inherited from class com.ibm.able.AbleObject
addAbleEventListener, addPropertyChangeListener, addPropertyConnection, addStateChangeListener, dataChanged, firePropertyChange, flushAbleEventQueue, getAbleEventListeners, getAbleEventProcessingEnabled, getAbleEventQueueSize, getComment, getFileName, getInputBuffer, getInputBuffer, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, getOutputBufferAsStringArray, getOutputBufferContents, getParent, getProperties, getProperty, getPropertyChangeListeners, getPropertyConnectionManager, getSleepTime, getState, getTraceLogger, hasInputBuffer, hasOutputBuffer, init, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isChanged, isConnectable, isDataFlowEnabled, isTimerEventProcessingEnabled, notifyAbleEventListeners, process, processAbleEvent, processBufferConnections, processNoEventProcessingEnabledSituation, removeAbleEventListener, removeAllAbleEventListeners, removeAllBufferConnections, removeAllPropertyConnections, removeProperty, removePropertyChangeListener, removePropertyConnection, removeStateChangeListener, restartEnabledEventProcessing, restoreFromFile, restoreFromFile, restoreFromSerializedFile, restoreFromStream, resumeEnabledEventProcessing, saveToFile, saveToFile, setAbleEventProcessingEnabled, setChanged, setComment, setFileName, setInputBuffer, setInputBuffer, setLogger, setName, setOutputBuffer, setOutputBuffer, setParent, setProperties, setProperty, setSleepTime, setState, setTimerEventProcessingEnabled, setTraceLogger, sourceConnectionsOK, startEnabledEventProcessing, suspendEnabledEventProcessing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.able.AbleBean
getComment, getLogger, getName, getParent, getProperties, getProperty, getState, getTraceLogger, init, isChanged, process, removeProperty, setChanged, setComment, setLogger, setName, setParent, setProperties, setProperty, setState, setTraceLogger
 
Methods inherited from interface com.ibm.able.AbleDataBufferManager
getInputBuffer, getInputBuffer, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, getOutputBufferAsStringArray, getOutputBufferContents, hasInputBuffer, hasOutputBuffer, isConnectable, isDataFlowEnabled, processBufferConnections, removeAllBufferConnections, setInputBuffer, setInputBuffer, setOutputBuffer, setOutputBuffer
 
Methods inherited from interface com.ibm.able.AbleEventListenerManager
addAbleEventListener, dataChanged, getAbleEventListeners, notifyAbleEventListeners, removeAbleEventListener
 
Methods inherited from interface com.ibm.able.AbleEventQueueManager
flushAbleEventQueue, getAbleEventProcessingEnabled, getAbleEventQueueSize, getSleepTime, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isTimerEventProcessingEnabled, restartEnabledEventProcessing, resumeEnabledEventProcessing, setAbleEventProcessingEnabled, setSleepTime, setTimerEventProcessingEnabled, startEnabledEventProcessing, suspendEnabledEventProcessing
 
Methods inherited from interface com.ibm.able.AbleEventQueueProcessor
processAbleEvent, processNoEventProcessingEnabledSituation
 
Methods inherited from interface com.ibm.able.AblePropertyChangeManager
addPropertyChangeListener, addPropertyConnection, getPropertyChangeListeners, getPropertyConnectionManager, removeAllPropertyConnections, removePropertyChangeListener, removePropertyConnection
 
Methods inherited from interface com.ibm.able.AbleSerializable
getFileName, restoreFromFile, restoreFromFile, saveToFile, saveToFile, setFileName
 
Methods inherited from interface com.ibm.able.AbleBeanContainer
getName
 

Field Detail

myPlaces

protected java.util.Vector myPlaces

myTransitions

protected java.util.Vector myTransitions

myArcs

protected java.util.Vector myArcs

myInitializationExpressions

protected java.util.Vector myInitializationExpressions

myRuleSet

protected transient AbleRuleSet myRuleSet

myClassLoader

protected transient java.lang.ClassLoader myClassLoader
Classloader to use to dynamically load and create user data types. Defaults to the classloader used to create this AbleRuleSet object For use in complex environments (like Eclipse), where user classes may not be in same classpath as JVM.

Constructor Detail

AblePetriNet

public AblePetriNet()
             throws AbleException
Construct an instance of a Petri net


AblePetriNet

public AblePetriNet(java.lang.String theName)
             throws AbleException
Construct an instance of a Petri net

Method Detail

getPlaces

public java.util.Vector getPlaces()

getTransitions

public java.util.Vector getTransitions()

getArcs

public java.util.Vector getArcs()

addPlace

public void addPlace(AblePetriPlace thePlace)

removePlace

public void removePlace(AblePetriPlace thePlace)

addTransition

public void addTransition(AblePetriTransition theTransition)

removeTransition

public void removeTransition(AblePetriTransition theTransition)

addArc

public void addArc(AblePetriArc theArc)

removeArc

public void removeArc(AblePetriArc theArc)

init

public void init()
          throws AbleException
Description copied from class: AbleDefaultAgent
Initialize the agent. This implementation simply calls super.init() to set the agent state.

Contained beans are not initialized explicitly because some agents manage their contained beans directly. To initialize all contained beans, use AbleDefaultAgent.initAllBeans().

Specified by:
init in interface AbleBean
Overrides:
init in class AbleDefaultAgent
Throws:
AbleException
See Also:
AbleObject.init()

createRuleSet

protected void createRuleSet()
                      throws AbleException
Throws:
AbleException

getInferenceEngine

public AbleInferenceEngine getInferenceEngine()

getRule

public AbleRule getRule(java.lang.String theRuleLabel)

getRuleSet

public AbleRuleSet getRuleSet()

getVariable

public AbleVariable getVariable(java.lang.String theVarName)

getVariables

public java.util.Vector getVariables()

processTimerEvent

public void processTimerEvent()
                       throws AbleException
If running in autonomous mode, let the sleepTime control the rate we fire transitions

Specified by:
processTimerEvent in interface AbleEventQueueProcessor
Overrides:
processTimerEvent in class AbleObject
Throws:
AbleException - If an error occurs.

process

public void process()
             throws AbleException
Description copied from class: AbleDefaultAgent
Performs the main, synchronous, standard processing function performed by this bean. An AbleEvent.DATACHANGED event is propagated to registered listeners.

In this implementation, a single processing step is performed by walking through the process list and calling the process() method on each DataFlowEnabled AbleBean contained within this agent. If the agent itself is DataFlowEnabled, its inputBuffer is passed to the first bean in the process list, and the outputBuffer from the last bean in the process list populates the agent's outputBuffer.

Specified by:
process in interface AbleBean
Overrides:
process in class AbleDefaultAgent
Throws:
AbleException - If an error occurs. Errors from each contained bean are accumulated.

addSourceBufferConnection

public void addSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
Adds a source buffer connection.

An AbleProperty.SourceBufferConnections PropertyChangeEvent is fired.

Specified by:
addSourceBufferConnection in interface AbleDataBufferManager
Overrides:
addSourceBufferConnection in class AbleObject
Parameters:
theAbleBufferConnection - An AbleBufferConnection object including a bean whose output buffer populates this bean's input buffer.

removeSourceBufferConnection

public void removeSourceBufferConnection(AbleBufferConnection theAbleBufferConnection)
Removes a source buffer connection.

An AbleProperty.SourceBufferConnections PropertyChangeEvent is fired.

Specified by:
removeSourceBufferConnection in interface AbleDataBufferManager
Overrides:
removeSourceBufferConnection in class AbleObject
Parameters:
theAbleBufferConnection - The AbleBufferConnection object to be removed.

getSourceBufferConnections

public java.util.Vector getSourceBufferConnections()
Description copied from interface: AbleDataBufferManager
Returns a list of all source (input) buffer connections. Typically only one of these connections is to an active bean.

Specified by:
getSourceBufferConnections in interface AbleDataBufferManager
Overrides:
getSourceBufferConnections in class AbleObject

addDestBufferConnection

public void addDestBufferConnection(AbleBufferConnection theAbleBufferConnection)
Adds a destination buffer connection.

An AbleProperty.DestBufferConnections PropertyChangeEvent is fired.

Specified by:
addDestBufferConnection in interface AbleDataBufferManager
Overrides:
addDestBufferConnection in class AbleObject
Parameters:
theAbleBufferConnection - An AbleBufferConnection object including a bean whose input buffer is to be populated from this bean's output buffer.

removeDestBufferConnection

public void removeDestBufferConnection(AbleBufferConnection theAbleBufferConnection)
Remove a destination buffer connection.

An AbleProperty.DestBufferConnections PropertyChangeEvent is fired.

Specified by:
removeDestBufferConnection in interface AbleDataBufferManager
Overrides:
removeDestBufferConnection in class AbleObject
Parameters:
theAbleBufferConnection - The AbleBufferConnection object to be removed.

getDestBufferConnections

public java.util.Vector getDestBufferConnections()
Description copied from interface: AbleDataBufferManager
Returns the list of all destination (output) buffer connections.

Specified by:
getDestBufferConnections in interface AbleDataBufferManager
Overrides:
getDestBufferConnections in class AbleObject

addBean

public void addBean(AbleBean theAbleBean)
             throws AbleException
Adds a bean to this container/agent. The following special processing is performed:
  1. If the bean to be added is null or is already contained in this agent, this action is ignored.
  2. If there is already a bean with the same name, a unique name will be generated by appending an underscore and integer. The integer will be start with a value of 1 and be incremented until a unique name is found. The bean will be renamed.
  3. This agent will listen for property changes sent from the contained bean.
  4. If the bean is an AbleDataSource, an event connection between the bean and this agent will be constructed. Only one data source can be data flow enabled in a container at one time, so if the added bean is an an active data source, a previously active contained data source will be made inactive.
  5. The AbleDefaultAgent.processList will be recalculated on its next access or use.

Note that if the bean to be added has a current parent, the bean will be removed from that parent because an ABLE bean can have only one parent at a time. This method will set the specified bean's parent to be this agent.

Specified by:
addBean in interface AbleBeanContainer
Overrides:
addBean in class AbleDefaultAgent
Parameters:
theAbleBean - The bean to be added to this container.
Throws:
AbleException - If an error occurs.

removeBean

public void removeBean(AbleBean theAbleBean)
                throws AbleException
Removes a bean from this container, and sets the bean's parent to null. The following special processing is performed:
  1. If the bean to be removed is null or is not contained in this agent, this action is ignored.
  2. A property change event will be fired, causing the property listener between the bean and the container to be removed.
  3. Any existing event connection between the bean and this agent will be removed.
  4. The AbleDefaultAgent.processList will be recalculated on its next access or use.

Specified by:
removeBean in interface AbleBeanContainer
Overrides:
removeBean in class AbleDefaultAgent
Parameters:
theAbleBean - A bean that is to be removed from this container.
Throws:
AbleException - If an error occurs.

removeAllBeans

public void removeAllBeans()
                    throws AbleException
Description copied from interface: AbleBeanContainer
Removes all beans from this container. Sets each bean's parent to null.

Specified by:
removeAllBeans in interface AbleBeanContainer
Overrides:
removeAllBeans in class AbleDefaultAgent
Throws:
AbleException

toString

public java.lang.String toString()

getVariablesText

public java.lang.String getVariablesText()
Returns:

setVariablesText

public void setVariablesText(java.lang.String text)

getExpressionText

public java.lang.String getExpressionText()
Returns:

setExpressionText

public void setExpressionText(java.lang.String text)

setClassLoader

public void setClassLoader(java.lang.ClassLoader theClassLoader)
Set the Classloader to be used to load and create user data types

Parameters:
theClassLoader - The Classloader to be used to load and create user data types

getClassLoader

public java.lang.ClassLoader getClassLoader()
Retrieve the Classloader used to load and create user data types

Returns:
a ClassLoader

buildProcessList

protected void buildProcessList()
                         throws AbleException
Description copied from class: AbleDefaultAgent
Examine the list of contained beans AbleDefaultAgent.myBeans for dataflow connections, building a sequential processing list. Lists all datasource objects first starting with the one enabled for data flow, then all data buffer-connected objects in sequence, regardless of if they are on or off.

Overrides:
buildProcessList in class AbleDefaultAgent
Throws:
AbleException - If an error occurs.

ABLE 2.3.0 07/13/2005 14:21:00

(C) Copyright IBM Corporation 1999, 2005