gov.nasa.arc.brahms.vm.api.common
Class BrahmsClassDescriptor

java.lang.Object
  extended by gov.nasa.arc.brahms.vm.api.common.BrahmsClassDescriptor

public class BrahmsClassDescriptor
extends java.lang.Object

BrahmsClassDescriptor maintains a record of the Brahms class and its attributes and relations.

Version:
$Revision: 1.6 $ $Date: 2009/11/23 21:08:33 $ $Author: rnado $
Author:
Ron van Hoof

Constructor Summary
BrahmsClassDescriptor(java.lang.String qualifiedname)
          Constructors, creates a new record about a Brahms Class with the specified qualified name.
 
Method Summary
 IAttribute getBrahmsAttribute(java.lang.String name)
          Returns the Brahms attribute with the specified name.
 java.util.Collection<IAttribute> getBrahmsAttributes()
          Returns the list of Brahms attributes declared for this class.
 IClass getBrahmsClass()
          Returns the Brahms class.
 IRelation getBrahmsRelation(java.lang.String name)
          Returns the Brahms relation with the specified name.
 java.util.Collection<IRelation> getBrahmsRelations()
          Returns the list of Brahms relations declared for this class.
 java.lang.String getQualifiedName()
          Returns the class' qualified name.
 java.lang.String getSimpleName()
          Returns the class' simple name.
 java.lang.Object getValue(IObject obj, IAttribute lhsAttribute, IContext brahmsCtx)
          Returns the value for the attribute of the specified object.
 java.lang.Object getValue(IObject source, IConcept lhsConcept, IAttribute lhsAttribute, IContext brahmsCtx)
          Returns the value for the attribute of the specified object.
 java.lang.Object getValue(IObject source, IConcept lhsConcept, IRelation rel, IContext brahmsCtx)
          Returns the values for the relation of the specified object.
 java.lang.Object getValue(IObject obj, IRelation rel, IContext brahmsCtx)
          Returns the values for the relation of the specified object.
 void setValue(IObject obj, IAttribute att, java.lang.Object value, IContext brahmsCtx)
          Sets the value for the attribute of the specified object.
 void setValue(IObject destination, IConcept lhsConcept, IAttribute lhsAttribute, java.lang.Object value, IContext brahmsCtx)
          Sets the value for the attribute of the specified object.
 void setValue(IObject destination, IConcept lhsConcept, IRelation rel, java.lang.Object value, IContext brahmsCtx)
          Sets the value for the relation of the specified object.
 void setValue(IObject obj, IRelation rel, java.lang.Object value, IContext brahmsCtx)
          Sets the value for the relation of the specified object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BrahmsClassDescriptor

public BrahmsClassDescriptor(java.lang.String qualifiedname)
Constructors, creates a new record about a Brahms Class with the specified qualified name.

Parameters:
qualifiedname - the class' qualified name
Method Detail

getSimpleName

public java.lang.String getSimpleName()
Returns the class' simple name.

Returns:
String the simple name

getQualifiedName

public java.lang.String getQualifiedName()
Returns the class' qualified name.

Returns:
String the qualified name

getBrahmsClass

public IClass getBrahmsClass()
                      throws ExternalException
Returns the Brahms class.

Returns:
IClass the Brahms class
Throws:
ExternalException - if the class could not be found

getBrahmsAttributes

public java.util.Collection<IAttribute> getBrahmsAttributes()
                                                     throws ExternalException
Returns the list of Brahms attributes declared for this class.

Returns:
Collection the Brahms attributes declared for the class
Throws:
ExternalException - if there was a problem obtaining the attribute list

getBrahmsAttribute

public IAttribute getBrahmsAttribute(java.lang.String name)
                              throws ExternalException
Returns the Brahms attribute with the specified name.

Parameters:
name - the attribute name
Returns:
IAttribute the Brahms attribute
Throws:
ExternalException - if the attribute could not be found

getBrahmsRelations

public java.util.Collection<IRelation> getBrahmsRelations()
                                                   throws ExternalException
Returns the list of Brahms relations declared for this class.

Returns:
Collection the Brahms relations declared for the class
Throws:
ExternalException - if there was a problem obtaining the relation list

getBrahmsRelation

public IRelation getBrahmsRelation(java.lang.String name)
                            throws ExternalException
Returns the Brahms relation with the specified name.

Parameters:
name - the relation name
Returns:
IRelation the Brahms relation
Throws:
ExternalException - if the relation could not be found

getValue

public java.lang.Object getValue(IObject obj,
                                 IAttribute lhsAttribute,
                                 IContext brahmsCtx)
                          throws ExternalException
Returns the value for the attribute of the specified object. If the attribute is of a map type, a Map is returned with keys being one of String or Integer type.

