Rev 358 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/*
* Copyright (C) 2014 Steve Ratcliffe
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 or
* version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
package test.files;
import java.util.ArrayList;
import java.util.List;
import uk.me.parabola.imgfmt.app.Coord;
import static test.util.ArcFlags.ARC_CLASSMASK;
/**
* A node from NOD 1 of the routing network.
*
* Each node is in a group we call the RouteCenter. A node has zero or more arcs that lead to
* other nodes.
*
* @author Steve Ratcliffe
*/
public class RouteNode
{
private final int offset
;
private final RouteCenter center
;
private int flags
;
private Coord coord
;
private final List<RouteArc
> arcs =
new ArrayList<>();
private boolean bad
;
private boolean problem
;
private long nextStart
;
private RoadData road
;
public RouteNode
(RouteCenter center,
long offset
) {
this.
center = center
;
this.
offset =
(int) offset
;
}
public int getOffset
() {
return offset
;
}
public void setFlags
(int flags
) {
this.
flags = flags
;
}
public int getFlags
() {
return flags
;
}
public boolean hasArcs
() {
return (flags
& 0x40
) !=
0;
}
public boolean hasLargeCoordOffsets
() {
return (flags
& 0x20
) !=
0;
}
public boolean hasRestrictions
() {
return (flags
& 0x10
) !=
0;
}
public boolean isBoundary
() {
return (flags
& 0x08
) !=
0;
}
public void setCoord
(Coord coord
) {
this.
coord = coord
;
}
public Coord getCoord
() {
return coord
;
}
public void addArc
(RouteArc arc
) {
arcs.
add(arc
);
}
public List<RouteArc
> getArcs
() {
return arcs
;
}
public String flagString
() {
StringBuilder sb =
new StringBuilder();
if (hasArcs
())
sb.
append(" arcs");
if (hasLargeCoordOffsets
())
sb.
append(" big");
if (hasRestrictions
())
sb.
append(" restrictions");
if (isBoundary
())
sb.
append(" boundary");
return sb.
toString();
}
public void setBad
(boolean bad
) {
this.
bad = bad
;
}
public boolean isBad
() {
return bad
;
}
public RouteCenter getCenter
() {
return center
;
}
public void setProblem
(boolean problem
) {
this.
problem = problem
;
}
public boolean isProblem
() {
return problem
;
}
public void setNextStart
(long nextStart
) {
this.
nextStart = nextStart
;
}
public long getNextStart
() {
return nextStart
;
}
public int getDestclass
() {
return flags
& ARC_CLASSMASK
;
}
public void setRoad
(RoadData road
) {
this.
road = road
;
}
public RoadData getRoad
() {
return road
;
}
}