
org.refcodes.graphical.impls.ViewportOffsetImpl 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")
// -----------------------------------------------------------------------------
// 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.Offset;
import org.refcodes.graphical.Position;
import org.refcodes.graphical.ViewportOffset;
/**
* @author steiner
*
*/
public class ViewportOffsetImpl implements ViewportOffset {
// /////////////////////////////////////////////////////////////////////////
// STATICS:
// /////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// CONSTANTS:
// /////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// VARIABLES:
// /////////////////////////////////////////////////////////////////////////
protected int _offsetX;
protected int _offsetY;
// /////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS:
// /////////////////////////////////////////////////////////////////////////
protected ViewportOffsetImpl() {}
public ViewportOffsetImpl( int aOffsetX, int aOffsetY ) {
_offsetX = aOffsetX;
_offsetY = aOffsetY;
}
// /////////////////////////////////////////////////////////////////////////
// INJECTION:
// /////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// METHODS:
// /////////////////////////////////////////////////////////////////////////
@Override
public int getViewportOffsetX() {
return _offsetX;
}
@Override
public int getViewportOffsetY() {
return _offsetY;
}
@Override
public String toString() {
return getClass().getSimpleName() + "(" + _offsetX + " x " + _offsetY + ")@" + hashCode();
}
// /////////////////////////////////////////////////////////////////////////
// HOOKS:
// /////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// HELPER:
// /////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
// INNER CLASSES:
// /////////////////////////////////////////////////////////////////////////
public static class ViewportOffsetPropertyBuilderImpl extends ViewportOffsetImpl implements ViewportOffsetPropertyBuilder {
public ViewportOffsetPropertyBuilderImpl() {
super();
}
public ViewportOffsetPropertyBuilderImpl( int aOffsetX, int aOffsetY ) {
super( aOffsetX, aOffsetY );
}
@Override
public void setViewportOffsetX( int aOffsetX ) {
_offsetX = aOffsetX;
}
@Override
public ViewportOffsetPropertyBuilderImpl withViewportOffsetX( int aOffsetX ) {
_offsetX = aOffsetX;
return this;
}
@Override
public void setViewportOffsetY( int aOffsetY ) {
_offsetY = aOffsetY;
}
@Override
public ViewportOffsetPropertyBuilderImpl withViewportOffsetY( int aOffsetY ) {
_offsetY = aOffsetY;
return this;
}
@Override
public ViewportOffsetPropertyBuilderImpl withViewportOffset( int aOffsetX, int aOffsetY ) {
setViewportOffset( aOffsetX, aOffsetY );
return this;
}
@Override
public ViewportOffsetPropertyBuilderImpl withViewportOffset( ViewportOffset aOffset ) {
setViewportOffset( aOffset );
return this;
}
@Override
public void setViewportOffset( int aOffsetX, int aOffsetY ) {
_offsetX = aOffsetX;
_offsetY = aOffsetY;
}
@Override
public void setViewportOffset( ViewportOffset aOffset ) {
_offsetX = aOffset.getViewportOffsetX();
_offsetY = aOffset.getViewportOffsetY();
}
@Override
public ViewportOffsetPropertyBuilderImpl withViewportOffset( Offset aOffset ) {
setViewportOffset( aOffset.getOffsetX(), aOffset.getOffsetY() );
return this;
}
@Override
public void setViewportOffset( Offset aOffset ) {
_offsetX = aOffset.getOffsetX();
_offsetY = aOffset.getOffsetY();
}
@Override
public ViewportOffsetPropertyBuilderImpl withViewportOffset( Position aOffset ) {
setViewportOffset( aOffset );
return this;
}
@Override
public void setViewportOffset( Position aOffset ) {
_offsetX = aOffset.getPositionX();
_offsetY = aOffset.getPositionY();
}
}
}