src/main/java/cursor/rybak/model/maze/compass/Compass.java
/**
     * method to move straight
     *
     * @param currentLocation current location
     * @param newLocation     new location
     */
method to move straight
@param currentLocation current location
@param newLocation     new location
method to move straight @param currentLocation current location @param newLocation new location
default void moveStraightCompass(Location currentLocation, Location newLocation) {
        List<Location> lineA = ListUtil.copy(newLocation.getLineA());
        List<Location> lineB = ListUtil.copy(newLocation.getLineB());
        if (LineTypes.lineTypeA.equals(currentLocation.getMainLineType())) {
            if (currentLocation.isMainReverse()) {
                newLocation.setMainLine(ListUtil.reverse(lineA));
                newLocation.setCrossLine(ListUtil.reverse(lineB));
            } else {
                newLocation.setMainLine(lineA);
                newLocation.setCrossLine(lineB);
            }
        } else {
            if (currentLocation.isMainReverse()) {
                newLocation.setMainLine(ListUtil.reverse(lineB));
                newLocation.setCrossLine(lineA);
            } else {
                newLocation.setMainLine(lineB);
                newLocation.setCrossLine(ListUtil.reverse(lineA));
            }
        }
        newLocation.setMainLineType(currentLocation.getMainLineType());
        newLocation.setMainReverse(currentLocation.isMainReverse());
    }
default void moveStraightCompass ( Location currentLocation , Location newLocation ) { List < Location > lineA = ListUtil . copy ( newLocation . getLineA ( ) ) ; List < Location > lineB = ListUtil . copy ( newLocation . getLineB ( ) ) ; if ( LineTypes . lineTypeA . equals ( currentLocation . getMainLineType ( ) ) ) { if ( currentLocation . isMainReverse ( ) ) { newLocation . setMainLine ( ListUtil . reverse ( lineA ) ) ; newLocation . setCrossLine ( ListUtil . reverse ( lineB ) ) ; } else { newLocation . setMainLine ( lineA ) ; newLocation . setCrossLine ( lineB ) ; } } else { if ( currentLocation . isMainReverse ( ) ) { newLocation . setMainLine ( ListUtil . reverse ( lineB ) ) ; newLocation . setCrossLine ( lineA ) ; } else { newLocation . setMainLine ( lineB ) ; newLocation . setCrossLine ( ListUtil . reverse ( lineA ) ) ; } } newLocation . setMainLineType ( currentLocation . getMainLineType ( ) ) ; newLocation . setMainReverse ( currentLocation . isMainReverse ( ) ) ; }
method to move straight
 @param currentLocation current location
 @param newLocation     new location
method to move straight @param currentLocation current location @param newLocation new location