001    package edu.nrao.sss.model.resource;
002    
003    import edu.nrao.sss.util.EnumerationUtility;
004    
005    /**
006     * A list of ways to identify an antenna.
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-12-11
017     */
018    public enum AntennaSpecifier
019    {
020      /**
021       * Indicates that an antenna has been specified via its own ID.
022       */
023      ANTENNA_ID("Antenna ID"),
024      
025      /**
026       * Indicates that an antenna has been specified via the ID of its pad.
027       */
028      PAD_ID("Pad ID");
029      
030      private String displayText;
031      
032      private AntennaSpecifier(String display)
033      {
034        displayText = display;
035      }
036      
037      /**
038       * Returns the default antenna specifier.
039       * @return the default antenna specifier.
040       */
041      public static AntennaSpecifier getDefault()
042      {
043        return ANTENNA_ID;
044      }
045      
046      /**
047       * Returns a text representation of this enumeration constant.
048       * @return a text representation of this enumeration constant.
049       */
050      public String toString()
051      {
052        return displayText;
053      }
054      
055      /**
056       * Returns the antenna specifier represented by {@code text}.
057       * <p>
058       * For details about the transformation, see
059       * {@link EnumerationUtility#enumFromString(Class, String)}.</p>
060       * 
061       * @param text a text representation of an antenna specifier.
062       * 
063       * @return the antenna specifier represented by {@code text}.
064       */
065      public static AntennaSpecifier fromString(String text)
066      {
067        return EnumerationUtility.getSharedInstance()
068                                 .enumFromString(AntennaSpecifier.class, text);
069      }
070    }