package tcra.exercises.resolve_one_way_list_private;

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

public class ResolveOneWayList_PostResetAssertion implements
      Assertion
{
   public ResolveOneWayList_PostResetAssertion() {}
   
   @SuppressWarnings("unchecked")
   public boolean check(List<MathType> t)
   {
      MathString<MathType> lb_prec = (MathString<MathType>)t.get(0);
      MathString<MathType> lb_rem  = (MathString<MathType>)t.get(1);
      MathString<MathType> prec    = (MathString<MathType>)t.get(2);
      MathString<MathType> rem     = (MathString<MathType>)t.get(3);
      
      if(prec.length() != 0) return false;
      if(!rem.equals(lb_prec.concat(lb_rem))) return false;
      
      return(true);
   } // end check(List<MathType>)

   @SuppressWarnings("unchecked")
   public String toInstanceString(List<MathType> t)
   {
      MathString<MathType> lb_prec = (MathString<MathType>)t.get(0);
      MathString<MathType> lb_rem  = (MathString<MathType>)t.get(1);
      MathString<MathType> prec    = (MathString<MathType>)t.get(2);
      MathString<MathType> rem     = (MathString<MathType>)t.get(3);
      
      return ""+prec.toHTMLString()+" = &lt; &gt; and "+
             rem.toHTMLString()+" = "+lb_prec.toHTMLString()+
             " o "+lb_rem.toHTMLString();
   } // end toInstanceString(List<MathType>)

   public String toString()
   {
      return "P.Prec = empty_string and P.Rem = #P.Prec o #P.Rem;";
   } // end toString()
} // end class
