Return-Path: Mailing-List: contact general-help@xml.apache.org; run by ezmlm Delivered-To: mailing list general@xml.apache.org Delivered-To: moderator for general@xml.apache.org Received: (qmail 60161 invoked from network); 5 Nov 2000 15:34:38 -0000 Received: from ha1.rdc1.tx.home.com (HELO mail.rdc1.tx.home.com) (imail@24.4.0.66) by locus.apache.org with SMTP; 5 Nov 2000 15:34:38 -0000 Received: from MIMICO ([24.112.75.79]) by mail2.rdc3.on.home.com (InterMail vM.4.01.03.00 201-229-121) with SMTP id <20001105153009.MLZD26241.mail2.rdc3.on.home.com@MIMICO> for ; Sun, 5 Nov 2000 07:30:09 -0800 Message-ID: <004101c0473d$868a1f70$4f4b7018@MIMICO> From: "Edward Ing" To: Subject: VisualAge for Java 2.0 Date: Sun, 5 Nov 2000 10:31:54 -0500 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_003D_01C04713.9D9A26D0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N ------=_NextPart_000_003D_01C04713.9D9A26D0 Content-Type: multipart/alternative; boundary="----=_NextPart_001_003E_01C04713.9D9A26D0" ------=_NextPart_001_003E_01C04713.9D9A26D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Has anyone seen the following problem? Here are two classes as part of the Xerces-1_2_1 which will not compile = on VAJ 2.0 or import into VAJ 2.0 I have the rollup and the updates on VAJ 2.0 on WindowsNT. RecurringDurationDatatypeValidator.java crashes VAJ 2.0 on an import. Op.java has an inner class which subclasses another innerclass which subclasses the outerclass which is the parent. It looks like the VAJ 2.0 compiler doesn't like this. All other's including Microsoft's jvc does compile successfully. ------=_NextPart_001_003E_01C04713.9D9A26D0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Has anyone seen the following = problem?
 

Here are two classes as part of the = Xerces-1_2_1 which will not compile on
VAJ 2.0 or import into VAJ=20 2.0

I have the rollup and the updates on VAJ 2.0 on=20 WindowsNT.

RecurringDurationDatatypeValidator.java crashes VAJ = 2.0 on an=20 import.

Op.java has an inner class which subclasses another = innerclass=20 which
subclasses the outerclass which is the parent. It looks like = the VAJ=20 2.0
compiler doesn't like this. All other's including Microsoft's jvc = does
compile = successfully.




