com.sun.org.apache.xerces.internal.xs.ShortList Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.xs.ShortList. 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: Field.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private ShortList convertToPrimitiveKind(ShortList itemValueType) {
    if (itemValueType != null) {
        int i;
        final int length = itemValueType.getLength();
        for (i = 0; i < length; ++i) {
            short type = itemValueType.item(i);
            if (type != convertToPrimitiveKind(type)) {
                break;
            }
        }
        if (i != length) {
            final short [] arr = new short[length];
            for (int j = 0; j < i; ++j) {
                arr[j] = itemValueType.item(j);
            }
            for(; i < length; ++i) {
                arr[i] = convertToPrimitiveKind(itemValueType.item(i));
            }
            return new ShortListImpl(arr, arr.length);
        }
    }
    return itemValueType;
}
 
Example #2
Source File: ShortListImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public boolean equals(Object obj) {
    if (obj == null || !(obj instanceof ShortList)) {
        return false;
    }
    ShortList rhs = (ShortList)obj;

    if (fLength != rhs.getLength()) {
        return false;
    }
    for (int i = 0;i < fLength; ++i) {
        if (fArray[i] != rhs.item(i)) {
            return false;
        }
    }
    return true;
}
 
Example #3
Source File: ShortListImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public boolean equals(Object obj) {
    if (obj == null || !(obj instanceof ShortList)) {
        return false;
    }
    ShortList rhs = (ShortList)obj;

    if (fLength != rhs.getLength()) {
        return false;
    }
    for (int i = 0;i < fLength; ++i) {
        if (fArray[i] != rhs.item(i)) {
            return false;
        }
    }
    return true;
}
 
Example #4
Source File: Field.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private ShortList convertToPrimitiveKind(ShortList itemValueType) {
    if (itemValueType != null) {
        int i;
        final int length = itemValueType.getLength();
        for (i = 0; i < length; ++i) {
            short type = itemValueType.item(i);
            if (type != convertToPrimitiveKind(type)) {
                break;
            }
        }
        if (i != length) {
            final short [] arr = new short[length];
            for (int j = 0; j < i; ++j) {
                arr[j] = itemValueType.item(j);
            }
            for(; i < length; ++i) {
                arr[i] = convertToPrimitiveKind(itemValueType.item(i));
            }
            return new ShortListImpl(arr, arr.length);
        }
    }
    return itemValueType;
}
 
Example #5
Source File: Field.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private ShortList convertToPrimitiveKind(ShortList itemValueType) {
    if (itemValueType != null) {
        int i;
        final int length = itemValueType.getLength();
        for (i = 0; i < length; ++i) {
            short type = itemValueType.item(i);
            if (type != convertToPrimitiveKind(type)) {
                break;
            }
        }
        if (i != length) {
            final short [] arr = new short[length];
            for (int j = 0; j < i; ++j) {
                arr[j] = itemValueType.item(j);
            }
            for(; i < length; ++i) {
                arr[i] = convertToPrimitiveKind(itemValueType.item(i));
            }
            return new ShortListImpl(arr, arr.length);
        }
    }
    return itemValueType;
}
 
Example #6
Source File: Field.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private ShortList convertToPrimitiveKind(ShortList itemValueType) {
    if (itemValueType != null) {
        int i;
        final int length = itemValueType.getLength();
        for (i = 0; i < length; ++i) {
            short type = itemValueType.item(i);
            if (type != convertToPrimitiveKind(type)) {
                break;
            }
        }
        if (i != length) {
            final short [] arr = new short[length];
            for (int j = 0; j < i; ++j) {
                arr[j] = itemValueType.item(j);
            }
            for(; i < length; ++i) {
                arr[i] = convertToPrimitiveKind(itemValueType.item(i));
            }
            return new ShortListImpl(arr, arr.length);
        }
    }
    return itemValueType;
}
 
Example #7
Source File: Field.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private ShortList convertToPrimitiveKind(ShortList itemValueType) {
    if (itemValueType != null) {
        int i;
        final int length = itemValueType.getLength();
        for (i = 0; i < length; ++i) {
            short type = itemValueType.item(i);
            if (type != convertToPrimitiveKind(type)) {
                break;
            }
        }
        if (i != length) {
            final short [] arr = new short[length];
            for (int j = 0; j < i; ++j) {
                arr[j] = itemValueType.item(j);
            }
            for(; i < length; ++i) {
                arr[i] = convertToPrimitiveKind(itemValueType.item(i));
            }
            return new ShortListImpl(arr, arr.length);
        }
    }
    return itemValueType;
}
 
