dk.vajhoej.model.core
Class Location

java.lang.Object
  extended by dk.vajhoej.model.core.Location
All Implemented Interfaces:
Persistable, java.io.Serializable, java.lang.Cloneable

public class Location
extends java.lang.Object
implements Persistable, java.lang.Cloneable, java.io.Serializable

Class Location represents a visual location.

See Also:
Serialized Form

Constructor Summary
Location()
          Create instance of location.
Location(int x, int y, java.lang.String clazz, java.lang.String id)
          Create instance of location.
Location(int x, int y, java.lang.String clazz, java.lang.String id, int angle)
          Create instance of location.
Location(int x, int y, java.lang.String clazz, java.lang.String id, int angle, double hor, double ver)
          Create instance of location.
 
Method Summary
 Location clone()
           
 boolean equals(java.lang.Object o)
           
 int getAngle()
          Get rotation angle.
 NameValuePairList getAttributes()
          Get all single value fields.
 java.util.List<java.util.List<Persistable>> getChildren()
          Get all multi value fields.
 java.lang.String getClazz()
          Get Java class name.
 double getHor()
          Get relative horizontal move.
 java.lang.String getId()
          Get object id.
 java.lang.String getName()
           
 java.lang.String getType()
          Get type (XML element name / database table name not Java class name).
 double getVer()
          Get relative vertical move.
 int getX()
          Get x coordinate.
 int getY()
          Get y coordinate.
 int hashCode()
           
 void move(int dx, int dy)
          Move locations.
 void setAttributes(NameValuePairList attr)
          Set all single value fields.
 void setChildren(java.util.List<java.util.List<Persistable>> childs)
          Set all multi value fields.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Location

public Location()
Create instance of location.


Location

public Location(int x,
                int y,
                java.lang.String clazz,
                java.lang.String id)
Create instance of location.

Parameters:
x - x coordinate
y - y coordinate
clazz - Java class name
id - object id

Location

public Location(int x,
                int y,
                java.lang.String clazz,
                java.lang.String id,
                int angle)
Create instance of location.

Parameters:
x - x coordinate
y - y coordinate
clazz - Java class name
angle - rotation angle

Location

public Location(int x,
                int y,
                java.lang.String clazz,
                java.lang.String id,
                int angle,
                double hor,
                double ver)
Create instance of location.

Parameters:
x - x coordinate
y - y coordinate
clazz - Java class name
angle - rotation angle
hor - relative horizontal move
ver - relative vertical move
Method Detail

getX

public int getX()
Get x coordinate.

Returns:
x coordinate

getY

public int getY()
Get y coordinate.

Returns:
y coordinate

getClazz

public java.lang.String getClazz()
Get Java class name.

Returns:
Java class name

getId

public java.lang.String getId()
Get object id.

Specified by:
getId in interface Persistable
Returns:
object id

getAngle

public int getAngle()
Get rotation angle.

Returns:
rotation angle

getHor

public double getHor()
Get relative horizontal move.

Returns:
horizontal move

getVer

public double getVer()
Get relative vertical move.

Returns:
vertical move

move

public void move(int dx,
                 int dy)
Move locations.

Parameters:
dx - delta x
dy - delta y

clone

public Location clone()
Overrides:
clone in class java.lang.Object

getName

public java.lang.String getName()

getType

public java.lang.String getType()
Description copied from interface: Persistable
Get type (XML element name / database table name not Java class name).

Specified by:
getType in interface Persistable
Returns:
type

getAttributes

public NameValuePairList getAttributes()
Description copied from interface: Persistable
Get all single value fields.

Specified by:
getAttributes in interface Persistable
Returns:
name value pair list

getChildren

public java.util.List<java.util.List<Persistable>> getChildren()
Description copied from interface: Persistable
Get all multi value fields.

Specified by:
getChildren in interface Persistable
Returns:
list of list of persistable objects

setAttributes

public void setAttributes(NameValuePairList attr)
                   throws ModelException
Description copied from interface: Persistable
Set all single value fields.

Specified by:
setAttributes in interface Persistable
Parameters:
attr - value pair list
Throws:
ModelException - if problems

setChildren

public void setChildren(java.util.List<java.util.List<Persistable>> childs)
                 throws ModelException
Description copied from interface: Persistable
Set all multi value fields.

Specified by:
setChildren in interface Persistable
Parameters:
childs - list of list of persistable objects
Throws:
ModelException - if problems

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object