another interims commit; Peer and Transformer can work with Operation; OperationalTransformer uses OperationWithTransformationSupport

This commit is contained in:
Axel Uhl
2014-11-08 23:39:23 +01:00
parent a9a3997752
commit 3c9556b592
18 changed files with 109 additions and 68 deletions
@@ -1,7 +1,13 @@
package com.sap.sse.operationaltransformation;
/**
* Returns the same state object as was passed in. This is required for the Operational Transformation algorithm to work.
*
* @author Axel Uhl (D043530)
*
* @param <S>
* @param <O>
*/
public interface OperationWithTransformationSupport<S, O extends OperationWithTransformationSupport<S, O>> extends Operation<S> {
/**
* Implements the specific transformation rule for the implementing subclass for the set of possible peer operations
@@ -1,8 +1,15 @@
package com.sap.sse.operationaltransformation;
/**
* A default implementation for the {@link Transformer} interface, assuming operations implement the
* {@link OperationWithTransformationSupport} interface which standardizes how operations are being transformed.
*
* @author Axel Uhl (D043530)
*
* @param <S>
* @param <O>
*/
public class OperationalTransformer<S, O extends OperationWithTransformationSupport<S, O>> implements Transformer<O> {
@Override
public ClientServerOperationPair<O> transform(O clientOp, O serverOp) {
ClientServerOperationPair<O> result = new ClientServerOperationPair<O>(
@@ -10,5 +17,4 @@ public class OperationalTransformer<S, O extends OperationWithTransformationSupp
serverOp == null ? null : serverOp.transformServerOp(clientOp));
return result;
}
}