summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnitsGUI/UnitConversionRecord.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/sevenUnitsGUI/UnitConversionRecord.java')
-rw-r--r--src/main/java/sevenUnitsGUI/UnitConversionRecord.java42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/main/java/sevenUnitsGUI/UnitConversionRecord.java b/src/main/java/sevenUnitsGUI/UnitConversionRecord.java
index 958deae..3c2bb6c 100644
--- a/src/main/java/sevenUnitsGUI/UnitConversionRecord.java
+++ b/src/main/java/sevenUnitsGUI/UnitConversionRecord.java
@@ -44,7 +44,7 @@ public final class UnitConversionRecord {
input.getValue().toString(false, RoundingMode.HALF_EVEN),
output.getValue().toString(false, RoundingMode.HALF_EVEN));
}
-
+
/**
* Gets a {@code UnitConversionRecord} from two unit values
*
@@ -60,7 +60,7 @@ public final class UnitConversionRecord {
output.getUnit().getName(), String.valueOf(input.getValue()),
String.valueOf(output.getValue()));
}
-
+
/**
* Gets a {@code UnitConversionRecord}
*
@@ -78,16 +78,12 @@ public final class UnitConversionRecord {
return new UnitConversionRecord(fromName, toName, inputValueString,
outputValueString);
}
-
- /**
- * The name of the unit or expression that was converted from
- */
+
+ /** The name of the unit or expression that was converted from */
private final String fromName;
- /**
- * The name of the unit or expression that was converted to
- */
+ /** The name of the unit or expression that was converted to */
private final String toName;
-
+
/**
* A string representing the input value. It doesn't need to be the same as
* the input value's string representation; it could be rounded, for example.
@@ -98,7 +94,7 @@ public final class UnitConversionRecord {
* the input value's string representation; it could be rounded, for example.
*/
private final String outputValueString;
-
+
/**
* @param fromName name of unit or expression that was converted
* from
@@ -115,14 +111,14 @@ public final class UnitConversionRecord {
this.inputValueString = inputValueString;
this.outputValueString = outputValueString;
}
-
+
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof UnitConversionRecord))
return false;
- final UnitConversionRecord other = (UnitConversionRecord) obj;
+ final var other = (UnitConversionRecord) obj;
if (this.fromName == null) {
if (other.fromName != null)
return false;
@@ -145,7 +141,7 @@ public final class UnitConversionRecord {
return false;
return true;
}
-
+
/**
* @return name of unit or expression that was converted from
* @since 2022-04-09
@@ -154,11 +150,11 @@ public final class UnitConversionRecord {
public String fromName() {
return this.fromName;
}
-
+
@Override
public int hashCode() {
- final int prime = 31;
- int result = 1;
+ final var prime = 31;
+ var result = 1;
result = prime * result
+ (this.fromName == null ? 0 : this.fromName.hashCode());
result = prime * result + (this.inputValueString == null ? 0
@@ -169,7 +165,7 @@ public final class UnitConversionRecord {
+ (this.toName == null ? 0 : this.toName.hashCode());
return result;
}
-
+
/**
* @return string representing input value
* @since 2022-04-09
@@ -178,7 +174,7 @@ public final class UnitConversionRecord {
public String inputValueString() {
return this.inputValueString;
}
-
+
/**
* @return string representing output value
* @since 2022-04-09
@@ -187,7 +183,7 @@ public final class UnitConversionRecord {
public String outputValueString() {
return this.outputValueString;
}
-
+
/**
* @return name of unit or expression that was converted to
* @since 2022-04-09
@@ -196,12 +192,12 @@ public final class UnitConversionRecord {
public String toName() {
return this.toName;
}
-
+
@Override
public String toString() {
- final String inputString = this.inputValueString.isBlank() ? this.fromName
+ final var inputString = this.inputValueString.isBlank() ? this.fromName
: this.inputValueString + " " + this.fromName;
- final String outputString = this.outputValueString.isBlank() ? this.toName
+ final var outputString = this.outputValueString.isBlank() ? this.toName
: this.outputValueString + " " + this.toName;
return inputString + " = " + outputString;
}