/// <summary> /// Tired of Properties not behaving like /// <c>Map<String,String></c> /// s? This method will solve that problem for you. /// </summary> public static IDictionary <string, string> AsMap(Properties properties) { IDictionary <string, string> map = Generics.NewHashMap(); foreach (KeyValuePair <object, object> entry in properties) { map[(string)entry.Key] = (string)entry.Value; } return(map); }
/// <summary>Compose two maps map1:x->y and map2:y->z to get a map x->z</summary> /// <returns>The composed map</returns> public static IDictionary <X, Z> Compose <X, Y, Z>(IDictionary <X, Y> map1, IDictionary <Y, Z> map2) { IDictionary <X, Z> composedMap = Generics.NewHashMap(); foreach (X key in map1.Keys) { composedMap[key] = map2[map1[key]]; } return(composedMap); }
public FastDisjointSet(ICollection <T> objectSet) { objectToElement = Generics.NewHashMap(); foreach (T o in objectSet) { // create an element FastDisjointSet.Element <T> e = new FastDisjointSet.Element <T>(o); objectToElement[o] = e; } }
/// <summary>Inverts a map x->y to a map y->pow(x) not assuming unique preimages.</summary> /// <returns>The inverted set</returns> public static IDictionary <Y, ICollection <X> > InvertSet <X, Y>(IDictionary <X, Y> map) { IDictionary <Y, ICollection <X> > invertedMap = Generics.NewHashMap(); foreach (KeyValuePair <X, Y> entry in map) { X key = entry.Key; Y value = entry.Value; PutIntoValueHashSet(invertedMap, value, key); } return(invertedMap); }
/// <summary>Inverts a map x->y to a map y->x assuming unique preimages.</summary> /// <remarks>Inverts a map x->y to a map y->x assuming unique preimages. If they are not unique, you get an arbitrary ones as the values in the inverted map.</remarks> /// <returns>The inverted map</returns> public static IDictionary <Y, X> Invert <X, Y>(IDictionary <X, Y> map) { IDictionary <Y, X> invertedMap = Generics.NewHashMap(); foreach (KeyValuePair <X, Y> entry in map) { X key = entry.Key; Y value = entry.Value; invertedMap[value] = key; } return(invertedMap); }
public FourDimensionalMap() { this.map = Generics.NewHashMap(); }
/// <summary>Creates a new Index.</summary> /// <param name="capacity">Initial capacity of Index.</param> public HashIndex(int capacity) : base() { objects = new List <E>(capacity); indexes = Generics.NewHashMap(capacity); }
/// <summary>Creates a new Index.</summary> public HashIndex() : base() { objects = new List <E>(); indexes = Generics.NewHashMap(); }
public override IDictionary <K1, V1> SetMap <K1, V1>(IDictionary <K1, V1> map, int initCapacity) { map = Generics.NewHashMap(initCapacity); return(map); }
public override IDictionary <K1, V1> SetMap <K1, V1>(IDictionary <K1, V1> map) { map = Generics.NewHashMap(); return(map); }
public override IDictionary <K, V> NewMap(int initCapacity) { return(Generics.NewHashMap(initCapacity)); }
public override IDictionary <K, V> NewMap() { return(Generics.NewHashMap()); }
public ArrayHeap(IComparator <E> cmp, int initCapacity) { this.cmp = cmp; indexToEntry = new List <ArrayHeap.HeapEntry <E> >(initCapacity); objectToEntry = Generics.NewHashMap(initCapacity); }
/// <summary>Create an ArrayHeap.</summary> /// <param name="cmp">The objects added will be ordered using the <code>Comparator</code>.</param> public ArrayHeap(IComparator <E> cmp) { this.cmp = cmp; indexToEntry = new List <ArrayHeap.HeapEntry <E> >(); objectToEntry = Generics.NewHashMap(); }
public ThreeDimensionalMap() { this.map = Generics.NewHashMap(); }
public OneToOneMap() { //------------------------------------------------------------ m_leftAsKey = Generics.NewHashMap(); m_rightAsKey = Generics.NewHashMap(); }