Package org.openjdk.jmc.common.unit
Class QuantityRange<U extends TypedUnit<U>>
- java.lang.Object
-
- org.openjdk.jmc.common.unit.QuantityRange<U>
-
-
Field Summary
Fields Modifier and Type Field Description protected ITypedQuantity<U>start-
Fields inherited from interface org.openjdk.jmc.common.IDisplayable
AUTO, EXACT, VERBOSE
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static IDisplayablecreateInfinite(IQuantity start, IQuantity end)static <U extends TypedUnit<U>>
IRange<IQuantity>createPoint(IQuantity start)static <U extends TypedUnit<U>>
IRange<IQuantity>createWithEnd(IQuantity start, IQuantity end)static <U extends TypedUnit<U>>
IRange<IQuantity>createWithExtent(IQuantity start, ITypedQuantity<LinearUnit> extent)StringdisplayUsing(String formatHint)Format this object for display purposes, preferably using the formatter hinted byformatHint.abstract ITypedQuantity<U>getEnd()ITypedQuantity<U>getStart()static IRange<IQuantity>intersection(IRange<IQuantity> a, IRange<IQuantity> b)static IRange<IQuantity>union(IRange<IQuantity> a, IRange<IQuantity> b)
-
-
-
Field Detail
-
start
protected final ITypedQuantity<U extends TypedUnit<U>> start
-
-
Method Detail
-
createWithEnd
public static <U extends TypedUnit<U>> IRange<IQuantity> createWithEnd(IQuantity start, IQuantity end)
-
createWithExtent
public static <U extends TypedUnit<U>> IRange<IQuantity> createWithExtent(IQuantity start, ITypedQuantity<LinearUnit> extent)
-
createInfinite
public static IDisplayable createInfinite(IQuantity start, IQuantity end)
Create anIRange<IQuantity>ifstartandendboth are non-null. Otherwise, create anIDisplayablethat looks like an infinite range, by treating null values as minus or plus infinity, respectively. This behavior is a consequence of the current state whereIQuantityand thuslyIRange<IQuantity>both need to be finite. (A possible change to this state, when all kinds of quantities support being stored as doubles, is to allowDouble.NEGATIVE_INFINITYandDouble.POSITIVE_INFINITYas numerical quantities. In that case, this method can be replaced withcreateWithEnd(IQuantity, IQuantity)).
-
intersection
public static IRange<IQuantity> intersection(IRange<IQuantity> a, IRange<IQuantity> b)
-
getStart
public ITypedQuantity<U> getStart()
-
getEnd
public abstract ITypedQuantity<U> getEnd()
-
displayUsing
public String displayUsing(String formatHint)
Description copied from interface:IDisplayableFormat this object for display purposes, preferably using the formatter hinted byformatHint. If no such formatter is defined for this type, the default formatter will be used.- Specified by:
displayUsingin interfaceIDisplayable- Parameters:
formatHint- the format hint- Returns:
- a formatted string according to the hinted (or default) formatter
-
-