com.sun.org.apache.xerces.internal.impl.xs.XSConstraints Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.impl.xs.XSConstraints. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XSAllCM.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // check whether there is conflict between any two leaves
    for (int i = 0; i < fNumElements; i++) {
        for (int j = i+1; j < fNumElements; j++) {
            if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
                                                                          fAllElements[j].toString()});
            }
        }
    }

    return false;
}
 
Example #2
Source File: XSAllCM.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // check whether there is conflict between any two leaves
    for (int i = 0; i < fNumElements; i++) {
        for (int j = i+1; j < fNumElements; j++) {
            if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
                                                                          fAllElements[j].toString()});
            }
        }
    }

    return false;
}
 
Example #3
Source File: XSAllCM.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // check whether there is conflict between any two leaves
    for (int i = 0; i < fNumElements; i++) {
        for (int j = i+1; j < fNumElements; j++) {
            if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
                                                                          fAllElements[j].toString()});
            }
        }
    }

    return false;
}
 
Example #4
Source File: XSAllCM.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // check whether there is conflict between any two leaves
    for (int i = 0; i < fNumElements; i++) {
        for (int j = i+1; j < fNumElements; j++) {
            if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
                                                                          fAllElements[j].toString()});
            }
        }
    }

    return false;
}
 
Example #5
Source File: XSAllCM.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // check whether there is conflict between any two leaves
    for (int i = 0; i < fNumElements; i++) {
        for (int j = i+1; j < fNumElements; j++) {
            if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
                                                                          fAllElements[j].toString()});
            }
        }
    }

    return false;
}
 
Example #6
Source File: XSAllCM.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // check whether there is conflict between any two leaves
    for (int i = 0; i < fNumElements; i++) {
        for (int j = i+1; j < fNumElements; j++) {
            if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
                                                                          fAllElements[j].toString()});
            }
        }
    }

    return false;
}
 
Example #7
Source File: XSAllCM.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // check whether there is conflict between any two leaves
    for (int i = 0; i < fNumElements; i++) {
        for (int j = i+1; j < fNumElements; j++) {
            if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
                                                                          fAllElements[j].toString()});
            }
        }
    }

    return false;
}
 
Example #8
Source File: XSAllCM.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // check whether there is conflict between any two leaves
    for (int i = 0; i < fNumElements; i++) {
        for (int j = i+1; j < fNumElements; j++) {
            if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
                                                                          fAllElements[j].toString()});
            }
        }
    }

    return false;
}
 
Example #9
Source File: XSAllCM.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // check whether there is conflict between any two leaves
    for (int i = 0; i < fNumElements; i++) {
        for (int j = i+1; j < fNumElements; j++) {
            if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
                                                                          fAllElements[j].toString()});
            }
        }
    }

    return false;
}
 
Example #10
Source File: XSAllCM.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // check whether there is conflict between any two leaves
    for (int i = 0; i < fNumElements; i++) {
        for (int j = i+1; j < fNumElements; j++) {
            if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
                                                                          fAllElements[j].toString()});
            }
        }
    }

    return false;
}
 
Example #11
Source File: XSAllCM.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // check whether there is conflict between any two leaves
    for (int i = 0; i < fNumElements; i++) {
        for (int j = i+1; j < fNumElements; j++) {
            if (XSConstraints.overlapUPA(fAllElements[i], fAllElements[j], subGroupHandler)) {
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fAllElements[i].toString(),
                                                                          fAllElements[j].toString()});
            }
        }
    }

    return false;
}
 
