Update of /cvsroot/tail/Tail/src/java/net/sf/tail
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv17810/src/java/net/sf/tail
Modified Files:
Operation.java Trade.java
Log Message:
overrided o método equals
Index: Operation.java
===================================================================
RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/Operation.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Operation.java 19 May 2007 12:37:56 -0000 1.1
--- Operation.java 19 May 2007 14:17:47 -0000 1.2
***************
*** 5,9 ****
private OperationType type;
private int index;
!
public Operation(int index, OperationType type) {
this.type = type;
--- 5,9 ----
private OperationType type;
private int index;
!
public Operation(int index, OperationType type) {
this.type = type;
***************
*** 14,20 ****
return type;
}
!
public int getIndex() {
return index;
}
}
--- 14,31 ----
return type;
}
!
public int getIndex() {
return index;
}
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof Operation) {
+ Operation o = (Operation) obj;
+ return type.equals(o.getType()) &&
+ (index == o.getIndex());
+ }
+ return false;
+ }
+
}
Index: Trade.java
===================================================================
RCS file: /cvsroot/tail/Tail/src/java/net/sf/tail/Trade.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Trade.java 19 May 2007 12:37:57 -0000 1.1
--- Trade.java 19 May 2007 14:17:47 -0000 1.2
***************
*** 20,22 ****
--- 20,32 ----
}
+ @Override
+ public boolean equals(Object obj) {
+ if(obj instanceof Trade){
+ Trade t = (Trade)obj;
+ return entry.equals(t.getEntry()) &&
+ exit.equals(t.getExit());
+ }
+ return false;
+ }
+
}
|