package mfl;

public class Set
extends mfl.Value
{
  public Value count_op()
    {return new mfl.Integer(size());}

  public boolean equals(Object x)
    {if (!(x instanceof Set)) return false;
     int n = size();
     if (n != ((mfl.Value)x).size()) return false;
     for (int i = 1; i <= n; i++) if (!ith_element(i).equals(((mfl.Value)x).ith_element(i))) return false;
     return true;}

  public Value plus_op(Value x)
    {int m, n; mfl.Enumerated_set result;
     m = size(); n = x.size();
     result = new Enumerated_set(m+n);
     for (int i = 1; i <= m; i++) result.append(ith_element(i));
     for (int i = 1; i <= n; i++) result.append(x.ith_element(i));
     return result;}
}

