
org.refcodes.graphical.BoxBorderMode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of refcodes-graphical Show documentation
Show all versions of refcodes-graphical Show documentation
Artifact for graphical issues regarding RGB, pixel, fonts, and other stuff (utility).
// /////////////////////////////////////////////////////////////////////////////
// REFCODES.ORG
// =============================================================================
// This code is copyright (c) by Siegfried Steiner, Munich, Germany and licensed
// under the following (see "http://en.wikipedia.org/wiki/Multi-licensing")
// licenses:
// =============================================================================
// GNU General Public License, v3.0 ("http://www.gnu.org/licenses/gpl-3.0.html")
// together with the GPL linking exception applied; as being applied by the GNU
// Classpath ("http://www.gnu.org/software/classpath/license.html")
// =============================================================================
// Apache License, v2.0 ("http://www.apache.org/licenses/LICENSE-2.0")
// =============================================================================
// Please contact the copyright holding author(s) of the software artifacts in
// question for licensing issues not being covered by the above listed licenses,
// also regarding commercial licensing models or regarding the compatibility
// with other open source licenses.
// /////////////////////////////////////////////////////////////////////////////
package org.refcodes.graphical;
/**
* The {@link BoxBorderMode} specifies for according algorithms on how a box is
* to be drawn.
*/
public enum BoxBorderMode {
// @formatter:off
NONE ( false, false, false, false),
LEFT ( false, false, false, true),
BOTTOM ( false, false, true, false),
BOTTOM_LEFT ( false, false, true, true),
RIGHT ( false, true, false, false),
RIGHT_LEFT ( false, true, false, true),
RIGHT_BOTTOM ( false, true, true, false),
RIGHT_BOTTOM_LEFT ( false, true, true, true),
TOP ( true, false, false, false),
TOP_LEFT ( true, false, false, true),
TOP_BOTTOM ( true, false, true, false),
TOP_BOTTOM_LEFT ( true, false, true, true),
TOP_RIGHT ( true, true, false, false),
TOP_RIGHT_LEFT ( true, true, false, true),
TOP_RIGHT_BOTTOM ( true, true, true, false),
TOP_RIGHT_BOTTOM_LEFT ( true, true, true, true),
ALL ( true, true, true, true);
// @formatter:on
private boolean _isLeftBorder;
private boolean _isTopBorder;
private boolean _isRightBorder;
private boolean _isBottomBorder;
public boolean isLeftBorder() {
return _isLeftBorder;
}
public boolean isTopBorder() {
return _isTopBorder;
}
public boolean isRightBorder() {
return _isRightBorder;
}
public boolean isBottomBorder() {
return _isBottomBorder;
}
private BoxBorderMode( boolean isTopBorder, boolean isRightBorder, boolean isBottomBorder, boolean isLeftBorder ) {
_isBottomBorder = isBottomBorder;
_isLeftBorder = isLeftBorder;
_isRightBorder = isRightBorder;
_isTopBorder = isTopBorder;
}
public static BoxBorderMode fromBoxBorders( boolean isTopBorder, boolean isRightBorder, boolean isBottomBorder, boolean isLeftBorder ) {
for ( BoxBorderMode eMode : values() ) {
if ( eMode.isTopBorder() == isTopBorder && eMode.isRightBorder() == isRightBorder && eMode.isBottomBorder() == isBottomBorder && eMode.isLeftBorder() == isLeftBorder ) return eMode;
}
throw new RuntimeException( "This code has a bug, it is missing the following enumeration element: Top := <" + isTopBorder + ">, right := <" + isRightBorder + ">, bottom := <" + isBottomBorder + ">, left := <" + isLeftBorder + ">" );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy