AtomicCounterEditor extends DefaultEditor { static boolean checkRevision(@NotNull NodeBuilder builder, @Nullable PropertyState revision) { if (revision == null) { return true; } String pName = revision.getName(); PropertyState builderRev = builder.getProperty(pName); if (builderRev == null) { return false; } long brValue = builderRev.getValue(Type.LONG); long rValue = revision.getValue(Type.LONG); if (brValue >= rValue) { return true; } return false; } AtomicCounterEditor(@NotNull final NodeBuilder builder, 
                               @Nullable String instanceId,
                               @Nullable ScheduledExecutorService executor,
                               @Nullable NodeStore store,
                               @Nullable Whiteboard board); private  AtomicCounterEditor(final String path, 
                                final NodeBuilder builder, 
                                @Nullable String instanceId, 
                                @Nullable ScheduledExecutorService executor,
                                @Nullable NodeStore store,
                                @Nullable Whiteboard board); static void consolidateCount(@NotNull final NodeBuilder builder); @Override void propertyAdded(final PropertyState after); @Override Editor childNodeAdded(final String name, final NodeState after); @Override Editor childNodeChanged(final String name, 
                                   final NodeState before, 
                                   final NodeState after); @Override void leave(final NodeState before, final NodeState after); static final String PROP_INCREMENT; static final String PROP_COUNTER; static final String PREFIX_PROP_COUNTER; static final String PREFIX_PROP_REVISION; }
@Test public void checkRevision() { NodeBuilder b = EMPTY_NODE.builder(); PropertyState r = LongPropertyState.createLongProperty("r", 10L); assertTrue(AtomicCounterEditor.checkRevision(b, null)); assertFalse(AtomicCounterEditor.checkRevision(b, r)); b.setProperty(LongPropertyState.createLongProperty(r.getName(), 1L)); assertFalse(AtomicCounterEditor.checkRevision(b, r)); b.setProperty(LongPropertyState.createLongProperty(r.getName(), 10L)); assertTrue(AtomicCounterEditor.checkRevision(b, r)); b.setProperty(LongPropertyState.createLongProperty(r.getName(), 20L)); assertTrue(AtomicCounterEditor.checkRevision(b, r)); }