/**
  * Constructs a map that decorates the specified maps,
  * used by the subclass <code>createBidiMap</code> implementation.
  *
  * @param normalMap  the normal direction map
  * @param reverseMap  the reverse direction map
  * @param inverseBidiMap  the inverse BidiMap
  */
 protected AbstractDualBidiMap(java.util.Map <Object, Object> normalMap, java.util.Map <Object, Object> reverseMap, BidiMap inverseBidiMap)
     : base()
 {
     maps[0] = normalMap;
     maps[1] = reverseMap;
     this.inverseBidiMapJ = inverseBidiMap;
 }
 public virtual BidiMap inverseBidiMap()
 {
     if (inverseBidiMapJ == null)
     {
         inverseBidiMapJ = createBidiMap(maps[1], maps[0], this);
     }
     return(inverseBidiMapJ);
 }
 /**
  * Factory method to create an unmodifiable map.
  * <p>
  * If the map passed in is already unmodifiable, it is returned.
  *
  * @param map  the map to decorate, must not be null
  * @return an unmodifiable BidiMap
  * @throws IllegalArgumentException if map is null
  */
 public static BidiMap decorate(BidiMap map)
 {
     if (map is Unmodifiable)
     {
         return map;
     }
     return new UnmodifiableBidiMap(map);
 }
 /**
  * Factory method to create an unmodifiable map.
  * <p>
  * If the map passed in is already unmodifiable, it is returned.
  *
  * @param map  the map to decorate, must not be null
  * @return an unmodifiable BidiMap
  * @throws IllegalArgumentException if map is null
  */
 public static BidiMap decorate(BidiMap map)
 {
     if (map is Unmodifiable)
     {
         return(map);
     }
     return(new UnmodifiableBidiMap(map));
 }
Exemplo n.º 5
0
 /**
  * Constructor that wraps (not copies).
  *
  * @param map  the map to decorate, must not be null
  * @throws IllegalArgumentException if the collection is null
  */
 protected AbstractBidiMapDecorator(BidiMap map)
     : base(map)
 {
 }
 /**
  * Creates a new instance of this object.
  *
  * @param normalMap  the normal direction map
  * @param reverseMap  the reverse direction map
  * @param inverseMap  the inverse BidiMap
  * @return new bidi map
  */
 protected override BidiMap createBidiMap(java.util.Map<Object, Object> normalMap, java.util.Map<Object, Object> reverseMap, BidiMap inverseMap)
 {
     return new DualTreeBidiMap(normalMap, reverseMap, inverseMap);
 }
 /**
  * Constructs a <code>DualTreeBidiMap</code> that decorates the specified maps.
  *
  * @param normalMap  the normal direction map
  * @param reverseMap  the reverse direction map
  * @param inverseBidiMap  the inverse BidiMap
  */
 protected DualTreeBidiMap(java.util.Map<Object, Object> normalMap, java.util.Map<Object, Object> reverseMap, BidiMap inverseBidiMap)
     : base(normalMap, reverseMap, inverseBidiMap)
 {
     this.comparatorJ = ((java.util.SortedMap<Object, Object>)normalMap).comparator();
 }
 /**
  * Constructs a <code>DualTreeBidiMap</code> that decorates the specified maps.
  *
  * @param normalMap  the normal direction map
  * @param reverseMap  the reverse direction map
  * @param inverseBidiMap  the inverse BidiMap
  */
 protected DualTreeBidiMap(java.util.Map <Object, Object> normalMap, java.util.Map <Object, Object> reverseMap, BidiMap inverseBidiMap) :
     base(normalMap, reverseMap, inverseBidiMap)
 {
     this.comparatorJ = ((java.util.SortedMap <Object, Object>)normalMap).comparator();
 }
 /**
  * Creates a new instance of this object.
  *
  * @param normalMap  the normal direction map
  * @param reverseMap  the reverse direction map
  * @param inverseMap  the inverse BidiMap
  * @return new bidi map
  */
 protected override BidiMap createBidiMap(java.util.Map <Object, Object> normalMap, java.util.Map <Object, Object> reverseMap, BidiMap inverseMap)
 {
     return(new DualTreeBidiMap(normalMap, reverseMap, inverseMap));
 }
 /**
  * Constructor that wraps (not copies).
  *
  * @param map  the map to decorate, must not be null
  * @throws IllegalArgumentException if the collection is null
  */
 protected AbstractBidiMapDecorator(BidiMap map)
     : base(map)
 {
 }
 /**
  * Creates a new instance of the subclass.
  *
  * @param normalMap  the normal direction map
  * @param reverseMap  the reverse direction map
  * @param inverseMap  this map, which is the inverse in the new map
  * @return the inverse map
  */
 protected abstract BidiMap createBidiMap(java.util.Map <Object, Object> normalMap, java.util.Map <Object, Object> reverseMap, BidiMap inverseMap);
 //-----------------------------------------------------------------------
 /**
  * Constructor that wraps (not copies).
  *
  * @param map  the map to decorate, must not be null
  * @throws IllegalArgumentException if map is null
  */
 private UnmodifiableBidiMap(BidiMap map)
     : base(map)
 {
 }
 /**
  * Constructs a <code>HashBidiMap</code> that decorates the specified maps.
  *
  * @param normalMap  the normal direction map
  * @param reverseMap  the reverse direction map
  * @param inverseBidiMap  the inverse BidiMap
  */
 protected DualHashBidiMap(java.util.Map<Object, Object> normalMap, java.util.Map<Object, Object> reverseMap, BidiMap inverseBidiMap)
     : base(normalMap, reverseMap, inverseBidiMap)
 {
 }
        //-----------------------------------------------------------------------

        /**
         * Constructor that wraps (not copies).
         *
         * @param map  the map to decorate, must not be null
         * @throws IllegalArgumentException if map is null
         */
        private UnmodifiableBidiMap(BidiMap map)
            : base(map)
        {
        }
Exemplo n.º 15
0
 /**
  * Constructs a <code>HashBidiMap</code> that decorates the specified maps.
  *
  * @param normalMap  the normal direction map
  * @param reverseMap  the reverse direction map
  * @param inverseBidiMap  the inverse BidiMap
  */
 protected DualHashBidiMap(java.util.Map <Object, Object> normalMap, java.util.Map <Object, Object> reverseMap, BidiMap inverseBidiMap) :
     base(normalMap, reverseMap, inverseBidiMap)
 {
 }