for (int i = 0; i < c.length; i++) { c[i] = new Canopy(); }
Canopy[] canopy=new Canopy[5]; //Creates a 'storage' for 5 Canopy objects System.out.println(Canopy[0]); //Prints null and throws NPE if you execute method Canopy[0]=new Canopy(); //Create new Canopy object and insert it in the array System.out.println(Canopy[0]); //Not null anymore - you can execute methods Canopy[0].setCanopy("CAN123", "Model1", 500, 200, 500, 5, 15, 10, "Available"); // works fine
Vector p1 = ptIter.next(); ptIter.remove(); Canopy canopy = new Canopy(p1, nextCanopyId++, measure); canopies.add(canopy); while (ptIter.hasNext()) {
Vector p1 = ptIter.next(); ptIter.remove(); Canopy canopy = new Canopy(p1, nextCanopyId++, measure); canopies.add(canopy); while (ptIter.hasNext()) {
Vector p1 = ptIter.next(); ptIter.remove(); Canopy canopy = new Canopy(p1, nextCanopyId++, measure); canopies.add(canopy); while (ptIter.hasNext()) {
log.debug("Created new Canopy:{} at center:{}", nextCanopyId, AbstractCluster.formatVector(point, null)); canopies.add(new Canopy(point, nextCanopyId++, measure));
log.debug("Created new Canopy:{} at center:{}", nextCanopyId, AbstractCluster.formatVector(point, null)); canopies.add(new Canopy(point, nextCanopyId++, measure));
log.debug("Created new Canopy:{} at center:{}", nextCanopyId, AbstractCluster.formatVector(point, null)); canopies.add(new Canopy(point, nextCanopyId++, measure));