src/com/sun/org/apache/xerces/internal/xpointer/ElementSchemePointer.java

Print this page

        

*** 1,15 **** /* * reserved comment block * DO NOT REMOVE OR ALTER! */ /* ! * Copyright 2005 The Apache Software Foundation. ! * ! * Licensed under the Apache License, Version 2.0 (the "License"); ! * you may not use this file except in compliance with the License. ! * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,16 ---- /* * reserved comment block * DO NOT REMOVE OR ALTER! */ /* ! * Licensed to the Apache Software Foundation (ASF) under one or more ! * contributor license agreements. See the NOTICE file distributed with ! * this work for additional information regarding copyright ownership. ! * The ASF licenses this file to You under the Apache License, Version 2.0 ! * (the "License"); you may not use this file except in compliance with ! * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS,
*** 17,27 **** * See the License for the specific language governing permissions and * limitations under the License. */ package com.sun.org.apache.xerces.internal.xpointer; ! import java.util.Hashtable; import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.XMLChar; import com.sun.org.apache.xerces.internal.xni.Augmentations; --- 18,28 ---- * See the License for the specific language governing permissions and * limitations under the License. */ package com.sun.org.apache.xerces.internal.xpointer; ! import java.util.HashMap; import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.XMLChar; import com.sun.org.apache.xerces.internal.xni.Augmentations;
*** 36,48 **** * </p> * * @xerces.internal * * @version $Id: ElementSchemePointer.java,v 1.4 2009/06/11 23:51:50 joehw Exp $ - * */ ! class ElementSchemePointer implements XPointerPart { // Fields // The Scheme Name i.e element private String fSchemeName; --- 37,48 ---- * </p> * * @xerces.internal * * @version $Id: ElementSchemePointer.java,v 1.4 2009/06/11 23:51:50 joehw Exp $ */ ! final class ElementSchemePointer implements XPointerPart { // Fields // The Scheme Name i.e element private String fSchemeName;
*** 344,362 **** fCurrentChildSequence[fCurrentChildDepth] = fCurrentChildPosition; fCurrentChildPosition++; // Donot check for empty elements if the empty element is // a child of a found parent element - //if (!fIsElementFound) { if (checkMatch()) { ! fIsElementFound = true; fWasOnlyEmptyElementFound = true; } else { fIsElementFound = false; } - //} - } } return fIsElementFound; } --- 344,364 ---- fCurrentChildSequence[fCurrentChildDepth] = fCurrentChildPosition; fCurrentChildPosition++; // Donot check for empty elements if the empty element is // a child of a found parent element if (checkMatch()) { ! if (!fIsElementFound) { fWasOnlyEmptyElementFound = true; } else { + fWasOnlyEmptyElementFound = false; + } + fIsElementFound = true; + } else { fIsElementFound = false; + fWasOnlyEmptyElementFound = false; } } } return fIsElementFound; }
*** 524,534 **** // Current token position private int fCurrentTokenIndex; private SymbolTable fSymbolTable; ! private Hashtable fTokenNames = new Hashtable(); /** * Constructor * * @param symbolTable SymbolTable --- 526,536 ---- // Current token position private int fCurrentTokenIndex; private SymbolTable fSymbolTable; ! private HashMap<Integer, String> fTokenNames = new HashMap<>(); /** * Constructor * * @param symbolTable SymbolTable
*** 546,580 **** * Returns the token String * @param token The index of the token * @return String The token string */ private String getTokenString(int token) { ! return (String) fTokenNames.get(new Integer(token)); ! } ! ! /** ! * Returns the token String ! * @param token The index of the token ! * @return String The token string ! */ ! private Integer getToken(int token) { ! return (Integer) fTokenNames.get(new Integer(token)); } /** * Add the specified string as a token * * @param token The token string */ private void addToken(String tokenStr) { ! Integer tokenInt = (Integer) fTokenNames.get(tokenStr); ! if (tokenInt == null) { ! tokenInt = new Integer(fTokenNames.size()); fTokenNames.put(tokenInt, tokenStr); - } addToken(tokenInt.intValue()); } /** * Add the specified int token * * @param token The int specifying the token --- 548,572 ---- * Returns the token String * @param token The index of the token * @return String The token string */ private String getTokenString(int token) { ! return fTokenNames.get(new Integer(token)); } /** * Add the specified string as a token * * @param token The token string */ private void addToken(String tokenStr) { ! if (!fTokenNames.containsValue(tokenStr)) { ! Integer tokenInt = new Integer(fTokenNames.size()); fTokenNames.put(tokenInt, tokenStr); addToken(tokenInt.intValue()); } + } /** * Add the specified int token * * @param token The int specifying the token