@Test public void testEquals() { Appt a1 = new Appt(2020,11,4,9,00, "Vote"); Appt a2 = new Appt( LocalDate.of(2020, 11, 4), LocalTime.of(9, 00), "Vote"); assertEquals("equals constructed both ways", a1, a2); }
@Override public boolean equals(Object o2) { if (this == o2) return true; if (o2.getClass() != Appt.class) return false; Appt a2 = (Appt) o2; if (!date.equals(a2.date)) return false; if (time != null && !time.equals(a2.time)) return false; return text.equals(a2.text); }
Appt implements Comparable<Appt> { @Override public boolean equals(Object o2) { if (this == o2) return true; if (o2.getClass() != Appt.class) return false; Appt a2 = (Appt) o2; if (!date.equals(a2.date)) return false; if (time != null && !time.equals(a2.time)) return false; return text.equals(a2.text); } }
Appt implements Comparable<Appt> { @Override public boolean equals(Object o2) { if (this == o2) return true; if (o2.getClass() != Appt.class) return false; Appt a2 = (Appt) o2; if (!date.equals(a2.date)) return false; if (time != null && !time.equals(a2.time)) return false; return text.equals(a2.text); } Appt(int y, int mo, int d, int h, int min, String text);  Appt(LocalDateTime datetime, String text);  Appt(LocalDate date, LocalTime time, String text); }
Appt implements Comparable<Appt> { @Override public boolean equals(Object o2) { if (this == o2) return true; if (o2.getClass() != Appt.class) return false; Appt a2 = (Appt) o2; if (!date.equals(a2.date)) return false; if (time != null && !time.equals(a2.time)) return false; return text.equals(a2.text); } Appt(int y, int mo, int d, int h, int min, String text);  Appt(LocalDateTime datetime, String text);  Appt(LocalDate date, LocalTime time, String text); void setRep(int typ, int intv, int count); boolean matches(int y, int m, int d); @Override int compareTo(Appt a2); @Override int hashCode(); @Override boolean equals(Object o2); @Override String toString(); static Appt fromString(String s); int getDay(); int getHour(); int getMinute(); int getMonth(); String getText(); int getYear(); }
Appt implements Comparable<Appt> { @Override public boolean equals(Object o2) { if (this == o2) return true; if (o2.getClass() != Appt.class) return false; Appt a2 = (Appt) o2; if (!date.equals(a2.date)) return false; if (time != null && !time.equals(a2.time)) return false; return text.equals(a2.text); } Appt(int y, int mo, int d, int h, int min, String text);  Appt(LocalDateTime datetime, String text);  Appt(LocalDate date, LocalTime time, String text); void setRep(int typ, int intv, int count); boolean matches(int y, int m, int d); @Override int compareTo(Appt a2); @Override int hashCode(); @Override boolean equals(Object o2); @Override String toString(); static Appt fromString(String s); int getDay(); int getHour(); int getMinute(); int getMonth(); String getText(); int getYear(); static final int NONE; static final int HOURLY; static final int DAILY; static final int WEEKLY; static final int MONTHLY_NUMDAY_OF_M; static final int MONTHLY_WEEKDAY_OF_M; static final int YEARLY; static final int FOREVER; }