Esempio n. 1
0
  // Responsible for loading the number of lines per node
  // Receives a line delimited tokenizer.  It will only process one line of
  // that tokenizer.  It must read that line, create a space/tab delimited
  // tokenizer from it, grab the number of lines per node from that tokenizer.
  // Structures that can contain additional information following the number
  // of lines per node (such as trees) should then override this generic
  // loadLinesPerNodeInfo with their own version of the method which will call
  // on the super version to get the actual lines per node and add additional
  // code to process the other information
  public void loadLinesPerNodeInfo(StringTokenizer st, LinkedList llist, draw d)
      throws VisualizerLoadException {
    String tempString, tempString2;
    if (st.hasMoreTokens()) tempString = st.nextToken();
    else throw (new VisualizerLoadException("Expected lines per node - found end of string"));

    StringTokenizer t = new StringTokenizer(tempString, " \t");
    if (t.hasMoreTokens()) tempString2 = t.nextToken();
    else throw (new VisualizerLoadException("Expected lines per node - found " + tempString));

    linespernode = Format.atoi(tempString2);

    xspacing = 1.5;
    yspacing = 1.5;

    if (t.hasMoreTokens()) tempString2 = t.nextToken();
    else return;

    xspacing = Format.atof(tempString2);

    if (t.hasMoreTokens()) tempString2 = t.nextToken();
    else return;

    yspacing = Format.atof(tempString2);
  }