Package pal.misc

Class SimpleIdGroup

  • All Implemented Interfaces:
    java.io.Serializable, IdGroup, Nameable

    public class SimpleIdGroup
    extends java.lang.Object
    implements IdGroup, java.io.Serializable, Nameable
    Default implementation of IdGroup interface. Memory-inefficient to allow fast whichIdNumber calls.
    Version:
    $Id: SimpleIdGroup.java,v 1.8 2001/11/26 03:59:24 matt Exp $
    Author:
    Alexei Drummond
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIdCount()
      Returns the number of identifiers in this group
      Identifier getIdentifier​(int i)
      Returns the ith identifier.
      java.lang.String getName()
      Return the name of this IdGroup.
      java.lang.String getName​(int i)
      Convenience method to return the name of identifier i
      void setIdentifier​(int i, Identifier id)
      Sets the ith identifier.
      void setName​(java.lang.String n)
      Sets the name of this IdGroup.
      java.lang.String toString()
      Returns a string representation of this IdGroup in the form of a bracketed list.
      int whichIdNumber​(java.lang.String name)
      Return index of identifier with name or -1 if not found
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SimpleIdGroup

        public SimpleIdGroup​(int size)
        Constructor taking the size of the group.
      • SimpleIdGroup

        public SimpleIdGroup​(java.lang.String[] labels)
        Constructor taking an array of strings.
      • SimpleIdGroup

        public SimpleIdGroup​(int size,
                             boolean createIDs)
        Constructor taking the size of the group.
        Parameters:
        size - - the number of ids
        createIDs - - if true creates default Identifiers. Otherwise leaves blank (for user to fill in)
      • SimpleIdGroup

        public SimpleIdGroup​(Identifier[] id)
        Constructor taking an array of identifiers.
      • SimpleIdGroup

        public SimpleIdGroup​(IdGroup a,
                             IdGroup b)
        Constructor taking two separate id groups and merging them.
      • SimpleIdGroup

        public SimpleIdGroup​(IdGroup a)
        Impersonating Constructor.
      • SimpleIdGroup

        public SimpleIdGroup​(IdGroup a,
                             int toIgnore)
        Impersonating Constructor.
        Parameters:
        toIgnore - - will ignore the identifier at the index specified by toIgnore
    • Method Detail

      • getIdCount

        public int getIdCount()
        Returns the number of identifiers in this group
        Specified by:
        getIdCount in interface IdGroup
      • getName

        public final java.lang.String getName​(int i)
        Convenience method to return the name of identifier i
      • whichIdNumber

        public int whichIdNumber​(java.lang.String name)
        Return index of identifier with name or -1 if not found
        Specified by:
        whichIdNumber in interface IdGroup
      • toString

        public java.lang.String toString()
        Returns a string representation of this IdGroup in the form of a bracketed list.
        Overrides:
        toString in class java.lang.Object
      • getName

        public java.lang.String getName()
        Return the name of this IdGroup.
        Specified by:
        getName in interface Nameable
        Returns:
        name of this object.
      • setName

        public void setName​(java.lang.String n)
        Sets the name of this IdGroup.
        Specified by:
        setName in interface Nameable
        Parameters:
        n - the new name.