public class TerminalSize extends Object
Modifier and Type | Field | Description |
---|---|---|
static TerminalSize |
ONE |
|
static TerminalSize |
ZERO |
Constructor | Description |
---|---|
TerminalSize(int columns,
int rows) |
Creates a new terminal size representation with a given width (columns) and height (rows)
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object obj) |
|
int |
getColumns() |
|
int |
getRows() |
|
int |
hashCode() |
|
TerminalSize |
max(TerminalSize other) |
Takes a different TerminalSize and returns a new TerminalSize that has the largest dimensions of the two,
measured separately.
|
TerminalSize |
min(TerminalSize other) |
Takes a different TerminalSize and returns a new TerminalSize that has the smallest dimensions of the two,
measured separately.
|
String |
toString() |
|
TerminalSize |
with(TerminalSize size) |
Returns itself if it is equal to the supplied size, otherwise the supplied size.
|
TerminalSize |
withColumns(int columns) |
Creates a new size based on this size, but with a different width
|
TerminalSize |
withRelative(int deltaColumns,
int deltaRows) |
Creates a new TerminalSize object representing a size based on this object's size but with a delta applied.
|
TerminalSize |
withRelative(TerminalSize delta) |
Creates a new TerminalSize object representing a size based on this object's size but with a delta applied.
|
TerminalSize |
withRelativeColumns(int delta) |
Creates a new TerminalSize object representing a size with the same number of rows, but with a column size offset by a
supplied value.
|
TerminalSize |
withRelativeRows(int delta) |
Creates a new TerminalSize object representing a size with the same number of columns, but with a row size offset by a
supplied value.
|
TerminalSize |
withRows(int rows) |
Creates a new size based on this size, but with a different height
|
public static final TerminalSize ZERO
public static final TerminalSize ONE
public TerminalSize(int columns, int rows)
columns
- Width, in number of columnsrows
- Height, in number of columnspublic int getColumns()
public TerminalSize withColumns(int columns)
columns
- Width of the new size, in columnspublic int getRows()
public TerminalSize withRows(int rows)
rows
- Height of the new size, in rowspublic TerminalSize withRelativeColumns(int delta)
delta
- Column offsetpublic TerminalSize withRelativeRows(int delta)
delta
- Row offsetpublic TerminalSize withRelative(TerminalSize delta)
withRelativeColumns(delta.getColumns()).withRelativeRows(delta.getRows())
delta
- Column and row offsetpublic TerminalSize withRelative(int deltaColumns, int deltaRows)
withRelativeColumns(deltaColumns).withRelativeRows(deltaRows)
deltaColumns
- How many extra columns the new TerminalSize will have (negative values are allowed)deltaRows
- How many extra rows the new TerminalSize will have (negative values are allowed)public TerminalSize max(TerminalSize other)
other
- Other TerminalSize to compare withpublic TerminalSize min(TerminalSize other)
other
- Other TerminalSize to compare withpublic TerminalSize with(TerminalSize size)
size
- Size you want to returnCopyright © 2020. All rights reserved.