Example #8
Source File: Field.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private ShortList convertToPrimitiveKind(ShortList itemValueType) {
    if (itemValueType != null) {
        int i;
        final int length = itemValueType.getLength();
        for (i = 0; i < length; ++i) {
            short type = itemValueType.item(i);
            if (type != convertToPrimitiveKind(type)) {
                break;
            }
        }
        if (i != length) {
            final short [] arr = new short[length];
            for (int j = 0; j < i; ++j) {
                arr[j] = itemValueType.item(j);
            }
            for(; i < length; ++i) {
                arr[i] = convertToPrimitiveKind(itemValueType.item(i));
            }
            return new ShortListImpl(arr, arr.length);
        }
    }
    return itemValueType;
}
 
Example #9
Source File: ShortListImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public boolean equals(Object obj) {
    if (obj == null || !(obj instanceof ShortList)) {
        return false;
    }
    ShortList rhs = (ShortList)obj;

    if (fLength != rhs.getLength()) {
        return false;
    }
    for (int i = 0;i < fLength; ++i) {
        if (fArray[i] != rhs.item(i)) {
            return false;
        }
    }
    return true;
}
 
Example #10
Source File: ShortListImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public boolean equals(Object obj) {
    if (obj == null || !(obj instanceof ShortList)) {
        return false;
    }
    ShortList rhs = (ShortList)obj;

    if (fLength != rhs.getLength()) {
        return false;
    }
    for (int i = 0;i < fLength; ++i) {
        if (fArray[i] != rhs.item(i)) {
            return false;
        }
    }
    return true;
}
 
Example #11
Source File: Field.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private ShortList convertToPrimitiveKind(ShortList itemValueType) {
    if (itemValueType != null) {
        int i;
        final int length = itemValueType.getLength();
        for (i = 0; i < length; ++i) {
            short type = itemValueType.item(i);
            if (type != convertToPrimitiveKind(type)) {
                break;
            }
        }
        if (i != length) {
            final short [] arr = new short[length];
            for (int j = 0; j < i; ++j) {
                arr[j] = itemValueType.item(j);
            }
            for(; i < length; ++i) {
                arr[i] = convertToPrimitiveKind(itemValueType.item(i));
            }
            return new ShortListImpl(arr, arr.length);
        }
    }
    return itemValueType;
}
 
Example #12
Source File: Selector.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object actualValue, short valueType, ShortList itemValueType) {
    super.endElement(element, type, nillable, actualValue, valueType, itemValueType);
    if (fElementDepth-- == fMatchedDepth) {
        fMatchedDepth = -1;
        fFieldActivator.endValueScopeFor(fIdentityConstraint, fInitialDepth);
    }
}
 
Example #13
Source File: XMLSchemaValidator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if this value store contains the locally scoped value stores
 */
public boolean contains() {
    // REVISIT: we can improve performance by using hash codes, instead of
    // traversing global vector that could be quite large.
    int next = 0;
    final int size = fValues.size();
    LOOP : for (int i = 0; i < size; i = next) {
        next = i + fFieldCount;
        for (int j = 0; j < fFieldCount; j++) {
            Object value1 = fLocalValues[j];
            Object value2 = fValues.elementAt(i);
            short valueType1 = fLocalValueTypes[j];
            short valueType2 = getValueTypeAt(i);
            if (value1 == null || value2 == null || valueType1 != valueType2 || !(value1.equals(value2))) {
                continue LOOP;
            }
            else if(valueType1 == XSConstants.LIST_DT || valueType1 == XSConstants.LISTOFUNION_DT) {
                ShortList list1 = fLocalItemValueTypes[j];
                ShortList list2 = getItemValueTypeAt(i);
                if(list1 == null || list2 == null || !list1.equals(list2))
                    continue LOOP;
            }
            i++;
        }
        // found it
        return true;
    }
    // didn't find it
    return false;
}
 
Example #14
Source File: Field.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method is called when the XPath handler matches the
 * XPath expression.
 */
