Package ca.phon.alignedTypesDatabase
Class AlignedTypesDatabaseTSTImpl
java.lang.Object
ca.phon.alignedTypesDatabase.AlignedTypesDatabaseTSTImpl
- All Implemented Interfaces:
AlignedTypesDatabaseImpl
,Serializable
public final class AlignedTypesDatabaseTSTImpl
extends Object
implements Serializable, AlignedTypesDatabaseImpl
AlignedTypesDatabase
implementation using TernaryTree as a backend.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAlignedTypes
(String[] tierNames, String[] types) void
addAlignedTypes
(Map<String, String> alignedTypes) Add aligned types to the database.void
addAlignment
(String tierName, String type, String alignedTierName, String alignedType) void
ca.hedlund.tst.TernaryTreeNode<Collection<ca.phon.alignedTypesDatabase.TypeEntry>>
addTypeForTier
(String tierName, String type) Add type for specified tiervoid
addUserTier
(String tierName) Adds a user tier to the list of tiers in the database Tier data type is assumed to be TierStringalignedTypesForTier
(String tierName, String type) Return a set of aligned types given a tier name and type that exists for that tier.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.boolean
alignmentExists
(String tierName, String tierVal, String linkedTier, String linkedVal) Is there a link between the two tier valuesboolean
hasAlignedTypes
(String[] tierNames, String[] rowVals) boolean
hasAlignedTypes
(Map<String, String> alignedTypes) void
importDatabase
(AlignedTypesDatabase importDb) Import all entries from given database into this database.boolean
removeAlignedTypes
(String[] tierNames, String[] types) boolean
removeAlignedTypes
(Map<String, String> alignedTypes) boolean
removeAlignment
(String tierName, String type, String alignedTierName, String alignedType) Remove the link between two tier values.void
boolean
removeType
(String type) boolean
typeExists
(String type) boolean
typeExistsInTier
(String type, String tier) typeIterator
(Predicate<String> filter) typesContaining
(String infix, boolean caseSensitive, Predicate<String> filter) typesForTier
(String keyTier) Return all types for given keyTiertypesWithPrefix
(String prefix, boolean caseSensitive, Predicate<String> filter) typesWithSuffix
(String suffix, boolean caseSensitive, Predicate<String> filter)
-
Method Details
-
addUserTier
Adds a user tier to the list of tiers in the database Tier data type is assumed to be TierString- Specified by:
addUserTier
in interfaceAlignedTypesDatabaseImpl
- Parameters:
tierName
-
-
addTypeForTier
public ca.hedlund.tst.TernaryTreeNode<Collection<ca.phon.alignedTypesDatabase.TypeEntry>> addTypeForTier(String tierName, String type) Add type for specified tier- Throws:
IllegalStateException
- if unable to add tier name or type to database
-
addAlignedTypes
Add aligned types to the database. This method will add each type as a key in the database and setup tier links as necessary.- Specified by:
addAlignedTypes
in interfaceAlignedTypesDatabaseImpl
- Parameters:
alignedTypes
- a map of tierName -> types which will be added to the database
-
addAlignedTypes
- Specified by:
addAlignedTypes
in interfaceAlignedTypesDatabaseImpl
-
addAlignment
- Specified by:
addAlignment
in interfaceAlignedTypesDatabaseImpl
-
removeAlignedTypes
- Specified by:
removeAlignedTypes
in interfaceAlignedTypesDatabaseImpl
-
removeAlignedTypes
- Specified by:
removeAlignedTypes
in interfaceAlignedTypesDatabaseImpl
-
alignedTypesForTier
Return a set of aligned types given a tier name and type that exists for that tier.- Specified by:
alignedTypesForTier
in interfaceAlignedTypesDatabaseImpl
- 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.- Specified by:
alignedTypesForTier
in interfaceAlignedTypesDatabaseImpl
- Parameters:
tierName
-type
-tierList
-- Returns:
- a map of aligned tier values for the given tier and type
-
tierNames
- Specified by:
tierNames
in interfaceAlignedTypesDatabaseImpl
-
getTierInfo
- Specified by:
getTierInfo
in interfaceAlignedTypesDatabaseImpl
-
typesForTier
Return all types for given keyTier- Specified by:
typesForTier
in interfaceAlignedTypesDatabaseImpl
- Parameters:
keyTier
-- Returns:
- all types which appear for the given keyTier
-
typeExists
- Specified by:
typeExists
in interfaceAlignedTypesDatabaseImpl
-
removeType
- Specified by:
removeType
in interfaceAlignedTypesDatabaseImpl
-
typeExistsInTier
- Specified by:
typeExistsInTier
in interfaceAlignedTypesDatabaseImpl
-
alignmentExists
public boolean alignmentExists(String tierName, String tierVal, String linkedTier, String linkedVal) Is there a link between the two tier values- Specified by:
alignmentExists
in interfaceAlignedTypesDatabaseImpl
- 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- Specified by:
removeAlignment
in interfaceAlignedTypesDatabaseImpl
- Parameters:
tierName
-type
-alignedTierName
-alignedType
-- Returns:
- true if link was removed
-
hasAlignedTypes
- Specified by:
hasAlignedTypes
in interfaceAlignedTypesDatabaseImpl
-
hasAlignedTypes
- Specified by:
hasAlignedTypes
in interfaceAlignedTypesDatabaseImpl
-
importDatabase
Import all entries from given database into this database.- Parameters:
importDb
-
-
addDatabaseListener
- Specified by:
addDatabaseListener
in interfaceAlignedTypesDatabaseImpl
-
removeDatabaseListener
- Specified by:
removeDatabaseListener
in interfaceAlignedTypesDatabaseImpl
-
typesWithPrefix
- Specified by:
typesWithPrefix
in interfaceAlignedTypesDatabaseImpl
-
typesContaining
- Specified by:
typesContaining
in interfaceAlignedTypesDatabaseImpl
-
typesWithSuffix
- Specified by:
typesWithSuffix
in interfaceAlignedTypesDatabaseImpl
-
typeIterator
- Specified by:
typeIterator
in interfaceAlignedTypesDatabaseImpl
-