org.eml.MMAX2.annotation.markables
Class Markable

java.lang.Object
  extended by org.eml.MMAX2.annotation.markables.Markable
All Implemented Interfaces:
java.io.Serializable, MarkableAPI

public final class Markable
extends java.lang.Object
implements java.io.Serializable, MarkableAPI

See Also:
Serialized Form

Constructor Summary
Markable(org.w3c.dom.Node _nodeRepresentation, java.lang.String _ID, java.lang.String[][] _fragments, java.util.HashMap _attributes, MarkableLevel _level)
          Creates new Markable.
 
Method Summary
 boolean addDiscourseElements(java.lang.String[] addees)
           
 void addLeftHandlePosition(int pos)
           
 void addRightHandlePosition(int pos)
           
 void clearMarkableHandles()
           
 Markable cloneMarkable()
           
 boolean coversDisplayPosition(int displayPosition)
          This method returns true if displayPosition is covered by the Markable, false otherwise.
 void deleteMe()
           
 void destroyDependentComponents()
           
 javax.swing.text.SimpleAttributeSet getAttributedependentStyle()
           
 java.util.HashMap getAttributes()
          This method returns all of this Markable's attributes (except ID and SPAN, which are system-attributes) as a HashMap.
 java.lang.String getAttributeValue(java.lang.String attributeName)
          This method returns the value this Markable has for attribute attributeName, or null if attribute is not defined for Markable.
 java.lang.String getAttributeValue(java.lang.String name, java.lang.String defaultIfUndefined)
          (API) Returns the string value of this Markable's attribute, or returnIfUndefined if attribute is undefined for this Markable.
 java.lang.String[] getDiscourseElementIDs()
           
 java.lang.String[] getDiscourseElements()
           
 int[] getDiscourseElementStartPositions()
           
 int[] getDisplayEndPositions()
           
 int[] getDisplayStartPositions()
           
 java.lang.String[][] getFragments()
           
 java.lang.String getID()
          (API) Returns the ID string of this Markable, e.g.
 boolean getIsInSearchResult()
           
 int[] getLeftHandlePositions()
           
 int getLeftmostDiscoursePosition()
          (API) Returns the discourse position of the leftmost MMAX2DiscourseElement that this Markable object contains.
 int getLeftmostDisplayPosition()
           
 MarkableLevel getMarkableLevel()
          (API) Returns the MarkableLevel object that this Markable belongs to.
 java.lang.String getMarkableLevelName()
           
 org.w3c.dom.Node getNodeRepresentation()
           
 java.awt.Point getPoint()
           
 int[] getRightHandlePositions()
           
 int getRightmostDiscoursePosition()
          (API) Returns the discourse position of the rightmost MMAX2DiscourseElement that this Markable object contains.
 int getRightmostDisplayPosition()
           
 int getSize()
           
 MMAX2Attribute[] getValidatedAttributes()
          This does return attributes only, values are changed back immediately afterwards!! (Used for creation of ActionSelector) Important: This does NOT make sure to set the attribute window to prior display state!!
 boolean isDefined(java.lang.String attributeName)
          This method returns true if an attribute with name attributeName is defined for this Markable, i.e.
 boolean isDiscontinuous()
           
 void removeAttribute(java.lang.String attributeName)
           
 boolean removeDiscourseElements(java.lang.String[] removees)
           
 void renderMe(int mode)
           
 void selectMe()
           
 void setAttributes(java.util.HashMap newAttributes)
           
 void setAttributeValue(java.lang.String attributeName, java.lang.String value)
          (API) Sets this markable's attribute to value.
 void setAttributeValueToNode(java.lang.String attributeName, java.lang.String value)
           
 void setIsInSearchResult(boolean status)
           
 java.lang.String toString()
          (API) Returns the string representation of this Markable object.
 java.lang.String toTrimmedString(int maxLen)
          (API) Returns the trimmed string representation of this Markable object.
 void update(java.lang.String[][] _fragments)
          This method is called on each markable after a change in the base data
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Markable

public Markable(org.w3c.dom.Node _nodeRepresentation,
                java.lang.String _ID,
                java.lang.String[][] _fragments,
                java.util.HashMap _attributes,
                MarkableLevel _level)
Creates new Markable. During initialization, this method is called during execution of MarkableLevel.createMarkables(). Synopsis: This method basically sets a number of Markable object properties, and then calls MarkableHelper.register(this,false).

Method Detail

clearMarkableHandles

public final void clearMarkableHandles()

update

public final void update(java.lang.String[][] _fragments)
This method is called on each markable after a change in the base data


toString

public final java.lang.String toString()
Description copied from interface: MarkableAPI
(API) Returns the string representation of this Markable object.

Specified by:
toString in interface MarkableAPI
Overrides:
toString in class java.lang.Object
Returns:
The string representation of this Markable's text, including square brackets at fragment boundaries.

getDiscourseElements

public final java.lang.String[] getDiscourseElements()

getDiscourseElementIDs

public final java.lang.String[] getDiscourseElementIDs()

removeDiscourseElements

public final boolean removeDiscourseElements(java.lang.String[] removees)

addDiscourseElements

public final boolean addDiscourseElements(java.lang.String[] addees)

deleteMe

public final void deleteMe()

getAttributedependentStyle

public final javax.swing.text.SimpleAttributeSet getAttributedependentStyle()

destroyDependentComponents