protected void matched(Object actualValue, short valueType, ShortList itemValueType, boolean isNil) {
    super.matched(actualValue, valueType, itemValueType, isNil);
    if(isNil && (fIdentityConstraint.getCategory() == IdentityConstraint.IC_KEY)) {
        String code = "KeyMatchesNillable";
        fStore.reportError(code,
            new Object[]{fIdentityConstraint.getElementName(), fIdentityConstraint.getIdentityConstraintName()});
    }
    fStore.addValue(Field.this, actualValue, convertToPrimitiveKind(valueType), convertToPrimitiveKind(itemValueType));
    // once we've stored the value for this field, we set the mayMatch
    // member to false so that, in the same scope, we don't match any more
    // values (and throw an error instead).
    fFieldActivator.setMayMatch(Field.this, Boolean.FALSE);
}
 
Example #15
Source File: Selector.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object actualValue, short valueType, ShortList itemValueType) {
    super.endElement(element, type, nillable, actualValue, valueType, itemValueType);
    if (fElementDepth-- == fMatchedDepth) {
        fMatchedDepth = -1;
        fFieldActivator.endValueScopeFor(fIdentityConstraint, fInitialDepth);
    }
}
 
Example #16
Source File: XPathMatcher.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
   * @param element
   *        name of the element.
   * @param type
   *        content type of this element. IOW, the XML schema type
   *        of the <tt>value</tt>. Note that this may not be the type declared
   *        in the element declaration, but it is "the actual type". For example,
   *        if the XML is &lt;foo xsi:type="xs:string">aaa&lt;/foo>, this
   *        parameter will be "xs:string".
   * @param nillable - nillable
   *        true if the element declaration is nillable.
   * @param value - actual value
   *        the typed value of the content of this element.
   */
public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object value, short valueType, ShortList itemValueType) {
    if (DEBUG_METHODS2) {
        System.out.println(toString()+"#endElement("+
                           "element={"+element+"},"+
                           ")");
    }
    for(int i = 0; i<fLocationPaths.length; i++) {
        // go back a step
        fCurrentStep[i] = fStepIndexes[i].pop();

        // don't do anything, if not matching
        if (fNoMatchDepth[i] > 0) {
            fNoMatchDepth[i]--;
        }

        // signal match, if appropriate
        else {
            int j=0;
            for(; j<i && ((fMatched[j] & MATCHED) != MATCHED); j++);
            if ((j<i) || (fMatched[j] == 0) ||
                    ((fMatched[j] & MATCHED_ATTRIBUTE) == MATCHED_ATTRIBUTE)) {
                continue;
            }
            // only certain kinds of matchers actually
            // match element content.  This permits
            // them a way to override this to do nothing
            // and hopefully save a few operations.
            handleContent(type, nillable, value, valueType, itemValueType);
            fMatched[i] = 0;
        }

        if (DEBUG_STACK) {
            System.out.println(toString()+": "+fStepIndexes[i]);
        }
    }

}
 
Example #17
Source File: XMLSchemaValidator.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private boolean itemValueTypeContains(ShortList value) {
    if (fUseItemValueTypeVector) {
        return fItemValueTypes.contains(value);
    }
    return fItemValueType == value ||
        (fItemValueType != null && fItemValueType.equals(value));
}
 
Example #18
Source File: Field.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected void handleContent(XSTypeDefinition type, boolean nillable, Object actualValue, short valueType, ShortList itemValueType) {
    if (type == null ||
       type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE &&
       ((XSComplexTypeDefinition) type).getContentType()
        != XSComplexTypeDefinition.CONTENTTYPE_SIMPLE) {

            // the content must be simpleType content
            fStore.reportError( "cvc-id.3", new Object[] {
                    fIdentityConstraint.getName(),
                    fIdentityConstraint.getElementName()});

    }
    fMatchedString = actualValue;
    matched(fMatchedString, valueType, itemValueType, nillable);
}
 
Example #19
Source File: XPathMatcher.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
   * @param element
   *        name of the element.
   * @param type
   *        content type of this element. IOW, the XML schema type
   *        of the <tt>value</tt>. Note that this may not be the type declared
   *        in the element declaration, but it is "the actual type". For example,
   *        if the XML is &lt;foo xsi:type="xs:string">aaa&lt;/foo>, this
   *        parameter will be "xs:string".
   * @param nillable - nillable
   *        true if the element declaration is nillable.
   * @param value - actual value
   *        the typed value of the content of this element.
   */
