Esempio n. 1
0
 public void onPictureTaken(byte[] imageData, Camera c) {
   if (imageData != null) {
     System.out.println("__________________ length: " + imageData.length);
     FileManager.savePicture(imageData);
     camera.cancelAutoFocus();
     camera.startPreview();
   }
 }
Esempio n. 2
0
 public void print() {
   List<String> textOutput = new ArrayList<String>();
   for (Server server : servers) {
     // TODO find the condition for an unallocated server
     if (server.getSlot() == -1) {
       textOutput.add(UNALLOCATED_SERVER);
     } else {
       StringBuilder line = new StringBuilder();
       // the allocated row(ar as ​i) and slot within the row(i) for the server, and the allocated
       // logical pool for it (a pi );
       line.append(server.getRow())
           .append(SPACE)
           .append(server.getSlot())
           .append(SPACE)
           .append(server.getPool());
       textOutput.add(line.toString());
     }
   }
   FileManager.write(textOutput, "output.txt");
   System.err.println(this.getScore());
 }
Esempio n. 3
0
  public void initialize() {
    List<String> lines = FileManager.read("input.txt");
    this.nbRows = this.getNthIntegerInLine(lines.get(0), 1);
    this.nbSlotsPerRow = this.getNthIntegerInLine(lines.get(0), 2);
    int nbUnavailableSlots = this.getNthIntegerInLine(lines.get(0), 3);
    this.nbPools = this.getNthIntegerInLine(lines.get(0), 4);
    int nbServers = this.getNthIntegerInLine(lines.get(0), 5);
    lines.remove(0);

    for (int i = 0; i < nbUnavailableSlots; i++) {
      int row = this.getNthIntegerInLine(lines.get(0), 1);
      int column = this.getNthIntegerInLine(lines.get(0), 2);
      this.unavailableSlots.add(new Coord(row, column));
      lines.remove(0);
    }

    for (int i = 0; i < nbServers; i++) {
      int size = this.getNthIntegerInLine(lines.get(0), 1);
      int capacity = this.getNthIntegerInLine(lines.get(0), 2);
      this.servers.add(new Server(size, capacity));
      lines.remove(0);
    }
  }