Formatting

This commit is contained in:
Roman Inflianskas 2016-06-06 13:16:23 +03:00
parent 1e94dba172
commit 2ae4229ed9

View file

@ -9,61 +9,59 @@ import net.osmand.util.Algorithms;
public class Street extends MapObject {
protected List<Building> buildings = new ArrayList<Building>();
protected List<Building> buildings = new ArrayList<Building>();
protected List<Street> intersectedStreets = null;
protected final City city;
public Street(City city) {
this.city = city;
}
public void addBuilding(Building building){
public void addBuilding(Building building) {
buildings.add(building);
}
public List<Street> getIntersectedStreets() {
if(intersectedStreets == null){
if (intersectedStreets == null) {
return Collections.emptyList();
}
return intersectedStreets;
}
public void addIntersectedStreet(Street s){
if(intersectedStreets == null) {
public void addIntersectedStreet(Street s) {
if (intersectedStreets == null) {
intersectedStreets = new ArrayList<Street>();
}
intersectedStreets.add(s);
}
public void addBuildingCheckById(Building building){
for(Building b : buildings) {
if(b.getId().longValue() == building.getId().longValue()){
public void addBuildingCheckById(Building building) {
for (Building b : buildings) {
if (b.getId().longValue() == building.getId().longValue()) {
return;
}
}
buildings.add(building);
}
public List<Building> getBuildings() {
return buildings;
}
public City getCity() {
return city;
}
public void sortBuildings(){
Collections.sort(buildings, new Comparator<Building>(){
public void sortBuildings() {
Collections.sort(buildings, new Comparator<Building>() {
@Override
public int compare(Building o1, Building o2) {
String s1 = o1.getName();
String s2 = o2.getName();
int i1 = Algorithms.extractFirstIntegerNumber(s1);
int i2 = Algorithms.extractFirstIntegerNumber(s2);
if(i1 == i2) {
if (i1 == i2) {
String t1 = Algorithms.extractIntegerSuffix(s1);
String t2 = Algorithms.extractIntegerSuffix(s2);
return t1.compareTo(t2);
@ -72,10 +70,9 @@ public class Street extends MapObject {
}
});
}
/// GENERATION
public void mergeWith(Street street) {
buildings.addAll(street.getBuildings());
copyNames(street);
@ -90,5 +87,4 @@ public class Street extends MapObject {
return nm;
}
}