/*This code was generated using the UMPLE modeling language! Date of generation: 2008/07/29 15:15:39*/ /*This class drives: Point*/ package GIS.core; import java.util.*; import GIS.*; import GIS.json.*; public class CurveFeature extends Feature { //Class datatypes //Class association variables private List points; //Registry of our system. GISRegistry registry = GISRegistry.getInstance(); //Constructor public CurveFeature(String aName, Map aMap, FeatureType aFeatureType) { super(aName, aMap, aFeatureType); points = new ArrayList(); registry.add(points); } public List getPoints() { return points; } public Point addPoint() { Point newPoint; newPoint = new Point(); if (!points.contains(newPoint)) { registry.add(newPoint); points.add(newPoint); } return newPoint; } public Point addPoint(Point aPoint) { if (!points.contains(aPoint)) points.add(aPoint); return aPoint; } public void delete() { //Delete all many ends first. for (Point aPoint : points) { aPoint.delete(); } points.clear(); } public void deletePoint(Point aPoint) { if (points.contains(aPoint)) { points.remove(aPoint); //registry.removeObj(registry.getKey(aPoint)); } else //Throw an UmpleException .. to be implemented. { } } public boolean areManyEndsNull() { if (points.size() == 0) { return true; } else return false; } /*********************************** * Returns the attribute list along with the * class ID in JSON format. ***********************************/ public JSONObject getAttributes() throws JSONException { JSONObject obj = new JSONObject(); obj.put("CLASS_ID", registry.getKey(this)); return obj; } }