public class ParameterSet extends Expression
parameterList
as an ExpressionList
.
The set can be defined either as a comma-separated list of possible values, or it can be defined as a range in terms of a start value, end value, and increment factor, which can then be converted into the explicit list of possible values.
The LBJava syntax for defining the parameter set is to declare the possible values inside of double curly braces, either as an explicit list or as a range. The following two examples are equivalent:
{{2,3,4,5}}
{{2->5:1}}
Modifier and Type | Field and Description |
---|---|
static int |
count
Remembers how many instances of this class have been instantiated.
|
Expression |
end
The end value for the range.
|
Expression |
increment
The factor to increment by.
|
boolean |
inRounds
|
Expression |
start
The start value for the range.
|
Type |
type
The most specific type for the values in this set.
|
parenthesized, typeCache, typeCacheFilled
byteOffset, line, nodeID, symbolTable
Constructor and Description |
---|
ParameterSet(Expression s,
Expression e,
Expression i)
Initializing constructor.
|
ParameterSet(ExpressionList list)
Initializing constructor.
|
ParameterSet(int line,
int byteOffset,
Expression s,
Expression e,
Expression i)
Full constructor.
|
ParameterSet(int line,
int byteOffset,
ExpressionList list)
Full constructor.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Creates a new object with the same primitive data, and recursively creates new member data
objects as well.
|
void |
convertRange()
Converts this parameter set's
start , end , and increment
expressions (which must represent Constant s of a PrimitiveType other than
boolean ) into an explicit list of values. |
boolean |
equals(Object o)
Two parameter sets are equivalent when their constituent expressions are the same.
|
Expression |
getFirst()
Returns the first element of the list.
|
String |
getParameterName()
Returns the value of
parameterName . |
int |
hashCode()
A hash code based on the hash codes of the constituent expressions.
|
boolean |
isRange()
true iff this parameter set was specified as a range. |
ASTNodeIterator |
iterator()
Returns an iterator used to successively access the children of this node.
|
ExpressionList.ExpressionListIterator |
listIterator()
Returns a list iterator over
parameterList . |
void |
runPass(Pass pass)
Ensures that the correct
run() method is called for this type of node. |
int[] |
toSortedIntArray()
Parses integers out of every constant in the set and returns them in a sorted array.
|
Object[] |
toStringArray()
Assuming that
convertRange() has already been called (if necessary) and that every
expression in parameterList is a Constant , this method produces an array of
String s containing the values of the constants. |
void |
write(StringBuffer buffer)
Writes a string representation of this
ASTNode to the specified buffer. |
containsQuantifiedVariable, getVariableTypes, senseValueChild
public static int count
public Expression start
public Expression end
public Expression increment
public Type type
public boolean inRounds
public ParameterSet(ExpressionList list)
list
- The list of possible values for the parameterpublic ParameterSet(int line, int byteOffset, ExpressionList list)
line
- The line on which the source code represented by this node is found.byteOffset
- The byte offset from the beginning of the source file at which the source
code represented by this node is found.list
- The list of possible values for the parameter.public ParameterSet(Expression s, Expression e, Expression i)
s
- The start value.e
- The end value.i
- The increment factor.public ParameterSet(int line, int byteOffset, Expression s, Expression e, Expression i)
line
- The line on which the source code represented by this node is found.byteOffset
- The byte offset from the beginning of the source file at which the source
code represented by this node is found.s
- The start value.e
- The end value.i
- The increment factor.public String getParameterName()
parameterName
.public boolean isRange()
true
iff this parameter set was specified as a range.public ExpressionList.ExpressionListIterator listIterator()
parameterList
.public Expression getFirst()
public void convertRange()
public int[] toSortedIntArray()
convertRange()
has
already been called.public Object[] toStringArray()
convertRange()
has already been called (if necessary) and that every
expression in parameterList
is a Constant
, this method produces an array of
String
s containing the values of the constants. The return type of the method is
Object[]
so that its elements can be replaced by objects of other types, which
is convenient during parameter tuning.public ASTNodeIterator iterator()
public boolean equals(Object o)
public int hashCode()
public Object clone()
public void runPass(Pass pass)
run()
method is called for this type of node.public void write(StringBuffer buffer)
ASTNode
to the specified buffer. The
representation written is parsable by the LBJava compiler, but not very readable.Copyright © 2016. All rights reserved.