# Enum MatrixFormat

java.lang.Object
java.lang.Enum<MatrixFormat>
uk.ac.starlink.ttools.plot2.geom.MatrixFormat

All Implemented Interfaces:
  `Serializable, Comparable<MatrixFormat>, java.lang.constant.Constable`

public enum MatrixFormat extends Enum<MatrixFormat>
Defines which cells from a matrix are included.

The various parts are specified by Boolean wrapper types; TRUE/FALSE value indicates unconditional in/exclusion, and a null value will include those cells only if there is something to plot in there.

Since:
  16 Aug 2023
Author:
  Mark Taylor

## Nested Class Summary

### Nested classes/interfaces inherited from class Enum

`Enum.EnumDesc<E>`

## Enum Constant Summary

Enum Constants
Enum Constant
Description
`FULL`
Full matrix is occupied.
`LOWER`
Lower diagonal part of matrix is occupied.
`UPPER`
Upper diagonal part of matrix is occupied.

## Method Summary

Modifier and Type
Method
Description
`String`
`getDescription()`
Returns a user-directed description of this format.
`MatrixShape`
`getShape(int nw, boolean hasOnDiag, boolean hasOffDiag)`
Returns a MatrixShape for a matrix of a given size conforming to this MatrixFormat.
`Boolean`
`hasDiagonal()`
Indicates whether to include the diagonal cells.
`Boolean`
`hasLower()`
Indicates whether to include the lower triangular cells.
`Boolean`
`hasUpper()`
Indicates whether to include the upper triangular cells.
`static boolean`
`isOffDiagonal(CoordGroup cgrp)`
Indicates whether a given coordinate group represents a grid element that would appear off the diagonal of a matrix plot.
`static boolean`
`isOnDiagonal(CoordGroup cgrp)`
Indicates whether a given coordinate group represents a grid element that would appear on the diagonal of a matrix plot.
`static MatrixFormat`
`valueOf(String name)`
Returns the enum constant of this type with the specified name.
`static MatrixFormat[]`
`values()`
Returns an array containing the constants of this enum type, in the order they are declared.

### Methods inherited from class Enum

`clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

### Methods inherited from class Object

`getClass, notify, notifyAll, wait, wait, wait`

## Enum Constant Details

### LOWER

public static final MatrixFormat LOWER
Lower diagonal part of matrix is occupied.

### UPPER

public static final MatrixFormat UPPER
Upper diagonal part of matrix is occupied.

### FULL

public static final MatrixFormat FULL
Full matrix is occupied.

## Method Details

### values

public static MatrixFormat[] values()
Returns an array containing the constants of this enum type, in the order they are declared.

Returns:
  an array containing the constants of this enum type, in the order they are declared

### valueOf

public static MatrixFormat valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
  `name` - the name of the enum constant to be returned.
Returns:
  the enum constant with the specified name
Throws:
  `IllegalArgumentException` - if this enum type has no constant with the specified name
  `NullPointerException` - if the argument is null

### hasDiagonal

public Boolean hasDiagonal()
Indicates whether to include the diagonal cells.

Returns:
  diagonal cells included/excluded/automatic

### hasLower

public Boolean hasLower()
Indicates whether to include the lower triangular cells.

Returns:
  lower triangular cells included/excluded/automatic

### hasUpper

public Boolean hasUpper()
Indicates whether to include the upper triangular cells.

Returns:
  upper triangular cells included/excluded/automatic

### getDescription

public String getDescription()
Returns a user-directed description of this format.

Returns:
  description

### getShape

public MatrixShape getShape(int nw, boolean hasOnDiag, boolean hasOffDiag)
Returns a MatrixShape for a matrix of a given size conforming to this MatrixFormat.

Parameters:
  `nw` - linear dimension of the matrix
  `hasOnDiag` - whether on-diagonal cells are present
  `hasOffDiag` - whether off-diagonal cells are present
Returns:
  matrix shape
See Also:
  - `isOnDiagonal(CoordGroup)`
  - `isOffDiagonal(CoordGroup)`

### isOnDiagonal

public static boolean isOnDiagonal(CoordGroup cgrp)
Indicates whether a given coordinate group represents a grid element that would appear on the diagonal of a matrix plot. This will return true if the coord group has one spatial coordinate, that is if it's histogram-like.

Parameters:
  `cgrp` - coord group
Returns:
  true for on-diagonal matrix plot element

### isOffDiagonal

public static boolean isOffDiagonal(CoordGroup cgrp)
Indicates whether a given coordinate group represents a grid element that would appear off the diagonal of a matrix plot. This will return true if the coord group has two spatial coordinates, that is if it's scatter-plot-like.

Parameters:
  `cgrp` - coord group, assumed to be the sort of coords that might show up in a matrix plot
Returns:
  true for off-diagonal matrix plot element