Preposition.java
Go to the documentation of this file.
00001 package instruction.semanticObjects;
00002 
00003 import java.util.ArrayList;
00004 import java.util.List;
00005 
00006 public class Preposition extends SemanticObject {
00007 
00008         private List<Word> prepositions = new ArrayList<Word>();
00009         private List<ObjectX> objects = new ArrayList<ObjectX>();
00010 
00011         public Preposition () {
00012 
00013         }
00014 
00015         public Preposition ( Word p, ObjectX o ) {
00016 
00017                 prepositions.add( p );
00018                 objects.add( o );
00019         }
00020         
00021         public void setPrepositions(List<Word> newPP) {
00022                 prepositions = newPP;
00023         }
00024 
00025         public List<ObjectX> getObjects() {
00026 
00027                 return objects;
00028         }
00029 
00030         public List<Word> getPrepositions() {
00031 
00032                 return prepositions;
00033         }
00034 
00035         public void addPreposition( Word pre ) {
00036 
00037                 prepositions.add( pre );
00038         }
00039 
00040         public void addObject( ObjectX o ) {
00041 
00042                 objects.add( o );
00043         }
00044         
00045         public void setObjects(List<ObjectX> newObjects) {
00046                 
00047                 objects = newObjects;
00048         }
00049 
00050         public String toString() {
00051 
00052                 String str = "({";
00053                 for ( int i = 0; i < prepositions.size(); i++ ) {
00054                         str += prepositions.get( i ).getLabel();
00055                         if ( i < prepositions.size() - 1 )
00056                                 str += ",";
00057                 }
00058                 str += "},{";
00059                 for ( int i = 0; i < objects.size(); i++ ) {
00060                         str += objects.get( i ).toString();
00061                         if ( i < objects.size() - 1 )
00062                                 str += ",";
00063                 }
00064                 str += "})";
00065                 return str;
00066         }
00067 
00068         public boolean equals( Object p ) {
00069                 if (! (p instanceof Preposition))
00070                         return false;
00071                 boolean equals = true;
00072 
00073                 equals = equals && prepositions.equals( ((Preposition) p).getPrepositions() );
00074                 equals = equals && objects.equals( ((Preposition) p).getObjects() );
00075                 return equals;
00076         }
00077 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


comp_ehow
Author(s): Moritz Tenorth, Daniel Nyga
autogenerated on Tue Apr 16 2013 00:18:03