Package com.deltawalker.script
Enum Class Role
- All Implemented Interfaces:
Serializable,Comparable<Role>,Constable
The role a compared item - a file, a folder, a block of text - plays in a
comparison. A two-way comparison has the roles
REF and
ONE; a three-way comparison also has TWO, with
REF as the common base. See
Comparisons.create(Comparison.Type, String[], ComparisonListener)
for which path gets which role.
const Role = Java.type('com.deltawalker.script.Role');
const res = node.resource(Role.REF);
- Since:
- 2.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic intcount()Returns the number ofRoles.static RolefromInt(int intVal) Returns theRolewith the specified numerical value.getDisplayName(boolean threeWay) The name of thisRoleto be used for display purposes.inttoInt()static RoleReturns the enum constant of this class with the specified name.static Role[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
ONE
The Modified role. In a 3-way comparison, this is the first of two modified roles. -
REF
The Reference role against which modified roles are compared. -
TWO
The Second Modified role. Present only in a 3-way comparison.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
count
public static int count()Returns the number ofRoles.- Returns:
- the number of values defined by this enum.
- Since:
- 2.0
-
fromInt
Returns theRolewith the specified numerical value.- Parameters:
intVal- the numerical value of the requested role- Returns:
- the
Rolewith the specified numerical value. - Since:
- 2.0
-
getDisplayName
The name of thisRoleto be used for display purposes. The display of the sameRolemay vary depending on whether it's used in the context of a two or three-way comparison. For instance, in a two-way comparisonONE's name would be just 'Modified'; in a three-way comparison it would be 'First Modified'. The display name ofREFwould remain the same - 'Reference'.- Parameters:
threeWay-trueto construct a display name for a three-way comparison,falsefor a two-way.- Returns:
- the name of this role as a string suitable for display purposes
- Since:
- 2.0
-
toInt
public int toInt()Returns the integer value of thisRole: 0 forREF, 1 forONEand 2 forTWO. This is also the index of each role inHistoryEntry.getPaths().- Returns:
- the integer value of this role
- Since:
- 2.0
-