Package es.upm.etsisi.cf4j.data
Class DataBank
- java.lang.Object
-
- es.upm.etsisi.cf4j.data.DataBank
-
- All Implemented Interfaces:
Serializable
public class DataBank extends Object implements Serializable
DataBank is focused on storing heterogeneous data as a support to the calculations made in the recommendation process.Only the following types are allowed to be stored: boolean, boolean[], int, int[], double, double[], String and String[].
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DataBank()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(String key)
Finds if an element exist inside the DataBankboolean
delete(String key)
Deletes a value associated to a single element key.void
deleteAll()
Deletes all content of this DataBank.boolean
getBoolean(String key)
Gets an stored boolean inside the DataBank.boolean[]
getBooleanArray(String key)
Gets an stored boolean array inside the DataBank.double
getDouble(String key)
Gets an stored double inside the DataBank.double[]
getDoubleArray(String key)
Gets an stored double array inside the DataBank.int
getInt(String key)
Gets an stored int inside the DataBank.int[]
getIntArray(String key)
Gets an stored int array inside the DataBank.String
getString(String key)
Gets an stored String inside the DataBank.String[]
getStringArray(String key)
Gets an stored String array inside the DataBank.void
setBoolean(String key, boolean value)
Sets or stores a boolean inside the DataBank.void
setBooleanArray(String key, boolean[] value)
Sets or stores a boolean array inside the DataBank.void
setDouble(String key, double value)
Sets or stores a double inside the DataBank.void
setDoubleArray(String key, double[] value)
Sets or stores a double array inside the DataBank.void
setInt(String key, int value)
Sets or stores an int inside the DataBank.void
setIntArray(String key, int[] value)
Sets or stores an int array inside the DataBank.void
setString(String key, String value)
Sets or stores an String inside the DataBank.void
setStringArray(String key, String[] value)
Sets or stores a double array inside the DataBank.
-
-
-
Method Detail
-
deleteAll
public void deleteAll()
Deletes all content of this DataBank.
-
delete
public boolean delete(String key)
Deletes a value associated to a single element key.- Parameters:
key
- Key where the data is stored- Returns:
- true if the key was found
-
contains
public boolean contains(String key)
Finds if an element exist inside the DataBank- Parameters:
key
- Key to be searched- Returns:
- true if the key exist inside the DataBank
-
setBoolean
public void setBoolean(String key, boolean value)
Sets or stores a boolean inside the DataBank.- Parameters:
key
- Key where the element will be stored.value
- boolean value to be stored.
-
setBooleanArray
public void setBooleanArray(String key, boolean[] value)
Sets or stores a boolean array inside the DataBank.- Parameters:
key
- Key where the element will be stored.value
- boolean array to be stored.
-
setInt
public void setInt(String key, int value)
Sets or stores an int inside the DataBank.- Parameters:
key
- Key where the element will be stored.value
- int value to be stored.
-
setIntArray
public void setIntArray(String key, int[] value)
Sets or stores an int array inside the DataBank.- Parameters:
key
- Key where the element will be stored.value
- int array to be stored.
-
setDouble
public void setDouble(String key, double value)
Sets or stores a double inside the DataBank.- Parameters:
key
- Key where the element will be stored.value
- double value to be stored.
-
setDoubleArray
public void setDoubleArray(String key, double[] value)
Sets or stores a double array inside the DataBank.- Parameters:
key
- Key where the element will be stored.value
- double array to be stored.
-
setString
public void setString(String key, String value)
Sets or stores an String inside the DataBank.- Parameters:
key
- Key where the element will be stored.value
- String value to be stored.
-
setStringArray
public void setStringArray(String key, String[] value)
Sets or stores a double array inside the DataBank.- Parameters:
key
- Key where the element will be stored.value
- String array to be stored.
-
getBoolean
public boolean getBoolean(String key)
Gets an stored boolean inside the DataBank.- Parameters:
key
- Key where the element should be stored- Returns:
- Stored boolean value or null if key does not exists
-
getBooleanArray
public boolean[] getBooleanArray(String key)
Gets an stored boolean array inside the DataBank.- Parameters:
key
- Key where the element should be stored- Returns:
- Stored boolean array value or null if key does not exists
-
getInt
public int getInt(String key)
Gets an stored int inside the DataBank.- Parameters:
key
- Key where the element should be stored- Returns:
- Stored int value or null if key does not exists
-
getIntArray
public int[] getIntArray(String key)
Gets an stored int array inside the DataBank.- Parameters:
key
- Key where the element should be stored- Returns:
- Stored int array value or null if key does not exists
-
getDouble
public double getDouble(String key)
Gets an stored double inside the DataBank.- Parameters:
key
- Key where the element should be stored- Returns:
- Stored double value or null if key does not exists
-
getDoubleArray
public double[] getDoubleArray(String key)
Gets an stored double array inside the DataBank.- Parameters:
key
- Key where the element should be stored- Returns:
- Stored double array value or null if key does not exists
-
getString
public String getString(String key)
Gets an stored String inside the DataBank.- Parameters:
key
- Key where the element should be stored- Returns:
- Stored String value or null if key does not exists
-
-