|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.omGraphics.geom.BasicGeometry com.bbn.openmap.omGraphics.OMGraphicAdapter com.bbn.openmap.omGraphics.OMList<OMGraphic> com.bbn.openmap.omGraphics.OMGraphicList com.bbn.openmap.omGraphics.OMGraphicHash
public class OMGraphicHash
This is an OMGraphicsList sub-class with a Map interface. Access is backed by a HashMap. Insertion and removal of OMGraphics is through the Map interface.
The add(OMGraphic), addOMGraphic(OMGraphic), remove(OMGraphic), and removeOMGraphicAt(int) method are disabled and will throw a RuntimeException if called.
This class is suited for use as the top OMGraphicList in an OMHandlerLayer that has a large number of OMGraphic objects and needs to access those objects using a unique key.
OMGraphicList
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.OMList |
---|
OMList.OMDist<T> |
Field Summary |
---|
Fields inherited from class com.bbn.openmap.omGraphics.OMList |
---|
allowDuplicates, FIRST_ADDED_ON_TOP, graphics, LAST_ADDED_ON_TOP, NONE, processAllGeometries, traverseMode, vague |
Fields inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter |
---|
declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask |
Fields inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
---|
attributes, lineType, needToRegenerate, shape, visible |
Constructor Summary | |
---|---|
OMGraphicHash()
Creates a new instance of OMGraphicHash |
|
OMGraphicHash(int initialCapacity)
Construct an OMGraphicList with an initial capacity. |
Method Summary | |
---|---|
boolean |
add(OMGraphic g)
Add an OMGraphic to the list. |
void |
clear()
Remove all elements from the graphic list. |
java.lang.Object |
clone()
Generic return of SinkGraphic for subclasses that don't implement clone properly. |
boolean |
containsKey(java.lang.Object obj)
Returns true if this map contains a mapping for the specified key. |
boolean |
containsValue(OMGraphic obj)
Returns true if this map maps one or more keys to the specified value. |
java.util.Set<java.util.Map.Entry<java.lang.Object,OMGraphic>> |
entrySet()
Returns a set view of the mappings contained in this map. |
OMGraphic |
get(java.lang.Object obj)
Returns the value to which this map maps the specified key. |
java.util.Set<java.lang.Object> |
keySet()
Returns a set view of the keys contained in this map. |
java.lang.Object |
put(java.lang.Object key,
OMGraphic graphic)
Associates the specified value with the specified key in this map (optional operation). |
void |
putAll(java.util.Map<java.lang.Object,OMGraphic> map)
Copies all of the mappings from the specified map to this map (optional operation). |
OMGraphic |
remove(int location)
Remove the graphic at the location number. |
boolean |
remove(java.lang.Object key)
Removes the mapping for this key from this map if it is present (optional operation). |
boolean |
remove(OMGraphic graphic)
Remove the graphic. |
void |
restore(OMGeometry source)
You need to make sure that the Generic type of the source matches the generic type of this list. |
java.util.Collection<OMGraphic> |
values()
Returns a collection view of the values contained in this map. |
Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicList |
---|
add, addAll, addAll, create, createDist, get, getOMGraphicAt, getTargets, iteratorCopy, listIteratorCopy, listIteratorCopy, objectToOMGraphic, readGraphics, readGraphics, set, setFillPaint, setGridGenerator, setLinePaint, setMatted, setMattingPaint, setOMGraphicAt, setSelectPaint, setStroke, setTargets, setTextureMask, sort, writeGraphics, writeGraphics |
Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
---|
_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
equals, hashCode |
Methods inherited from interface com.bbn.openmap.omGraphics.OMGraphic |
---|
getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, hasLineTypeChoice, isMatted, isSelected, normalizeDistanceForLineWidth, regenerate, renderLabel, setDeclutterType, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setRenderType, setSelected, setShowEditablePalette, shouldRenderEdge, shouldRenderFill |
Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry |
---|
clearAttributes, contains, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape |
Constructor Detail |
---|
public OMGraphicHash()
public OMGraphicHash(int initialCapacity)
initialCapacity
- the initial capacity of the listMethod Detail |
---|
public OMGraphic get(java.lang.Object obj)
More formally, if this map contains a mapping from a key k to a value v such that (key==null ? k==null : key.equals(k)), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)
obj
- key whose associated value is to be returned.
java.lang.ClassCastException
- if the key is of an inappropriate type for
this map (optional).
java.lang.NullPointerException
- if the key is null and this map
does not permit null keys (optional).containsKey(Object)
public boolean containsKey(java.lang.Object obj)
obj
- key whose presence in this map is to be tested.
java.lang.ClassCastException
- if the key is of an inappropriate type for
this map (optional).
java.lang.NullPointerException
- if the key is null and this map
does not permit null keys (optional).public boolean containsValue(OMGraphic obj)
obj
- value whose presence in this map is to be tested.
java.lang.ClassCastException
- if the value is of an inappropriate type for
this map (optional).
java.lang.NullPointerException
- if the value is null and this map
does not permit null values (optional).public java.util.Set<java.util.Map.Entry<java.lang.Object,OMGraphic>> entrySet()
Map.Entry
. The set is backed by the map, so
changes to the map are reflected in the set, and vice-versa. If the map
is modified while an iteration over the set is in progress (except
through the iterator's own remove operation, or through the
setValue operation on a map entry returned by the iterator) the
results of the iteration are undefined. The set supports element removal,
which removes the corresponding mapping from the map, via the
Iterator.remove, Set.remove, removeAll,
retainAll and clear operations. It does not support the
add or addAll operations.
public java.util.Set<java.lang.Object> keySet()
public java.lang.Object put(java.lang.Object key, OMGraphic graphic)
m.containsKey(k)
would return true
.))
key
- key with which the specified value is to be associated.graphic
- value to be associated with the specified key.
java.lang.UnsupportedOperationException
- if the put operation is
not supported by this map.
java.lang.ClassCastException
- if the class of the specified key or value
prevents it from being stored in this map.
java.lang.IllegalArgumentException
- if some aspect of this key or value
prevents it from being stored in this map.
java.lang.NullPointerException
- if this map does not permit null
keys or values, and the specified key or value is null.public void putAll(java.util.Map<java.lang.Object,OMGraphic> map)
put(k, v)
on this map once for each
mapping from key k to value v in the specified map. The
behavior of this operation is unspecified if the specified map is
modified while the operation is in progress.
map
- Mappings to be stored in this map.
java.lang.UnsupportedOperationException
- if the putAll method is
not supported by this map.
java.lang.ClassCastException
- if the class of a key or value in the
specified map prevents it from being stored in this map.
java.lang.IllegalArgumentException
- some aspect of a key or value in the
specified map prevents it from being stored in this map.
java.lang.NullPointerException
- if the specified map is null, or if
this map does not permit null keys or values, and the
specified map contains null keys or values.public boolean remove(java.lang.Object key)
(key==null ? k==null : key.equals(k))
, that mapping is
removed. (The map can contain at most one such mapping.)
Returns the value to which the map previously associated the key, or null if the map contained no mapping for this key. (A null return can also indicate that the map previously associated null with the specified key if the implementation supports null values.) The map will not contain a mapping for the specified key once the call returns.
remove
in interface java.util.Collection<OMGraphic>
remove
in interface java.util.List<OMGraphic>
remove
in class OMList<OMGraphic>
key
- key whose mapping is to be removed from the map.
java.lang.ClassCastException
- if the key is of an inappropriate type for
this map (optional).
java.lang.NullPointerException
- if the key is null and this map
does not permit null keys (optional).
java.lang.UnsupportedOperationException
- if the remove method is
not supported by this map.public java.util.Collection<OMGraphic> values()
public java.lang.Object clone()
OMGraphicAdapter
clone
in interface OMGraphic
clone
in class OMGraphicList
public boolean add(OMGraphic g)
For OMGraphicHash this method will throw an
IllegalArgumentException
because adding a graphic must be
done through put(key,value)
.
add
in interface java.util.Collection<OMGraphic>
add
in interface java.util.List<OMGraphic>
add
in class OMGraphicList
public OMGraphic remove(int location)
For OMGraphicHash this method will throw an
IllegalArgumentException
because removing a graphic must be
done through remove(key)
.
remove
in interface java.util.List<OMGraphic>
remove
in class OMGraphicList
location
- the location of the OMGraphic to remove.public boolean remove(OMGraphic graphic)
For OMGraphicHash this method will throw an
IllegalArgumentException
because removing a graphic must be
done through remove(key)
.
graphic
- the OMGraphic object to remove.
public void clear()
clear
in interface java.util.Collection<OMGraphic>
clear
in interface java.util.List<OMGraphic>
clear
in class OMList<OMGraphic>
public void restore(OMGeometry source)
OMList
restore
in interface OMGeometry
restore
in class OMList<OMGraphic>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |