</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="lib" level="project" />
</component>
-</module>
+</module>
\ No newline at end of file
double r_diff = this.getColor().getRed() - eye.getColor().getRed();
double g_diff = this.getColor().getGreen() - eye.getColor().getGreen();
double b_diff = this.getColor().getBlue() - eye.getColor().getBlue();
- // See https://en.wikipedia.org/wiki/Color_difference
+ //See https://en.wikipedia.org/wiki/Color_difference
Double distance = Math.sqrt(2 * Math.pow(r_diff, 2) + 4 * Math.pow(g_diff, 2) + 3 * Math.pow(b_diff, 2));
return distance.intValue();
}
this.label.setText("Eyes color");
this.colorsList = new JList(getEyeObj().getColorsList());
this.colorsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ this.colorsList.setLayoutOrientation(JList.VERTICAL);
add(label);
add(colorsList);
}
//creating and showing this application's GUI.
String programName = "Person Comparator";
+ Eye blackEye = new Eye("black");
+ Eye greenEye = new Eye("green");
+ Eye blueEye = new Eye("blue");
+ Eye brownEye = new Eye("brown");
+
+ //Person person = new Person();
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
import java.util.ArrayList;
public class MainWindowsView extends JFrame {
+
MainWindowsView(String title) {
//Create and set up the window.
setTitle(title);
//this.pack();
this.setVisible(true);
}
-
}
\ No newline at end of file
+import java.util.ArrayList;
import java.util.Comparator;
public class Person implements Comparable<Person>, Comparator<Person> {
private Size size;
private Weight weight;
private Eye eye;
+ //List of persons in the database to compare to.
+ private ArrayList<Person> personArrayList;
Person(Firstname firstname, Origin origin, Size size, Weight weight, Eye eye) {
setFirstname(firstname);
return eye;
}
+ public void setPersonArrayList(ArrayList<Person> personArrayList) {
+ this.personArrayList = personArrayList;
+ }
+
+ public ArrayList<Person> getPersonArrayList() {
+ return personArrayList;
+ }
+
@Override
public int compareTo(Person person) {
return this.firstname.compareTo(person.getFirstname()) + this.origin.compareTo(person.getOrigin())