Adding an implementation of the visitor pattern in java