package tcra.exercises.resolve_delete_entries_private;

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

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

   @SuppressWarnings("unchecked")
   public boolean check(List<MathType> t)
   {
      MathString<MathType> lb_self  = (MathString<MathType>)t.get(0);
      MathInteger          lb_index = (MathInteger)t.get(1);
      
      return(lb_index.getValue() >= 0 &&
             lb_index.getValue() <= lb_self.length());
   } // end check(List)
   
   public String toString() { return("0 ≤ k ≤ |S|;"); }

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