|
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.Main
@Participant(value="Client") public class Main
Interpreter tests.
Constructor Summary | |
---|---|
Main()
No-arg constructor. |
Method Summary | ||
---|---|---|
private
|
create1(Sequence<E> sequence,
Class<E> type,
E value,
Context context)
Creates: next[20], y = current, (reverse[true] ? |
|
private
|
create2(Sequence<E> sequence,
Class<E> type,
E value,
Context context)
Creates: next[value], foo = Integer{next[(boo ? |
|
private
|
create3(Sequence<E> sequence,
Class<E> type,
E value,
Context context)
Creates a loop-structure by using cyclic expression references without intermediate variables: (current < value ? |
|
private
|
create4(Sequence<E> sequence,
Class<E> type,
E value1,
E value2,
Context context)
Generates the mother of all sequence expressions: (current < value1 ? |
|
private Expression<Comparable<?>> |
create5(Context context,
Sequence<String> string,
Sequence<Integer> integer,
String stringValue,
Integer integerValue)
Creates an expression with a loop having 15 iterations as well as different sequences and types: ((! |
|
private void |
log(boolean log)
True to enable logging per expression type. |
|
static void |
main(String[] args)
Executes the Interpreter tests. |
|
boolean |
test(Log out,
Arguments arguments)
Accepted argument: -value=n , where n is an integer value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Main()
Method Detail |
---|
private <E extends Comparable<? super E>> Expression<E> create1(Sequence<E> sequence, Class<E> type, E value, Context context) throws ExpressionException
next[20], y = current, (reverse[true] ? next[10], x = current, (x < value ? x : break[y]) : current)Where
value
is the value supplied as the value
argument.
E
- The type of comparable value the evaluation of
the returned expression produces.sequence
- The sequence to manipulate; never null.type
- The expression and value type; never null.value
- The value used in the expression; never null.context
- The context to use; never null.
ExpressionException
- If the creation fails.private <E extends Number & Comparable<? super E>> Expression<E> create2(Sequence<E> sequence, Class<E> type, E value, Context context) throws ExpressionException
next[value], foo = Integer{next[(boo ? current : value)]}, (reverse[foo < value] ? next[set[value], next[bar = foo], (foo > value ? bar : break[foo])] : foo)Where
value
is the value supplied as the value
argument.
E
- The type of comparable numeric value the evaluation of
the returned expression produces.sequence
- The sequence to manipulate; never null.type
- The expression and value type; never null.value
- The value used in the expression; never null.context
- The context to use; never null.
ExpressionException
- If the creation fails.private <E extends Comparable<? super E>> Expression<E> create3(Sequence<E> sequence, Class<E> type, E value, Context context) throws ExpressionException
(current < value ? next[1], {{flow -> conditional}} : current)Where
value
is supplied as the argument value
.
E
- The type of comparable value the evaluation of
the returned expression produces.sequence
- The sequence to manipulate; never null.type
- The expression and value type; never null.value
- The value used in the expression; never null.context
- The context to use; never null.
ExpressionException
- If the creation fails.private <E extends Number & Comparable<? super E>> Expression<E> create4(Sequence<E> sequence, Class<E> type, E value1, E value2, Context context) throws ExpressionException
(current < value1 ? next[20], y = current, (reverse[true] ? next[10], x = current, (x < value2 ? x : break[y]) : current), x = current, (current < value1 ? next[1], {{flow -> flow}} : current), y = current, (reverse[(next[y] > x | (y == x ? break[boo] : false))] ? break[x] : (((!current == next[value1], foo = Integer{next[(boo ? current : value1)]}, (reverse[foo < value1] ? next[set[value1], next[bar = foo], (foo > value1 ? bar : break[foo])] : foo)) && x = bar == (current < value2 ? next[1], {{flow -> flow}} : current)) ? x : foo)) : exit)Where
value1
and value2
are the values supplied
as arguments to this method.
E
- The type of comparable value the evaluation of
the returned expression produces.sequence
- The sequence to manipulate; never null.type
- The expression and value type; never null.value1
- The first value used in the expression; never null.value2
- The second value used in the expression; never null.context
- The context to use; never null.
ExpressionException
- If the creation fails.private Expression<Comparable<?>> create5(Context context, Sequence<String> string, Sequence<Integer> integer, String stringValue, Integer integerValue) throws ExpressionException
((!next[1] == 15) ? Comparable{c} = (Boolean{boo} = (Integer{i} > Integer{current} || (String{s} == String{next[Integer{next[1]}]} ? break[Boolean{boo}] : booboo = (!booboo))) ? Integer{next[1]} : String{current}), {{flow -> conditional}} : Comparable{c})Where
stringValue
is the initial value of s
, and
intergerValue
of i
. The identity hash codes of the created sequences are listed as well for each terminal expression.
context
- The context to use; never null.string
- A sequence delivering strings; never null.integer
- A sequence delivering integers; never null.stringValue
- A string value used in the expression; never null.integerValue
- An integer value used in the expression; never null.
ExpressionException
- If the creation fails.private void log(boolean log)
log
- True to enable verbose logging per expression type,
false to disable.public static void main(String[] args)
args
- The arguments to supply to test(Log, Arguments)
,
if any; can be null.public boolean test(Log out, Arguments arguments)
-value=n
, where n
is an integer value.
test
in interface Testable
out
- The log to report the test outcome to; cannot be null.arguments
- Additional arguments, if any.
|
Gunni Rode / rode.dk | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |