| 18 | import java.util.Set; |
| 19 | |
| 20 | public abstract class APersistentSet extends AFn implements IPersistentSet, Collection, Set, Serializable, IHashEq { |
| 21 | |
| 22 | private static final long serialVersionUID = 889908853183699706L; |
| 23 | |
| 24 | int _hash; |
| 25 | int _hasheq; |
| 26 | final IPersistentMap impl; |
| 27 | |
| 28 | protected APersistentSet(IPersistentMap impl){ |
| 29 | this.impl = impl; |
| 30 | } |
| 31 | |
| 32 | public String toString(){ |
| 33 | return RT.printString(this); |
| 34 | } |
| 35 | |
| 36 | public boolean contains(Object key){ |
| 37 | return impl.containsKey(key); |
| 38 | } |
| 39 | |
| 40 | public Object get(Object key){ |
| 41 | return impl.valAt(key); |
| 42 | } |
| 43 | |
| 44 | public int count(){ |
| 45 | return impl.count(); |
| 46 | } |
| 47 | |
| 48 | public ISeq seq(){ |
| 49 | return RT.keys(impl); |
| 50 | } |
| 51 | |
| 52 | public Object invoke(Object arg1) { |
| 53 | return get(arg1); |
| 54 | } |
| 55 | |
| 56 | public boolean equals(Object obj){ |
| 57 | return setEquals(this, obj); |
| 58 | } |
| 59 | |
| 60 | static public boolean setEquals(IPersistentSet s1, Object obj) { |
| 61 | if(s1 == obj) return true; |
| 62 | if(!(obj instanceof Set)) |
| 63 | return false; |
| 64 | Set m = (Set) obj; |
| 65 | |
| 66 | if(m.size() != s1.count()) |
| 67 | return false; |
| 68 | |
| 69 | for(Object aM : m) |
| 70 | { |
| 71 | if(!s1.contains(aM)) |
| 72 | return false; |
| 73 | } |
| 74 | |
| 75 | return true; |
| 76 | } |
| 77 |
nothing calls this directly
no outgoing calls
no test coverage detected