objects
Class EuRadius

java.lang.Object
  |
  +--objects.EuObject
        |
        +--objects.EuRadius
All Implemented Interfaces:
java.lang.Cloneable

public class EuRadius
extends EuObject

An instance of this class represents a radius, i.e. a nonnegative integer which can be used to form circles.


Field Summary
 fundamentals.EuReal radius
          A floating point representation of the radius
 
Fields inherited from class objects.EuObject
infoHash, provenience, scaledown
 
Constructor Summary
EuRadius()
          Constructor for dummy object.
EuRadius(double r)
          The constructor checks that the radius is indeed a nonnegative integer.
EuRadius(objects.EuPoint p1, objects.EuPoint p2)
          The radius is instantiated as the distance between the two given points
EuRadius(fundamentals.mouseInfo info, java.util.Random croupier)
          Constructed randomly, via mouseInfo.
 
Method Summary
 fundamentals.EuVector atParameter(double t)
          Call has no meaning, return (1,0)
 boolean castIdentical(objects.EuObject other)
          Return true if passed object is a EuRadius with the same radius parameter.
 double closestParameter(double x, double y)
          Return zero as dummy value.
 boolean closureContains(fundamentals.EuVector point)
          Returns false as radii have no closure points.
protected  objects.plotCollection computeClip(fundamentals.mouseInfo info)
          Draw an oval with the radius centered at the top left corner.
 double confusionDistance(objects.EuObject other)
          Returns the distance from this object to another under these simplifications: The distance to lines or circles is in {0,POSITIVE_INFINITY} unless this is a point.
 double distance(fundamentals.EuVector point)
          Return POSITIVE_INFINITY as dummy value.
 boolean interiorContains(fundamentals.EuVector point)
          Returns false as radii have no interior points.
 boolean isFull()
          Determine whether object is a subobject of another.
 boolean mouseVicinity(fundamentals.mouseVector mouseAt, fundamentals.mouseInfo info)
          Determine whether mouse position is close to displayed object
 double nameDisplacementAngle(fundamentals.mouseInfo info)
          Describe nameDisplacementAngle method here.
 fundamentals.EuVector nameLocation(fundamentals.mouseInfo info)
          Describe nameLocation method here.
 boolean overlaps(objects.EuObject other)
          Determine whether objects overlap.
 java.lang.String params()
          Generate a mathematical specification of parameters associated to the object
 void passArguments(fundamentals.EuArguments args)
          Read off parameters describing the object and add to passed EuArguments instance
 java.lang.String toNaturalLanguage(int language, boolean determined)
          Generate a description of the object in a natural language (Danish or English)
 java.lang.String toString()
          Generate a mathematical specification of the object
 char typeName()
          Return R for radius.
 
Methods inherited from class objects.EuObject
cloneObject, draw, equals, getClip, isVisible, mouseVicinity, toPs
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

radius

public fundamentals.EuReal radius
A floating point representation of the radius

Constructor Detail

EuRadius

public EuRadius(double r)
         throws DesignException,
                UserException
The constructor checks that the radius is indeed a nonnegative integer. A zero radius leads to a warning.

Parameters:
r - the radius
Throws:
DesignException - if an error occurs
UserException - if an error occurs

EuRadius

public EuRadius()
Constructor for dummy object.


EuRadius

public EuRadius(fundamentals.mouseInfo info,
                java.util.Random croupier)
         throws UserException
Constructed randomly, via mouseInfo. No error possibilities.

Parameters:
info - the mouseinfo, used in deciding what range to draw random anchor point from
croupier - the random number generator to use
Throws:
UserException - if an error occurs

EuRadius

public EuRadius(objects.EuPoint p1,
                objects.EuPoint p2)
         throws UserException
The radius is instantiated as the distance between the two given points

Parameters:
p1 - an EuPoint value
p2 - an EuPoint value
Throws:
UserException - if an error occurs
Method Detail

atParameter

public fundamentals.EuVector atParameter(double t)
Call has no meaning, return (1,0)

Parameters:
t - ignored
Returns:
null vector

computeClip

protected objects.plotCollection computeClip(fundamentals.mouseInfo info)
                                      throws UserException,
                                             DesignException
