| 15 | import java.io.StringWriter; |
| 16 | |
| 17 | public abstract class AMapEntry extends APersistentVector implements IMapEntry{ |
| 18 | |
| 19 | private static final long serialVersionUID = -5007980429903443802L; |
| 20 | |
| 21 | public Object nth(int i){ |
| 22 | if(i == 0) |
| 23 | return key(); |
| 24 | else if(i == 1) |
| 25 | return val(); |
| 26 | else |
| 27 | throw new IndexOutOfBoundsException(); |
| 28 | } |
| 29 | |
| 30 | private IPersistentVector asVector(){ |
| 31 | return LazilyPersistentVector.createOwning(key(), val()); |
| 32 | } |
| 33 | |
| 34 | public IPersistentVector assocN(int i, Object val){ |
| 35 | return asVector().assocN(i, val); |
| 36 | } |
| 37 | |
| 38 | public int count(){ |
| 39 | return 2; |
| 40 | } |
| 41 | |
| 42 | public ISeq seq(){ |
| 43 | return asVector().seq(); |
| 44 | } |
| 45 | |
| 46 | public IPersistentVector cons(Object o){ |
| 47 | return asVector().cons(o); |
| 48 | } |
| 49 | |
| 50 | public IPersistentCollection empty(){ |
| 51 | return null; |
| 52 | } |
| 53 | |
| 54 | public IPersistentStack pop(){ |
| 55 | return LazilyPersistentVector.createOwning(key()); |
| 56 | } |
| 57 | |
| 58 | public Object setValue(Object value){ |
| 59 | throw new UnsupportedOperationException(); |
| 60 | } |
| 61 | |
| 62 | /* |
| 63 | |
| 64 | public boolean equals(Object obj){ |
| 65 | return APersistentVector.doEquals(this, obj); |
| 66 | } |
| 67 | |
| 68 | public int hashCode(){ |
| 69 | //must match logic in APersistentVector |
| 70 | return 31 * (31 + Util.hash(key())) + Util.hash(val()); |
| 71 | // return Util.hashCombine(Util.hashCombine(0, Util.hash(key())), Util.hash(val())); |
| 72 | } |
| 73 | |
| 74 | public String toString(){ |
nothing calls this directly
no outgoing calls
no test coverage detected