Package org.midheaven.collections
Class Length
java.lang.Object
org.midheaven.collections.Length
- Direct Known Subclasses:
Length.Finite,Length.Infinite,Length.Unknown
public abstract sealed class Length
extends Object
permits Length.Finite, Length.Infinite, Length.Unknown
Represents the Length of an
Enumerator. It can be infinite, finite or unknown-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic final class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LengthCreates a finiteLengthwith the given lengthabstract LengthReturns a new Length that is the minimum betweenthisand the given Lengthmin(finite(x), finite(y)) -> finite(x <= y ? x : y) min(finite(x), infinite) -> finite(x) min(finite(x), unknown) -> unknown min(infinite, unknown) -> unknownabstract LengthSubtracts the given value from this value.
-
Constructor Details
-
Length
public Length()
-
-
Method Details
-
finite
Creates a finiteLengthwith the given length- Parameters:
length- the length value- Returns:
-
min
Returns a new Length that is the minimum betweenthisand the given Lengthmin(finite(x), finite(y)) -> finite(x <= y ? x : y) min(finite(x), infinite) -> finite(x) min(finite(x), unknown) -> unknown min(infinite, unknown) -> unknown- Parameters:
other- the other value- Returns:
- the minimum Length
-
minus
Subtracts the given value from this value.finite(x) - finite(y) -> x - y finite(x) - infinite -> infinite infinite - finite(x) -> infinite finite(x) - unknown -> unknown unknown - finite(x) -> unknown infinite - infinite -> infinite infinite - unknown -> infinite unknown - infinite -> unknown unknown - unknown -> unknown- Parameters:
other- the value to subtract- Returns:
this-other
-