//This file is part of SECONDO. //Copyright (C) 2004, University in Hagen, Department of Computer Science, //Database Systems for New Applications. //SECONDO is free software; you can redistribute it and/or modify //it under the terms of the GNU General Public License as published by //the Free Software Foundation; either version 2 of the License, or //(at your option) any later version. //SECONDO is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //GNU General Public License for more details. //You should have received a copy of the GNU General Public License //along with SECONDO; if not, write to the Free Software //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package fuzzyobjects.simple; import fuzzyobjects.basic.*; import sj.lang.ListExpr; /** * a class representing fuzzy elementary points * @author Thomas Behr */ public class fEPoint implements SimpleObject{ //simple Point /** * creates a new fEPoint * no check of vadility * @param BP the Point representing the location of this point * @param Z the fuzziness of this Point in (0,1] */ public fEPoint(BasicPoint BP, double Z){ this.BP = BP; this.Z = Z; } /** get the x value of this point */ public int getX(){ return BP.getX(); } /** get the y value of this point */ public int getY(){ return BP.getY(); } /** * creates a new FEPoint * no Check of vadility * @param x,y the location of this Point * @param Z the fuzziness of this point */ public fEPoint(int x, int y, double Z){ this.BP = new BasicPoint(x,y); this.Z = Z; } /** * returns a copy of this * @return a new fEPoint whith same location and * fuzziness as this */ public fEPoint copy() { return new fEPoint(BP.copy(),Z); } /** returns min X of the Bounding Box */ public int getMinX(){ return BP.getX(); } /** returns max X of the Bounding Box */ public int getMaxX(){ return BP.getX(); } /** return min Y of the Bounding Box */ public int getMinY(){ return BP.getY(); } /** return max Y of the Bounding Box */ public int getMaxY(){ return BP.getY(); } /** * returns a readable String of this Point * @return a String representing this Point */ public String toString() { return "SP : (" + BP +"," + Z +")"; } /** * check wether this is a valid fEPoint * @return true if location is valid and fuzziness is in (0,1] */ public boolean isValid() { return BP.isValid() && Z>0 && Z<=1; } /** * returns the fuzziness of this Point * @return the fuzziness of this Point */ public double getZ() { return Z; } /** * get the location of this Point * @returns the location of this point */ public BasicObject basic(){ return BP.copy(); } /** * check whether this is equal to SP * @param SP the Point to checked * @return true if this and SP have same location and fuzziness */ public boolean equal(fEPoint SP){ return BP.equals(SP.BP) && (Z==SP.Z); } /** * sorts a array of fEPoints * @param fEPs the array to sorted * @return the array sorted by basic */ public static void sort(fEPoint[] fEPs) { for (int i=0; i1) return false; BasicPoint P = new BasicPoint(x,y); if (!P.isValid()){ return false; } this.BP=P; this.Z = z; return true; } /** the location of this Point */ private BasicPoint BP; /** the fuzziness of this Point */ private double Z; // degree of membership } // class