| 14 | import java.util.*; |
| 15 | |
| 16 | public abstract class ASeq extends Obj implements ISeq, Sequential, List, Serializable, IHashEq { |
| 17 | |
| 18 | private static final long serialVersionUID = 4748650717905139299L; |
| 19 | |
| 20 | transient int _hash; |
| 21 | transient int _hasheq; |
| 22 | |
| 23 | public String toString(){ |
| 24 | return RT.printString(this); |
| 25 | } |
| 26 | |
| 27 | public IPersistentCollection empty(){ |
| 28 | return PersistentList.EMPTY; |
| 29 | } |
| 30 | |
| 31 | protected ASeq(IPersistentMap meta){ |
| 32 | super(meta); |
| 33 | } |
| 34 | |
| 35 | |
| 36 | protected ASeq(){ |
| 37 | } |
| 38 | |
| 39 | public boolean equiv(Object obj){ |
| 40 | |
| 41 | if(!(obj instanceof Sequential || obj instanceof List)) |
| 42 | return false; |
| 43 | |
| 44 | if(this instanceof Counted && obj instanceof Counted && |
| 45 | ((Counted)this).count() != ((Counted)obj).count()) |
| 46 | return false; |
| 47 | |
| 48 | ISeq ms = RT.seq(obj); |
| 49 | for(ISeq s = seq(); s != null; s = s.next(), ms = ms.next()) |
| 50 | { |
| 51 | if(ms == null || !Util.equiv(s.first(), ms.first())) |
| 52 | return false; |
| 53 | } |
| 54 | return ms == null; |
| 55 | |
| 56 | } |
| 57 | |
| 58 | public boolean equals(Object obj){ |
| 59 | if(this == obj) return true; |
| 60 | if(!(obj instanceof Sequential || obj instanceof List)) |
| 61 | return false; |
| 62 | ISeq ms = RT.seq(obj); |
| 63 | for(ISeq s = seq(); s != null; s = s.next(), ms = ms.next()) |
| 64 | { |
| 65 | if(ms == null || !Util.equals(s.first(), ms.first())) |
| 66 | return false; |
| 67 | } |
| 68 | return ms == null; |
| 69 | |
| 70 | } |
| 71 | |
| 72 | public int hashCode(){ |
| 73 | if(_hash == 0) |
nothing calls this directly
no outgoing calls
no test coverage detected