Package com.microstrategy.webapi.utils
Class TriMap<T1,T2,T3>
- java.lang.Object
-
- com.microstrategy.webapi.utils.TriMap<T1,T2,T3>
-
public class TriMap<T1,T2,T3> extends java.lang.ObjectTriMap is a triple-directional map. It is intended to hold items, T1, T2, and T3, that have a 1-1 relationship and it is desired to look up item T1 from T2 or T3, T2 from T1 or T2, or T3 from T1 or T2. If a new item is inserted that already exists in the map the add will fail
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTriMap.Entry<T1,T2,T3>
-
Constructor Summary
Constructors Constructor Description TriMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddT1(T1 iT1, T2 iT2, T3 iT3)addT1 puts the iT1, iT2, and iT3 into the internal tri-maps.voidclear()clear will remove all entries in the tri-mapsbooleancontainsT1(T1 iT1)containsT1 return true is iT1 is in the tri-mapsbooleancontainsT2(T2 iT2)containsT2 return true is iT2 is in the tri-mapsbooleancontainsT3(T3 iT3)containsT2 return true is iT2 is in the tri-mapsjava.util.Set<TriMap.Entry<T1,T2,T3>>entrySet()entrySet returns a Set of Entry objects from the tri-maps.TriMap.Entry<T1,T2,T3>getByT1(T1 iT1)TriMap.Entry<T1,T2,T3>getByT2(T2 iT2)TriMap.Entry<T1,T2,T3>getByT3(T3 iT3)booleanisEmpty()TriMap.Entry<T1,T2,T3>removeByT1(T1 iT1)removeByT1 removes the entry in the tri-maps corresponding to iT1.TriMap.Entry<T1,T2,T3>removeByT2(T2 iT2)removeByT2 removes the entry in the tri-maps corresponding to iT2.TriMap.Entry<T1,T2,T3>removeByT3(T3 iT3)removeByT3 removes the entry in the tri-maps corresponding to iT3.intsize()
-
-
-
Method Detail
-
addT1
public void addT1(T1 iT1, T2 iT2, T3 iT3) throws java.lang.IllegalArgumentException
addT1 puts the iT1, iT2, and iT3 into the internal tri-maps. throws IllegalArgumentException if T1, T2, or T3 already exist in the map- Throws:
java.lang.IllegalArgumentException
-
getByT1
public TriMap.Entry<T1,T2,T3> getByT1(T1 iT1)
-
getByT2
public TriMap.Entry<T1,T2,T3> getByT2(T2 iT2)
-
getByT3
public TriMap.Entry<T1,T2,T3> getByT3(T3 iT3)
-
removeByT1
public TriMap.Entry<T1,T2,T3> removeByT1(T1 iT1)
removeByT1 removes the entry in the tri-maps corresponding to iT1. Returns the entry of the map
-
removeByT2
public TriMap.Entry<T1,T2,T3> removeByT2(T2 iT2)
removeByT2 removes the entry in the tri-maps corresponding to iT2. Returns the entry of the map
-
removeByT3
public TriMap.Entry<T1,T2,T3> removeByT3(T3 iT3)
removeByT3 removes the entry in the tri-maps corresponding to iT3. Returns the entry of the map
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
containsT1
public boolean containsT1(T1 iT1)
containsT1 return true is iT1 is in the tri-maps
-
containsT2
public boolean containsT2(T2 iT2)
containsT2 return true is iT2 is in the tri-maps
-
containsT3
public boolean containsT3(T3 iT3)
containsT2 return true is iT2 is in the tri-maps
-
clear
public void clear()
clear will remove all entries in the tri-maps
-
entrySet
public java.util.Set<TriMap.Entry<T1,T2,T3>> entrySet()
entrySet returns a Set of Entry objects from the tri-maps. It is intended to be used when iterating over the tri-maps. It works very similarly (same syntax) as the HashMap.entrySet(). However, the returned Set is independent of the contents of the tri-map. Thus, if you modify the returned Set, you will NOT modify the underlying tri-maps
-
-