public class GenSymCounter extends Object
| Constructor and Description |
|---|
GenSymCounter(int maxValue)
Constructor with maxValue only, initialValue defaults to 0 (first value of
getNewSym() is 1). |
GenSymCounter(int maxValue,
int initialValue)
Standard Constructor with maxValue and initialValue (first value of
getNewSym() is initialValue+1). |
| Modifier and Type | Method and Description |
|---|---|
String |
createSymStringFromInt(int value)
Creates a string representation for integer value (cast int to string and pad with leading zeros to fit length).
|
String |
getCurrentSym()
Gets the current symbol (counter value in string representation).
|
int |
getCurrentValue()
Gets the current counter value as integer.
|
String |
getNewSym()
Gets a new symbol by increasing the counter and returning its value in string representation.
|
void |
reset()
Resets the counter to
initialValue. |
public GenSymCounter(int maxValue,
int initialValue)
getNewSym() is initialValue+1).maxValue - maximum value of the counterinitialValue - initial value (first value of getNewSym() will be this+1)public GenSymCounter(int maxValue)
getNewSym() is 1).maxValue - maximum value of the counterpublic String getNewSym() throws Exception
Exceptionpublic String getCurrentSym()
public int getCurrentValue()
public String createSymStringFromInt(int value)
value - a numbermaxValuepublic void reset()
initialValue.Copyright © 2018. All rights reserved.