------=_NextPart_001_003E_01C04713.9D9A26D0-- ------=_NextPart_000_003D_01C04713.9D9A26D0 Content-Type: application/octet-stream; name="RecurringDurationDatatypeValidator.java" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="RecurringDurationDatatypeValidator.java" /* * The Apache Software License, Version 1.1 * * * Copyright (c) 1999, 2000 The Apache Software Foundation. All rights=20 * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer.=20 * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: =20 * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software = itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Xerces" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written=20 * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation and was * originally based on software copyright (c) 1999, International * Business Machines, Inc., http://www.apache.org. For more * information on the Apache Software Foundation, please see * . */ package org.apache.xerces.validators.datatype; import java.util.Hashtable; import java.util.Vector; import java.util.Enumeration; import java.util.Locale; import java.util.Calendar; import java.util.GregorianCalendar; import java.text.ParseException; import org.apache.xerces.utils.regex.RegularExpression; import org.apache.xerces.validators.schema.SchemaSymbols; /** * * * * @author Ted Leung, George Joseph, Jeffrey Rodriguez, =20 * @author Mark Swinkles - List Validation refactoring * @version $Id: RecurringDurationDatatypeValidator.java,v 1.8 = 2000/10/17 00:52:40 jeffreyr Exp $ */ public class RecurringDurationDatatypeValidator extends = AbstractDatatypeValidator { private static final boolean fDbug =3D false; private Locale fLocale =3D null; DatatypeValidator fBaseValidator =3D null; // A Native datatype = is null String fPattern =3D null; long fMaxInclusive =3D Long.MAX_VALUE; long fMaxExclusive =3D Long.MAX_VALUE-1; long fMinInclusive =3D 1L; long fMinExclusive =3D 0L; long fDuration =3D 0L; long fPeriod =3D 0L; long[] fEnumrecurringduration =3D null; // Time duration = is represented internally as longs boolean isMaxExclusiveDefined =3D false; boolean isMaxInclusiveDefined =3D false; boolean isMinExclusiveDefined =3D false; boolean isMinInclusiveDefined =3D false; boolean isBaseTypeTimePeriod =3D false; int fFacetsDefined =3D 0; Hashtable fFacets =3D null; private DatatypeMessageProvider fMessageProvider =3D new = DatatypeMessageProvider(); public RecurringDurationDatatypeValidator () throws = InvalidDatatypeFacetException { this( null, null, false ); // Native, No Facets defined, = Restriction } public RecurringDurationDatatypeValidator ( DatatypeValidator base, = Hashtable facets,=20 boolean derivedByList ) = throws InvalidDatatypeFacetException { if ( base !=3D null ) { setBasetype( base ); // Set base type=20 fFacets =3D facets; } // Set Facets if any defined if ( facets !=3D null ) { for (Enumeration e =3D facets.keys(); e.hasMoreElements();) = { String key =3D (String) e.nextElement(); if (key.equals(SchemaSymbols.ELT_PATTERN)) { fFacetsDefined +=3D DatatypeValidator.FACET_PATTERN; fPattern =3D (String)facets.get(key); } else if (key.equals(SchemaSymbols.ELT_ENUMERATION)) { fFacetsDefined +=3D = DatatypeValidator.FACET_ENUMERATION; continue; //Treat the enumeration after this for = loop } else if (key.equals(SchemaSymbols.ELT_MAXINCLUSIVE)) { fFacetsDefined +=3D = DatatypeValidator.FACET_MAXINCLUSIVE; String value =3D null; try { value =3D ((String)facets.get(key)); fMaxInclusive =3D normalizeRecurringDuration( = value.toCharArray(), 0) ; } catch ( InvalidDatatypeValueException nfe ){ throw new InvalidDatatypeFacetException( = getErrorString( = DatatypeMessageProvider.IllegalFacetValue, = DatatypeMessageProvider.MSG_NONE, = new Object [] { value, key})); } } else if (key.equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) { fFacetsDefined +=3D = DatatypeValidator.FACET_MAXEXCLUSIVE; String value =3D null; try { value =3D ((String)facets.get(key)); fMaxExclusive =3D normalizeRecurringDuration( = value.toCharArray(), 0 ); } catch ( InvalidDatatypeValueException nfe ){ throw new InvalidDatatypeFacetException( = getErrorString( = DatatypeMessageProvider.IllegalFacetValue, = DatatypeMessageProvider.MSG_NONE, = new Object [] { value, key})); } } else if (key.equals(SchemaSymbols.ELT_MININCLUSIVE)) { fFacetsDefined +=3D = DatatypeValidator.FACET_MININCLUSIVE; String value =3D null; try { value =3D ((String)facets.get(key)); fMinInclusive =3D normalizeRecurringDuration( = value.toCharArray(), 0 ); } catch ( InvalidDatatypeValueException nfe ){ throw new InvalidDatatypeFacetException( = getErrorString( = DatatypeMessageProvider.IllegalFacetValue, = DatatypeMessageProvider.MSG_NONE, = new Object [] { value, key})); } } else if (key.equals(SchemaSymbols.ELT_MINEXCLUSIVE)) { fFacetsDefined +=3D = DatatypeValidator.FACET_MININCLUSIVE; String value =3D null; try { value =3D ((String)facets.get(key)); fMinExclusive =3D normalizeRecurringDuration( = value.toCharArray(), 0 );=20 } catch ( InvalidDatatypeValueException nfe ) { throw new InvalidDatatypeFacetException( = getErrorString( = DatatypeMessageProvider.IllegalFacetValue, = DatatypeMessageProvider.MSG_NONE, = new Object [] { value, key})); } } else if (key.equals(SchemaSymbols.ELT_PERIOD )) { fFacetsDefined +=3D DatatypeValidator.FACET_PERIOD; String value =3D null; try { value =3D ((String)facets.get(key)); fPeriod =3D normalizeRecurringDuration( = value.toCharArray(), 0 );=20 if ( fDbug =3D=3D true ){ System.out.println( "value =3D " + value ); System.out.println("fPeriod =3D " + fPeriod = ); } } catch ( InvalidDatatypeValueException nfe ) { throw new InvalidDatatypeFacetException( = getErrorString( = DatatypeMessageProvider.IllegalFacetValue, = DatatypeMessageProvider.MSG_NONE, = new Object [] { value, key})); } } else if (key.equals(SchemaSymbols.ELT_DURATION )) { fFacetsDefined +=3D = DatatypeValidator.FACET_DURATION; String value =3D null; try { value =3D ((String)facets.get(key)); fDuration =3D normalizeRecurringDuration( = value.toCharArray(), 0 );=20 if ( fDbug =3D=3D true ){ System.out.println("fDuration =3D " + = fDuration ); } } catch ( InvalidDatatypeValueException nfe ) { throw new InvalidDatatypeFacetException( = getErrorString( = DatatypeMessageProvider.IllegalFacetValue, = DatatypeMessageProvider.MSG_NONE, = new Object [] { value, key})); } } else { throw new InvalidDatatypeFacetException( = getErrorString( DatatypeMessageProvider.MSG_FORMAT_FAILURE, = DatatypeMessageProvider.MSG_NONE, = null)); } } isMaxExclusiveDefined =3D ((fFacetsDefined &=20 = DatatypeValidator.FACET_MAXEXCLUSIVE ) !=3D 0 )?true:false; isMaxInclusiveDefined =3D ((fFacetsDefined &=20 = DatatypeValidator.FACET_MAXINCLUSIVE ) !=3D 0 )?true:false; isMinExclusiveDefined =3D ((fFacetsDefined & = DatatypeValidator.FACET_MINEXCLUSIVE ) !=3D 0 )?true:false; isMinInclusiveDefined =3D ((fFacetsDefined & = DatatypeValidator.FACET_MININCLUSIVE ) !=3D 0 )?true:false; if ( isMaxExclusiveDefined && isMaxInclusiveDefined ) { throw new InvalidDatatypeFacetException( "It is an error = for both maxInclusive and maxExclusive to be specified for the same = datatype." );=20 } if ( isMinExclusiveDefined && isMinInclusiveDefined ) { throw new InvalidDatatypeFacetException( "It is an error = for both minInclusive and minExclusive to be specified for the same = datatype." );=20 } if ( (fFacetsDefined & DatatypeValidator.FACET_ENUMERATION ) = !=3D 0 ) { Vector v =3D (Vector) = facets.get(SchemaSymbols.ELT_ENUMERATION); =20 if (v !=3D null) { fEnumrecurringduration =3D new long[v.size()]; int i =3D 0; String value =3D null; try { for (; i < v.size(); i++){ value =3D (String)v.elementAt(i); fEnumrecurringduration[i] =3D=20 normalizeRecurringDuration( = value.toCharArray(), 0 ); boundsCheck( fEnumrecurringduration[i] ); // = Check against max,min Inclusive, Exclusives } if ( fDbug =3D=3D true ){ System.out.println( "The enumeration vectory = is " + value ); for ( int enumCounter =3D 0; enumCounter < = this.fEnumrecurringduration.length; enumCounter++ ) { System.out.println( = "fEnumrecurringduration[" + enumCounter + "]" ); } } } catch (InvalidDatatypeValueException idve) { throw new InvalidDatatypeFacetException( = getErrorString(DatatypeMessageProvider.InvalidEnumValue, = DatatypeMessageProvider.MSG_NONE, = new Object [] { v.elementAt(i)})); } } } =20 if( fBaseValidator !=3D null ) { // Check if basetype of = Period id null String value =3D null; long baseTypePeriod; try { Hashtable baseValidatorFacet =3D = fBaseValidator.getFacets(); if( baseValidatorFacet !=3D null ) { value =3D = ((String)baseValidatorFacet.get(SchemaSymbols.ELT_PERIOD )); if( value !=3D null ) { fPeriod =3D = normalizeRecurringDuration( value.toCharArray(), 0 );=20 if( fPeriod =3D=3D 0 ){ isBaseTypeTimePeriod =3D true; } if ( fDbug =3D=3D true ){ System.out.println( "value =3D " + = value ); System.out.println("fPeriod =3D " + = fPeriod ); } } } } catch ( InvalidDatatypeValueException nfe ) { throw new InvalidDatatypeFacetException( = getErrorString( = DatatypeMessageProvider.IllegalFacetValue, = DatatypeMessageProvider.MSG_NONE, = new Object [] { value, SchemaSymbols.ELT_PERIOD})); } } }// End Facet definition } /** * validates a String to be a Lexical representation * of a recurringduration Datatype. *=20 * @param content A string containing the content to be validated * @param state * @return=20 * @exception InvalidDatatypeValueException * If String is does not represent a * valid recurringduration datatype. */ public Object validate(String content, Object state) throws = InvalidDatatypeValueException{ long normalizedValue; if( fDbug =3D=3D true ) { System.out.println( "Write fFacetsDefined =3D " + = fFacetsDefined ); if ( ( fFacetsDefined & DatatypeValidator.FACET_DURATION = ) !=3D 0 ){ System.out.println( "Duration =3D " + this.fDuration = ); } if ( ( fFacetsDefined & DatatypeValidator.FACET_PERIOD ) = !=3D 0 ){ System.out.println( "Period =3D " + this.fPeriod ); } System.out.println("datatype =3D " + this.fBaseValidator = ); } if ( fPattern !=3D null ) { RegularExpression regex =3D new RegularExpression(fPattern, = "X" ); if ( regex.matches( content) =3D=3D false ) throw new = InvalidDatatypeValueException("Value'"+content+ "does not match = regular expression facet" + fPattern ); } //normalizeRecurringDuration(content.toCharArray(), 0 ); //Calendar cal =3D normalizeInstant(content.toCharArray(), 0, = content.length() );=20 //System.out.println( "cal =3D " + cal.toString() ); //try { //boundsCheck( normalizedValue ); // } catch( InvalidDatatypeFacetException ex ){ // throw new InvalidDatatypeValueException( "Boundary error:" = ); //} //if ( fEnumrecurringduration !=3D null ) // enumCheck( normalizedValue ); =20 return null; } /** * set the base type for this datatype * * @param base the validator for this type's base type * */ public void setBasetype(DatatypeValidator base) { fBaseValidator =3D base; } /** * set the locate to be used for error messages */ public void setLocale(Locale locale) { } public int compare( String content1, String content2) { return -1; } public Hashtable getFacets(){ return fFacets; } // Here start private methods // Work in Progress -------=20 private static long normalizeRecurringDuration(char[] value, int = start )=20 throws InvalidDatatypeValueException { long normalizedDuration =3D 0L; //System.out.println("value to normalize =3D " + value ); //This method will convert the Lexical representation of re //CCYY-MM-DDThh:mm:ss.sss=20 // return normalizedDuration; } public static Calendar normalizeInstant(char[] value, int start, int length) throws = InvalidDatatypeValueException { boolean negative=3Dfalse; boolean tznegative=3Dfalse; int tzoffset=3D0; int tzhh=3D0,tzmm=3D0; int i=3Dstart,j=3D0,k=3D0,l=3D0,m=3D0; final char[]ms=3D{'0','0','0'}; final Calendar cal =3D new GregorianCalendar(); final int endindex =3D (start+length)-1; try { if (length < 16) throw new ParseException("Value is too = short.",0); cal.clear(); cal.setLenient(false); // If there's a leading sign, set the appropriate Era. if (value[i]=3D=3D'-'||value[i]=3D=3D'+') { cal.set(Calendar.ERA, = (value[i]=3D=3D'-'?GregorianCalendar.BC:GregorianCalendar.AD)); i++; } // Grab the year (might be > 9999), month, day, hour and minute = fields =20 j=3DindexOf(value,i,'-',i+5); if (j=3D=3D-1 || j>endindex)throw new ParseException("Year = separator is missing or misplaced.", i); cal.set(Calendar.YEAR, parseInt(value,i,j-i)); i=3Dj+1; cal.set(Calendar.MONTH, parseInt(value,i,2)-1); i+=3D2; if (value[i]!=3D'-')throw new ParseException("Month = separator is missing or misplaced.",i); cal.set(Calendar.DAY_OF_MONTH, parseInt(value,i+1,2)); i+=3D3; if (value[i]!=3D'T')throw new ParseException("Time separator = is missing or misplaced.",i); cal.set(Calendar.HOUR_OF_DAY, parseInt(value,i+1,2)); i+=3D3; if (value[i]!=3D':')throw new ParseException("Hour separator = is missing or misplaced.",i); cal.set(Calendar.MINUTE, parseInt(value,i+1,2)); i+=3D3; // Seconds are optional if ((endindex-i)>1 && (value[i]=3D=3D':')) { cal.set(Calendar.SECOND, parseInt(value,i+1,2)); i+=3D3; // Grab optional fractional seconds to 3 decimal places. if (i=3D fMinInclusive ); } else if ( isMinExclusiveDefined ) { inLowerBound =3D ( f > fMinExclusive ); } if ( inUpperBound =3D=3D false || inLowerBound =3D=3D false ) { = // within bounds ? throw new InvalidDatatypeFacetException( = getErrorString(DatatypeMessageProvider.OutOfBounds, = DatatypeMessageProvider.MSG_NONE, new = Object [] { new Long(f),"","","",""}));//Revisit } } private void enumCheck(long d) throws InvalidDatatypeValueException = { for (int i =3D 0; i < this.fEnumrecurringduration.length; i++) { if (d =3D=3D fEnumrecurringduration[i]) return; } throw new InvalidDatatypeValueException( = getErrorString(DatatypeMessageProvider.NotAnEnumValue, = DatatypeMessageProvider.MSG_NONE, new Object = [] { new Long(d )})); } private String getErrorString(int major, int minor, Object args[]) { try { return fMessageProvider.createMessage(fLocale, major, minor, = args); } catch (Exception e) { return "Illegal Errorcode "+minor; } } private static final int indexOf(char[] value, int start, char s) { return(indexOf(value,start,s,value.length-1)); } private static final int indexOf(char[] value, int start, char s, = int max) { for (int i=3Dstart;i<=3Dmax;i++)if (value[i]=3D=3Ds) return(i); return(-1); } private static final int indexOneOf(char[] value, int start, String = s) { return(indexOneOf(value,start,s,value.length-1)); } private static final int indexOneOf(char[] value, int start, String = s, int max) { for (int i=3Dstart;i 1) return result; else throw new NumberFormatException(new = String(s,start,length)); } return -result; } } ------=_NextPart_000_003D_01C04713.9D9A26D0 Content-Type: application/octet-stream; name="Op.java" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Op.java" /* * The Apache Software License, Version 1.1 * * * Copyright (c) 1999,2000 The Apache Software Foundation. All rights=20 * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer.=20 * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: =20 * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software = itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Xerces" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written=20 * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation and was * originally based on software copyright (c) 1999, International * Business Machines, Inc., http://www.apache.org. For more * information on the Apache Software Foundation, please see * . */ package org.apache.xerces.utils.regex; import java.util.Vector; /** */ class Op { static final int DOT =3D 0; static final int CHAR =3D 1; // Single character static final int RANGE =3D 3; // [a-zA-Z] static final int NRANGE =3D 4; // [^a-zA-Z] static final int ANCHOR =3D 5; // ^ $ ... static final int STRING =3D 6; // literal String=20 static final int CLOSURE =3D 7; // X* static final int NONGREEDYCLOSURE =3D 8; // X*? static final int QUESTION =3D 9; // X? static final int NONGREEDYQUESTION =3D 10; // X?? static final int UNION =3D 11; // X|Y static final int CAPTURE =3D 15; // ( and ) static final int BACKREFERENCE =3D 16; // \1 \2 ... static final int LOOKAHEAD =3D 20; // (?=3D...) static final int NEGATIVELOOKAHEAD =3D 21; // (?!...) static final int LOOKBEHIND =3D 22; // (?<=3D...) static final int NEGATIVELOOKBEHIND =3D 23; // (?...) static final int MODIFIER =3D 25; // (?ims-ims:...) static final int CONDITION =3D 26; // (?(..)yes|no) static int nofinstances =3D 0; static final boolean COUNT =3D false; static Op createDot() { if (Op.COUNT) Op.nofinstances ++; return new Op(Op.DOT); } static CharOp createChar(int data) { if (Op.COUNT) Op.nofinstances ++; return new CharOp(Op.CHAR, data); } static CharOp createAnchor(int data) { if (Op.COUNT) Op.nofinstances ++; return new CharOp(Op.ANCHOR, data); } static CharOp createCapture(int number, Op next) { if (Op.COUNT) Op.nofinstances ++; CharOp op =3D new CharOp(Op.CAPTURE, number); op.next =3D next; return op; } static UnionOp createUnion(int size) { if (Op.COUNT) Op.nofinstances ++; //System.err.println("Creates UnionOp"); return new UnionOp(Op.UNION, size); } static ChildOp createClosure(int id) { if (Op.COUNT) Op.nofinstances ++; return new ModifierOp(Op.CLOSURE, id, -1); } static ChildOp createNonGreedyClosure() { if (Op.COUNT) Op.nofinstances ++; return new ChildOp(Op.NONGREEDYCLOSURE); } static ChildOp createQuestion(boolean nongreedy) { if (Op.COUNT) Op.nofinstances ++; return new ChildOp(nongreedy ? Op.NONGREEDYQUESTION : = Op.QUESTION); } static RangeOp createRange(Token tok) { if (Op.COUNT) Op.nofinstances ++; return new RangeOp(Op.RANGE, tok); } static ChildOp createLook(int type, Op next, Op branch) { if (Op.COUNT) Op.nofinstances ++; ChildOp op =3D new ChildOp(type); op.setChild(branch); op.next =3D next; return op; } static CharOp createBackReference(int refno) { if (Op.COUNT) Op.nofinstances ++; return new CharOp(Op.BACKREFERENCE, refno); } static StringOp createString(String literal) { if (Op.COUNT) Op.nofinstances ++; return new StringOp(Op.STRING, literal); } static ChildOp createIndependent(Op next, Op branch) { if (Op.COUNT) Op.nofinstances ++; ChildOp op =3D new ChildOp(Op.INDEPENDENT); op.setChild(branch); op.next =3D next; return op; } static ModifierOp createModifier(Op next, Op branch, int add, int = mask) { if (Op.COUNT) Op.nofinstances ++; ModifierOp op =3D new ModifierOp(Op.MODIFIER, add, mask); op.setChild(branch); op.next =3D next; return op; } static ConditionOp createCondition(Op next, int ref, Op = conditionflow, Op yesflow, Op noflow) { if (Op.COUNT) Op.nofinstances ++; ConditionOp op =3D new ConditionOp(Op.CONDITION, ref, = conditionflow, yesflow, noflow); op.next =3D next; return op; } int type; Op next =3D null; protected Op(int type) { this.type =3D type; } int size() { // for UNION return 0; } Op elementAt(int index) { // for UNIoN throw new RuntimeException("Internal Error: type=3D"+this.type); } Op getChild() { // for CLOSURE, QUESTION throw new RuntimeException("Internal Error: type=3D"+this.type); } // ModifierOp int getData() { // CharOp for CHAR, = BACKREFERENCE, CAPTURE, ANCHOR,=20 throw new RuntimeException("Internal Error: type=3D"+this.type); } int getData2() { // ModifierOp throw new RuntimeException("Internal Error: type=3D"+this.type); } RangeToken getToken() { // RANGE, NRANGE throw new RuntimeException("Internal Error: type=3D"+this.type); } String getString() { // STRING throw new RuntimeException("Internal Error: type=3D"+this.type); } // = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D static class CharOp extends Op { int charData; CharOp(int type, int data) { super(type); this.charData =3D data; } int getData() { return this.charData; } } // = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D static class UnionOp extends Op { Vector branches; UnionOp(int type, int size) { super(type); this.branches =3D new Vector(size); } void addElement(Op op) { this.branches.addElement(op); } int size() { return this.branches.size(); } Op elementAt(int index) { return (Op)this.branches.elementAt(index); } } // = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D static class ChildOp extends Op { Op child; ChildOp(int type) { super(type); } void setChild(Op child) { this.child =3D child; } Op getChild() { return this.child; } } // = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D static class ModifierOp extends ChildOp { int v1; int v2; ModifierOp(int type, int v1, int v2) { super(type); this.v1 =3D v1; this.v2 =3D v2; } int getData() { return this.v1; } int getData2() { return this.v2; } } // = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D static class RangeOp extends Op { Token tok; RangeOp(int type, Token tok) { super(type); this.tok =3D tok; } RangeToken getToken() { return (RangeToken)this.tok; } } // = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D static class StringOp extends Op { String string; StringOp(int type, String literal) { super(type); this.string =3D literal; } String getString() { return this.string; } } // = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D static class ConditionOp extends Op { int refNumber; Op condition; Op yes; Op no; ConditionOp(int type, int refno, Op conditionflow, Op yesflow, = Op noflow) { super(type); this.refNumber =3D refno; this.condition =3D conditionflow; this.yes =3D yesflow; this.no =3D noflow; } } } ------=_NextPart_000_003D_01C04713.9D9A26D0--