org.omwg.mediation.language.objectModel
Class ClassExpr

java.lang.Object
  extended by org.omwg.mediation.language.objectModel.Expression
      extended by org.omwg.mediation.language.objectModel.ClassExpr

public class ClassExpr
extends Expression

Extends Expression - constructs a class expression consisting of either an Id, an expression definition, or an array list of sub-expressions and a string representation (operator)

Version:
$Revision: 1.4 $ $Date: 2005/06/20 09:54:04 $
Author:
Francois Scharffe, Adrian Mocan Created on 23-Mar-2005 Committed by $Author: grahamhench $ $Source: /cvsroot/dome//dome/src/org/omwg/mediation/language/objectModel/ClassExpr.java,v $,

Field Summary
 
Fields inherited from class org.omwg.mediation.language.objectModel.Expression
AND_OPERATOR, INVERSE_OPERATOR, JOIN_OPERATOR, NOT_OPERATOR, OR_OPERATOR, REFLEXIVE_OPERATOR, SYMMETRIC_OPERATOR, TRANS_OPERATOR
 
Constructor Summary
ClassExpr(java.util.ArrayList subExpressions, java.lang.String operator)
          Constructs a class expression object with an array list of sub-expressions and a string representation (operator)
ClassExpr(Id id)
          Constructs class expression object with an id
 
Method Summary
 boolean addExpression(ClassExpr expression)
          Sends the class expression to the Expression class.
 boolean addExpression(ClassExpr expression, int index)
          Sends the class expression and index to the Expression class.
 java.lang.Object clone()
          Copies the ClassExpr object
 Expression getSubExpression(int index)
          Returns the specific class expression definition from the array list of sub-expressions when the class expression is complex.
 java.util.ArrayList getSubExpressionsList()
          Returns the array list of sub-expressions when the class expression is complex.
 
Methods inherited from class org.omwg.mediation.language.objectModel.Expression
getId, getOperator, isComplexExpression, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassExpr

public ClassExpr(Id id)

Constructs class expression object with an id

Parameters:
id -

ClassExpr

public ClassExpr(java.util.ArrayList subExpressions,
                 java.lang.String operator)

Constructs a class expression object with an array list of sub-expressions and a string representation (operator)

Parameters:
subExpressions - (array list of sub-expressions)
operator - (string type)
Method Detail

getSubExpressionsList

public java.util.ArrayList getSubExpressionsList()

Returns the array list of sub-expressions when the class expression is complex. Otherwise, returns null

Specified by:
getSubExpressionsList in class Expression
Returns:
classExpressionList (array list)

getSubExpression

public Expression getSubExpression(int index)

Returns the specific class expression definition from the array list of sub-expressions when the class expression is complex. If not, or if the integer parameter (index) is out of bounds, then the method returns null

Specified by:
getSubExpression in class Expression
Parameters:
index - (int type)
Returns:
class expression definition

addExpression

public boolean addExpression(ClassExpr expression)

Sends the class expression to the Expression class. Adds expression to a complex expression, if the sub-expression array list is not empty - then returns true. Otherwise returns false.

Parameters:
expression - (ClassExpr object)
Returns:
boolean (true, if expression is added - false if not)

addExpression

public boolean addExpression(ClassExpr expression,
                             int index)

Sends the class expression and index to the Expression class. Adds expression to a complex expression. If the index is negative or greater than the size of the sub-expression array list, then false is returned. If the sub-expression array list is not empty - then returns true. Otherwise returns false.

Parameters:
expression - (ClassExpr object)
index - (int type)
Returns:
boolean (true, if expression is added - false if not)

clone

public java.lang.Object clone()

Copies the ClassExpr object

Specified by:
clone in class Expression
Returns:
new ClassExpr object