From 973951fe36062a8250b6890213b1e0c3e71da8b2 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Wed, 13 Nov 2024 15:11:00 +0000
Subject: [PATCH] Dokumentation in Arbeit, Konstanten verschoben

---
 src/de/uhilger/fm/CopyMoveVisitor.java |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/de/uhilger/fm/CopyMoveVisitor.java b/src/de/uhilger/fm/CopyMoveVisitor.java
index f7c5087..07fea91 100644
--- a/src/de/uhilger/fm/CopyMoveVisitor.java
+++ b/src/de/uhilger/fm/CopyMoveVisitor.java
@@ -37,23 +37,38 @@
   private Path targetDir;
   private int operation;
 
+  /**
+   * Den Zielordner fuer Kopier- oder Verschiebeoperationen angeben
+   * 
+   * @param targetDir der Zielordner
+   */
   public void setTargetDir(Path targetDir) {
     this.targetDir = targetDir;
-    //logger.fine("targetDir: " + targetDir.toString());
   }
 
   /**
-   * OP_COPY oder OP_MOVE
+   * Die gewuenschte Dateioperation angeben,
+   * OP_COPY, OP_MOVE oder OP_DELETE
    *
-   * @param op
+   * @param op die Dateioperation
    */
   public void setOperation(int op) {
     this.operation = op;
   }
 
+  /**
+   * Dafuer sorgen, dass beim Kopieren oder Verschieben kein am Ziel bereits existierender 
+   * Ordner ueberschrieben wird, indem am Ziel fuer einen bereits existierenden Ordner ein  
+   * anderer Name mit laufender Nummer erzeugt wird.
+   * 
+   * @param dir Zielordner
+   * @param attrs die gewuenschten Attribute
+   * @return gibt stets FileVisitResult.CONTINUE zurueck
+   * @throws IOException wenn etwas schief geht
+   */
   @Override
   public FileVisitResult preVisitDirectory(Object dir, BasicFileAttributes attrs) throws IOException {
-    if (operation != Const.OP_DELETE) {
+    if (operation != Eraser.OP_DELETE) {
       if (dir instanceof Path) {
         Path sourceDir = (Path) dir;
         File destFile = targetDir.resolve(sourceDir.getFileName()).toFile();
@@ -72,17 +87,17 @@
 
   @Override
   public FileVisitResult visitFile(Object file, BasicFileAttributes attrs) throws IOException {
-    if(operation != Const.OP_DELETE) {
+    if(operation != Eraser.OP_DELETE) {
       if (file instanceof Path) {
         Path source = (Path) file;
         File destFile = targetDir.resolve(source.getFileName()).toFile();
         if (destFile.exists()) {
           destFile = getNewFileName(destFile);
         }
-        if (operation == Const.OP_MOVE) {
+        if (operation == Mover.OP_MOVE) {
           //logger.fine("move source: " + source.toString() + ", destFile: " + destFile.getAbsolutePath());
           Files.move(source, destFile.toPath());
-        } else if (operation == Const.OP_COPY) {
+        } else if (operation == Mover.OP_COPY) {
           //logger.fine("copy source: " + source.toString() + ", destFile: " + destFile.getAbsolutePath());
           Files.copy(source, destFile.toPath());
         }
@@ -100,11 +115,11 @@
 
   @Override
   public FileVisitResult postVisitDirectory(Object dir, IOException exc) throws IOException {
-    if (operation != Const.OP_DELETE) {
+    if (operation != Eraser.OP_DELETE) {
       if (dir instanceof Path) {
         Path finishedDir = (Path) dir;
         targetDir = targetDir.getParent();
-        if(operation == Const.OP_MOVE) {
+        if(operation == Mover.OP_MOVE) {
           //logger.fine("delete " + finishedDir.toString());
           Files.delete(finishedDir);
         }

--
Gitblit v1.9.3