generator2
Class ExternalObject

java.lang.Object
  |
  +--generator2.ExternalObject
All Implemented Interfaces:
LayerSpatialSearchTreeObject, SpatialSearchTreeEntry, SpatialSearchTreeObject

public class ExternalObject
extends java.lang.Object
implements LayerSpatialSearchTreeObject

Class representing an external object.


Constructor Summary
ExternalObject(int id, int time, int lifetime, int objClass, int x, int y, int width, int height)
          Constructor.
 
Method Summary
 void addToContainer(ExternalObjects container)
          Adds the object to a container.
 double computeDistanceTo(int[] p)
          Computes the distance to a given point.
 boolean contains(MBR rect)
          Tests whether the object contains a given rectangle or not.
 void draw(java.awt.Graphics g, int scale)
          Draws the MBR of the object if it is exists at the actual time.
 long getId()
          Returns the identifier of the external object.
 int getLayer()
          Returns the layer of the object.
 MBR getMBR()
          Returns the area.
 int getNumOfDimensions()
          Returns the number of dimensions.
 int getObjectClass()
          Returns the object class of the object.
 java.lang.Object getType()
          Returns the class of the object as Integer.
 boolean interacts(int x, int y, int scale)
          Tests whether an object is selected by a point or not.
 boolean intersects(MBR r)
          Tests whether the object intersects a given rectangle.
 boolean intersects(java.lang.Object obj)
          Tests whether the object intersects another object.
 boolean isAlive(int currTime)
          Returns whether the object is alive or not.
 boolean isContainedBy(MBR rect)
          Tests whether the object is contained by a given rectangle or not.
 boolean isContainedBy(SpatialSearchTreeEntry entry)
          Tests whether the object is contained by a given entry or not.
 boolean isOfSameType(SpatialSearchTreeObject obj)
          Tests whether the object is of the same type as the given object or not.
 boolean isVisible(double scale)
          Test whether the external object is visible or not.
 boolean isVisible(int scale)
          Tests whether the object is visible at a given scale or not.
 void reportDeletedObject(Reporter reporter, int currTime)
          Reports a deleted external object.
 void reportMovingObject(Reporter reporter, int currTime)
          Reports a moving external object.
 void reportNewObject(Reporter reporter)
          Reports a new external object.
 void setMBR(MBR newMBR)
          Sets the MBR of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalObject

public ExternalObject(int id,
                      int time,
                      int lifetime,
                      int objClass,
                      int x,
                      int y,
                      int width,
                      int height)
Constructor.

Parameters:
id - the identifier
time - current time
lifetime - lifetime
objClass - id of the object class
x - x-coordinate
y - y-coordinate
width - width
height - height
Method Detail

addToContainer

public void addToContainer(ExternalObjects container)
Adds the object to a container.

Parameters:
container - the container

computeDistanceTo

public double computeDistanceTo(int[] p)
Computes the distance to a given point.

Specified by:
computeDistanceTo in interface SpatialSearchTreeObject
Parameters:
p - coordinates of the point
Returns:
distance

contains

public boolean contains(MBR rect)
Tests whether the object contains a given rectangle or not.

Specified by:
contains in interface SpatialSearchTreeObject
Parameters:
rect - the rectangle
Returns:
contains?

draw

public void draw(java.awt.Graphics g,
                 int scale)
Draws the MBR of the object if it is exists at the actual time.

Specified by:
draw in interface SpatialSearchTreeObject
Parameters:
g - graphic context
scale - actual scale

getId

public long getId()
Returns the identifier of the external object.

Specified by:
getId in interface SpatialSearchTreeObject
Returns:
the id

getLayer

public int getLayer()
Returns the layer of the object.

Specified by:
getLayer in interface LayerSpatialSearchTreeObject
Returns:
the layer

getMBR

public MBR getMBR()
Returns the area.

Specified by:
getMBR in interface SpatialSearchTreeEntry
Returns:
the area

getNumOfDimensions

public int getNumOfDimensions()
Returns the number of dimensions.

Specified by:
getNumOfDimensions in interface SpatialSearchTreeEntry
Returns:
dimensions

getObjectClass

public int getObjectClass()
Returns the object class of the object.

Returns:
id of the object class

getType

public java.lang.Object getType()
Returns the class of the object as Integer.

Returns:
class

interacts

public boolean interacts(int x,
                         int y,
                         int scale)
Tests whether an object is selected by a point or not.

Parameters:
x - x-coordinate of the point
y - y-coordinate of the point
scale - scale
Returns:
selected?

intersects

public boolean intersects(java.lang.Object obj)
Tests whether the object intersects another object.

Specified by:
intersects in interface SpatialSearchTreeObject
Parameters:
obj - the object
Returns:
intersects?

intersects

public boolean intersects(MBR r)
Tests whether the object intersects a given rectangle.

Specified by:
intersects in interface SpatialSearchTreeObject
Parameters:
r - the rectangle
Returns:
intersects?

isAlive

public boolean isAlive(int currTime)
Returns whether the object is alive or not.

Parameters:
currTime - the current time
Returns:
object alive?

isContainedBy

public boolean isContainedBy(MBR rect)
Tests whether the object is contained by a given rectangle or not.

Specified by:
isContainedBy in interface SpatialSearchTreeObject
Parameters:
rect - the rectangle
Returns:
is contained?

isContainedBy

public boolean isContainedBy(SpatialSearchTreeEntry entry)
Tests whether the object is contained by a given entry or not.

Specified by:
isContainedBy in interface SpatialSearchTreeObject
Parameters:
entry - the entry
Returns:
is contained?

isOfSameType

public boolean isOfSameType(SpatialSearchTreeObject obj)
Tests whether the object is of the same type as the given object or not.

Specified by:
isOfSameType in interface SpatialSearchTreeObject
Parameters:
obj - the other object
Returns:
is of same type?

isVisible

public boolean isVisible(double scale)
Test whether the external object is visible or not.

Parameters:
scale - the current actual scale (negative value => returns true)
Returns:
is visible?

isVisible

public boolean isVisible(int scale)
Tests whether the object is visible at a given scale or not.

Parameters:
scale - scale
Returns:
visible?

reportDeletedObject

public void reportDeletedObject(Reporter reporter,
                                int currTime)
Reports a deleted external object.

Parameters:
reporter - the reporter
currTime - the current time

reportMovingObject

public void reportMovingObject(Reporter reporter,
                               int currTime)
Reports a moving external object.

Parameters:
reporter - the reporter
currTime - the current time

reportNewObject

public void reportNewObject(Reporter reporter)
Reports a new external object.

Parameters:
reporter - the reporter

setMBR

public void setMBR(MBR newMBR)
Sets the MBR of the object.

Parameters:
newMBR - the new MNR