public class VariableTypeMap extends HashMap<Variable,ConstantType>
HashMap
,
adding functionality specific to predicate arguments.
Any variable that changes type will throw an exception,
except for DeferredFunctionalUniqueID.
DeferredFunctionalUniqueID can be replaced with UniqueIntID or UniqueStringID.
After all variables in a rule are added, there should be no DeferredFunctionalUniqueID left.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
VariableTypeMap() |
Modifier and Type | Method and Description |
---|---|
void |
addAll(VariableTypeMap other)
Performs a shallow copy of all variable-type pairs from another VariableTypeMap to this one.
|
void |
addVariable(Variable var,
ConstantType type) |
void |
addVariable(Variable var,
ConstantType type,
boolean force)
Adds a variable-type pair to the hashmap.
|
ConstantType |
getType(Variable var)
Returns the type of a given variable.
|
Set<Variable> |
getVariables()
Returns all variables in the hashmap.
|
boolean |
hasVariable(Variable var)
Returns whether the given variable exists in the hashmap.
|
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
equals, hashCode, toString
public void addVariable(Variable var, ConstantType type)
public void addVariable(Variable var, ConstantType type, boolean force)
var
- A variabletype
- An argument typeforce
- ignore any consistency checks. This is not suggested.public Set<Variable> getVariables()
public ConstantType getType(Variable var)
var
- A variablepublic boolean hasVariable(Variable var)
var
- A variablepublic void addAll(VariableTypeMap other)
other
- Another VariableTypeMapCopyright © 2018 University of California, Santa Cruz. All rights reserved.