gate.jape
Class KleeneOperator

java.lang.Object
  extended by gate.jape.KleeneOperator
All Implemented Interfaces:
Serializable

public class KleeneOperator
extends Object
implements Serializable

Representation of Kleene operators on expressions. Kleene operators indicate the number of repetitions over an expression that are legal. The most common are star (0 or more), plus (1 or more), and optional (0 or 1, also referred to as "kleene query"). The class can also represent a range with a fixed minimum, maximum, or both. Finally, a default type of single (exactly 1) is also defined.

Version:
$Revision$
Author:
esword
See Also:
Serialized Form

Nested Class Summary
static class KleeneOperator.Type
          Enum containing the defined types of operators.
 
Field Summary
protected static org.apache.log4j.Logger log
           
 
Constructor Summary
KleeneOperator(Integer val)
          Create an operator with type RANGE and min and max both set to val.
KleeneOperator(Integer min, Integer max)
          Create an operator with type RANGE and the given min and max.
KleeneOperator(KleeneOperator.Type type)
          Create an operator with the given type, setting the appropriate min for each (and max when defined).
 
Method Summary
 Integer getMax()
           
 Integer getMin()
           
 KleeneOperator.Type getType()
           
 void setType(KleeneOperator.Type type)
           
 String toString()
          The string representation for most operators is the operator symbol itself.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static final org.apache.log4j.Logger log
Constructor Detail

KleeneOperator

public KleeneOperator(KleeneOperator.Type type)
Create an operator with the given type, setting the appropriate min for each (and max when defined). This constructor should not be used for KleeneOperator.Type.RANGE operators. Use one of the other range-defining constructors in that case.

Parameters:
type -

KleeneOperator

public KleeneOperator(Integer val)
Create an operator with type RANGE and min and max both set to val.

Parameters:
val -

KleeneOperator

public KleeneOperator(Integer min,
                      Integer max)
Create an operator with type RANGE and the given min and max.

Parameters:
min -
max -
Method Detail

toString

public String toString()
The string representation for most operators is the operator symbol itself. For ranges, the min and max are shown. If min == max, only one is shown.

Overrides:
toString in class Object

getType

public KleeneOperator.Type getType()

setType

public void setType(KleeneOperator.Type type)

getMin

public Integer getMin()

getMax

public Integer getMax()