Draw an oval with the radius centered at the top left corner.

Specified by:
computeClip in class EuObject
Parameters:
info - information used in scaling and positioning the object
Returns:
a plotCollection value
Throws:
UserException - if an error occurs
DesignException - if an error occurs

mouseVicinity

public boolean mouseVicinity(fundamentals.mouseVector mouseAt,
                             fundamentals.mouseInfo info)
Determine whether mouse position is close to displayed object

Overrides:
mouseVicinity in class EuObject
Parameters:
mouseAt - The coordinates of the mouse position
info - information used in locating the object on screen
Returns:
true if mouse is close

castIdentical

public boolean castIdentical(objects.EuObject other)
Return true if passed object is a EuRadius with the same radius parameter.

Specified by:
castIdentical in class EuObject
Parameters:
other - the object being compared to the present one
Returns:
true if passed object is a EuRadius with the same radius parameter.

interiorContains

public boolean interiorContains(fundamentals.EuVector point)
Returns false as radii have no interior points.

Specified by:
interiorContains in class EuObject
Parameters:
point - an EuVector value
Returns:
false

closureContains

public boolean closureContains(fundamentals.EuVector point)
Returns false as radii have no closure points.

Specified by:
closureContains in class EuObject
Parameters:
point - an EuVector value
Returns:
false

overlaps

public boolean overlaps(objects.EuObject other)
Determine whether objects overlap. Radii are said to overlap with other radii, but not with other objects.

Specified by:
overlaps in class EuObject
Parameters:
other - the object being compared to the present one
Returns:
true if passed object is a EuRadius

closestParameter

public double closestParameter(double x,
                               double y)
Return zero as dummy value.

Parameters:
x - the first coordinate of the point
y - the second coordinate of the point
Returns:
zero

distance

public double distance(fundamentals.EuVector point)
Return POSITIVE_INFINITY as dummy value.

Specified by:
distance in class EuObject
Parameters:
point - the point
Returns:
Double.POSITIVE_INFINITY

confusionDistance

public double confusionDistance(objects.EuObject other)
Returns the distance from this object to another under these simplifications: The distance to lines or circles is in {0,POSITIVE_INFINITY} unless this is a point. The distance to radii is POSITIVE_INFINITY unless this is a radius The distance to points is POSITIVE_INFINITY if this is a radius

Specified by:
confusionDistance in class EuObject
Parameters:
other - an EuObject value
Returns:
the parameter or zero

typeName

public char typeName()
Return R for radius.

Specified by:
typeName in class EuObject
Returns:
R

isFull

public boolean isFull()
Determine whether object is a subobject of another.

Specified by:
isFull in class EuObject
Returns:
true since the item is of subtype A_RADIUS, A_POINT, A_LINE, A_CIRCLE

params

public java.lang.String params()
Generate a mathematical specification of parameters associated to the object

Overrides:
params in class EuObject
Returns:
A mathematical specification of parameters associated to the object

toString

public java.lang.String toString()
Generate a mathematical specification of the object

Specified by:
toString in class EuObject
Returns:
A mathematical specification of the object

passArguments

public void passArguments(fundamentals.EuArguments args)
Read off parameters describing the object and add to passed EuArguments instance

Specified by:
passArguments in class EuObject
Parameters:
args - an EuArguments value

toNaturalLanguage

public java.lang.String toNaturalLanguage(int language,
                                          boolean determined)
Generate a description of the object in a natural language (Danish or English)

Specified by:
toNaturalLanguage in class EuObject
Parameters:
language - Globals.DANISH or Globals.ENGLISH
determined - true for a determined noun (the ..., ...en/..et)
Returns:
a String value

nameLocation

public fundamentals.EuVector nameLocation(fundamentals.mouseInfo info)
Describe nameLocation method here. LATER!

Specified by:
nameLocation in class EuObject
Parameters:
info - a mouseInfo value
Returns:
an EuVector value

nameDisplacementAngle

public double nameDisplacementAngle(fundamentals.mouseInfo info)
Describe nameDisplacementAngle method here.

Specified by:
nameDisplacementAngle in class EuObject
Parameters:
info - a mouseInfo value
Returns:
a double value