package tcra.exercises.resolve_bounded_queue_private;

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

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

   @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          length  = (MathInteger)t.get(2);
      
      if(!self.equals(lb_self))            return false;
      if(!length.equals(lb_self.length())) return false;
       
      return true;
   } // end check(List)
   
   public String toString() { return("Length = (|Q|);"); }

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