Package adams.data.spreadsheet
Class LookUpHelper
- java.lang.Object
-
- adams.data.spreadsheet.LookUpHelper
-
public class LookUpHelper extends Object
Helper class for LookUp related stuff.- Version:
- $Revision$
- 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(PlaceholderFile file, String key, String value, boolean useNative, StringBuilder error)
Generates a lookup table from the given file.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.
-
-
-
Method Detail
-
newTable
public static HashMap<String,Object> newTable()
Returns an empty new lookup table.- Returns:
- the empty table
-
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(PlaceholderFile file, String key, String value, boolean useNative, StringBuilder error)
Generates a lookup table from the given file. Uses empty string as missing value.- Parameters:
file
- the spreadsheet (CSV) to loadkey
- 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(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
-
-