Added EventRacePlaces

This commit is contained in:
Lennart Hensler committed 2012-01-12 10:03:43 +01:00
1 parent 42cbbe9a5b
commit f6894c9f46
3 files changed
+82

No files matched your search

@@ -0,0 +1,11 @@
package com.sap.sailing.geocoding;
import java.util.List;
public interface EventRacePlaces {
String getName();
List<RacePlaceOrder> getRacePlaces();
void addRacePlace(RacePlaceOrder racePlace);
}
@@ -0,0 +1,40 @@
package com.sap.sailing.geocoding.impl;
import java.util.ArrayList;
import java.util.List;
import com.sap.sailing.geocoding.EventRacePlaces;
import com.sap.sailing.geocoding.RacePlaceOrder;
public class EventRacePlacesImpl implements EventRacePlaces {
private String eventName;
private List<RacePlaceOrder> racePlaces;
public EventRacePlacesImpl(String eventName) {
super();
this.eventName = eventName;
this.racePlaces = new ArrayList<RacePlaceOrder>();
}
@Override
public String getName() {
return eventName;
}
@Override
public List<RacePlaceOrder> getRacePlaces() {
return racePlaces;
}
@Override
public void addRacePlace(RacePlaceOrder racePlace) {
racePlaces.add(racePlace);
}
@Override
public String toString() {
return eventName + racePlaces.toString();
}
}
@@ -48,4 +48,35 @@ public class RacePlaceOrderImpl implements RacePlaceOrder {
return b.toString();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((places == null) ? 0 : places.hashCode());
result = prime * result + ((raceName == null) ? 0 : raceName.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RacePlaceOrderImpl other = (RacePlaceOrderImpl) obj;
if (places == null) {
if (other.places != null)
return false;
} else if (!places.equals(other.places))
return false;
if (raceName == null) {
if (other.raceName != null)
return false;
} else if (!raceName.equals(other.raceName))
return false;
return true;
}
}