Class ResourceHash
java.lang.Object
|
+----ResourceHash
- public class ResourceHash
- extends Object
A class that allows a good maintenance of a set of constants.
It basically does nothing more than storing a vector of strings
representing the names of the resources and another vector representing
the values of the same resources.
Written: Radu Sion
Version: 0.14
Source: ResourceHash.java
-
ResourceHash(Vector, Vector)
- Creates a new object.
-
getBoolean(String)
-
Returns the first occurence of a resource value interpreted as a boolean.
-
getDouble(String)
- Returns the first occurence of a resource value interpreted as a double.
-
getDoubleValue(String)
- Returns a double representing the value of the above .getDouble()
returned Double object.
-
getLong(String)
- Returns the first occurence of a resource value interpreted as a Long.
-
getLongValue(String)
- Returns a long representing the value of the above .getLong() returned
Long object.
-
getString(String)
- Returns the first occurence of a resource value treated as a string
with the given name.
-
size()
- Returns the size of this structure, actually the length of the
internal arrays that hold the resources.
ResourceHash
public ResourceHash(Vector names,
Vector values)
- Creates a new object. The sizes of the parameters should be the same
although no parameter checkings are performed.
- Parameters:
- names - A Vector containing the resource names as String objects
- values - A Vector containing the resource string values as String objects
size
public int size()
- Returns the size of this structure, actually the length of the
internal arrays that hold the resources.
getString
public String getString(String resname)
- Returns the first occurence of a resource value treated as a string
with the given name.
- Parameters:
- resname - Resource name to consider (case senzitive)
- Returns:
- The resource value or null if nonexistent or error.
getBoolean
public int getBoolean(String resname)
- Returns the first occurence of a resource value interpreted as a boolean.
A boolean may have the following string values meaning true or false:
true: ok, enabled, true, on
false: disabled, false, off
- Parameters:
- resname - Resource name to consider (case senzitive)
- Returns:
- 1 if resource interpreted as true, 0 if false, -1 if error
getLong
public Long getLong(String resname)
- Returns the first occurence of a resource value interpreted as a Long.
- Parameters:
- resname - Resource name to consider (case senzitive)
- Returns:
- The value interpreted, null if error
getLongValue
public long getLongValue(String resname)
- Returns a long representing the value of the above .getLong() returned
Long object.
NOTE: If .getLong() returns null then this method returns 0 !!!
Error tracking is difficult.
- Parameters:
- resname - Resource name to consider
- Returns:
- A long or 0 if error (may be zero also if no error !!!)
getDouble
public Double getDouble(String resname)
- Returns the first occurence of a resource value interpreted as a double.
- Parameters:
- resname - Resource name to consider (case senzitive)
- Returns:
- The value interpreted, null if error
getDoubleValue
public double getDoubleValue(String resname)
- Returns a double representing the value of the above .getDouble()
returned Double object.
NOTE: If .getDouble() returns null then this method returns 0 !!!
Error tracking is difficult !!!
- Parameters:
- resname - Resource name to consider
- Returns:
- A double or 0 if error (may be zero also if no error !!!)