|
Evaluating Software Design Patterns — the "Gang of Four" patterns implemented in Java 6 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.rode.thesis.interpreter.AbstractExpression<E> dk.rode.thesis.interpreter.SequenceExpression<T,E>
T
- The type of sequence values delivered by the
manipulated sequence
. Normally,
but not required to be, identical with or a
sub-type of E
.E
- The type of value the evaluation of this expression
produces.public abstract class SequenceExpression<T,E>
A sequence expression represents a terminal expression
used to manipulate a given sequence
.
When a sequence expression is copied, the manipulated sequence is not copied, but used as is.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface dk.rode.thesis.interpreter.Expression |
---|
Expression.SymbolIdiom |
Field Summary | |
---|---|
protected boolean |
includeHashCode
True to include the identity hash code of sequence
in the symbolic representation, false if not. |
protected Sequence<? extends T> |
sequence
The sequence manipulated by this expression. |
Constructor Summary | |
---|---|
protected |
SequenceExpression(Sequence<? extends T> sequence,
boolean includeHashCode)
Constructor. |
protected |
SequenceExpression(SequenceExpression<? extends T,E> expression)
Copy constructor. |
Method Summary | |
---|---|
String |
asSymbol(Context context)
Returns name , where name is the
actual name of this expression, or
name#123 , where 123 is the identity
hash code of the manipulated sequence. |
boolean |
equals(Object object)
Returns true if object is a sequence expression
of the same type as this expression manipulating the
same sequence using the same operands, false if not. |
int |
hashCode()
Returns the hash code of this expression. |
List<Expression<?>> |
operands()
Returns the expression operands used by this expression, in order. |
String |
toString()
Returns the string representation of this expression. |
Methods inherited from class dk.rode.thesis.interpreter.AbstractExpression |
---|
contains |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface dk.rode.thesis.interpreter.Expression |
---|
contains, copy, evaluate, name |
Field Detail |
---|
protected final boolean includeHashCode
sequence
in the symbolic representation, false if not. Default false.
protected final Sequence<? extends T> sequence
Never null.
Constructor Detail |
---|
protected SequenceExpression(Sequence<? extends T> sequence, boolean includeHashCode)
The identity hash code of sequence
is included
in the symbolic
representation of
this expression if includeHashCode
is true.
sequence
- The sequence to manipulate by this
expression; cannot be null.includeHashCode
- True to include the identity hash code
of sequence
in the symbolic
representation, false not to.
NullPointerException
- If sequence
is null.protected SequenceExpression(SequenceExpression<? extends T,E> expression)
The actual sequence
manipulated by
expression
is not copied, but used
as is.
expression
- The expression to copy; cannot be null.
NullPointerException
- If expression
is null.Method Detail |
---|
public String asSymbol(Context context) throws ExpressionException
name
, where name
is the
actual name
of this expression, or
name#123
, where 123
is the identity
hash code of the manipulated sequence.
asSymbol
in interface Expression<E>
context
- The context to use; never null.
ExpressionException
- If the symbol cannot be generated.Expression.contains(Expression)
public boolean equals(Object object)
object
is a sequence expression
of the same type as this expression manipulating the
same sequence using the same operands, false if not.
equals
in class AbstractExpression<E>
object
- The object to test; can be null.
public int hashCode()
hashCode
in class AbstractExpression<E>
public List<Expression<?>> operands()
Expression
Modifying the returned list will not affect this expression.
operands
in interface Expression<E>
public String toString()
AbstractExpression
toString
in interface Expression<E>
toString
in class AbstractExpression<E>
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |