org.qtitools.qti.node.expression.operator
Enum Shape

java.lang.Object
  extended by java.lang.Enum<Shape>
      extended by org.qtitools.qti.node.expression.operator.Shape
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Shape>

public enum Shape
extends java.lang.Enum<Shape>

Enumeration for inside expression.

Author:
Jiri Kajaba
See Also:
Inside

Enum Constant Summary
CIRCLE
          A circular region.
DEFAULT
          The default shape refers to the entire area of the associated image.
ELLIPSE
          This value is deprecated, but is included for compatibility with version of 1 of the QTI specification.
POLY
          An arbitrary polygonal region.
RECT
          A rectangular region.
 
Field Summary
static java.lang.String CLASS_TAG
          Name of this class in xml schema.
 
Method Summary
abstract  boolean isInside(int[] coords, PointValue point)
          Returns true if given PointValue is inside this Shape; false otherwise.
static Shape parseShape(java.lang.String shape)
          Parses string representation of Shape.
 java.lang.String toString()
           
abstract  ValidationResult validateCoords(Attribute attribute, int[] coords)
          Validates coords attribute.
protected  ValidationResult validateCoordsLength(Attribute attribute, int[] coords, int expectedLength)
          Validates length of coords attribute (number of coordinates).
protected  ValidationResult validatePositiveCoords(Attribute attribute, int[] coords)
          Validates if all coordinates are greater or equal than zero.
static Shape valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static Shape[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

DEFAULT

public static final Shape DEFAULT
The default shape refers to the entire area of the associated image.


RECT

public static final Shape RECT
A rectangular region.


CIRCLE

public static final Shape CIRCLE
A circular region.


POLY

public static final Shape POLY
An arbitrary polygonal region.


ELLIPSE

public static final Shape ELLIPSE
This value is deprecated, but is included for compatibility with version of 1 of the QTI specification. Systems should use circle or poly shapes instead.

Field Detail

CLASS_TAG

public static final java.lang.String CLASS_TAG
Name of this class in xml schema.

See Also:
Constant Field Values
Method Detail

values

public static final Shape[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(Shape c : Shape.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static Shape valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

validateCoords

public abstract ValidationResult validateCoords(Attribute attribute,
                                                int[] coords)
Validates coords attribute.

Parameters:
attribute - attribute to be validated
coords - attribute's value to be validated
Returns:
validation result

validateCoordsLength

protected ValidationResult validateCoordsLength(Attribute attribute,
                                                int[] coords,
                                                int expectedLength)
Validates length of coords attribute (number of coordinates).

Parameters:
attribute - attribute to be validated
coords - attribute's value to be validated
expectedLength - expected length of coords attribute (number of coordinates)
Returns:
validation result

validatePositiveCoords

protected ValidationResult validatePositiveCoords(Attribute attribute,
                                                  int[] coords)
Validates if all coordinates are greater or equal than zero.

Parameters:
attribute - attribute to be validated
coords - attribute's value to be validated
Returns:
validation result

isInside

public abstract boolean isInside(int[] coords,
                                 PointValue point)
Returns true if given PointValue is inside this Shape; false otherwise.

Parameters:
coords - coordinates of this shape
point - given PointValue
Returns:
true if given PointValue is inside this Shape; false otherwise

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Enum<Shape>

parseShape

public static Shape parseShape(java.lang.String shape)
Parses string representation of Shape.

Parameters:
shape - string representation of Shape
Returns:
parsed Shape


Copyright © 2009. All Rights Reserved.