Пример #1
0
  String ls(String args[], boolean relative) {
    if (args.length < 2)
      throw new IllegalArgumentException(
          "the ${ls} macro must at least have a directory as parameter");

    File dir = domain.getFile(args[1]);
    if (!dir.isAbsolute())
      throw new IllegalArgumentException(
          "the ${ls} macro directory parameter is not absolute: " + dir);

    if (!dir.exists())
      throw new IllegalArgumentException(
          "the ${ls} macro directory parameter does not exist: " + dir);

    if (!dir.isDirectory())
      throw new IllegalArgumentException(
          "the ${ls} macro directory parameter points to a file instead of a directory: " + dir);

    Collection<File> files = new ArrayList<File>(new SortedList<File>(dir.listFiles()));

    for (int i = 2; i < args.length; i++) {
      Instructions filters = new Instructions(args[i]);
      files = filters.select(files, true);
    }

    List<String> result = new ArrayList<String>();
    for (File file : files) result.add(relative ? file.getName() : file.getAbsolutePath());

    return Processor.join(result, ",");
  }
Пример #2
0
  public void draw() {

    // Center in display window
    translate(width / 2, height / 2, -1500);
    // if the user turned on the angled view
    if (a) {
      rotateX(radians(-30));
    }

    background(0);
    lights();
    noFill();
    smooth();
    // if the user turned on borders
    if (b) {
      stroke(255);
    }

    stage.create();
    ball.create();

    if (z) {
      fill(255, 255, 255, 100);
      instructions.loadInstructions();
    }

    if (keyPressed) {
      if (key == 'a' || key == 'A') {
        a = (a) ? false : true;
      }

      if (key == 'b' || key == 'B') {
        b = (b) ? false : true;
      }

      if (key == 'c' || key == 'C') {
        c = (c) ? false : true;
      }

      if (key == 'g' || key == 'G') {
        g = (g) ? false : true;
      }

      if (key == 'z') {
        z = (z) ? false : true;
      }
    }
  }