org.ocltf.translation.library
Class Translation

java.lang.Object
  extended byorg.ocltf.translation.library.Translation

public class Translation
extends java.lang.Object

Represents a translation XML template found within a translation library.

Author:
Chad Brandon

Constructor Summary
Translation()
          Constructs an instance of Translation.
 
Method Summary
 void addFragment(Fragment fragment)
          Adds a new Translation fragment to the Translation.
 void addIgnorePattern(java.lang.String ignorePattern)
          Adds an ignorePattern to the Collection of ignorePatterns.
 void addValidatePattern(java.lang.String validatePattern)
          Adds an validatePattern to the Collection of validatePatterns.
protected  Fragment getFragment(java.lang.String name)
          Gets the fragment matching (using regular expressions) the specified name.
protected  LibraryTranslation getLibraryTranslation()
          Gets the LibraryTranslation to which this Translation belongs.
protected  java.lang.String getName()
          Gets the name of this Translation.
protected  java.lang.String getTranslated(java.lang.String name, java.lang.String kind)
          Gets the "translated" value of this Fragment if it exists.
 boolean isIgnorePattern(java.lang.String pattern)
          Checks to see if the pattern is an ignore pattern.
protected  void setLibraryTranslation(LibraryTranslation translation)
          Sets the LibraryTranslation to which this Translation belongs.
protected  void setName(java.lang.String name)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Translation

public Translation()
Constructs an instance of Translation.

Method Detail

getLibraryTranslation

protected LibraryTranslation getLibraryTranslation()
Gets the LibraryTranslation to which this Translation belongs.

Returns:
LibraryTranslation

setLibraryTranslation

protected void setLibraryTranslation(LibraryTranslation translation)
Sets the LibraryTranslation to which this Translation belongs.

Parameters:
translation - the LibraryTranslation to which this Translation belongs.

getFragment

protected Fragment getFragment(java.lang.String name)
Gets the fragment matching (using regular expressions) the specified name.

Parameters:
name - the name of the fragment to retrieve.
Returns:
Fragment

addFragment

public void addFragment(Fragment fragment)
Adds a new Translation fragment to the Translation.

Parameters:
fragment -

getName

protected java.lang.String getName()
Gets the name of this Translation.

Returns:
String

setName

protected void setName(java.lang.String name)
Parameters:
name -

addIgnorePattern

public void addIgnorePattern(java.lang.String ignorePattern)
Adds an ignorePattern to the Collection of ignorePatterns.

Parameters:
ignorePattern - the pattern to ignore.

addValidatePattern

public void addValidatePattern(java.lang.String validatePattern)
Adds an validatePattern to the Collection of validatePatterns.

Parameters:
validatePattern - the pattern to validate.

isIgnorePattern

public boolean isIgnorePattern(java.lang.String pattern)
Checks to see if the pattern is an ignore pattern. What this means is that if if this pattern matches on a regular expression found in the collection of ignore patterns then the TranslationLibrary won't complain if it doesn't match a fragment name.

Parameters:
pattern -
Returns:
boolean true if its an ignore pattern, false otherwise.

getTranslated

protected java.lang.String getTranslated(java.lang.String name,
                                         java.lang.String kind)
Gets the "translated" value of this Fragment if it exists. That is, it retrieves the fragment body for the name of this fragment and replaces any fragment references with other fragment bodies (if they exist)

Parameters:
name - the name of the fragment.
kind - the kind of the fragment.
Returns:
String the translated body of the fragment kind.

toString

public java.lang.String toString()
See Also:
Object.toString()


Copyright © 2003-2004 Chad Brandon. All Rights Reserved.