gov.nasa.arc.brahms.common.data
Class Agent

java.lang.Object
  extended by gov.nasa.arc.brahms.common.data.BrahmsObject
      extended by gov.nasa.arc.brahms.common.data.ModelElement
          extended by gov.nasa.arc.brahms.common.data.NamedModelElement
              extended by gov.nasa.arc.brahms.common.data.Concept
                  extended by gov.nasa.arc.brahms.common.data.ActiveConcept
                      extended by gov.nasa.arc.brahms.common.data.ActiveInstance
                          extended by gov.nasa.arc.brahms.common.data.Agent
All Implemented Interfaces:
IConceptInstance, Type, gov.nasa.arc.brahms.common.IConstants, java.io.Serializable
Direct Known Subclasses:
VMAgent

public class Agent
extends ActiveInstance

An agent in Brahms is the most central construct in a Brahms model. An agent represents an interactive system, a subject with behavior interacting with the world. An agent can for example represent a person in an organization, but could also represent an animal in a forest. A Brahms model is always about the activities of agents in a work process.

Version:
$Revision: 1.4 $ $Date: 2009/11/23 19:05:07 $ $Author: rnado $
Author:
Ron van Hoof
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gov.nasa.arc.brahms.common.data.Concept
ATTRIBUTES_PROPERTY, RELATIONS_PROPERTY
 
Fields inherited from class gov.nasa.arc.brahms.common.data.NamedModelElement
NAME_PROPERTY
 
Fields inherited from interface gov.nasa.arc.brahms.common.IConstants
ABORT, ACTIVECLASS, ACTIVECONCEPT, ACTIVEINSTANCE, AGENT, ANONYMOUS, ANYAGENT, AREA, AREADEF, ASSIGNED, ATTRIBUTE, BASEAREADEF, BASECLASS, BASECONCEPTUALCLASS, BASEGROUP, BASELIBRARY, BOOLEAN, BROADCAST, BUILDING, BYTE, CCLOCK, CDATE, CHAR, CITY, CLASS, CLOCK, COLLECTALL, COMMUNICATE, COMPLETE, COMPOSITE, COMPUTER, CONCEPT, CONCEPTUALCLASS, CONCEPTUALCONCEPT, CONCEPTUALOBJECT, CONTINUE, COPY, CREATEAGENT, CREATEAREA, CREATEOBJECT, current, CURRENT, DATAFRAME, DATE, DB, DETECTABLE, DIV, DOUBLE, EMAIL, EMPTY_STRING, END, ENDACTIVITY, ENTAGENT, EQ, EXCEPTION, EXPR, FACE2FACE, FACTFRAME, FALSE, FAX, FLOAT, FOREACH, FORONE, G2, GE, GEOGRAPHYCONCEPT, GESTURE, GET, GROUP, GT, IMPASSE, INT, INVALID, JAVA, JAVA_TYPE, KNOWN_MODIFIER, KNOWNVAL_MODIFIER, LE, LOCAL, LONG, LT, MAP, MINUS, MOD, MOVE, MULT, NE, NEW, NONE, NOT_MODIFIER, NOWORK, O, OA, OBJECT, ONTOLOGY, PAGER, PARAMETER, PATH, PHONE, PLUS, PRIMITIVE, PRIVATE, PROAGENT, PROTECTED, PRSAGENT, PUBLIC, PUT, RECEIVE, RELATION, sACTIVECLASS, sACTIVECONCEPT, sACTIVEINSTANCE, sAGENT, sARCHIVE, sAREA, sAREADEF, sBOOLEAN, sBYTE, sBYTECODEEXT, sCHAR, sCLASS, sCOMPUTER, sCONCEPT, sCONCEPTUALCLASS, sCONCEPTUALCONCEPT, sCONCEPTUALOBJECT, sCOPY, sCURRENT, sDETECTABLE, sDOUBLE, sEMAIL, sEND, SEND, sFACE2FACE, sFAX, sFILEEXT, sFLOAT, sGEOGRAPHYCONCEPT, sGROUP, SHORT, SIMAGENT, sINT, sJAVA_TYPE, sLONG, sMAP, sNEW, sNONE, sNOWORK, sOBJECT, SOURCECODE, sPAGER, sPARAMETER, sPATH, sPHONE, sPRIVATE, sPROJECTEXT, sPROTECTED, sPUBLIC, sSHORT, sSTART, sSTRING, sSYMBOL, START, STRING, sUNKNOWN, sVOID, SYMBOL, TRUE, UDT, UML, UNASSIGNED, UNDEFINED, unknown, UNKNOWN, UNKNOWN_MODIFIER, V, VARIABLE, VOID, WHENEVER, WORKFRAME, WORLD, XML
 
Constructor Summary
Agent()
           
Agent(java.lang.String name)
           
Agent(java.lang.String file, int line)
           
Agent(java.lang.String name, java.lang.String file, int line)
           
 
Method Summary
 boolean addParent(Group parent)
          Make the agent a member of the given group.
 IConceptCtx createContext()
          Creates a new context for this concept for use in a virtual machine.
 void delete()
          Deletes this agent from the model and removes all references to this agent in other model elements.
protected  java.util.LinkedList<Activity> getActivitiesRecursive(boolean includeThis)
          Returns the active concepts' activities including the activities inherited from its parent class and their parent super classes.
protected  java.util.LinkedList<Activity> getActivitiesRecursive(java.lang.String name, boolean includeThis)
          Searches for all activities with the specified name through the concept hierarchy breadth first.
protected  Activity getActivityByDescriptorRecursive(java.lang.String descriptor, boolean includeThis)
          Searches for the activity with the specified descriptor through the concept hierarchy breadth first.
protected  Attribute getAttributeRecursive(java.lang.String name, boolean includeThis)
          Searches for the attribute with the specified name through the concept hierarchy breadth first.
protected  java.util.LinkedList<Attribute> getAttributesRecursive(boolean includeThis)
          Returns the active concepts' attributes including the attributes inherited from its parent class and their parent super classes.
protected  java.util.LinkedList<InitialStatement> getInitialBeliefsRecursive(boolean includeThis)
          Returns the active concepts' initial beliefs including the initial beliefs of its parent class and their parent super classes.
protected  java.util.LinkedList<InitialStatement> getInitialFactsRecursive(boolean includeThis)
          Returns the active concepts' initial facts including the initial facts of its parent class and their parent super classes.
 Group getParent(java.lang.String name)
           
 java.util.Enumeration getParents()
           
 java.util.LinkedList<Group> getParents(boolean includeParents)
          Returns all parents for this concept, if includeParents is true it will include all parents, direct and indirect, breadth first.
protected  Relation getRelationRecursive(java.lang.String name, boolean includeThis)
          Searches for the relation with the specified name through the concept hierarchy breadth first.
protected  java.util.LinkedList<Relation> getRelationsRecursive(boolean includeThis)
          Returns the active concepts' relations including the relations inherited from its parent class and their parent super classes.
protected  java.util.LinkedList<Thoughtframe> getThoughtframesRecursive(boolean includeThis, boolean includeComposites)
          Returns the active concepts' thoughtframes including the thoughtframes of its parent class and their parent super classes.
protected  java.util.LinkedList<Workframe> getWorkframesRecursive(boolean includeThis, boolean includeComposites)
          Returns the active concepts' workframes including the workframes of its parent class and their parent super classes.
 boolean hasParents()
           
 boolean isExternal()
          Returns whether the agent is implemented in another language than Brahms.
 boolean isInstanceOf(Concept concept)
          Checks whether this active instance is an instance of the specified concept.
 boolean removeParent(java.lang.String name)
          Remove the relationship between the group and agent
 void setExternal(boolean external)
          Sets whether the agent is implemented in another language than Brahms.
protected  void setID()
          Sets the unique identifier.
 
Methods inherited from class gov.nasa.arc.brahms.common.data.ActiveInstance
getLocation, setLocation
 
Methods inherited from class gov.nasa.arc.brahms.common.data.ActiveConcept
addActivity, addInitialBelief, addInitialFact, addThoughtframe, addWorkframe, getActivities, getActivities, getActivities, getActivities, getActivityByDescriptor, getActivityByDescriptor, getAttribute, getAttributes, getCost, getInitialBeliefs, getInitialBeliefs, getInitialFacts, getInitialFacts, getLocalActivityByDescriptor, getRelation, getRelations, getThoughtframe, getThoughtframes, getThoughtframes, getThoughtframes, getTimeUnit, getWorkframe, getWorkframes, getWorkframes, getWorkframes, hasActivities, hasInitialBeliefs, hasInitialFacts, hasThoughtframes, hasWorkframes, removeActivity, removeThoughtframe, removeWorkframe, setCost, setTimeUnit
 
Methods inherited from class gov.nasa.arc.brahms.common.data.Concept
addAttribute, addRelation, compareTypes, equals, getAttribute, getAttributes, getContext, getFullyQualifiedName, getIcon, getModel, getName, getPackage, getRelation, getRelations, getType, hasAttributes, hasRelations, isLocal, isSerializable, removeAttribute, removeRelation, setContext, setIcon, setLocal, setModel, setPackage, setSerializable, toString
 
Methods inherited from class gov.nasa.arc.brahms.common.data.NamedModelElement
getDisplayText, getOwner, setDisplayText, setFullyQualifiedName, setName, setOwner
 