Parameters:
obj - the IObject holding the belief and also the left hand side concept of the belief from which to obtain the value
lhsAttribute - the IAttribute to obtain the value for
brahmsCtx - the IContext used to obtain the value
Returns:
Object the value, null if no value set or the value is IUnknown
Throws:
ExternalException - if there was a problem obtaining the value

getValue

public java.lang.Object getValue(IObject source,
                                 IConcept lhsConcept,
                                 IAttribute lhsAttribute,
                                 IContext brahmsCtx)
                          throws ExternalException
Returns the value for the attribute of the specified object. If the attribute is of a map type, a Map is returned with keys being one of String or Integer type.

Parameters:
source - the IObject to obtain the belief and value from
lhsConcept - the left hand side IConcept in the belief from which to obtain the value
lhsAttribute - the IAttribute to obtain the value for
brahmsCtx - the IContext used to obtain the value
Returns:
Object the value, null if no value set or the value is IUnknown
Throws:
ExternalException - if there was a problem obtaining the value

getValue

public java.lang.Object getValue(IObject obj,
                                 IRelation rel,
                                 IContext brahmsCtx)
                          throws ExternalException
Returns the values for the relation of the specified object. The values are returned as a List, if the relation's value is IUnknown an empty List is returned. The list only contains those values for which the truth value is set to true.

Parameters:
obj - the IObject holding the belief and also the left hand side concept of the belief from which to obtain the value
rel - the IRelation to obtain the values for
brahmsCtx - the IContext used to obtain the values
Returns:
Object the values, null if no value set
Throws:
ExternalException - if there was a problem obtaining the values

getValue

public java.lang.Object getValue(IObject source,
                                 IConcept lhsConcept,
                                 IRelation rel,
                                 IContext brahmsCtx)
                          throws ExternalException
Returns the values for the relation of the specified object. The values are returned as a List, if the relation's value is IUnknown an empty List is returned. The list only contains those values for which the truth value is set to true.

Parameters:
source - the IObject holding the belief from which to obtain the value
lhsConcept - the left hand side IConcept in the belief from which to obtain the value
rel - the IRelation to obtain the values for
brahmsCtx - the IContext used to obtain the values
Returns:
Object the values, null if no value set
Throws:
ExternalException - if there was a problem obtaining the values

setValue

public void setValue(IObject obj,
                     IAttribute att,
                     java.lang.Object value,
                     IContext brahmsCtx)
              throws ExternalException
Sets the value for the attribute of the specified object.

Note: Assumes that the specified value is a valid Brahms value. If a Map is passes as a value its keys must be either of type String or Integer and its values must be valid Brahms values.

Parameters:
obj - the IObject in which to assert the belief with the value and serving as the lhs concept in the belief to set the value for
att - the IAttribute to set the value for
value - the value
brahmsCtx - the IContext used to set the value
Throws:
ExternalException - if the value could not be set

setValue

public void setValue(IObject destination,
                     IConcept lhsConcept,
                     IAttribute lhsAttribute,
                     java.lang.Object value,
                     IContext brahmsCtx)
              throws ExternalException
Sets the value for the attribute of the specified object.

Note: Assumes that the specified value is a valid Brahms value. If a Map is passes as a value its keys must be either of type String or Integer and its values must be valid Brahms values.

Parameters:
destination - the IObject to assert the belief with the value into
lhsConcept - the left hand side IConcept in the belief for which to setthe value
lhsAttribute - the IAttribute to set the value for
value - the value
brahmsCtx - the IContext used to set the value
Throws:
ExternalException - if the value could not be set

setValue

public void setValue(IObject obj,
                     IRelation rel,
                     java.lang.Object value,
                     IContext brahmsCtx)
              throws ExternalException
Sets the value for the relation of the specified object.

Note: Assumes that the specified value is a valid Brahms value. If a Collection is passed as a value its values must be valid Brahms values (all of type IConcept).

Parameters:
obj - the IObject in which to assert the belief with the value and serving as the lhs concept in the belief to set the value for
rel - the IRelation to set the value for
value - the value
brahmsCtx - the IContext used to set the value
Throws:
ExternalException - if the value could not be set

setValue

public void setValue(IObject destination,
                     IConcept lhsConcept,
                     IRelation rel,
                     java.lang.Object value,
                     IContext brahmsCtx)
              throws ExternalException
Sets the value for the relation of the specified object.

Note: Assumes that the specified value is a valid Brahms value. If a Collection is passed as a value its values must be valid Brahms values (all of type IConcept).

Parameters:
destination - the IObject to assert the belief with the value into
lhsConcept - the left hand side IConcept in the belief for which to set the value
rel - the IRelation to set the value for
value - the value
brahmsCtx - the IContext used to set the value
Throws:
ExternalException - if the value could not be set


Copyright © 1997-2012 All Rights Reserved.