Search in sources :

Example 1 with BTWWeight

use of il.ac.technion.cs.yp.btw.classes.BTWWeight in project BTW by TechnionYearlyProject.

the class TestRoadsDataBase method testGetHeuristicDist.

/*
     * @author Sharon Hadar
     * @Date 21/01/2018*/
@Test
public void testGetHeuristicDist() {
    String mapName = "test";
    MainDataBase.openConnection();
    Road aaRoad = RoadsDataBase.getRoad("aa", mapName);
    Road bbRoad = RoadsDataBase.getRoad("bb", mapName);
    BTWWeight dist = aaRoad.getHeuristicDist(bbRoad);
    assert (dist.seconds() == 123123);
    MainDataBase.closeConnection();
}
Also used : Road(il.ac.technion.cs.yp.btw.classes.Road) DataRoad(il.ac.technion.cs.yp.btw.db.DataObjects.DataRoad) BTWWeight(il.ac.technion.cs.yp.btw.classes.BTWWeight) Test(org.junit.Test)

Example 2 with BTWWeight

use of il.ac.technion.cs.yp.btw.classes.BTWWeight in project BTW by TechnionYearlyProject.

the class VehicleImpl method driveOnRoad.

/**
 * @author Guy Rephaeli
 *
 * Commit a drive on Road rd, on the part
 * described by the given ratios
 *
 * @param rd         - The Road to drive on
 * @param ratioStart - the ratio from the beginning
 *                   of the Road, We begin our drive at
 * @param ratioEnd   - the ratio from the the beginning
 */
@Override
public Vehicle driveOnRoad(Road rd, double ratioStart, double ratioEnd) {
    CityRoad realRoad = this.simulator.getRealRoad(rd);
    BTWWeight weight = realRoad.getCurrentWeight();
    this.remainingTimeOnRoad = Double.valueOf((ratioEnd - ratioStart) * weight.seconds()).longValue();
    realRoad.addVehicle(this);
    return this;
}
Also used : BTWWeight(il.ac.technion.cs.yp.btw.classes.BTWWeight)

Aggregations

BTWWeight (il.ac.technion.cs.yp.btw.classes.BTWWeight)2 Road (il.ac.technion.cs.yp.btw.classes.Road)1 DataRoad (il.ac.technion.cs.yp.btw.db.DataObjects.DataRoad)1 Test (org.junit.Test)1