TrustGrapher  r52
A playabale simulator for modelling trust between agents
D:/src/cu/repsystestbed/graphs/FeedbackHistoryGraphEdge.java
Go to the documentation of this file.
00001 package cu.repsystestbed.graphs;
00002 
00003 import java.util.ArrayList;
00004 
00005 import cu.repsystestbed.data.Feedback;
00006 import cu.repsystestbed.entities.Agent;
00007 
00008 public class FeedbackHistoryGraphEdge extends TestbedEdge
00009 {
00010 
00011         private static final long serialVersionUID = 1590992129571899946L;
00012         public ArrayList<Feedback> feedbacks; 
00013         
00014         public FeedbackHistoryGraphEdge(Agent src, Agent sink) throws Exception
00015         {
00016                 if(src.equals(sink)) throw new Exception("src == sink.");
00017                 super.src = src;
00018                 super.sink = sink;
00019                 feedbacks = new ArrayList<Feedback>();
00020                 
00021         }
00022         
00023         public void addFeedback(Feedback feedback) throws Exception
00024         {
00025                 if(!feedback.getAssesor().equals(super.src)) throw new Exception("Adding a feedback to the wrong edge. e.source!=edge.src");
00026                 this.feedbacks.add(feedback);
00027         }
00028         
00029         public ArrayList getFeedbacks()
00030         {
00031                 return this.feedbacks;
00032         }
00033         
00034         public boolean equals(Object o)
00035         {
00036                 FeedbackHistoryGraphEdge otherEdge = (FeedbackHistoryGraphEdge) o;
00037                 if(this.sink.equals(otherEdge.sink) && this.src.equals(otherEdge.src)) return true;
00038                 else return false;
00039         }
00040         
00041 
00042         
00043 
00044 }