org.mymedialite.util
Class RecommenderParameters

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<java.lang.String,java.lang.String>
          extended by org.mymedialite.util.RecommenderParameters
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.String>

public class RecommenderParameters
extends java.util.HashMap<java.lang.String,java.lang.String>

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
RecommenderParameters(java.util.List<java.lang.String> args, int start)
          Create a CommandLineParameters object.
RecommenderParameters(java.lang.String arg_string)
          Create a CommandLineParameters object.
 
Method Summary
 boolean checkForLeftovers()
          Check for parameters that have not been processed yet.
 boolean GetRemoveBool(java.lang.String key)
          Get the value of a boolean parameter from the collection and remove the corresponding key-value pair.
 boolean GetRemoveBool(java.lang.String key, boolean dvalue)
          Get the value of a boolean parameter from the collection and remove the corresponding key-value pair.
 double getRemoveDouble(java.lang.String key)
          Get a double value from the parameters.
 double getRemoveDouble(java.lang.String key, double dvalue)
          Get a double value from the parameters.
 float getRemoveFloat(java.lang.String key)
          Get a float value from the parameters.
 float getRemoveFloat(java.lang.String key, float dvalue)
          Get a float value from the parameters.
 int getRemoveInt32(java.lang.String key)
          Get the value of an integer parameter from the collection and remove the corresponding key-value pair.
 int getRemoveInt32(java.lang.String key, int dvalue)
          Get the value of an integer parameter from the collection and remove the corresponding key-value pair.
 java.util.List<java.lang.Integer> getRemoveInt32List(java.lang.String key)
          Get the values of an integer list parameter from the collection and remove the corresponding key-value pair.
 java.util.List<java.lang.Integer> getRemoveInt32List(java.lang.String key, java.lang.String sep)
          Get the values of an integer list parameter from the collection and remove the corresponding key-value pair.
 java.lang.String getRemoveString(java.lang.String key)
          Get a string parameter.
 java.lang.String getRemoveString(java.lang.String key, java.lang.String dvalue)
          Get a string parameter.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

RecommenderParameters

public RecommenderParameters(java.lang.String arg_string)
Create a CommandLineParameters object.

Parameters:
arg_string - a string that contains the command line parameters

RecommenderParameters

public RecommenderParameters(java.util.List<java.lang.String> args,
                             int start)
Create a CommandLineParameters object.

Parameters:
args - a list of strings that contains the command line parameters
start - ignore all parameters before this position
Method Detail

checkForLeftovers

public boolean checkForLeftovers()
Check for parameters that have not been processed yet.

Returns:
true if there are leftovers

getRemoveInt32

public int getRemoveInt32(java.lang.String key)
Get the value of an integer parameter from the collection and remove the corresponding key-value pair.

Parameters:
key - the name of the parameter
Returns:
the value of the parameter if it exists, 0 otherwise

getRemoveInt32

public int getRemoveInt32(java.lang.String key,
                          int dvalue)
Get the value of an integer parameter from the collection and remove the corresponding key-value pair.

Parameters:
key - the name of the parameter
dvalue - the default value of the parameter
Returns:
the value of the parameter if it exists, the default otherwise

getRemoveInt32List

public java.util.List<java.lang.Integer> getRemoveInt32List(java.lang.String key)
Get the values of an integer list parameter from the collection and remove the corresponding key-value pair.

Parameters:
key - the name of the parameter
Returns:
the values of the parameter if it exists, an empty list otherwise

getRemoveInt32List

public java.util.List<java.lang.Integer> getRemoveInt32List(java.lang.String key,
                                                            java.lang.String sep)
Get the values of an integer list parameter from the collection and remove the corresponding key-value pair.

Parameters:
key - the name of the parameter
sep - the separator character used to split the string representation of the list
Returns:
the values of the parameter if it exists, the default otherwise

getRemoveDouble

public double getRemoveDouble(java.lang.String key)
Get a double value from the parameters.

Parameters:
key - the parameter name
Returns:
the value of the parameter, 0 if no parameter of the given name found

getRemoveDouble

public double getRemoveDouble(java.lang.String key,
                              double dvalue)
Get a double value from the parameters.

Parameters:
key - the parameter name
dvalue - the default value if parameter of the given name is not found
Returns:
the value of the parameter if it is found, the default value otherwise

getRemoveFloat

public float getRemoveFloat(java.lang.String key)
Get a float value from the parameters.

Parameters:
key - the parameter name
Returns:
the value of the parameter, 0 if no parameter of the given name found

getRemoveFloat

public float getRemoveFloat(java.lang.String key,
                            float dvalue)
Get a float value from the parameters.

Parameters:
key - the parameter name
dvalue - the default value if parameter of the given name is not found
Returns:
the value of the parameter if it is found, the default value otherwise

getRemoveString

public java.lang.String getRemoveString(java.lang.String key)
Get a string parameter.

Parameters:
key - the name of the parameter
Returns:
the parameter value related to key, an empty string if it does not exist

getRemoveString

public java.lang.String getRemoveString(java.lang.String key,
                                        java.lang.String dvalue)
Get a string parameter.

Parameters:
key - the name of the parameter
dvalue - the default value
Returns:
the parameter value related to key, the default value if it does not exist

GetRemoveBool

public boolean GetRemoveBool(java.lang.String key)
Get the value of a boolean parameter from the collection and remove the corresponding key-value pair.

Parameters:
key - the name of the parameter
Returns:
the value of the parameter if it exists, false otherwise

GetRemoveBool

public boolean GetRemoveBool(java.lang.String key,
                             boolean dvalue)
Get the value of a boolean parameter from the collection and remove the corresponding key-value pair.

Parameters:
key - the name of the parameter
dvalue - the default value of the parameter
Returns:
the value of the parameter if it exists, the default otherwise