|
@@ -27,12 +27,14 @@ import java.util.logging.Logger;
|
|
|
|
|
|
import javolution.util.FastMap;
|
|
import javolution.util.FastMap;
|
|
|
|
|
|
|
|
+import com.l2jserver.gameserver.model.interfaces.IParserAdvUtils;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * @author mkizub <BR>
|
|
|
|
- * This class is used in order to have a set of couples (key,value).<BR>
|
|
|
|
- * Methods deployed are accessors to the set (add/get value from its key) and addition of a whole set in the current one.
|
|
|
|
|
|
+ * This class is meant to hold a set of (key,value) pairs.<br>
|
|
|
|
+ * They are stored as object but can be retrieved in any type wanted. As long as cast is available.<br>
|
|
|
|
+ * @author mkizub
|
|
*/
|
|
*/
|
|
-public class StatsSet
|
|
|
|
|
|
+public class StatsSet implements IParserAdvUtils
|
|
{
|
|
{
|
|
private static final Logger _log = Logger.getLogger(StatsSet.class.getName());
|
|
private static final Logger _log = Logger.getLogger(StatsSet.class.getName());
|
|
private final Map<String, Object> _set;
|
|
private final Map<String, Object> _set;
|
|
@@ -70,13 +72,15 @@ public class StatsSet
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Return the boolean associated to the key put in parameter ("name")
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
|
|
+ * Return the boolean value associated with key.
|
|
|
|
+ * @param key : String designating the key in the set
|
|
* @return boolean : value associated to the key
|
|
* @return boolean : value associated to the key
|
|
|
|
+ * @throws IllegalArgumentException : If value is not set or value is not boolean
|
|
*/
|
|
*/
|
|
- public boolean getBool(String name)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public boolean getBoolean(String key)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
throw new IllegalArgumentException("Boolean value required, but not specified");
|
|
throw new IllegalArgumentException("Boolean value required, but not specified");
|
|
@@ -96,17 +100,18 @@ public class StatsSet
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Return the boolean associated to the key put in parameter ("name"). If the value associated to the key is null, this method returns the value of the parameter deflt.
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param deflt : boolean designating the default value if value associated with the key is null
|
|
|
|
- * @return boolean : value of the key
|
|
|
|
|
|
+ * Return the boolean value associated with key.<br>
|
|
|
|
+ * If no value is associated with key, or type of value is wrong, returns defaultValue.
|
|
|
|
+ * @param key : String designating the key in the entry set
|
|
|
|
+ * @return boolean : value associated to the key
|
|
*/
|
|
*/
|
|
- public boolean getBool(String name, boolean deflt)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public boolean getBoolean(String key, boolean defaultValue)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- return deflt;
|
|
|
|
|
|
+ return defaultValue;
|
|
}
|
|
}
|
|
if (val instanceof Boolean)
|
|
if (val instanceof Boolean)
|
|
{
|
|
{
|
|
@@ -118,22 +123,17 @@ public class StatsSet
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
catch (Exception e)
|
|
{
|
|
{
|
|
- throw new IllegalArgumentException("Boolean value required, but found: " + val);
|
|
|
|
|
|
+ return defaultValue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the int associated to the key put in parameter ("name"). If the value associated to the key is null, this method returns the value of the parameter deflt.
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param deflt : byte designating the default value if value associated with the key is null
|
|
|
|
- * @return byte : value associated to the key
|
|
|
|
- */
|
|
|
|
- public byte getByte(String name, byte deflt)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public byte getByte(String key)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- return deflt;
|
|
|
|
|
|
+ throw new IllegalArgumentException("Byte value required, but not specified");
|
|
}
|
|
}
|
|
if (val instanceof Number)
|
|
if (val instanceof Number)
|
|
{
|
|
{
|
|
@@ -149,17 +149,13 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the byte associated to the key put in parameter ("name").
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @return byte : value associated to the key
|
|
|
|
- */
|
|
|
|
- public byte getByte(String name)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public byte getByte(String key, byte defaultValue)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- throw new IllegalArgumentException("Byte value required, but not specified");
|
|
|
|
|
|
+ return defaultValue;
|
|
}
|
|
}
|
|
if (val instanceof Number)
|
|
if (val instanceof Number)
|
|
{
|
|
{
|
|
@@ -175,15 +171,9 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the byte[] associated to the key put in parameter ("name"). If the value associated to the key is null, this method returns the value of the parameter deflt.
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param splitOn
|
|
|
|
- * @return byte[] : value associated to the key
|
|
|
|
- */
|
|
|
|
- public byte[] getByteArray(String name, String splitOn)
|
|
|
|
|
|
+ public byte[] getByteArray(String key, String splitOn)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
throw new IllegalArgumentException("Byte value required, but not specified");
|
|
throw new IllegalArgumentException("Byte value required, but not specified");
|
|
@@ -213,28 +203,23 @@ public class StatsSet
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- public List<Byte> getByteList(String name, String splitOn)
|
|
|
|
|
|
+ public List<Byte> getByteList(String key, String splitOn)
|
|
{
|
|
{
|
|
List<Byte> result = new ArrayList<>();
|
|
List<Byte> result = new ArrayList<>();
|
|
- for (Byte i : getByteArray(name, splitOn))
|
|
|
|
|
|
+ for (Byte i : getByteArray(key, splitOn))
|
|
{
|
|
{
|
|
result.add(i);
|
|
result.add(i);
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the short associated to the key put in parameter ("name"). If the value associated to the key is null, this method returns the value of the parameter deflt.
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param deflt : short designating the default value if value associated with the key is null
|
|
|
|
- * @return short : value associated to the key
|
|
|
|
- */
|
|
|
|
- public short getShort(String name, short deflt)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public short getShort(String key)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- return deflt;
|
|
|
|
|
|
+ throw new IllegalArgumentException("Short value required, but not specified");
|
|
}
|
|
}
|
|
if (val instanceof Number)
|
|
if (val instanceof Number)
|
|
{
|
|
{
|
|
@@ -250,17 +235,13 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the short associated to the key put in parameter ("name").
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @return short : value associated to the key
|
|
|
|
- */
|
|
|
|
- public short getShort(String name)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public short getShort(String key, short defaultValue)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- throw new IllegalArgumentException("Short value required, but not specified");
|
|
|
|
|
|
+ return defaultValue;
|
|
}
|
|
}
|
|
if (val instanceof Number)
|
|
if (val instanceof Number)
|
|
{
|
|
{
|
|
@@ -276,17 +257,13 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the int associated to the key put in parameter ("name").
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @return int : value associated to the key
|
|
|
|
- */
|
|
|
|
- public int getInteger(String name)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public int getInt(String key)
|
|
{
|
|
{
|
|
- final Object val = _set.get(name);
|
|
|
|
|
|
+ final Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- throw new IllegalArgumentException("Integer value required, but not specified: " + name + "!");
|
|
|
|
|
|
+ throw new IllegalArgumentException("Integer value required, but not specified: " + key + "!");
|
|
}
|
|
}
|
|
|
|
|
|
if (val instanceof Number)
|
|
if (val instanceof Number)
|
|
@@ -304,18 +281,13 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the int associated to the key put in parameter ("name"). If the value associated to the key is null, this method returns the value of the parameter deflt.
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param deflt : int designating the default value if value associated with the key is null
|
|
|
|
- * @return int : value associated to the key
|
|
|
|
- */
|
|
|
|
- public int getInteger(String name, int deflt)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public int getInt(String key, int defaultValue)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- return deflt;
|
|
|
|
|
|
+ return defaultValue;
|
|
}
|
|
}
|
|
if (val instanceof Number)
|
|
if (val instanceof Number)
|
|
{
|
|
{
|
|
@@ -331,15 +303,9 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the int[] associated to the key put in parameter ("name"). If the value associated to the key is null, this method returns the value of the parameter deflt.
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param splitOn
|
|
|
|
- * @return int[] : value associated to the key
|
|
|
|
- */
|
|
|
|
- public int[] getIntegerArray(String name, String splitOn)
|
|
|
|
|
|
+ public int[] getIntArray(String key, String splitOn)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
throw new IllegalArgumentException("Integer value required, but not specified");
|
|
throw new IllegalArgumentException("Integer value required, but not specified");
|
|
@@ -369,24 +335,20 @@ public class StatsSet
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- public List<Integer> getIntegerList(String name, String splitOn)
|
|
|
|
|
|
+ public List<Integer> getIntegerList(String key, String splitOn)
|
|
{
|
|
{
|
|
List<Integer> result = new ArrayList<>();
|
|
List<Integer> result = new ArrayList<>();
|
|
- for (int i : getIntegerArray(name, splitOn))
|
|
|
|
|
|
+ for (int i : getIntArray(key, splitOn))
|
|
{
|
|
{
|
|
result.add(i);
|
|
result.add(i);
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the long associated to the key put in parameter ("name").
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @return long : value associated to the key
|
|
|
|
- */
|
|
|
|
- public long getLong(String name)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public long getLong(String key)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
throw new IllegalArgumentException("Integer value required, but not specified");
|
|
throw new IllegalArgumentException("Integer value required, but not specified");
|
|
@@ -405,18 +367,13 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the long associated to the key put in parameter ("name"). If the value associated to the key is null, this method returns the value of the parameter deflt.
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param deflt : long designating the default value if value associated with the key is null
|
|
|
|
- * @return long : value associated to the key
|
|
|
|
- */
|
|
|
|
- public long getLong(String name, long deflt)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public long getLong(String key, long defaultValue)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- return deflt;
|
|
|
|
|
|
+ return defaultValue;
|
|
}
|
|
}
|
|
if (val instanceof Number)
|
|
if (val instanceof Number)
|
|
{
|
|
{
|
|
@@ -432,14 +389,10 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the float associated to the key put in parameter ("name").
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @return float : value associated to the key
|
|
|
|
- */
|
|
|
|
- public float getFloat(String name)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public float getFloat(String key)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
throw new IllegalArgumentException("Float value required, but not specified");
|
|
throw new IllegalArgumentException("Float value required, but not specified");
|
|
@@ -458,18 +411,13 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the float associated to the key put in parameter ("name"). If the value associated to the key is null, this method returns the value of the parameter deflt.
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param deflt : float designating the default value if value associated with the key is null
|
|
|
|
- * @return float : value associated to the key
|
|
|
|
- */
|
|
|
|
- public float getFloat(String name, float deflt)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public float getFloat(String key, float defaultValue)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- return deflt;
|
|
|
|
|
|
+ return defaultValue;
|
|
}
|
|
}
|
|
if (val instanceof Number)
|
|
if (val instanceof Number)
|
|
{
|
|
{
|
|
@@ -485,14 +433,10 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the double associated to the key put in parameter ("name").
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @return double : value associated to the key
|
|
|
|
- */
|
|
|
|
- public double getDouble(String name)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public double getDouble(String key)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
throw new IllegalArgumentException("Float value required, but not specified");
|
|
throw new IllegalArgumentException("Float value required, but not specified");
|
|
@@ -511,18 +455,13 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the double associated to the key put in parameter ("name"). If the value associated to the key is null, this method returns the value of the parameter deflt.
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param deflt : float designating the default value if value associated with the key is null
|
|
|
|
- * @return double : value associated to the key
|
|
|
|
- */
|
|
|
|
- public double getDouble(String name, double deflt)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public double getDouble(String key, double defaultValue)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- return deflt;
|
|
|
|
|
|
+ return defaultValue;
|
|
}
|
|
}
|
|
if (val instanceof Number)
|
|
if (val instanceof Number)
|
|
{
|
|
{
|
|
@@ -538,14 +477,10 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the String associated to the key put in parameter ("name").
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @return String : value associated to the key
|
|
|
|
- */
|
|
|
|
- public String getString(String name)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public String getString(String key)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
throw new IllegalArgumentException("String value required, but not specified");
|
|
throw new IllegalArgumentException("String value required, but not specified");
|
|
@@ -553,33 +488,22 @@ public class StatsSet
|
|
return String.valueOf(val);
|
|
return String.valueOf(val);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns the String associated to the key put in parameter ("name"). If the value associated to the key is null, this method returns the value of the parameter deflt.
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param deflt : String designating the default value if value associated with the key is null
|
|
|
|
- * @return String : value associated to the key
|
|
|
|
- */
|
|
|
|
- public String getString(String name, String deflt)
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public String getString(String key, String defaultValue)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- return deflt;
|
|
|
|
|
|
+ return defaultValue;
|
|
}
|
|
}
|
|
return String.valueOf(val);
|
|
return String.valueOf(val);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns an enumeration of <T> from the set
|
|
|
|
- * @param <T> : Class of the enumeration returned
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param enumClass : Class designating the class of the value associated with the key in the set
|
|
|
|
- * @return Enum<T>
|
|
|
|
- */
|
|
|
|
|
|
+ @Override
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
- public <T extends Enum<T>> T getEnum(String name, Class<T> enumClass)
|
|
|
|
|
|
+ public <T extends Enum<T>> T getEnum(String key, Class<T> enumClass)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
throw new IllegalArgumentException("Enum value of type " + enumClass.getName() + " required, but not specified");
|
|
throw new IllegalArgumentException("Enum value of type " + enumClass.getName() + " required, but not specified");
|
|
@@ -598,21 +522,14 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Returns an enumeration of <T> from the set. If the enumeration is empty, the method returns the value of the parameter "deflt".
|
|
|
|
- * @param <T> : Class of the enumeration returned
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param enumClass : Class designating the class of the value associated with the key in the set
|
|
|
|
- * @param deflt : <T> designating the value by default
|
|
|
|
- * @return Enum<T>
|
|
|
|
- */
|
|
|
|
|
|
+ @Override
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
- public <T extends Enum<T>> T getEnum(String name, Class<T> enumClass, T deflt)
|
|
|
|
|
|
+ public <T extends Enum<T>> T getEnum(String key, Class<T> enumClass, T defaultValue)
|
|
{
|
|
{
|
|
- Object val = _set.get(name);
|
|
|
|
|
|
+ Object val = _set.get(key);
|
|
if (val == null)
|
|
if (val == null)
|
|
{
|
|
{
|
|
- return deflt;
|
|
|
|
|
|
+ return defaultValue;
|
|
}
|
|
}
|
|
if (enumClass.isInstance(val))
|
|
if (enumClass.isInstance(val))
|
|
{
|
|
{
|
|
@@ -628,83 +545,59 @@ public class StatsSet
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Add the String hold in param "value" for the key "name"
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param value : String corresponding to the value associated with the key
|
|
|
|
- */
|
|
|
|
- public void set(String name, String value)
|
|
|
|
|
|
+ public void set(String key, boolean value)
|
|
{
|
|
{
|
|
- _set.put(name, value);
|
|
|
|
|
|
+ _set.put(key, value);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Add the boolean hold in param "value" for the key "name"
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param value : boolean corresponding to the value associated with the key
|
|
|
|
- */
|
|
|
|
- public void set(String name, boolean value)
|
|
|
|
|
|
+ public void set(String key, byte value)
|
|
{
|
|
{
|
|
- _set.put(name, value);
|
|
|
|
|
|
+ _set.put(key, value);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Add the int hold in param "value" for the key "name"
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param value : int corresponding to the value associated with the key
|
|
|
|
- */
|
|
|
|
- public void set(String name, int value)
|
|
|
|
|
|
+ public void set(String key, short value)
|
|
{
|
|
{
|
|
- _set.put(name, value);
|
|
|
|
|
|
+ _set.put(key, value);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Safe version of "set". Expected values are within [min, max[<br>
|
|
|
|
- * Add the int hold in param "value" for the key "name".
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param value : int corresponding to the value associated with the key
|
|
|
|
- * @param min
|
|
|
|
- * @param max
|
|
|
|
- * @param reference
|
|
|
|
- */
|
|
|
|
- public void safeSet(String name, int value, int min, int max, String reference)
|
|
|
|
|
|
+ public void set(String key, int value)
|
|
{
|
|
{
|
|
- assert !(((min <= max) && ((value < min) || (value >= max))));
|
|
|
|
- if ((min <= max) && ((value < min) || (value >= max)))
|
|
|
|
- {
|
|
|
|
- _log.log(Level.SEVERE, "Incorrect value: " + value + "for: " + name + "Ref: " + reference);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- set(name, value);
|
|
|
|
|
|
+ _set.put(key, value);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Add the double hold in param "value" for the key "name"
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param value : double corresponding to the value associated with the key
|
|
|
|
- */
|
|
|
|
- public void set(String name, double value)
|
|
|
|
|
|
+ public void set(String key, long value)
|
|
{
|
|
{
|
|
- _set.put(name, value);
|
|
|
|
|
|
+ _set.put(key, value);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Add the long hold in param "value" for the key "name"
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param value : double corresponding to the value associated with the key
|
|
|
|
- */
|
|
|
|
- public void set(String name, long value)
|
|
|
|
|
|
+ public void set(String key, float value)
|
|
{
|
|
{
|
|
- _set.put(name, value);
|
|
|
|
|
|
+ _set.put(key, value);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Add the Enum hold in param "value" for the key "name"
|
|
|
|
- * @param name : String designating the key in the set
|
|
|
|
- * @param value : Enum corresponding to the value associated with the key
|
|
|
|
- */
|
|
|
|
- public void set(String name, Enum<?> value)
|
|
|
|
|
|
+ public void set(String key, double value)
|
|
{
|
|
{
|
|
- _set.put(name, value);
|
|
|
|
|
|
+ _set.put(key, value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void set(String key, String value)
|
|
|
|
+ {
|
|
|
|
+ _set.put(key, value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void set(String key, Enum<?> value)
|
|
|
|
+ {
|
|
|
|
+ _set.put(key, value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void safeSet(String key, int value, int min, int max, String reference)
|
|
|
|
+ {
|
|
|
|
+ assert !(((min <= max) && ((value < min) || (value >= max))));
|
|
|
|
+ if ((min <= max) && ((value < min) || (value >= max)))
|
|
|
|
+ {
|
|
|
|
+ _log.log(Level.SEVERE, "Incorrect value: " + value + "for: " + key + "Ref: " + reference);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ set(key, value);
|
|
}
|
|
}
|
|
}
|
|
}
|