Prechádzať zdrojové kódy

Renamed property "position" (defined by MPC) to "priority"

JaniruTEC 4 rokov pred
rodič
commit
ec64055d93

+ 3 - 3
main/commons/src/main/java/org/cryptomator/common/mountpoint/AvailableDriveLetterChooser.java

@@ -8,7 +8,7 @@ import java.util.Optional;
 
 public class AvailableDriveLetterChooser implements MountPointChooser {
 
-	private static final int POSITION = 200;
+	public static final int PRIORITY = 200;
 
 	private final WindowsDriveLetters windowsDriveLetters;
 
@@ -27,7 +27,7 @@ public class AvailableDriveLetterChooser implements MountPointChooser {
 	}
 
 	@Override
-	public int getPosition() {
-		return POSITION;
+	public int getPriority() {
+		return PRIORITY;
 	}
 }

+ 3 - 3
main/commons/src/main/java/org/cryptomator/common/mountpoint/CustomDriveLetterChooser.java

@@ -9,7 +9,7 @@ import java.util.Optional;
 
 public class CustomDriveLetterChooser implements MountPointChooser {
 
-	public static final int POSITION = 100;
+	public static final int PRIORITY = 100;
 
 	private final Vault vault;
 
@@ -28,7 +28,7 @@ public class CustomDriveLetterChooser implements MountPointChooser {
 	}
 
 	@Override
-	public int getPosition() {
-		return POSITION;
+	public int getPriority() {
+		return PRIORITY;
 	}
 }

+ 3 - 3
main/commons/src/main/java/org/cryptomator/common/mountpoint/CustomMountPointChooser.java

@@ -17,7 +17,7 @@ import java.util.Optional;
 
 public class CustomMountPointChooser implements MountPointChooser {
 
-	public static final int POSITION = 0;
+	public static final int PRIORITY = 0;
 
 	private static final Logger LOG = LoggerFactory.getLogger(CustomMountPointChooser.class);
 
@@ -86,7 +86,7 @@ public class CustomMountPointChooser implements MountPointChooser {
 	}
 
 	@Override
-	public int getPosition() {
-		return POSITION;
+	public int getPriority() {
+		return PRIORITY;
 	}
 }

+ 13 - 13
main/commons/src/main/java/org/cryptomator/common/mountpoint/MountPointChooser.java

@@ -11,11 +11,11 @@ import java.util.SortedSet;
  * preparation of a Mountpoint or an exception otherwise.<br>
  * <p>All <i>MountPointChoosers (MPCs)</i> need to implement this class and must be added to
  * the pool of possible MPCs by the {@link MountPointChooserModule MountPointChooserModule.}
- * The MountPointChooserModule will sort them according to their {@link #getPosition() position.}
- * The position must be defined by the developer to reflect a useful execution order;
- * the order of execution of MPCs with equal position is undefined.
+ * The MountPointChooserModule will sort them according to their {@link #getPriority() priority.}
+ * The priority must be defined by the developer to reflect a useful execution order;
+ * the order of execution of MPCs with equal priority is undefined.
  *
- * <p>MPCs are executed by a {@link Volume} in ascedning order of their position to find
+ * <p>MPCs are executed by a {@link Volume} in ascedning order of their priority to find
  * and prepare a suitable Mountpoint for the Volume. The Volume has access to a
  * {@link SortedSet} of MPCs in this specific order, that is provided by the Module.
  * The Set only contains Choosers that were deemed {@link #isApplicable() applicable}
@@ -128,30 +128,30 @@ public interface MountPointChooser extends Comparable<MountPointChooser> {
 	/**
 	 * Called by the {@link MountPointChooserModule} to sort the available MPCs
 	 * and determine their execution order.
-	 * The position must be defined by the developer to reflect a useful execution order.
-	 * MPCs with lower positions will be placed at lower indices in the resulting
+	 * The priority must be defined by the developer to reflect a useful execution order.
+	 * MPCs with lower priorities will be placed at lower indices in the resulting
 	 * {@link SortedSet} and will be executed with higher probability.
-	 * The order of execution of MPCs with equal position is undefined.
+	 * The order of execution of MPCs with equal priority is undefined.
 	 *
-	 * @return the position of this MPC.
+	 * @return the priority of this MPC.
 	 */
-	int getPosition();
+	int getPriority();
 
 	/**
 	 * Called by the {@link MountPointChooserModule} to determine the execution order
 	 * of the registered MPCs. <b>Implementations usually should not override this
 	 * method.</b> This default implementation sorts the MPCs in ascending order
-	 * of their {@link #getPosition() position.}<br>
+	 * of their {@link #getPriority() priority.}<br>
 	 * <br>
 	 * <b>Original description:</b>
 	 * <p>{@inheritDoc}
 	 *
 	 * @implNote This default implementation sorts the MPCs in ascending order
-	 * of their {@link #getPosition() position.}
+	 * of their {@link #getPriority() priority.}
 	 */
 	@Override
 	default int compareTo(MountPointChooser other) {
-		//Sort by position (ascending order)
-		return Integer.compare(this.getPosition(), other.getPosition());
+		//Sort by priority (ascending order)
+		return Integer.compare(this.getPriority(), other.getPriority());
 	}
 }

+ 3 - 3
main/commons/src/main/java/org/cryptomator/common/mountpoint/TemporaryMountPointChooser.java

@@ -15,7 +15,7 @@ import java.util.Optional;
 
 public class TemporaryMountPointChooser implements MountPointChooser {
 
-	public static final int POSITION = 300;
+	public static final int PRIORITY = 300;
 
 	private static final Logger LOG = LoggerFactory.getLogger(TemporaryMountPointChooser.class);
 	private static final int MAX_TMPMOUNTPOINT_CREATION_RETRIES = 10;
@@ -89,7 +89,7 @@ public class TemporaryMountPointChooser implements MountPointChooser {
 	}
 
 	@Override
-	public int getPosition() {
-		return POSITION;
+	public int getPriority() {
+		return PRIORITY;
 	}
 }