Class Tier<T>

java.lang.Object
ca.phon.session.Tier<T>
All Implemented Interfaces:
IExtendable

public final class Tier<T> extends Object implements IExtendable
A tier in a record with name, parameters, alignment rules and value.
  • Method Details

    • getName

      public String getName()
      Returns:
      tier name
    • getDeclaredType

      public Class<T> getDeclaredType()
      Returns:
      tier type
    • getTierParameters

      public Map<String,String> getTierParameters()
      Tier parameters as setup in the session TierDescription
      Returns:
      tier parameters
    • isExcludeFromAlignment

      public boolean isExcludeFromAlignment()
      Is tier excluded from cross tier alignment
      Returns:
      true if tier is not part of cross tier alignment
    • isBlind

      public boolean isBlind()
      Is tier a blind tier?
      Returns:
      true if tier is included in blind transcription
    • setBlind

      public void setBlind(boolean blind)
      Set blind status of this tier
      Parameters:
      blind -
    • hasSubtypeDelim

      public boolean hasSubtypeDelim()
      Return true if this tier include subtype delimiters
      Returns:
      true if the number of subtype delimiters > 0
    • hasSubtypeExpr

      public boolean hasSubtypeExpr()
      Return true if a subtype expression has been specified.
      Returns:
      true if this tier specified a subtype expression
    • getSubtypeDelim

      public List<String> getSubtypeDelim()
      Get subtype delimiters (if any)
      Returns:
      list of subtype delimiters
    • getSubtypeExpr

      public String getSubtypeExpr()
      Get subtype regex. Groups in the expression will be used to identify part of the expression to use
      Returns:
      subtype expr or null if not set
    • hasBlindTranscription

      public boolean hasBlindTranscription(String transcriberId)
      Does this tier have a blind transcription for given transcriber
      Parameters:
      transcriberId -
      Returns:
      true if getBlindTranscription(transcriberId) != null
    • isBlindTranscriptionUnvalidated

      public boolean isBlindTranscriptionUnvalidated(String transcriberId)
      Is the blind transcription for the given transcriber unvalidated
      Parameters:
      transcriberId -
      Returns:
      true if the blind transcription has a parse error
    • getBlindUnvalidatedValue

      public UnvalidatedValue getBlindUnvalidatedValue(String transcriberId)
      Get the unvalidated value for the given blind transcriber (if any)
      Returns:
      unvalidated value for transcriber or null if isBlindTranscription(transcriberId) returns false
    • setBlindTranscription

      public void setBlindTranscription(String transcriberId, T value)
      Set blind transcription
      Parameters:
      transcriberId -
      value -
    • setBlindTranscription

      public boolean setBlindTranscription(String transcriberId, String text)
      Set blind transcription using text
      Parameters:
      transcriberId -
      text -
      Returns:
      true if successful, false if text has a parse error
    • getBlindTranscription

      public T getBlindTranscription(String transcriberId)
      Get blind transcription for given transcriber
      Parameters:
      transcriberId -
      Returns:
      blind transcription for transcriber or null if none or isBlind() is false
    • getTranscribers

      public List<String> getTranscribers()
      Return list of blind transcribers for this tier
      Returns:
      list of transcriberIds
    • getFormatter

      public Formatter<T> getFormatter()
      Return formatter used by setText and toString for converting between objects and text
      Returns:
      formatter, if no formatter is manually set will use the result of FormatterFactory.createFormatter, null if no formatter is set or found
    • setFormatter

      public void setFormatter(Formatter<T> formatter)
      Set formatter used by parse and toString for converting between objects and text
      Parameters:
      formatter - , use null to use default (if any)
    • setText

      public boolean setText(String text)
      Set the tier text. If the text can be parsed into the appropriate object type the tier value will be updated with the new value. If the text cannot be parsed the tier value will be cleared and the tier become unvalidated.
      Parameters:
      text -
      Returns:
      true if successful, false if text has a parse error
    • isUnvalidated

      public boolean isUnvalidated()
      Is the tier unvalidated, meaning unparseable text has been passed to setText.
      Returns:
      boolean
    • getUnvalidatedValue

      public UnvalidatedValue getUnvalidatedValue()
      Return the unvalidated value for this tier (if set)
      Returns:
      unvalidated value or null
    • getValue

      public T getValue()
      Get tier value
      Returns:
      tier value (may be null)
    • hasValue

      public boolean hasValue()
      Has the tier value been set
      Returns:
      true if tier value is not null
    • clear

      public void clear()
      Clear tier value (set to null)
    • setValue

      public void setValue(T value)
      Set value for tier, this will trigger a value changed event if necessary
      Parameters:
      value -
    • toString

      public String toString()
      Return string representation of tier value
      Overrides:
      toString in class Object
      Returns:
      tier string
    • setValueForTranscriber

      public void setValueForTranscriber(Transcriber transcriber, T value)
      Set value of the tier while also considering the transcriber.
      Parameters:
      transcriber -
      value -
    • setValueForTranscriber

      public void setValueForTranscriber(String transcriberId, T value)
      Set value of the tier while also considering the transcriber.
      Parameters:
      transcriberId -
      value -
    • getValueForTranscriber

      public Optional<T> getValueForTranscriber(Transcriber transcriber)
      Get value of the tier while also considering the transcriber.
      Parameters:
      transcriber -
      Returns:
      value for the tier for the given transcriber if it is a blind tier, otherwise the value of the tier itself.
    • getValueForTranscriber

      public Optional<T> getValueForTranscriber(String transcriberId)
      Get value of the tier while also considering the transcriber.
      Parameters:
      transcriberId -
      Returns:
      value for the tier for the given transcriber if it is a blind tier, otherwise the value of the tier itself.
    • addTierListener

      public void addTierListener(TierListener<T> listener)
    • removeTierListener

      public void removeTierListener(TierListener<T> listener)
    • getExtensions

      public Set<Class<?>> getExtensions()
      Description copied from interface: IExtendable
      Return all extension types supported
      Specified by:
      getExtensions in interface IExtendable
    • getExtension

      public <T> T getExtension(Class<T> cap)
      Description copied from interface: IExtendable
      Get the requested extension if available.
      Specified by:
      getExtension in interface IExtendable
      Returns:
      the capability object or null if the cability is not available
    • putExtension

      public <T> T putExtension(Class<T> cap, T impl)
      Description copied from interface: IExtendable
      Add a new extension.
      Specified by:
      putExtension in interface IExtendable
      Parameters:
      cap - the extension to add
      Returns:
      the added extension implementation
    • removeExtension

      public <T> T removeExtension(Class<T> cap)
      Description copied from interface: IExtendable
      Remove a capability.
      Specified by:
      removeExtension in interface IExtendable
      Parameters:
      cap - the capability to remove