public final void destroyDependentComponents()

getLeftmostDiscoursePosition

public final int getLeftmostDiscoursePosition()
Description copied from interface: MarkableAPI
(API) Returns the discourse position of the leftmost MMAX2DiscourseElement that this Markable object contains.

Specified by:
getLeftmostDiscoursePosition in interface MarkableAPI
Returns:
The discourse position of the leftmost MMAX2DiscourseElement that this Markable object contains. The discourse position is normally the base data element's position in the base data file.

getRightmostDiscoursePosition

public final int getRightmostDiscoursePosition()
Description copied from interface: MarkableAPI
(API) Returns the discourse position of the rightmost MMAX2DiscourseElement that this Markable object contains.

Specified by:
getRightmostDiscoursePosition in interface MarkableAPI
Returns:
The discourse position of the rightmost MMAX2DiscourseElement that this Markable object contains. The discourse position is normally the base data element's position in the base data file.

getLeftmostDisplayPosition

public final int getLeftmostDisplayPosition()

getRightmostDisplayPosition

public final int getRightmostDisplayPosition()

getDisplayStartPositions

public final int[] getDisplayStartPositions()

getDisplayEndPositions

public final int[] getDisplayEndPositions()

getDiscourseElementStartPositions

public final int[] getDiscourseElementStartPositions()

renderMe

public final void renderMe(int mode)

isDiscontinuous

public final boolean isDiscontinuous()

getSize

public final int getSize()

addLeftHandlePosition

public final void addLeftHandlePosition(int pos)

getLeftHandlePositions

public final int[] getLeftHandlePositions()

addRightHandlePosition

public final void addRightHandlePosition(int pos)

getRightHandlePositions

public final int[] getRightHandlePositions()

getNodeRepresentation

public final org.w3c.dom.Node getNodeRepresentation()

getID

public final java.lang.String getID()
Description copied from interface: MarkableAPI
(API) Returns the ID string of this Markable, e.g. 'markable_12'.

Specified by:
getID in interface MarkableAPI
Returns:
The ID of this Markable.

getMarkableLevelName

public final java.lang.String getMarkableLevelName()

getMarkableLevel

public final MarkableLevel getMarkableLevel()
Description copied from interface: MarkableAPI
(API) Returns the MarkableLevel object that this Markable belongs to.

Specified by:
getMarkableLevel in interface MarkableAPI
Returns:
The MarkableLevel that this Markable belongs to.

getValidatedAttributes

public final MMAX2Attribute[] getValidatedAttributes()
This does return attributes only, values are changed back immediately afterwards!! (Used for creation of ActionSelector) Important: This does NOT make sure to set the attribute window to prior display state!!


coversDisplayPosition

public final boolean coversDisplayPosition(int displayPosition)
This method returns true if displayPosition is covered by the Markable, false otherwise.


getFragments

public final java.lang.String[][] getFragments()

getIsInSearchResult

public final boolean getIsInSearchResult()

setIsInSearchResult

public final void setIsInSearchResult(boolean status)

toTrimmedString

public java.lang.String toTrimmedString(int maxLen)
Description copied from interface: MarkableAPI
(API) Returns the trimmed string representation of this Markable object.

Specified by:
toTrimmedString in interface MarkableAPI
Parameters:
maxLen - The maximum string width to return.
Returns:
The string representation of this Markable's text, including square brackets at fragment boundaries. The text is trimmed to contain maximally maxWidth characters. Trimming is performed by removing a part of the string in the middle and replacing it with [...].

getPoint

public final java.awt.Point getPoint()

getAttributes

public final java.util.HashMap getAttributes()
This method returns all of this Markable's attributes (except ID and SPAN, which are system-attributes) as a HashMap.


setAttributes

public final void setAttributes(java.util.HashMap newAttributes)

selectMe

public final void selectMe()

getAttributeValue

public final java.lang.String getAttributeValue(java.lang.String attributeName)
This method returns the value this Markable has for attribute attributeName, or null if attribute is not defined for Markable. attributeName is set to lowercase before its value is retrieved, and value is set to lower case before it is returned.


getAttributeValue

public final java.lang.String getAttributeValue(java.lang.String name,
                                                java.lang.String defaultIfUndefined)
Description copied from interface: MarkableAPI
(API) Returns the string value of this Markable's attribute, or returnIfUndefined if attribute is undefined for this Markable.

Specified by:
getAttributeValue in interface MarkableAPI
Parameters:
name - The name of the attribute whose value to return.
defaultIfUndefined - The string to return if attribute is undefined.
Returns:
The value of the attribute, or returnIfUndefined if attribute is undefined.

setAttributeValue

public final void setAttributeValue(java.lang.String attributeName,
                                    java.lang.String value)
Description copied from interface: MarkableAPI
(API) Sets this markable's attribute to value.

Specified by:
setAttributeValue in interface MarkableAPI
Parameters:
attributeName - The attribute whose value to set.
value - The value to assign to the attribute.

setAttributeValueToNode

public final void setAttributeValueToNode(java.lang.String attributeName,
                                          java.lang.String value)

removeAttribute

public final void removeAttribute(java.lang.String attributeName)

isDefined

public final boolean isDefined(java.lang.String attributeName)
This method returns true if an attribute with name attributeName is defined for this Markable, i.e. if it has a non-null value in this.attributes, false otherwise.


cloneMarkable

public final Markable cloneMarkable()