/* * This file is part of the Wayback archival access software * (http://archive-access.sourceforge.net/projects/wayback/). * * Licensed to the Internet Archive (IA) by one or more individual * contributors. * * The IA licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.archive.wayback.util.graph; import java.awt.Rectangle; /** * A GraphElement which allows interrogation of it's bounding java.awt.Rectangle * @author brad * */ public abstract class RectangularGraphElement implements GraphElement { protected int x = 0; protected int y = 0; protected int width = 0; protected int height = 0; /** * Construct a new RectangularGraphElement with the supplied values * @param x the rectangles x in the global coordinate space * @param y the rectangles y in the global coordinate space * @param width the rectangles width * @param height the rectangles height */ public RectangularGraphElement(int x, int y, int width, int height) { this.x = x; this.y = y; this.width = width; this.height = height; } /** * @return the width */ public int getWidth() { return width; } /** * @return the height */ public int getHeight() { return height; } /** * @return the java.awt.Rectangle which bounds this GraphElement, in the * coordinate space of the Graph which contains it. */ public Rectangle getBoundingRectangle() { return new Rectangle(x, y, width, height); } }