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

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
All Implemented Interfaces:
Type, gov.nasa.arc.brahms.common.IConstants, java.io.Serializable
Direct Known Subclasses:
ActiveConcept, ConceptualConcept, Current, GeographyConcept

public class Concept
extends NamedModelElement
implements Type

class Concept

Version:
$Revision: 1.5 $ $Date: 2009/11/23 19:08:55 $ $Author: rnado $
Author:
Ron van Hoof
See Also:
Serialized Form

Field Summary
static java.lang.String ATTRIBUTES_PROPERTY
           
static java.lang.String 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
Concept()
           
Concept(java.lang.String name)
           
Concept(java.lang.String file, int line)
           
Concept(java.lang.String name, java.lang.String file, int line)
           
 
Method Summary
 boolean addAttribute(Attribute att)
           
 boolean addRelation(Relation rel)
           
 boolean compareTypes(Type type, boolean target)
          This method compares this type with the given type and checks based on the target flag whether the types can be converted to one another.
 IConceptCtx createContext()
          Creates a new context for this concept for use in a virtual machine.
 boolean equals(java.lang.Object obj)
          Tests whether two concepts are identical.
 Attribute getAttribute(java.lang.String name)
          Returns the Attribute with the specified name.
 Attribute getAttribute(java.lang.String name, boolean includeParents)
          Returns the Attribute with the specified name.
 java.util.Enumeration getAttributes()
           
 java.util.Enumeration getAttributes(boolean includeParents)
          Returns the concepts' attributes.
 IConceptCtx getContext()
          Returns the concept's context used in a virtual machine.
 java.lang.String getFullyQualifiedName()
          Returns the fully qualified name of the concept.
 java.lang.String getIcon()
           
 Model getModel()
           
 java.lang.String getName()
          Returns the name or String representation of the type
 java.lang.String getPackage()
          Returns the package in which this concept is defined in and belongs to.
 Relation getRelation(java.lang.String name)
          Returns the Relation with the specified name.
 Relation getRelation(java.lang.String name, boolean includeParents)
          Returns the Relation with the specified name.
 java.util.Enumeration getRelations()
           
 java.util.Enumeration getRelations(boolean includeParents)
          Returns the concepts' relations.
 int getType()
          Returns the type represented by this type.
 boolean hasAttributes()
           
 boolean hasRelations()
           
 boolean isLocal()
          Returns whether the concept is loaded locally or remotely in another virtual machine.
 boolean isSerializable()
          Returns whether the concept is serializable.
 boolean removeAttribute(java.lang.String name)
           
 boolean removeRelation(java.lang.String name)
           
protected  void setContext(IConceptCtx ctx)
          Sets the context for this concept for use in a virtual machine.
 void setIcon(java.lang.String icon)
           
 void setLocal(boolean local)
          Specifies whether the concept is loaded locally or remotely in another virtual machine.
 void setModel(Model model)
           
 void setPackage(java.lang.String sPackage)
          Sets the package in which this concept is defined in and belongs to.
 void setSerializable(boolean serializable)
          Specifies whether the concept is serializable.
 java.lang.String toString()
          Returns a string representation of this concept, the fully qualified name.
 
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
delete, export, getFile, getID, getLine, getSerialNumber, isBCC, isDynamic, isLoaded, isResolved, setBCC, setDynamic, setFile, setID, 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
 

Field Detail

ATTRIBUTES_PROPERTY

public static final java.lang.String ATTRIBUTES_PROPERTY
See Also:
Constant Field Values

RELATIONS_PROPERTY

public static final java.lang.String RELATIONS_PROPERTY
See Also:
Constant Field Values
Constructor Detail

Concept

public Concept()

Concept

public Concept(java.lang.String name)

Concept

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

Concept

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

getName

public java.lang.String getName()
Description copied from interface: Type
Returns the name or String representation of the type

Specified by:
getName in interface Type
Overrides:
getName in class NamedModelElement
Returns:
String the String representation

setModel

public void setModel(Model model)

getModel

public Model getModel()

setIcon

public void setIcon(java.lang.String icon)

getIcon

public java.lang.String getIcon()

setPackage

public void setPackage(java.lang.String sPackage)
Sets the package in which this concept is defined in and belongs to.

Parameters:
sPackage - the package statement

getPackage

public java.lang.String getPackage()
Returns the package in which this concept is defined in and belongs to.

Returns:
String the concept's package

getFullyQualifiedName

