📄 categorylabelpositions.java
字号:
* Default constructor. */ public CategoryLabelPositions() { this.positionForAxisAtTop = new CategoryLabelPosition(); this.positionForAxisAtBottom = new CategoryLabelPosition(); this.positionForAxisAtLeft = new CategoryLabelPosition(); this.positionForAxisAtRight = new CategoryLabelPosition(); } /** * Creates a new position specification. * * @param top the label position info used when an axis is at the top (<code>null</code> * not permitted). * @param bottom the label position info used when an axis is at the bottom (<code>null</code> * not permitted). * @param left the label position info used when an axis is at the left (<code>null</code> * not permitted). * @param right the label position info used when an axis is at the right (<code>null</code> * not permitted). */ public CategoryLabelPositions(CategoryLabelPosition top, CategoryLabelPosition bottom, CategoryLabelPosition left, CategoryLabelPosition right) { if (top == null) { throw new IllegalArgumentException("Null 'top' argument."); } if (bottom == null) { throw new IllegalArgumentException("Null 'bottom' argument."); } if (left == null) { throw new IllegalArgumentException("Null 'left' argument."); } if (right == null) { throw new IllegalArgumentException("Null 'right' argument."); } this.positionForAxisAtTop = top; this.positionForAxisAtBottom = bottom; this.positionForAxisAtLeft = left; this.positionForAxisAtRight = right; } /** * Returns the category label position specification for an axis at the given location. * * @param edge the axis location. * * @return the category label position specification. */ public CategoryLabelPosition getLabelPosition(RectangleEdge edge) { CategoryLabelPosition result = null; if (edge == RectangleEdge.TOP) { result = this.positionForAxisAtTop; } else if (edge == RectangleEdge.BOTTOM) { result = this.positionForAxisAtBottom; } else if (edge == RectangleEdge.LEFT) { result = this.positionForAxisAtLeft; } else if (edge == RectangleEdge.RIGHT) { result = this.positionForAxisAtRight; } return result; } /** * Returns a new instance based on an existing instance but with the top position changed. * * @param base the base (<code>null</code> not permitted). * @param top the top position (<code>null</code> not permitted). * * @return a new instance (never <code>null</code>). */ public static CategoryLabelPositions replaceTopPosition(CategoryLabelPositions base, CategoryLabelPosition top) { if (base == null) { throw new IllegalArgumentException("Null 'base' argument."); } if (top == null) { throw new IllegalArgumentException("Null 'top' argument."); } return new CategoryLabelPositions( top, base.getLabelPosition(RectangleEdge.BOTTOM), base.getLabelPosition(RectangleEdge.LEFT), base.getLabelPosition(RectangleEdge.RIGHT) ); } /** * Returns a new instance based on an existing instance but with the bottom position changed. * * @param base the base (<code>null</code> not permitted). * @param bottom the bottom position (<code>null</code> not permitted). * * @return a new instance (never <code>null</code>). */ public static CategoryLabelPositions replaceBottomPosition(CategoryLabelPositions base, CategoryLabelPosition bottom) { if (base == null) { throw new IllegalArgumentException("Null 'base' argument."); } if (bottom == null) { throw new IllegalArgumentException("Null 'bottom' argument."); } return new CategoryLabelPositions( base.getLabelPosition(RectangleEdge.TOP), bottom, base.getLabelPosition(RectangleEdge.LEFT), base.getLabelPosition(RectangleEdge.RIGHT) ); } /** * Returns a new instance based on an existing instance but with the left position changed. * * @param base the base (<code>null</code> not permitted). * @param left the left position (<code>null</code> not permitted). * * @return a new instance (never <code>null</code>). */ public static CategoryLabelPositions replaceLeftPosition(CategoryLabelPositions base, CategoryLabelPosition left) { if (base == null) { throw new IllegalArgumentException("Null 'base' argument."); } if (left == null) { throw new IllegalArgumentException("Null 'left' argument."); } return new CategoryLabelPositions( base.getLabelPosition(RectangleEdge.TOP), base.getLabelPosition(RectangleEdge.BOTTOM), left, base.getLabelPosition(RectangleEdge.RIGHT) ); } /** * Returns a new instance based on an existing instance but with the right position changed. * * @param base the base (<code>null</code> not permitted). * @param right the right position (<code>null</code> not permitted). * * @return a new instance (never <code>null</code>). */ public static CategoryLabelPositions replaceRightPosition(CategoryLabelPositions base, CategoryLabelPosition right) { if (base == null) { throw new IllegalArgumentException("Null 'base' argument."); } if (right == null) { throw new IllegalArgumentException("Null 'right' argument."); } return new CategoryLabelPositions( base.getLabelPosition(RectangleEdge.TOP), base.getLabelPosition(RectangleEdge.BOTTOM), base.getLabelPosition(RectangleEdge.LEFT), right ); } /** * Returns <code>true</code> if this object is equal to the specified object, and * <code>false</code> otherwise. * * @param o the other object. * * @return a boolean. */ public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CategoryLabelPositions)) { return false; } final CategoryLabelPositions p = (CategoryLabelPositions) o; boolean b0 = this.positionForAxisAtTop.equals(p.positionForAxisAtTop); boolean b1 = this.positionForAxisAtBottom.equals(p.positionForAxisAtBottom); boolean b2 = this.positionForAxisAtLeft.equals(p.positionForAxisAtLeft); boolean b3 = this.positionForAxisAtRight.equals(p.positionForAxisAtRight); return b0 && b1 && b2 && b3; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -