Search in sources :

Example 81 with Station

use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.

the class StationRenameTest method testRenameOriginStation.

@Test
public void testRenameOriginStation() {
    Survey testSurvey = BasicTestSurveyCreator.createStraightNorth();
    Station s1 = testSurvey.getStationByName("1");
    SurveyUpdater.renameStation(testSurvey, s1, "ShinyNewNameOrigin");
    Station shinyNewStation = testSurvey.getStationByName("ShinyNewNameOrigin");
    Assert.assertEquals("ShinyNewNameOrigin", shinyNewStation.getName());
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Survey(org.hwyl.sexytopo.model.survey.Survey) Test(org.junit.Test)

Example 82 with Station

use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.

the class StationRenameTest method testGetStationByNameCanFail.

@Test
public void testGetStationByNameCanFail() {
    Survey testSurvey = BasicTestSurveyCreator.createStraightNorth();
    Station shouldBeNull = testSurvey.getStationByName("I DO NOT EXIST :P");
    Assert.assertNull(shouldBeNull);
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Survey(org.hwyl.sexytopo.model.survey.Survey) Test(org.junit.Test)

Example 83 with Station

use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.

the class SurveyUpdaterTest method testMoveLegWorks.

@Test
public void testMoveLegWorks() {
    Survey survey = BasicTestSurveyCreator.createStraightNorth();
    Leg toMove = survey.getStationByName("2").getOnwardLegs().get(0);
    Station originatingStation = survey.getOriginatingStation(toMove);
    Station destinationStation = survey.getStationByName("1");
    Assert.assertNotEquals(originatingStation, destinationStation);
    SurveyUpdater.moveLeg(survey, toMove, destinationStation);
    Assert.assertTrue(destinationStation.getOnwardLegs().contains(toMove));
    Assert.assertFalse(originatingStation.getOnwardLegs().contains(toMove));
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Survey(org.hwyl.sexytopo.model.survey.Survey) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Example 84 with Station

use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.

the class SurveyStatsTest method testSurveyComponentCountsFromIntermediateStation.

@Test
public void testSurveyComponentCountsFromIntermediateStation() {
    Survey survey = BasicTestSurveyCreator.createStraightNorthWith2EBranchFromS2();
    Station subStation = survey.getStationByName("2");
    Assert.assertEquals(5, SurveyStats.calcNumberSubStations(subStation));
    Assert.assertEquals(4, SurveyStats.calcNumberSubLegs(subStation));
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Survey(org.hwyl.sexytopo.model.survey.Survey) Test(org.junit.Test)

Example 85 with Station

use of org.hwyl.sexytopo.model.survey.Station in project sexytopo by richsmith.

the class SurveyStatsTest method testLegCountsWithSplays.

@Test
public void testLegCountsWithSplays() {
    Survey survey = BasicTestSurveyCreator.createStraightNorthWith2EBranchFromS2();
    Station subStation = survey.getStationByName("2");
    survey.setActiveStation(subStation);
    Leg leg2 = new Leg(5, 0, 0);
    SurveyUpdater.update(survey, leg2);
    Assert.assertEquals(5, SurveyStats.calcNumberSubStations(subStation));
    Assert.assertEquals(5, SurveyStats.calcNumberSubLegs(subStation));
}
Also used : Station(org.hwyl.sexytopo.model.survey.Station) Survey(org.hwyl.sexytopo.model.survey.Survey) Leg(org.hwyl.sexytopo.model.survey.Leg) Test(org.junit.Test)

Aggregations

Station (org.hwyl.sexytopo.model.survey.Station)85 Leg (org.hwyl.sexytopo.model.survey.Leg)32 Survey (org.hwyl.sexytopo.model.survey.Survey)30 Coord2D (org.hwyl.sexytopo.model.graph.Coord2D)20 Test (org.junit.Test)19 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)9 SuppressLint (android.annotation.SuppressLint)8 AlertDialog (android.app.AlertDialog)8 JSONException (org.json.JSONException)7 Line (org.hwyl.sexytopo.model.graph.Line)6 SurveyConnection (org.hwyl.sexytopo.model.survey.SurveyConnection)6 JSONObject (org.json.JSONObject)6 View (android.view.View)5 Set (java.util.Set)5 Direction (org.hwyl.sexytopo.model.graph.Direction)5 Space (org.hwyl.sexytopo.model.graph.Space)5 JSONArray (org.json.JSONArray)5 Context (android.content.Context)4 HashSet (java.util.HashSet)4