Package org.web3d.vrml.util
Class FieldValidator
java.lang.Object
org.web3d.vrml.util.FieldValidator
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkBBoxSize
(String idString, float[] bboxSize) Check the validity of the bboxSize field.static void
checkBBoxSize2D
(String idString, float[] bboxSize) Check the validity of the 2D bboxSize field.static void
checkColorAlphaVector
(String idString, float[] newColor) Check the validity of a color field Valid range is [0,1] for each elementstatic void
checkColorArray
(String idString, float[] newColor) Check the validity of a MFColor field array.static void
checkColorVector
(String idString, float[] newColor) Check the validity of a color field Valid range is [0,1] for each elementstatic void
checkDoublePosInfinity
(String idString, double newDouble) Check the validity of a double pos infinity field Valid range is [0,infinity)static void
checkFloat
(String idString, float newFloat) Check the validity of a float field Valid range is [0,1]static void
checkFloatPositiveInfinity
(String idString, float newFloat) Check the validity of a float pos infinity field Valid range is [0,infinity)static void
checkIntPositiveInfinity
(String idString, int newInt) Check the validity of a integer pos infinity field Valid range is [0,infinity)
-
Constructor Details
-
FieldValidator
public FieldValidator()
-
-
Method Details
-
checkColorVector
public static void checkColorVector(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 messagesnewColor
- The proposed new value- Throws:
InvalidFieldValueException
- Value out of spec
-
checkColorAlphaVector
public static void checkColorAlphaVector(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 messagesnewColor
- The proposed new value- Throws:
InvalidFieldValueException
- Value out of spec
-
checkColorArray
public static void checkColorArray(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 messagesnewColor
- The proposed new value- Throws:
InvalidFieldValueException
- Value out of spec
-
checkFloat
Check the validity of a float field Valid range is [0,1]- Parameters:
idString
- A field ID name for nice error messagesnewFloat
- the float to validate- Throws:
InvalidFieldValueException
- Value out of spec
-
checkFloatPositiveInfinity
public static void checkFloatPositiveInfinity(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 messagesnewFloat
- the float to validate- Throws:
InvalidFieldValueException
- Value out of spec
-
checkDoublePosInfinity
public static void checkDoublePosInfinity(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 messagesnewDouble
- the double to validate- Throws:
InvalidFieldValueException
- Value out of spec
-
checkIntPositiveInfinity
public static void checkIntPositiveInfinity(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 messagesnewInt
- the integer to validate- Throws:
InvalidFieldValueException
- Value out of spec
-
checkBBoxSize
public static void checkBBoxSize(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 messagesbboxSize
- The field to validate.- Throws:
InvalidFieldValueException
- Value out of spec
-
checkBBoxSize2D
public static void checkBBoxSize2D(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 messagesbboxSize
- The field to validate.- Throws:
InvalidFieldValueException
- Value out of spec
-