package tcra.exercises.resolve_prefix_reversal_private;

import java.util.List;
import tcra.math.*;
import tcra.exercises.ResolvePrefixReversalCapabilityExercise;

public class ResolvePrefixReversalCapability_PrePrefix_ReversalAssertion
      implements Assertion
{
   public ResolvePrefixReversalCapability_PrePrefix_ReversalAssertion()
   {}

   @SuppressWarnings("unchecked")
   public boolean check(List<MathType> t)
   {
      MathString<MathType> lb_self = (MathString<MathType>)t.get(0);
      MathString<MathType> lb_pre  = (MathString<MathType>)t.get(1);
      
      return((lb_self.length() + lb_pre.length()) <=
              ResolvePrefixReversalCapabilityExercise.getMaxDepth());
   } // end check(List)

   public String toString()
   {
      return("|Pre| + |S| ≤ Max_Depth;");
   } // end toString()
   
   @SuppressWarnings("unchecked")
   public String toInstanceString(List<MathType> t)
   {
      MathString<MathType> lb_self = (MathString<MathType>)t.get(0);
      MathString<MathType> lb_pre  = (MathString<MathType>)t.get(1);
      
      return("|"+lb_pre.toHTMLString()+"| + |"+
             lb_self.toHTMLString()+"| ≤ "+
             ResolvePrefixReversalCapabilityExercise.getMaxDepth()+
             ";");
   } // end toInstanceString(List)
} // end class
