public class FactMap<T> extends java.lang.Object implements NameValueReferableMap<T>
Map; it stores facts by their name and provides convenience methods for
accessing Fact objects.| Constructor and Description |
|---|
FactMap() |
FactMap(java.util.Map<java.lang.String,NameValueReferable<T>> facts) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<java.lang.String,NameValueReferable<T>>> |
entrySet() |
Fact<T> |
get(java.lang.Object key) |
java.lang.Double |
getDblVal(java.lang.String name)
Method getDblVal() gets the Double value of a Fact in the FactMap.
|
java.lang.Integer |
getIntVal(java.lang.String name)
Method getIntVal() gets the Integer value of a Fact in the FactMap.
|
T |
getOne()
The method getOne() gets the value of the single Fact in the FactMap.
|
java.lang.String |
getStrVal(java.lang.String name)
Method getStrVal() gets the String value of a Fact in the FactMap.
|
T |
getValue(java.lang.String name)
The method getValue() returns the value of the Fact associated with the name passed in.
|
boolean |
isEmpty() |
java.util.Set<java.lang.String> |
keySet() |
Fact<T> |
put(NameValueReferable<T> fact)
This put() method is a convenience method for adding a Fact to a FactMap.
It uses the name of the Fact as the key and the Fact as the value. |
Fact<T> |
put(java.lang.String key,
NameValueReferable<T> fact) |
void |
putAll(java.util.Map<? extends java.lang.String,? extends NameValueReferable<T>> map) |
Fact<T> |
remove(java.lang.Object key) |
void |
setValue(java.lang.String name,
T value)
The method setValue sets the value of the Fact by its name.
If no Fact exists with the associated name, a new fact is created with the specified name and value. |
int |
size() |
java.lang.String |
toString()
The toString() method gets the FactMap converted a string.
If there is only one Fact, the String value is the String value of the Fact. Otherwise, the String value is the value of the parent HashMap. |
java.util.Collection<NameValueReferable<T>> |
values() |
public FactMap(java.util.Map<java.lang.String,NameValueReferable<T>> facts)
public FactMap()
public T getOne()
getOne in interface NameValueReferableMap<T>public T getValue(java.lang.String name)
getValue in interface NameValueReferableMap<T>name - the name of the Factpublic java.lang.String getStrVal(java.lang.String name)
name - the name of the Fact in the FactMappublic java.lang.Integer getIntVal(java.lang.String name)
name - the name of the Fact in the FactMappublic java.lang.Double getDblVal(java.lang.String name)
name - the name of the Fact in the FactMappublic void setValue(java.lang.String name,
T value)
setValue in interface NameValueReferableMap<T>name - the name of the Factvalue - the value object of the Factpublic Fact<T> put(NameValueReferable<T> fact)
put in interface NameValueReferableMap<T>fact - the Fact to be added to the FactMappublic Fact<T> put(java.lang.String key, NameValueReferable<T> fact)
put in interface java.util.Map<java.lang.String,NameValueReferable<T>>public int size()
size in interface java.util.Map<java.lang.String,NameValueReferable<T>>public boolean isEmpty()
isEmpty in interface java.util.Map<java.lang.String,NameValueReferable<T>>public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<java.lang.String,NameValueReferable<T>>public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<java.lang.String,NameValueReferable<T>>public Fact<T> get(java.lang.Object key)
get in interface java.util.Map<java.lang.String,NameValueReferable<T>>public Fact<T> remove(java.lang.Object key)
remove in interface java.util.Map<java.lang.String,NameValueReferable<T>>public void putAll(java.util.Map<? extends java.lang.String,? extends NameValueReferable<T>> map)
putAll in interface java.util.Map<java.lang.String,NameValueReferable<T>>public void clear()
clear in interface java.util.Map<java.lang.String,NameValueReferable<T>>public java.util.Set<java.lang.String> keySet()
keySet in interface java.util.Map<java.lang.String,NameValueReferable<T>>public java.util.Collection<NameValueReferable<T>> values()
values in interface java.util.Map<java.lang.String,NameValueReferable<T>>public java.util.Set<java.util.Map.Entry<java.lang.String,NameValueReferable<T>>> entrySet()
entrySet in interface java.util.Map<java.lang.String,NameValueReferable<T>>public java.lang.String toString()
HashMap.toString in class java.lang.Object