Package com.inductiveautomation.rm.base
Class RMSize
- java.lang.Object
-
- com.inductiveautomation.rm.base.RMListenerList
-
- com.inductiveautomation.rm.base.RMObject
-
- com.inductiveautomation.rm.base.RMSize
-
- All Implemented Interfaces:
RMPropertyChanger
,java.lang.Cloneable
public class RMSize extends RMObject
This class represents a simple geometric size (width, height).
-
-
Constructor Summary
Constructors Constructor Description RMSize()
Creates a size initialized to 0,0.RMSize(double w, double h)
Creates a size initialized to the given width and height.RMSize(RMSize aSize)
Creates a size initialized to the given size.RMSize(java.awt.Dimension d)
Creates a size from a java2D dimensionRMSize(java.lang.String aString)
Creates a size from a string (assumes comma separated).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RMSize
abs()
Normalizes the receiver to positive values.boolean
equals(double w, double h)
Returns whether size is equal to given width and height.boolean
equals(java.lang.Object anObj)
Standard equals implementation.double
magnitude()
Returns the square root of the sum of the squares of the width and height.void
negate()
Simply sets the width and height to their negatives.RMSize
normalize()
Normalizes the receiver by scaling its width and height such that its magnitude will be 1.java.lang.String
toString()
Returns a string representation of size.-
Methods inherited from class com.inductiveautomation.rm.base.RMObject
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange
-
Methods inherited from class com.inductiveautomation.rm.base.RMListenerList
addListener, clone, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
-
-
-
-
Constructor Detail
-
RMSize
public RMSize()
Creates a size initialized to 0,0.
-
RMSize
public RMSize(double w, double h)
Creates a size initialized to the given width and height.
-
RMSize
public RMSize(RMSize aSize)
Creates a size initialized to the given size.
-
RMSize
public RMSize(java.awt.Dimension d)
Creates a size from a java2D dimension
-
RMSize
public RMSize(java.lang.String aString)
Creates a size from a string (assumes comma separated).
-
-
Method Detail
-
abs
public RMSize abs()
Normalizes the receiver to positive values.
-
magnitude
public double magnitude()
Returns the square root of the sum of the squares of the width and height.
-
normalize
public RMSize normalize()
Normalizes the receiver by scaling its width and height such that its magnitude will be 1.
-
negate
public void negate()
Simply sets the width and height to their negatives.
-
equals
public boolean equals(java.lang.Object anObj)
Standard equals implementation.- Overrides:
equals
in classjava.lang.Object
-
equals
public boolean equals(double w, double h)
Returns whether size is equal to given width and height.
-
-