Skip to main content
deleted 19 characters in body
Source Link
  1. all switch-case statements are the same, just invoked on different variables -> put the statement in a method and pass it the variable to query. Moreover, the whole switch-case statement can be replaced by getting the index of the index of the xint-LocationVIntegerlocation from the String "ABCDEFG":
    locationStr = "ABCDEFG".substring(locationInt, locationInt+1); and you can catch the IndexOutOfBoundsException to detect out of range int value

  2. you already use a collection to put locations. instead of keeping three separate set of variables for V/H and the rest-> use a colection for these as well.

  1. all switch-case statements are the same, just invoked on different variables -> put the statement in a method and pass it the variable to query. Moreover, the whole switch-case statement can be replaced by getting the index of the index of the x-LocationVInteger from the String "ABCDEFG":
    locationStr = "ABCDEFG".substring(locationInt, locationInt+1); and you can catch the IndexOutOfBoundsException to detect out of range int value

  2. you already use a collection to put locations. instead of keeping three separate set of variables for V/H and the rest-> use a colection for these as well.

  1. all switch-case statements are the same, just invoked on different variables -> put the statement in a method and pass it the variable to query. Moreover, the whole switch-case statement can be replaced by getting the index of the int-location from the String "ABCDEFG":
    locationStr = "ABCDEFG".substring(locationInt, locationInt+1); and you can catch the IndexOutOfBoundsException to detect out of range int value

  2. you already use a collection to put locations. instead of keeping three separate set of variables for V/H and the rest-> use a colection for these as well.

Source Link

  1. all switch-case statements are the same, just invoked on different variables -> put the statement in a method and pass it the variable to query. Moreover, the whole switch-case statement can be replaced by getting the index of the index of the x-LocationVInteger from the String "ABCDEFG":
    locationStr = "ABCDEFG".substring(locationInt, locationInt+1); and you can catch the IndexOutOfBoundsException to detect out of range int value

  2. you already use a collection to put locations. instead of keeping three separate set of variables for V/H and the rest-> use a colection for these as well.