diff options
| author | Paul Buetow <paul@buetow.org> | 2025-06-20 20:04:02 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-06-20 20:04:02 +0300 |
| commit | f0b58321ae53f330da86c392661354b87bd9a412 (patch) | |
| tree | c0be72f57094d13cf8bcb53567614258a6eb43fa /src/main/java/utils/VS3Tupel.java | |
| parent | c3b95267b24d843897b04d6d6a16f62dc8cf1ed2 (diff) | |
Modernize codebase to use Java 21 features
- Convert VS3Tupel and VSLamportTime to records for immutability
- Use switch expressions with pattern matching in VSTimestampTriggeredEvent
- Modernize exception handling with pattern matching in VSErrorHandler
- Replace anonymous ActionListener with lambda in VSAboutFrame
- Use formatted strings instead of concatenation in VSDummyProtocol
- Add sealed hierarchy VSEventType for exhaustive pattern matching
- Create VSSimulationConfig record for configuration management
- Maintain backward compatibility with deprecated methods
All 132 unit tests pass successfully with Java 21 features.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'src/main/java/utils/VS3Tupel.java')
| -rw-r--r-- | src/main/java/utils/VS3Tupel.java | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/src/main/java/utils/VS3Tupel.java b/src/main/java/utils/VS3Tupel.java index ac7ffba..3ff5129 100644 --- a/src/main/java/utils/VS3Tupel.java +++ b/src/main/java/utils/VS3Tupel.java @@ -1,58 +1,59 @@ package utils; /** - * The class VS3Tupel, an object of this class represents a 3-Tupel of objects. - * Each object can have its own type. + * A generic 3-tuple record that holds three values of potentially different types. + * This is an immutable value object that provides automatic implementations of + * {@code equals()}, {@code hashCode()}, and {@code toString()}. + * + * <p>Example usage:</p> + * <pre>{@code + * VS3Tupel<String, Integer, Boolean> tuple = new VS3Tupel<>("Hello", 42, true); + * String first = tuple.a(); + * Integer second = tuple.b(); + * Boolean third = tuple.c(); + * }</pre> * + * @param <A> the type of the first element + * @param <B> the type of the second element + * @param <C> the type of the third element + * @param a the first element + * @param b the second element + * @param c the third element + * * @author Paul C. Buetow */ -public final class VS3Tupel<A,B,C> { - /** The a. */ - private A a; - - /** The b. */ - private B b; - - /** The c. */ - private C c; - - /** - * Instantiates a new tupel. - * - * @param a the a - * @param b the b - * @param c the c - */ - public VS3Tupel(A a, B b, C c) { - this.a = a; - this.b = b; - this.c = c; - } - +public record VS3Tupel<A, B, C>(A a, B b, C c) { + /** - * Gets the a. + * Gets the first element (provided for backward compatibility). * - * @return the a + * @return the first element + * @deprecated Use {@link #a()} instead */ + @Deprecated public A getA() { return a; } - + /** - * Gets the b. + * Gets the second element (provided for backward compatibility). * - * @return the b + * @return the second element + * @deprecated Use {@link #b()} instead */ + @Deprecated public B getB() { return b; } - + /** - * Gets the c. + * Gets the third element (provided for backward compatibility). * - * @return the c + * @return the third element + * @deprecated Use {@link #c()} instead */ + @Deprecated public C getC() { return c; } -} +}
\ No newline at end of file |
