org.ejen.util.arl
Class ArlUtil

java.lang.Object
  |
  +--org.ejen.util.arl.ArlUtil
All Implemented Interfaces:
ArlParserConstants, ArlParserTreeConstants

public class ArlUtil
extends Object
implements ArlParserTreeConstants, ArlParserConstants

ArlUtil class utility (static methods).

"ARL" stands for "ARray Language". It is a very basic language that allows to set elements of an int array to one of three flag values: F_ACCEPT, F_REMOVE or F_CROSS.

An ARL sequence looks like "~23;+34;-45;-[46,56];..." The meaning of this expression is: "set the 23th element of the array to F_CROSS; set the 34th element to F_ACCEPT; set the 45th to F_REMOVE; set all elements between and including the 46th and the 56th to F_REMOVE;..."

Order is important: "-[23,56];~34" means "set all elements of the array between and including 23 and 56 to F_REMOVE; then set the 34th element to F_CROSS". On the other hand, "~34;-[23,56]" is strictly identical to "-[23,56]".

The "+" sign (for F_ACCEPT) is optional: "+45" is identical to "45".

This language is used for parsers control (see JavaSourceToXML.process(ExpressionContext,String,String,String), SimpleNode.toNode(Document,Node,int[],int[],boolean) and Token.toNode(Document,Node,int[],boolean)).

Version:
1.0
Author:
F. Wolff

Field Summary
static int F_ACCEPT
           
static int F_CROSS
           
static int F_REMOVE
           
 
Fields inherited from interface org.ejen.util.arl.ArlParserTreeConstants
JJTARLEXP, JJTARLSEQUENCE, JJTINTERVAL, jjtNodeName
 
Fields inherited from interface org.ejen.util.arl.ArlParserConstants
ACCEPT, CROSS, DEFAULT, EOF, INTEGER, REMOVE, tokenImage
 
Constructor Summary
protected ArlUtil()
          Prevents intanciation.
 
Method Summary
static int[] process(String arl, int[] array)
          Returns the array parameter whose elements are set according to the arl parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

F_ACCEPT

public static final int F_ACCEPT
See Also:
Constant Field Values

F_REMOVE

public static final int F_REMOVE
See Also:
Constant Field Values

F_CROSS

public static final int F_CROSS
See Also:
Constant Field Values
Constructor Detail

ArlUtil

protected ArlUtil()
Prevents intanciation.

Method Detail

process

public static int[] process(String arl,
                            int[] array)
Returns the array parameter whose elements are set according to the arl parameter.

Parameters:
arl - an ARL sequence.
array - the array to modify.
Returns:
the modified array parameter.
Throws:
WrappedRuntimeException - parse exception, array out of bound exception...