00001 package instruction.semanticObjects; 00002 00003 import java.util.ArrayList; 00004 00005 public class Sentence extends Instruction { 00006 00007 private ArrayList<ObjectX> actors = new ArrayList<ObjectX>(); 00008 00009 public Sentence() { 00010 00011 } 00012 00013 public ArrayList<ObjectX> getActors() { 00014 return actors; 00015 } 00016 00017 public void addActor(ObjectX actor) { 00018 actors.add( actor ); 00019 } 00020 00021 public void setActors(ArrayList<ObjectX> actors) { 00022 this.actors = actors; 00023 } 00024 00025 public boolean equals(Object desc) { 00026 if (! (desc instanceof Sentence) ) 00027 return false; 00028 return super.equals( desc ) && actors.equals( ((Sentence) desc).getActors() ); 00029 } 00030 00031 public String toString() { 00032 String str = ""; 00033 str += action.getAction().getLabel(); 00034 for (int i = 0; i < objects.size(); i++) { 00035 str += objects.get( i ); 00036 if (i < objects.size() - 1) 00037 str += ","; 00038 } 00039 str += "("; 00040 for (int i = 0; i < actors.size(); i++) { 00041 str += actors.get( i ); 00042 if (i < actors.size() - 1) 00043 str += ","; 00044 } 00045 str += ")"; 00046 return str; 00047 } 00048 }