if (en.kind() == Kind.AssignmentNode) {
AssignmentNode an = (AssignmentNode) en;
- String destName = an.getDest().printNode(0);
- if (destName.startsWith("this.")) {
- destName = destName.substring(5);
- }
+ boolean postinc = isPostIncAssignment(an);
- if (an.getSrc().getType().isNull() && destName.equals(needToNullify)) {
- needToNullify = null;
- return true;
+ if (!postinc) {
+ String destName = an.getDest().printNode(0);
+ if (destName.startsWith("this.")) {
+ destName = destName.substring(5);
+ }
+ if (an.getSrc().getType().isNull() && destName.equals(needToNullify)) {
+ needToNullify = null;
+ return true;
+ }
}
+
}
}
}
}
- private void checkAssignmentNode(MethodDescriptor md, SymbolTable nametable, AssignmentNode an) {
-
- boolean postinc = true;
+ public boolean isPostIncAssignment(AssignmentNode an) {
if (an.getOperation().getBaseOp() == null
|| (an.getOperation().getBaseOp().getOp() != Operation.POSTINC && an.getOperation()
- .getBaseOp().getOp() != Operation.POSTDEC))
- postinc = false;
+ .getBaseOp().getOp() != Operation.POSTDEC)) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ private void checkAssignmentNode(MethodDescriptor md, SymbolTable nametable, AssignmentNode an) {
+
+ boolean postinc = isPostIncAssignment(an);
if (!postinc) {
checkExpressionNode(md, nametable, an.getSrc());
}
prevAssignNode = node;
} else if (src.kind() == Kind.ArrayAccessNode) {
+ ArrayAccessNode aan = (ArrayAccessNode) src;
TypeDescriptor srcType = src.getType();
- if (srcType.isPtr() && !srcType.isString()) {
+ if (srcType.isPtr() && srcType.getArrayCount() > 0) {
throw new Error(
"Not allowed to create an alias to the middle of the multidimensional array at "
+ md.getClassDesc().getSourceFileName() + "::" + node.getNumLine());
+ } else {
+ needToNullify = aan.printNode(0);
+ prevAssignNode = node;
}
} else if (src.kind() == Kind.CreateObjectNode || src.kind() == Kind.MethodInvokeNode
|| src.kind() == Kind.ArrayInitializerNode || src.kind() == Kind.LiteralNode) {
}
private boolean isReference(TypeDescriptor td) {
- if (td.isPtr()) {
+ if (td.isPtr() && (!td.isString())) {
return true;
}
return false;
// debugPrint();
// }
parseLocationAnnotation();
- inference();
+ // inference();
doFlowDownCheck();
doDefinitelyWrittenCheck();
debugDoLoopCheck();
}
-
- private void inference(){
+
+ private void inference() {
SSJavaInferenceEngine inferEngine = new SSJavaInferenceEngine(this, state);
inferEngine.inference();
}
}
}
+
private void doLinearTypeCheck() {
LinearTypeCheck checker = new LinearTypeCheck(this, state);
checker.linearTypeCheck();
// sanity checks
if (locOrder.getThisLoc() != null && !locOrder.containsKey(locOrder.getThisLoc())) {
throw new Error("Variable 'this' location '" + locOrder.getThisLoc()
- + "' is not defined in the default local variable lattice at " + cd.getSourceFileName());
+ + "' is not defined in the local variable lattice at " + cd.getSourceFileName());
}
if (locOrder.getGlobalLoc() != null && !locOrder.containsKey(locOrder.getGlobalLoc())) {
throw new Error("Variable global location '" + locOrder.getGlobalLoc()
- + "' is not defined in the default local variable lattice at " + cd.getSourceFileName());
+ + "' is not defined in the local variable lattice at " + cd.getSourceFileName());
}
}
if (md2lattice.containsKey(md)) {
return md2lattice.get(md);
} else {
- return cd2methodDefault.get(md.getClassDesc());
+
+ if (cd2methodDefault.containsKey(md.getClassDesc())) {
+ return cd2methodDefault.get(md.getClassDesc());
+ } else {
+ throw new Error("Method Lattice of " + md + " is not defined.");
+ }
+
}
}
*
* @author Florian
*/
+@LATTICE("V")
+@METHODDEFAULT("OUT<V,V<THIS,THIS<C,C<IN,C*,V*,THISLOC=THIS,RETURNLOC=OUT")
public class Classifier {
+ @LOC("V")
private ScanArea[] scanAreas;
- // private float possibilityFace = 0f;
+ @LOC("V")
private float[] possibilities_FaceYes;
+ @LOC("V")
private float[] possibilities_FaceNo;
+ @LOC("V")
private int possibilityFaceYes = 0;
+ @LOC("V")
private int possibilityFaceNo = 0;
- public static final long serialVersionUID = 5168971806943656945l;
-
public Classifier(int numScanAreas) {
this.scanAreas = new ScanArea[numScanAreas];
this.possibilities_FaceYes = new float[numScanAreas];
scanAreas[idx] = area;
}
- public void setPossibilitiesFaceYes(float[] arr) {
+ public void setPossibilitiesFaceYes(@DELEGATE float[] arr) {
this.possibilities_FaceYes = arr;
}
this.possibilityFaceYes = v;
}
- public void setPossibilitiesFaceNo(float[] arr) {
+ public void setPossibilitiesFaceNo(@DELEGATE float[] arr) {
this.possibilities_FaceNo = arr;
}
this.possibilityFaceNo = v;
}
- // public void learn(IntegralImageData image, boolean isFace) {
- // long values[] = new long[this.scanAreas.length];
- // //
- // System.out.println("HERE:"+image.getIntegralAt(image.getDimension().width-1,
- // // image.getDimension().height-1));
- // // we assume the image is rectangular so we can simply use one side to
- // // calculate
- // // the scale factor
- // float scaleFactor = image.getDimension().width / 100.0f;
- //
- // float avg = 0f;
- // int avgItems = 0;
- // for (int i = 0; i < this.scanAreas.length; ++i) {
- // ScanArea scanArea = this.scanAreas[i];
- // values[i] = 0l;
- //
- // values[i] += image.getIntegralAt(scanArea.getToX(scaleFactor),
- // scanArea.getToY(scaleFactor));
- // values[i] +=
- // image.getIntegralAt(scanArea.getFromX(scaleFactor),
- // scanArea.getFromY(scaleFactor));
- //
- // values[i] -=
- // image.getIntegralAt(scanArea.getToX(scaleFactor),
- // scanArea.getFromY(scaleFactor));
- // values[i] -=
- // image.getIntegralAt(scanArea.getFromX(scaleFactor),
- // scanArea.getToY(scaleFactor));
- //
- // values[i] = (long) (values[i] / ((float) scanArea.getSize(scaleFactor)));
- // avg = ((avgItems * avg) + values[i]) / (++avgItems);
- // }
- //
- // if (isFace) {
- // this.possibilityFaceYes++;
- // } else {
- // this.possibilityFaceNo++;
- // }
- // for (int i = 0; i < this.scanAreas.length; ++i) {
- // boolean bright = (values[i] >= avg);
- //
- // if (isFace) {
- // // here we change the possibility of P(Scanarea_N = (Bright | NotBright)
- // // | Face=Yes)
- // this.possibilities_FaceYes[i] =
- // (((this.possibilityFaceYes - 1) * this.possibilities_FaceYes[i]) + (bright
- // ? 0.999f
- // : 0.001f)) / this.possibilityFaceYes;
- // //
- // System.out.println("P(Scannarea"+i+"=bright|Face=Yes) = "+this.possibilities_FaceYes[i]);
- // //
- // System.out.println("P(Scannarea"+i+"=dark|Face=Yes) = "+(1.0f-this.possibilities_FaceYes[i]));
- // } else {
- // // here we change the possibility of P(Scanarea_N = (Bright | NotBright)
- // // | Face=No)
- // this.possibilities_FaceNo[i] =
- // (((this.possibilityFaceNo - 1) * this.possibilities_FaceNo[i]) + (bright ?
- // 0.999f
- // : 0.001f)) / this.possibilityFaceNo;
- // //
- // System.out.println("P(Scannarea"+i+"=bright|Face=No) = "+this.possibilities_FaceNo[i]);
- // //
- // System.out.println("P(Scannarea"+i+"=dark|Face=No) = "+(1.0f-this.possibilities_FaceNo[i]));
- // }
- //
- // }
- //
- // // System.out.println("Average: "+avg);
- // // System.out.println(this);
- // }
-
/**
* Classifies an images region as face
*
* @param translationY
* @return true if this region was classified as face, else false
*/
- public boolean classifyFace(IntegralImageData image, float scaleFactor, int translationX,
- int translationY, float borderline) {
+ public boolean classifyFace(@LOC("IN") IntegralImageData image, @LOC("IN") float scaleFactor,
+ @LOC("IN") int translationX, @LOC("IN") int translationY, @LOC("IN") float borderline) {
- long values[] = new long[this.scanAreas.length];
+ @LOC("V") long values[] = new long[this.scanAreas.length];
- float avg = 0f;
- int avgItems = 0;
- for (int i = 0; i < this.scanAreas.length; ++i) {
- ScanArea scanArea = this.scanAreas[i];
- // System.out.println("scanarea="+scanArea);
+ @LOC("V") float avg = 0f;
+ @LOC("V") int avgItems = 0;
+ for (@LOC("C") int i = 0; i < this.scanAreas.length; ++i) {
values[i] = 0l;
values[i] +=
- image.getIntegralAt(translationX + scanArea.getToX(scaleFactor),
- translationY + scanArea.getToY(scaleFactor));
+ image.getIntegralAt(translationX + scanAreas[i].getToX(scaleFactor), translationY
+ + scanAreas[i].getToY(scaleFactor));
values[i] +=
- image.getIntegralAt(translationX + scanArea.getFromX(scaleFactor), translationY
- + scanArea.getFromY(scaleFactor));
+ image.getIntegralAt(translationX + scanAreas[i].getFromX(scaleFactor), translationY
+ + scanAreas[i].getFromY(scaleFactor));
values[i] -=
- image.getIntegralAt(translationX + scanArea.getToX(scaleFactor),
- translationY + scanArea.getFromY(scaleFactor));
+ image.getIntegralAt(translationX + scanAreas[i].getToX(scaleFactor), translationY
+ + scanAreas[i].getFromY(scaleFactor));
values[i] -=
- image.getIntegralAt(translationX + scanArea.getFromX(scaleFactor), translationY
- + scanArea.getToY(scaleFactor));
+ image.getIntegralAt(translationX + scanAreas[i].getFromX(scaleFactor), translationY
+ + scanAreas[i].getToY(scaleFactor));
- values[i] = (long) (values[i] / ((float) scanArea.getSize(scaleFactor)));
+ values[i] = (long) (values[i] / ((float) scanAreas[i].getSize(scaleFactor)));
avg = ((avgItems * avg) + values[i]) / (++avgItems);
}
-// System.out.println("avg=" + avg);
+ // System.out.println("avg=" + avg);
// int amountYesNo = this.possibilityFaceNo + this.possibilityFaceYes;
// as we just maximize the args we don't actually calculate the accurate
// possibility
- float isFaceYes = 1.0f;// this.possibilityFaceYes / (float)amountYesNo;
- float isFaceNo = 1.0f;// this.possibilityFaceNo / (float)amountYesNo;
+ @LOC("OUT") float isFaceYes = 1.0f;// this.possibilityFaceYes /
+ // (float)amountYesNo;
+ @LOC("OUT") float isFaceNo = 1.0f;// this.possibilityFaceNo /
+ // (float)amountYesNo;
- for (int i = 0; i < this.scanAreas.length; ++i) {
- boolean bright = (values[i] >= avg);
+ for (@LOC("C") int i = 0; i < this.scanAreas.length; ++i) {
+ @LOC("V") boolean bright = (values[i] >= avg);
isFaceYes *= (bright ? this.possibilities_FaceYes[i] : 1 - this.possibilities_FaceYes[i]);
isFaceNo *= (bright ? this.possibilities_FaceNo[i] : 1 - this.possibilities_FaceNo[i]);
}
-// System.out.println("avg=" + avg + " yes=" + isFaceYes + " no=" + isFaceNo);
+ // System.out.println("avg=" + avg + " yes=" + isFaceYes + " no=" +
+ // isFaceNo);
return (isFaceYes >= isFaceNo && (isFaceYes / (isFaceYes + isFaceNo)) > borderline);
}
public String toString() {
- String str = "";
- for (int i = 0; i < scanAreas.length; i++) {
+ @LOC("OUT") String str = "";
+ for (@LOC("C") int i = 0; i < scanAreas.length; i++) {
str += scanAreas[i].toString() + "\n";
}
return str;
}
- // @Override
- // public String toString() {
- // StringBuilder sb = new StringBuilder();
- // sb.append("Classifier [ScanAreas: " + this.scanAreas.length);
- // int yesNo = this.possibilityFaceYes + this.possibilityFaceNo;
- // sb.append(String.format("|Yes: %3.2f| No:%3.2f] (",
- // (this.possibilityFaceYes / (float) yesNo) * 100.0f,
- // (this.possibilityFaceNo / (float) yesNo) * 100.0f));
- // for (int i = 0; i < this.scanAreas.length; ++i) {
- // sb.append(String.format("[%3d|Yes: %3.2f| No: %3.2f], ", i + 1,
- // (this.possibilities_FaceYes[i] * 100.0f), (this.possibilities_FaceNo[i] *
- // 100.0f)));
- // }
- // sb.append(")");
- //
- // return sb.toString();
- // }
-
- /**
- * Generates a new set of classifiers each with more ScanAreas than the last
- * classifier. You can specifiy the amount of classifiers you want to generate
- *
- * @param amount
- * amount of classifiers to create
- * @param startAmountScanAreas
- * the start amount of scanAreas - if your first classifiers should
- * contain 3 items you should give 3 here
- * @param incAmountScanAreas
- * the amount of which the scanAreas should increase - a simple 2
- * will increase them by 2 every step
- * @return a List of classifiers
- */
- // public static List<Classifier> generateNewClassifiers(int amount, int
- // startAmountScanAreas,
- // float incAmountScanAreas) {
- // List<Classifier> classifiers = new ArrayList<Classifier>();
- //
- // int maxDim = 40;
- // Random random = new Random(System.currentTimeMillis());
- // double maxSpace = 2 * Math.PI * Math.pow(50, 2);
- //
- // for (int i = 0; i < amount; ++i) {
- // // we create an odd amount of ScanAreas starting with 1 (3, 5, 7, ...)
- // int scanAreaAmount = startAmountScanAreas + (int)
- // Math.pow(incAmountScanAreas, i);// +
- // // ((i)*incAmountScanAreas+1);
- //
- // int scanAreaSize =
- // randomInt(random, scanAreaAmount * 20, (int) Math.min(maxDim * maxDim,
- // maxSpace))
- // / scanAreaAmount;
- // // System.out.println("scanAreaSize = "+scanAreaSize);
- //
- // List<ScanArea> scanAreas = new ArrayList<ScanArea>();
- //
- // for (int j = 0; j < scanAreaAmount; ++j) {
- //
- // int counter = 0;
- // ScanArea scanArea = null;
- // do {
- // // new the width has the first choice
- // int minWidth = (int) Math.ceil(scanAreaSize / (float) maxDim);
- //
- // int scanAreaWidth = randomInt(random, minWidth, Math.min(maxDim,
- // scanAreaSize / 2));
- // int scanAreaHeight = (int) Math.ceil(scanAreaSize / (float) scanAreaWidth);
- //
- // int radius =
- // randomInt(random, 5, Math.min(50 - scanAreaHeight / 2, 50 - scanAreaWidth /
- // 2));
- // double angle = random.nextFloat() * 2 * Math.PI;
- //
- // int posX = (int) (50 + Math.cos(angle) * radius) - (scanAreaWidth / 2);
- // int posY = (int) (50 + Math.sin(angle) * radius) - (scanAreaHeight / 2);
- //
- // // System.out.println("[Angle: "+(angle /
- // // (Math.PI*2)*180)+" | radius: "+radius+"]");
- // //
- // System.out.println("Area"+j+" is "+posX+", "+posY+" ("+scanAreaWidth+" x "+scanAreaHeight+" = "+((scanAreaWidth*scanAreaHeight))+")");
- //
- // // now we get random position for this area
- // scanArea = new ScanArea(posX, posY, scanAreaWidth, scanAreaHeight);
- //
- // counter++;
- // } while (scanAreas.contains(scanArea) && counter < 30);
- //
- // if (counter == 30) {
- // j -= 1;
- // continue;
- // }
- //
- // scanAreas.add(scanArea);
- // }
- //
- // Classifier classifier = new Classifier(scanAreas.toArray(new ScanArea[0]));
- // classifiers.add(classifier);
- // }
- //
- // return classifiers;
- // }
-
- // private static int randomInt(Random random, int from, int to) {
- // if (to - from <= 0)
- // to = from + 1;
- // return from + random.nextInt(to - from);
- // }
- //
- // public static List<Classifier> getDefaultClassifier() {
- // List<Classifier> classifier = new ArrayList<Classifier>();
- //
- // classifier.add(new Classifier(new ScanArea(30, 30, 30, 30), new
- // ScanArea(15, 8, 15, 82),
- // new ScanArea(75, 8, 15, 82)));
- //
- // return classifier;
- // }
}
*
* @author Florian
*/
+@LATTICE("C")
+@METHODDEFAULT("OUT<THIS,THIS<IN,THISLOC=THIS,RETURNLOC=OUT")
public class ClassifierTree {
- private ArrayList classifiers;
+ @LOC("C")
+ private Classifier classifiers[];
- public ClassifierTree() {
- classifiers = new ArrayList();
+ public ClassifierTree(int size) {
+ classifiers = new Classifier[size];
}
- public void addClassifier(Classifier c) {
- classifiers.add(c);
+ public void addClassifier(@LOC("IN") int idx, @LOC("IN") Classifier c) {
+ classifiers[idx] = c;
}
- // public static BufferedImage resizeImageFittingInto(BufferedImage image, int
- // dimension) {
- //
- // int newHeight = 0;
- // int newWidth = 0;
- // float factor = 0;
- // if (image.getWidth() > image.getHeight()) {
- // factor = dimension / (float) image.getWidth();
- // newWidth = dimension;
- // newHeight = (int) (factor * image.getHeight());
- // } else {
- // factor = dimension / (float) image.getHeight();
- // newHeight = dimension;
- // newWidth = (int) (factor * image.getWidth());
- // }
- //
- // if (factor > 1) {
- // BufferedImageOp op = new
- // ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
- // BufferedImage tmpImage = op.filter(image, null);
- //
- // return tmpImage;
- // }
- //
- // BufferedImage resizedImage = new BufferedImage(newWidth, newHeight,
- // BufferedImage.TYPE_INT_RGB);
- //
- // Graphics2D g2D = resizedImage.createGraphics();
- // g2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
- // RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
- //
- // g2D.drawImage(image, 0, 0, newWidth - 1, newHeight - 1, 0, 0,
- // image.getWidth() - 1,
- // image.getHeight() - 1, null);
- //
- // BufferedImageOp op = new
- // ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
- // BufferedImage tmpImage = op.filter(resizedImage, null);
- //
- // return tmpImage;
- // }
- //
- // /**
- // * Image should have 100x100px and should be in b/w
- // *
- // * @param image
- // */
- // public void learn(BufferedImage image, boolean isFace) {
- // IntegralImageData imageData = new IntegralImageData(image);
- // for (Classifier classifier : this.classifiers) {
- // classifier.learn(imageData, isFace);
- // }
- // }
- //
- // public int getLearnedFacesYes() {
- // return this.classifiers.get(0).getLearnedFacesYes();
- // }
- //
- // public int getLearnedFacesNo() {
- // return this.classifiers.get(0).getLearnedFacesNo();
- // }
-
- /**
- * Locates a face by linear iteration through all probable face positions
- *
- * @deprecated use locateFaceRadial instead for improved performance
- * @param image
- * @return an rectangle representing the actual face position on success or
- * null if no face could be detected
- */
- // public Rectangle2D locateFace(BufferedImage image) {
- // long timeStart = System.currentTimeMillis();
- //
- // int resizeTo = 600;
- //
- // BufferedImage smallImage = resizeImageFittingInto(image, resizeTo);
- // IntegralImageData imageData = new IntegralImageData(smallImage);
- //
- // float factor = image.getWidth() / (float) smallImage.getWidth();
- //
- // int maxIterations = 0;
- //
- // // first we calculate the maximum scale factor for our 200x200 image
- // float maxScaleFactor = Math.min(imageData.getWidth() / 100f,
- // imageData.getHeight() / 100f);
- //
- // // we simply won't recognize faces that are smaller than 40x40 px
- // float minScaleFactor = 0.5f;
- //
- // // border for faceYes-possibility must be greater that that
- // float maxBorder = 0.999f;
- //
- // for (float scale = maxScaleFactor; scale > minScaleFactor; scale -= 0.25) {
- // int actualDimension = (int) (scale * 100);
- // int borderX = imageData.getWidth() - actualDimension;
- // int borderY = imageData.getHeight() - actualDimension;
- // for (int x = 0; x <= borderX; ++x) {
- // yLines: for (int y = 0; y <= borderY; ++y) {
- //
- // for (int iterations = 0; iterations < this.classifiers.size();
- // ++iterations) {
- // Classifier classifier = this.classifiers.get(iterations);
- //
- // float borderline =
- // 0.8f + (iterations / this.classifiers.size() - 1) * (maxBorder - 0.8f);
- // if (iterations > maxIterations)
- // maxIterations = iterations;
- // if (!classifier.classifyFace(imageData, scale, x, y, borderline)) {
- // continue yLines;
- // }
- // }
- //
- // // if we reach here we have a face recognized because our image went
- // // through all
- // // classifiers
- //
- // Rectangle2D faceRect =
- // new Rectangle2D.Float(x * factor, y * factor, actualDimension * factor,
- // actualDimension * factor);
- //
- // System.out.println("Time: " + (System.currentTimeMillis() - timeStart) +
- // "ms");
- // return faceRect;
- //
- // }
- // }
- // }
- //
- // return null;
- // }
-
/**
* Locates a face by searching radial starting at the last known position. If
* lastCoordinates are null we simply start in the center of the image.
* @return an rectangle representing the actual face position on success or
* null if no face could be detected
*/
+ @LATTICE("OUT,THIS<CXY,CXY<V,V<IMG,IMG<C,C<IN,C*,FACTOR*,CXY*,THISLOC=THIS,RETURNLOC=OUT")
+ public Rectangle2D locateFaceRadial(@LOC("IN") Image smallImage,
+ @LOC("C") Rectangle2D lastCoordinates) {
- public Rectangle2D locateFaceRadial(Image smallImage, Rectangle2D lastCoordinates) {
-
- IntegralImageData imageData = new IntegralImageData(smallImage);
- float originalImageFactor = 1;
+ @LOC("IMG") IntegralImageData imageData = new IntegralImageData(smallImage);
+ @LOC("IN") float originalImageFactor = 1;
if (lastCoordinates == null) {
// if we don't have a last coordinate we just begin in the center
- int smallImageMaxDimension = Math.min(smallImage.getWidth(), smallImage.getHeight());
+ @LOC("C") int smallImageMaxDimension =
+ Math.min(smallImage.getWidth(), smallImage.getHeight());
lastCoordinates =
new Rectangle2D((smallImage.getWidth() - smallImageMaxDimension) / 2.0,
(smallImage.getHeight() - smallImageMaxDimension) / 2.0, smallImageMaxDimension,
smallImageMaxDimension);
-// System.out.println("lastCoordinates=" + lastCoordinates);
+ // System.out.println("lastCoordinates=" + lastCoordinates);
} else {
// first we have to scale the last coodinates back relative to the resized
// image
(lastCoordinates.getHeight() * (1 / originalImageFactor)));
}
- float startFactor = (float) (lastCoordinates.getWidth() / 100.0f);
+ @LOC("V") float startFactor = (float) (lastCoordinates.getWidth() / 100.0f);
// first we calculate the maximum scale factor for our 200x200 image
- float maxScaleFactor = Math.min(imageData.getWidth() / 100f, imageData.getHeight() / 100f);
+ @LOC("V") float maxScaleFactor =
+ Math.min(imageData.getWidth() / 100f, imageData.getHeight() / 100f);
// maxScaleFactor = 1.0f;
// we simply won't recognize faces that are smaller than 40x40 px
- float minScaleFactor = 0.5f;
+ @LOC("V") float minScaleFactor = 0.5f;
- float maxScaleDifference =
+ @LOC("V") float maxScaleDifference =
Math.max(Math.abs(maxScaleFactor - startFactor), Math.abs(minScaleFactor - startFactor));
// border for faceYes-possibility must be greater that that
- float maxBorder = 0.999f;
+ @LOC("V") float maxBorder = 0.999f;
- int startPosX = (int) lastCoordinates.getX();
- int startPosY = (int) lastCoordinates.getX();
+ @LOC("V") int startPosX = (int) lastCoordinates.getX();
+ @LOC("V") int startPosY = (int) lastCoordinates.getX();
- for (float factorDiff = 0.0f; Math.abs(factorDiff) <= maxScaleDifference; factorDiff =
+ for (@LOC("C") float factorDiff = 0.0f; Math.abs(factorDiff) <= maxScaleDifference; factorDiff =
(factorDiff + sgn(factorDiff) * 0.1f) * -1 // we alternate between
// negative and positiv
// factors
) {
- float factor = startFactor + factorDiff;
-// System.out.println("factor=" + factor);
+ @LOC("V") float factor = startFactor + factorDiff;
+ // System.out.println("factor=" + factor);
if (factor > maxScaleFactor || factor < minScaleFactor)
continue;
// now we calculate the actualDimmension
- int actualDimmension = (int) (100 * factor);
- int maxX = imageData.getWidth() - actualDimmension;
- int maxY = imageData.getHeight() - actualDimmension;
+ @LOC("V") int actualDimmension = (int) (100 * factor);
+ @LOC("V") int maxX = imageData.getWidth() - actualDimmension;
+ @LOC("V") int maxY = imageData.getHeight() - actualDimmension;
- int maxDiffX = Math.max(Math.abs(startPosX - maxX), startPosX);
- int maxDiffY = Math.max(Math.abs(startPosY - maxY), startPosY);
+ @LOC("V") int maxDiffX = Math.max(Math.abs(startPosX - maxX), startPosX);
+ @LOC("V") int maxDiffY = Math.max(Math.abs(startPosY - maxY), startPosY);
- for (float xDiff = 0.1f; Math.abs(xDiff) <= maxDiffX; xDiff =
+ for (@LOC("CXY") float xDiff = 0.1f; Math.abs(xDiff) <= maxDiffX; xDiff =
(xDiff + sgn(xDiff) * 0.5f) * -1) {
- int xPos = Math.round((float) (startPosX + xDiff));
+ @LOC("CXY") int xPos = Math.round((float) (startPosX + xDiff));
if (xPos < 0 || xPos > maxX)
continue;
// yLines:
- for (float yDiff = 0.1f; Math.abs(yDiff) <= maxDiffY; yDiff =
+ for (@LOC("CXY") float yDiff = 0.1f; Math.abs(yDiff) <= maxDiffY; yDiff =
(yDiff + sgn(yDiff) * 0.5f) * -1) {
- int yPos = Math.round(startPosY + yDiff);
+ @LOC("CXY") int yPos = Math.round(startPosY + yDiff);
if (yPos < 0 || yPos > maxY)
continue;
// by now we should have a valid coordinate to process which we should
// do now
- boolean backToYLines = false;
- for (int iterations = 0; iterations < classifiers.size(); ++iterations) {
- Classifier classifier = (Classifier) classifiers.get(iterations);
-
- float borderline = 0.8f + (iterations / (classifiers.size() - 1)) * (maxBorder - 0.8f);
- if (!classifier.classifyFace(imageData, factor, xPos, yPos, borderline)) {
-// System.out.println("continue yLines; ");
+ @LOC("CXY") boolean backToYLines = false;
+ for (@LOC("CXY") int idx = 0; idx < classifiers.length; ++idx) {
+ @LOC("CXY") float borderline =
+ 0.8f + (idx / (classifiers.length - 1)) * (maxBorder - 0.8f);
+ if (!classifiers[idx].classifyFace(imageData, factor, xPos, yPos, borderline)) {
backToYLines = true;
break;
- // continue yLines;
+ // continue yLines;
}
}
-
// if we reach here we have a face recognized because our image went
// through all
// classifiers
if (backToYLines) {
continue;
}
- Rectangle2D faceRect =
+ @LOC("OUT") Rectangle2D faceRect =
new Rectangle2D(xPos * originalImageFactor, yPos * originalImageFactor,
actualDimmension * originalImageFactor, actualDimmension * originalImageFactor);
}
- // public Rectangle2D locateFaceRadial(BufferedImage image, Rectangle2D
- // lastCoordinates) {
- //
- // int resizeTo = 600;
- //
- // BufferedImage smallImage = resizeImageFittingInto(image, resizeTo);
- // float originalImageFactor = image.getWidth() / (float)
- // smallImage.getWidth();
- // IntegralImageData imageData = new IntegralImageData(smallImage);
- //
- // if (lastCoordinates == null) {
- // // if we don't have a last coordinate we just begin in the center
- // int smallImageMaxDimension = Math.min(smallImage.getWidth(),
- // smallImage.getHeight());
- // lastCoordinates =
- // new Rectangle2D.Float((smallImage.getWidth() - smallImageMaxDimension) /
- // 2.0f,
- // (smallImage.getHeight() - smallImageMaxDimension) / 2.0f,
- // smallImageMaxDimension,
- // smallImageMaxDimension);
- // } else {
- // // first we have to scale the last coodinates back relative to the resized
- // // image
- // lastCoordinates =
- // new Rectangle2D.Float((float) (lastCoordinates.getX() * (1 /
- // originalImageFactor)),
- // (float) (lastCoordinates.getY() * (1 / originalImageFactor)),
- // (float) (lastCoordinates.getWidth() * (1 / originalImageFactor)),
- // (float) (lastCoordinates.getHeight() * (1 / originalImageFactor)));
- // }
- //
- // float startFactor = (float) (lastCoordinates.getWidth() / 100.0f);
- //
- // // first we calculate the maximum scale factor for our 200x200 image
- // float maxScaleFactor = Math.min(imageData.getWidth() / 100f,
- // imageData.getHeight() / 100f);
- // // maxScaleFactor = 1.0f;
- //
- // // we simply won't recognize faces that are smaller than 40x40 px
- // float minScaleFactor = 0.5f;
- //
- // float maxScaleDifference =
- // Math.max(Math.abs(maxScaleFactor - startFactor), Math.abs(minScaleFactor -
- // startFactor));
- //
- // // border for faceYes-possibility must be greater that that
- // float maxBorder = 0.999f;
- //
- // int startPosX = (int) lastCoordinates.getX();
- // int startPosY = (int) lastCoordinates.getX();
- //
- // for (float factorDiff = 0.0f; Math.abs(factorDiff) <= maxScaleDifference;
- // factorDiff =
- // (factorDiff + sgn(factorDiff) * 0.1f) * -1 // we alternate between
- // // negative and positiv
- // // factors
- // ) {
- //
- // float factor = startFactor + factorDiff;
- // if (factor > maxScaleFactor || factor < minScaleFactor)
- // continue;
- //
- // // now we calculate the actualDimmension
- // int actualDimmension = (int) (100 * factor);
- // int maxX = imageData.getWidth() - actualDimmension;
- // int maxY = imageData.getHeight() - actualDimmension;
- //
- // int maxDiffX = Math.max(Math.abs(startPosX - maxX), startPosX);
- // int maxDiffY = Math.max(Math.abs(startPosY - maxY), startPosY);
- //
- // for (float xDiff = 0.1f; Math.abs(xDiff) <= maxDiffX; xDiff =
- // (xDiff + sgn(xDiff) * 0.5f) * -1) {
- // int xPos = Math.round(startPosX + xDiff);
- // if (xPos < 0 || xPos > maxX)
- // continue;
- //
- // yLines: for (float yDiff = 0.1f; Math.abs(yDiff) <= maxDiffY; yDiff =
- // (yDiff + sgn(yDiff) * 0.5f) * -1) {
- // int yPos = Math.round(startPosY + yDiff);
- // if (yPos < 0 || yPos > maxY)
- // continue;
- //
- // // by now we should have a valid coordinate to process which we should
- // // do now
- // for (int iterations = 0; iterations < this.classifiers.size();
- // ++iterations) {
- // Classifier classifier = this.classifiers.get(iterations);
- //
- // float borderline =
- // 0.8f + (iterations / (this.classifiers.size() - 1)) * (maxBorder - 0.8f);
- //
- // if (!classifier.classifyFace(imageData, factor, xPos, yPos, borderline)) {
- // continue yLines;
- // }
- // }
- //
- // // if we reach here we have a face recognized because our image went
- // // through all
- // // classifiers
- //
- // Rectangle2D faceRect =
- // new Rectangle2D.Float(xPos * originalImageFactor, yPos *
- // originalImageFactor,
- // actualDimmension * originalImageFactor, actualDimmension *
- // originalImageFactor);
- //
- // return faceRect;
- //
- // }
- //
- // }
- //
- // }
- //
- // //
- // System.out.println("Time: "+(System.currentTimeMillis()-timeStart)+"ms");
- // return null;
- //
- // }
-
- // public List<Classifier> getClassifiers() {
- // return new ArrayList<Classifier>(this.classifiers);
- // }
- //
- // public static void saveToXml(OutputStream out, ClassifierTree tree) throws
- // IOException {
- // PrintWriter writer = new PrintWriter(new OutputStreamWriter(out, "UTF-8"));
- // writer.write(xStream.toXML(tree));
- // writer.close();
- // }
- //
- // public static ClassifierTree loadFromXml(InputStream in) throws IOException
- // {
- // Reader reader = new InputStreamReader(in, "UTF-8");
- // StringBuilder sb = new StringBuilder();
- //
- // char[] buffer = new char[1024];
- // int read = 0;
- // do {
- // read = reader.read(buffer);
- // if (read > 0) {
- // sb.append(buffer, 0, read);
- // }
- // } while (read > -1);
- // reader.close();
- //
- // return (ClassifierTree) xStream.fromXML(sb.toString());
- // }
-
- private static int sgn(float value) {
+ private static int sgn(@LOC("IN") float value) {
return (value < 0 ? -1 : (value > 0 ? +1 : 1));
}
+++ /dev/null
-import Analysis.SSJava.Location;
-
-/*
- * Copyright 2009 (c) Florian Frankenberger (darkblue.de)
- *
- * This file is part of LEA.
- *
- * LEA is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
- *
- * LEA 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 Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with LEA. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * Representing an eyes deviation
- *
- * @author Florian Frankenberger
- */
-public class Deviation {
-
- int directionX, directionY;
- String direction;
-
- public Deviation(String direction, int directionX, int directionY) {
- this.directionX = directionX;
- this.directionY = directionY;
- this.direction = direction;
- }
-
- public boolean concurs(int directionX, int directionY) {
- return (directionX == this.directionX && directionY == this.directionY);
- }
-
- public boolean equals(Object o) {
- if (!(o instanceof Deviation)) {
- return false;
- }
-
- Deviation dev = (Deviation) o;
- if (dev.directionX == directionX && dev.directionY == directionY) {
- return true;
- }
-
- return false;
- }
-
- public String toString() {
- return direction;
- }
-
-}
* \r
* @author Florian Frankenberger\r
*/\r
+@LATTICE("SIZE<POS,SIZE*")\r
+@METHODDEFAULT("OUT<THIS,THIS<IN,THISLOC=THIS,RETURNLOC=OUT")\r
public class DeviationScanner {\r
\r
+ @LOC("POS")\r
private EyePosition eyePositions[];\r
\r
// LEFT_UP(+1, -1), UP(0, -1), RIGHT_UP(-1, -1), LEFT(+1, 0), NONE(0, 0),\r
// RIGHT(-1, 0), LEFT_DOWN(\r
// +1, +1), DOWN(0, +1), RIGHT_DOWN(-1, +1);\r
\r
- private static final Deviation LEFT_UP = new Deviation("LEFT_UP", +1, -1);\r
- private static final Deviation UP = new Deviation("UP", 0, -1);\r
- private static final Deviation RIGHT_UP = new Deviation("RIGHT_UP", -1, -1);\r
- private static final Deviation LEFT = new Deviation("LEFT", +1, 0);\r
- private static final Deviation NONE = new Deviation("NONE", 0, 0);\r
- private static final Deviation RIGHT = new Deviation("RIGHT", -1, 0);\r
- private static final Deviation LEFT_DOWN = new Deviation("LEFT_DOWN", +1, +1);\r
- private static final Deviation DOWN = new Deviation("DOWN", 0, +1);\r
- private static final Deviation RIGHT_DOWN = new Deviation("RIGHT_DOWN", -1, +1);\r
-\r
+ public static final int LEFT_UP = 0;\r
+ public static final int UP = 1;\r
+ public static final int RIGHT_UP = 2;\r
+ public static final int LEFT = 3;\r
+ public static final int NONE = 4;\r
+ public static final int RIGHT = 5;\r
+ public static final int LEFT_DOWN = 6;\r
+ public static final int DOWN = 7;\r
+ public static final int RIGHT_DOWN = 8;\r
+\r
+ @LOC("SIZE")\r
private int size;\r
\r
public DeviationScanner() {\r
size = 0;\r
}\r
\r
- public void addEyePosition(EyePosition eyePosition) {\r
+ @LATTICE("THIS<C,C<IN,THISLOC=THIS")\r
+ public void addEyePosition(@LOC("IN") EyePosition eyePosition) {\r
\r
- for (int i = 1; i < eyePositions.length; i++) {\r
+ for (@LOC("C") int i = 1; i < eyePositions.length; i++) {\r
eyePositions[i - 1] = eyePositions[i];\r
+ eyePositions[i] = null;\r
}\r
eyePositions[eyePositions.length - 1] = eyePosition;\r
\r
return size;\r
}\r
\r
- public Deviation scanForDeviation(Rectangle2D faceRect) {\r
- Deviation deviation = NONE;\r
+ @LATTICE("OUT<DEV,DEV<THIS,THIS<C,C<IN,C*,DEV*,OUT*,THISLOC=THIS,RETURNLOC=OUT")\r
+ public int scanForDeviation(@LOC("IN") Rectangle2D faceRect) {\r
+ @LOC("OUT") int deviation = NONE;\r
if (getEyePositionsSize() >= 3) {\r
- double deviationX = 0;\r
- double deviationY = 0;\r
-\r
- EyePosition lastEyePosition = null;\r
- for (int i = 0; i < 3; ++i) {\r
- EyePosition eyePosition = this.eyePositions[i];\r
- if (lastEyePosition != null) {\r
- deviationX += (eyePosition.getX() - lastEyePosition.getX());\r
- deviationY += (eyePosition.getY() - lastEyePosition.getY());\r
+ @LOC("DEV") double deviationX = 0;\r
+ @LOC("DEV") double deviationY = 0;\r
+\r
+ @LOC("DEV") int lastIdx = -1;\r
+ for (@LOC("C") int i = 0; i < 3; ++i) {\r
+ if (lastIdx != -1) {\r
+ deviationX += (eyePositions[i].getX() - eyePositions[lastIdx].getX());\r
+ deviationY += (eyePositions[i].getY() - eyePositions[lastIdx].getY());\r
}\r
- lastEyePosition = eyePosition;\r
+ lastIdx = i;\r
}\r
\r
- final double deviationPercentX = 0.04;\r
- final double deviationPercentY = 0.04;\r
+ @LOC("DEV") final double deviationPercentX = 0.04;\r
+ @LOC("DEV") final double deviationPercentY = 0.04;\r
\r
deviationX /= faceRect.getWidth();\r
deviationY /= faceRect.getWidth();\r
\r
- int deviationAbsoluteX = 0;\r
- int deviationAbsoluteY = 0;\r
+ @LOC("DEV") int deviationAbsoluteX = 0;\r
+ @LOC("DEV") int deviationAbsoluteY = 0;\r
if (deviationX > deviationPercentX)\r
deviationAbsoluteX = 1;\r
if (deviationX < -deviationPercentX)\r
return deviation;\r
}\r
\r
- public static Deviation getDirectionFor(int directionX, int directionY) {\r
+ public int getDirectionFor(@LOC("IN") int directionX, @LOC("IN") int directionY) {\r
\r
- if (LEFT_UP.concurs(directionX, directionY)) {\r
+ if (directionX == +1 && directionY == -1) {\r
return LEFT_UP;\r
- } else if (UP.concurs(directionX, directionY)) {\r
+ } else if (directionX == 0 && directionY == -1) {\r
return UP;\r
- } else if (RIGHT_UP.concurs(directionX, directionY)) {\r
+ } else if (directionX == -1 && directionY == -1) {\r
return RIGHT_UP;\r
- } else if (LEFT.concurs(directionX, directionY)) {\r
+ } else if (directionX == +1 && directionY == 0) {\r
return LEFT;\r
- } else if (NONE.concurs(directionX, directionY)) {\r
+ } else if (directionX == 0 && directionY == 0) {\r
return NONE;\r
- } else if (RIGHT.concurs(directionX, directionY)) {\r
+ } else if (directionX == -1 && directionY == 0) {\r
return RIGHT;\r
- } else if (LEFT_DOWN.concurs(directionX, directionY)) {\r
+ } else if (directionX == +1 && directionY == +1) {\r
return LEFT_DOWN;\r
- } else if (DOWN.concurs(directionX, directionY)) {\r
+ } else if (directionX == 0 && directionY == +1) {\r
return DOWN;\r
- } else if (RIGHT_DOWN.concurs(directionX, directionY)) {\r
+ } else if (directionX == -1 && directionY == +1) {\r
return RIGHT_DOWN;\r
}\r
- return null;\r
+\r
+ return -1;\r
}\r
\r
public void clear() {\r
size = 0;\r
}\r
\r
+ public String toStringDeviation(@LOC("IN") int dev) {\r
+ if (dev == LEFT_UP) {\r
+ return "LEFT_UP";\r
+ } else if (dev == UP) {\r
+ return "UP";\r
+ } else if (dev == RIGHT_UP) {\r
+ return "RIGHT_UP";\r
+ } else if (dev == LEFT) {\r
+ return "LEFT";\r
+ } else if (dev == NONE) {\r
+ return "NONE";\r
+ } else if (dev == RIGHT) {\r
+ return "RIGHT";\r
+ } else if (dev == LEFT_DOWN) {\r
+ return "LEFT_DOWN";\r
+ } else if (dev == DOWN) {\r
+ return "DOWN";\r
+ } else if (dev == RIGHT_DOWN) {\r
+ return "RIGHT_DOWN";\r
+ }\r
+ return "ERROR";\r
+ }\r
+\r
}\r
+++ /dev/null
-/*
- * Copyright 2009 (c) Florian Frankenberger (darkblue.de)
- *
- * This file is part of LEA.
- *
- * LEA is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
- *
- * LEA 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 Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with LEA. If not, see <http://www.gnu.org/licenses/>.
- */
-
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.Rectangle2D;
-import java.awt.image.BufferedImage;
-
-/**
- *
- * @author Florian
- */
-class EyeInfoPanel extends InfoPanel {
-
- private static final long serialVersionUID = 7681992432092759058L;
-
- public EyeInfoPanel() {
- super("Eye Status", new String[] { "nolock.png" }, 0, 100, 40);
- }
-
- public void setDeviation(Deviation deviation) {
- if (deviation == null) {
- this.setImage(null);
- } else {
- this.setImage(loadImage(deviation.toString() + ".png"));
- }
- }
-
- public void setEyePosition(BufferedImage image, Rectangle2D faceRect, EyePosition eyePosition) {
-
- BufferedImage faceRectImage = null;
- if (image != null && faceRect != null) {
- int width = 100;
- int height = 40;
-
- int posX = (int) (faceRect.getX() + eyePosition.getX());
- int posY = (int) (faceRect.getY() + eyePosition.getY());
-
- int targetWidth = (int) (0.3 * faceRect.getWidth());
- int targetHeight = (int) (height / (float) width * targetWidth);
-
- faceRectImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
-
- Graphics2D g2D = faceRectImage.createGraphics();
- g2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
- RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
-
- g2D.drawImage(image, 0, 0, width, height, posX - targetWidth / 2, posY - targetHeight / 2,
- posX + targetWidth / 2, posY + targetHeight / 2, null);
-
- }
- this.setImage(faceRectImage);
- }
-
-}
+++ /dev/null
-/*
- * Copyright 2009 (c) Florian Frankenberger (darkblue.de)
- *
- * This file is part of LEA.
- *
- * LEA is free software: you can redistribute it and/or modify it under the
- * terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation, either version 3 of the License, or (at your option) any
- * later version.
- *
- * LEA 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 Lesser General Public License for more
- * details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with LEA. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-import de.darkblue.lea.model.Deviation;
-
-/**
- * Implementations of eye movements and face detections should
- * look like this.
- * s
- * @author Florian Frankenberger
- */
-public interface IEyeMovementListener {
-
- /**
- * Is called whenever a face has been detected. Only
- * if a face was detected <code>onEyeMoved</code> will be
- * called (no face = no eye movement)
- */
- public void onFaceDetected();
-
- /**
- * If the face was lost this method is being called
- */
- public void onFaceLost();
-
- /**
- * Gets called whenever an eye movement has been recognized
- *
- * @param deviation the calculated deviation
- */
- public void onEyeMoved(Deviation deviation);
-
-}
--- /dev/null
+public @interface LATTICE {
+ String value();
+}
private DeviationScanner deviationScanner = new DeviationScanner();
private int counter = 0;
- // private ImageProcessor imageProcessor;
- //
- // private class ImageProcessor extends TimedThread {
- //
- // private FaceAndEyePosition lastPositions = new FaceAndEyePosition(null,
- // null);
- // private DeviationScanner deviationScanner = new DeviationScanner();
- // private int counter = 0;
- //
- // private int fps;
- //
- // public ImageProcessor(int fps) {
- // super(fps);
- // this.fps = fps;
- // }
- //
- // @Override
- // public void doRun() {
- //
- // BufferedImage image = captureDevice.getImage();
- // if (image == null)
- // return;
- //
- // try {
- // FaceAndEyePosition positions = implementation.getEyePosition(image);
- //
- // if (((lastPositions.getFacePosition() == null &&
- // positions.getFacePosition() != null) || (lastPositions
- // .getFacePosition() != null && positions.getFacePosition() == null)) ||
- // counter++ > fps) {
- //
- // if ((lastPositions.getFacePosition() == null && positions.getFacePosition()
- // != null)
- // || (lastPositions.getFacePosition() != null && positions.getFacePosition()
- // == null)) {
- // if (positions.getFacePosition() != null) {
- // notifyEyeMovementListenerFaceDetected();
- // } else {
- // notifyEyeMovementListenerFaceLost();
- // }
- // }
- // counter = 0;
- // if (statusWindow != null)
- // statusWindow.getFaceInfoPanel().setFace(image,
- // positions.getFacePosition());
- // }
- //
- // if (positions.getEyePosition() != null) {
- // if (statusWindow != null) {
- // statusWindow.getEyeInfoPanel().setEyePosition(image,
- // positions.getFacePosition(),
- // positions.getEyePosition());
- // }
- // deviationScanner.addEyePosition(positions.getEyePosition());
- // Deviation deviation =
- // deviationScanner.scanForDeviation(positions.getFacePosition());//
- // positions.getEyePosition().getDeviation(lastPositions.getEyePosition());
- //
- // if (deviation != Deviation.NONE) {
- // notifyEyeMovementListenerEyeMoved(deviation);
- // }
- //
- // } else {
- // if (statusWindow != null)
- // statusWindow.getEyeInfoPanel().setDeviation(null);
- // }
- //
- // lastPositions = positions;
- // } catch (Exception e) {
- // e.printStackTrace();
- // try {
- // close();
- // } catch (Exception e2) {
- // }
- // }
- // }
- //
- // public synchronized void clearDeviationScanner() {
- // this.deviationScanner.clear();
- // }
- //
- // }
-
public LEA() {
// this.imageProcessor = new
// ImageProcessor(this.captureDevice.getFrameRate());
ImageReader reader = new ImageReader();
- while (i < maxCount) {
+ SSJAVA: while (i < maxCount) {
Image image = reader.readImage("data/b" + i + ".bmp");
i++;
if (image == null) {
if (positions.getEyePosition() != null) {
deviationScanner.addEyePosition(positions.getEyePosition());
- Deviation deviation = deviationScanner.scanForDeviation(positions.getFacePosition());// positions.getEyePosition().getDeviation(lastPositions.getEyePosition());
+ int deviation = deviationScanner.scanForDeviation(positions.getFacePosition());// positions.getEyePosition().getDeviation(lastPositions.getEyePosition());
if (deviation != DeviationScanner.NONE) {
- System.out.println("deviation=" + deviation);
+ System.out.println("deviation=" + deviationScanner.toStringDeviation(deviation));
// notifyEyeMovementListenerEyeMoved(deviation);
}
}
- // else {
- // if (statusWindow != null)
- // statusWindow.getEyeInfoPanel().setDeviation(null);
- // }
lastPositions = positions;
- // } catch (Exception e) {
- // e.printStackTrace();
- // try {
- // close();
- // } catch (Exception e2) {
- // }
- // }
}
}
EyePosition eyePosition = null;
if (faceRect != null) {
lastRectangle = faceRect;
- Point point = readEyes(image, faceRect);
+ faceRect = null;
+ Point point = readEyes(image, lastRectangle);
if (point != null) {
- eyePosition = new EyePosition(point, faceRect);
+ eyePosition = new EyePosition(point, lastRectangle);
}
}
System.out.println("eyePosition=" + eyePosition);
- return new FaceAndEyePosition(faceRect, eyePosition);
+ return new FaceAndEyePosition(lastRectangle, eyePosition);
}
private Point readEyes(Image image, Rectangle2D rect) {
FileInputStream inputFile = new FileInputStream("facedata.dat");
- classifierTree = new ClassifierTree();
-
int numClassifier = Integer.parseInt(inputFile.readLine());
+ classifierTree = new ClassifierTree(numClassifier);
for (int c = 0; c < numClassifier; c++) {
int numArea = Integer.parseInt(inputFile.readLine());
classifier.setPossibilityFaceYes(Integer.parseInt(inputFile.readLine()));
classifier.setPossibilityFaceNo(Integer.parseInt(inputFile.readLine()));
- classifierTree.addClassifier(classifier);
+ classifierTree.addClassifier(c, classifier);
}
}
- // private Point readEyes(BufferedImage image, Rectangle2D rect) {
- //
- // // now we cluster the black image points and try to find the inner eye
- // /*
- // * BlackHoleDetector bhd = new BlackHoleDetector(image, rect);
- // * bhd.detect(20);
- // *
- // * return bhd.getPosition();
- // */
- //
- // EyeDetector ed = new EyeDetector(image, rect);
- // return ed.detectEye();
- // }
}
+++ /dev/null
-/*\r
- * Copyright 2009 (c) Florian Frankenberger (darkblue.de)\r
- * \r
- * This file is part of LEA.\r
- * \r
- * LEA is free software: you can redistribute it and/or modify it under the\r
- * terms of the GNU Lesser General Public License as published by the Free\r
- * Software Foundation, either version 3 of the License, or (at your option) any\r
- * later version.\r
- * \r
- * LEA is distributed in the hope that it will be useful, but WITHOUT ANY\r
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\r
- * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more\r
- * details.\r
- * \r
- * You should have received a copy of the GNU Lesser General Public License\r
- * along with LEA. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-\r
-\r
-/**\r
- * An array with just a static size. If you add more than\r
- * the capacity holds the oldest element gets removed.\r
- * <p>\r
- * This List is implemented as an ring buffer array.\r
- * <p>\r
- * TODO: implement the <code>List</code> interface\r
- * \r
- * @author Florian Frankenberger\r
- */\r
-public class StaticSizeArrayList<T> {\r
-\r
- private Object[] buffer;\r
- private int startPos = 0;\r
- private int pos = 0;\r
- private int size = 0;\r
- \r
- public StaticSizeArrayList(int size) {\r
- this.buffer = new Object[size];\r
- }\r
- \r
- public synchronized void add(T item) {\r
- this.buffer[pos] = item;\r
- pos = ++pos % buffer.length;\r
- if (size < buffer.length) {\r
- size++;\r
- } else {\r
- this.startPos = ++this.startPos % this.buffer.length;\r
- }\r
- }\r
- \r
- @SuppressWarnings("unchecked")\r
- public synchronized T get(int i) {\r
- if (i >= this.size)\r
- throw new ArrayIndexOutOfBoundsException("Size is "+this.size+" but tried to access item "+i);\r
- \r
- int acPos = (this.startPos + i) % this.buffer.length;\r
- \r
- return (T)this.buffer[acPos];\r
- }\r
- \r
- public synchronized void clear() {\r
- this.startPos = 0;\r
- this.pos = 0;\r
- this.size = 0;\r
- }\r
- \r
- public synchronized int size() {\r
- return this.size;\r
- }\r
- \r
-}\r
+++ /dev/null
-/* ArrayList.java -- JDK1.2's answer to Vector; this is an array-backed
- implementation of the List interface
- Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath 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, or (at your option)
-any later version.
-
-GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-//package java.util;
-
-/*import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.lang.reflect.Array;
-*/
-/**
- * An array-backed implementation of the List interface. This implements
- * all optional list operations, and permits null elements, so that it is
- * better than Vector, which it replaces. Random access is roughly constant
- * time, and iteration is roughly linear time, so it is nice and fast, with
- * less overhead than a LinkedList.
- * <p>
- *
- * Each list has a capacity, and as the array reaches that capacity it
- * is automatically transferred to a larger array. You also have access to
- * ensureCapacity and trimToSize to control the backing array's size, avoiding
- * reallocation or wasted memory.
- * <p>
- *
- * ArrayList is not synchronized, so if you need multi-threaded access,
- * consider using:<br>
- * <code>List l = Collections.synchronizedList(new ArrayList(...));</code>
- * <p>
- *
- * The iterators are <i>fail-fast</i>, meaning that any structural
- * modification, except for <code>remove()</code> called on the iterator
- * itself, cause the iterator to throw a
- * {@link ConcurrentModificationException} rather than exhibit
- * non-deterministic behavior.
- *
- * @author Jon A. Zeppieri
- * @author Bryce McKinlay
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Collection
- * @see List
- * @see LinkedList
- * @see Vector
- * @see Collections#synchronizedList(List)
- * @see AbstractList
- * @status updated to 1.4
- */
-//public class ArrayList<E> extends AbstractList<E>
-// implements List<E>, RandomAccess, Cloneable, Serializable
-public class ArrayList
-{
- protected transient int modCount;
- /**
- * Compatible with JDK 1.2
- */
- private static final long serialVersionUID = 8683452581122892189L;
-
- /**
- * The default capacity for new ArrayLists.
- */
- private static final int DEFAULT_CAPACITY = 10;
-
- /**
- * The number of elements in this list.
- * @serial the list size
- */
- private int size;
-
- /**
- * Where the data is stored.
- */
- //private transient E[] data;
- private transient Object[] data;
-
- /**
- * Construct a new ArrayList with the supplied initial capacity.
- *
- * @param capacity initial capacity of this ArrayList
- * @throws IllegalArgumentException if capacity is negative
- */
- public ArrayList(int capacity)
- {
- // Must explicitly check, to get correct exception.
- if (capacity < 0)
- throw new Error("Illegal Argument Exception")/*IllegalArgumentException()*/;
- data = (Object/*E*/[]) new Object[capacity];
- }
-
- /**
- * Construct a new ArrayList with the default capacity (16).
- */
- public ArrayList()
- {
- this(DEFAULT_CAPACITY);
- }
-
- /**
- * Construct a new ArrayList, and initialize it with the elements
- * in the supplied Collection. The initial capacity is 110% of the
- * Collection's size.
- *
- * @param c the collection whose elements will initialize this list
- * @throws NullPointerException if c is null
- */
- /*public ArrayList(Collection<? extends E> c)
- {
- this((int) (c.size() * 1.1f));
- addAll(c);
- }*/
-
- /**
- * Trims the capacity of this List to be equal to its size;
- * a memory saver.
- */
- public void trimToSize()
- {
- // Not a structural change from the perspective of iterators on this list,
- // so don't update modCount.
- if (size != data.length)
- {
- Object/*E*/[] newData = /*(ObjectE[])*/ new Object[size];
- System.arraycopy(data, 0, newData, 0, size);
- data = newData;
- }
- }
-
- /**
- * Guarantees that this list will have at least enough capacity to
- * hold minCapacity elements. This implementation will grow the list to
- * max(current * 2, minCapacity) if (minCapacity > current). The JCL says
- * explictly that "this method increases its capacity to minCap", while
- * the JDK 1.3 online docs specify that the list will grow to at least the
- * size specified.
- *
- * @param minCapacity the minimum guaranteed capacity
- */
- public void ensureCapacity(int minCapacity)
- {
- int current = data.length;
-
- if (minCapacity > current)
- {
- Object/*E*/[] newData = /*(E[])*/ new Object[Math.max(current * 2, minCapacity)];
- System.arraycopy(data, 0, newData, 0, size);
- data = newData;
- }
- }
-
- /**
- * Returns the number of elements in this list.
- *
- * @return the list size
- */
- public int size()
- {
- return size;
- }
-
- /**
- * Checks if the list is empty.
- *
- * @return true if there are no elements
- */
- public boolean isEmpty()
- {
- return size == 0;
- }
-
- /**
- * Returns true iff element is in this ArrayList.
- *
- * @param e the element whose inclusion in the List is being tested
- * @return true if the list contains e
- */
- public boolean contains(Object e)
- {
- return indexOf(e) != -1;
- }
-
- /**
- * Returns the lowest index at which element appears in this List, or
- * -1 if it does not appear.
- *
- * @param e the element whose inclusion in the List is being tested
- * @return the index where e was found
- */
- public int indexOf(Object e)
- {
- for (int i = 0; i < size; i++)
- if (equals(e, data[i]))
- return i;
- return -1;
- }
-
- /**
- * Returns the highest index at which element appears in this List, or
- * -1 if it does not appear.
- *
- * @param e the element whose inclusion in the List is being tested
- * @return the index where e was found
- */
- public int lastIndexOf(Object e)
- {
- for (int i = size - 1; i >= 0; i--)
- if (equals(e, data[i]))
- return i;
- return -1;
- }
-
- boolean equals(Object o1, Object o2)
- {
- return o1 == null ? o2 == null : o1.equals(o2);
- }
-
- /**
- * Creates a shallow copy of this ArrayList (elements are not cloned).
- *
- * @return the cloned object
- */
- /*public Object clone()
- {
- ArrayList<E> clone = null;
- try
- {
- clone = (ArrayList<E>) super.clone();
- //clone = new ArrayList();
- clone.data = (E[]) data.clone();
- }
- catch (CloneNotSupportedException e)
- {
- // Impossible to get here.
- }
- return clone;
- }*/
-
- /**
- * Returns an Object array containing all of the elements in this ArrayList.
- * The array is independent of this list.
- *
- * @return an array representation of this list
- */
- public Object[] toArray()
- {
- Object/*E*/[] array = /*(E[])*/ new Object[size];
- System.arraycopy(data, 0, array, 0, size);
- return array;
- }
-
- /**
- * Returns an Array whose component type is the runtime component type of
- * the passed-in Array. The returned Array is populated with all of the
- * elements in this ArrayList. If the passed-in Array is not large enough
- * to store all of the elements in this List, a new Array will be created
- * and returned; if the passed-in Array is <i>larger</i> than the size
- * of this List, then size() index will be set to null.
- *
- * @param a the passed-in Array
- * @return an array representation of this list
- * @throws ArrayStoreException if the runtime type of a does not allow
- * an element in this list
- * @throws NullPointerException if a is null
- */
- /*public <T> T[] toArray(T[] a)
- {
- if (a.length < size)
- a = (T[]) Array.newInstance(a.getClass().getComponentType(), size);
- else if (a.length > size)
- a[size] = null;
- System.arraycopy(data, 0, a, 0, size);
- return a;
- }*/
-
- /**
- * Retrieves the element at the user-supplied index.
- *
- * @param index the index of the element we are fetching
- * @throws IndexOutOfBoundsException if index < 0 || index >= size()
- */
- public Object/*E*/ get(int index)
- {
- checkBoundExclusive(index);
- return data[index];
- }
-
- /**
- * Sets the element at the specified index. The new element, e,
- * can be an object of any type or null.
- *
- * @param index the index at which the element is being set
- * @param e the element to be set
- * @return the element previously at the specified index
- * @throws IndexOutOfBoundsException if index < 0 || index >= 0
- */
- public Object/*E*/ set(int index, Object/*E*/ e)
- {
- checkBoundExclusive(index);
- Object/*E*/ result = data[index];
- data[index] = e;
- return result;
- }
-
- /**
- * Appends the supplied element to the end of this list.
- * The element, e, can be an object of any type or null.
- *
- * @param e the element to be appended to this list
- * @return true, the add will always succeed
- */
- public boolean add(Object/*E*/ e)
- {
- modCount++;
- if (size == data.length)
- ensureCapacity(size + 1);
- data[size++] = e;
- return true;
- }
-
- /**
- * Adds the supplied element at the specified index, shifting all
- * elements currently at that index or higher one to the right.
- * The element, e, can be an object of any type or null.
- *
- * @param index the index at which the element is being added
- * @param e the item being added
- * @throws IndexOutOfBoundsException if index < 0 || index > size()
- */
- public void add(int index, Object/*E*/ e)
- {
- checkBoundInclusive(index);
- modCount++;
- if (size == data.length)
- ensureCapacity(size + 1);
- if (index != size)
- System.arraycopy(data, index, data, index + 1, size - index);
- data[index] = e;
- size++;
- }
-
- /**
- * Removes the element at the user-supplied index.
- *
- * @param index the index of the element to be removed
- * @return the removed Object
- * @throws IndexOutOfBoundsException if index < 0 || index >= size()
- */
- public Object/*E*/ remove(int index)
- {
- checkBoundExclusive(index);
- Object/*E*/ r = data[index];
- modCount++;
- if (index != --size)
- System.arraycopy(data, index + 1, data, index, size - index);
- // Aid for garbage collection by releasing this pointer.
- data[size] = null;
- return r;
- }
-
- /**
- * Removes all elements from this List
- */
- public void clear()
- {
- if (size > 0)
- {
- modCount++;
- // Allow for garbage collection.
- //Arrays.fill(data, 0, size, null);
- for(int i = 0; i < size; i++) {
- this.data[i] = null;
- }
- size = 0;
- }
- }
-
- /**
- * Add each element in the supplied Collection to this List. It is undefined
- * what happens if you modify the list while this is taking place; for
- * example, if the collection contains this list. c can contain objects
- * of any type, as well as null values.
- *
- * @param c a Collection containing elements to be added to this List
- * @return true if the list was modified, in other words c is not empty
- * @throws NullPointerException if c is null
- */
- /*public boolean addAll(Collection<? extends E> c)
- {
- return addAll(size, c);
- }*/
-
- /**
- * Add all elements in the supplied collection, inserting them beginning
- * at the specified index. c can contain objects of any type, as well
- * as null values.
- *
- * @param index the index at which the elements will be inserted
- * @param c the Collection containing the elements to be inserted
- * @throws IndexOutOfBoundsException if index < 0 || index > 0
- * @throws NullPointerException if c is null
- */
- /*public boolean addAll(int index, Collection<? extends E> c)
- {
- checkBoundInclusive(index);
- Iterator<? extends E> itr = c.iterator();
- int csize = c.size();
-
- modCount++;
- if (csize + size > data.length)
- ensureCapacity(size + csize);
- int end = index + csize;
- if (size > 0 && index != size)
- System.arraycopy(data, index, data, end, size - index);
- size += csize;
- for ( ; index < end; index++)
- data[index] = itr.next();
- return csize > 0;
- }*/
-
- /**
- * Removes all elements in the half-open interval [fromIndex, toIndex).
- * Does nothing when toIndex is equal to fromIndex.
- *
- * @param fromIndex the first index which will be removed
- * @param toIndex one greater than the last index which will be removed
- * @throws IndexOutOfBoundsException if fromIndex > toIndex
- */
- protected void removeRange(int fromIndex, int toIndex)
- {
- int change = toIndex - fromIndex;
- if (change > 0)
- {
- modCount++;
- System.arraycopy(data, toIndex, data, fromIndex, size - toIndex);
- size -= change;
- }
- else if (change < 0)
- throw new Error("Index Out Of Bounds Exception")/*IndexOutOfBoundsException()*/;
- }
-
- /**
- * Checks that the index is in the range of possible elements (inclusive).
- *
- * @param index the index to check
- * @throws IndexOutOfBoundsException if index > size
- */
- private void checkBoundInclusive(int index)
- {
- // Implementation note: we do not check for negative ranges here, since
- // use of a negative index will cause an ArrayIndexOutOfBoundsException,
- // a subclass of the required exception, with no effort on our part.
- if (index > size)
- raiseBoundsError(index);
- }
-
- /**
- * Checks that the index is in the range of existing elements (exclusive).
- *
- * @param index the index to check
- * @throws IndexOutOfBoundsException if index >= size
- */
- private void checkBoundExclusive(int index)
- {
- // Implementation note: we do not check for negative ranges here, since
- // use of a negative index will cause an ArrayIndexOutOfBoundsException,
- // a subclass of the required exception, with no effort on our part.
- if (index >= size)
- raiseBoundsError(index);
- }
-
- /**
- * Raise the ArrayIndexOfOutBoundsException.
- *
- * @param index the index of the access
- * @throws IndexOutOfBoundsException unconditionally
- */
- private void raiseBoundsError(int index)
- {
- // Implementaion note: put in a separate method to make the JITs job easier
- // (separate common from uncommon code at method boundaries when trivial to
- // do so).
- throw new Error/*IndexOutOfBoundsException*/("IndexOutOfBoundsException Index: " + index + ", Size: " + size);
- }
-
-
- /**
- * Remove from this list all elements contained in the given collection.
- * This is not public, due to Sun's API, but this performs in linear
- * time while the default behavior of AbstractList would be quadratic.
- *
- * @param c the collection to filter out
- * @return true if this list changed
- * @throws NullPointerException if c is null
- */
- /*boolean removeAllInternal(Collection<?> c)
- {
- int i;
- int j;
- for (i = 0; i < size; i++)
- if (c.contains(data[i]))
- break;
- if (i == size)
- return false;
-
- modCount++;
- for (j = i++; i < size; i++)
- if (! c.contains(data[i]))
- data[j++] = data[i];
- size -= i - j;
- return true;
- }*/
-
- /**
- * Retain in this vector only the elements contained in the given collection.
- * This is not public, due to Sun's API, but this performs in linear
- * time while the default behavior of AbstractList would be quadratic.
- *
- * @param c the collection to filter by
- * @return true if this vector changed
- * @throws NullPointerException if c is null
- * @since 1.2
- */
- /*boolean retainAllInternal(Collection<?> c)
- {
- int i;
- int j;
- for (i = 0; i < size; i++)
- if (! c.contains(data[i]))
- break;
- if (i == size)
- return false;
-
- modCount++;
- for (j = i++; i < size; i++)
- if (c.contains(data[i]))
- data[j++] = data[i];
- size -= i - j;
- return true;
- }*/
-
- /**
- * Serializes this object to the given stream.
- *
- * @param s the stream to write to
- * @throws IOException if the underlying stream fails
- * @serialData the size field (int), the length of the backing array
- * (int), followed by its elements (Objects) in proper order.
- */
- /*private void writeObject(ObjectOutputStream s) throws IOException
- {
- // The 'size' field.
- s.defaultWriteObject();
- // We serialize unused list entries to preserve capacity.
- int len = data.length;
- s.writeInt(len);
- // it would be more efficient to just write "size" items,
- // this need readObject read "size" items too.
- for (int i = 0; i < size; i++)
- s.writeObject(data[i]);
- }*/
-
- /**
- * Deserializes this object from the given stream.
- *
- * @param s the stream to read from
- * @throws ClassNotFoundException if the underlying stream fails
- * @throws IOException if the underlying stream fails
- * @serialData the size field (int), the length of the backing array
- * (int), followed by its elements (Objects) in proper order.
- */
- /*private void readObject(ObjectInputStream s)
- throws IOException, ClassNotFoundException
- {
- // the `size' field.
- s.defaultReadObject();
- int capacity = s.readInt();
- data = (E[]) new Object[capacity];
- for (int i = 0; i < size; i++)
- data[i] = (E) s.readObject();
- }*/
-
- public ArrayListIterator iterator()
- {
- // Bah, Sun's implementation forbids using listIterator(0).
- return new ArrayListIterator(this);
- }
-}
+++ /dev/null
-public class ArrayListIterator extends Iterator {
- private int pos;
- private int size;
- private int last;
- private ArrayList list;
-
- public ArrayListIterator(ArrayList list) {
- this.list = list;
- this.pos = 0;
- this.size = this.list.size();
- this.last = -1;
- }
-
- /**
- * Tests to see if there are any more objects to
- * return.
- *
- * @return True if the end of the list has not yet been
- * reached.
- */
- public boolean hasNext()
- {
- return pos < size;
- }
-
- /**
- * Retrieves the next object from the list.
- *
- * @return The next object.
- * @throws NoSuchElementException if there are
- * no more objects to retrieve.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
- */
- public Object next()
- {
- if (pos == size)
- throw new /*NoSuchElement*/Exception("NoSuchElementException");
- last = pos;
- return this.list.get(pos++);
- }
-
- /**
- * Removes the last object retrieved by <code>next()</code>
- * from the list, if the list supports object removal.
- *
- * @throws ConcurrentModificationException if the list
- * has been modified elsewhere.
- * @throws IllegalStateException if the iterator is positioned
- * before the start of the list or the last object has already
- * been removed.
- * @throws UnsupportedOperationException if the list does
- * not support removing elements.
- */
- public void remove()
- {
- if (last < 0)
- throw new /*IllegalState*/Exception("IllegalStateException");
- this.list.remove(last);
- pos--;
- size--;
- last = -1;
- }
-}
\ No newline at end of file
+++ /dev/null
-public class Iterator {
- boolean hasNext() {
- System.out.println("Iterator is an abstract class.");
- System.exit(-1);
- }
-
- Object next() {
- System.out.println("Iterator is an abstract class.");
- System.exit(-1);
- }
-
- void remove() {
- System.out.println("Iterator is an abstract class.");
- System.exit(-1);
- }
-}