started on visitor pattern

This commit is contained in:
Johannes Schmelz 2024-06-07 15:25:26 +02:00
parent 753d5e2780
commit e518460e81
5 changed files with 16 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,11 @@
package uebung08.doc;
public class CountWordsVisitor implements Visitor<Integer>{
@Override
public <T> Integer visit(TextComponent textComponent) {
image.accept(this);
return 0;
}
}

View File

@ -0,0 +1,5 @@
package uebung08.doc;
public interface Visitor<T> {
T visit(TextComponent textComponent);
}