Dimensions

com.phasmid.majabigwaduce.matrix.Dimensions
See theDimensions companion object
case class Dimensions(xs: Seq[Int]) extends Ordered[Dimensions]

Case class to represent the dimensions of a matrix. Currently, area works only for one- or two-dimensional matrices

Value parameters

xs

a sequence of integers defining the numbers of rows, columns, etc.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Ordered[Dimensions]
trait Comparable[Dimensions]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def area: Int

Calculates the area of a two-dimensional matrix based on its dimensions. The area is computed as the product of the number of rows and columns. If rows or columns are not defined, default values are used (0 for rows, and 1 for columns).

Calculates the area of a two-dimensional matrix based on its dimensions. The area is computed as the product of the number of rows and columns. If rows or columns are not defined, default values are used (0 for rows, and 1 for columns).

Attributes

Returns

the computed area as an integer value

def compare(that: Dimensions): Int

Result of comparing this with operand that.

Result of comparing this with operand that.

Implement this method to determine how instances of A will be sorted.

Returns x where:

  • x < 0 when this < that

  • x == 0 when this == that

  • x > 0 when this > that

Value parameters

that

the instance to compare against

Attributes

Returns

an integer whose sign indicates the ordering relation between this and that

def rows: Int

Retrieves the number of rows in the collection by inspecting the first element. If the collection is empty, it defaults to 0.

Retrieves the number of rows in the collection by inspecting the first element. If the collection is empty, it defaults to 0.

Attributes

Returns

The number of rows as an integer.

def size: Int

Returns the number of elements in the collection.

Returns the number of elements in the collection.

Attributes

Returns

the size of the collection as an integer

Inherited methods

def <(that: Dimensions): Boolean

Returns true if this is less than that

Returns true if this is less than that

Value parameters

that

the instance to compare against

Attributes

Inherited from:
Ordered
def <=(that: Dimensions): Boolean

Returns true if this is less than or equal to that.

Returns true if this is less than or equal to that.

Attributes

Inherited from:
Ordered
def >(that: Dimensions): Boolean

Returns true if this is greater than that.

Returns true if this is greater than that.

Value parameters

that

the instance to compare against

Attributes

Inherited from:
Ordered
def >=(that: Dimensions): Boolean

Returns true if this is greater than or equal to that.

Returns true if this is greater than or equal to that.

Attributes

Inherited from:
Ordered
def compareTo(that: Dimensions): Int

Result of comparing this with operand that.

Result of comparing this with operand that.

Value parameters

that

the instance to compare against

Attributes

Inherited from:
Ordered
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product

Concrete fields

val cols: Int

Represents the number of columns in the matrix. Defaults to 1 if the matrix has no second dimension.

Represents the number of columns in the matrix. Defaults to 1 if the matrix has no second dimension.

Attributes