diff --git src/org/eclipse/equinox/bidi/STextEngine.java src/org/eclipse/equinox/bidi/STextEngine.java index 512e28b..0bc0021 100644 --- src/org/eclipse/equinox/bidi/STextEngine.java +++ src/org/eclipse/equinox/bidi/STextEngine.java @@ -10,7 +10,6 @@ ******************************************************************************/ package org.eclipse.equinox.bidi; -import org.eclipse.equinox.bidi.custom.STextDirections; import org.eclipse.equinox.bidi.custom.STextProcessor; import org.eclipse.equinox.bidi.internal.STextImpl; @@ -313,7 +312,7 @@ public static int getCurDirection(STextProcessor processor, STextEnvironment environment, String text) { if (processor == null) return DIR_LTR; - return processor.getDirection(environment, text, new STextDirections(text)); + return processor.getDirection(environment, text); } } diff --git src/org/eclipse/equinox/bidi/custom/STextCharTypes.java src/org/eclipse/equinox/bidi/custom/STextCharTypes.java new file mode 0 index 0000000..50d768d 0 --- /dev/null +++ src/org/eclipse/equinox/bidi/custom/STextCharTypes.java @@ -0,0 +1,118 @@ +/******************************************************************************* + * Copyright (c) 2011 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ +package org.eclipse.equinox.bidi.custom; + +import org.eclipse.equinox.bidi.STextEnvironment; + +/** + * The class determines bidirectional types of characters in a string. + */ +public class STextCharTypes { + + // In the following lines, B, L, R and AL represent bidi categories + // as defined in the Unicode Bidirectional Algorithm + // ( http://www.unicode.org/reports/tr9/ ). + // B represents the category Block Separator. + // L represents the category Left to Right character. + // R represents the category Right to Left character. + // AL represents the category Arabic Letter. + // AN represents the category Arabic Number. + // EN represents the category European Number. + static final byte B = Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR; + static final byte L = Character.DIRECTIONALITY_LEFT_TO_RIGHT; + static final byte R = Character.DIRECTIONALITY_RIGHT_TO_LEFT; + static final byte AL = Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC; + static final byte AN = Character.DIRECTIONALITY_ARABIC_NUMBER; + static final byte EN = Character.DIRECTIONALITY_EUROPEAN_NUMBER; + + private static final int DIRPROPS_ADD = 2; + + final protected String text; + + // 1 byte for each char in text + private byte[] dirProps; + + // current orientation + private int orientation = -1; // "-1" means "unknown" + + public STextCharTypes(String text) { + this.text = text; + dirProps = new byte[text.length()]; + } + + private byte getCachedDirectionAt(int index) { + return (byte) (dirProps[index] - DIRPROPS_ADD); + } + + private boolean hasCachedDirectionAt(int i) { + return (dirProps[i] != 0); // "0" means "unknown" + } + + /** + * @param dirProp bidirectional class of the character. It must be + * one of the values which can be returned by + * java.lang.Character.getDirectionality. + */ + public void setBidiTypeAt(int i, byte dirProp) { + dirProps[i] = (byte) (dirProp + DIRPROPS_ADD); + } + + public int getOrientation(STextEnvironment environment) { + int result; + int orient = environment.getOrientation(); + if ((orient & STextEnvironment.ORIENT_CONTEXTUAL_LTR) == 0) { // absolute orientation + result = orient; + } else { // contextual orientation: + result = orient & 1; // initiate to the default orientation minus contextual bit + int len = text.length(); + byte dirProp; + for (int i = 0; i < len; i++) { + if (!hasCachedDirectionAt(i)) { + dirProp = Character.getDirectionality(text.charAt(i)); + if (dirProp == B) // B char resolves to L or R depending on orientation + continue; + setBidiTypeAt(i, dirProp); + } else { + dirProp = getCachedDirectionAt(i); + } + if (dirProp == L) { + result = STextEnvironment.ORIENT_LTR; + break; + } + if (dirProp == R || dirProp == AL) { + result = STextEnvironment.ORIENT_RTL; + break; + } + } + } + orientation = result; + return result; + } + + /** + * Returns directionality of the character in the original string at + * the specified index. + * @param index position of the character in the lean text + * @return the bidirectional class of the character. It is one of the + * values which can be returned by {@link Character#getDirectionality(char)} + */ + public byte getBidiTypeAt(int index) { + if (hasCachedDirectionAt(index)) + return getCachedDirectionAt(index); + byte dirProp = Character.getDirectionality(text.charAt(index)); + if (dirProp == B) { + dirProp = (orientation == STextEnvironment.ORIENT_RTL) ? R : L; + } + setBidiTypeAt(index, dirProp); + return dirProp; + } + +} diff --git src/org/eclipse/equinox/bidi/custom/STextDirections.java src/org/eclipse/equinox/bidi/custom/STextDirections.java deleted file mode 100644 index bc469bb..0000000 100644 --- src/org/eclipse/equinox/bidi/custom/STextDirections.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - ******************************************************************************/ -package org.eclipse.equinox.bidi.custom; - -import org.eclipse.equinox.bidi.STextEnvironment; - -/** - * The class determines bidirectional types of characters in a string. - */ -public class STextDirections { - - // In the following lines, B, L, R and AL represent bidi categories - // as defined in the Unicode Bidirectional Algorithm - // ( http://www.unicode.org/reports/tr9/ ). - // B represents the category Block Separator. - // L represents the category Left to Right character. - // R represents the category Right to Left character. - // AL represents the category Arabic Letter. - // AN represents the category Arabic Number. - // EN represents the category European Number. - static final byte B = Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR; - static final byte L = Character.DIRECTIONALITY_LEFT_TO_RIGHT; - static final byte R = Character.DIRECTIONALITY_RIGHT_TO_LEFT; - static final byte AL = Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC; - static final byte AN = Character.DIRECTIONALITY_ARABIC_NUMBER; - static final byte EN = Character.DIRECTIONALITY_EUROPEAN_NUMBER; - - private static final int DIRPROPS_ADD = 2; - - final protected String text; - - // 1 byte for each char in text - private byte[] dirProps; - - // current orientation - private byte baseOrientation = 0; // "0" means "unknown" // Mati: 0 is not a good choice for unknown orientation since 0 corresponds to LTR. - - public STextDirections(String text) { - this.text = text; - dirProps = new byte[text.length()]; - } - - private byte getCachedDirectionAt(int index) { - return (byte) (dirProps[index] - DIRPROPS_ADD); - } - - private boolean hasCachedDirectionAt(int i) { - return (dirProps[i] != 0); // "0" means "unknown" - } - - /** - * @param dirProp bidirectional class of the character. It must be - * one of the values which can be returned by - * java.lang.Character.getDirectionality. - */ - public void setBidiTypeAt(int i, byte dirProp) { - dirProps[i] = (byte) (dirProp + DIRPROPS_ADD); - } - - public int getBaseOrientation(STextEnvironment environment) { - int result; - int orient = environment.getOrientation(); - if ((orient & STextEnvironment.ORIENT_CONTEXTUAL_LTR) == 0) { // absolute orientation - result = orient; - } else { // contextual orientation: - result = orient & 1; // initiate to the default orientation minus contextual bit - int len = text.length(); - byte dirProp; - for (int i = 0; i < len; i++) { - if (!hasCachedDirectionAt(i)) { - dirProp = Character.getDirectionality(text.charAt(i)); - if (dirProp == B) // B char resolves to L or R depending on orientation - continue; - setBidiTypeAt(i, dirProp); - } else { - dirProp = getCachedDirectionAt(i); - } - if (dirProp == L) { // TBD || == EN ? - result = STextEnvironment.ORIENT_LTR; - break; - } - if (dirProp == R || dirProp == AL) { - result = STextEnvironment.ORIENT_RTL; - break; - } - } - } - baseOrientation = (byte) result; - return result; - } - - /** - * Returns directionality of the character in the original string at - * the specified index. - * @param index position of the character in the lean text - * @return the bidirectional class of the character. It is one of the - * values which can be returned by {@link Character#getDirectionality(char)} - */ - public byte getBidiTypeAt(int index) { - if (hasCachedDirectionAt(index)) - return getCachedDirectionAt(index); - byte dirProp = Character.getDirectionality(text.charAt(index)); - if (dirProp == B) { - byte orient = baseOrientation; - dirProp = (orient == STextEnvironment.ORIENT_RTL) ? R : L; - } - setBidiTypeAt(index, dirProp); - return dirProp; - } - -} diff --git src/org/eclipse/equinox/bidi/custom/STextProcessor.java src/org/eclipse/equinox/bidi/custom/STextProcessor.java index 481f1a3..f24d84c 100644 --- src/org/eclipse/equinox/bidi/custom/STextProcessor.java +++ src/org/eclipse/equinox/bidi/custom/STextProcessor.java @@ -132,7 +132,7 @@ * number of special cases is zero, which means that * indexOfSpecial should never be called for them. */ - public int indexOfSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int caseNumber, int fromIndex) { + public int indexOfSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int caseNumber, int fromIndex) { // This method must be overridden by all subclasses with special cases. throw new IllegalStateException("A processor with specialsCount > 0 must have an indexOfSpecial() method."); //$NON-NLS-1$ } @@ -216,7 +216,7 @@ * number of special cases is zero, which means that * processSpecial should never be called for them. */ - public int processSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { + public int processSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { // This method must be overridden by all subclasses with any special case. throw new IllegalStateException("A processor with specialsCount > 0 must have a processSpecial() method."); //$NON-NLS-1$ } @@ -252,7 +252,7 @@ * For the benefit of efficiency, it is better to insert * multiple marks in ascending order of the offsets. */ - public static final void insertMark(String text, STextDirections dirProps, int[] offsets, int offset) { + public static final void insertMark(String text, STextCharTypes dirProps, int[] offsets, int offset) { STextImpl.insertMark(text, dirProps, offsets, offset); } @@ -287,7 +287,7 @@ * It must be a non-negative number smaller than the length * of the lean text. */ - public static final void processSeparator(String text, STextDirections dirProps, int[] offsets, int separLocation) { + public static final void processSeparator(String text, STextCharTypes dirProps, int[] offsets, int separLocation) { STextImpl.processSeparator(text, dirProps, offsets, separLocation); } @@ -302,18 +302,37 @@ * null, in which case the * {@link STextEnvironment#DEFAULT DEFAULT} * environment should be assumed. - * - * @param text is the structured text string to process. - * - * @param dirProps is a parameter received uniquely to be used as argument - * for calls to getDirProp and other methods used - * by processors. * * @return a string grouping one-character separators which separate * the structured text into tokens. */ - public String getSeparators(STextEnvironment environment, String text, STextDirections dirProps) { + public String getSeparators(STextEnvironment environment) { return separators; + } + + /** + * Indicate the base text direction appropriate for an instance of structured text. + * This method is invoked before starting the processing. + *

+ * If not overridden, this method returns DIR_LTR. + *

+ * @param environment the current environment, which may affect the behavior of + * the processor. This parameter may be specified as + * null, in which case the + * {@link STextEnvironment#DEFAULT DEFAULT} + * environment should be assumed. + * + * @param text is the structured text string to process. + * + * @return the base direction of the structured text. This direction + * may not be the same depending on the environment and on + * whether the structured text contains Arabic or Hebrew + * letters.
+ * The value returned is either + * {@link STextEngine#DIR_LTR DIR_LTR} or {@link STextEngine#DIR_RTL DIR_RTL}. + */ + public int getDirection(STextEnvironment environment, String text) { + return STextEngine.DIR_LTR; } /** @@ -341,7 +360,7 @@ * The value returned is either * {@link STextEngine#DIR_LTR DIR_LTR} or {@link STextEngine#DIR_RTL DIR_RTL}. */ - public int getDirection(STextEnvironment environment, String text, STextDirections dirProps) { + public int getDirection(STextEnvironment environment, String text, STextCharTypes dirProps) { return STextEngine.DIR_LTR; } @@ -358,12 +377,6 @@ * null, in which case the * {@link STextEnvironment#DEFAULT DEFAULT} * environment should be assumed. - * - * @param text is the structured text string to process. - * - * @param dirProps is a parameter received uniquely to be used as argument - * for calls to getDirProp and other methods used - * by processors. * * @return the number of special cases for the associated processor. * Special cases exist for some types of structured text @@ -373,7 +386,7 @@ * anything which is not identified by a one-character separator. * */ - public int getSpecialsCount(STextEnvironment environment, String text, STextDirections dirProps) { + public int getSpecialsCount(STextEnvironment environment) { return 0; } @@ -402,7 +415,7 @@ * text to add directional formatting characters. * */ - public boolean skipProcessing(STextEnvironment environment, String text, STextDirections dirProps) { + public boolean skipProcessing(STextEnvironment environment, String text, STextCharTypes dirProps) { return false; } diff --git src/org/eclipse/equinox/bidi/internal/STextDelims.java src/org/eclipse/equinox/bidi/internal/STextDelims.java index dd0bc3a..3a0cc7a 100644 --- src/org/eclipse/equinox/bidi/internal/STextDelims.java +++ src/org/eclipse/equinox/bidi/internal/STextDelims.java @@ -11,7 +11,7 @@ package org.eclipse.equinox.bidi.internal; import org.eclipse.equinox.bidi.STextEnvironment; -import org.eclipse.equinox.bidi.custom.STextDirections; +import org.eclipse.equinox.bidi.custom.STextCharTypes; import org.eclipse.equinox.bidi.custom.STextProcessor; /** @@ -44,7 +44,7 @@ * * @see #getDelimiters */ - public int indexOfSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int caseNumber, int fromIndex) { + public int indexOfSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int caseNumber, int fromIndex) { char delim = getDelimiters().charAt((caseNumber - 1) * 2); return text.indexOf(delim, fromIndex); } @@ -59,7 +59,7 @@ * @return the position after the matching end delimiter, or the length * of text if no end delimiter is found. */ - public int processSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { + public int processSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { STextProcessor.processSeparator(text, dirProps, offsets, separLocation); int loc = separLocation + 1; char delim = getDelimiters().charAt((caseNumber * 2) - 1); diff --git src/org/eclipse/equinox/bidi/internal/STextDelimsEsc.java src/org/eclipse/equinox/bidi/internal/STextDelimsEsc.java index 25438e6..e583e9e 100644 --- src/org/eclipse/equinox/bidi/internal/STextDelimsEsc.java +++ src/org/eclipse/equinox/bidi/internal/STextDelimsEsc.java @@ -11,7 +11,7 @@ package org.eclipse.equinox.bidi.internal; import org.eclipse.equinox.bidi.STextEnvironment; -import org.eclipse.equinox.bidi.custom.STextDirections; +import org.eclipse.equinox.bidi.custom.STextCharTypes; import org.eclipse.equinox.bidi.custom.STextProcessor; /** @@ -50,7 +50,7 @@ * and skips until after the matching end delimiter, * ignoring possibly escaped end delimiters. */ - public int processSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { + public int processSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { STextProcessor.processSeparator(text, dirProps, offsets, separLocation); int location = separLocation + 1; char delim = getDelimiters().charAt((caseNumber * 2) - 1); diff --git src/org/eclipse/equinox/bidi/internal/STextImpl.java src/org/eclipse/equinox/bidi/internal/STextImpl.java index a980eee..5a40645 100644 --- src/org/eclipse/equinox/bidi/internal/STextImpl.java +++ src/org/eclipse/equinox/bidi/internal/STextImpl.java @@ -12,7 +12,7 @@ import org.eclipse.equinox.bidi.STextEngine; import org.eclipse.equinox.bidi.STextEnvironment; -import org.eclipse.equinox.bidi.custom.STextDirections; +import org.eclipse.equinox.bidi.custom.STextCharTypes; import org.eclipse.equinox.bidi.custom.STextProcessor; /** @@ -65,10 +65,10 @@ // nothing to do } - static long computeNextLocation(STextProcessor processor, STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int[] locations, int[] state, int curPos) { - String separators = processor.getSeparators(environment, text, dirProps); + static long computeNextLocation(STextProcessor processor, STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int[] locations, int[] state, int curPos) { + String separators = processor.getSeparators(environment); int separCount = separators.length(); - int specialsCount = processor.getSpecialsCount(environment, text, dirProps); + int specialsCount = processor.getSpecialsCount(environment); int len = text.length(); int nextLocation = len; int idxLocation = 0; @@ -107,7 +107,7 @@ /** * @see STextProcessor#processSeparator STextProcessor.processSeparator */ - public static void processSeparator(String text, STextDirections dirProps, int[] offsets, int separLocation) { + public static void processSeparator(String text, STextCharTypes dirProps, int[] offsets, int separLocation) { int len = text.length(); // offsets[2] contains the structured text direction if (offsets[2] == STextEngine.DIR_RTL) { @@ -212,7 +212,7 @@ int len = text.length(); if (len == 0) return text; - STextDirections dirProps = new STextDirections(text); + STextCharTypes dirProps = new STextCharTypes(text); int[] offsets = leanToFullCommon(processor, environment, text, state, dirProps); int prefixLength = offsets[1]; int count = offsets[0] - OFFSETS_SHIFT; @@ -263,7 +263,7 @@ int len = text.length(); if (len == 0) return EMPTY_INT_ARRAY; - STextDirections dirProps = new STextDirections(text); + STextCharTypes dirProps = new STextCharTypes(text); int[] offsets = leanToFullCommon(processor, environment, text, state, dirProps); int prefixLength = offsets[1]; int[] map = new int[len]; @@ -286,7 +286,7 @@ int len = text.length(); if (len == 0) return EMPTY_INT_ARRAY; - STextDirections dirProps = new STextDirections(text); + STextCharTypes dirProps = new STextCharTypes(text); int[] offsets = leanToFullCommon(processor, environment, text, state, dirProps); // offsets[0] contains the number of used entries int count = offsets[0] - OFFSETS_SHIFT; @@ -295,7 +295,7 @@ return result; } - static int[] leanToFullCommon(STextProcessor processor, STextEnvironment environment, String text, int[] state, STextDirections dirProps) { + static int[] leanToFullCommon(STextProcessor processor, STextEnvironment environment, String text, int[] state, STextCharTypes dirProps) { if (environment == null) environment = STextEnvironment.DEFAULT; if (state == null) { @@ -303,7 +303,7 @@ state[0] = STextEngine.STATE_INITIAL; } int len = text.length(); - int orient = dirProps.getBaseOrientation(environment); + int orient = dirProps.getOrientation(environment); int direction = processor.getDirection(environment, text, dirProps); // offsets of marks to add. Entry 0 is the number of used slots; // entry 1 is reserved to pass prefixLength. @@ -313,8 +313,8 @@ offsets[2] = direction; if (!processor.skipProcessing(environment, text, dirProps)) { // initialize locations - int separCount = processor.getSeparators(environment, text, dirProps).length(); - int[] locations = new int[separCount + processor.getSpecialsCount(environment, text, dirProps)]; + int separCount = processor.getSeparators(environment).length(); + int[] locations = new int[separCount + processor.getSpecialsCount(environment)]; for (int i = 0, k = locations.length; i < k; i++) { locations[i] = -1; } @@ -353,7 +353,7 @@ offsets[1] = 0; else { // recompute orient since it may have changed if contextual - orient = dirProps.getBaseOrientation(environment); + orient = dirProps.getOrientation(environment); if (orient == direction && orient != STextEnvironment.ORIENT_UNKNOWN) offsets[1] = 0; else if ((environment.getOrientation() & STextEnvironment.ORIENT_CONTEXTUAL_LTR) != 0) @@ -376,7 +376,7 @@ state = new int[1]; state[0] = STextEngine.STATE_INITIAL; } - int dir = processor.getDirection(environment, text, new STextDirections(text)); + int dir = processor.getDirection(environment, text); char curMark = MARKS[dir]; char curEmbed = EMBEDS[dir]; int i; // used as loop index @@ -468,7 +468,7 @@ return EMPTY_INT_ARRAY; String lean = fullToLeanText(processor, environment, full, state); int lenLean = lean.length(); - int dir = processor.getDirection(environment, lean, new STextDirections(lean)); + int dir = processor.getDirection(environment, lean); char curMark = MARKS[dir]; char curEmbed = EMBEDS[dir]; int[] map = new int[lenFull]; @@ -536,7 +536,7 @@ /** * @see STextProcessor#insertMark STextProcessor.insertMark */ - public static void insertMark(String text, STextDirections dirProps, int[] offsets, int offset) { + public static void insertMark(String text, STextCharTypes dirProps, int[] offsets, int offset) { int count = offsets[0];// number of used entries int index = count - 1; // index of greatest member <= offset // look up after which member the new offset should be inserted diff --git src/org/eclipse/equinox/bidi/internal/STextSingle.java src/org/eclipse/equinox/bidi/internal/STextSingle.java index effffb3..4f6e3b1 100644 --- src/org/eclipse/equinox/bidi/internal/STextSingle.java +++ src/org/eclipse/equinox/bidi/internal/STextSingle.java @@ -11,7 +11,7 @@ package org.eclipse.equinox.bidi.internal; import org.eclipse.equinox.bidi.STextEnvironment; -import org.eclipse.equinox.bidi.custom.STextDirections; +import org.eclipse.equinox.bidi.custom.STextCharTypes; import org.eclipse.equinox.bidi.custom.STextProcessor; /** @@ -41,8 +41,8 @@ * * @see #getSeparators getSeparators */ - public int indexOfSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int caseNumber, int fromIndex) { - return text.indexOf(this.getSeparators(environment, text, dirProps).charAt(0), fromIndex); + public int indexOfSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int caseNumber, int fromIndex) { + return text.indexOf(this.getSeparators(environment).charAt(0), fromIndex); } /** @@ -51,7 +51,7 @@ * * @return the length of text. */ - public int processSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { + public int processSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { STextProcessor.processSeparator(text, dirProps, offsets, separLocation); return text.length(); } @@ -61,7 +61,7 @@ * * @return 1. */ - public int getSpecialsCount(STextEnvironment environment, String text, STextDirections dirProps) { + public int getSpecialsCount(STextEnvironment environment) { return 1; } diff --git src/org/eclipse/equinox/bidi/internal/consumable/STextEmail.java src/org/eclipse/equinox/bidi/internal/consumable/STextEmail.java index ea52c7e..3f69de0 100644 --- src/org/eclipse/equinox/bidi/internal/consumable/STextEmail.java +++ src/org/eclipse/equinox/bidi/internal/consumable/STextEmail.java @@ -12,7 +12,7 @@ import org.eclipse.equinox.bidi.STextEngine; import org.eclipse.equinox.bidi.STextEnvironment; -import org.eclipse.equinox.bidi.custom.STextDirections; +import org.eclipse.equinox.bidi.custom.STextCharTypes; import org.eclipse.equinox.bidi.internal.STextDelimsEsc; /** @@ -38,7 +38,7 @@ * * Otherwise, returns {@link STextEngine#DIR_LTR DIR_LTR}. */ - public int getDirection(STextEnvironment environment, String text, STextDirections dirProps) { + public int getDirection(STextEnvironment environment, String text, STextCharTypes dirProps) { String language = environment.getLanguage(); if (!language.equals("ar")) //$NON-NLS-1$ return STextEngine.DIR_LTR; @@ -57,7 +57,7 @@ /** * @return 2 as number of special cases handled by this processor. */ - public int getSpecialsCount(STextEnvironment environment, String text, STextDirections dirProps) { + public int getSpecialsCount(STextEnvironment environment) { return 2; } diff --git src/org/eclipse/equinox/bidi/internal/consumable/STextJava.java src/org/eclipse/equinox/bidi/internal/consumable/STextJava.java index 13c116d..81b3b41 100644 --- src/org/eclipse/equinox/bidi/internal/consumable/STextJava.java +++ src/org/eclipse/equinox/bidi/internal/consumable/STextJava.java @@ -12,7 +12,7 @@ import org.eclipse.equinox.bidi.STextEngine; import org.eclipse.equinox.bidi.STextEnvironment; -import org.eclipse.equinox.bidi.custom.STextDirections; +import org.eclipse.equinox.bidi.custom.STextCharTypes; import org.eclipse.equinox.bidi.custom.STextProcessor; import org.eclipse.equinox.bidi.internal.STextActivator; @@ -46,7 +46,7 @@ /** * @return 4 as the number of special cases handled by this processor. */ - public int getSpecialsCount(STextEnvironment environment, String text, STextDirections dirProps) { + public int getSpecialsCount(STextEnvironment environment) { return 4; } @@ -59,7 +59,7 @@ *
  • comments starting with slash-slash
  • * */ - public int indexOfSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int caseNumber, int fromIndex) { + public int indexOfSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int caseNumber, int fromIndex) { switch (caseNumber) { case 1 : /* space */ return text.indexOf(' ', fromIndex); @@ -83,7 +83,7 @@ *
  • skip until after a line separator
  • * */ - public int processSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { + public int processSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { int location, counter, i; STextProcessor.processSeparator(text, dirProps, offsets, separLocation); diff --git src/org/eclipse/equinox/bidi/internal/consumable/STextMath.java src/org/eclipse/equinox/bidi/internal/consumable/STextMath.java index 0f130f9..dcadfba 100644 --- src/org/eclipse/equinox/bidi/internal/consumable/STextMath.java +++ src/org/eclipse/equinox/bidi/internal/consumable/STextMath.java @@ -12,7 +12,7 @@ import org.eclipse.equinox.bidi.STextEngine; import org.eclipse.equinox.bidi.STextEnvironment; -import org.eclipse.equinox.bidi.custom.STextDirections; +import org.eclipse.equinox.bidi.custom.STextCharTypes; import org.eclipse.equinox.bidi.custom.STextProcessor; /** @@ -41,7 +41,7 @@ * * Otherwise, returns {@link STextEngine#DIR_LTR DIR_LTR}. */ - public int getDirection(STextEnvironment environment, String text, STextDirections dirProps) { + public int getDirection(STextEnvironment environment, String text, STextCharTypes dirProps) { String language = environment.getLanguage(); if (!language.equals("ar")) //$NON-NLS-1$ return STextEngine.DIR_LTR; diff --git src/org/eclipse/equinox/bidi/internal/consumable/STextRegex.java src/org/eclipse/equinox/bidi/internal/consumable/STextRegex.java index 214eb57..97d7e3f 100644 --- src/org/eclipse/equinox/bidi/internal/consumable/STextRegex.java +++ src/org/eclipse/equinox/bidi/internal/consumable/STextRegex.java @@ -12,7 +12,7 @@ import org.eclipse.equinox.bidi.STextEngine; import org.eclipse.equinox.bidi.STextEnvironment; -import org.eclipse.equinox.bidi.custom.STextDirections; +import org.eclipse.equinox.bidi.custom.STextCharTypes; import org.eclipse.equinox.bidi.custom.STextProcessor; /** @@ -69,7 +69,7 @@ * * @return the number of special cases for this processor. */ - public int getSpecialsCount(STextEnvironment environment, String text, STextDirections dirProps) { + public int getSpecialsCount(STextEnvironment environment) { return maxSpecial; } @@ -77,7 +77,7 @@ * This method locates occurrences of the syntactic strings and of * R, AL, EN, AN characters. */ - public int indexOfSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int caseNumber, int fromIndex) { + public int indexOfSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int caseNumber, int fromIndex) { // In this method, L, R, AL, AN and EN represent bidi categories // as defined in the Unicode Bidirectional Algorithm // ( http://www.unicode.org/reports/tr9/ ). @@ -145,7 +145,7 @@ /** * This method process the special cases. */ - public int processSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { + public int processSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { int location; switch (caseNumber) { @@ -227,7 +227,7 @@ * * Otherwise, returns {@link STextEngine#DIR_LTR DIR_LTR}. */ - public int getDirection(STextEnvironment environment, String text, STextDirections dirProps) { + public int getDirection(STextEnvironment environment, String text, STextCharTypes dirProps) { String language = environment.getLanguage(); if (!language.equals("ar")) //$NON-NLS-1$ return STextEngine.DIR_LTR; diff --git src/org/eclipse/equinox/bidi/internal/consumable/STextSql.java src/org/eclipse/equinox/bidi/internal/consumable/STextSql.java index e45af32..426d732 100644 --- src/org/eclipse/equinox/bidi/internal/consumable/STextSql.java +++ src/org/eclipse/equinox/bidi/internal/consumable/STextSql.java @@ -12,7 +12,7 @@ import org.eclipse.equinox.bidi.STextEngine; import org.eclipse.equinox.bidi.STextEnvironment; -import org.eclipse.equinox.bidi.custom.STextDirections; +import org.eclipse.equinox.bidi.custom.STextCharTypes; import org.eclipse.equinox.bidi.custom.STextProcessor; import org.eclipse.equinox.bidi.internal.STextActivator; @@ -46,7 +46,7 @@ /** * @return 5 as the number of special cases handled by this processor. */ - public int getSpecialsCount(STextEnvironment environment, String text, STextDirections dirProps) { + public int getSpecialsCount(STextEnvironment environment) { return 5; } @@ -60,7 +60,7 @@ *
  • comments starting with hyphen-hyphen
  • * */ - public int indexOfSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int caseNumber, int fromIndex) { + public int indexOfSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int caseNumber, int fromIndex) { switch (caseNumber) { case 1 : /* space */ return text.indexOf(" ", fromIndex); //$NON-NLS-1$ @@ -87,7 +87,7 @@ *
  • skip until after a line separator
  • * */ - public int processSpecial(STextEnvironment environment, String text, STextDirections dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { + public int processSpecial(STextEnvironment environment, String text, STextCharTypes dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { int location; STextProcessor.processSeparator(text, dirProps, offsets, separLocation); diff --git src/org/eclipse/equinox/bidi/internal/consumable/STextXPath.java src/org/eclipse/equinox/bidi/internal/consumable/STextXPath.java index cef45e5..7ead88b 100644 --- src/org/eclipse/equinox/bidi/internal/consumable/STextXPath.java +++ src/org/eclipse/equinox/bidi/internal/consumable/STextXPath.java @@ -11,7 +11,6 @@ package org.eclipse.equinox.bidi.internal.consumable; import org.eclipse.equinox.bidi.STextEnvironment; -import org.eclipse.equinox.bidi.custom.STextDirections; import org.eclipse.equinox.bidi.internal.STextDelims; /** @@ -26,7 +25,7 @@ /** * @return 2 as the number of special cases handled by this processor. */ - public int getSpecialsCount(STextEnvironment environment, String text, STextDirections dirProps) { + public int getSpecialsCount(STextEnvironment environment) { return 2; }