Methods inherited from class gov.nasa.arc.brahms.common.data.BrahmsObject
export, getFile, getID, getLine, getSerialNumber, isBCC, isDynamic, isLoaded, isResolved, setBCC, setDynamic, setFile, setID, setLine, setLoaded, setResolved, setSerialNumber
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nasa.arc.brahms.common.data.Type
getSerialNumber
 

Constructor Detail

Agent

public Agent()

Agent

public Agent(java.lang.String name)

Agent

public Agent(java.lang.String file,
             int line)

Agent

public Agent(java.lang.String name,
             java.lang.String file,
             int line)
Method Detail

setID

protected void setID()
Sets the unique identifier.

Overrides:
setID in class BrahmsObject

setExternal

public void setExternal(boolean external)
Sets whether the agent is implemented in another language than Brahms.

Parameters:
external - true if the agent is implemented in another language, false if the agent is implemented in Brahms.

isExternal

public boolean isExternal()
Returns whether the agent is implemented in another language than Brahms.

Returns:
boolean true if the agent is implemented in another language, false if the agent is implemented in Brahms.

addParent

public boolean addParent(Group parent)
Make the agent a member of the given group.

Parameters:
parent - the Group to add
Returns:
boolean true if added, false otherwise

removeParent

public boolean removeParent(java.lang.String name)
Remove the relationship between the group and agent

Parameters:
name - the name of the parent to remove
Returns:
boolean true if removed, false otherwise

getParent

public Group getParent(java.lang.String name)
                throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

hasParents

public boolean hasParents()

getParents

public java.util.Enumeration getParents()

getParents

public java.util.LinkedList<Group> getParents(boolean includeParents)
Returns all parents for this concept, if includeParents is true it will include all parents, direct and indirect, breadth first.

Parameters:
includeParents - true if also indirect parents are to be included in the list, false if only th direct parents are to be returned
Returns:
LinkedList the list of parents.

delete

public void delete()
Deletes this agent from the model and removes all references to this agent in other model elements.

Overrides:
delete in class ActiveConcept

getAttributeRecursive

protected Attribute getAttributeRecursive(java.lang.String name,
                                          boolean includeThis)
Searches for the attribute with the specified name through the concept hierarchy breadth first. If the attribute with the specified name is found it is returned, otherwise null is returned.

Specified by:
getAttributeRecursive in class ActiveConcept
Parameters:
name - the name of the attribute to be found
includeThis - flag indicating whether to search for the attribute in this concept or only to search in the parents
Returns:
Attribute the attribute if it was found, null otherwise

getAttributesRecursive

protected java.util.LinkedList<Attribute> getAttributesRecursive(boolean includeThis)
Returns the active concepts' attributes including the attributes inherited from its parent class and their parent super classes. The attributes are retrieved recursively breadth first.

Note:When processing this list in other methods and an attribute with the same name occurs more then once, then only the last occurrence is to be used by the active concept. The list contains the attibutes starting with the attributes highest in the class hierarchy.

Specified by:
getAttributesRecursive in class ActiveConcept
Parameters:
ll - the LinkedList to which to add the attributes found
includeThis - flag indicating whether to include the attibutes for this concept or only to return the parent attributes
concepts - a table containing the concepts from which attributes were already retrieved. This table is necessary to prevent circular loops.
Returns:
LinkedList the active concept's (parent) attributes

getRelationRecursive

protected Relation getRelationRecursive(java.lang.String name,
                                        boolean includeThis)
Searches for the relation with the specified name through the concept hierarchy breadth first. If the relation with the specified name is found it is returned, otherwise null is returned.

Specified by:
getRelationRecursive in class ActiveConcept
Parameters:
name - the name of the relation to be found
includeThis - flag indicating whether to search for the relation in this concept or only to search in the parents
Returns:
Relation the relation if it was found, null otherwise

getRelationsRecursive

protected java.util.LinkedList<Relation> getRelationsRecursive(boolean includeThis)
Returns the active concepts' relations including the relations inherited from its parent class and their parent super classes. The relations are retrieved recursively breadth first.

Note:When processing this list in other methods and an relation with the same name occurs more then once, then only the last occurrence is to be used by the active concept. The list contains the relations starting with the relations highest in the class hierarchy.

Specified by:
getRelationsRecursive in class ActiveConcept
Parameters:
includeThis - flag indicating whether to include the relations for this concept or only to return the parent relations
Returns:
LinkedList the active concept's (parent) relations

getInitialBeliefsRecursive

protected java.util.LinkedList<InitialStatement> getInitialBeliefsRecursive(boolean includeThis)
Returns the active concepts' initial beliefs including the initial beliefs of its parent class and their parent super classes. The initial beliefs are retrieved recursively breadth first.

Note:The list contains the initial beliefs starting with the initial beliefs lowest in the class hierarchy.

