All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.refcodes.graphical.impls.FieldDimensionImpl Maven / Gradle / Ivy

Go to download

Artifact for graphical issues regarding RGB, pixel, fonts, and other stuff (utility).

There is a newer version: 3.3.9
Show newest version
// /////////////////////////////////////////////////////////////////////////////
// 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")
// -----------------------------------------------------------------------------
// 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.impls;

import org.refcodes.graphical.Dimension;
import org.refcodes.graphical.FieldDimension;

/**
 * @author steiner
 *
 */
public class FieldDimensionImpl implements FieldDimension {

	// /////////////////////////////////////////////////////////////////////////
	// STATICS:
	// /////////////////////////////////////////////////////////////////////////

	// /////////////////////////////////////////////////////////////////////////
	// CONSTANTS:
	// /////////////////////////////////////////////////////////////////////////

	// /////////////////////////////////////////////////////////////////////////
	// VARIABLES:
	// /////////////////////////////////////////////////////////////////////////

	protected int _fieldWidth;
	protected int _fieldHeight;
	protected int _fieldGap;

	// /////////////////////////////////////////////////////////////////////////
	// CONSTRUCTORS:
	// /////////////////////////////////////////////////////////////////////////

	protected FieldDimensionImpl() {}

	public FieldDimensionImpl( int aWidth, int aHeight, int aFieldGap ) {
		_fieldWidth = aWidth;
		_fieldHeight = aHeight;
		_fieldGap = aFieldGap;
	}

	// /////////////////////////////////////////////////////////////////////////
	// INJECTION:
	// /////////////////////////////////////////////////////////////////////////

	// /////////////////////////////////////////////////////////////////////////
	// METHODS:
	// /////////////////////////////////////////////////////////////////////////

	@Override
	public int getFieldWidth() {
		return _fieldWidth;
	}

	@Override
	public int getFieldHeight() {
		return _fieldHeight;
	}

	@Override
	public int getFieldGap() {
		return _fieldGap;
	}

	@Override
	public String toString() {
		return getClass().getSimpleName() + "(" + _fieldWidth + " x " + _fieldHeight + ", " + _fieldGap + ")@" + hashCode();
	}

	// /////////////////////////////////////////////////////////////////////////
	// HOOKS:
	// /////////////////////////////////////////////////////////////////////////

	// /////////////////////////////////////////////////////////////////////////
	// HELPER:
	// /////////////////////////////////////////////////////////////////////////

	// /////////////////////////////////////////////////////////////////////////
	// INNER CLASSES:
	// /////////////////////////////////////////////////////////////////////////

	public static class FieldDimensionPropertyBuilderImpl extends FieldDimensionImpl implements FieldDimensionPropertyBuilder {

		public FieldDimensionPropertyBuilderImpl() {
			super();
		}

		public FieldDimensionPropertyBuilderImpl( int aWidth, int aHeight, int aGap ) {
			super( aWidth, aHeight, aGap );
		}

		@Override
		public void setFieldWidth( int aWidth ) {
			_fieldWidth = aWidth;
		}

		@Override
		public FieldDimensionPropertyBuilderImpl withFieldWidth( int aWidth ) {
			_fieldWidth = aWidth;
			return this;
		}

		@Override
		public void setFieldHeight( int aHeight ) {
			_fieldHeight = aHeight;
		}

		@Override
		public FieldDimensionPropertyBuilderImpl withFieldHeight( int aHeight ) {
			_fieldHeight = aHeight;
			return this;
		}

		@Override
		public FieldDimensionPropertyBuilderImpl withFieldDimension( int aWidth, int aHeight ) {
			setFieldDimension( aWidth, aHeight );
			return this;
		}

		@Override
		public FieldDimensionPropertyBuilderImpl withFieldDimension( int aWidth, int aHeight, int aGap ) {
			setFieldDimension( aWidth, aHeight, aGap );
			return this;
		}

		@Override
		public FieldDimensionPropertyBuilderImpl withFieldDimension( FieldDimension aDimension ) {
			setFieldDimension( aDimension );
			return this;
		}

		@Override
		public void setFieldDimension( int aWidth, int aHeight ) {
			_fieldWidth = aWidth;
			_fieldHeight = aHeight;
		}

		@Override
		public void setFieldDimension( int aWidth, int aHeight, int aGap ) {
			_fieldWidth = aWidth;
			_fieldHeight = aHeight;
			_fieldGap = aGap;
		}

		@Override
		public void setFieldDimension( FieldDimension aDimension ) {
			_fieldWidth = aDimension.getFieldWidth();
			_fieldHeight = aDimension.getFieldHeight();
			_fieldGap = aDimension.getFieldGap();
		}

		@Override
		public FieldDimensionPropertyBuilderImpl withFieldDimension( Dimension aDimension ) {
			setFieldDimension( aDimension );
			return this;
		}

		@Override
		public void setFieldDimension( Dimension aDimension ) {
			_fieldWidth = aDimension.getWidth();
			_fieldHeight = aDimension.getHeight();
		}

		@Override
		public void setFieldGap( int aFieldGap ) {
			_fieldGap = aFieldGap;

		}

		@Override
		public FieldDimensionPropertyBuilderImpl withFieldGap( int aFieldGap ) {
			setFieldGap( aFieldGap );
			return this;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy