gov.nasa.arc.brahms.common.rt
Class ConceptCtx

java.lang.Object
  extended by gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
      extended by gov.nasa.arc.brahms.common.rt.ConceptCtx
All Implemented Interfaces:
IBrahmsObjectCtx, IConceptCtx, IRuntimeConstants, java.io.Serializable
Direct Known Subclasses:
ActiveInstanceCtx, AreaCtx, ConceptualInstanceCtx, VMPathCtx

public class ConceptCtx
extends BrahmsObjectCtx
implements IConceptCtx

The ConceptCtx is the runtime representation of concepts defined in a Brahms model. The concept context manages the creation and deletion time of the concepts.

Version:
1.0
Author:
Ron van Hoof
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface gov.nasa.arc.brahms.common.rt.IRuntimeConstants
ABORTED, ACTIVE, ACTIVITY, AVAILABLE, COMPLETED, CONSEQUENCE, DETECTABLE, ENDED, ENGINE, EXTERNAL_AGENT, FROM, IMPASSED, INITIAL, INTERRUPTED, JAVA_PROPERTY, sABORTED, sACTIVE, sAVAILABLE, sCOMPLETED, sENDED, sIMPASSED, sINTERRUPTED, sUNAVAILABLE, TO, TRANSFER, UNAVAILABLE
 
Constructor Summary
ConceptCtx(Concept concept)
          Constructor, creates a new context for the specified concept.
 
Method Summary
protected  void addAttribute(Attribute att)
          Adds the specified attribute to the attribute cache containing a list of all the attributes specified for a concept, including the attributes specified for parent concepts (if available).
protected  void addRelation(Relation rel)
          Adds the specified relation to the relation cache containing a list of all the relations specified for a concept, including the relations specified for parent concepts (if available).
protected  Attribute getAttribute(java.lang.String name)
          Returns the attribute with the specified name from the cache.
protected  Relation getRelation(java.lang.String name)
          Returns the relation with the specified name from the cache.
protected  void initAttributeRelationCache()
          Initializes the cache for the attributes and relations.
protected  void removeAttribute(Attribute att)
          Removes the specified attribute from the attribute cache containing a list of all the attributes specified for a concept, including the attributes specified for parent concepts (if available).
protected  void removeRelation(Relation rel)
          Removes the specified relation from the relation cache containing a list of all the relations specified for a concept, including the relations specified for parent concepts (if available).
protected  void resetAttributeRelationCache()
          Resets the attribute and relation cache
 java.lang.String toString()
          Returns the fully qualified name of the conceptfor which this is a context
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setContextFor, setEndTime, setID, setStartTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IBrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime
 

Constructor Detail

ConceptCtx

public ConceptCtx(Concept concept)
Constructor, creates a new context for the specified concept.

Parameters:
concept - the concept for which to create a context
Method Detail

initAttributeRelationCache

protected void initAttributeRelationCache()
                                   throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Initializes the cache for the attributes and relations. It retrieves all the concepts attributes and relations but also the attributes and relations of its parent hierarchy.

Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an error occurs in initializing the cache

resetAttributeRelationCache

protected void resetAttributeRelationCache()
Resets the attribute and relation cache

See Also:
initAttributeRelationCache

addAttribute

protected void addAttribute(Attribute att)
Adds the specified attribute to the attribute cache containing a list of all the attributes specified for a concept, including the attributes specified for parent concepts (if available).

Parameters:
att - the Attribute to be added to the attribute cache

removeAttribute

protected void removeAttribute(Attribute att)
Removes the specified attribute from the attribute cache containing a list of all the attributes specified for a concept, including the attributes specified for parent concepts (if available).

Parameters:
att - the Attribute to be removed from the attribute cache

getAttribute

protected Attribute getAttribute(java.lang.String name)
                          throws gov.nasa.arc.brahms.common.exceptions.BrahmsException,
                                 java.util.NoSuchElementException
Returns the attribute with the specified name from the cache.

Note: The cache does not get dynamically updated if the concept's concept hierarchy changes. The cache is generally built up at initialization time of the virtual machine. The cache is cleared when the concept is reset.

Parameters:
name - the name of the requested Attribute
Throws:
java.util.NoSuchElementException - if no attribute with the specified name is specified for the concept
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the context is not associated with a concept

addRelation

protected void addRelation(Relation rel)
Adds the specified relation to the relation cache containing a list of all the relations specified for a concept, including the relations specified for parent concepts (if available).

Parameters:
att - the Relation to be added to the relation cache

removeRelation

protected void removeRelation(Relation rel)
Removes the specified relation from the relation cache containing a list of all the relations specified for a concept, including the relations specified for parent concepts (if available).

Parameters:
att - the Relation to be removed from the relation cache

getRelation

protected Relation getRelation(java.lang.String name)
                        throws gov.nasa.arc.brahms.common.exceptions.BrahmsException,
                               java.util.NoSuchElementException
Returns the relation with the specified name from the cache.

Note: The cache does not get dynamically updated if the concept's concept hierarchy changes. The cache is generally built up at initialization time of the virtual machine. The cache is cleared when the concept is reset.

Parameters:
name - the name of the requested Relation
Throws:
java.util.NoSuchElementException - if no relation with the specified name is specified for the concept
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the context is not associated with a concept

toString

public java.lang.String toString()
Returns the fully qualified name of the conceptfor which this is a context

Overrides:
toString in class java.lang.Object
Returns:
String the fully qualified name of the concept


Copyright © 1997-2012 All Rights Reserved.