viper.descriptors.attributes
Class Attribute_obox.Obox

java.lang.Object
  extended byviper.descriptors.attributes.Attribute_polygon.AbstractPolygonValue
      extended byviper.descriptors.attributes.Attribute_obox.Obox
All Implemented Interfaces:
AttributeValue, BoxInformation, java.lang.Cloneable, Composable, Measurable
Enclosing class:
Attribute_obox

protected static class Attribute_obox.Obox
extends viper.descriptors.attributes.Attribute_polygon.AbstractPolygonValue
implements BoxInformation


Nested Class Summary
 
Nested classes inherited from class viper.descriptors.attributes.Measurable
Measurable.Difference
 
Field Summary
protected  PolyList value
           
 
Fields inherited from interface viper.descriptors.attributes.Composable
ORDERED, UNORDERED
 
Constructor Summary
protected Attribute_obox.Obox()
           
 
Method Summary
 java.lang.Object clone()
           
 Composable compose(Composable partner)
          Generate the composition of this object with its partner.
 boolean contains(Pnt point)
          Tests to see if the specified point is within this rectangle
 boolean equals(java.lang.Object o)
           
 Pnt getCentroid()
          A rational approximation of the box's centroid.
 int getCompositionType()
          Get the type of composition to try.
 Measurable.Difference getDifference(Measurable beta, Measurable blackout, Measurable ignore, CanonicalFileDescriptor cfd)
          Not optimized version.
 Measurable.Difference getDifference(Measurable beta, Measurable blackout, Measurable ignore, CanonicalFileDescriptor cfd, Measurable.Difference old)
          For performance reasons, takes an optional (could be null) Measurable.Difference to replace the data from.
 int getHeight()
          Gets the height of the box.
 Pnt getNearIntersection(Pnt q1)
          Get the point of intersection between the ray from the centroid of this box through q1 that is closest to q1.
 int getRotation()
          Gets the number of degrees the box is rotated counterclockwise about its origin.
 java.lang.String getType()
          Gets the type name.
 int getWidth()
          Gets the width of the box.
 int getX()
          Gets the x-coordinate of the box's origin.
 int getY()
          Gets the y-coordinate of the box's origin.
 int hashCode()
           
 boolean isValidRule(java.lang.String ruleName)
          Tell if a name is a valid rule or not
 AttributeValue setValue(org.w3c.dom.Element el)
          Sets the state of the object to the data the xml-dom element represents.
 viper.descriptors.attributes.Attribute_polygon.AbstractPolygonValue setValue(PolyList newVal)
           
 AttributeValue setValue(java.lang.String S)
          Sets the state of the object to the data the String represents.
 java.lang.String toString()
           
 org.w3c.dom.Element toXML(org.w3c.dom.Document doc)
          Returns an xml element for this object, sans angle brackets, eg: svalue value="something", so that the Attribute manager can add a span value, and namespace prefix, if necessary.
 boolean validate(AttributeValue v)
          Checks to make sure that the value can be set.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected PolyList value
Constructor Detail

Attribute_obox.Obox

protected Attribute_obox.Obox()
Method Detail

clone

public java.lang.Object clone()
Specified by:
clone in interface BoxInformation

getType

public java.lang.String getType()
Description copied from interface: Measurable
Gets the type name.

Specified by:
getType in interface Measurable

validate

public boolean validate(AttributeValue v)
Description copied from class: viper.descriptors.attributes.Attribute_polygon.AbstractPolygonValue
Checks to make sure that the value can be set.

Specified by:
validate in interface AttributeValue
Parameters:
v - the value to check
Returns:
true iff the value is valid for this type

setValue

public AttributeValue setValue(org.w3c.dom.Element el)
Sets the state of the object to the data the xml-dom element represents.

Specified by:
setValue in interface AttributeValue
Parameters:
el - DOM Node to parse
Returns:
the parsed value
Throws:
java.lang.IllegalArgumentException - If the data is ill-formed

setValue

public AttributeValue setValue(java.lang.String S)
Sets the state of the object to the data the String represents. Useful for old GTF format Should be able to run setValue(toString()) and have it come out the same.

Specified by:
setValue in interface AttributeValue
Parameters:
S - String representation of this type of value.
Returns:
the parsed value
Throws:
java.lang.IllegalArgumentException - If the data is ill-formed

toXML

public org.w3c.dom.Element toXML(org.w3c.dom.Document doc)
Returns an xml element for this object, sans angle brackets, eg: svalue value="something", so that the Attribute manager can add a span value, and namespace prefix, if necessary.

Specified by:
toXML in interface AttributeValue
Parameters:
doc - the DOM Document to use while creating the element
Returns:
a DOM describing the attribute

contains

public boolean contains(Pnt point)
Description copied from interface: BoxInformation
Tests to see if the specified point is within this rectangle

Specified by:
contains in interface BoxInformation
Parameters:
point - the point to test
Returns:
true iff the point is within this rectangle

getCentroid

public Pnt getCentroid()
Description copied from interface: BoxInformation
A rational approximation of the box's centroid.

Specified by:
getCentroid in interface BoxInformation
Returns:
the center point of the box

getHeight

public int getHeight()
Description copied from interface: BoxInformation
Gets the height of the box.

Specified by:
getHeight in interface BoxInformation
Returns:
the height of the box.

getNearIntersection

public Pnt getNearIntersection(Pnt q1)
Description copied from interface: BoxInformation
Get the point of intersection between the ray from the centroid of this box through q1 that is closest to q1.

Specified by:
getNearIntersection in interface BoxInformation
Parameters:
q1 - A point that is not the centroid.
Returns:
A point on the perimeter of the box on the ray from the centroid through q1.

getRotation

public int getRotation()
Description copied from interface: BoxInformation
Gets the number of degrees the box is rotated counterclockwise about its origin.

Specified by:
getRotation in interface BoxInformation
Returns:
the rotation, in degrees.

getWidth

public int getWidth()
Description copied from interface: BoxInformation
Gets the width of the box.

Specified by:
getWidth in interface BoxInformation
Returns:
the width of the box.

getX

public int getX()
Description copied from interface: BoxInformation
Gets the x-coordinate of the box's origin.

Specified by:
getX in interface BoxInformation
Returns:
the x-coordinate of the box's origin.

getY

public int getY()
Description copied from interface: BoxInformation
Gets the y-coordinate of the box's origin.

Specified by:
getY in interface BoxInformation
Returns:
the y-coordinate of the box's origin.

setValue

public viper.descriptors.attributes.Attribute_polygon.AbstractPolygonValue setValue(PolyList newVal)

toString

public java.lang.String toString()

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()

getDifference

public Measurable.Difference getDifference(Measurable beta,
                                           Measurable blackout,
                                           Measurable ignore,
                                           CanonicalFileDescriptor cfd)
                                    throws IgnoredValueException
Description copied from interface: Measurable
Not optimized version. Usually will just call getDifference (..., null).

Specified by:
getDifference in interface Measurable
Parameters:
beta - the value to subtract/get the difference from
blackout - the bad region
ignore - the ignored region
cfd - the media's information
Returns:
the difference between this and beta, given the constraints
Throws:
IgnoredValueException - if this and beta are totally ignored
See Also:
Measurable.getDifference(Measurable, Measurable, Measurable, CanonicalFileDescriptor, Measurable.Difference)

getDifference

public Measurable.Difference getDifference(Measurable beta,
                                           Measurable blackout,
                                           Measurable ignore,
                                           CanonicalFileDescriptor cfd,
                                           Measurable.Difference old)
                                    throws IgnoredValueException
Description copied from interface: Measurable
For performance reasons, takes an optional (could be null) Measurable.Difference to replace the data from. Calling getDistance (alpha, beta, blackout, ignore) should have the same effect as getDistance (alpha.getDifference (beta, blackout, ignore)) (Except for if alpha is null... then it will use Distances.DefaultDifference

Specified by:
getDifference in interface Measurable
Parameters:
beta - the difference to get against
blackout - the measurable to count as bad
ignore - the measurable region to ignore
cfd - the media file descriptor
old - an old difference to copy into, if possible, like the array passed to list.toArray()
Returns:
the difference between this and beta
Throws:
IgnoredValueException - if everything is ignored

isValidRule

public boolean isValidRule(java.lang.String ruleName)
Tell if a name is a valid rule or not

Parameters:
ruleName - the name of the rule to check
Returns:
true if the rule name is known

compose

public Composable compose(Composable partner)
Description copied from interface: Composable
Generate the composition of this object with its partner. If ordered, this is the object on the "left," whatever that means.

Specified by:
compose in interface Composable
Parameters:
partner -
Returns:
new Composable object from the this and the passed partner

getCompositionType

public int getCompositionType()
Description copied from interface: Composable
Get the type of composition to try.

Specified by:
getCompositionType in interface Composable
Returns:
ORDERED or UNORDERED