Package no.priv.garshol.duke

Examples of no.priv.garshol.duke.DukeException


          break;
      }

      // finally
      if (pos == ix)
        throw new DukeException("Couldn't find float in " + out);
      return Float.valueOf(out.substring(pos, ix));
    }
View Full Code Here


  public boolean yesorno() {
    System.out.print("Correct? (Y/N) ");
    try {
      String line = console.readLine();
      if (line == null)
        throw new DukeException("End of file on console");
      line = line.trim();
     
      if (line.equalsIgnoreCase("Y"))
        return true;
      else if (line.equalsIgnoreCase("N"))
        return false;
      else
        return yesorno();
    } catch (IOException e) {
      throw new DukeException("Couldn't read input line", e);
    }
  }
View Full Code Here

    throws IOException {
    CSVReader reader = new CSVReader(input);
    String[] row = reader.next();
    while (row != null) {
      if (row.length != 4)
        throw new DukeException("Wrong test file format, row had " +
                                row.length + " values, should be 4");
       
      LinkKind kind = row[0].equals("+") ? LinkKind.SAME : LinkKind.DIFFERENT;
      String id1 = row[1];
      String id2 = row[2];
View Full Code Here

    if (writer != null)
      try {
        writer.write(id1, id2, match, 1.0);
        out.flush(); // make sure everything's saved
      } catch (IOException e) {
        throw new DukeException(e);
      }
    return match ? LinkKind.SAME : LinkKind.DIFFERENT;
  }
View Full Code Here

        continue;

      return v;
    }

    throw new DukeException("No identity for record " + r);
  }
View Full Code Here

      if (vs == null)
        continue;
      for (String v : vs)
        return v;
    }
    throw new DukeException("No identity found in record [" +
                            PrintMatchListener.toString(r) + "]");
  }
View Full Code Here

        return 0.0;

      return ((1.0 - (dist / maxdist)) * 0.5 ) + 0.5;
    } catch (NumberFormatException e) {
      if (strict)
        throw new DukeException("Invalid number: " + e, e);
      return 0.5;
    }
  }
View Full Code Here

  private boolean valid(double lat, double lon) {
    if (lat > 90.0 || lat < -90.0 || // north pole: 90 deg north
        lon > 180.0 || lon < -180.0) { // date line at -180 and +180
      if (strict)
        throw new DukeException("Position outside legal range: " + lat + ", " +
                                lon);
      return false;
    } else
      return true;
  }
View Full Code Here

      String nextline;
      while (subject == null) {
        try {
          nextline = reader.readLine();
        } catch (IOException e) {
          throw new DukeException(e);
        }
       
        if (nextline == null)
          return; // we're finished, and there is no next record
View Full Code Here

        this.port = parsedPort;
      }
    }
  catch(NumberFormatException ex){
      System.out.println("** Invalid port number: "+port);
      throw new DukeException(ex);
  }
  }
View Full Code Here

TOP

Related Classes of no.priv.garshol.duke.DukeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.