de.folt.models.datamodel
Class MonoLingualObject

java.lang.Object
  extended by java.util.Observable
      extended by de.folt.models.datamodel.GeneralLinguisticObject
          extended by de.folt.models.datamodel.MonoLingualObject
All Implemented Interfaces:
java.io.Serializable

public class MonoLingualObject
extends GeneralLinguisticObject
implements java.io.Serializable

This class implements a MonoLingualObject, a object representing strings in a specific language.
OpenTMS Software Architecture.
It extends a GeneralLinguisticObject.
Its main components are:

 formattedSegment = null; - the segment with all the format information available (e.g. TMX or XLIFF formats like 
 language = null; the language associated with the segment
 parentMultiLingualObject = null; MonoLingualObject(s) can be part of MultiLingualObjects; this is the reference to the parent MultiLingualObject. A MonoLingualObject can only belong to one  MultiLingualObject.
 plainTextSegment = null; This is a version of the formattedSegment where all the formats (esp. <..> has been removed. This string is generated by supplying an appropriate method to the constructor of the MonoLingualObject.
 
Other components are inherited from GeneralLinguisticObject GeneralLinguisticObject.

Author:
klemens
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class de.folt.models.datamodel.GeneralLinguisticObject
GeneralLinguisticObject.LinguisticTypes, GeneralLinguisticObject.TestObserver
 
Constructor Summary
MonoLingualObject()
           
MonoLingualObject(LinguisticProperties linguisticProperties, GeneralLinguisticObject.LinguisticTypes lingType, java.lang.String formattedSegment, java.lang.String plainTextSegment, java.lang.String language)
           
MonoLingualObject(java.lang.String formattedSegment, java.lang.String language)
           
MonoLingualObject(java.lang.String formattedSegment, java.lang.String language, java.lang.Class classname, java.lang.reflect.Method determinePlaintext, java.lang.Object params)
           
MonoLingualObject(java.lang.String formattedSegment, java.lang.String plainTextSegment, java.lang.String language)
           
 
Method Summary
 boolean bCompare(MonoLingualObject molObj)
          bCompare compare this MOL against another MOL
 boolean bCompare(MonoLingualObject molObj, boolean bCompareCoreAttributes)
          bCompare compare this MOL against another MOL
 void clearObject()
          clearObject sets all values to null or zero
 java.lang.String format()
          format
 java.lang.String formatAsXml()
          formatAsXml
static MonoLingualObject fromJson(java.lang.String jsonMono)
          fromJson convert into a MonoLingualObject from JSON String
 java.lang.String getFormattedSegment()
           
 java.lang.String getLanguage()
           
 MultiLingualObject getParentMultiLingualObject()
           
 java.lang.String getPlainTextSegment()
           
static void main(java.lang.String[] args)
          main
 java.lang.String mapToJson()
          mapToJson
 java.lang.String mapToTig()
          mapToTig
 java.lang.String mapToTuv()
          mapToTuv converts the MonoLingualObject into a tuv formatted string
 void setFormattedSegment(java.lang.String formattedSegment)
           
 void setLanguage(java.lang.String language)
           
 void setParentMultiLingualObject(MultiLingualObject parentMultiLingualObject)
           
 void setPlainTextSegment(java.lang.String plainTextSegment)
           
static java.lang.String simpleComputePlainText(java.lang.String formattedText)
          simpleComputePlainText generates the a plain text version of a string.
static java.lang.String simpleComputePlainText(java.lang.String formattedText, java.lang.Object arg)
          simpleComputePlainText generates the a plain text version of a string.
static void test()
          test simple test method for generating some general linguistic objects
 
Methods inherited from class de.folt.models.datamodel.GeneralLinguisticObject
addLinguisticProperty, addObjectLinguisticProperty, addStringLinguisticProperty, bCompare, bCompare, checkDataSourceCriteria, checkDataSourceCriteria, checkDataSourceCriteria, getCreationTime, getException, getId, getLastAccessTime, getLingType, getLinguisticProperties, getModificationTime, getObjectLinguisticProperty, getStOwner, getStUniqueID, getUniqueID, getUsageNumber, isbLogExceptions, matchLinguisticProperties, removeLinguisticProperty, setbLogExceptions, setCreationTime, setException, setId, setLastAccessTime, setLingType, setLinguisticProperties, setModificationTime, setStOwner, setStUniqueID, setUniqueID, setUsageNumber, updateModificationTime, updateUsageNumber
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonoLingualObject

public MonoLingualObject()

MonoLingualObject

public MonoLingualObject(LinguisticProperties linguisticProperties,
                         GeneralLinguisticObject.LinguisticTypes lingType,
                         java.lang.String formattedSegment,
                         java.lang.String plainTextSegment,
                         java.lang.String language)
Parameters:
linguisticProperties -
lingType -
formattedSegment -
plainTextSegment -
language -

MonoLingualObject

public MonoLingualObject(java.lang.String formattedSegment,
                         java.lang.String language)
Parameters:
formattedSegment - the formatted Segment; plaintextsegment is set to the formattedSegment
language - the language of the segment

MonoLingualObject

public MonoLingualObject(java.lang.String formattedSegment,
                         java.lang.String language,
                         java.lang.Class classname,
                         java.lang.reflect.Method determinePlaintext,
                         java.lang.Object params)
Parameters:
formattedSegment - the formatted segment
language - the language of the segment
classname - a Class object which contains the method determinePlaintext (best declared static!)
determinePlaintext - the method which computes the plain text (arguments supplied are: formatted string and an object for any additional parameters needed
params - the additional parameter (Object) for controlling the computation of the plain text string

MonoLingualObject

public MonoLingualObject(java.lang.String formattedSegment,
                         java.lang.String plainTextSegment,
                         java.lang.String language)
Parameters:
formattedSegment -
plainTextSegment -
language -
Method Detail

fromJson

public static MonoLingualObject fromJson(java.lang.String jsonMono)
fromJson convert into a MonoLingualObject from JSON String

Parameters:
jsonMono - the json formatted string
Returns:
the MonoLingualObject

main

public static void main(java.lang.String[] args)
main

Parameters:
args -

simpleComputePlainText

public static java.lang.String simpleComputePlainText(java.lang.String formattedText)
simpleComputePlainText generates the a plain text version of a string.
 "Hallo bold house." ==>> "Hallo  house."
 

Parameters:
formattedText - the text with format inside (e.g. xml tags)
Returns:
the plain text.

simpleComputePlainText

public static java.lang.String simpleComputePlainText(java.lang.String formattedText,
                                                      java.lang.Object arg)
simpleComputePlainText generates the a plain text version of a string.
 "Hallo bold house." ==>> "Hallo  house."
 

Parameters:
formattedText - the text with format inside (e.g. xml tags)
arg - currently not used; future reserved to specify params for removing format information
Returns:
the plain text.

test

public static void test()
test simple test method for generating some general linguistic objects


bCompare

public boolean bCompare(MonoLingualObject molObj)
bCompare compare this MOL against another MOL

Parameters:
molObj - the MOL to compare against
Returns:
true if the formattedSegment and language and LinguisticProperties match (without core GeneralLinguisticObject attributes)

bCompare

public boolean bCompare(MonoLingualObject molObj,
                        boolean bCompareCoreAttributes)
bCompare compare this MOL against another MOL

Parameters:
genObj - the MOL to compare against
bCompareCoreAttributes -
Returns:
true if the formattedSegment and language and LinguisticProperties match (including the core GeneralLinguisticObject attributes)

clearObject

public void clearObject()
Description copied from class: GeneralLinguisticObject
clearObject sets all values to null or zero

Overrides:
clearObject in class GeneralLinguisticObject

format

public java.lang.String format()
Description copied from class: GeneralLinguisticObject
format

Overrides:
format in class GeneralLinguisticObject
Returns:
the formatted string

formatAsXml

public java.lang.String formatAsXml()
Description copied from class: GeneralLinguisticObject
formatAsXml

Overrides:
formatAsXml in class GeneralLinguisticObject
Returns:

getFormattedSegment

public java.lang.String getFormattedSegment()
Returns:
the formattedSegment

getLanguage

public java.lang.String getLanguage()
Returns:
the language

getParentMultiLingualObject

public MultiLingualObject getParentMultiLingualObject()
Returns:
the parentMultiLingualObject

getPlainTextSegment

public java.lang.String getPlainTextSegment()
Returns:
the plainTextSegment

mapToJson

public java.lang.String mapToJson()
mapToJson

Overrides:
mapToJson in class GeneralLinguisticObject
Returns:

mapToTig

public java.lang.String mapToTig()
mapToTig

Returns:

mapToTuv

public java.lang.String mapToTuv()
mapToTuv converts the MonoLingualObject into a tuv formatted string

Returns:
the tuv string

setFormattedSegment

public void setFormattedSegment(java.lang.String formattedSegment)
Parameters:
formattedSegment - the formattedSegment to set

setLanguage

public void setLanguage(java.lang.String language)
Parameters:
language - the language to set

setParentMultiLingualObject

public void setParentMultiLingualObject(MultiLingualObject parentMultiLingualObject)
Parameters:
parentMultiLingualObject - the parentMultiLingualObject to set

setPlainTextSegment

public void setPlainTextSegment(java.lang.String plainTextSegment)
Parameters:
plainTextSegment - the plainTextSegment to set; the plain text segment is set to null if it is identical to the formattedSegment