Class AlignedTypesDatabase

java.lang.Object
ca.phon.alignedTypesDatabase.AlignedTypesDatabase
All Implemented Interfaces:
Serializable

public final class AlignedTypesDatabase extends Object implements Serializable
A database of types (unique strings) along with the tiers in which they appear and a list of other types to which they are linked. This database also includes a list of tiers along with ordering and visibility of those tiers. The visibility parameter is used by the editor view and will not affect the return values for the tierNames() or tierInfo() methods.
See Also:
  • Method Details

    • impl

      public AlignedTypesDatabaseImpl impl()
    • addUserTier

      public void addUserTier(String tierName)
      Adds a user tier to the list of tiers in the database Tier data type is assumed to be TierString
      Parameters:
      tierName -
    • addAlignedTypes

      public void addAlignedTypes(Map<String,String> alignedTypes)
      Add aligned types to the database. This method will add each type as a key in the database and setup tier links as necessary.
      Parameters:
      alignedTypes - a map of tierName -> types which will be added to the database
    • addAlignedTypes

      public void addAlignedTypes(String[] tierNames, String[] types)
    • addAlignment

      public void addAlignment(String tierName, String type, String alignedTierName, String alignedType)
    • removeAlignedTypes

      public boolean removeAlignedTypes(Map<String,String> alignedTypes)
      Remove alignment from database
      Parameters:
      alignedTypes -
      Returns:
    • removeAlignedTypes

      public boolean removeAlignedTypes(String[] tierNames, String[] types)
      Remove alignment from the database
      Parameters:
      tierNames -
      types -
      Returns:
    • alignedTypesForTier

      public Map<String,String[]> alignedTypesForTier(String tierName, String type)
      Return a set of aligned types given a tier name and type that exists for that tier.
      Parameters:
      tierName -
      type -
      Returns:
      a map of aligned tier values for the given tier and type
    • alignedTypesForTier

      public Map<String,String[]> alignedTypesForTier(String tierName, String type, List<String> tierList)
      Return a set of aligned types given a tier name and type that exists for that tier.
      Parameters:
      tierName -
      type -
      tierList -
      Returns:
      a map of aligned tier values for the given tier and type
    • tierNames

      public Collection<String> tierNames()
    • getTierInfo

      public Collection<TierInfo> getTierInfo()
    • typesForTier

      public Collection<String> typesForTier(String keyTier)
      Return all types for given keyTier
      Parameters:
      keyTier -
      Returns:
      all types which appear for the given keyTier
    • typeExists

      public boolean typeExists(String type)
      Does the given type exist in the database
      Parameters:
      type -
      Returns:
      true if type exists in database (any tier)
    • removeType

      public boolean removeType(String type)
      Remove type from database
      Parameters:
      type -
      Returns:
      true if type was removed, false if type does not exist in db
    • typeExistsInTier

      public boolean typeExistsInTier(String type, String tier)
    • alignmentExists

      public boolean alignmentExists(String tierName, String tierVal, String linkedTier, String linkedVal)
      Is there a link between the two tier values
      Parameters:
      tierName -
      tierVal -
      linkedTier -
      linkedVal -
    • removeAlignment

      public boolean removeAlignment(String tierName, String type, String alignedTierName, String alignedType)
      Remove the link between two tier values. If all links for the tier are removed, the type is also removed for that tier
      Parameters:
      tierName -
      type -
      alignedTierName -
      alignedType -
      Returns:
      true if link was removed
    • hasAlignedTypes

      public boolean hasAlignedTypes(Map<String,String> alignedTypes)
    • hasAlignedTypes

      public boolean hasAlignedTypes(String[] tierNames, String[] rowVals)
    • addDatabaseListener

      public void addDatabaseListener(AlignedTypesDatabaseListener listener)
    • removeDatabaseListener

      public void removeDatabaseListener(AlignedTypesDatabaseListener listener)
    • typeIterator

      public TypeIterator typeIterator()
      Return an iterator for types in the database
      Returns:
      type iterator
    • typeIterator

      public TypeIterator typeIterator(Predicate<String> filter)
      Return an iterator for types in the database using given filter
      Parameters:
      filter -
      Returns:
      type iterator for types which pass filter
    • typesWithPrefix

      public TypeIterator typesWithPrefix(String prefix)
      Return an iterator for types with given prefix
      Parameters:
      prefix -
      Returns:
      type iterator for types with given prefix
    • typesWithPrefix

      public TypeIterator typesWithPrefix(String prefix, boolean caseSensitive)
    • typesWithPrefix

      public TypeIterator typesWithPrefix(String prefix, Predicate<String> filter)
    • typesWithPrefix

      public TypeIterator typesWithPrefix(String prefix, boolean caseSensitive, Predicate<String> filter)
      Return an iterator for types with given prefix
      Parameters:
      prefix -
      caseSensitive -
      filter -
      Returns:
      type iterator for types with given prefix
    • typesContaining

      public TypeIterator typesContaining(String infix)
      Return an iterator for types which contain infix
      Parameters:
      infix -
      Returns:
      type iterator for types containing infix
    • typesContaining

      public TypeIterator typesContaining(String infix, boolean caseSensitive)
    • typesContaining

      public TypeIterator typesContaining(String infix, Predicate<String> filter)
    • typesContaining

      public TypeIterator typesContaining(String infix, boolean caseSensitive, Predicate<String> filter)
      Return an iterator for types which contain infix
      Parameters:
      infix -
      caseSensitive -
      filter -
      Returns:
      type iterator for types containing infix
    • typesWithSuffix

      public TypeIterator typesWithSuffix(String suffix)
      Return an iterator for types ending with suffix
      Parameters:
      suffix -
      Returns:
      iterator for types ending with suffix
    • typesWithSuffix

      public TypeIterator typesWithSuffix(String suffix, boolean caseSensitive)
    • typesWithSuffix

      public TypeIterator typesWithSuffix(String suffix, Predicate<String> filter)
    • typesWithSuffix

      public TypeIterator typesWithSuffix(String suffix, boolean caseSensitive, Predicate<String> filter)
      Return an iterator for types ending with suffix
      Parameters:
      suffix -
      caseSensitive -
      filter -
      Returns:
      iterator for types ending with suffix