algorithm.matching
Class MatchList

java.lang.Object
  extended by algorithm.matching.MatchList

public class MatchList
extends java.lang.Object

Data structure to hold assignments found in assignment algorithms. saving the matching partners in a list, as well as saving the total costs for this assignment. The matchings are saved in an order according to their matching costs.


Field Summary
private  org.apache.log4j.Logger logger
          logger instance
private  java.util.Queue<Matching> matchlist
          holding all matchings, order according to their matching costs
private  double totalcost
          the totalcost for all matchings
 
Constructor Summary
MatchList()
          constructor.
 
Method Summary
 void addMatching(int partnerid1, int partnerid2, double cost)
          add a new matching.
 boolean contains(Matching matching)
          check if a matchlist contains a specified matching
 boolean equals(MatchList compare)
          check if a given matchlist contains the same matchings as the current instance.
 java.util.Queue<Matching> getMatchlist()
          return matchlist - list containing all found matches.
 double getMean()
          Get the average matching costs of this match list.
 double getMedian()
           
 double getStandardDeviation()
           
 double getTotalcost()
          get this matching's total cost
 void setTotalcost(double totalcost)
          set this matching's total cost.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

matchlist

private final java.util.Queue<Matching> matchlist
holding all matchings, order according to their matching costs


totalcost

private double totalcost
the totalcost for all matchings


logger

private final org.apache.log4j.Logger logger
logger instance

Constructor Detail

MatchList

public MatchList()
constructor. creating new empty arraylist to save all found matchings.

Method Detail

getTotalcost

public double getTotalcost()
get this matching's total cost

Returns:
totalcost

setTotalcost

public void setTotalcost(double totalcost)
set this matching's total cost. if not set, default is 0.

Parameters:
totalcost -

addMatching

public void addMatching(int partnerid1,
                        int partnerid2,
                        double cost)
add a new matching.

Parameters:
partnerid1 - - id of the first partner
partnerid2 - - if of the snd partner
cost -

contains

public boolean contains(Matching matching)
check if a matchlist contains a specified matching

Parameters:
matching -
Returns:
true if the match list contains the specified matching, false if not

getMean

public double getMean()
Get the average matching costs of this match list.

Returns:
average matching cost

getStandardDeviation

public double getStandardDeviation()

getMedian

public double getMedian()

equals

public boolean equals(MatchList compare)
check if a given matchlist contains the same matchings as the current instance.

Parameters:
compare - the matchlist to be compared
Returns:
true if matching partners and total costs are equal, false if not

getMatchlist

public java.util.Queue<Matching> getMatchlist()
return matchlist - list containing all found matches.

Returns:
matchlist

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object