The Facet derived class.

Java Primer
The Game of SET & Software Design
Vince Huston
Listing 2. The Facet derived class.


class Zero extends Facet {
  public boolean isValid1(
                 Facet second, Facet third ) {
    return second.isValid2( third, this );
  }

  public boolean isValid2(
                   Facet third, Zero first ) {
    return third.isValid3( first, this );
  }
  public boolean isValid2(
                    Facet third, One first ) {
    return third.isValid3( first, this );
  }
  public boolean isValid2(
                    Facet third, Two first ) {
    return third.isValid3( first, this );
  }

  public boolean isValid3(
                   Zero first, Zero second ) {
    return true;
  }
  public boolean isValid3(
                   One first, Two second ) {
    return true;
  }
  public boolean isValid3(
                   Two first, One second ) {
    return true;
  }
}