package tcra.exercises.resolve_appending_capability_private;

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

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

   @SuppressWarnings("unchecked")
   public boolean check(List<MathType> t)
   {
      MathString<MathType> lb_self   = (MathString<MathType>)t.get(0);
      MathString<MathType> lb_append = (MathString<MathType>)t.get(1);
      MathString<MathType> append    = (MathString<MathType>)t.get(3);
      
      return(append.equals(lb_append.concat(lb_self)));
   } // end check(List)
   
   public String toString()
   {
      return("P = #P * #Q;");
   } // end toString()

   @SuppressWarnings("unchecked")
   public String toInstanceString(List<MathType> t)
   {
      MathString<MathType> lb_self   = (MathString<MathType>)t.get(0);
      MathString<MathType> lb_append = (MathString<MathType>)t.get(1);
      MathString<MathType> append    = (MathString<MathType>)t.get(3);
      
      return(append.toHTMLString()+" = "+lb_append.toHTMLString()+
             " * "+lb_self.toHTMLString()+";");
   } // end toInstanceString(List)
} // end class
