示例#1
0
 public void start(String[] args) throws Exception {
   if (lineReader == null) {
     lineReader = new DefaultLineReader();
   }
   running = true;
   while (running) {
     print("hazelcast[" + namespace + "] > ");
     try {
       final String command = lineReader.readLine();
       handleCommand(command);
     } catch (Throwable e) {
       e.printStackTrace();
     }
   }
 }
示例#2
0
  /**
   * Parses those lines in the configuration files that content the fields of the SetupDataType.
   *
   * @param configBuffer configuration file contents
   * @param format format of the configuration file
   * @throws IOException if can't read the file
   */
  public void readConfiguration(LineReader configBuffer, int format) throws IOException {

    boolean bool;

    origin = new Point(configBuffer.readInteger(), configBuffer.readInteger());

    grid_size = configBuffer.readInteger();
    frozen = configBuffer.readBoolean();
    raster = configBuffer.readBoolean();
    subNetNo = configBuffer.readInteger();
    flags = configBuffer.readInteger();
    layers = configBuffer.readInteger();
    updateType = configBuffer.readInteger();

    bool = configBuffer.readBoolean();
    top_label_type = configBuffer.readInteger();
    if (!bool || top_label_type < 0 || top_label_type > WINNER) top_label_type = NOTHING;

    bool = configBuffer.readBoolean();
    base_label_type = configBuffer.readInteger();
    if (!bool || base_label_type < 0 || base_label_type > WINNER) base_label_type = NOTHING;

    show_links = configBuffer.readBoolean();
    show_directions = configBuffer.readBoolean();
    show_weights = configBuffer.readBoolean();

    double pos = 0, neg = 0;
    pos = configBuffer.readDouble();
    neg = configBuffer.readDouble();
    if (pos < -neg) link_trigger = pos;
    else link_trigger = -neg;

    unit_max = 1 / configBuffer.readDouble();

    if (format >= 3) {
      link_max = configBuffer.readDouble();
      siteName = configBuffer.readText();

      color_index = String.valueOf(configBuffer.readInteger());
      while (color_index.length() < 6) color_index = "0" + color_index;
      try {
        text_color = index2color(color_index.substring(0, 2));
        background_color = index2color(color_index.substring(2, 4));
        selection_color = index2color(color_index.substring(4, 6));
      } catch (Exception ex) {
        throw (new IOException("Error in configuration file."));
      }
    }
  }