class TextInstructions {

  public String directionFromDegree(Double degree) {
    if (degree == null) {
      // step had no bearing_after degree, ignoring
      return "";
    } else if (degree >= 0 && degree <= 20) {
      return getVersionObject().getAsJsonObject("constants").getAsJsonObject("direction")
        .getAsJsonPrimitive("north").getAsString();
    } else if (degree > 20 && degree < 70) {
      return getVersionObject().getAsJsonObject("constants").getAsJsonObject("direction")
        .getAsJsonPrimitive("northeast").getAsString();
    } else if (degree >= 70 && degree <= 110) {
      return getVersionObject().getAsJsonObject("constants").getAsJsonObject("direction")
        .getAsJsonPrimitive("east").getAsString();
    } else if (degree > 110 && degree < 160) {
      return getVersionObject().getAsJsonObject("constants").getAsJsonObject("direction")
        .getAsJsonPrimitive("southeast").getAsString();
    } else if (degree >= 160 && degree <= 200) {
      return getVersionObject().getAsJsonObject("constants").getAsJsonObject("direction")
        .getAsJsonPrimitive("south").getAsString();
    } else if (degree > 200 && degree < 250) {
      return getVersionObject().getAsJsonObject("constants").getAsJsonObject("direction")
        .getAsJsonPrimitive("southwest").getAsString();
    } else if (degree >= 250 && degree <= 290) {
      return getVersionObject().getAsJsonObject("constants").getAsJsonObject("direction")
        .getAsJsonPrimitive("west").getAsString();
    } else if (degree > 290 && degree < 340) {
      return getVersionObject().getAsJsonObject("constants").getAsJsonObject("direction")
        .getAsJsonPrimitive("northwest").getAsString();
    } else if (degree >= 340 && degree <= 360) {
      return getVersionObject().getAsJsonObject("constants").getAsJsonObject("direction")
        .getAsJsonPrimitive("north").getAsString();
    } else {
      throw new RuntimeException("Degree is invalid: " + degree);
    }
  }

  public  TextInstructions(String language, String version);

}