本文整理汇总了Java中net.ssehub.easy.basics.progress.ProgressObserver.NO_OBSERVER属性的典型用法代码示例。如果您正苦于以下问题:Java ProgressObserver.NO_OBSERVER属性的具体用法?Java ProgressObserver.NO_OBSERVER怎么用?Java ProgressObserver.NO_OBSERVER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.ssehub.easy.basics.progress.ProgressObserver
的用法示例。
在下文中一共展示了ProgressObserver.NO_OBSERVER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EclipsePersistencer
/**
* This constructor can be used if a project shall be/is stored outside the workspace (e.g. is only linked).
* @param projectFolder The top level folder of the project.
* @param monitor A progress monitor, or <tt>null</tt> if progress reporting is not desired
*/
public EclipsePersistencer(File projectFolder, IProgressMonitor monitor) {
this.projectFolder = projectFolder;
String projectName = projectFolder.getName();
project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
PathEnvironment pathEnv = PathEnvironmentFactory.createPathEnvironment(project);
File projectFolder2 = new File(pathEnv.getBaseFolder(), projectName);
File storageFile = PersistenceUtils.getLocationFile(projectFolder2, PathKind.IVML);
persistencer = new Persistencer(pathEnv, projectFolder2,
storageFile.getAbsolutePath(), ProgressObserver.NO_OBSERVER);
if (null == monitor) {
this.monitor = new NullProgressMonitor();
} else {
this.monitor = monitor;
}
}
示例2: scanAll
/**
* Scans the entire environment starting at <code>root</code>.
*
* @param observer the observer to be notified in case of progress, use
* {@link ProgressObserver#NO_OBSERVER} if progress shall not be monitored
* @throws VilException in case that creating / obtaining artifacts fails
*/
public void scanAll(ProgressObserver observer) throws VilException {
if (null != base) {
ITask task = observer.registerTask("creating complete artifact model for " + base.getAbsolutePath());
int count = 0;
if (ProgressObserver.NO_OBSERVER != observer) {
count = scanAll(base, 0, null, null, null);
}
observer.notifyProgress(task, 0, count);
List<VilException> errors = new ArrayList<VilException>();
scanAll(base, 0, observer, task, errors);
observer.notifyEnd(task);
if (errors.size() > 0) {
throw new VilException(errors);
}
}
}
示例3: testCreation
/**
* Tests whether a new {@link PLPInfo} can be created and saved.
* @throws PersistenceException If the files could not be written/created to the file system.
*/
@Test
public void testCreation() throws PersistenceException {
// Test that no data exists at the desired location
Assert.assertFalse(TEST_PROJECT_CREATION.exists());
// Create and save new project.
PathEnvironment projectsWorkspace = new PathEnvironment(TEST_PROJECT_CREATION.getParentFile());
File easyConfigFile = PersistenceUtils.getLocationFile(TEST_PROJECT_CREATION, PathKind.IVML);
IPersistencer persistencer = new Persistencer(projectsWorkspace, TEST_PROJECT_CREATION,
easyConfigFile.getAbsolutePath(), ProgressObserver.NO_OBSERVER);
IProjectCreationResult result = persistencer.createProject(TEST_PROJECT_CREATION.getName(),
TEST_PROJECT_CREATION.getParentFile(), UUID.randomUUID().toString(), false);
PLPInfo plp = new PLPInfoLoader(result);
// Test whether project was saved correctly
Assert.assertTrue(TEST_PROJECT_CREATION.exists());
Assert.assertEquals(TEST_PROJECT_CREATION, plp.getProjectLocation());
}
示例4: testFileUpgrader
/**
* Test {@link FileUpgrader}.
*/
@Test
public void testFileUpgrader() {
try {
print(targetDir);
Map<String, String> fileMapping = Collections.unmodifiableMap(FILE_MAPPING);
String location = IUpgrader.toBundleLocation(targetDir);
FileUpgrader upgrader = new FileUpgrader(sourceDir.toURI(),
location, fileMapping, null, ProgressObserver.NO_OBSERVER);
assertResult(upgrader.upgrade(), fileMapping);
print(targetDir);
clean(targetDir);
} catch (MalformedURLException e) {
Assert.fail("URL: " + e.getMessage());
}
}
示例5: resultHandler
/**
* Method for handling reasoning result.
* @param expectedFailedConstraints Number of constraints that are expected to fa
* @param projectP1 Project to reason on.
*/
private void resultHandler(int expectedFailedConstraints, Project projectP1) {
Configuration config = new Configuration(projectP1, false);
ReasonerConfiguration rConfig = new ReasonerConfiguration();
rConfig.setRuntimeMode(true);
// Perform reasoning
Engine engine = new Engine(projectP1, config, rConfig, ProgressObserver.NO_OBSERVER);
ReasoningResult result = engine.reason();
// Test whether reasoning detected correct result
int failedConstraints = 0;
for (int i = 0; i < result.getMessageCount(); i++) {
if (result.getMessage(i).getStatus() == Status.ERROR) {
failedConstraints = failedConstraints + result.getMessage(i).getConflicts().size();
}
}
Assert.assertEquals("Failed constraints: ", expectedFailedConstraints, failedConstraints);
}
示例6: resultHandler
/**
* Method for handling reasoning result.
* @param expectedFailedConstraints Number of constraints that are expected to fa
* @param projectP1 Project to reason on.
*/
public static void resultHandler(int expectedFailedConstraints, Project projectP1) {
Configuration config = new Configuration(projectP1, false);
ReasonerConfiguration rConfig = new ReasonerConfiguration();
// Perform reasoning
Engine engine = new Engine(projectP1, config, rConfig, ProgressObserver.NO_OBSERVER);
ReasoningResult result = engine.reason();
// Test whether reasoning detected correct result
int failedConstraints = 0;
for (int i = 0; i < result.getMessageCount(); i++) {
if (result.getMessage(i).getStatus() == Status.ERROR) {
failedConstraints = failedConstraints + result.getMessage(i).getConflicts().size();
}
}
Assert.assertEquals("Failed constraints: ", expectedFailedConstraints, failedConstraints);
}
示例7: testResolveOfIntegers
/**
* Tests whether integer variables are resolved correctly.
* This tests includes:
* <ul>
* <li>Imports</li>
* <li>Assignments</li>
* <li>Defaults</li>
* <li>Re-Assignments</li>
* </ul>
*/
@Test
public void testResolveOfIntegers() {
createProjectP0();
createProjectP1();
createProjectP2();
Configuration config = new Configuration(projectP2, false);
ReasonerConfiguration rConfig = new ReasonerConfiguration();
Engine engine = new Engine(projectP2, config, rConfig, ProgressObserver.NO_OBSERVER);
engine.reason();
assertVariable(config, declA, 2, AssignmentState.DERIVED);
assertVariable(config, declB, 2, AssignmentState.DERIVED);
assertVariable(config, declC, 3, AssignmentState.DERIVED);
assertVariable(config, declD, 5, AssignmentState.DERIVED);
}
示例8: runReasoner
/**
* Runs the reasoner for the specified project.
* @param projectP1 Project to reason on.
* @return number of failed constraints.
*/
private int runReasoner(Project projectP1) {
Configuration config = new Configuration(projectP1, false);
ReasonerConfiguration rConfig = new ReasonerConfiguration();
// Perform reasoning
Engine engine = new Engine(projectP1, config, rConfig, ProgressObserver.NO_OBSERVER);
ReasoningResult result = engine.reason();
// Test whether reasoning detected correct result
int failedConstraints = 0;
for (int i = 0; i < result.getMessageCount(); i++) {
if (result.getMessage(i).getStatus() == Status.ERROR) {
failedConstraints = failedConstraints + result.getMessage(i).getConflicts().size();
}
}
return failedConstraints;
}
示例9: createProjectInstance
/**
* Creates a project instance for <code>folder</code>.
*
* @param folder the folder to create the project on
* @return the created project instance
*/
private static Project createProjectInstance(File folder) {
Project result = null;
try {
result = new Project(folder, ProgressObserver.NO_OBSERVER);
} catch (VilException e) {
Assert.fail("unexpected exeption: " + e);
}
return result;
}
示例10: createReasoningProcess
/**
* Creates a reasoning process.
* @param desiredOperation Specifies which reasoning operation should be performed.
* @param listener listener A listener which will be called after the reasoning has been finished.
* Can be <tt>null</tt>, if no action shall be executed after the reasoning is finished.
* @return A {@link ReasoningProcess} which can be used for reasoning (cf. {@link ReasoningProcess#run()}).
*/
protected final ReasoningProcess createReasoningProcess(ReasoningOperation desiredOperation,
IReasonerListener listener) {
ReasoningProcess process = null;
if (desiredOperation == ReasoningOperation.CONSITENCY_CHECK) {
process = new ReasoningProcess(getProject(), getReasonerConfig(), listener, ProgressObserver.NO_OBSERVER);
} else {
process = new ReasoningProcess(desiredOperation, getConfiguration(), getReasonerConfig(), listener,
ProgressObserver.NO_OBSERVER);
}
return process;
}
示例11: loadPLPInfo
/**
* Helping method for loading projects from the testdata folder.
* @param projectFolder The toplevel folder of a saved {@link PLPInfo} which should be used for testing.
* @return A {@link PLPInfo} which was loaded from the given location.
* @throws PersistenceException Must not occur, otherwise the config files inside the toplevel location are corrupt.
*/
protected static PLPInfo loadPLPInfo(File projectFolder) throws PersistenceException {
// Create Persistencer for loading a PLP
PathEnvironment projectsWorkspace = new PathEnvironment(projectFolder.getParentFile());
File easyConfigFile = PersistenceUtils.getLocationFile(projectFolder, PathKind.IVML);
IPersistencer persistencer = new Persistencer(projectsWorkspace, projectFolder,
easyConfigFile.getAbsolutePath(), ProgressObserver.NO_OBSERVER);
Assert.assertNotNull("Error: Persistencer could not be created.", persistencer);
// Load PLP
PersistentProject project = persistencer.load();
Assert.assertNotNull("Error: Information could not be loaded.", project);
Assert.assertNotNull("Error: IVML could not be loaded.", project.getProject());
Assert.assertNotNull("Error: VIL could not be loaded.", project.getMainBuildScript());
PLPInfo plp = new PLPInfoLoader(project);
Assert.assertNotNull("Error: PLP could not be created.", plp);
Assert.assertNotNull("Error: IVML could not be loaded.", plp.getProject());
Assert.assertNotNull("Error: VIL could not be loaded.", plp.getBuildScript());
LOADED_INFOS.add(plp);
PersistentProject2PLPConverter converter = new PersistentProject2PLPConverter(persistencer, project);
converter.persistentProject2PLP();
return plp;
}
示例12: getPersistencer
/**
* Creates an {@link IPersistencer} instance.
* @param projectFolder The toplevel folder of the complete project.
* @return An {@link IPersistencer} depending on whether Eclipse is running or not.
*/
public static IPersistencer getPersistencer(File projectFolder) {
IPersistencer persistencer = null;
if (Environment.runsInEclipse()) {
persistencer = new EclipsePersistencer(projectFolder, null);
} else {
PathEnvironment projectsWorkspace = new PathEnvironment(projectFolder.getParentFile());
File easyConfigFile = PersistenceUtils.getLocationFile(projectFolder, PathKind.IVML);
persistencer = new Persistencer(projectsWorkspace, projectFolder, easyConfigFile.getAbsolutePath(),
ProgressObserver.NO_OBSERVER);
}
return persistencer;
}
示例13: reasoningTest
/**
* Method to test whether different types of variables and constraints could be translated correctly
* into rules and reasoned on without any errors.
* @param ivmlFile IVML file to translate and reason on.
* @param operation {@link ReasoningOperation} to be performed.
* @param expectedFailedConstraints Number of constraints that are expected to fail.
*/
public void reasoningTest(String ivmlFile, ReasoningOperation operation, int expectedFailedConstraints) {
// Get project
Project project = loadProject(ivmlFile);
Configuration config = new Configuration(project);
ReasonerModel model = new ReasonerModel(config, null);
// Perform reasoning
DroolsEngine engine = new DroolsEngine(model, operation, ProgressObserver.NO_OBSERVER);
ReasoningResult result = engine.reason();
// Test whether reasoning detected correct result
int failedConstraints = 0;
if (result.getMessageCount() > 0 && result.getMessage(0).getStatus() == Status.ERROR) {
net.ssehub.easy.reasoning.core.reasoner.Message cause = result.getMessage(0);
failedConstraints = Math.max(cause.getConflicts().size(), result.getMessageCount());
}
Assert.assertEquals("Failed constraints: ", expectedFailedConstraints, failedConstraints);
// Integer i = 0;
// Integer count = model.getNormalConstraintCount();
// Set<ReasonerVariable> usedVariables =
// model.getVariablesUsedInConstraints();
// for (ReasonerVariable reasonerVariable : usedVariables) {
// i++;
// LOGGER.debug(reasonerVariable.getName().toString()
// + " : "
// + " rmodel: "
// + reasonerVariable.getReasoningState().toString() + " "
// + reasonerVariable.getValue()
// + " varmodel: "
// + reasonerVariable.getDecisionVariable().getState().toString() + " "
// + reasonerVariable.getDecisionVariable().getValue());
// }
}
示例14: createObserver
@Override
public ProgressObserver createObserver() {
return ProgressObserver.NO_OBSERVER; // TODO check, preliminary
}
示例15: createSimpleProject
/**
* Creates a simple test project and performs reasoning.
* @throws ValueDoesNotMatchTypeException Must not occur otherwise there is a failure inside the
* {@link ValueFactory}.
* @throws CSTSemanticException Must not occur otherwise there is a failure inside the constraint syntax trees.
*/
public void createSimpleProject() throws ValueDoesNotMatchTypeException, CSTSemanticException {
// Create project and variables
project = new Project("SimpleTestProject");
declA = new DecisionVariableDeclaration("intA", IntegerType.TYPE, project);
project.add(declA);
declB = new DecisionVariableDeclaration("intB", IntegerType.TYPE, project);
project.add(declB);
declC = new DecisionVariableDeclaration("intC", IntegerType.TYPE, project);
declC.setValue(33);
project.add(declC);
// Create assignment
Value valA = ValueFactory.createValue(declA.getType(), 31);
Variable varA = new Variable(declA);
ConstantValue constValA = new ConstantValue(valA);
OCLFeatureCall assignmentA = new OCLFeatureCall(varA, OclKeyWords.ASSIGNMENT, constValA);
Constraint assignmentConstraint = new Constraint(project);
assignmentConstraint.setConsSyntax(assignmentA);
project.add(assignmentConstraint);
// Create implies constraint
Value valB = ValueFactory.createValue(declB.getType(), 37);
ConstantValue constValB = new ConstantValue(valB);
Value valC = ValueFactory.createValue(declC.getType(), 40);
ConstantValue constValC = new ConstantValue(valC);
OCLFeatureCall equalsA = new OCLFeatureCall(varA, OclKeyWords.EQUALS, constValA);
OCLFeatureCall equalsB = new OCLFeatureCall(new Variable(declB), OclKeyWords.EQUALS, constValB);
OCLFeatureCall equalsC = new OCLFeatureCall(new Variable(declC), OclKeyWords.EQUALS, constValC);
OCLFeatureCall implies = new OCLFeatureCall(equalsA, OclKeyWords.IMPLIES, equalsB);
OCLFeatureCall impliesFail = new OCLFeatureCall(equalsA, OclKeyWords.IMPLIES, equalsC);
Constraint impliesConstaint = new Constraint(project);
impliesConstaint.setConsSyntax(implies);
project.add(impliesConstaint);
Constraint impliesConstaintFail = new Constraint(project);
impliesConstaintFail.setConsSyntax(impliesFail);
project.add(impliesConstaintFail);
// debugging
System.out.println(StringProvider.toIvmlString(project));
// Create Configuration (will also start AssignmentResolver)
config = new Configuration(project, true);
rConfig = new ReasonerConfiguration();
Engine engine = new Engine(project, config, rConfig, ProgressObserver.NO_OBSERVER);
engine.reason();
}