Package pal.datatype

Class SimpleDataType

    • Constructor Detail

      • SimpleDataType

        public SimpleDataType()
    • Method Detail

      • getState

        public final int getState​(char c)
        Handles gap char and then passes on to getStateImpl
        Specified by:
        getState in interface DataType
        Parameters:
        c - character
        Returns:
        state
      • getChar

        public final char getChar​(int state)
        Handles gap state and then passes on to getStateImpl
        Specified by:
        getChar in interface DataType
        Parameters:
        state - state return corresponding character
      • getStateImpl

        protected abstract int getStateImpl​(char c)
        For sub classes to implement main functionality of getState. Gaps do not need to be considered
      • getCharImpl

        protected abstract char getCharImpl​(int state)
      • getPreferredChar

        public final char getPreferredChar​(char c)
        Automatically handles Gaps for sub classes
        Specified by:
        getPreferredChar in interface DataType
      • getPreferredCharImpl

        protected char getPreferredCharImpl​(char c)
        Can be overidden by subclasses. Default implementation get's character's state and that get's the character for that state
      • isUnknownChar

        public final boolean isUnknownChar​(char c)
        Specified by:
        isUnknownChar in interface DataType
        Returns:
        true if this state is unknown (or a gap)
      • isUnknownState

        public final boolean isUnknownState​(int state)
        Checks if state is a gap state (then returns true), otherwise passes on to isUnknownStateImpl
        Specified by:
        isUnknownState in interface DataType
        Returns:
        true if this state is an unknown state (the same as check if a state is >= the number of states... but neater)
      • isUnknownStateImpl

        protected abstract boolean isUnknownStateImpl​(int state)
        For subclasses to handle, without regard for gaps
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isAmbiguous

        public boolean isAmbiguous()
        Specified by:
        isAmbiguous in interface DataType
        Returns:
        false
      • hasGap

        public final boolean hasGap()
        Specified by:
        hasGap in interface DataType
        Returns:
        true
      • isGapChar

        public final boolean isGapChar​(char c)
        Specified by:
        isGapChar in interface DataType
        Returns:
        true if this character is a '.' or a '_'
      • isGapState

        public final boolean isGapState​(int state)
        Specified by:
        isGapState in interface DataType
        Returns:
        true if state is gap state (-2), false other wise
      • getRecommendedGapState

        public final int getRecommendedGapState()
        Specified by:
        getRecommendedGapState in interface DataType
        Returns:
        GAP_STATE (-2)