Specified by:
getInitialBeliefsRecursive in class ActiveConcept
Parameters:
includeThis - flag indicating whether to include the initial beliefs for this concept or only to return the parent initial beliefs
Returns:
LinkedList the active concept's (parent) initial beliefs

getInitialFactsRecursive

protected java.util.LinkedList<InitialStatement> getInitialFactsRecursive(boolean includeThis)
Returns the active concepts' initial facts including the initial facts of its parent class and their parent super classes. The initial facts are retrieved recursively breadth first.

Note:The list contains the initial facts starting with the initial facts lowest in the class hierarchy.

Specified by:
getInitialFactsRecursive in class ActiveConcept
Parameters:
includeThis - flag indicating whether to include the initial facts for this concept or only to return the parent initial facts
Returns:
LinkedList the active concept's (parent) initial facts

getActivitiesRecursive

protected java.util.LinkedList<Activity> getActivitiesRecursive(java.lang.String name,
                                                                boolean includeThis)
Searches for all activities with the specified name through the concept hierarchy breadth first. Makes sure that all signatures are unique and that if multiple activities with the same signature exist in the hierarchy that the most specific activity is returned in the list.

Specified by:
getActivitiesRecursive in class ActiveConcept
Parameters:
name - the name of the activity to be found
includeThis - flag indicating whether to search for the activity in this concept or only to search in the parents
Returns:
LinkedList the activities if any were found, null otherwise

getActivityByDescriptorRecursive

protected Activity getActivityByDescriptorRecursive(java.lang.String descriptor,
                                                    boolean includeThis)
Searches for the activity with the specified descriptor through the concept hierarchy breadth first. If the activity with the specified descriptor is found it is returned, otherwise null is returned.

Specified by:
getActivityByDescriptorRecursive in class ActiveConcept
Parameters:
descriptor - the descriptor of the activity to be found
includeThis - flag indicating whether to search for the activity in this concept or only to search in the parents
Returns:
Activity the activity if it was found, null otherwise

getActivitiesRecursive

protected java.util.LinkedList<Activity> getActivitiesRecursive(boolean includeThis)
Returns the active concepts' activities including the activities inherited from its parent class and their parent super classes. The activities are retrieved recursively breadth first.

Note:When processing this list in other methods and an activity with the same name occurs more then once, then only the last occurrence is to be used by the active concept. The list contains the activities starting with the activities highest in the class hierarchy.

Specified by:
getActivitiesRecursive in class ActiveConcept
Parameters:
includeThis - flag indicating whether to include the activities for this concept or only to return the parent activities
Returns:
LinkedList the active concept's (parent) activities

getWorkframesRecursive

protected java.util.LinkedList<Workframe> getWorkframesRecursive(boolean includeThis,
                                                                 boolean includeComposites)
Returns the active concepts' workframes including the workframes of its parent class and their parent super classes. The workframes are retrieved recursively breadth first.

Note:When processing this list in other methods and a workframe with the same name occurs more then once, then only the last occurrence is to be used by the active concept. The list contains the frames starting with the frames highest in the class hierarchy.

Specified by:
getWorkframesRecursive in class ActiveConcept
Parameters:
includeThis - flag indicating whether to include the frames for this concept or only to return the parent frames
includeComposites - true if also the workframes specified in composite activities are to be returned.
Returns:
LinkedList the active concept's (parent) workframes

getThoughtframesRecursive

protected java.util.LinkedList<Thoughtframe> getThoughtframesRecursive(boolean includeThis,
                                                                       boolean includeComposites)
Returns the active concepts' thoughtframes including the thoughtframes of its parent class and their parent super classes. The thoughtframes are retrieved recursively breadth first.

Note:When processing this list in other methods and a thoughtframe with the same name occurs more then once, then only the last occurrence is to be used by the active concept. The list contains the frames starting with the frames highest in the class hierarchy.

Specified by:
getThoughtframesRecursive in class ActiveConcept
Parameters:
includeThis - flag indicating whether to include the frames for this concept or only to return the parent frames
includeComposites - true if also the thoughtframes specified in composite activities are to be returned.
Returns:
LinkedList the active concept's (parent) thoughtframes

createContext

public IConceptCtx createContext()
Creates a new context for this concept for use in a virtual machine.

Note: This method always returns a new instance and does not verify whether one is already created.

Specified by:
createContext in class ActiveInstance
Returns:
ConceptCtx the concept's context

isInstanceOf

public boolean isInstanceOf(Concept concept)
Checks whether this active instance is an instance of the specified concept.

Specified by:
isInstanceOf in class ActiveInstance
Parameters:
concept - the Concept to be checked to see if this active instance is an instance of the concept
Returns:
true if this active instance is an instance of the specified concept, false otherwise


Copyright © 1997-2012 All Rights Reserved.