



package lrs.visitor;



import lrs.*;



public class LRSSum implements IAlgo{

 public static LRSSum Singleton = new LRSSum();



 private LRSSum() { }



  public Object emptyCase(LRStruct host, Object... param) {

      return 0;

  }



  public Object nonEmptyCase(LRStruct host, Object... param) {

      return (Integer) host.getFirst()+ (Integer)host.getRest().execute(this);

  }

}