Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean isIncludedIn(AbstractImage img2)
- {
- Iterator<NodeState> itThis = this.iterator();
- Iterator<NodeState> it2 = img2.iterator();
- if (it2.isEmpty()) {
- System.out.println("Image2 est vide!");
- return false;
- } else {
- return isIncludedR(itThis, it2);
- }
- }
- private boolean isIncludedR(Iterator<NodeState> itThis, Iterator<NodeState> it2) {
- boolean res = true;
- if (!it2.isEmpty()) {
- if (!itThis.isEmpty()) {
- if (it2.getValue().equals(NodeState.valueOf(1)) || itThis.getValue().equals(NodeState.valueOf(0))) {
- } else if (it2.getValue().equals(NodeState.valueOf(0)) || itThis.getValue().equals(NodeState.valueOf(1))) {
- res = false;
- } else {
- itThis.goLeft();
- it2.goLeft();
- if (isIncludedR(itThis, it2)) {
- itThis.goUp();
- it2.goUp();
- itThis.goRight();
- it2.goRight();
- if (!isIncludedR(itThis, it2)) {
- res = false;
- }
- } else {
- res = false;
- }
- itThis.goUp();
- it2.goUp();
- }
- }
- }
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement