public class AttributeMap
extends java.util.Hashtable
implements java.lang.Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
AttributeMap.SerializablePoint2D |
static class |
AttributeMap.SerializableRectangle2D |
Modifier and Type | Field and Description |
---|---|
static AttributeMap |
emptyAttributeMap
Shared empty attribute map to return instead of null in applyMap.
|
Constructor and Description |
---|
AttributeMap()
Creates a new attribute map with an initial capacity of 8.
|
AttributeMap(int initialCapacity)
Creates a new attribute map with the specified initial capacity
|
AttributeMap(int initialCapacity,
float loadCapacity)
Constructs a new, empty hashtable with the specified initial capacity and
the specified load factor.
|
AttributeMap(java.util.Map map)
Constructs a new AttributeMap with the same mappings as the given Map.
|
Modifier and Type | Method and Description |
---|---|
AttributeMap |
applyMap(java.util.Map change)
Apply the
change to this views attributes. |
java.lang.Object |
applyValue(java.lang.Object key,
java.lang.Object value)
Apply the
key to value |
java.lang.Object |
clone()
Returns a clone of
map , from keys to values. |
AttributeMap |
cloneEntries(AttributeMap newMap)
Clones special object entried in the given map.
|
java.util.List |
clonePoints(java.util.List points)
Returns a list where all instances of PortView are replaced by their
correspnding Point instance.
|
java.util.List |
clonePoints(java.lang.Object[] points,
boolean convertPortViews)
Returns a list where all instances of PortView are replaced by their
correspnding Point instance.
|
java.awt.geom.Point2D[] |
clonePoints(java.awt.geom.Point2D[] points)
Returns a list where all instances of PortView are replaced by their
correspnding Point instance.
|
java.awt.geom.Point2D |
createPoint()
Creates a point of suitable type for this attribute map
|
java.awt.geom.Point2D |
createPoint(double x,
double y)
Creates a point of suitable type for this attribute map with the same
values as those passed in
|
java.awt.geom.Point2D |
createPoint(java.awt.geom.Point2D p)
Creates a point of suitable type for this attribute map with the same
values as the point passed in
|
java.awt.geom.Rectangle2D |
createRect()
Creates a rectangle of suitable type for this attribute map
|
java.awt.geom.Rectangle2D |
createRect(double x,
double y,
double w,
double h)
Creates a rectangle of suitable type for this attribute map with the same
values as those passed in
|
java.awt.geom.Rectangle2D |
createRect(double x,
double y,
double w,
double h,
double grow1,
double grow2)
Creates a rectangle of suitable type for this attribute map
|
java.awt.geom.Rectangle2D |
createRect(java.awt.geom.Point2D pt)
Creates a rectangle of suitable type for this attribute map at the
position of the point passed in
|
java.awt.geom.Rectangle2D |
createRect(java.awt.geom.Point2D pt,
double size)
Creates a rectangle of suitable type for this attribute map at the
position of the point passed in with lengths
size |
java.awt.geom.Rectangle2D |
createRect(java.awt.geom.Rectangle2D rect)
Clones the rectangle passed in
|
java.awt.geom.Rectangle2D |
createRect(java.awt.geom.Rectangle2D rect,
double grow1,
double grow2)
Creates a clone of the rectangle passed in and manipulates it by
grow1 and grow2 |
java.util.Map |
diff(java.util.Map newState)
Returns a new map that contains all (key, value)-pairs of
newState where either key is not used or value is
different for key in oldState . |
void |
scale(double sx,
double sy,
java.awt.geom.Point2D origin)
Scales
map by the given amount. |
static void |
translate(java.util.Collection c,
double dx,
double dy)
Translates the maps in
c using
translate(Map, int, int) . |
void |
translate(double dx,
double dy)
Translates
map by the given amount. |
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, values
public static transient AttributeMap emptyAttributeMap
public AttributeMap()
public AttributeMap(int initialCapacity)
initialCapacity
- the initial capacity of the new mappublic AttributeMap(int initialCapacity, float loadCapacity)
initialCapacity
- the initial capacity of the hashtable.loadCapacity
- the load factor of the hashtable.public AttributeMap(java.util.Map map)
map
- the input map to copypublic java.awt.geom.Point2D createPoint()
public java.awt.geom.Point2D createPoint(java.awt.geom.Point2D p)
p
- the point whose values the new point are to be based onpublic java.awt.geom.Point2D createPoint(double x, double y)
x
- the x-coordinate position of the new pointy
- the y-coordinate position of the new pointpublic java.awt.geom.Rectangle2D createRect()
public java.awt.geom.Rectangle2D createRect(double x, double y, double w, double h)
x
- the x-coordinate position of the new rectangley
- the y-coordinate position of the new rectanglew
- the width of the new rectangleh
- the height of the new rectanglepublic java.awt.geom.Rectangle2D createRect(java.awt.geom.Point2D pt)
pt
- the position of the new rectanglepublic java.awt.geom.Rectangle2D createRect(java.awt.geom.Point2D pt, double size)
size
pt
- the position of the new rectanglesize
- the length of both sides of the rectanglepublic java.awt.geom.Rectangle2D createRect(java.awt.geom.Rectangle2D rect)
rect
- the rectangle to clonepublic java.awt.geom.Rectangle2D createRect(double x, double y, double w, double h, double grow1, double grow2)
x
- the x-coordinate position of the new rectangley
- the y-coordinate position of the new rectanglew
- the width of the new rectangleh
- the height of the new rectanglegrow1
- the amount both dimensions are to be increased by and the
position coorindates of the rectangle are to be decreased bygrow2
- the additional amount by which both dimensions are to be
increased bypublic java.awt.geom.Rectangle2D createRect(java.awt.geom.Rectangle2D rect, double grow1, double grow2)
grow1
and grow2
grow1
- the amount both dimensions are to be increased by and the
position coorindates of the rectangle are to be decreased bygrow2
- the additional amount by which both dimensions are to be
increased bypublic AttributeMap applyMap(java.util.Map change)
change
to this views attributes.
change
must be a Map
previously obtained
from this object.change
- the change to applypublic java.lang.Object applyValue(java.lang.Object key, java.lang.Object value)
key
to value
key
- the map key whose value is to be alteredvalue
- the new value to be applied to the specified keypublic java.awt.geom.Point2D[] clonePoints(java.awt.geom.Point2D[] points)
points
- the points to be clonedpublic java.util.List clonePoints(java.util.List points)
points
- the points to be clonedpublic java.util.List clonePoints(java.lang.Object[] points, boolean convertPortViews)
public static void translate(java.util.Collection c, double dx, double dy)
c
using
translate(Map, int, int)
.public void translate(double dx, double dy)
map
by the given amount.public void scale(double sx, double sy, java.awt.geom.Point2D origin)
map
by the given amount.public java.util.Map diff(java.util.Map newState)
newState
where either key is not used or value is
different for key in oldState
. In other words, this
method removes the common entries from oldState and newState, and returns
the "difference" between the two.
This method never returns null.public java.lang.Object clone()
map
, from keys to values. If the map
contains bounds or points, these are cloned as well. References to
PortViews
are replaces by points. clone
in class java.util.Hashtable
public AttributeMap cloneEntries(AttributeMap newMap)
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.