Rev 398 |
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 uk.me.parabola.imgfmt.app.Coord;
/**
* Locates the node within a road.
*
* @author Steve Ratcliffe
*/
public class NodeLocator
extends CoordLocator
{
private final RouteNode node
; // The node
private int length
; // The distance from the beginning of the road
private int index
; // The node number on the road, starting with 0.
public NodeLocator
(RouteNode node
) {
this.
node = node
;
}
public int getOffset
() {
return node.
getOffset();
}
public int getLength
() {
return length
;
}
public void setLength
(int length
) {
this.
length = length
;
}
public void setIndex
(int index
) {
this.
index = index
;
}
public int getIndex
() {
return index
;
}
public void setCoord
(Coord coord
) {
throw new UnsupportedOperationException();
}
public RouteNode getNode
() {
return node
;
}
public Coord getCoord
() {
return node.
getCoord();
}
public String toString
() {
return String.
format("loc[%x: node-index=%d, %d of %d in segment]",
node.
getOffset(), index, getCoordNumber
()+
1, getCoordsInSegment
());
}
}