public java.lang.String getFullyQualifiedName()
Returns the fully qualified name of the concept. The fully qualified name of a concept is the package name of the concept followed by the name of the concept.

Specified by:
getFullyQualifiedName in interface Type
Overrides:
getFullyQualifiedName in class NamedModelElement
Returns:
String the fully qualified name

setLocal

public final void setLocal(boolean local)
Specifies whether the concept is loaded locally or remotely in another virtual machine.

Parameters:
local - true if the concept is loaded locally, false if remotely

isLocal

public final boolean isLocal()
Returns whether the concept is loaded locally or remotely in another virtual machine.

Returns:
boolean true if the concept is loaded locally, false if remotely

setSerializable

public final void setSerializable(boolean serializable)
Specifies whether the concept is serializable.

Parameters:
local - true if the concept is loaded locally, false if remotely

isSerializable

public final boolean isSerializable()
Returns whether the concept is serializable.

Returns:
boolean true if the concept is loaded locally, false if remotely

addAttribute

public boolean addAttribute(Attribute att)

removeAttribute

public boolean removeAttribute(java.lang.String name)

getAttribute

public Attribute getAttribute(java.lang.String name)
                       throws java.util.NoSuchElementException
Returns the Attribute with the specified name.

Parameters:
name - the name of the requested attribute
Returns:
Attribute if the attribute with the specified name is defined for this concept
Throws:
java.util.NoSuchElementException - if the attribute with the specified name is not defined for this concept (could be defined in one of its parent concepts)

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.

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).

hasAttributes

public boolean hasAttributes()

getAttributes

public java.util.Enumeration getAttributes()

getAttributes

public java.util.Enumeration getAttributes(boolean includeParents)
Returns the concepts' attributes. If the includeParents flag is false it excludes the inherited attributes defined for its parent classes or superclasses (if they exist). If the flag is true it includes the inherited attributes defined for its parent classes or superclasses.

Parameters:
includeParents - true if also the inherited attributes of its classes and superclasses are to be included, false otherwise
Returns:
Enumeration a list of all the concept's attibutes

addRelation

public boolean addRelation(Relation rel)

removeRelation

public boolean removeRelation(java.lang.String name)

getRelation

public Relation getRelation(java.lang.String name)
                     throws java.util.NoSuchElementException
Returns the Relation with the specified name.

Parameters:
name - the name of the requested relation
Returns:
Relation if the relation with the specified name is defined for this concept
Throws:
java.util.NoSuchElementException - if the relation with the specified name is not defined for this concept (could be defined in one of its parent concepts)

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.

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).

hasRelations

public boolean hasRelations()

getRelations

public java.util.Enumeration getRelations()

getRelations

public java.util.Enumeration getRelations(boolean includeParents)
Returns the concepts' relations. If the includeParents flag is false it excludes the inherited relations defined for its parent classes or superclasses (if they exist). If the flag is true it includes the inherited relations defined for its parent classes or superclasses.

Parameters:
includeParents - true if also the inherited relations of its classes and superclasses are to be included, false otherwise
Returns:
Enumeration a list of all the concept's relations

getType

public int getType()
Description copied from interface: Type
Returns the type represented by this type.

Specified by:
getType in interface Type
Returns:
int the represented type

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.

Returns:
ConceptCtx the concept's context

setContext

protected void setContext(IConceptCtx ctx)
Sets the context for this concept for use in a virtual machine.

Parameters:
ctx - the concept's context

getContext

public IConceptCtx getContext()
Returns the concept's context used in a virtual machine.

Returns:
IConceptCtx the concept's context

compareTypes

public boolean compareTypes(Type type,
                            boolean target)
This method compares this type with the given type and checks based on the target flag whether the types can be converted to one another. If target is true this method checks if the given type can be converted to or is compatible with this type. If target is false this method checks whether this type can be converted to or is compatible with the given type.

Specified by:
compareTypes in interface Type
Parameters:
type - the type to compare this type with
target - true if this type is the target false if the given type ios the target
Returns:
boolean an true if the types are compatible, false otherwise

equals

public boolean equals(java.lang.Object obj)
Tests whether two concepts are identical. They are considered identical if their fully qualified names are identical. The FQNs must be unique in the name space regardless of the type of concept.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the Object to be compared for equality
Returns:
true if the two concepts are equal, false otherwise

toString

public java.lang.String toString()
Returns a string representation of this concept, the fully qualified name.

Overrides:
toString in class NamedModelElement
Returns:
String the fully qualified name of the concept


Copyright © 1997-2012 All Rights Reserved.