(Object dispatchValX, Object dispatchValY)
| 82 | } |
| 83 | |
| 84 | public MultiFn preferMethod(Object dispatchValX, Object dispatchValY) { |
| 85 | rw.writeLock().lock(); |
| 86 | try |
| 87 | { |
| 88 | if(prefers(hierarchy.deref(), dispatchValY, dispatchValX)) |
| 89 | throw new IllegalStateException( |
| 90 | String.format("Preference conflict in multimethod '%s': %s is already preferred to %s", |
| 91 | name, dispatchValY, dispatchValX)); |
| 92 | preferTable = getPreferTable().assoc(dispatchValX, RT.conj((IPersistentCollection) RT.get(getPreferTable(), |
| 93 | dispatchValX, |
| 94 | PersistentHashSet.EMPTY), |
| 95 | dispatchValY)); |
| 96 | resetCache(); |
| 97 | return this; |
| 98 | } |
| 99 | finally |
| 100 | { |
| 101 | rw.writeLock().unlock(); |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | private boolean prefers(Object hierarchy, Object x, Object y) { |
| 106 | IPersistentSet xprefs = (IPersistentSet) getPreferTable().valAt(x); |
nothing calls this directly
no test coverage detected