001/*
002// $Id: Size.java 3 2009-05-11 08:11:57Z jhyde $
003// Clapham generates railroad diagrams to represent computer language grammars.
004// Copyright (C) 2008-2009 Julian Hyde
005// Copyright (c) 2005 Stefan Schoergenhumer, Markus Dopler
006//
007// This program is free software; you can redistribute it and/or modify it
008// under the terms of the GNU General Public License as published by the Free
009// Software Foundation; either version 2 of the License, or (at your option)
010// any later version approved by The Eigenbase Project.
011//
012// This program is distributed in the hope that it will be useful,
013// but WITHOUT ANY WARRANTY; without even the implied warranty of
014// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015// GNU General Public License for more details.
016//
017// You should have received a copy of the GNU General Public License
018// along with this program; if not, write to the Free Software
019// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
020*/
021package net.hydromatic.clapham.graph;
022
023/**
024 * TODO:
025 *
026 * @author jhyde
027 * @version $Id: Size.java 3 2009-05-11 08:11:57Z jhyde $
028 * @since Jul 30, 2008
029 */
030public class Size {
031    private float width;
032    private float height;
033
034    public Size(float width, float height) {
035        this.width = width;
036        this.height = height;
037    }
038
039    public Size() {
040        this(0, 0);
041    }
042
043    public String toString() {
044        return width + "x" + height;
045    }
046
047    public void setHeight(float height) {
048        this.height = height;
049    }
050
051    public float getHeight() {
052        return height;
053    }
054
055    public float getWidth() {
056        return width;
057    }
058
059    public void setWidth(float width) {
060        this.width = width;
061    }
062
063    public void maxHeight(float height) {
064        if (height > this.height) {
065            this.height = height;
066        }
067    }
068
069    public void maxWidth(float width) {
070        if (width > this.width) {
071            this.width = width;
072        }
073    }
074
075    public void incWidth(float width) {
076        this.width += width;
077    }
078
079    public void incHeight(float height) {
080        this.height += height;
081    }
082}
083
084// End Size.java