public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object value, short valueType, ShortList itemValueType) {
    if (DEBUG_METHODS2) {
        System.out.println(toString()+"#endElement("+
                           "element={"+element+"},"+
                           ")");
    }
    for(int i = 0; i<fLocationPaths.length; i++) {
        // go back a step
        fCurrentStep[i] = fStepIndexes[i].pop();

        // don't do anything, if not matching
        if (fNoMatchDepth[i] > 0) {
            fNoMatchDepth[i]--;
        }

        // signal match, if appropriate
        else {
            int j=0;
            for(; j<i && ((fMatched[j] & MATCHED) != MATCHED); j++);
            if ((j<i) || (fMatched[j] == 0) ||
                    ((fMatched[j] & MATCHED_ATTRIBUTE) == MATCHED_ATTRIBUTE)) {
                continue;
            }
            // only certain kinds of matchers actually
            // match element content.  This permits
            // them a way to override this to do nothing
            // and hopefully save a few operations.
            handleContent(type, nillable, value, valueType, itemValueType);
            fMatched[i] = 0;
        }

        if (DEBUG_STACK) {
            System.out.println(toString()+": "+fStepIndexes[i]);
        }
    }

}
 
Example #20
Source File: ValidatedInfo.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Returns true if the two ValidatedInfo objects can be compared in the same
 * value space.
 */
public static boolean isComparable(ValidatedInfo info1, ValidatedInfo info2) {
    final short primitiveType1 = convertToPrimitiveKind(info1.actualValueType);
    final short primitiveType2 = convertToPrimitiveKind(info2.actualValueType);
    if (primitiveType1 != primitiveType2) {
        return (primitiveType1 == XSConstants.ANYSIMPLETYPE_DT && primitiveType2 == XSConstants.STRING_DT ||
                primitiveType1 == XSConstants.STRING_DT && primitiveType2 == XSConstants.ANYSIMPLETYPE_DT);
    }
    else if (primitiveType1 == XSConstants.LIST_DT || primitiveType1 == XSConstants.LISTOFUNION_DT) {
        final ShortList typeList1 = info1.itemValueTypes;
        final ShortList typeList2 = info2.itemValueTypes;
        final int typeList1Length = typeList1 != null ? typeList1.getLength() : 0;
        final int typeList2Length = typeList2 != null ? typeList2.getLength() : 0;
        if (typeList1Length != typeList2Length) {
            return false;
        }
        for (int i = 0; i < typeList1Length; ++i) {
            final short primitiveItem1 = convertToPrimitiveKind(typeList1.item(i));
            final short primitiveItem2 = convertToPrimitiveKind(typeList2.item(i));
            if (primitiveItem1 != primitiveItem2) {
                if (primitiveItem1 == XSConstants.ANYSIMPLETYPE_DT && primitiveItem2 == XSConstants.STRING_DT ||
                    primitiveItem1 == XSConstants.STRING_DT && primitiveItem2 == XSConstants.ANYSIMPLETYPE_DT) {
                    continue;
                }
                return false;
            }
        }
    }
    return true;
}
 
Example #21
Source File: Field.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * This method is called when the XPath handler matches the
 * XPath expression.
 */
protected void matched(Object actualValue, short valueType, ShortList itemValueType, boolean isNil) {
    super.matched(actualValue, valueType, itemValueType, isNil);
    if(isNil && (fIdentityConstraint.getCategory() == IdentityConstraint.IC_KEY)) {
        String code = "KeyMatchesNillable";
        fStore.reportError(code,
            new Object[]{fIdentityConstraint.getElementName(), fIdentityConstraint.getIdentityConstraintName()});
    }
    fStore.addValue(Field.this, actualValue, convertToPrimitiveKind(valueType), convertToPrimitiveKind(itemValueType));
    // once we've stored the value for this field, we set the mayMatch
    // member to false so that, in the same scope, we don't match any more
    // values (and throw an error instead).
    fFieldActivator.setMayMatch(Field.this, Boolean.FALSE);
}
 
Example #22
Source File: Selector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object actualValue, short valueType, ShortList itemValueType) {
    super.endElement(element, type, nillable, actualValue, valueType, itemValueType);
    if (fElementDepth-- == fMatchedDepth) {
        fMatchedDepth = -1;
        fFieldActivator.endValueScopeFor(fIdentityConstraint, fInitialDepth);
    }
}
 
Example #23
Source File: XMLSchemaValidator.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns true if this value store contains the locally scoped value stores
 */
public boolean contains() {
    // REVISIT: we can improve performance by using hash codes, instead of
    // traversing global vector that could be quite large.
    int next = 0;
    final int size = fValues.size();
    LOOP : for (int i = 0; i < size; i = next) {
        next = i + fFieldCount;
        for (int j = 0; j < fFieldCount; j++) {
            Object value1 = fLocalValues[j];
            Object value2 = fValues.elementAt(i);
            short valueType1 = fLocalValueTypes[j];
            short valueType2 = getValueTypeAt(i);
            if (value1 == null || value2 == null || valueType1 != valueType2 || !(value1.equals(value2))) {
                continue LOOP;
            }
            else if(valueType1 == XSConstants.LIST_DT || valueType1 == XSConstants.LISTOFUNION_DT) {
                ShortList list1 = fLocalItemValueTypes[j];
                ShortList list2 = getItemValueTypeAt(i);
                if(list1 == null || list2 == null || !list1.equals(list2))
                    continue LOOP;
            }
            i++;
        }
        // found it
        return true;
    }
    // didn't find it
    return false;
}
 
Example #24
Source File: XMLSchemaValidator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Constructs a value store for the specified identity constraint. */
protected ValueStoreBase(IdentityConstraint identityConstraint) {
    fIdentityConstraint = identityConstraint;
    fFieldCount = fIdentityConstraint.getFieldCount();
    fFields = new Field[fFieldCount];
    fLocalValues = new Object[fFieldCount];
    fLocalValueTypes = new short[fFieldCount];
    fLocalItemValueTypes = new ShortList[fFieldCount];
    for (int i = 0; i < fFieldCount; i++) {
        fFields[i] = fIdentityConstraint.getFieldAt(i);
    }
}
 
Example #25
Source File: XMLSchemaValidator.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean itemValueTypeContains(ShortList value) {
    if (fUseItemValueTypeVector) {
        return fItemValueTypes.contains(value);
    }
    return fItemValueType == value ||
        (fItemValueType != null && fItemValueType.equals(value));
}
 
Example #26
Source File: XPathMatcher.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
   * @param element
   *        name of the element.
   * @param type
   *        content type of this element. IOW, the XML schema type
   *        of the <tt>value</tt>. Note that this may not be the type declared
   *        in the element declaration, but it is "the actual type". For example,
   *        if the XML is &lt;foo xsi:type="xs:string">aaa&lt;/foo>, this
   *        parameter will be "xs:string".
   * @param nillable - nillable
   *        true if the element declaration is nillable.
   * @param value - actual value
   *        the typed value of the content of this element.
   */
public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object value, short valueType, ShortList itemValueType) {
    if (DEBUG_METHODS2) {
        System.out.println(toString()+"#endElement("+
                           "element={"+element+"},"+
                           ")");
    }
    for(int i = 0; i<fLocationPaths.length; i++) {
        // go back a step
        fCurrentStep[i] = fStepIndexes[i].pop();

        // don't do anything, if not matching
        if (fNoMatchDepth[i] > 0) {
            fNoMatchDepth[i]--;
        }

        // signal match, if appropriate
        else {
            int j=0;
            for(; j<i && ((fMatched[j] & MATCHED) != MATCHED); j++);
            if ((j<i) || (fMatched[j] == 0) ||
                    ((fMatched[j] & MATCHED_ATTRIBUTE) == MATCHED_ATTRIBUTE)) {
                continue;
            }
            // only certain kinds of matchers actually
            // match element content.  This permits
            // them a way to override this to do nothing
            // and hopefully save a few operations.
            handleContent(type, nillable, value, valueType, itemValueType);
            fMatched[i] = 0;
        }

        if (DEBUG_STACK) {
            System.out.println(toString()+": "+fStepIndexes[i]);
        }
    }

}
 
Example #27
Source File: Field.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method is called when the XPath handler matches the
 * XPath expression.
 */
protected void matched(Object actualValue, short valueType, ShortList itemValueType, boolean isNil) {
    super.matched(actualValue, valueType, itemValueType, isNil);
    if(isNil && (fIdentityConstraint.getCategory() == IdentityConstraint.IC_KEY)) {
        String code = "KeyMatchesNillable";
        fStore.reportError(code,
            new Object[]{fIdentityConstraint.getElementName(), fIdentityConstraint.getIdentityConstraintName()});
    }
    fStore.addValue(Field.this, actualValue, convertToPrimitiveKind(valueType), convertToPrimitiveKind(itemValueType));
    // once we've stored the value for this field, we set the mayMatch
    // member to false so that, in the same scope, we don't match any more
    // values (and throw an error instead).
    fFieldActivator.setMayMatch(Field.this, Boolean.FALSE);
}
 
Example #28
Source File: XMLSchemaValidator.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/** Constructs a value store for the specified identity constraint. */
protected ValueStoreBase(IdentityConstraint identityConstraint) {
    fIdentityConstraint = identityConstraint;
    fFieldCount = fIdentityConstraint.getFieldCount();
    fFields = new Field[fFieldCount];
    fLocalValues = new Object[fFieldCount];
    fLocalValueTypes = new short[fFieldCount];
    fLocalItemValueTypes = new ShortList[fFieldCount];
    for (int i = 0; i < fFieldCount; i++) {
        fFields[i] = fIdentityConstraint.getFieldAt(i);
    }
}
 
Example #29
Source File: XPathMatcher.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
   * @param element
   *        name of the element.
   * @param type
   *        content type of this element. IOW, the XML schema type
   *        of the <tt>value</tt>. Note that this may not be the type declared
   *        in the element declaration, but it is "the actual type". For example,
   *        if the XML is &lt;foo xsi:type="xs:string">aaa&lt;/foo>, this
   *        parameter will be "xs:string".
   * @param nillable - nillable
   *        true if the element declaration is nillable.
   * @param value - actual value
   *        the typed value of the content of this element.
   */
public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object value, short valueType, ShortList itemValueType) {
    if (DEBUG_METHODS2) {
        System.out.println(toString()+"#endElement("+
                           "element={"+element+"},"+
                           ")");
    }
    for(int i = 0; i<fLocationPaths.length; i++) {
        // go back a step
        fCurrentStep[i] = fStepIndexes[i].pop();

        // don't do anything, if not matching
        if (fNoMatchDepth[i] > 0) {
            fNoMatchDepth[i]--;
        }

        // signal match, if appropriate
        else {
            int j=0;
            for(; j<i && ((fMatched[j] & MATCHED) != MATCHED); j++);
            if ((j<i) || (fMatched[j] == 0) ||
                    ((fMatched[j] & MATCHED_ATTRIBUTE) == MATCHED_ATTRIBUTE)) {
                continue;
            }
            // only certain kinds of matchers actually
            // match element content.  This permits
            // them a way to override this to do nothing
            // and hopefully save a few operations.
            handleContent(type, nillable, value, valueType, itemValueType);
            fMatched[i] = 0;
        }

        if (DEBUG_STACK) {
            System.out.println(toString()+": "+fStepIndexes[i]);
        }
    }

}
 
Example #30
Source File: XSSimpleTypeDecl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A list of enumeration type values (as a list of ShortList objects) if it exists, otherwise returns
 * null
 */
public ObjectList getEnumerationItemTypeList() {
    if (fEnumerationItemTypeList == null) {
        if(fEnumerationItemType == null)
            return null;
        fEnumerationItemTypeList = new AbstractObjectList() {
            public int getLength() {
                return (fEnumerationItemType != null) ? fEnumerationItemType.length : 0;
            }
            public boolean contains(Object item) {
                if(fEnumerationItemType == null || !(item instanceof ShortList))
                    return false;
                for(int i = 0;i < fEnumerationItemType.length; i++)
                    if(fEnumerationItemType[i] == item)
                        return true;
                return false;
            }
            public Object item(int index) {
                if (index < 0 || index >= getLength()) {
                    return null;
                }
                return fEnumerationItemType[index];
            }
        };
    }
    return fEnumerationItemTypeList;
}