PolygonHC

ostrat.prid.phex.PolygonHC
See thePolygonHC companion object
final class PolygonHC(val arrayUnsafe: Array[Int]) extends AnyVal, HCoordSeqSpec, PolygonLikeInt2[HCoord], ArrayIntBacked

A polygon with the vertices defined by hex tile coordinates HCoords.

Attributes

Companion
object
Graph
Supertypes
trait SeqSpec[HCoord]
trait SeqLike[HCoord]
class AnyVal
trait Matchable
class Any
Show all

Members list

Type members

Types

override type SideT = LineSegHC
override type ThisT = PolygonHC

Gives the final type of this class.

Gives the final type of this class.

Attributes

Value members

Concrete methods

def circularIndex(inp: Int): Int

This applies the index value in a circular manner. So the 6th index of a Hexagon is applied at vertex 0, 7 at 1 and -1 at 5.

This applies the index value in a circular manner. So the 6th index of a Hexagon is applied at vertex 0, 7 at 1 and -1 at 5.

Attributes

def combine(operand: PolygonHC): Option[PolygonHC]
override def fromArray(array: Array[Int]): PolygonHC

Constructs the final type of these SeqLikeIntN from an Array[Int]. Mostly you will access this capability from the companion object or the appropriate builder, but it can be useful to access this from the class itself.

Constructs the final type of these SeqLikeIntN from an Array[Int]. Mostly you will access this capability from the companion object or the appropriate builder, but it can be useful to access this from the class itself.

Attributes

Definition Classes
override def side(index: Int): LineSegHC

Returns a side of the appropriate type for the PolygonLike from the goven index. The index cycles.

Returns a side of the appropriate type for the PolygonLike from the goven index. The index cycles.

Attributes

Definition Classes
override def sides: LineSegHCArr

Attributes

Definition Classes
override def sidesForeach[U](f: LineSegHC => U): Unit

Attributes

Definition Classes
def toPolygon(f: HCoord => Pt2): Polygon
override def typeStr: String

String specifying the type of this object.

String specifying the type of this object.

Attributes

Definition Classes
def vertNum: Int
override def verts: HCoordArr

Attributes

Definition Classes
override def vertsForeach[U](f: HCoord => U): Unit

Performs the side effecting function on the HCoord value of each vertex.

Performs the side effecting function on the HCoord value of each vertex.

Attributes

Definition Classes
override def vertsMap[B, ArrB <: Arr[B]](f: HCoord => B)(implicit builder: BuilderArrMap[B, ArrB]): ArrB

Maps the vertices of this polygon to an immutable Array like sequence of type B.

Maps the vertices of this polygon to an immutable Array like sequence of type B.

Type parameters

ArrB

The type of the immutable Array like sequence of B.

B

The element type of the returned sequence.

Attributes

Returns

the immutable sequence collection by applying the supplied function to each vertex.

Definition Classes
override def vertsPrevForEach[U](f: (HCoord, HCoord) => U): Unit

This method does nothing if the vertNum < 2. Foreach vertex applies the side effecting function to the previous vertex with each vertex. The previous vertex to the first vertex is the last vertex of the PolygonLike. Note the function signature (previous, vertex) => U follows the foreach based convention of putting the collection element 2nd or last as seen for example in fold methods'(accumulator, element) => B signature.

This method does nothing if the vertNum < 2. Foreach vertex applies the side effecting function to the previous vertex with each vertex. The previous vertex to the first vertex is the last vertex of the PolygonLike. Note the function signature (previous, vertex) => U follows the foreach based convention of putting the collection element 2nd or last as seen for example in fold methods'(accumulator, element) => B signature.

Attributes

Definition Classes

Inherited methods

override protected def arrayForSides: Array[Int]

Creates the Array[Int] need to implement the sides method.

Creates the Array[Int] need to implement the sides method.

Attributes

Definition Classes
Inherited from:
PolygonLikeInt2
final def arrayLen: Int

The length of the backing Array.

The length of the backing Array.

Attributes

Inherited from:
ArrayIntBacked
override def elemProdSize: Int

The number of atomic values, Ints, Doubles, Longs etc that specify / construct an element of this immutable flat Array based collection class.

The number of atomic values, Ints, Doubles, Longs etc that specify / construct an element of this immutable flat Array based collection class.

Attributes

Definition Classes
Inherited from:
SeqLikeInt2
override def elemsStr: String

The element String allows the composition of toString for the whole collection. The syntax of the output will be reworked.

The element String allows the composition of toString for the whole collection. The syntax of the output will be reworked.

Attributes

Definition Classes
Inherited from:
SeqSpec
final override def fElemStr: HCoord => String

Attributes

Definition Classes
Inherited from:
HCoordSeqLike
def flatMap[B <: ValueNElem, BB <: PolygonLike[B]](f: HCoord => SeqLike[B])(implicit build: PolygonLikeFlatBuilder[B, BB]): BB

FlatMaps the vertices of this PolygonLike to a new to PolygonLike class of type BB.

FlatMaps the vertices of this PolygonLike to a new to PolygonLike class of type BB.

Attributes

Inherited from:
PolygonLike
def map[B <: ValueNElem, BB <: PolygonLike[B]](f: HCoord => B)(implicit build: PolygonLikeMapBuilder[B, BB]): BB

Maps the vertices of this PolygonLike to a new to PolygonLike class of type BB.

Maps the vertices of this PolygonLike to a new to PolygonLike class of type BB.

Attributes

Inherited from:
PolygonLike
final override def newElem(int1: Int, int2: Int): HCoord

Attributes

Definition Classes
Inherited from:
HCoordSeqLike
override def numVerts: Int

The number of vertices and also the number of sides in this Polygon.

The number of vertices and also the number of sides in this Polygon.

Attributes

Definition Classes
Inherited from:
PolygonValueN
def optMap[B <: ValueNElem, BB <: PolygonLike[B]](f: HCoord => Option[B])(implicit build: PolygonLikeMapBuilder[B, BB]): Option[BB]

Optionally maps the vertices of this PolygonLike to vertices of a new to PolygonLike class of type BB. If the new PolygonLike has at least 3 vertices returns Some else returns None.

Optionally maps the vertices of this PolygonLike to vertices of a new to PolygonLike class of type BB. If the new PolygonLike has at least 3 vertices returns Some else returns None.

Attributes

Inherited from:
PolygonLike
override def reverse: ThisT

Reverses the order of the elements of the specifying sequence.

Reverses the order of the elements of the specifying sequence.

Attributes

Definition Classes
Inherited from:
SeqSpecIntN
final override def setElemUnsafe(index: Int, newElem: HCoord): Unit

Sets / mutates an element in the Arr. This method should rarely be needed by end users, but is used by the initialisation and factory methods.

Sets / mutates an element in the Arr. This method should rarely be needed by end users, but is used by the initialisation and factory methods.

Attributes

Definition Classes
Inherited from:
SeqLikeInt2
def setElemsUnsafe(index: Int, elems: HCoord*): Unit

Sets / mutates elements in the Arr. This method should rarely be needed by end users, but is used by the initialisation and factory methods.

Sets / mutates elements in the Arr. This method should rarely be needed by end users, but is used by the initialisation and factory methods.

Attributes

Inherited from:
SeqLike
final override def ssElemEq(a1: HCoord, a2: HCoord): Boolean

Checks if 2 values of the specifying sequence are equal.

Checks if 2 values of the specifying sequence are equal.

Attributes

Definition Classes
Inherited from:
SeqSpecInt2
def ssFold[B](initVal: B)(f: (B, HCoord) => B): B

specifying -sequence fold.

specifying -sequence fold.

Attributes

Inherited from:
SeqSpec

Attributes

Inherited from:
SeqSpecValueN
def ssForeach[U](f: HCoord => U): Unit

Performs a side effecting function on each element of the specifying sequence in order.

Performs a side effecting function on each element of the specifying sequence in order.

Attributes

Inherited from:
SeqSpec
def ssIForeach[U](initIndex: Int)(f: (Int, HCoord) => U): Unit

Index with foreach on the data elements. Performs a side effecting function on the index and each element of the data sequence. It takes a function as a parameter. The function may return Unit. If it does return a non Unit value it is discarded. The [U] type parameter is there just to avoid warnings about discarded values and can be ignored by method users. The method has 2 versions / name overloads. The default start for the index is 0 if just the function parameter is passed. The second version name overload takes an Int for the first parameter list, to set the start value of the index. Note the function signature follows the foreach based convention of putting the collection element 2nd or last as seen for example in fold methods' (accumulator, element) => B signature.

Index with foreach on the data elements. Performs a side effecting function on the index and each element of the data sequence. It takes a function as a parameter. The function may return Unit. If it does return a non Unit value it is discarded. The [U] type parameter is there just to avoid warnings about discarded values and can be ignored by method users. The method has 2 versions / name overloads. The default start for the index is 0 if just the function parameter is passed. The second version name overload takes an Int for the first parameter list, to set the start value of the index. Note the function signature follows the foreach based convention of putting the collection element 2nd or last as seen for example in fold methods' (accumulator, element) => B signature.

Attributes

Inherited from:
SeqSpec
def ssIForeach[U](f: (Int, HCoord) => Any): Unit

Index with foreach on the the specifying sequence elements. Performs a side effecting function on the index and each element of the specifying sequence. It takes a function as a parameter. The function may return Unit. If it does return a non Unit value it is discarded. The [U] type parameter is there just to avoid warnings about discarded values and can be ignored by method users. The method has 2 versions / name overloads. The default start for the index is 0 if just the function parameter is passed. The second version name overload takes an Int for the first parameter list, to set the start value of the index. Note the function signature follows the foreach based convention of putting the collection element 2nd or last as seen for example in fold methods' (accumulator, element) => B signature.

Index with foreach on the the specifying sequence elements. Performs a side effecting function on the index and each element of the specifying sequence. It takes a function as a parameter. The function may return Unit. If it does return a non Unit value it is discarded. The [U] type parameter is there just to avoid warnings about discarded values and can be ignored by method users. The method has 2 versions / name overloads. The default start for the index is 0 if just the function parameter is passed. The second version name overload takes an Int for the first parameter list, to set the start value of the index. Note the function signature follows the foreach based convention of putting the collection element 2nd or last as seen for example in fold methods' (accumulator, element) => B signature.

Attributes

Inherited from:
SeqSpec
final override def ssIndex(index: Int): HCoord

Accesses the specifying sequence element by a 0 based index.

Accesses the specifying sequence element by a 0 based index.

Attributes

Definition Classes
Inherited from:
SeqSpecInt2
def ssInnerForeach[U](f: HCoord => U): Unit

Foreachs over the inner of the specifying sequence, excludes the first and last element. Performs a side effecting function on each element of the tail of the specifying sequence in order.

Foreachs over the inner of the specifying sequence, excludes the first and last element. Performs a side effecting function on each element of the tail of the specifying sequence in order.

Attributes

Inherited from:
SeqSpec
def ssLast: HCoord

Last element of the specifying sequence.

Last element of the specifying sequence.

Attributes

Inherited from:
SeqSpec
override def ssLength: Int

The number of product elements in this collection. For example in a [[PolygonImp], this is the number of Pt2s in the Polygon

The number of product elements in this collection. For example in a [[PolygonImp], this is the number of Pt2s in the Polygon

Attributes

Definition Classes
Inherited from:
SeqSpecValueN
def ssMap[B, ArrB <: Arr[B]](f: HCoord => B)(implicit ev: BuilderArrMap[B, ArrB]): ArrB

Specialised map to an immutable Arr of B. For Sequ dataMap is the same as map, but for other structures it will be different, for example a PolygonLike will map to another PolygonLike.

Specialised map to an immutable Arr of B. For Sequ dataMap is the same as map, but for other structures it will be different, for example a PolygonLike will map to another PolygonLike.

Attributes

Inherited from:
SeqSpec
def ssReverseForeach[U](f: HCoord => U): Unit

Performs a side effecting function on each element of the specifying-sequence in reverse order. The function may return Unit. If it does return a non Unit value it is discarded. The [U] type parameter is there just to avoid warnings about discarded values and can be ignored by method users.

Performs a side effecting function on each element of the specifying-sequence in reverse order. The function may return Unit. If it does return a non Unit value it is discarded. The [U] type parameter is there just to avoid warnings about discarded values and can be ignored by method users.

Attributes

Inherited from:
SeqSpec
def ssTailFold[B](initial: B)(f: (B, HCoord) => B): B

FoldLeft over the tail of the specifying sequence.

FoldLeft over the tail of the specifying sequence.

Attributes

Inherited from:
SeqSpec
def ssTailForeach[U](f: HCoord => U): Unit

Foreachs over the tail of the specifying sequence. Performs a side effecting function on each element of the tail of the specifying sequence in order.

Foreachs over the tail of the specifying sequence. Performs a side effecting function on each element of the tail of the specifying sequence in order.

Attributes

Inherited from:
SeqSpec
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
SeqLike -> Any
Inherited from:
SeqLike
final def unsafeSameSize(length: Int): ThisT

Method for creating a new Array[Int] backed collection class of this collection class's final type.

Method for creating a new Array[Int] backed collection class of this collection class's final type.

Attributes

Inherited from:
SeqLikeIntN
def vert(index: Int): HCoord

Returns the vertex of the given index. Cycles around if the index is out of range, vert 3 retruns vert 0 on a triangle.

Returns the vertex of the given index. Cycles around if the index is out of range, vert 3 retruns vert 0 on a triangle.

Attributes

Inherited from:
PolygonLike

This method should be overridden in final classes.

This method should be overridden in final classes.

Attributes

Inherited from:
PolygonLike

Checks this polygon has at least 3 vertices.

Checks this polygon has at least 3 vertices.

Attributes

Inherited from:
PolygonLike

Concrete fields

The backing Array[Int] of this collection class. End users should not normally need to interact with this directly.

The backing Array[Int] of this collection class. End users should not normally need to interact with this directly.

Attributes