Example #1
0
  @Override
  public GeoPoint addPoint(
      String longitude,
      String latitude,
      Double altitude,
      String continent,
      String country,
      String capital,
      List<Token> pointTokens) {

    GeoPointStored p = new GeoPointStored();
    p.longitude = longitude;
    p.latitude = latitude;
    p.altitude = altitude;
    p.continent = continent;
    p.country = country;
    p.capital = capital;
    p.tokRefs = new String[pointTokens.size()];
    for (int i = 0; i < pointTokens.size(); i++) {
      Token token = pointTokens.get(i);
      p.tokRefs[i] = token.getID();
      connector.token2ItsGeopoint.put(token, p);
    }
    points.add(p);
    return p;
  }
Example #2
0
 /**
  * Prints out tokens from a file or System.in. If no arguments are given, System.in will be used
  * for input. If more arguments are given, the first argument will be used as the name of the file
  * to use as input
  *
  * @param args program arguments, of which the first is a filename
  */
 public static void main(String[] args) {
   InputStream in;
   try {
     if (args.length > 0) {
       File f = new File(args[0]);
       if (f.exists()) {
         if (f.canRead()) {
           in = new FileInputStream(f);
         } else {
           throw new IOException("Could not open " + args[0]);
         }
       } else {
         throw new IOException("Could not find " + args[0]);
       }
     } else {
       in = System.in;
     }
     PropertiesLexer shredder = new PropertiesLexer(in);
     Token t;
     while ((t = shredder.getNextToken()) != null) {
       if (t.getID() != PropertiesToken.WHITE_SPACE) {
         System.out.println(t);
       }
     }
   } catch (IOException e) {
     System.err.println(e.getMessage());
   }
 }