00001 package instruction.semanticObjects; 00002 00003 import java.util.ArrayList; 00004 import java.util.List; 00005 00006 public class ObjectX extends SemanticObject { 00007 00011 private List<Word> name = new ArrayList<Word>(); 00012 00016 private Quantifier quantifier = new Quantifier(); 00017 00021 private List<Preposition> prepositions = new ArrayList<Preposition>(); 00022 00026 private List<Word> adjectives = new ArrayList<Word>(); 00027 00032 private List<Description> descriptions = new ArrayList<Description>(); 00033 00034 private List<Word> participles = new ArrayList<Word>(); 00035 00043 public ObjectX ( Word name ) { 00044 00045 this.name.add( name ); 00046 } 00047 00051 public ObjectX () { 00052 00053 } 00054 00055 public void addNameComponent( Word n ) { 00056 00057 name.add( n ); 00058 } 00059 00060 public List<Word> getName() { 00061 00062 return name; 00063 } 00064 00065 public void setName( List<Word> n ) { 00066 00067 name = n; 00068 } 00069 00070 public Quantifier getQuantifier() { 00071 00072 return quantifier; 00073 } 00074 00075 public List<Description> getDescriptions() { 00076 00077 return descriptions; 00078 } 00079 00080 public void addDescription( Description desc ) { 00081 00082 descriptions.add( desc ); 00083 } 00084 00085 public void setDescriptions( ArrayList<Description> descs ) { 00086 00087 descriptions = descs; 00088 } 00089 00090 public void setQuantifier( Quantifier q ) { 00091 00092 quantifier = q; 00093 } 00094 00095 public List<Word> getAdjectives() { 00096 00097 return adjectives; 00098 } 00099 00100 public void addPreposition( Preposition loc ) { 00101 00102 prepositions.add( loc ); 00103 } 00104 00105 public List<Preposition> getPrepositions() { 00106 00107 return prepositions; 00108 } 00109 00110 public String toString() { 00111 00112 String str = "("; 00113 00114 for ( int i = 0; i < name.size(); i++ ) { 00115 str += name.get( i ); 00116 if ( i < name.size() - 1 ) 00117 str += ","; 00118 } 00119 str += ","; 00120 00121 str += "{"; 00122 for ( int i = 0; i < adjectives.size(); i++ ) { 00123 str += adjectives.get( i ); 00124 if ( i + 1 < adjectives.size() ) 00125 str += ","; 00126 } 00127 str += "},"; 00128 00129 str += "{"; 00130 for ( int i = 0; i < prepositions.size(); i++ ) { 00131 str += prepositions.get( i ); 00132 if ( i < prepositions.size() - 1 ) 00133 str += ","; 00134 } 00135 str += "})"; 00136 return str; 00137 } 00138 00139 public boolean equals( Object o ) { 00140 00141 if ( ! ( o instanceof ObjectX ) ) 00142 return false; 00143 00144 boolean equals = true; 00145 00146 equals = equals && name.equals( ( (ObjectX) o ).getName() ); 00147 equals = equals && adjectives.equals( ( (ObjectX) o ).getAdjectives() ); 00148 equals = equals && prepositions.equals( ( (ObjectX) o ).getPrepositions() ); 00149 equals = equals && quantifier.equals( ( (ObjectX) o ).getQuantifier() ); 00150 00151 return equals; 00152 } 00153 00154 public void setParticiples( List<Word> participles ) { 00155 00156 this.participles = participles; 00157 } 00158 00159 public List<Word> getParticiples() { 00160 00161 return participles; 00162 } 00163 00164 public void addParticiple(Word part) { 00165 00166 participles.add( part ); 00167 00168 } 00169 }