Esempio n. 1
1
    @Override
    public void run() {
      while (true) {
        if (istWindows()) aktuell = holeLaufwerkeWindows();
        else aktuell = holeLaufwerkeUnix();

        if (initial.size() != aktuell.size()) {
          if (!initial.containsAll(aktuell)) {
            neuesLaufwerk = holePathVonNeuemLaufwerk(initial, aktuell);
            textArea.append("Neues Laufwerk endeckt:  " + neuesLaufwerk + System.lineSeparator());
            this.initial = (ArrayList<Path>) aktuell.clone();
            neuesLaufwerkDialog();

          } else {
            this.initial = (ArrayList<Path>) aktuell.clone();
            textArea.append("Laufwerk wurde entfernt" + System.lineSeparator());
          }
        }

        try {
          Thread.sleep(5000);
        } catch (InterruptedException e) {
          System.out.println("Laufwerksprüfung wird abgebrochen");
        }
      }
    }
 public static void printUsage(Options options) {
   String usage = String.format("%s [options] <dir_path>", TOOL_NAME);
   String header =
       System.lineSeparator()
           + "Bulk load the sstables found in the directory <dir_path> to the configured cluster."
           + "The parent directories of <dir_path> are used as the target keyspace/table name. "
           + "So for instance, to load an sstable named Standard1-g-1-Data.db into Keyspace1/Standard1, "
           + "you will need to have the files Standard1-g-1-Data.db and Standard1-g-1-Index.db into a directory /path/to/Keyspace1/Standard1/.";
   String footer =
       System.lineSeparator()
           + "You can provide cassandra.yaml file with -f command line option to set up streaming throughput, client and server encryption options. "
           + "Only stream_throughput_outbound_megabits_per_sec, server_encryption_options and client_encryption_options are read from yaml. "
           + "You can override options read from cassandra.yaml with corresponding command line options.";
   new HelpFormatter().printHelp(usage, header, options, footer);
 }
public class TaskETestCase {

  Random in = new Random();
  String ln = System.lineSeparator();

  @TestCase
  public Collection<Test> createTests() {
    List<Test> list = new ArrayList<Test>();
    for (int i = 0; i < 1000; i++) {
      list.add(gen());
    }
    return list;
  }

  private Test gen() {
    StringBuilder input = new StringBuilder();
    StringBuilder output = new StringBuilder();
    int n = in.nextInt(5) + 1;
    List<Integer> ls = new ArrayList<Integer>();
    for (int i = 0; i < 11; i++) ls.add(i);
    Collections.shuffle(ls);
    input.append(n + ln);
    for (int i = 0; i < n; i++) {
      input.append(ls.get(i) + " " + in.nextInt(21) + ln);
    }
    input.append(ln + "0" + ln);
    return new Test(input.toString(), output.toString());
  }
}
Esempio n. 4
0
  public static String readFromFile(String fileName) throws IOException {
    BufferedReader br = new BufferedReader(new FileReader(fileName));
    try {
      StringBuilder sb = new StringBuilder();
      String line = br.readLine();
      boolean start = false;

      while (line != null) {
        if (line.equals("EOF")) {
          start = false;
        }
        if (start) {
          sb.append(line);
          sb.append(System.lineSeparator());
        }
        if (line.equals("NODE_COORD_SECTION")) {
          start = true;
        }
        line = br.readLine();
      }
      return sb.toString();
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      br.close();
    }
    return null;
  }
Esempio n. 5
0
 public static List<Point> parseToPoints(String data) {
   List<Point> points = new ArrayList<>();
   for (String line : data.split(System.lineSeparator())) {
     points.add(new Point(line));
   }
   return points;
 }
Esempio n. 6
0
 void pln(String s) {
   try {
     bw.write(s);
     bw.write(System.lineSeparator());
   } catch (Exception ex) {
   }
 }
Esempio n. 7
0
 @Override
 public String toString() {
   String out = "";
   String separator = "";
   for (Map.Entry<IOID, ISBAObject> objects : data.entrySet()) {
     out += separator + "<i" + objects.getKey() + ", " + objects.getValue().toString() + ">";
     separator = System.lineSeparator();
   }
   return out;
 }
 private void initDebugString() {
   this.startKeyString = BytesUtil.toHex(this.startKey);
   this.stopKeyString = BytesUtil.toHex(this.stopKey);
   StringBuilder buf = new StringBuilder();
   for (Pair<byte[], byte[]> fuzzyKey : this.fuzzyKeys) {
     buf.append(BytesUtil.toHex(fuzzyKey.getFirst()));
     buf.append(" ");
     buf.append(BytesUtil.toHex(fuzzyKey.getSecond()));
     buf.append(System.lineSeparator());
   }
   this.fuzzyKeyString = buf.toString();
 }
Esempio n. 9
0
 public static void main(String[] args) throws IOException {
   Scanner in = new Scanner(System.in);
   int numRow = in.nextInt();
   int numCol = in.nextInt();
   int num11 = 0;
   int num01 = 0;
   for (int i = 0; i < numRow * numCol; i++) {
     int a = in.nextInt();
     if (a == 11) num11++;
     if (a == 10 || a == 1) num01++;
   }
   StringBuilder writer = new StringBuilder();
   //		BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
   for (int r = 0; r < numRow; r++) {
     if (r % 2 == 0) {
       for (int c = 0; c < numCol; c++) {
         if (num11 > 0) {
           //						writer.write("11");
           writer.append("11");
           num11--;
         } else if (num01 > 0) {
           //						writer.write("01");
           writer.append("01");
           num01--;
         } else {
           writer.append("00");
           //						writer.write("00");
         }
         if (c + 1 < numCol)
           //						writer.write(" ");
           writer.append(" ");
       }
     } else {
       for (int c = 0; c < numCol; c++) {
         int numLeft = numCol - c;
         if (num11 > 0 && num11 >= numLeft) {
           writer.append("11");
           //						writer.write("11");
           num11--;
         } else if (num01 > 0 && num01 >= numLeft) {
           //						writer.write("10");
           writer.append("10");
           num01--;
         } else {
           //						writer.write("00");
           writer.append("00");
         }
         if (c + 1 < numCol) writer.append(" ");
         //						writer.writer(" ");
       }
     }
     //			writer.write(System.lineSeparator());
     writer.append(System.lineSeparator());
   }
   //		writer.flush();
   //		writer.close();
   BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
   out.write(writer.toString());
   out.flush();
   out.close();
 }
Esempio n. 10
0
 private static void printNewLine(OutputStream stream) {
   print(stream, System.lineSeparator());
 }
Esempio n. 11
0
 public String getDetails() {
     String details = "Item " + this.description + ":" + System.lineSeparator() + "Buyer Price: $" + this.buyerprice + System.lineSeparator() + "Sales Price: $" + this.salesprice + System.lineSeparator() + "Quantity: " + this.quantity;
     return details;
 }
Esempio n. 12
0
 private void logExecution() {
   logger.debug("Executing query:{}{}", new Object[] {System.lineSeparator(), this.parsedQuery});
 }
Esempio n. 13
0
 public laufwerksPruefung() {
   if (istWindows()) initial = holeLaufwerkeWindows();
   else initial = holeLaufwerkeUnix();
   textArea.append("Laufwerksprüfung aktiv" + System.lineSeparator());
 }
Esempio n. 14
0
    public void cnpStart(Path quellOrdner, Path zielOrdner) {
      try {
        DirectoryStream<Path> qstream = Files.newDirectoryStream(quellOrdner);
        for (Path qfile : qstream) {
          Path target = Paths.get(zielOrdner.toString() + "/" + qfile.getFileName());
          if (abbruch) break;
          if (Files.isDirectory(qfile) && !Files.exists(target)) {
            Files.createDirectory(target);
            textArea.append("Verzeichnis: " + qfile + " wurde erstellt" + System.lineSeparator());
            cnpStart(
                Paths.get(quellOrdner.toString() + "/" + qfile.getFileName()),
                Paths.get(zielOrdner.toString() + "/" + qfile.getFileName()));
          } else if (Files.isDirectory(qfile) && Files.exists(target)) {
            textArea.append("Wechsle in Verzeichnis: " + qfile + System.lineSeparator());
            cnpStart(
                Paths.get(quellOrdner.toString() + "/" + qfile.getFileName()),
                Paths.get(zielOrdner.toString() + "/" + qfile.getFileName()));
          }
          // Wenn die Datei noch nicht existiert
          else if (!Files.exists(target)) {
            textArea.append(
                "Datei " + target.toString() + " wurde erstellt" + System.lineSeparator());
            Files.copy(qfile, target, StandardCopyOption.REPLACE_EXISTING);

          }
          // Wenn Datei im Zielverzeichnis schon existiert
          else if (Files.exists(target)) {
            if (cAUeSchr) {
              textArea.append(
                  "Datei "
                      + target.toString()
                      + " wird absolut überschrieben"
                      + System.lineSeparator());
              Files.copy(qfile, target, StandardCopyOption.REPLACE_EXISTING);
            } else if (cUeSchr) {
              if (checkAlter(
                  Paths.get(quellOrdner.toString() + "/" + qfile.getFileName()),
                  Paths.get(zielOrdner.toString() + "/" + qfile.getFileName()))) {
                textArea.append(
                    target.toString()
                        + " wird mit neuer Datei überschrieben"
                        + System.lineSeparator());
                Files.copy(qfile, target, StandardCopyOption.REPLACE_EXISTING);
              } else {
                textArea.append(
                    target.toString() + " alte Datei bleibt bestehen" + System.lineSeparator());
              }
            } else
              textArea.append(
                  target.toString() + " alte Datei bleibt bestehen" + System.lineSeparator());
          }
          pbCounter++;
          progressBar.setValue(pbCounter);
        }

        qstream.close();
      } catch (IOException e) {

        e.printStackTrace();
      }
    }