001    package edu.nrao.sss.model.project.scan;
002    
003    import edu.nrao.sss.util.EnumerationUtility;
004    
005    /**
006     * An indicator for interpreting a position as either absolute or relative.
007     * <p>
008     * <b>CVS Info:</b>
009     * <table style="margin-left:2em">
010     *   <tr><td>$Revision: 161 $</td></tr>
011     *   <tr><td>$Date: 2006-12-15 11:48:34 -0700 (Fri, 15 Dec 2006) $</td></tr>
012     *   <tr><td>$Author: btruitt $</td></tr>
013     * </table></p>
014     *  
015     * @author David M. Harland
016     * @since 2006-09-08
017     */
018    public enum PositionType
019    {
020      /**
021       * Indicates that a position is an absolute position.
022       */
023      ABSOLUTE,
024      
025      /**
026       * Indicates that a position is relative to, or offset from,
027       * another position.
028       */
029      OFFSET;
030      
031      /**
032       * Returns the default position type.
033       * @return the default position type.
034       */
035      public static PositionType getDefault()
036      {
037        return ABSOLUTE;
038      }
039      
040      /**
041       * Returns a text representation of this enumeration constant.
042       * @return a text representation of this enumeration constant.
043       */
044      public String toString()
045      {
046        return EnumerationUtility.getSharedInstance().enumToString(this);
047      }
048      
049      /**
050       * Returns the position type represented by {@code text}.
051       * <p>
052       * For details about the transformation, see
053       * {@link EnumerationUtility#enumFromString(Class, String)}.</p>
054       * 
055       * @param text a text representation of a position type.
056       * 
057       * @return the position type represented by {@code text}.
058       */
059      public static PositionType fromString(String text)
060      {
061        return EnumerationUtility.getSharedInstance()
062                                 .enumFromString(PositionType.class, text);
063      }
064    }