org.omwg.mediation.language.objectModel
Class RelationExpr

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

public class RelationExpr
extends Expression

Extends Expression - constructs a relation 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:40 $
Author:
Francois Scharffe, Adrian Mocan Created on 23-Mar-2005 Committed by $Author: grahamhench $ $Source: /cvsroot/dome//dome/src/org/omwg/mediation/language/objectModel/RelationExpr.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
RelationExpr(java.util.ArrayList subExpressions, java.lang.String operator)
          Constructs a relation expression object with an array list of sub-expressions and a string representation (operator)
RelationExpr(Id id)
          Constructs relation expression object with an id
 
Method Summary
 boolean addExpression(RelationExpr expression)
          Sends the relation expression to the Expression class.
 boolean addExpression(RelationExpr expression, int index)
          Sends the relation expression and index to the Expression class.
 java.lang.Object clone()
          Copies the relationExpr object
 Expression getSubExpression(int index)
          Returns the specific relation expression definition from the array list of sub-expressions when the relation expression is complex.
 java.util.ArrayList getSubExpressionsList()
          Returns the array list of sub-expressions when the relation 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

RelationExpr

public RelationExpr(Id id)

Constructs relation expression object with an id

Parameters:
id -

RelationExpr

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

Constructs a relation 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 relation expression is complex. Otherwise, returns null

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

getSubExpression

public Expression getSubExpression(int index)

Returns the specific relation expression definition from the array list of sub-expressions when the relation 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:
relation expression definition

addExpression

public boolean addExpression(RelationExpr expression)

Sends the relation 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 - (RelationExpr object)
Returns:
boolean (true, if expression is added - false if not)

addExpression

public boolean addExpression(RelationExpr expression,
                             int index)

Sends the relation 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 - (RelationExpr object)
index - (int type)
Returns:
boolean (true, if expression is added - false if not)

clone

public java.lang.Object clone()

Copies the relationExpr object

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