private List <String> getBasic(String key, String constraintValue, String defaultValue, MultiMap <Value> map) { List <String> mappedValues = new List <String>(); // If null key use the default value if this is defined if (key == null) { if (defaultValue != null) { mappedValues.Add(defaultValue); return(mappedValues); } else { return(null); } } if (map.IsEmpty()) { // no translation - this is a one-one mapping: mappedValues.Add(key); return(mappedValues); } else if (map.ContainsKey(key)) { List <Value> values = map[key]; List <String> stringValues = new List <String>(); foreach (Value v in values) { if (v.constraintMatches(constraintValue)) { stringValues.Add(v.getValue()); } } return(stringValues); } else if (defaultValue != null) { mappedValues.Add(defaultValue); return(mappedValues); } return(null); // mapping failed }
public BiDirectionalMap() { forwardMap = new MultiMap <Value>(); inverseMap = new MultiMap <Value>(); }
// Clears the map - intended to be used when reloading from file public void clear() { forwardMap = new MultiMap <Value>(); inverseMap = new MultiMap <Value>(); }