Example #12
Source File: XSDFACM.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // Unique Particle Attribution
    // store the conflict results between any two elements in fElemMap
    // 0: not compared; -1: no conflict; 1: conflict
    // initialize the conflict table (all 0 initially)
    byte conflictTable[][] = new byte[fElemMapSize][fElemMapSize];

    // for each state, check whether it has overlap transitions
    for (int i = 0; i < fTransTable.length && fTransTable[i] != null; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            for (int k = j+1; k < fElemMapSize; k++) {
                if (fTransTable[i][j] != -1 &&
                    fTransTable[i][k] != -1) {
                    if (conflictTable[j][k] == 0) {
                        if (XSConstraints.overlapUPA
                                (fElemMap[j], fElemMap[k],
                                        subGroupHandler)) {
                            if (fCountingStates != null) {
                                Occurence o = fCountingStates[i];
                                // If "i" is a counting state and exactly one of the transitions
                                // loops back to "i" then the two particles do not overlap if
                                // minOccurs == maxOccurs.
                                if (o != null &&
                                    fTransTable[i][j] == i ^ fTransTable[i][k] == i &&
                                    o.minOccurs == o.maxOccurs) {
                                    conflictTable[j][k] = (byte) -1;
                                    continue;
                                }
                            }
                            conflictTable[j][k] = (byte) 1;
                        }
                        else {
                            conflictTable[j][k] = (byte) -1;
                        }
                    }
                }
            }
        }
    }

    // report all errors
    for (int i = 0; i < fElemMapSize; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            if (conflictTable[i][j] == 1) {
                //errors.newError("cos-nonambig", new Object[]{fElemMap[i].toString(),
                //                                             fElemMap[j].toString()});
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fElemMap[i].toString(),
                                                                          fElemMap[j].toString()});
            }
        }
    }

    // if there is a other or list wildcard, we need to check this CM
    // again, if this grammar is cached.
    for (int i = 0; i < fElemMapSize; i++) {
        if (fElemMapType[i] == XSParticleDecl.PARTICLE_WILDCARD) {
            XSWildcardDecl wildcard = (XSWildcardDecl)fElemMap[i];
            if (wildcard.fType == XSWildcardDecl.NSCONSTRAINT_LIST ||
                wildcard.fType == XSWildcardDecl.NSCONSTRAINT_NOT) {
                return true;
            }
        }
    }

    return false;
}
 
Example #13
Source File: XSDFACM.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // Unique Particle Attribution
    // store the conflict results between any two elements in fElemMap
    // 0: not compared; -1: no conflict; 1: conflict
    // initialize the conflict table (all 0 initially)
    byte conflictTable[][] = new byte[fElemMapSize][fElemMapSize];

    // for each state, check whether it has overlap transitions
    for (int i = 0; i < fTransTable.length && fTransTable[i] != null; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            for (int k = j+1; k < fElemMapSize; k++) {
                if (fTransTable[i][j] != -1 &&
                    fTransTable[i][k] != -1) {
                    if (conflictTable[j][k] == 0) {
                        if (XSConstraints.overlapUPA
                                (fElemMap[j], fElemMap[k],
                                        subGroupHandler)) {
                            if (fCountingStates != null) {
                                Occurence o = fCountingStates[i];
                                // If "i" is a counting state and exactly one of the transitions
                                // loops back to "i" then the two particles do not overlap if
                                // minOccurs == maxOccurs.
                                if (o != null &&
                                    fTransTable[i][j] == i ^ fTransTable[i][k] == i &&
                                    o.minOccurs == o.maxOccurs) {
                                    conflictTable[j][k] = (byte) -1;
                                    continue;
                                }
                            }
                            conflictTable[j][k] = (byte) 1;
                        }
                        else {
                            conflictTable[j][k] = (byte) -1;
                        }
                    }
                }
            }
        }
    }

    // report all errors
    for (int i = 0; i < fElemMapSize; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            if (conflictTable[i][j] == 1) {
                //errors.newError("cos-nonambig", new Object[]{fElemMap[i].toString(),
                //                                             fElemMap[j].toString()});
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fElemMap[i].toString(),
                                                                          fElemMap[j].toString()});
            }
        }
    }

    // if there is a other or list wildcard, we need to check this CM
    // again, if this grammar is cached.
    for (int i = 0; i < fElemMapSize; i++) {
        if (fElemMapType[i] == XSParticleDecl.PARTICLE_WILDCARD) {
            XSWildcardDecl wildcard = (XSWildcardDecl)fElemMap[i];
            if (wildcard.fType == XSWildcardDecl.NSCONSTRAINT_LIST ||
                wildcard.fType == XSWildcardDecl.NSCONSTRAINT_NOT) {
                return true;
            }
        }
    }

    return false;
}
 
Example #14
Source File: XSDFACM.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // Unique Particle Attribution
    // store the conflict results between any two elements in fElemMap
    // 0: not compared; -1: no conflict; 1: conflict
    // initialize the conflict table (all 0 initially)
    byte conflictTable[][] = new byte[fElemMapSize][fElemMapSize];

    // for each state, check whether it has overlap transitions
    for (int i = 0; i < fTransTable.length && fTransTable[i] != null; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            for (int k = j+1; k < fElemMapSize; k++) {
                if (fTransTable[i][j] != -1 &&
                    fTransTable[i][k] != -1) {
                    if (conflictTable[j][k] == 0) {
                        if (XSConstraints.overlapUPA
                                (fElemMap[j], fElemMap[k],
                                        subGroupHandler)) {
                            if (fCountingStates != null) {
                                Occurence o = fCountingStates[i];
                                // If "i" is a counting state and exactly one of the transitions
                                // loops back to "i" then the two particles do not overlap if
                                // minOccurs == maxOccurs.
                                if (o != null &&
                                    fTransTable[i][j] == i ^ fTransTable[i][k] == i &&
                                    o.minOccurs == o.maxOccurs) {
                                    conflictTable[j][k] = (byte) -1;
                                    continue;
                                }
                            }
                            conflictTable[j][k] = (byte) 1;
                        }
                        else {
                            conflictTable[j][k] = (byte) -1;
                        }
                    }
                }
            }
        }
    }

    // report all errors
    for (int i = 0; i < fElemMapSize; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            if (conflictTable[i][j] == 1) {
                //errors.newError("cos-nonambig", new Object[]{fElemMap[i].toString(),
                //                                             fElemMap[j].toString()});
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fElemMap[i].toString(),
                                                                          fElemMap[j].toString()});
            }
        }
    }

    // if there is a other or list wildcard, we need to check this CM
    // again, if this grammar is cached.
    for (int i = 0; i < fElemMapSize; i++) {
        if (fElemMapType[i] == XSParticleDecl.PARTICLE_WILDCARD) {
            XSWildcardDecl wildcard = (XSWildcardDecl)fElemMap[i];
            if (wildcard.fType == XSWildcardDecl.NSCONSTRAINT_LIST ||
                wildcard.fType == XSWildcardDecl.NSCONSTRAINT_NOT) {
                return true;
            }
        }
    }

    return false;
}
 
Example #15
Source File: XSDFACM.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // Unique Particle Attribution
    // store the conflict results between any two elements in fElemMap
    // 0: not compared; -1: no conflict; 1: conflict
    // initialize the conflict table (all 0 initially)
    byte conflictTable[][] = new byte[fElemMapSize][fElemMapSize];

    // for each state, check whether it has overlap transitions
    for (int i = 0; i < fTransTable.length && fTransTable[i] != null; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            for (int k = j+1; k < fElemMapSize; k++) {
                if (fTransTable[i][j] != -1 &&
                    fTransTable[i][k] != -1) {
                    if (conflictTable[j][k] == 0) {
                        if (XSConstraints.overlapUPA
                                (fElemMap[j], fElemMap[k],
                                        subGroupHandler)) {
                            if (fCountingStates != null) {
                                Occurence o = fCountingStates[i];
                                // If "i" is a counting state and exactly one of the transitions
                                // loops back to "i" then the two particles do not overlap if
                                // minOccurs == maxOccurs.
                                if (o != null &&
                                    fTransTable[i][j] == i ^ fTransTable[i][k] == i &&
                                    o.minOccurs == o.maxOccurs) {
                                    conflictTable[j][k] = (byte) -1;
                                    continue;
                                }
                            }
                            conflictTable[j][k] = (byte) 1;
                        }
                        else {
                            conflictTable[j][k] = (byte) -1;
                        }
                    }
                }
            }
        }
    }

    // report all errors
    for (int i = 0; i < fElemMapSize; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            if (conflictTable[i][j] == 1) {
                //errors.newError("cos-nonambig", new Object[]{fElemMap[i].toString(),
                //                                             fElemMap[j].toString()});
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fElemMap[i].toString(),
                                                                          fElemMap[j].toString()});
            }
        }
    }

    // if there is a other or list wildcard, we need to check this CM
    // again, if this grammar is cached.
    for (int i = 0; i < fElemMapSize; i++) {
        if (fElemMapType[i] == XSParticleDecl.PARTICLE_WILDCARD) {
            XSWildcardDecl wildcard = (XSWildcardDecl)fElemMap[i];
            if (wildcard.fType == XSWildcardDecl.NSCONSTRAINT_LIST ||
                wildcard.fType == XSWildcardDecl.NSCONSTRAINT_NOT) {
                return true;
            }
        }
    }

    return false;
}
 
Example #16
Source File: XSDFACM.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // Unique Particle Attribution
    // store the conflict results between any two elements in fElemMap
    // 0: not compared; -1: no conflict; 1: conflict
    // initialize the conflict table (all 0 initially)
    byte conflictTable[][] = new byte[fElemMapSize][fElemMapSize];

    // for each state, check whether it has overlap transitions
    for (int i = 0; i < fTransTable.length && fTransTable[i] != null; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            for (int k = j+1; k < fElemMapSize; k++) {
                if (fTransTable[i][j] != -1 &&
                    fTransTable[i][k] != -1) {
                    if (conflictTable[j][k] == 0) {
                        if (XSConstraints.overlapUPA
                                (fElemMap[j], fElemMap[k],
                                        subGroupHandler)) {
                            if (fCountingStates != null) {
                                Occurence o = fCountingStates[i];
                                // If "i" is a counting state and exactly one of the transitions
                                // loops back to "i" then the two particles do not overlap if
                                // minOccurs == maxOccurs.
                                if (o != null &&
                                    fTransTable[i][j] == i ^ fTransTable[i][k] == i &&
                                    o.minOccurs == o.maxOccurs) {
                                    conflictTable[j][k] = (byte) -1;
                                    continue;
                                }
                            }
                            conflictTable[j][k] = (byte) 1;
                        }
                        else {
                            conflictTable[j][k] = (byte) -1;
                        }
                    }
                }
            }
        }
    }

    // report all errors
    for (int i = 0; i < fElemMapSize; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            if (conflictTable[i][j] == 1) {
                //errors.newError("cos-nonambig", new Object[]{fElemMap[i].toString(),
                //                                             fElemMap[j].toString()});
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fElemMap[i].toString(),
                                                                          fElemMap[j].toString()});
            }
        }
    }

    // if there is a other or list wildcard, we need to check this CM
    // again, if this grammar is cached.
    for (int i = 0; i < fElemMapSize; i++) {
        if (fElemMapType[i] == XSParticleDecl.PARTICLE_WILDCARD) {
            XSWildcardDecl wildcard = (XSWildcardDecl)fElemMap[i];
            if (wildcard.fType == XSWildcardDecl.NSCONSTRAINT_LIST ||
                wildcard.fType == XSWildcardDecl.NSCONSTRAINT_NOT) {
                return true;
            }
        }
    }

    return false;
}
 
Example #17
Source File: XSDFACM.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // Unique Particle Attribution
    // store the conflict results between any two elements in fElemMap
    // 0: not compared; -1: no conflict; 1: conflict
    // initialize the conflict table (all 0 initially)
    byte conflictTable[][] = new byte[fElemMapSize][fElemMapSize];

    // for each state, check whether it has overlap transitions
    for (int i = 0; i < fTransTable.length && fTransTable[i] != null; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            for (int k = j+1; k < fElemMapSize; k++) {
                if (fTransTable[i][j] != -1 &&
                    fTransTable[i][k] != -1) {
                    if (conflictTable[j][k] == 0) {
                        if (XSConstraints.overlapUPA
                                (fElemMap[j], fElemMap[k],
                                        subGroupHandler)) {
                            if (fCountingStates != null) {
                                Occurence o = fCountingStates[i];
                                // If "i" is a counting state and exactly one of the transitions
                                // loops back to "i" then the two particles do not overlap if
                                // minOccurs == maxOccurs.
                                if (o != null &&
                                    fTransTable[i][j] == i ^ fTransTable[i][k] == i &&
                                    o.minOccurs == o.maxOccurs) {
                                    conflictTable[j][k] = (byte) -1;
                                    continue;
                                }
                            }
                            conflictTable[j][k] = (byte) 1;
                        }
                        else {
                            conflictTable[j][k] = (byte) -1;
                        }
                    }
                }
            }
        }
    }

    // report all errors
    for (int i = 0; i < fElemMapSize; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            if (conflictTable[i][j] == 1) {
                //errors.newError("cos-nonambig", new Object[]{fElemMap[i].toString(),
                //                                             fElemMap[j].toString()});
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fElemMap[i].toString(),
                                                                          fElemMap[j].toString()});
            }
        }
    }

    // if there is a other or list wildcard, we need to check this CM
    // again, if this grammar is cached.
    for (int i = 0; i < fElemMapSize; i++) {
        if (fElemMapType[i] == XSParticleDecl.PARTICLE_WILDCARD) {
            XSWildcardDecl wildcard = (XSWildcardDecl)fElemMap[i];
            if (wildcard.fType == XSWildcardDecl.NSCONSTRAINT_LIST ||
                wildcard.fType == XSWildcardDecl.NSCONSTRAINT_NOT) {
                return true;
            }
        }
    }

    return false;
}
 
Example #18
Source File: XSDFACM.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // Unique Particle Attribution
    // store the conflict results between any two elements in fElemMap
    // 0: not compared; -1: no conflict; 1: conflict
    // initialize the conflict table (all 0 initially)
    byte conflictTable[][] = new byte[fElemMapSize][fElemMapSize];

    // for each state, check whether it has overlap transitions
    for (int i = 0; i < fTransTable.length && fTransTable[i] != null; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            for (int k = j+1; k < fElemMapSize; k++) {
                if (fTransTable[i][j] != -1 &&
                    fTransTable[i][k] != -1) {
                    if (conflictTable[j][k] == 0) {
                        if (XSConstraints.overlapUPA
                                (fElemMap[j], fElemMap[k],
                                        subGroupHandler)) {
                            if (fCountingStates != null) {
                                Occurence o = fCountingStates[i];
                                // If "i" is a counting state and exactly one of the transitions
                                // loops back to "i" then the two particles do not overlap if
                                // minOccurs == maxOccurs.
                                if (o != null &&
                                    fTransTable[i][j] == i ^ fTransTable[i][k] == i &&
                                    o.minOccurs == o.maxOccurs) {
                                    conflictTable[j][k] = (byte) -1;
                                    continue;
                                }
                            }
                            conflictTable[j][k] = (byte) 1;
                        }
                        else {
                            conflictTable[j][k] = (byte) -1;
                        }
                    }
                }
            }
        }
    }

    // report all errors
    for (int i = 0; i < fElemMapSize; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            if (conflictTable[i][j] == 1) {
                //errors.newError("cos-nonambig", new Object[]{fElemMap[i].toString(),
                //                                             fElemMap[j].toString()});
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fElemMap[i].toString(),
                                                                          fElemMap[j].toString()});
            }
        }
    }

    // if there is a other or list wildcard, we need to check this CM
    // again, if this grammar is cached.
    for (int i = 0; i < fElemMapSize; i++) {
        if (fElemMapType[i] == XSParticleDecl.PARTICLE_WILDCARD) {
            XSWildcardDecl wildcard = (XSWildcardDecl)fElemMap[i];
            if (wildcard.fType == XSWildcardDecl.NSCONSTRAINT_LIST ||
                wildcard.fType == XSWildcardDecl.NSCONSTRAINT_NOT) {
                return true;
            }
        }
    }

    return false;
}
 
Example #19
Source File: XSDFACM.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // Unique Particle Attribution
    // store the conflict results between any two elements in fElemMap
    // 0: not compared; -1: no conflict; 1: conflict
    // initialize the conflict table (all 0 initially)
    byte conflictTable[][] = new byte[fElemMapSize][fElemMapSize];

    // for each state, check whether it has overlap transitions
    for (int i = 0; i < fTransTable.length && fTransTable[i] != null; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            for (int k = j+1; k < fElemMapSize; k++) {
                if (fTransTable[i][j] != -1 &&
                    fTransTable[i][k] != -1) {
                    if (conflictTable[j][k] == 0) {
                        if (XSConstraints.overlapUPA
                                (fElemMap[j], fElemMap[k],
                                        subGroupHandler)) {
                            if (fCountingStates != null) {
                                Occurence o = fCountingStates[i];
                                // If "i" is a counting state and exactly one of the transitions
                                // loops back to "i" then the two particles do not overlap if
                                // minOccurs == maxOccurs.
                                if (o != null &&
                                    fTransTable[i][j] == i ^ fTransTable[i][k] == i &&
                                    o.minOccurs == o.maxOccurs) {
                                    conflictTable[j][k] = (byte) -1;
                                    continue;
                                }
                            }
                            conflictTable[j][k] = (byte) 1;
                        }
                        else {
                            conflictTable[j][k] = (byte) -1;
                        }
                    }
                }
            }
        }
    }

    // report all errors
    for (int i = 0; i < fElemMapSize; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            if (conflictTable[i][j] == 1) {
                //errors.newError("cos-nonambig", new Object[]{fElemMap[i].toString(),
                //                                             fElemMap[j].toString()});
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fElemMap[i].toString(),
                                                                          fElemMap[j].toString()});
            }
        }
    }

    // if there is a other or list wildcard, we need to check this CM
    // again, if this grammar is cached.
    for (int i = 0; i < fElemMapSize; i++) {
        if (fElemMapType[i] == XSParticleDecl.PARTICLE_WILDCARD) {
            XSWildcardDecl wildcard = (XSWildcardDecl)fElemMap[i];
            if (wildcard.fType == XSWildcardDecl.NSCONSTRAINT_LIST ||
                wildcard.fType == XSWildcardDecl.NSCONSTRAINT_NOT) {
                return true;
            }
        }
    }

    return false;
}
 
Example #20
Source File: XSDFACM.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // Unique Particle Attribution
    // store the conflict results between any two elements in fElemMap
    // 0: not compared; -1: no conflict; 1: conflict
    // initialize the conflict table (all 0 initially)
    byte conflictTable[][] = new byte[fElemMapSize][fElemMapSize];

    // for each state, check whether it has overlap transitions
    for (int i = 0; i < fTransTable.length && fTransTable[i] != null; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            for (int k = j+1; k < fElemMapSize; k++) {
                if (fTransTable[i][j] != -1 &&
                    fTransTable[i][k] != -1) {
                    if (conflictTable[j][k] == 0) {
                        if (XSConstraints.overlapUPA
                                (fElemMap[j], fElemMap[k],
                                        subGroupHandler)) {
                            if (fCountingStates != null) {
                                Occurence o = fCountingStates[i];
                                // If "i" is a counting state and exactly one of the transitions
                                // loops back to "i" then the two particles do not overlap if
                                // minOccurs == maxOccurs.
                                if (o != null &&
                                    fTransTable[i][j] == i ^ fTransTable[i][k] == i &&
                                    o.minOccurs == o.maxOccurs) {
                                    conflictTable[j][k] = (byte) -1;
                                    continue;
                                }
                            }
                            conflictTable[j][k] = (byte) 1;
                        }
                        else {
                            conflictTable[j][k] = (byte) -1;
                        }
                    }
                }
            }
        }
    }

    // report all errors
    for (int i = 0; i < fElemMapSize; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            if (conflictTable[i][j] == 1) {
                //errors.newError("cos-nonambig", new Object[]{fElemMap[i].toString(),
                //                                             fElemMap[j].toString()});
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fElemMap[i].toString(),
                                                                          fElemMap[j].toString()});
            }
        }
    }

    // if there is a other or list wildcard, we need to check this CM
    // again, if this grammar is cached.
    for (int i = 0; i < fElemMapSize; i++) {
        if (fElemMapType[i] == XSParticleDecl.PARTICLE_WILDCARD) {
            XSWildcardDecl wildcard = (XSWildcardDecl)fElemMap[i];
            if (wildcard.fType == XSWildcardDecl.NSCONSTRAINT_LIST ||
                wildcard.fType == XSWildcardDecl.NSCONSTRAINT_NOT) {
                return true;
            }
        }
    }

    return false;
}
 
Example #21
Source File: XSDFACM.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // Unique Particle Attribution
    // store the conflict results between any two elements in fElemMap
    // 0: not compared; -1: no conflict; 1: conflict
    // initialize the conflict table (all 0 initially)
    byte conflictTable[][] = new byte[fElemMapSize][fElemMapSize];

    // for each state, check whether it has overlap transitions
    for (int i = 0; i < fTransTable.length && fTransTable[i] != null; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            for (int k = j+1; k < fElemMapSize; k++) {
                if (fTransTable[i][j] != -1 &&
                    fTransTable[i][k] != -1) {
                    if (conflictTable[j][k] == 0) {
                        if (XSConstraints.overlapUPA
                                (fElemMap[j], fElemMap[k],
                                        subGroupHandler)) {
                            if (fCountingStates != null) {
                                Occurence o = fCountingStates[i];
                                // If "i" is a counting state and exactly one of the transitions
                                // loops back to "i" then the two particles do not overlap if
                                // minOccurs == maxOccurs.
                                if (o != null &&
                                    fTransTable[i][j] == i ^ fTransTable[i][k] == i &&
                                    o.minOccurs == o.maxOccurs) {
                                    conflictTable[j][k] = (byte) -1;
                                    continue;
                                }
                            }
                            conflictTable[j][k] = (byte) 1;
                        }
                        else {
                            conflictTable[j][k] = (byte) -1;
                        }
                    }
                }
            }
        }
    }

    // report all errors
    for (int i = 0; i < fElemMapSize; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            if (conflictTable[i][j] == 1) {
                //errors.newError("cos-nonambig", new Object[]{fElemMap[i].toString(),
                //                                             fElemMap[j].toString()});
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fElemMap[i].toString(),
                                                                          fElemMap[j].toString()});
            }
        }
    }

    // if there is a other or list wildcard, we need to check this CM
    // again, if this grammar is cached.
    for (int i = 0; i < fElemMapSize; i++) {
        if (fElemMapType[i] == XSParticleDecl.PARTICLE_WILDCARD) {
            XSWildcardDecl wildcard = (XSWildcardDecl)fElemMap[i];
            if (wildcard.fType == XSWildcardDecl.NSCONSTRAINT_LIST ||
                wildcard.fType == XSWildcardDecl.NSCONSTRAINT_NOT) {
                return true;
            }
        }
    }

    return false;
}
 
Example #22
Source File: XSDFACM.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * check whether this content violates UPA constraint.
 *
 * @param subGroupHandler the substitution group handler
 * @return true if this content model contains other or list wildcard
 */
public boolean checkUniqueParticleAttribution(SubstitutionGroupHandler subGroupHandler) throws XMLSchemaException {
    // Unique Particle Attribution
    // store the conflict results between any two elements in fElemMap
    // 0: not compared; -1: no conflict; 1: conflict
    // initialize the conflict table (all 0 initially)
    byte conflictTable[][] = new byte[fElemMapSize][fElemMapSize];

    // for each state, check whether it has overlap transitions
    for (int i = 0; i < fTransTable.length && fTransTable[i] != null; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            for (int k = j+1; k < fElemMapSize; k++) {
                if (fTransTable[i][j] != -1 &&
                    fTransTable[i][k] != -1) {
                    if (conflictTable[j][k] == 0) {
                        if (XSConstraints.overlapUPA
                                (fElemMap[j], fElemMap[k],
                                        subGroupHandler)) {
                            if (fCountingStates != null) {
                                Occurence o = fCountingStates[i];
                                // If "i" is a counting state and exactly one of the transitions
                                // loops back to "i" then the two particles do not overlap if
                                // minOccurs == maxOccurs.
                                if (o != null &&
                                    fTransTable[i][j] == i ^ fTransTable[i][k] == i &&
                                    o.minOccurs == o.maxOccurs) {
                                    conflictTable[j][k] = (byte) -1;
                                    continue;
                                }
                            }
                            conflictTable[j][k] = (byte) 1;
                        }
                        else {
                            conflictTable[j][k] = (byte) -1;
                        }
                    }
                }
            }
        }
    }

    // report all errors
    for (int i = 0; i < fElemMapSize; i++) {
        for (int j = 0; j < fElemMapSize; j++) {
            if (conflictTable[i][j] == 1) {
                //errors.newError("cos-nonambig", new Object[]{fElemMap[i].toString(),
                //                                             fElemMap[j].toString()});
                // REVISIT: do we want to report all errors? or just one?
                throw new XMLSchemaException("cos-nonambig", new Object[]{fElemMap[i].toString(),
                                                                          fElemMap[j].toString()});
            }
        }
    }

    // if there is a other or list wildcard, we need to check this CM
    // again, if this grammar is cached.
    for (int i = 0; i < fElemMapSize; i++) {
        if (fElemMapType[i] == XSParticleDecl.PARTICLE_WILDCARD) {
            XSWildcardDecl wildcard = (XSWildcardDecl)fElemMap[i];
            if (wildcard.fType == XSWildcardDecl.NSCONSTRAINT_LIST ||
                wildcard.fType == XSWildcardDecl.NSCONSTRAINT_NOT) {
                return true;
            }
        }
    }

    return false;
}