1 33 34 package edu.rice.cs.util.sexp; 35 36 public class Cons extends SEList { 37 38 private SExp _first; 39 private SEList _rest; 40 41 public Cons(SExp first, SEList rest) { 42 _first = first; 43 _rest = rest; 44 } 45 46 public SExp getFirst() { return _first; } 47 48 public SEList getRest() { return _rest; } 49 50 public <Ret> Ret accept(SExpVisitor<Ret> v) { 51 return v.forCons(this); 52 } 53 public <Ret> Ret accept(SEListVisitor<Ret> v) { 54 return v.forCons(this); 55 } 56 57 protected String toStringHelp() { 58 return " " + _first + _rest.toStringHelp(); 59 } 60 61 public String toString() { 62 return "(" + _first + _rest.toStringHelp(); 63 } 64 } | Popular Tags |