001 package edu.nrao.sss.model.project.scan; 002 003 import edu.nrao.sss.util.EnumerationUtility; 004 005 /** 006 * The direction in which to tip 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-07-18 017 */ 018 public enum TippingOrder 019 { 020 /** 021 * Tip the antenna from the lowest elevation to the highest. 022 */ 023 LOW_TO_HIGH, 024 025 /** 026 * Tip the antenna from the highest elevation to the lowest. 027 */ 028 HIGH_TO_LOW; 029 030 private TippingOrder reverse; 031 032 //Would have preferred to do this in the constructor, but we are not 033 //allowed to forward-reference another element. E.g., cannot 034 //write: LOW_TO_HIGH(HIGH_TO_LOW), 035 // HIGH_TO_LOW(LOW_TO_HIGH); 036 static 037 { 038 LOW_TO_HIGH.reverse = HIGH_TO_LOW; 039 HIGH_TO_LOW.reverse = LOW_TO_HIGH; 040 } 041 042 /** 043 * Returns the tipping order that represents the reverse direction 044 * from this one. 045 * @return the reverse tipping order. 046 */ 047 public TippingOrder getReverseOrder() { return reverse; } 048 049 /** 050 * Returns the default tipping direction. 051 * @return the default tipping direction. 052 */ 053 public static TippingOrder getDefault() 054 { 055 return LOW_TO_HIGH; 056 } 057 058 /** 059 * Returns a text representation of this enumeration constant. 060 * @return a text representation of this enumeration constant. 061 */ 062 public String toString() 063 { 064 return EnumerationUtility.getSharedInstance().enumToString(this); 065 } 066 067 /** 068 * Returns the tipping order represented by {@code text}. 069 * <p> 070 * For details about the transformation, see 071 * {@link EnumerationUtility#enumFromString(Class, String)}.</p> 072 * 073 * @param text a text representation of a tipping order. 074 * 075 * @return the tipping order represented by {@code text}. 076 */ 077 public static TippingOrder fromString(String text) 078 { 079 return EnumerationUtility.getSharedInstance() 080 .enumFromString(TippingOrder.class, text); 081 } 082 }