org.ujac.util.exi
Class Operand

java.lang.Object
  extended by org.ujac.util.exi.Operand
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
ConstantOperand, ExpressionTuple, VariableOperand

public abstract class Operand
extends Object
implements Serializable, Cloneable

Name: Operand
Description: A common implementation for operands.

Author:
lauerc
See Also:
Serialized Form

Constructor Summary
Operand()
          Constructs an Operand instance with no specific arguments.
Operand(char[] source, int absolutePosition, int relativePosition, int length)
          Constructs an Operand instance with specific arguments.
Operand(Operand outer)
          Constructs an Operand instance with specific arguments.
 
Method Summary
 Object clone()
           
 int getAbsolutePosition()
          Gets the tuple's absolute position in the source string.
 String getCode()
          Gets the source of the current expression part.
 ExpressionType getForcedType()
          Getter method for the the property forcedType.
 int getLength()
          Gets the tuple's length.
 int getRelativePosition()
          Gets the tuple's relative position in the source string.
 char[] getSource()
          Gets the source.
 int getTotalLength()
          Gets the tuple's total length.
 int getTotalPosition()
          Gets the tuple's total position in the source string.
abstract  Object getValue()
          Gets the operand value.
abstract  boolean isSimple()
          Tells whether the operand is a simple one or not.
 void setAbsolutePosition(int absolutePosition)
          Sets the tuple's absolute position in the source string.
 void setForcedType(ExpressionType forcedType)
          Setter method for the the property forcedType.
 void setLength(int length)
          Sets the tuple's length.
 void setRelativePosition(int relativePosition)
          Sets the tuple's relative position in the source string.
 void setSource(char[] source)
          Sets the source.
 void setTotalLength(int totalLength)
          Sets the tuple's total length.
 void setTotalPosition(int totalPosition)
          Sets the tuple's total position in the source string.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Operand

public Operand()
Constructs an Operand instance with no specific arguments.


Operand

public Operand(char[] source,
               int absolutePosition,
               int relativePosition,
               int length)
Constructs an Operand instance with specific arguments.

Parameters:
source - The textual source for the expression.
absolutePosition - The absolute start position of the expression within the source.
relativePosition - The relative start position of the expression within the source.
length - The length of the expression.

Operand

public Operand(Operand outer)
Constructs an Operand instance with specific arguments. Copies the source, totalPosition and totalLength from the outer expression.

Parameters:
outer - The outer expression.
Method Detail

isSimple

public abstract boolean isSimple()
Tells whether the operand is a simple one or not.

Returns:
true if the operand is instance of class VariableOperand else false.

getCode

public String getCode()
Gets the source of the current expression part.

Returns:
The code of the current expression part.

getSource

public char[] getSource()
Gets the source.

Returns:
The source of the complete expression.

setSource

public void setSource(char[] source)
Sets the source.

Parameters:
source - The source to set

getAbsolutePosition

public int getAbsolutePosition()
Gets the tuple's absolute position in the source string.

Returns:
The tuple's absolute position in the source string.

setAbsolutePosition

public void setAbsolutePosition(int absolutePosition)
Sets the tuple's absolute position in the source string.

Parameters:
absolutePosition - The absolute position to set.

getRelativePosition

public int getRelativePosition()
Gets the tuple's relative position in the source string.

Returns:
The tuple's relative position in the source string.

setRelativePosition

public void setRelativePosition(int relativePosition)
Sets the tuple's relative position in the source string.

Parameters:
relativePosition - The relative position to set.

getLength

public int getLength()
Gets the tuple's length.

Returns:
The tuple's length.

setLength

public void setLength(int length)
Sets the tuple's length.

Parameters:
length - The length to set.

getTotalPosition

public int getTotalPosition()
Gets the tuple's total position in the source string.

Returns:
The tuple's total position in the source string.

setTotalPosition

public void setTotalPosition(int totalPosition)
Sets the tuple's total position in the source string.

Parameters:
totalPosition - The total position to set.

getTotalLength

public int getTotalLength()
Gets the tuple's total length.

Returns:
The tuple's length.

setTotalLength

public void setTotalLength(int totalLength)
Sets the tuple's total length.

Parameters:
totalLength - The total length to set.

getValue

public abstract Object getValue()
Gets the operand value.

Returns:
the value of the operand.

getForcedType

public ExpressionType getForcedType()
Getter method for the the property forcedType.

Returns:
The current value of property forcedType.

setForcedType

public void setForcedType(ExpressionType forcedType)
Setter method for the the property forcedType.

Parameters:
forcedType - The value to set for the property forcedType.

clone

public Object clone()
Overrides:
clone in class Object
See Also:
Object.clone()


Copyright © 2003-2004 UJAC.org. All Rights Reserved.