Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.util
Class FieldValidator

java.lang.Object
  extended by org.web3d.vrml.util.FieldValidator

public class FieldValidator
extends java.lang.Object

Validates the value of a VRML field against the specification.

Will throw a InvalidFieldValueException if the value is out of range

Version:
$Revision: 1.12 $
Author:
Alan Hudson

Constructor Summary
FieldValidator()
           
 
Method Summary
static void checkBBoxSize(java.lang.String idString, float[] bboxSize)
          Check the validity of the bboxSize field.
static void checkBBoxSize2D(java.lang.String idString, float[] bboxSize)
          Check the validity of the 2D bboxSize field.
static void checkColorAlphaVector(java.lang.String idString, float[] newColor)
          Check the validity of a color field Valid range is [0,1] for each element
static void checkColorArray(java.lang.String idString, float[] newColor)
          Check the validity of a MFColor field array.
static void checkColorVector(java.lang.String idString, float[] newColor)
          Check the validity of a color field Valid range is [0,1] for each element
static void checkDoublePosInfinity(java.lang.String idString, double newDouble)
          Check the validity of a double pos infinity field Valid range is [0,infinity)
static void checkFloat(java.lang.String idString, float newFloat)
          Check the validity of a float field Valid range is [0,1]
static void checkFloatPosInfinity(java.lang.String idString, float newFloat)
          Check the validity of a float pos infinity field Valid range is [0,infinity)
static void checkIntPosInfinity(java.lang.String idString, int newInt)
          Check the validity of a integer pos infinity field Valid range is [0,infinity)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldValidator

public FieldValidator()
Method Detail

checkColorVector

public static void checkColorVector(java.lang.String idString,
                                    float[] newColor)
                             throws InvalidFieldValueException
Check the validity of a color field Valid range is [0,1] for each element

Parameters:
idString - A field ID name for nice error messages
newColor - The proposed new value
Throws:
InvalidFieldValueException - Value out of spec

checkColorAlphaVector

public static void checkColorAlphaVector(java.lang.String idString,
                                         float[] newColor)
                                  throws InvalidFieldValueException
Check the validity of a color field Valid range is [0,1] for each element

Parameters:
idString - A field ID name for nice error messages
newColor - The proposed new value
Throws:
InvalidFieldValueException - Value out of spec

checkColorArray

public static void checkColorArray(java.lang.String idString,
                                   float[] newColor)
                            throws InvalidFieldValueException
Check the validity of a MFColor field array. Valid range is [0,1] for each element

Parameters:
idString - A field ID name for nice error messages
newColor - The proposed new value
Throws:
InvalidFieldValueException - Value out of spec

checkFloat

public static void checkFloat(java.lang.String idString,
                              float newFloat)
                       throws InvalidFieldValueException
Check the validity of a float field Valid range is [0,1]

Parameters:
idString - A field ID name for nice error messages
newFloat - the float to validate
Throws:
InvalidFieldValueException - Value out of spec

checkFloatPosInfinity

public static void checkFloatPosInfinity(java.lang.String idString,
                                         float newFloat)
                                  throws InvalidFieldValueException
Check the validity of a float pos infinity field Valid range is [0,infinity)

Parameters:
idString - A field ID name for nice error messages
newFloat - the float to validate
Throws:
InvalidFieldValueException - Value out of spec

checkDoublePosInfinity

public static void checkDoublePosInfinity(java.lang.String idString,
                                          double newDouble)
                                   throws InvalidFieldValueException
Check the validity of a double pos infinity field Valid range is [0,infinity)

Parameters:
idString - A field ID name for nice error messages
newDouble - the double to validate
Throws:
InvalidFieldValueException - Value out of spec

checkIntPosInfinity

public static void checkIntPosInfinity(java.lang.String idString,
                                       int newInt)
                                throws InvalidFieldValueException
Check the validity of a integer pos infinity field Valid range is [0,infinity)

Parameters:
idString - A field ID name for nice error messages
newInt - the integer to validate
Throws:
InvalidFieldValueException - Value out of spec

checkBBoxSize

public static void checkBBoxSize(java.lang.String idString,
                                 float[] bboxSize)
                          throws InvalidFieldValueException
Check the validity of the bboxSize field. All values must be either greater than or equal to zero. They may also have the value of -1 for all fields to indicate that it should be auto-computed. If one field is -1 then all fields must be -1.

Parameters:
idString - A field ID name for nice error messages
bboxSize - The field to validate.
Throws:
InvalidFieldValueException - Value out of spec

checkBBoxSize2D

public static void checkBBoxSize2D(java.lang.String idString,
                                   float[] bboxSize)
                            throws InvalidFieldValueException
Check the validity of the 2D bboxSize field. All values must be either greater than or equal to zero. They may also have the value of -1 for all fields to indicate that it should be auto-computed. If one field is -1 then all fields must be -1.

Parameters:
idString - A field ID name for nice error messages
bboxSize - The field to validate.
Throws:
InvalidFieldValueException - Value out of spec

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium