Class Language

java.lang.Object
  |
  +--Language

public class Language
extends java.lang.Object

This class is the building-block for customizing (natural) language support in Arboreal.

Version:
$03/07/23 01:29:28 mdh$
Author:
Malcolm D. Hyman

Field Summary
static java.lang.String ALTERNATE
           
static java.lang.String ANYTHING
           
static java.lang.String BEGIN_CAPTURE
           
static java.lang.String BEGIN_CLASS
           
static java.lang.String BEGIN_GROUP
           
static java.lang.String END_CAPTURE
           
static java.lang.String END_CLASS
           
static java.lang.String END_GROUP
           
static java.lang.String MATCH_END
           
static java.lang.String MATCH_START
           
static java.lang.String SPACE
           
 
Constructor Summary
Language(java.lang.String identifier, java.lang.String fullName, java.lang.String canonicalEncodingName, boolean rightToLeft)
          Creates a new language.
 
Method Summary
 void addAlias(java.lang.String alias)
          Adds an alias identifier for this language.
 void addDisplayFilter(PluggableFilter filter)
          Adds a pluggable display filter for this language.
 java.lang.String filter(java.lang.String text)
          Filters the string text for the current view.
 java.util.List getAliases()
          Returns all aliases for this language.
 java.lang.String getCanonicalEncodingName()
          Returns the name of the canonical encoding for this language.
 PluggableFilter getCurrentFilter()
          Returns the currently selected PluggableFilter.
 int getCurrentView()
          Returns the current display mode (view) for this language.This API method is intended for use by a configuration manager only.
 int getDefaultView()
          Returns the default display mode for this language.
 PluggableFilter getDisplayFilter(int index)
          Returns the display filter with the specified index.
 PluggableFilter[] getDisplayFilters()
          Returns all registered pluggable display filters for this language.
 java.lang.String getEndDelims(boolean canonical)
          Returns a string of all delimiters which may occur after a word in this language.
 java.lang.String getFullName()
          Returns the human-readable name of this language.
 java.lang.String getIdentifier()
          Returns the ISO 639 identifier for this language.
 java.awt.ComponentOrientation getOrientation()
          Returns the appropriate component orientation (for the current display filter settings) for a component containing text in this language.
 java.lang.String getStartDelims(boolean canonical)
          Returns a string of all delimiters which may occur before a word in this language.
 java.lang.String matchBetween()
          Returns a regular expression that matches material between words.
 java.lang.String matchEnd()
          Returns a regular expression that matches the end of a word in this language.
 java.lang.String matchStart()
          Returns a regular expression that matches the start of a word in this language.
 java.lang.String matchWord(java.lang.String word, boolean caseSensitive)
          Returns a Perl-style regular expression that matches word.
 void setCurrentView(int value)
          Sets the current display mode (view) for this language.
 void setDefaultView(int value)
          Sets the default view for this language.
 void setDelimiters(java.lang.String startDelims, java.lang.String endDelims)
          Sets the word delimiters for this language.
 void setRegexPatterns(java.lang.String regexUniv, java.lang.String regexInit, java.lang.String regexFinal)
          Sets the patterns used for matching word boundaries for this language, in its default encoding/view.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BEGIN_GROUP

public static final java.lang.String BEGIN_GROUP

END_GROUP

public static final java.lang.String END_GROUP

MATCH_START

public static final java.lang.String MATCH_START

MATCH_END

public static final java.lang.String MATCH_END

ALTERNATE

public static final java.lang.String ALTERNATE

ANYTHING

public static final java.lang.String ANYTHING

BEGIN_CAPTURE

public static final java.lang.String BEGIN_CAPTURE

END_CAPTURE

public static final java.lang.String END_CAPTURE

BEGIN_CLASS

public static final java.lang.String BEGIN_CLASS

END_CLASS

public static final java.lang.String END_CLASS

SPACE

public static final java.lang.String SPACE
Constructor Detail

Language

public Language(java.lang.String identifier,
                java.lang.String fullName,
                java.lang.String canonicalEncodingName,
                boolean rightToLeft)
Creates a new language. Most properties get sensible defaults.
Parameters:
identifier - ISO 639 identifier for this language
fullName - human-readble name for this language
canonicalEncodingName -  
Method Detail

addAlias

public void addAlias(java.lang.String alias)
Adds an alias identifier for this language.
Parameters:
alias - alias for this language

getAliases

public java.util.List getAliases()
Returns all aliases for this language.
Returns:
list of aliases (String identifiers)

addDisplayFilter

public void addDisplayFilter(PluggableFilter filter)
Adds a pluggable display filter for this language.
Parameters:
filter - pluggable display filter

getDisplayFilters

public PluggableFilter[] getDisplayFilters()
Returns all registered pluggable display filters for this language.
Returns:
all registered display filters

getDisplayFilter

public PluggableFilter getDisplayFilter(int index)
Returns the display filter with the specified index.
Parameters:
index - display filter index
Returns:
pluggable display filter

getIdentifier

public java.lang.String getIdentifier()
Returns the ISO 639 identifier for this language.
Returns:
ISO 639 identifier

getFullName

public java.lang.String getFullName()
Returns the human-readable name of this language.
Returns:
human-readable name

getCanonicalEncodingName

public java.lang.String getCanonicalEncodingName()
Returns the name of the canonical encoding for this language.
Returns:
canonical encoding name

setDefaultView

public void setDefaultView(int value)
Sets the default view for this language. This API method is intended for use by a configuration manager only.
Parameters:
value - default display mode

getDefaultView

public int getDefaultView()
Returns the default display mode for this language.
Returns:
default display mode

setCurrentView

public void setCurrentView(int value)
Sets the current display mode (view) for this language. This API method is intended for use by a configuration manager only.
Parameters:
value - current display mode

getCurrentView

public int getCurrentView()
Returns the current display mode (view) for this language.This API method is intended for use by a configuration manager only.
Returns:
current display mode

getCurrentFilter

public PluggableFilter getCurrentFilter()
Returns the currently selected PluggableFilter.
Returns:
selected display filter (or null)

filter

public java.lang.String filter(java.lang.String text)
Filters the string text for the current view.
Parameters:
text - text to be re-encoded
Returns:
re-encoded text

setDelimiters

public void setDelimiters(java.lang.String startDelims,
                          java.lang.String endDelims)
Sets the word delimiters for this language.
Parameters:
startDelims - word start delimeters
endDelims - word end delimiters

setRegexPatterns

public void setRegexPatterns(java.lang.String regexUniv,
                             java.lang.String regexInit,
                             java.lang.String regexFinal)
Sets the patterns used for matching word boundaries for this language, in its default encoding/view.
Parameters:
regexUniv - matches any word boundary
regexInit - matches only word-initial boundary
regexFinal - matches only word-final boundary

getStartDelims

public java.lang.String getStartDelims(boolean canonical)
Returns a string of all delimiters which may occur before a word in this language.
Parameters:
canonical - false: for current view; true: for default encoding
Returns:
word start delimiters

getEndDelims

public java.lang.String getEndDelims(boolean canonical)
Returns a string of all delimiters which may occur after a word in this language.
Parameters:
canonical - false: for current view; true: for default encoding
Returns:
word end delimiters

matchStart

public java.lang.String matchStart()
Returns a regular expression that matches the start of a word in this language.
Returns:
word start regex

matchEnd

public java.lang.String matchEnd()
Returns a regular expression that matches the end of a word in this language.
Returns:
word end regex

matchBetween

public java.lang.String matchBetween()
Returns a regular expression that matches material between words.
Returns:
regex that matches between words

matchWord

public java.lang.String matchWord(java.lang.String word,
                                  boolean caseSensitive)
Returns a Perl-style regular expression that matches word.
Parameters:
word - word to search for
caseSensitive - should search be case-sensitive?

getOrientation

public java.awt.ComponentOrientation getOrientation()
Returns the appropriate component orientation (for the current display filter settings) for a component containing text in this language.
Returns:
orientation for filtered text in lang

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object