< prev index next >
jdk/src/java.base/share/classes/sun/text/normalizer/Trie.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -20,20 +20,16 @@
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *******************************************************************************
- * (C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved *
- * *
- * The original version of this source code and documentation is copyrighted *
- * and owned by IBM, These materials are provided under terms of a License *
- * Agreement between IBM and Sun. This technology is protected by multiple *
- * US and International patents. This notice and attribution to IBM may not *
- * to removed. *
- *******************************************************************************
+ ******************************************************************************
+ * Copyright (C) 1996-2014, International Business Machines Corporation and
+ * others. All Rights Reserved.
+ ******************************************************************************
*/
package sun.text.normalizer;
import java.io.DataInputStream;
@@ -133,31 +129,10 @@
m_dataOffset_ = input.readInt();
m_dataLength_ = input.readInt();
unserialize(inputStream);
}
- /**
- * Trie constructor
- * @param index array to be used for index
- * @param options used by the trie
- * @param dataManipulate object containing the information to parse the
- * trie data
- */
- protected Trie(char index[], int options, DataManipulate dataManipulate)
- {
- m_options_ = options;
- if(dataManipulate != null) {
- m_dataManipulate_ = dataManipulate;
- } else {
- m_dataManipulate_ = new DefaultGetFoldingOffset();
- }
- m_isLatin1Linear_ = (m_options_ &
- HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_) != 0;
- m_index_ = index;
- m_dataOffset_ = m_index_.length;
- }
-
// protected data members ------------------------------------------
/**
* Lead surrogate code points' index displacement in the index array.
* <pre>{@code
@@ -186,20 +161,10 @@
/**
* Mask for getting the lower bits from the input index.
* DATA_BLOCK_LENGTH - 1.
*/
protected static final int INDEX_STAGE_3_MASK_ = DATA_BLOCK_LENGTH - 1;
- /** Number of bits of a trail surrogate that are used in index table lookups. */
- protected static final int SURROGATE_BLOCK_BITS=10-INDEX_STAGE_1_SHIFT_;
- /**
- * Number of index (stage 1) entries per lead surrogate.
- * Same as number of index entries for 1024 trail surrogates,
- * {@code ==0x400>>INDEX_STAGE_1_SHIFT_}
- */
- protected static final int SURROGATE_BLOCK_COUNT=(1<<SURROGATE_BLOCK_BITS);
- /** Length of the BMP portion of the index (stage 1) array. */
- protected static final int BMP_INDEX_LENGTH=0x10000>>INDEX_STAGE_1_SHIFT_;
/**
* Surrogate mask to use when shifting offset to retrieve supplementary
* values
*/
protected static final int SURROGATE_MASK_ = 0x3FF;
@@ -233,23 +198,10 @@
* @return offset to data
*/
protected abstract int getSurrogateOffset(char lead, char trail);
/**
- * Gets the value at the argument index
- * @param index value at index will be retrieved
- * @return 32 bit value
- */
- protected abstract int getValue(int index);
-
- /**
- * Gets the default initial value
- * @return 32 bit value
- */
- protected abstract int getInitialValue();
-
- /**
* Gets the offset to the data which the index ch after variable offset
* points to.
* Note for locating a non-supplementary character data offset, calling
* <p>
* getRawOffset(0, ch);
@@ -319,11 +271,11 @@
// look at the construction of supplementary characters
// trail forms the ends of it.
return getSurrogateOffset(UTF16.getLeadSurrogate(ch),
(char)(ch & SURROGATE_MASK_));
} else {
- // return -1 // if there is an error, in this case we return
+ // return -1 if there is an error, in this case we return
return -1;
}
}
/**
@@ -341,19 +293,10 @@
m_index_[i] = input.readChar();
}
}
/**
- * Determines if this is a 32 bit trie
- * @return true if options specifies this is a 32 bit trie
- */
- protected final boolean isIntTrie()
- {
- return (m_options_ & HEADER_OPTIONS_DATA_IS_32_BIT_) != 0;
- }
-
- /**
* Determines if this is a 16 bit trie
* @return true if this is a 16 bit trie
*/
protected final boolean isCharTrie()
{
< prev index next >