Skip to content

[EngineAddon] Add empty default operations to IEngineAddon #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,63 +10,13 @@
*******************************************************************************/
package org.eclipse.gemoc.xdsmlframework.api.engine_addon;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.eclipse.gemoc.xdsmlframework.api.core.EngineStatus.RunStatus;
import org.eclipse.gemoc.xdsmlframework.api.core.IExecutionEngine;

import org.eclipse.gemoc.trace.commons.model.trace.Step;

@Deprecated()
/**
* Engine addon with no behavior at all.
*
* @deprecated Use {@link IEngineAddon} directly instead, as all operations have
* default empty implementations.
*/
public class DefaultEngineAddon implements IEngineAddon {

@Override
public void engineAboutToStart(IExecutionEngine engine) {
}

@Override
public void engineStarted(IExecutionEngine executionEngine) {
}

@Override
public void aboutToSelectStep(IExecutionEngine engine, Collection<Step<?>> steps) {
}

@Override
public void stepSelected(IExecutionEngine engine, Step<?> selectedStep) {
}

@Override
public void engineStopped(IExecutionEngine engine) {
}

@Override
public void aboutToExecuteStep(IExecutionEngine executionEngine, Step<?> stepToApply) {
}

@Override
public void engineStatusChanged(IExecutionEngine engineRunnable, RunStatus newStatus) {
}

@Override
public void engineAboutToStop(IExecutionEngine engine) {
}

@Override
public void stepExecuted(IExecutionEngine engine, Step<?> stepExecuted) {
}

@Override
public void proposedStepsChanged(IExecutionEngine engine, Collection<Step<?>> steps) {
}

@Override
public void engineAboutToDispose(IExecutionEngine engine) {
}

@Override
public List<String> validate(List<IEngineAddon> otherAddons) {
return new ArrayList<String>();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2017 Inria and others.
* Copyright (c) 2016 Inria and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.gemoc.xdsmlframework.api.engine_addon;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

Expand All @@ -23,49 +24,58 @@ public interface IEngineAddon {
/**
* Operation called before the engine starts
*/
public void engineAboutToStart(IExecutionEngine engine);
default public void engineAboutToStart(IExecutionEngine engine) {
};

/**
* Operation called after the engine have started
*/
public void engineStarted(IExecutionEngine executionEngine);
default public void engineStarted(IExecutionEngine executionEngine) {
};

default public void engineInitialized(IExecutionEngine executionEngine) {
}

public void engineAboutToStop(IExecutionEngine engine);
};

default public void engineAboutToStop(IExecutionEngine engine) {
};

/**
* Operation called after the engine has been stopped
*/
public void engineStopped(IExecutionEngine engine);
default public void engineStopped(IExecutionEngine engine) {
};


/**
* Operation before the engine has been disposed (and after the engine has
* been stopped)
*/
public void engineAboutToDispose(IExecutionEngine engine);
default public void engineAboutToDispose(IExecutionEngine engine) {
};

/**
* Operation called before the Step has been chosen
*/
public void aboutToSelectStep(IExecutionEngine engine, Collection<Step<?>> steps);
default public void aboutToSelectStep(IExecutionEngine engine, Collection<Step<?>> steps) {
};

public void proposedStepsChanged(IExecutionEngine engine, Collection<Step<?>> steps);
default public void proposedStepsChanged(IExecutionEngine engine, Collection<Step<?>> steps) {
};

/**
* Operation called after the Step has been chosen It also returns the
* chosen Step
*/
public void stepSelected(IExecutionEngine engine, Step<?> selectedStep);
default public void stepSelected(IExecutionEngine engine, Step<?> selectedStep) {
};

public void aboutToExecuteStep(IExecutionEngine engine, Step<?> stepToExecute);
default public void aboutToExecuteStep(IExecutionEngine engine, Step<?> stepToExecute) {
};

public void stepExecuted(IExecutionEngine engine, Step<?> stepExecuted);
default public void stepExecuted(IExecutionEngine engine, Step<?> stepExecuted) {
};

public void engineStatusChanged(IExecutionEngine engine, RunStatus newStatus);
default public void engineStatusChanged(IExecutionEngine engine, RunStatus newStatus) {
};

/**
* This operation check the current addon compatibility with elements in
Expand All @@ -74,6 +84,8 @@ default public void engineInitialized(IExecutionEngine executionEngine) {
* @return A list of error messages if the check failed or an empty list
* otherwise.
*/
public List<String> validate(List<IEngineAddon> otherAddons);
default public List<String> validate(List<IEngineAddon> otherAddons) {
return new ArrayList<String>();
};

}
}