// Date: 2011-05-12 Khu

package Problems2Generic;
// Only to be used for extensions of Problem and Solution.

public abstract class DivisibleProblemQAI<S> implements Problem<S>
{
   protected boolean isDirectlySolvable;

   protected abstract void checkSolvability ();

   protected abstract void divide ();
      // Precondition: !isDirectlySolvable

   protected void computeSolution ()
      // Template method.
   {
      while (true)
      {
	 checkSolvability();
	 if (isDirectlySolvable) break;
	 divide();
      }
   }
}