Checkpoint: added performExchange
This commit is contained in:
@ -1,27 +1,36 @@
|
||||
package com.plannaplan.models;
|
||||
|
||||
import com.plannaplan.entities.Assignment;
|
||||
import com.plannaplan.entities.Exchange;
|
||||
|
||||
public class MatchData {
|
||||
private Assignment assignmentOne;
|
||||
private Assignment assignmentTwo;
|
||||
private Exchange exchangeOne;
|
||||
private Exchange exchangeTwo;
|
||||
|
||||
public MatchData(Assignment assignmentOne, Assignment assignmentTwo) {
|
||||
this.assignmentOne = assignmentOne;
|
||||
this.assignmentTwo = assignmentTwo;
|
||||
public MatchData(Exchange exchangeOne, Exchange exchangeTwo) {
|
||||
this.exchangeOne = exchangeOne;
|
||||
this.exchangeTwo = exchangeTwo;
|
||||
}
|
||||
|
||||
public Exchange getExchangeOne() {
|
||||
return this.exchangeOne;
|
||||
}
|
||||
|
||||
public Exchange getExchangeTwo() {
|
||||
return this.exchangeTwo;
|
||||
}
|
||||
|
||||
public Assignment getAssignmentTwo() {
|
||||
return assignmentTwo;
|
||||
return this.exchangeTwo.getOwnedAssignment();
|
||||
}
|
||||
|
||||
public Assignment getAssignmentOne() {
|
||||
return assignmentOne;
|
||||
return this.exchangeOne.getOwnedAssignment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.assignmentOne.hashCode() + this.assignmentTwo.hashCode();
|
||||
return this.getAssignmentOne().hashCode() + this.getAssignmentTwo().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,6 +53,6 @@ public class MatchData {
|
||||
MatchData c = (MatchData) o;
|
||||
|
||||
// Compare the data members and return accordingly
|
||||
return (this.assignmentOne.equals(c.getAssignmentOne()) && this.assignmentTwo.equals(c.getAssignmentTwo())) || (this.assignmentOne.equals(c.getAssignmentTwo()) && this.assignmentTwo.equals(c.getAssignmentOne()));
|
||||
return (this.getAssignmentOne().equals(c.getAssignmentOne()) && this.getAssignmentTwo().equals(c.getAssignmentTwo())) || (this.getAssignmentOne().equals(c.getAssignmentTwo()) && this.getAssignmentTwo().equals(c.getAssignmentOne()));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user