GeoEngine infinite loop precautions and cleanup.

This commit is contained in:
MobiusDevelopment
2019-03-21 23:38:52 +00:00
parent ad9a9006cf
commit 3b9cb63ca2
39 changed files with 117 additions and 234 deletions

View File

@ -841,7 +841,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -892,7 +893,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -841,7 +841,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -892,7 +893,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -841,7 +841,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -892,7 +893,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -841,7 +841,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -892,7 +893,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -841,7 +841,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -892,7 +893,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -841,7 +841,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -892,7 +893,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -841,7 +841,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -892,7 +893,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -827,7 +827,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -878,7 +879,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -134,7 +134,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -183,7 +184,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -827,7 +827,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -878,7 +879,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -134,7 +134,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -183,7 +184,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -841,7 +841,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -892,7 +893,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -841,7 +841,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -892,7 +893,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -841,7 +841,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -892,7 +893,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**

View File

@ -841,7 +841,8 @@ public class GeoEngine
int ny = gpy; int ny = gpy;
// loop // loop
do int count = 0;
while (count++ < Config.MAX_ITERATIONS)
{ {
direction = 0; direction = 0;
@ -892,7 +893,8 @@ public class GeoEngine
return new GeoLocation(gox, goy, goz); return new GeoLocation(gox, goy, goz);
} }
} }
while (true);
return new GeoLocation(gox, goy, goz);
} }
/** /**

View File

@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
GeoLocation nodeB = (GeoLocation) point.next(); GeoLocation nodeB = (GeoLocation) point.next();
// iterate thought the path to optimize it // iterate thought the path to optimize it
while (point.hasNext()) int count = 0;
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{ {
// get node C // get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex()); GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
Node parent = target.getParent(); Node parent = target.getParent();
// while parent exists // while parent exists
while (parent != null) int count = 0;
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
{ {
// get parent <> target direction X/Y // get parent <> target direction X/Y
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX(); final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();

View File

@ -39,10 +39,6 @@ public class NodeBuffer
private int _gty = 0; private int _gty = 0;
private short _gtz = 0; private short _gtz = 0;
// pathfinding statistics
private long _timeStamp = 0;
private long _lastElapsedTime = 0;
private Node _current = null; private Node _current = null;
/** /**
@ -77,9 +73,6 @@ public class NodeBuffer
*/ */
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz) public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
{ {
// load timestamp
_timeStamp = System.currentTimeMillis();
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer) // set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
_cx = gox + ((gtx - gox - _size) / 2); _cx = gox + ((gtx - gox - _size) / 2);
_cy = goy + ((gty - goy - _size) / 2); _cy = goy + ((gty - goy - _size) / 2);
@ -106,7 +99,7 @@ public class NodeBuffer
// move pointer // move pointer
_current = _current.getChild(); _current = _current.getChild();
} }
while ((_current != null) && (++count < Config.MAX_ITERATIONS)); while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
return null; return null;
} }
@ -132,12 +125,6 @@ public class NodeBuffer
} }
_lock.unlock(); _lock.unlock();
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
}
public final long getElapsedTime()
{
return _lastElapsedTime;
} }
/** /**