Package uk.ac.starlink.ttools.plot2
Class Surround.Block
java.lang.Object
uk.ac.starlink.ttools.plot2.Surround.Block
- Enclosing class:
Surround
Represents the space taken along one side of a rectangle.
The extent is considered to be the distance perpendicular to the side
away from the rectangle, while the under/over values are
non-negative overhang distances in the negative/positive
directions parallel to the side.
The top block is represented by the following magnificent ASCII-art:
----------------------------------------------------------
| . ^ . |
| . | . |
|(--under--). extent .(--over--)|
| . | . |
|-----------. V .----------|
+++++++++++++++++++++++++++++++++++
++++++ Attached rectangle +++++++++
+++++++++++++++++++++++++++++++++++
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBlock()Constructs an empty block.Block(int extent) Constructs a block with an extent but no over or under.Block(int extent, int under, int over) Constructs a block with all members supplied.Block(Surround.Block other) Clone constructor. -
Method Summary
Modifier and TypeMethodDescriptionadd(Surround.Block other) Creates a block which is represents the sum of this and another.toString()union(Surround.Block other) Creates a block which represents the union of this and another.
-
Field Details
-
extent
public int extent -
under
public int under -
over
public int over
-
-
Constructor Details
-
Block
public Block()Constructs an empty block. -
Block
Clone constructor. A deep copy of the provided template is constructed.- Parameters:
other- template block
-
Block
public Block(int extent) Constructs a block with an extent but no over or under.- Parameters:
extent- extent
-
Block
public Block(int extent, int under, int over) Constructs a block with all members supplied.- Parameters:
extent- extent perpendicular to axisunder- non-negative overhang in negative direction parallel to axisover- non-negative overhang in positive direction parallel to axis
-
-
Method Details
-
add
Creates a block which is represents the sum of this and another. Extents are added, and the larger over/under values are used.- Parameters:
other- block to add to this one- Returns:
- new block
-
union
Creates a block which represents the union of this and another. For each of extent, under and over, the maximum values is used.- Parameters:
other- block to add to this one- Returns:
- new block
-
toString
-