private void countJars() { for (Cell c : cells) { c.resetObjIterator(); while (c.objectIterator().hasNext()) { if (c.objectIterator().next() instanceof Jar) { jarCounter++; } } } }
public boolean allJarsOnMarks() { int jars = 0; GameObject obj; for (Cell c : cells) { c.resetObjIterator(); while (c.objectIterator().hasNext()) { if ((obj = c.objectIterator().next()) instanceof Mark) { jars += ((Mark) obj).getJarCounter(); } } } if (jars >= jarCounter) { return true; } return false; }