rename field
This commit is contained in:
@@ -15,7 +15,7 @@ public class MarketAnalyzer {
|
|||||||
|
|
||||||
private Market market;
|
private Market market;
|
||||||
private Graph<Vendor> graph;
|
private Graph<Vendor> graph;
|
||||||
private double stock;
|
private double tank;
|
||||||
private double maxDistance;
|
private double maxDistance;
|
||||||
private int jumps;
|
private int jumps;
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ public class MarketAnalyzer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void rebuild(Vendor source){
|
private void rebuild(Vendor source){
|
||||||
graph = new Graph<>(source, market.get(), stock, maxDistance, true, jumps, PathRoute::new);
|
graph = new Graph<>(source, market.get(), tank, maxDistance, true, jumps, PathRoute::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setSource(Vendor source){
|
private void setSource(Vendor source){
|
||||||
@@ -73,8 +73,8 @@ public class MarketAnalyzer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setStock(double stock) {
|
public void setTank(double tank) {
|
||||||
this.stock = stock;
|
this.tank = tank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxDistance(double maxDistance) {
|
public void setMaxDistance(double maxDistance) {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class MarketAnalyzerTest extends Assert {
|
|||||||
public void testPaths() throws Exception {
|
public void testPaths() throws Exception {
|
||||||
LOG.info("Start paths test");
|
LOG.info("Start paths test");
|
||||||
MarketAnalyzer analyzer = new MarketAnalyzer(market);
|
MarketAnalyzer analyzer = new MarketAnalyzer(market);
|
||||||
analyzer.setJumps(5);analyzer.setMaxDistance(1);analyzer.setStock(1);
|
analyzer.setJumps(5);analyzer.setMaxDistance(1);analyzer.setTank(1);
|
||||||
|
|
||||||
Collection<Path<Vendor>> paths = analyzer.getPaths(v1, v2);
|
Collection<Path<Vendor>> paths = analyzer.getPaths(v1, v2);
|
||||||
TestUtil.assertCollectionEquals(paths, Path.toPath(v1, v2));
|
TestUtil.assertCollectionEquals(paths, Path.toPath(v1, v2));
|
||||||
@@ -115,7 +115,7 @@ public class MarketAnalyzerTest extends Assert {
|
|||||||
public void testPathsWithStock() throws Exception {
|
public void testPathsWithStock() throws Exception {
|
||||||
LOG.info("Start paths with stock test");
|
LOG.info("Start paths with stock test");
|
||||||
MarketAnalyzer analyzer = new MarketAnalyzer(market);
|
MarketAnalyzer analyzer = new MarketAnalyzer(market);
|
||||||
analyzer.setJumps(5);analyzer.setMaxDistance(1);analyzer.setStock(2);
|
analyzer.setJumps(5);analyzer.setMaxDistance(1);analyzer.setTank(2);
|
||||||
|
|
||||||
Collection<Path<Vendor>> paths = analyzer.getPaths(v1, v2);
|
Collection<Path<Vendor>> paths = analyzer.getPaths(v1, v2);
|
||||||
TestUtil.assertCollectionContainAll(paths, Path.toPath(v1, v2));
|
TestUtil.assertCollectionContainAll(paths, Path.toPath(v1, v2));
|
||||||
@@ -141,7 +141,7 @@ public class MarketAnalyzerTest extends Assert {
|
|||||||
public void testPathsWithStockAndRefill() throws Exception {
|
public void testPathsWithStockAndRefill() throws Exception {
|
||||||
LOG.info("Start paths with stock and refill test");
|
LOG.info("Start paths with stock and refill test");
|
||||||
MarketAnalyzer analyzer = new MarketAnalyzer(market);
|
MarketAnalyzer analyzer = new MarketAnalyzer(market);
|
||||||
analyzer.setJumps(2);analyzer.setMaxDistance(10);analyzer.setStock(15);
|
analyzer.setJumps(2);analyzer.setMaxDistance(10);analyzer.setTank(15);
|
||||||
|
|
||||||
Collection<Path<Vendor>> paths = analyzer.getPaths(v10, v6);
|
Collection<Path<Vendor>> paths = analyzer.getPaths(v10, v6);
|
||||||
TestUtil.assertCollectionContainAll(paths, Path.toPath(v10, v6), Path.toPath(v10, v11, v6),
|
TestUtil.assertCollectionContainAll(paths, Path.toPath(v10, v6), Path.toPath(v10, v11, v6),
|
||||||
@@ -157,7 +157,7 @@ public class MarketAnalyzerTest extends Assert {
|
|||||||
public void testPathsWithStockAndRefill2() throws Exception {
|
public void testPathsWithStockAndRefill2() throws Exception {
|
||||||
LOG.info("Start paths with stock and refill test 2");
|
LOG.info("Start paths with stock and refill test 2");
|
||||||
MarketAnalyzer analyzer = new MarketAnalyzer(market);
|
MarketAnalyzer analyzer = new MarketAnalyzer(market);
|
||||||
analyzer.setJumps(3);analyzer.setMaxDistance(10);analyzer.setStock(15);
|
analyzer.setJumps(3);analyzer.setMaxDistance(10);analyzer.setTank(15);
|
||||||
|
|
||||||
Collection<Path<Vendor>> paths = analyzer.getPaths(v10, v6);
|
Collection<Path<Vendor>> paths = analyzer.getPaths(v10, v6);
|
||||||
TestUtil.assertCollectionContainAll(paths, Path.toPath(v10, v6), Path.toPath(v10, v11, v6),
|
TestUtil.assertCollectionContainAll(paths, Path.toPath(v10, v6), Path.toPath(v10, v11, v6),
|
||||||
|
|||||||
Reference in New Issue
Block a user