Search this API

y.util
Class DefaultMutableValue2D

java.lang.Object
  extended by y.util.DefaultMutableValue2D
All Implemented Interfaces:
MutableValue2D, Value2D, Value2DSettable

public class DefaultMutableValue2D
extends java.lang.Object
implements MutableValue2D

General purpose value object that obeys the Value2D and Value2DSettable contracts.

 
Your browser does not support SVG content.

Constructor Summary
protected DefaultMutableValue2D(double x, double y)
          Creates a new DefaultMutableValue2D for the specified data.
 
Method Summary
static DefaultMutableValue2D create()
          Creates a new DefaultMutableValue2D with x and y both equal to 0.
static DefaultMutableValue2D create(double[] coordinates)
          Creates a new DefaultMutableValue2D for the specified array data.
static DefaultMutableValue2D create(double x, double y)
          Creates a new DefaultMutableValue2D for the specified data.
static DefaultMutableValue2D create(java.awt.geom.Point2D prototype)
          Creates a new DefaultMutableValue2D whose x and y data correspond to the specified Point2D's x and y coordinates.
static DefaultMutableValue2D create(YPoint prototype)
          Creates a new DefaultMutableValue2D whose x and y data correspond to the specified YPoint's x and y coordinates.
static Value2D createView(java.awt.geom.Point2D point)
          Creates a read-only view of the specified Point2D.
static Value2D createView(YPoint point)
          Creates a read-only view of the specified YPoint.
 double getX()
          Returns the value object's x data.
 double getY()
          Returns the value object's y data.
 void setX(double x)
          Specifies the value object's x data.
 void setY(double y)
          Specifies the value object's y data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMutableValue2D

protected DefaultMutableValue2D(double x,
                                double y)
Creates a new DefaultMutableValue2D for the specified data.

Parameters:
x - the x data
y - the y data
Method Detail

getX

public double getX()
Returns the value object's x data.

Specified by:
getX in interface Value2D
Returns:
the value object's x data.

setX

public void setX(double x)
Specifies the value object's x data.

Specified by:
setX in interface Value2DSettable
Parameters:
x - the x data

getY

public double getY()
Returns the value object's y data.

Specified by:
getY in interface Value2D
Returns:
the value object's y data.

setY

public void setY(double y)
Specifies the value object's y data.

Specified by:
setY in interface Value2DSettable
Parameters:
y - the y data

create

public static DefaultMutableValue2D create(double x,
                                           double y)
Creates a new DefaultMutableValue2D for the specified data.

Parameters:
x - the x data
y - the y data
Returns:
a new DefaultMutableValue2D for the specified data.

create

public static DefaultMutableValue2D create(double[] coordinates)
Creates a new DefaultMutableValue2D for the specified array data. The specified array's length must be at least 2. Its first element is interpreted as x data, Its second element is interpreted as y data.

Parameters:
coordinates - an array holding at least two elements
Returns:
a new DefaultMutableValue2D for the specified data.

create

public static DefaultMutableValue2D create(YPoint prototype)
Creates a new DefaultMutableValue2D whose x and y data correspond to the specified YPoint's x and y coordinates.

Parameters:
prototype - the YPoint
Returns:
a new DefaultMutableValue2D whose x and y data correspond to the specified YPoint's x and y coordinates.

create

public static DefaultMutableValue2D create(java.awt.geom.Point2D prototype)
Creates a new DefaultMutableValue2D whose x and y data correspond to the specified Point2D's x and y coordinates.

Parameters:
prototype - the Point2D
Returns:
a new DefaultMutableValue2D whose x and y data correspond to the specified Point2D's x and y coordinates.

create

public static DefaultMutableValue2D create()
Creates a new DefaultMutableValue2D with x and y both equal to 0.

Returns:
a new DefaultMutableValue2D with x and y both equal to 0.

createView

public static Value2D createView(java.awt.geom.Point2D point)
Creates a read-only view of the specified Point2D.

Returns:
a read-only view of the specified Point2D.

createView

public static Value2D createView(YPoint point)
Creates a read-only view of the specified YPoint.

Returns:
a read-only view of the specified YPoint.

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.