maspack.geometry
Class Rectangle
java.lang.Object
maspack.geometry.Rectangle
- All Implemented Interfaces:
- Scannable
public class Rectangle
- extends java.lang.Object
- implements Scannable
Method Summary |
boolean |
equals(java.lang.Object obj)
|
double |
getHeight()
|
double |
getWidth()
|
double |
getX()
|
double |
getY()
|
boolean |
isWritable()
Returns true if this component should in fact be written to
secondary storage. |
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer. |
void |
scan(java.lang.String str)
|
void |
set(double x,
double y,
double width,
double height)
|
void |
set(Rectangle r)
|
java.lang.String |
toString()
|
java.lang.String |
toString(NumberFormat fmt)
|
void |
translate(double dx,
double dy)
|
void |
write(java.io.PrintWriter pw,
NumberFormat fmt,
java.lang.Object ref)
Writes a text description of this element to a PrintWriter. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
x
public double x
y
public double y
width
public double width
height
public double height
Rectangle
public Rectangle()
Rectangle
public Rectangle(Rectangle rect)
Rectangle
public Rectangle(double x,
double y,
double width,
double height)
set
public void set(Rectangle r)
translate
public void translate(double dx,
double dy)
set
public void set(double x,
double y,
double width,
double height)
getX
public double getX()
getY
public double getY()
getWidth
public double getWidth()
getHeight
public double getHeight()
scan
public void scan(java.lang.String str)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
isWritable
public boolean isWritable()
- Description copied from interface:
Scannable
- Returns
true
if this component should in fact be written to
secondary storage. This gives subclasses control over whether or
not they are actually written out.
- Specified by:
isWritable
in interface Scannable
- Returns:
true
if this component should be written to
secondary storage.
write
public void write(java.io.PrintWriter pw,
NumberFormat fmt,
java.lang.Object ref)
throws java.io.IOException
- Description copied from interface:
Scannable
- Writes a text description of this element to a PrintWriter. The text
description should be compatable with
scan
and complete
enough to allow full reconstruction of the element.
- Specified by:
write
in interface Scannable
- Parameters:
pw
- stream for writing the elementfmt
- numeric formating informationref
- optional reference object which can be used for producing references to
other objects
- Throws:
java.io.IOException
- if an I/O error occured
scan
public void scan(ReaderTokenizer rtok,
java.lang.Object ref)
throws java.io.IOException
- Description copied from interface:
Scannable
- Scans this element from a ReaderTokenizer. The expected text format is
assumed to be compatible with that produced by
write
.
- Specified by:
scan
in interface Scannable
- Parameters:
rtok
- Tokenizer from which to scan the elementref
- optional reference object which can be used for resolving references to
other objects
- Throws:
java.io.IOException
- if an I/O or formatting error occured
toString
public java.lang.String toString(NumberFormat fmt)
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object