[Polycasso-commit] SF.net SVN: polycasso:[50] trunk/polycasso/src/com/mebigfatguy/polycasso/ Improv
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2009-11-25 04:22:45
|
Revision: 50
http://polycasso.svn.sourceforge.net/polycasso/?rev=50&view=rev
Author: dbrosius
Date: 2009-11-25 04:22:39 +0000 (Wed, 25 Nov 2009)
Log Message:
-----------
javadoc
Modified Paths:
--------------
trunk/polycasso/src/com/mebigfatguy/polycasso/Improver.java
Modified: trunk/polycasso/src/com/mebigfatguy/polycasso/Improver.java
===================================================================
--- trunk/polycasso/src/com/mebigfatguy/polycasso/Improver.java 2009-11-25 04:18:33 UTC (rev 49)
+++ trunk/polycasso/src/com/mebigfatguy/polycasso/Improver.java 2009-11-25 04:22:39 UTC (rev 50)
@@ -27,6 +27,11 @@
import java.util.List;
import java.util.Random;
+/**
+ * a class that applies various improvement attempts to a polygon, attempts to prioritize
+ * which algorithms to pick based on what has worked in the past, as well as priorities which
+ * polygons have had success being transformed.
+ */
public class Improver {
public static final int NUM_POLYS = 50;
@@ -34,15 +39,30 @@
private List<PolygonData> polygons = null;
private Random r;
+ /**
+ * create an improver using a specified image size
+ *
+ * @param size the size of the image
+ */
public Improver(Dimension size) {
imageSize = size;
r = new Random();
}
+ /**
+ * sets the new set of polygons by copying them
+ *
+ * @param data the best set of polygon data so far
+ */
public void setData(PolygonData[] data) {
polygons = new LinkedList<PolygonData>(Arrays.<PolygonData>asList(data));
}
+ /**
+ * get the list of polygons usually after attempted to be improved
+ *
+ * @return the list of polygons
+ */
public List<PolygonData> getData() {
return polygons;
}
@@ -228,6 +248,9 @@
return type;
}
+ /**
+ * generates a random polygon change (all values)
+ */
private void randomCompleteChange() {
int idx = r.nextInt(polygons.size());
polygons.set(idx, PolygonData.randomPoly(imageSize));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|