|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.slamd.example.ValuePattern
public class ValuePattern
This class defines a utility that can be used to construct values from
static strings and numeric ranges. The values constructed can have multiple
numeric ranges, and each range can either iterate through the values
sequentially or move through them in random order. The numeric ranges should
be enclosed in square brackets, with the upper and lower bounds separated by
a dash for random order or a colon for sequential order. For sequential
ranges, the upper bound can be followed by an 'x' character and a positive or
negative integer to indicate that the increment or decrement should be in
steps of that amount. Both sequential and random ranges may be followed by
a percent sign and a format string (as used by an instance of
java.util.DecimalFormat to define the format that should be used
for the values.
| Constructor Summary | |
|---|---|
ValuePattern(java.lang.String pattern)
Creates the value pattern based on the provided pattern string. |
|
ValuePattern(java.lang.String pattern,
java.util.Random random)
Creates the value pattern based on the provided pattern string. |
|
| Method Summary | |
|---|---|
NumericRange[] |
getComponents()
Retrieves the components that make up this value pattern. |
java.lang.String |
getPattern()
Retrieves the pattern used to construct the values for this value pattern. |
java.lang.String |
nextValue()
Retrieves the next value that should be used for this value pattern. |
void |
nextValue(java.lang.StringBuffer buffer)
Appends the next value for this value pattern to the provided buffer. |
void |
setDefaultNumberFormat(java.text.NumberFormat format)
Specifies the number format that should be used for numeric ranges in which no other format has been specified. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ValuePattern(java.lang.String pattern)
pattern - The pattern string to use to create this value pattern.
public ValuePattern(java.lang.String pattern,
java.util.Random random)
pattern - The pattern string to use to create this value pattern.random - The random number generator to use for this value pattern.| Method Detail |
|---|
public void setDefaultNumberFormat(java.text.NumberFormat format)
format - The number format that should be used for numeric ranges in
which no other format has been specified.public java.lang.String nextValue()
public void nextValue(java.lang.StringBuffer buffer)
buffer - The buffer to which the value should be appended.public java.lang.String getPattern()
public NumericRange[] getComponents()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||