RedGreenIntArrayRange

open class RedGreenIntArrayRange @JvmOverloads constructor(range: ClosedRange<Int>, defaultColor: RedGreenColor = RedGreenColor.Red) : RedGreenArrayRange<Int, Int>

RedGreenArrayRange subclass for IntRange.

Constructors

Link copied to clipboard
constructor(range: ClosedRange<Int>, defaultColor: RedGreenColor = RedGreenColor.Red)

Properties

Link copied to clipboard

the default color, a colored range is supposed to be fully colored with it right after constructor call.

Link copied to clipboard
open override val length: Int

the length of colored range.

Link copied to clipboard
override val math: BoundMath<Int, Int>

the math used for calculating lengths and distances of subranges.

Link copied to clipboard

the second color.

Link copied to clipboard
override val range: ClosedRange<Int>

a regular range marking bounds of colored range.

Link copied to clipboard

the factory for ranges, it is used for custom ranges type. For example IntRange is more convenient than ClosedRange<BoundType> for equality checks outside the interface or class.

Link copied to clipboard
override val step: Int

the minimal non-zero length of a subrange and distance between two neighbour subranges. Usually it has a value of 1 for integer types of BoundType.

Functions

Link copied to clipboard
open override fun getColor(bound: Int): RedGreenColor

Looks for a subrange containing bound and returns its color.

Link copied to clipboard
fun getGreenSubrange(maxLength: Int = step, limitByRange: ClosedRange<Int> = range): ClosedRange<Int>?

Requests subrange of RedGreenColor.Green color, see TwoColoredRange.getSubrangeOfColor for details.

Link copied to clipboard

Returns subranges of RedGreenColor.Green color.

Link copied to clipboard
fun getRedSubrange(maxLength: Int = step, limitByRange: ClosedRange<Int> = range): ClosedRange<Int>?

Requests subrange of RedGreenColor.Red color, see TwoColoredRange.getSubrangeOfColor for details.

Link copied to clipboard

Returns subranges of RedGreenColor.Red color.

Link copied to clipboard
open override fun getSubrangeOfColor(color: RedGreenColor): ClosedRange<Int>?

getSubrangeOfColor called with maxLength = step and limitByRange = range.

open override fun getSubrangeOfColor(color: RedGreenColor, maxLength: Int): ClosedRange<Int>?

getSubrangeOfColor called with limitByRange = range.

open override fun getSubrangeOfColor(color: RedGreenColor, limitByRange: ClosedRange<Int>): ClosedRange<Int>?

getSubrangeOfColor called with maxLength = step.

open override fun getSubrangeOfColor(color: RedGreenColor, maxLength: Int, limitByRange: ClosedRange<Int>): ClosedRange<Int>?

Performs a search for a subrange with color color limited by limitByRange. If a subrange with length >= maxLength was found then returns a subrange from foundSubrange.start to foundSubrange.start + maxLength (involving math and rangeFactory). Otherwise returns first non-empty subrange with color color inside limitByRange or null.

Link copied to clipboard

Returns list of subranges colored with color.

Link copied to clipboard

Returns list of subranges colored with defaultColor.

Link copied to clipboard

Returns list of subranges colored with otherColor.

Link copied to clipboard
open operator override fun iterator(): Iterator<Pair<ClosedRange<Int>, RedGreenColor>>
Link copied to clipboard
open override fun setSubrangeColor(subrange: ClosedRange<Int>, color: RedGreenColor)

Paints subrange with color overriding any previous colors the subrange contained.

Link copied to clipboard
open override fun setSubrangeDefaultColor(subrange: ClosedRange<Int>)

Paints subrange with defaultColor overriding any previous colors the subrange contained.

Link copied to clipboard

Paints subrange with RedGreenColor.Green color.

Link copied to clipboard
open override fun setSubrangeOtherColor(subrange: ClosedRange<Int>)

Paints subrange with otherColor overriding any previous colors the subrange contained.

Link copied to clipboard

Paints subrange with RedGreenColor.Red color.

Link copied to clipboard

Iterator limited by limitByRange.