package tcra.exercises.resolve_stack_mystery_private;

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

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

   @SuppressWarnings("unchecked")
   public boolean check(List<MathType> t)
   {
      MathString<MathType> lb_self = (MathString<MathType>)t.get(0);
      MathString<MathType> self    = (MathString<MathType>)t.get(2);
      MathInteger          mystery = (MathInteger)t.get(3);
      
      if(!lb_self.equals(self.prepend(mystery))) return false;
      if(!self.equals(lb_self)) return false;
      
      return true;
   } // end check(List)
   
   public String toString()
   {
      return("&lt;I&gt; * S = #S;");
   } // end toString()

   @SuppressWarnings("unchecked")
   public String toInstanceString(List<MathType> t)
   {
      MathString<MathType> lb_self = (MathString<MathType>)t.get(0);
      MathString<MathType> self    = (MathString<MathType>)t.get(2);
      MathInteger          mystery = (MathInteger)t.get(3);
      
      return("&lt;"+mystery.toHTMLString()+"&gt; * "+
             self.toHTMLString()+" = "+lb_self.toHTMLString()+";");
   } // end toInstanceString(List)
} // end class
