CSC407/ECE450 Assignment 1b Sample Solution

plan.dom
Class ReverseFeaturePlanningOrder

java.lang.Object
  |
  +--plan.dom.ReverseFeaturePlanningOrder
All Implemented Interfaces:
java.util.Comparator

class ReverseFeaturePlanningOrder
extends java.lang.Object
implements java.util.Comparator

Compares Features by in-plan desirability. More highly desirable features are < less desirable ones in order that sort can sort them so that the most desired ones come out first.

The criteria are

  1. higher priority
  2. greater cumulative customer desirability
  3. smaller sizing


Field Summary
private static java.util.Comparator theInstance
           
 
Constructor Summary
private ReverseFeaturePlanningOrder()
          Ensure only one instance.
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compares two features to see which is least desirable to be in-plan.
 boolean equals(java.lang.Object o1, java.lang.Object o2)
          Compares two features for equal in-plan desirability.
static java.util.Comparator get()
          Returns the unique instance of this comparator
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

theInstance

private static java.util.Comparator theInstance
Constructor Detail

ReverseFeaturePlanningOrder

private ReverseFeaturePlanningOrder()
Ensure only one instance.
Method Detail

get

public static java.util.Comparator get()
Returns the unique instance of this comparator

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compares two features to see which is least desirable to be in-plan.
Specified by:
compare in interface java.util.Comparator

equals

public boolean equals(java.lang.Object o1,
                      java.lang.Object o2)
Compares two features for equal in-plan desirability.

CSC407/ECE450 Assignment 1b Sample Solution