Package com.jfcbuilder.builders
Class XYBoxBuilder
java.lang.Object
com.jfcbuilder.builders.XYBoxBuilder
- All Implemented Interfaces:
IXYAnnotationBuilder<XYBoxBuilder>
Builder for producing
XYBoxAnnotation
objects.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionorg.jfree.chart.annotations.XYAnnotation
build()
Builds the XYAnnotation from all configured data and properties.Gets the fill color of the box.Sets the fill color of the box.static XYBoxBuilder
get()
Factory method for obtaining new instances of this class.void
mapXToTimeIndex
(long[] timeData, int indexRangeStartIndex, int indexRangeEndIndex) UsesArrays.binarySearch()
two times to search the source array for the x1 and x2 date value.Gets the outline color of the box.outlineColor
(Paint outlineColor) Sets the outline color of the box.Gets the outline style of the box.outlineStyle
(Stroke outlineStyle) Sets outline style of the box.double
x1()
Gets the x-axis data coordinate of the first corner of the box.x1
(double x1) Sets the x-axis data coordinate of the first corner of the box.double
x2()
Gets the x-axis data coordinate of the second corner of the box.x2
(double x2) Sets the x-axis data coordinate of the second corner of the box.double
y1()
Gets the y-axis data coordinate of the first corner of the box.y1
(double y1) Sets the y-axis data coordinate of the first corner of the box.double
y2()
Gets the y-axis data coordinate of the second corner of the box.y2
(double y2) Sets the y-axis data coordinate of the second corner of the box.
-
Field Details
-
DEFAULT_OUTLINE_COLOR
The outline color to use if none is specified. -
DEFAULT_OUTLINE_STYLE
The outline style to use if none is specified.
-
-
Method Details
-
get
Factory method for obtaining new instances of this class.- Returns:
- New instance of this class
-
x1
public double x1()Gets the x-axis data coordinate of the first corner of the box.- Returns:
- The data coordinate value
-
x1
Sets the x-axis data coordinate of the first corner of the box.- Parameters:
x1
- The data coordinate to set- Returns:
- Reference to this builder instance for method chaining
-
y1
public double y1()Gets the y-axis data coordinate of the first corner of the box.- Returns:
- The data coordinate value
-
y1
Sets the y-axis data coordinate of the first corner of the box.- Parameters:
y1
- The data coordinate to set- Returns:
- Reference to this builder instance for method chaining
-
x2
public double x2()Gets the x-axis data coordinate of the second corner of the box.- Returns:
- The data coordinate value
-
x2
Sets the x-axis data coordinate of the second corner of the box.- Parameters:
x2
- The data coordinate to set- Returns:
- Reference to this builder instance for method chaining
-
y2
public double y2()Gets the y-axis data coordinate of the second corner of the box.- Returns:
- The data coordinate value
-
y2
Sets the y-axis data coordinate of the second corner of the box.- Parameters:
y2
- The data coordinate to set- Returns:
- Reference to this builder instance for method chaining
-
outlineStyle
Gets the outline style of the box.- Returns:
- The outline's style
-
outlineStyle
Sets outline style of the box.- Parameters:
outlineStyle
- The style to set- Returns:
- Reference to this builder instance for method chaining
-
outlineColor
Gets the outline color of the box.- Returns:
- The color
-
outlineColor
Sets the outline color of the box.- Parameters:
outlineColor
- The color to set- Returns:
- Reference to this builder instance for method chaining
-
fillColor
Gets the fill color of the box.- Returns:
- The fill color
-
fillColor
Sets the fill color of the box.- Parameters:
fillColor
- The color to set- Returns:
- Reference to this builder instance for method chaining
-
build
Description copied from interface:IXYAnnotationBuilder
Builds the XYAnnotation from all configured data and properties.- Specified by:
build
in interfaceIXYAnnotationBuilder<XYBoxBuilder>
- Returns:
- New instance of an XYAnnotation corresponding to all configured data and properties
- Throws:
IllegalStateException
- If the builder is missing properties whenbuild()
is called
-
mapXToTimeIndex
public void mapXToTimeIndex(long[] timeData, int indexRangeStartIndex, int indexRangeEndIndex) UsesArrays.binarySearch()
two times to search the source array for the x1 and x2 date value. If found, replaces the values in the builder with the found array index relative to the configured index range. The source time values are assumed to be timestamps in milliseconds since the epoch start. It's also assumed these are in ascending chronologic order. Failure to provide them in sorted order will result in undefined behavior as perArrays.binarySearch()
.- Specified by:
mapXToTimeIndex
in interfaceIXYAnnotationBuilder<XYBoxBuilder>
- Parameters:
timeData
- The array of source time valuesindexRangeStartIndex
- The start index of the series index rangeindexRangeEndIndex
- The end index of the series index range
-