001/* *********************************************************************** *
002 * project: org.matsim.*
003 *                                                                         *
004 * *********************************************************************** *
005 *                                                                         *
006 * copyright       : (C) 2012 by the members listed in the COPYING,        *
007 *                   LICENSE and WARRANTY file.                            *
008 * email           : info at matsim dot org                                *
009 *                                                                         *
010 * *********************************************************************** *
011 *                                                                         *
012 *   This program is free software; you can redistribute it and/or modify  *
013 *   it under the terms of the GNU General Public License as published by  *
014 *   the Free Software Foundation; either version 2 of the License, or     *
015 *   (at your option) any later version.                                   *
016 *   See also COPYING, LICENSE and WARRANTY file                           *
017 *                                                                         *
018 * *********************************************************************** */
019package org.matsim.contrib.parking.parkingchoice.lib.obj.network;
020
021import org.matsim.api.core.v01.Coord;
022/**
023 * 
024 * @author rashid_waraich
025 *
026 * @param <T>
027 */
028public class EnclosingRectangle {
029
030        double minX = Double.MAX_VALUE;
031        double minY = Double.MAX_VALUE;
032        double maxX = Double.MIN_VALUE;
033        double maxY = Double.MIN_VALUE;
034        
035        public void registerCoord(Coord coord){
036                if (coord.getX() < minX) {
037                        minX = coord.getX();
038                }
039
040                if (coord.getY() < minY) {
041                        minY = coord.getY();
042                }
043
044                if (coord.getX() > maxX) {
045                        maxX = coord.getX();
046                }
047
048                if (coord.getY() > maxY) {
049                        maxY = coord.getY();
050                }
051        }
052
053        public double getMinX() {
054                return minX;
055        }
056
057        public double getMinY() {
058                return minY;
059        }
060
061        public double getMaxX() {
062                return maxX;
063        }
064
065        public double getMaxY() {
066                return maxY;
067        }
068        
069}