org.apache.xerces.impl.validation.datatypes.eTypes.Models
Class Helpers

java.lang.Object
  |
  +--org.apache.xerces.impl.validation.datatypes.eTypes.Models.Helpers

public class Helpers
extends java.lang.Object

This class provides static methods which can be used to implement certain frequently occurring 'eval' and 'merge' methods. As well as a method which turns the exceptions thrown by Method.invoke into RuntimeExceptions

Version:
$Id: Helpers.java,v 1.1.2.1 2000/10/28 00:04:50 jeffreyr Exp $
Author:
Leonard C. Berman, Jeffrey Rodriguez

Field Summary
static java.lang.reflect.Method allFalse
          When this method is used as merge, the accumulator should be initialized to Boolean.FALSE.
static java.lang.reflect.Method andMethod
          When this method is used as merge, the accumulator should be initialized to Boolean.FALSE.
static java.lang.reflect.Method constrainAboveClosed
           
static java.lang.reflect.Method constrainAboveOpen
           
static java.lang.reflect.Method constrainBelowClosed
           
static java.lang.reflect.Method constrainBelowOpen
           
static java.lang.reflect.Method maxMethod
           
static java.lang.reflect.Method minMethod
           
static java.lang.reflect.Method orMethod
          When this method is used as merge, the accumulator should be initialized to Boolean.FALSE.
 
Constructor Summary
Helpers()
           
 
Method Summary
static java.lang.Object allFalse(java.lang.Object thisObject, java.lang.Object accumulator)
          When this method is used as merge, the accumulator should be initialized to Boolean.TRUE.
static java.lang.Object and(java.lang.Object thisObject, java.lang.Object accumulator)
          When this method is used as merge, the accumulator should be initialized to Boolean.TRUE.
static java.lang.Number constrainAboveClosed(java.lang.Object obj, java.lang.Object constraint)
           
static java.lang.Number constrainAboveOpen(java.lang.Object obj, java.lang.Object constraint)
           
static java.lang.Number constrainBelowClosed(java.lang.Object obj, java.lang.Object constraint)
           
static java.lang.Number constrainBelowOpen(java.lang.Object obj, java.lang.Object constraint)
           
static void main(java.lang.String[] args)
           
static java.lang.Object max(java.lang.Object instance, java.lang.Object accum)
          Objects should be instances of java.class.Number.
static java.lang.Object min(java.lang.Object instance, java.lang.Object accum)
          Objects should be instances of java.class.Number.
static java.lang.Object mInvoke(java.lang.reflect.Method m, java.lang.Object first, java.lang.Object second)
          Invokes static method, m, on two arguments.
static java.lang.Object or(java.lang.Object thisObject, java.lang.Object accumulator)
          When this method is used as merge, the accumulator should be initialized to Boolean.FALSE.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

andMethod

public static final java.lang.reflect.Method andMethod
When this method is used as merge, the accumulator should be initialized to Boolean.FALSE.

allFalse

public static final java.lang.reflect.Method allFalse
When this method is used as merge, the accumulator should be initialized to Boolean.FALSE.

orMethod

public static final java.lang.reflect.Method orMethod
When this method is used as merge, the accumulator should be initialized to Boolean.FALSE.

maxMethod

public static final java.lang.reflect.Method maxMethod

minMethod

public static final java.lang.reflect.Method minMethod

constrainBelowClosed

public static final java.lang.reflect.Method constrainBelowClosed

constrainBelowOpen

public static final java.lang.reflect.Method constrainBelowOpen

constrainAboveClosed

public static final java.lang.reflect.Method constrainAboveClosed

constrainAboveOpen

public static final java.lang.reflect.Method constrainAboveOpen
Constructor Detail

Helpers

public Helpers()
Method Detail

allFalse

public static java.lang.Object allFalse(java.lang.Object thisObject,
                                        java.lang.Object accumulator)
When this method is used as merge, the accumulator should be initialized to Boolean.TRUE.
Returns:
( thisObject==null ) ? null : accumulator

and

public static java.lang.Object and(java.lang.Object thisObject,
                                   java.lang.Object accumulator)
When this method is used as merge, the accumulator should be initialized to Boolean.TRUE.
Returns:
( thisObject==null ) ? null : accumulator

constrainAboveClosed

public static final java.lang.Number constrainAboveClosed(java.lang.Object obj,
                                                          java.lang.Object constraint)
Parameters:
obj - must be a String which can be converted into Double or Long.
obj - constraint be a Number.
Returns:
null or the Double/Long repr of String (depending on type of constraint)

constrainAboveOpen

public static final java.lang.Number constrainAboveOpen(java.lang.Object obj,
                                                        java.lang.Object constraint)
Parameters:
obj - must be a String which can be converted into Double or Long.
obj - constraint be a Number.
Returns:
null or the Double/Long repr of String (depending on type of constraint)

constrainBelowClosed

public static final java.lang.Number constrainBelowClosed(java.lang.Object obj,
                                                          java.lang.Object constraint)
Parameters:
obj - must be a String which can be converted into Double or Long.
obj - constraint be a Number.
Returns:
null or the Double/Long repr of String (depending on type of constraint)

constrainBelowOpen

public static final java.lang.Number constrainBelowOpen(java.lang.Object obj,
                                                        java.lang.Object constraint)
Parameters:
obj - must be a Number or String which can be converted into Double or Long.
obj - constraint be a Number.
Returns:
null or the Double/Long repr of String (depending on type of constraint)

mInvoke

public static java.lang.Object mInvoke(java.lang.reflect.Method m,
                                       java.lang.Object first,
                                       java.lang.Object second)
Invokes static method, m, on two arguments. Turns Exceptions thrown by invoke into RuntimeExceptions

main

public static void main(java.lang.String[] args)

max

public static java.lang.Object max(java.lang.Object instance,
                                   java.lang.Object accum)
Objects should be instances of java.class.Number. max( a , null ) == a, max( null , a ) == null
Returns:
Double or Long. max if both non-null, null if instance==null, instance if accum == null

min

public static java.lang.Object min(java.lang.Object instance,
                                   java.lang.Object accum)
Objects should be instances of java.class.Number. min( a , null ) == a, max( null , a ) == null
Returns:
Double or Long. min if both non-null, null if instance==null, instance if accum == null

or

public static java.lang.Object or(java.lang.Object thisObject,
                                  java.lang.Object accumulator)
When this method is used as merge, the accumulator should be initialized to Boolean.FALSE.
Returns:
( thisObject!=null ) ? thisObject : accumulator


Copyright © 1999-2001 Apache XML Project. All Rights Reserved.