blob: 34a8a2145dcaee6547c197fefc1b0d367576da4d [file] [log] [blame]
/*=============================================================================#
# Copyright (c) 2013, 2021 Stephan Wahlbrink and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================*/
package org.eclipse.statet.ecommons.waltable.layer;
import org.eclipse.statet.ecommons.waltable.coordinate.Orientation;
/**
* Abstract implementation of layer dimension.
*
* @param <TLayer> the type of the layer
*/
public abstract class AbstractLayerDim<TLayer extends ILayer> implements ILayerDim {
protected final TLayer layer;
protected final Orientation orientation;
public AbstractLayerDim(/*@NonNull*/ final TLayer layer, /*@NonNull*/ final Orientation orientation) {
if (layer == null) {
throw new NullPointerException("layer"); //$NON-NLS-1$
}
if (orientation == null) {
throw new NullPointerException("orientation"); //$NON-NLS-1$
}
this.layer= layer;
this.orientation= orientation;
}
@Override
public ILayer getLayer() {
return this.layer;
}
@Override
public final Orientation getOrientation() {
return this.orientation;
}
@Override
public String toString() {
final StringBuilder sb= new StringBuilder("LayerDim"); //$NON-NLS-1$
sb.append(" ").append(this.orientation); //$NON-NLS-1$
sb.append(" of \n").append(this.layer); //$NON-NLS-1$
return sb.toString();
}
}