001    package edu.upenn.cis.propbank_shen;
002    
003    import java.io.*;
004    
005    /**
006       We represent the future, past, and present tenses with the 
007       propbank inflectional information.
008    
009       <p>
010    
011       Sometimes, no tense is specified because this annotation isn't 
012       very complete, so we have NoTense as well.
013    
014       @author Scott Cotton
015       @see edu.upenn.cis.propbank_shen.Inflection
016    
017    */
018    public final class InflTense {
019    
020        private String srep;
021        /** use a private constructor so that only static members
022            can be referenced.  This helps us emulate an enumeration */
023        private InflTense(String s) {srep = s;}
024    
025        /** the future tense */
026        public static final InflTense Future = new InflTense("f");
027        /** the past tense */
028        public static final InflTense Past = new InflTense("p");
029        /** the present tense */
030        public static final InflTense Present = new InflTense("n");
031        /** no tense specified */
032        public static final InflTense NoTense = new InflTense("-");
033    
034        /** create a canonical string representation of the InflTense instance */
035        public String toString() { return srep; }
036        /** return an InflTense instance from a canonical string.
037            print an error on stderr if the string doesn't make sense, and
038            use the default "NoTense" in that case"
039        */
040        public static InflTense ofString(String s) 
041        {
042            if (s.equals("f")) { return InflTense.Future; }
043            else if (s.equals("p")) { return InflTense.Past; }
044            else if (s.equals("n")) { return InflTense.Present; }
045            else if (s.equals("-")) { return InflTense.NoTense; }
046            else {
047                System.err.println("invalid inflection.tense string: " + s);
048                return InflTense.NoTense;
049            }
050                
051        }
052    }