Anticipation031.java

Package: agent/
File: Anticipation031.java

  1. package agent;
  2.  
  3. import coupling.Experiment;
  4.  
  5. /**
  6.  * An Anticipation031 is created for each experience.
  7.  * Anticipations031 are equal if they propose the same experience.
  8.  * An Anticipation031 is greater than another if its proclivity is greater that the other's.
  9.  */
  10. public class Anticipation031 implements Anticipation {
  11.  
  12. Experiment experience;
  13. int proclivity;
  14.  
  15. public Anticipation031(Experiment experience, int proclivity){
  16. this.experience = experience;
  17. this.proclivity = proclivity;
  18. }
  19.  
  20. public int compareTo(Anticipation anticipation){
  21. return new Integer(((Anticipation031)anticipation).getProclivity()).compareTo(this.proclivity);
  22. }
  23.  
  24. public boolean equals(Object otherProposition){
  25. return ((Anticipation031)otherProposition).getExperience() == this.experience;
  26. }
  27.  
  28. public Experiment getExperience() {
  29. return this.experience;
  30. }
  31.  
  32. public void setExperience(Experiment experience) {
  33. this.experience = experience;
  34. }
  35.  
  36. public int getProclivity() {
  37. return proclivity;
  38. }
  39.  
  40. public void addProclivity(int proclivity) {
  41. this.proclivity += proclivity;
  42. }
  43.  
  44. public String toString(){
  45. return this.experience.getLabel() + " proclivity " + this.proclivity;
  46. }
  47.  
  48. }
  49.  

See public discussions about this page or start a new discussion by clicking on the Google+ Share button. Please type the #IDEALMOOCAnticipation031 hashtag in your post: