/**
* Copyright (C) 2022 by Martin Robillard. See https://codesample.info/about.html
*/
package e2.chapter8;
/**
* Defines the ability to visit all types of card sources in
* a composite structure.
*/
public interface CardSourceVisitor
{
void visitCompositeCardSource(CompositeCardSource pCompositeCardSource);
void visitDeck(Deck pDeck);
void visitCardSequence(CardSequence pCardSequence);
}
The interface of an abstract visitor typically contains one visit
method per type of object that can be visited. It is possible to
use a single name (visit
) and overload the method. However, for the
reasons explained in Chapter 7, it is often preferable to use a longer
form for the method names, as shown here.
The interface of an abstract visitor typically contains one visit
method per type of object that can be visited. It is possible to
use a single name (visit
) and overload the method. However, for the
reasons explained in Chapter 7, it is often preferable to use a longer
form for the method names, as shown here.