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

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.GeographyConcept
                      extended by gov.nasa.arc.brahms.common.data.AreaDef
All Implemented Interfaces:
IConceptClass, Type, gov.nasa.arc.brahms.common.IConstants, java.io.Serializable
Direct Known Subclasses:
VMAreaDef

public class AreaDef
extends GeographyConcept
implements IConceptClass

An area definition is used for defining area constructs used for representing geographical information in a model. Area definitions are similar to classes in their use. Examples of area definitions are 'World', 'Building', and 'Floor'.

Version:
$Revision: 1.2 $ $Date: 2008/09/04 13:51:05 $ $Author: rvhoof $
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
AreaDef()
           
AreaDef(java.lang.String name)
           
AreaDef(java.lang.String file, int line)
           
AreaDef(java.lang.String name, java.lang.String file, int line)
           
 
Method Summary
 boolean addMember(Area concept)
           
 boolean addSubClass(AreaDef concept)
           
 boolean addSuperClass(AreaDef concept)
           
 void delete()
          Deletes this element from the model and removes all references to this element in other model elements.
 Attribute getAttribute(java.lang.String name, boolean includeParents)
          Returns the Attribute with the specified name.
protected  Attribute getAttributeRecursive(java.lang.String name, boolean includeThis)
          Searches for the attribute with the specified name through the concept hierarchy breadth first.
 java.util.Enumeration getAttributes(boolean includeParents)
          Returns the area def's attributes.
protected  java.util.LinkedList<Attribute> getAttributesRecursive(boolean includeThis)
          Returns the area def's attributes including the attributes inherited from its parent class and their parent super classes.
 java.util.Enumeration getInitialFacts(boolean includeParents)
          Returns the area def's initial facts.
protected  java.util.LinkedList<InitialStatement> getInitialFactsRecursive(boolean includeThis)
          Returns the area def's initial facts including the initial facts of its parent class and their parent super classes.
 Area getMember(java.lang.String name)
           
 java.util.Enumeration getMembers()
           
 java.util.List<Area> getMembers(boolean includeSubClasses)
          Returns a list of all the members of this class.
 void getMembersRecursive(java.util.HashMap<java.lang.String,Area> members, boolean includeSubClasses, java.util.HashMap<java.lang.String,AreaDef> classes)
          Returns a list of all the members of this class.
 Relation getRelation(java.lang.String name, boolean includeParents)
          Returns the Relation with the specified name.
protected  Relation getRelationRecursive(java.lang.String name, boolean includeThis)
          Searches for the relation with the specified name through the concept hierarchy breadth first.
 java.util.Enumeration getRelations(boolean includeParents)
          Returns the area def's relations.
protected  java.util.LinkedList<Relation> getRelationsRecursive(boolean includeThis)
          Returns the area def's relations including the relations inherited from its parent class and their parent super classes.
 AreaDef getSubClass(java.lang.String name)
           
 java.util.Enumeration getSubClasses()
           
 AreaDef getSuperClass(java.lang.String name)
           
 java.util.Enumeration getSuperClasses()
           
 java.util.LinkedList<AreaDef> getSuperClasses(boolean includeParents)
          Returns all superclasses for this concept, if includeParents is true it will include all superclasses, direct and indirect, breadth first.
 boolean hasMembers()
           
 boolean hasSubClasses()
           
 boolean hasSuperClasses()
           
 boolean isSubClassOf(Concept concept)
          Checks whether this area definition is a sub class of the specified concept.
protected  boolean isSubClassOf(Concept concept, java.util.Hashtable checked)
          Checks recursively whether this area definition is a sub class of the specified concept, checking the concept hierarchy.
 boolean removeMember(java.lang.String name)
           
 boolean removeSubClass(java.lang.String name)
           
 boolean removeSuperClass(java.lang.String name)
           
protected  void setID()
          Sets the unique identifier.
 
Methods inherited from class gov.nasa.arc.brahms.common.data.GeographyConcept
addInitialFact, getInitialFacts, hasInitialFacts
 
Methods inherited from class gov.nasa.arc.brahms.common.data.Concept
addAttribute, addRelation, compareTypes, createContext, 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

AreaDef

public AreaDef()

AreaDef

public AreaDef(java.lang.String name)

AreaDef

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

AreaDef

public AreaDef(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

addSuperClass

public boolean addSuperClass(AreaDef concept)

removeSuperClass

public boolean removeSuperClass(java.lang.String name)

getSuperClass

public AreaDef getSuperClass(java.lang.String name)
                      throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

hasSuperClasses

public boolean hasSuperClasses()

getSuperClasses

public java.util.Enumeration getSuperClasses()

getSuperClasses

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

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

addSubClass

public boolean addSubClass(AreaDef concept)

removeSubClass

public boolean removeSubClass(java.lang.String name)

getSubClass

public AreaDef getSubClass(java.lang.String name)
                    throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

hasSubClasses

public boolean hasSubClasses()

getSubClasses

public java.util.Enumeration getSubClasses()

addMember

public boolean addMember(Area concept)

removeMember

public boolean removeMember(java.lang.String name)

getMember

public Area getMember(java.lang.String name)
               throws java.util.NoSuchElementException
Throws:
java.util.NoSuchElementException

hasMembers

public boolean hasMembers()

getMembers

public java.util.Enumeration getMembers()

getMembers

public java.util.List<Area> getMembers(boolean includeSubClasses)
Returns a list of all the members of this class. If includeSubClasses is true it will also include all of the members of the subclasses.

Parameters:
includeSubClasses - true to include members of subclasses, false for only the direct members
Returns:
List the list of members, empty list if none found

getMembersRecursive

public void getMembersRecursive(java.util.HashMap<java.lang.String,Area> members,
                                boolean includeSubClasses,
                                java.util.HashMap<java.lang.String,AreaDef> classes)
Returns a list of all the members of this class. If includeSubClasses is true it will also include all of the members of the subclasses.

Parameters:
members - the map to which to add the members
includeSubClasses - true to include members of subclasses, false for only the direct members
classes - the map with classes for which members were already retrieved

getAttribute

public Attribute getAttribute(java.lang.String name,
                              boolean includeParents)
                       throws java.util.NoSuchElementException
Returns the Attribute with the specified name. If includeParents is set to true and the attribute with the specified name is not defined for this concept, this method will try to find the attribute in one of the parent concepts. If includeParents is false the search will be limited to the attributes specified for only this concept and not that of its parent concepts.

Overrides:
getAttribute in class Concept
Parameters:
name - the name of the requested attribute
includeParents - true if the search should also include the parent concept, false if not.
Returns:
Attribute if the attribute with the specified name was found
Throws:
java.util.NoSuchElementException - if the attribute with the specified name is not defined for this concept or its parent concepts (if includeParents is true).

getAttributes

public java.util.Enumeration getAttributes(boolean includeParents)
Returns the area def's attributes. If the includeParents flag is false it excludes the inherited attributes defined for its parent area defs or their superclasses. If the flag is true it includes the inherited attributes defined for its parent area defs or its superclasses.

Overrides:
getAttributes in class Concept
Parameters:
includeParents - true if also the inherited attributes of its superclasses are to be included, false otherwise
Returns:
Enumeration a list of all the area def's attibutes

getRelation

public Relation getRelation(java.lang.String name,
                            boolean includeParents)
                     throws java.util.NoSuchElementException
Returns the Relation with the specified name. If includeParents is set to true and the relation with the specified name is not defined for this concept, this method will try to find the relation in one of the parent concepts. If includeParents is false the search will be limited to the relations specified for only this concept and not that of its parent concepts.

Overrides:
getRelation in class Concept
Parameters:
name - the name of the requested relation
includeParents - true if the search should also include the parent concept, false if not.
Returns:
Relation if the relation with the specified name was found
Throws:
java.util.NoSuchElementException - if the relation with the specified name is not defined for this concept or its parent concepts (if includeParents is true).

getRelations

public java.util.Enumeration getRelations(boolean includeParents)
Returns the area def's relations. If the includeParents flag is false it excludes the inherited relations defined for its parent area defs or its superclasses. If the flag is true it includes the inherited relations defined for its parent area defs or superclasses.

Overrides:
getRelations in class Concept
Parameters:
includeParents - true if also the inherited relations of its superclasses are to be included, false otherwise
Returns:
Enumeration a list of all the area def's relations

getInitialFacts

public java.util.Enumeration getInitialFacts(boolean includeParents)
Returns the area def's initial facts. If the includeParents flag is false it excludes the initial facts defined for its parent classes or superclasses. If the flag is true it includes the initial facts defined for its parent classes or superclasses.

Parameters:
includeParents - true if also the initial facts of its parent classes and superclasses are to be included, false otherwise
Returns:
Enumeration a list of all the area def's initial facts

delete

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

Overrides:
delete in class BrahmsObject

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.

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 area def's 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 area def. The list contains the attibutes starting with the attributes highest in the class hierarchy.

Parameters:
includeThis - flag indicating whether to include the attibutes for this concept or only to return the parent attributes
Returns:
LinkedList the area def'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.

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 area def's 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 area def. The list contains the relations starting with the relations highest in the class hierarchy.

Parameters:
includeThis - flag indicating whether to include the relations for this concept or only to return the parent relations
Returns:
LinkedList the area def's (parent) relations

getInitialFactsRecursive

protected java.util.LinkedList<InitialStatement> getInitialFactsRecursive(boolean includeThis)
Returns the area def's 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.

Parameters:
includeThis - flag indicating whether to include the initial facts for this concept or only to return the parent initial facts
Returns:
LinkedList the area def's (parent) initial facts

isSubClassOf

public boolean isSubClassOf(Concept concept)
Checks whether this area definition is a sub class of the specified concept.

Parameters:
concept - the concept to be checked to see if it is a parent of this area definition.
Returns:
true if this area definition is a sub class of the concept, false otherwise

isSubClassOf

protected boolean isSubClassOf(Concept concept,
                               java.util.Hashtable checked)
Checks recursively whether this area definition is a sub class of the specified concept, checking the concept hierarchy.

Parameters:
concept - the concept to be checked to see if it is a parent of this area definition.
checked - the table with parents already checked in the hierarchy to prevent circular loops
Returns:
true if this area definition is a sub class of the concept, false otherwise


Copyright © 1997-2012 All Rights Reserved.