Package de.fu_berlin.inf.dpp.concurrent.jupiter

Examples of de.fu_berlin.inf.dpp.concurrent.jupiter.Operation


                "Jupiter expects timestamps of type JupiterVectorTime");
        }
        checkPreconditions((JupiterVectorTime) timestamp);
        discardAcknowledgedOperations((JupiterVectorTime) timestamp);

        Operation newOp = transform(jupiterActivity.getOperation());
        this.vectorTime = this.vectorTime.incrementRemoteOperationCount();
        return newOp;

    }
View Full Code Here


        discardAcknowledgedOperations((JupiterVectorTime) timestamp);
        int[] result = new int[indices.length];
        System.arraycopy(indices, 0, result, 0, indices.length);
        for (int i = 0; i < this.ackJupiterActivityList.size(); i++) {
            OperationWrapper wrap = this.ackJupiterActivityList.get(i);
            Operation ack = wrap.getOperation();
            for (int k = 0; k < indices.length; k++) {
                result[k] = transformIndex(result[k], ack);
            }
        }
        return result;
View Full Code Here

    protected Operation transform(Operation newOp) {
        for (int ackJupiterActivityListCnt = 0; ackJupiterActivityListCnt < this.ackJupiterActivityList
            .size(); ackJupiterActivityListCnt++) {
            OperationWrapper wrap = this.ackJupiterActivityList
                .get(ackJupiterActivityListCnt);
            Operation existingOp = wrap.getOperation();

            Operation transformedOp;

            if (isClientSide()) {
                transformedOp = this.inclusion.transform(newOp, existingOp,
                    Boolean.TRUE);
                existingOp = this.inclusion.transform(existingOp, newOp,
View Full Code Here

    protected Operation calcUndoOperation(SPath editor) {

        if (!undoHistory.canUndo(editor))
            return new NoOperation(); // nothing to undo

        Operation lastLocal = undoHistory.getLatestLocal(editor);

        assert lastLocal != null;

        Operation undoOperation = lastLocal.invert();

        for (EditorHistoryEntry entry : undoHistory
            .entriesToLatestLocal(editor)) {

            Operation operation = entry.getOperation();

            undoOperation = transformation.transform(undoOperation, operation,
                Boolean.TRUE);

            log.debug("transformed undo: " + undoOperation);
View Full Code Here

    protected Operation calcRedoOperation(SPath editor) {

        if (!undoHistory.canRedo(editor))
            return new NoOperation(); // nothing to redo

        Operation lastUndo = undoHistory.getLatestRedoable(editor);

        assert lastUndo != null;

        Operation redoOperation = lastUndo.invert();

        for (EditorHistoryEntry entry : undoHistory
            .entriesToLatestRedoable(editor)) {

            redoOperation = transformation.transform(redoOperation,
View Full Code Here

        return redoOperation;
    }

    protected void undo(SPath editor) {

        Operation op = calcUndoOperation(editor);
        log.debug("calculated undo: " + op);

        // don't waste the network
        if (op instanceof NoOperation) {
            log.debug("nothing to undo in " + editor);
            return;
        }

        for (TextEditActivity activity : op.toTextEdit(editor,
            sarosSession.getLocalUser())) {
            log.debug("undone: " + activity + " in " + editor);
            fireActivity(activity);
        }
    }
View Full Code Here

        }
    }

    protected void redo(SPath editor) {

        Operation op = calcRedoOperation(editor);

        for (TextEditActivity activity : op.toTextEdit(editor,
            sarosSession.getLocalUser())) {
            log.debug("redone: " + activity + " in " + editor);
            fireActivity(activity);
        }
    }
View Full Code Here

        User source = jupiterActivity.getSource();

        // 1. Use JupiterClient of sender to transform JupiterActivity
        Jupiter sourceProxy = proxies.get(source.getJID());
        Operation op = sourceProxy.receiveJupiterActivity(jupiterActivity);

        // 2. Generate outgoing JupiterActivities for all other clients and the
        // host
        for (Map.Entry<JID, Jupiter> entry : proxies.entrySet()) {
View Full Code Here

        }
        return false;
    }

    public Operation invert() {
        Operation inverseOperation = new SplitOperation(getSecond().invert(),
            getFirst().invert());
        return inverseOperation;
    }
View Full Code Here

        JupiterActivity jupiterActivity) {

        TransformationResult result = new TransformationResult(
            sarosSession.getLocalUser());

        Operation op;
        try {
            op = jupiterClient.receive(jupiterActivity);
        } catch (TransformationException e) {
            log.error("Error during transformation of: " + jupiterActivity, e);
            // TODO this should trigger a consistency check
            return result;
        }

        // Transform to TextEdit so it can be executed locally
        for (TextEditActivity textEdit : op.toTextEdit(
            jupiterActivity.getPath(), jupiterActivity.getSource())) {

            result.executeLocally.add(textEdit);
        }
View Full Code Here

TOP

Related Classes of de.fu_berlin.inf.dpp.concurrent.jupiter.Operation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.