Package adams.data.spreadsheet
Class LookUpHelper
- java.lang.Object
-
- adams.data.spreadsheet.LookUpHelper
-
public class LookUpHelper extends Object
Helper class for LookUp related stuff.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description LookUpHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HashMap<String,Object>getTable(Actor context, StorageName name)Returns the specified lookup table.static HashMap<String,Object>load(int initialCap, SpreadSheet sheet, String key, String value, boolean useNative, StringBuilder error)Generates a lookup table from the given spreadsheet.static HashMap<String,Object>load(SpreadSheet sheet, String key, String value, boolean useNative, StringBuilder error)Generates a lookup table from the given spreadsheet.static HashMap<String,Object>newTable()Returns an empty new lookup table.static HashMap<String,Object>newTable(int initialCapacity)Returns an empty new lookup table.
-
-
-
Method Detail
-
newTable
public static HashMap<String,Object> newTable()
Returns an empty new lookup table.- Returns:
- the empty lookup
-
newTable
public static HashMap<String,Object> newTable(int initialCapacity)
Returns an empty new lookup table.- Parameters:
initialCapacity- the initial capacity for the map- Returns:
- the empty lookup
-
getTable
public static HashMap<String,Object> getTable(Actor context, StorageName name)
Returns the specified lookup table.- Returns:
- the table
-
load
public static HashMap<String,Object> load(SpreadSheet sheet, String key, String value, boolean useNative, StringBuilder error)
Generates a lookup table from the given spreadsheet.- Parameters:
sheet- the spreadsheet to usekey- the key column (or 1-based index)value- the value column (or 1-based index)useNative- whether to use native objects or just string representationerror- for storing error messages- Returns:
- the lookup table, null in case of an error
-
load
public static HashMap<String,Object> load(int initialCap, SpreadSheet sheet, String key, String value, boolean useNative, StringBuilder error)
Generates a lookup table from the given spreadsheet.- Parameters:
initialCap- the initial capacity to use for the lookup table, <= 0 for defaultsheet- the spreadsheet to usekey- the key column (or 1-based index)value- the value column (or 1-based index)useNative- whether to use native objects or just string representationerror- for storing error messages- Returns:
- the lookup table, null in case of an error
-
-