Class CoordinateAttribute

All Implemented Interfaces:
Comparable<Object>, Attribute, CollectionAttribute, DeepCopy, GraphicAttributeConstants, Displayable

public class CoordinateAttribute
extends HashMapAttribute
implements GraphicAttributeConstants
Contains the coordinate graphic attribute.
Version:
$Revision: 1.9 $
Author:
breu
  • Constructor Details

    • CoordinateAttribute

      public CoordinateAttribute​(String id)
      Constructor for Coordinate that sets the coordinates to a random number.
      Parameters:
      id - the id of the attribute.
    • CoordinateAttribute

      public CoordinateAttribute​(String id, Point2D c)
      Constructor for Coordinate.
      Parameters:
      id - the id of the attribute.
      c - the coordinate-value of the attriubte.
    • CoordinateAttribute

      public CoordinateAttribute​(String id, double x, double y)
      Constructor for Coordinate.
      Parameters:
      id - the id of the attribute.
      x - the x-value of the attribute.
      y - the y-value of the attribute.
  • Method Details

    • setCollection

      public void setCollection​(Map<String,​Attribute> attrs)
      Sets the collection of attributes contained within this CollectionAttribute. The coordinate values are set, additional values are simply added (that means that if there exists already a subattribute with the same id, an exception will be thrown).
      Specified by:
      setCollection in interface CollectionAttribute
      Overrides:
      setCollection in class HashMapAttribute
      Parameters:
      attrs - the map that contains all attributes.
      Throws:
      IllegalArgumentException - DOCUMENT ME!
    • setCoordinate

      public void setCoordinate​(Point2D p)
      Sets the x and y values of this coordinate to the given points' values.
      Parameters:
      p - Point2D to which this coordinate should be set.
    • setCoordinate

      public void setCoordinate​(double x, double y)
    • getCoordinate

      public Point2D getCoordinate()
      Returns the encapsulated coordinate.
      Returns:
      the encapsulated coordinate.
    • setX

      public void setX​(double x)
      Sets the 'x1'-value.
      Parameters:
      x - the 'x1'-value to be set.
    • getX

      public double getX()
      Returns the 'x'-value of the encapsulated coordinate.
      Returns:
      the 'x'-value of the encapsulated coordinate.
    • setY

      public void setY​(double y)
      Sets the 'x2'-value.
      Parameters:
      y - the 'x2'-value to be set.
    • getY

      public double getY()
      Returns the 'y'-value of the encapsulated coordinate.
      Returns:
      the 'y'-value of the encapsulated coordinate.
    • copy

      public Object copy()
      Returns a deep copy of this object.
      Specified by:
      copy in interface DeepCopy
      Overrides:
      copy in class HashMapAttribute
      Returns:
      A deep copy of this object.