package tcra.exercises.resolve_bounded_stack_private;

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

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

   @SuppressWarnings("unchecked")
   public boolean check(List<MathType> t)
   {
      MathString<MathType> lb_self = (MathString<MathType>)t.get(0);
      MathString<MathType>    self = (MathString<MathType>)t.get(1);
      MathInteger            depth = (MathInteger)t.get(2);
      
      if(!self.equals(lb_self))           return false;
      if(!depth.equals(new MathInteger(lb_self.length()))) return false;
      
      return true;
   } // end check(List)
   
   public String toString()
   {
      return("Depth = (|S|);");
   } // end toString()

   @SuppressWarnings("unchecked")
   public String toInstanceString(List<MathType> t)
   {
      MathString<MathType> lb_self = (MathString<MathType>)t.get(0);
      MathInteger            depth = (MathInteger)t.get(2);
      
      return(depth.toHTMLString() + " = (|" + lb_self.toHTMLString()+
             "|);");
   } // end toInstanceString(List)

}
