/** * Exposes a document as a map of per-wavelet seen-version/seen-hash pairs. * * @param router router for the seen-state document * @return wavelet seen version and hash signature. */ private static <E> ObservableBasicMap<WaveletId, HashedVersion> createWaveletSeenVersion( DocumentEventRouter<? super E, E, ?> router) { return DocumentBasedMonotonicMap.create(router, router.getDocument().getDocumentElement(), WaveletIdSerializer.INSTANCE, HashedVersionSerializer.INSTANCE, SEEN_VERSION_TAG, ID_ATTR, SIGNATURE_ATTR); }
/** * Exposes a document as a map from wavelet ids to version numbers. * * @param router router for the archiving document * @return archiving state. */ private static <E> ObservableMonotonicMap<WaveletId, Integer> createWaveletArchiveState( DocumentEventRouter<? super E, E, ?> router) { return DocumentBasedMonotonicMap.create(router, router.getDocument().getDocumentElement(), WaveletIdSerializer.INSTANCE, Serializer.INTEGER, ARCHIVE_TAG, ID_ATTR, VERSION_ATTR); }
/** * Exposes a document as a map of per-wavelet notified-versions. * * @param router router for the notified-state document * @return wavelet notified version. */ private static <E> ObservableBasicMap<WaveletId, Integer> createWaveletNotifiedVersion( DocumentEventRouter<? super E, E, ?> router) { return DocumentBasedMonotonicMap.create(router, router.getDocument().getDocumentElement(), WaveletIdSerializer.INSTANCE, Serializer.INTEGER, NOTIFIED_VERSION_TAG, ID_ATTR, VERSION_ATTR); }
DocumentBasedWaveletReadState(DocumentEventRouter<? super E, E, ?> router, E container) { this.router = router; this.container = container; blips = DocumentBasedMonotonicMap.create(router, container, Serializer.STRING, Serializer.INTEGER, WaveletBasedSupplement.BLIP_READ_TAG, WaveletBasedSupplement.ID_ATTR, WaveletBasedSupplement.VERSION_ATTR); participants = DocumentBasedMonotonicValue.create(router, container, Serializer.INTEGER, WaveletBasedSupplement.PARTICIPANTS_READ_TAG, WaveletBasedSupplement.VERSION_ATTR); tags = DocumentBasedMonotonicValue.create(router, container, Serializer.INTEGER, WaveletBasedSupplement.TAGS_READ_TAG, WaveletBasedSupplement.VERSION_ATTR); wavelet = DocumentBasedMonotonicValue.create(router, container, Serializer.INTEGER, WaveletBasedSupplement.WAVELET_READ_TAG, WaveletBasedSupplement.VERSION_ATTR); }
/** * Creates a target map on a substrate. */ private <N, E extends N> void createTargetOn(ValueContext<N, E> context) { DocumentBasedMonotonicMap<E, String, Integer> target = DocumentBasedMonotonicMap.create(DefaultDocumentEventRouter.create(context.doc), context.container, Serializer.STRING, Serializer.INTEGER, ENTRY_TAG, KEY_ATTR, VALUE_ATTR); // Eventually, the target map and the substrate should be sufficient state for all tests. // However, in order to simulate document events, the two need to be wrapped together in a // FungeStack so that Java knows that the element type-parameters match. stack = new FungeStack<N, E, String, Integer>( context, target, Serializer.STRING, Serializer.INTEGER); }
/** * Creates a target map on a substrate. */ private <N, E extends N> void createTargetOn(ValueContext<N, E> context) { DocumentBasedMonotonicMap<E, String, Integer> target = DocumentBasedMonotonicMap.create(DefaultDocumentEventRouter.create(context.doc), context.container, Serializer.STRING, Serializer.INTEGER, ENTRY_TAG, KEY_ATTR, VALUE_ATTR); // Eventually, the target map and the substrate should be sufficient state for all tests. // However, in order to simulate document events, the two need to be wrapped together in a // FungeStack so that Java knows that the element type-parameters match. stack = new FungeStack<N, E, String, Integer>( context, target, Serializer.STRING, Serializer.INTEGER); }