mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-22 13:45:42 +00:00
another interims commit; Peer and Transformer can work with Operation; OperationalTransformer uses OperationWithTransformationSupport
This commit is contained in:
+8
-2
@@ -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
|
||||
|
||||
+9
-3
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user