|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cosmic.util.Misc
General utility class with various value conversion and input methods. Author: James.A.Marshall@imperial.ac.uk
Field Summary | |
private static org.w3c.dom.Node |
msNodeReading
The node currently being read in a DOM document (for error reporting) |
Constructor Summary | |
private |
Misc()
Private constructor for Misc class to prevent instantiation of Misc objects |
Method Summary | |
static double |
getDoubleFromString(java.lang.String string)
Gets a double from the specified string |
static double |
getDoubleFromStringInInterval(java.lang.String string,
double lowerBound,
double upperBound,
boolean closedLowerBound,
boolean closedUpperBound)
Gets a double from the specified string in the specified interval |
static double |
getDoubleFromStringWithLowerBound(java.lang.String string,
double lowerBound,
boolean closedLowerBound)
Gets a double from the specified string with the specified lower bound |
static double |
getDoubleFromStringWithUpperBound(java.lang.String string,
double upperBound,
boolean closedUpperBound)
Gets a double from the specified string with the specified upper bound |
static org.w3c.dom.Node |
getFirstChildElementNode(org.w3c.dom.Node node)
Gets the first child element node of the given input node in a DOM document |
static int |
getIntegerFromString(java.lang.String string)
Gets an integer from the specified string |
static int |
getIntegerFromStringInInterval(java.lang.String string,
int lowerBound,
int upperBound,
boolean closedLowerBound,
boolean closedUpperBound)
Gets an integer from the specified string in the specified interval |
static int |
getIntegerFromStringWithLowerBound(java.lang.String string,
int lowerBound,
boolean closedLowerBound)
Gets an integer from the specified string with the specified lower bound |
static int |
getIntegerFromStringWithUpperBound(java.lang.String string,
int upperBound,
boolean closedUpperBound)
Gets an integer from the specified string with the specified upper bound |
static int |
getIntFromTwosComplementString(java.lang.String string)
Converts a binary string in two's complement into an integer |
static org.w3c.dom.Node |
getNextElementNode(org.w3c.dom.Node node)
Gets the next element node after the given input node in a DOM document |
static java.lang.String |
getNodeReadingName()
Gets the name of the node currently being read in a DOM document |
static java.lang.String |
getTwosComplementString(int sourceInt,
int numBits)
Converts a source integer to a binary string in two's complement |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static org.w3c.dom.Node msNodeReading
Constructor Detail |
private Misc()
Method Detail |
public static java.lang.String getTwosComplementString(int sourceInt, int numBits)
java.lang.IllegalArgumentException
- if source integer cannot be encoded in the specified number of bitspublic static int getIntFromTwosComplementString(java.lang.String string) throws java.lang.NumberFormatException
java.lang.NumberFormatException
- if string is not a binary stringpublic static int getIntegerFromString(java.lang.String string) throws java.lang.NumberFormatException
string
- (!= null)
java.lang.NumberFormatException
- if string does not represent a valid integerpublic static int getIntegerFromStringInInterval(java.lang.String string, int lowerBound, int upperBound, boolean closedLowerBound, boolean closedUpperBound) throws java.lang.NumberFormatException
string
- (!= null)
java.lang.NumberFormatException
- if string does not represent a valid integer
java.lang.IllegalArgumentException
- if integer is not within intervalpublic static int getIntegerFromStringWithLowerBound(java.lang.String string, int lowerBound, boolean closedLowerBound)
string
- (!= null)
java.lang.NumberFormatException
- if string does not represent a valid integer
java.lang.IllegalArgumentException
- if integer violates lower boundpublic static int getIntegerFromStringWithUpperBound(java.lang.String string, int upperBound, boolean closedUpperBound)
string
- (!= null)
java.lang.NumberFormatException
- if string does not represent a valid integer
java.lang.IllegalArgumentException
- if integer violates upper boundpublic static double getDoubleFromString(java.lang.String string) throws java.lang.NumberFormatException
string
- (!= null)
java.lang.NumberFormatException
- if string does not represent a valid doublepublic static double getDoubleFromStringInInterval(java.lang.String string, double lowerBound, double upperBound, boolean closedLowerBound, boolean closedUpperBound) throws java.lang.NumberFormatException
string
- (!= null)
java.lang.NumberFormatException
- if string does not represent a valid double
java.lang.IllegalArgumentException
- if double is not within intervalpublic static double getDoubleFromStringWithLowerBound(java.lang.String string, double lowerBound, boolean closedLowerBound)
string
- (!= null)
java.lang.NumberFormatException
- if string does not represent a valid double
java.lang.IllegalArgumentException
- if double violates lower boundpublic static double getDoubleFromStringWithUpperBound(java.lang.String string, double upperBound, boolean closedUpperBound)
string
- (!= null)
java.lang.NumberFormatException
- if string does not represent a valid double
java.lang.IllegalArgumentException
- if double violates upper boundpublic static org.w3c.dom.Node getFirstChildElementNode(org.w3c.dom.Node node)
public static org.w3c.dom.Node getNextElementNode(org.w3c.dom.Node node)
public static java.lang.String getNodeReadingName()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |