本文整理汇总了Java中com.rapidminer.tools.Observable类的典型用法代码示例。如果您正苦于以下问题:Java Observable类的具体用法?Java Observable怎么用?Java Observable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Observable类属于com.rapidminer.tools包,在下文中一共展示了Observable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TutorialBrowser
import com.rapidminer.tools.Observable; //导入依赖的package包/类
/**
* Creates a new browser which is linked to the given {@link TutorialSelector}.
*
* @param tutorialSelector
* the selector which should be observed
*/
public TutorialBrowser(TutorialSelector tutorialSelector) {
this.tutorialSelector = tutorialSelector;
initGUI();
tutorialObserver = new Observer<Tutorial>() {
@Override
public void update(Observable<Tutorial> observable, Tutorial tutorial) {
selectedTutorial = tutorial;
nextTutorial = null;
// find next tutorial
if (selectedTutorial != null) {
List<Tutorial> tutorials = selectedTutorial.getGroup().getTutorials();
int currIndex = tutorials.indexOf(selectedTutorial);
if (currIndex != -1 && currIndex + 1 < tutorials.size()) {
nextTutorial = tutorials.get(currIndex + 1);
}
}
updateTutorial(tutorial);
}
};
tutorialSelector.addObserver(tutorialObserver, true);
}
示例2: DistanceMeasureHelper
import com.rapidminer.tools.Observable; //导入依赖的package包/类
public DistanceMeasureHelper(Operator operator) {
this.operator = operator;
operator.getParameters().addObserver(new Observer<String>() {
@Override
public void update(Observable<String> observable, String arg) {
if (DistanceMeasures.PARAMETER_MEASURE_TYPES.equals(arg)
|| DistanceMeasures.PARAMETER_MIXED_MEASURE.equals(arg)
|| DistanceMeasures.PARAMETER_NUMERICAL_MEASURE.equals(arg)
|| DistanceMeasures.PARAMETER_NOMINAL_MEASURE.equals(arg)
|| DistanceMeasures.PARAMETER_DIVERGENCE.equals(arg)) {
updateMeasure();
}
}
}, false);
updateMeasure();
}
示例3: initialize
import com.rapidminer.tools.Observable; //导入依赖的package包/类
/**
* Inits the {@link ConfigurationManager}. This includes initial configuration loading as well
* as registering listeners to remote repositories.
*/
public void initialize() {
if (initialized) {
loadConfiguration();
return;
}
loadConfiguration();
RepositoryManager.getInstance(null).addObserver(new Observer<Repository>() {
@Override
public void update(Observable<Repository> observable, final Repository arg) {
if (arg instanceof RemoteRepository) {
loadFromRepository((RemoteRepository) arg);
((RemoteRepository) arg).addConnectionListener(loadOnConnectListener);
arg.addRepositoryListener(loadOnRefreshListener);
}
}
}, false);
for (RemoteRepository ra : RepositoryManager.getInstance(null).getRemoteRepositories()) {
//ra.addConnectionListener(this.loadOnConnectListener);
//ra.addRepositoryListener(this.loadOnRefreshListener);
}
initialized = true;
}
示例4: notSameNameAnymoreUpdate
import com.rapidminer.tools.Observable; //导入依赖的package包/类
@Test
public void notSameNameAnymoreUpdate() {
columnMetaData.get(1).setName("att1");
validator.validate(1);
columnMetaData.get(1).setName("att2");
final AtomicBoolean wasCalled = new AtomicBoolean();
Observer<Set<Integer>> observer = new Observer<Set<Integer>>() {
@Override
public void update(Observable<Set<Integer>> observable, Set<Integer> arg) {
assertTrue(arg.contains(1));
assertTrue(arg.contains(0));
wasCalled.set(true);
}
};
validator.addObserver(observer, false);
validator.validate(1);
assertTrue(wasCalled.get());
}
示例5: notSameRoleAnymoreUpdate
import com.rapidminer.tools.Observable; //导入依赖的package包/类
@Test
public void notSameRoleAnymoreUpdate() {
columnMetaData.get(0).setRole("label");
columnMetaData.get(1).setRole("label");
validator.validate(0);
validator.validate(1);
final AtomicBoolean wasCalled = new AtomicBoolean();
Observer<Set<Integer>> observer = new Observer<Set<Integer>>() {
@Override
public void update(Observable<Set<Integer>> observable, Set<Integer> arg) {
assertTrue(arg.contains(1));
assertTrue(arg.contains(0));
wasCalled.set(true);
}
};
validator.addObserver(observer, false);
columnMetaData.get(1).setRole("label2");
validator.validate(1);
assertTrue(wasCalled.get());
}
示例6: updatedIndicesForDuplicatedNameChange
import com.rapidminer.tools.Observable; //导入依赖的package包/类
@Test
public void updatedIndicesForDuplicatedNameChange() {
final AtomicBoolean wasCalled = new AtomicBoolean();
final Set<Integer> expected = new HashSet<>();
expected.add(0);
expected.add(1);
Observer<Set<Integer>> observer = new Observer<Set<Integer>>() {
@Override
public void update(Observable<Set<Integer>> observable, Set<Integer> arg) {
assertEquals(expected, arg);
wasCalled.set(true);
}
};
validator.addObserver(observer, false);
columnMetaData.get(1).setName("att1");
validator.validate(1);
assertTrue(wasCalled.get());
}
示例7: changeBetweenDifferentDuplicatesNoUpdateIndices
import com.rapidminer.tools.Observable; //导入依赖的package包/类
@Test
public void changeBetweenDifferentDuplicatesNoUpdateIndices() {
final AtomicBoolean wasCalled = new AtomicBoolean();
columnMetaData.get(1).setName("att1");
columnMetaData.get(2).setName("att1");
columnMetaData.get(3).setName("att2");
columnMetaData.add(new DefaultColumnMetaData("att2", ColumnType.BINARY));
validator.init(columnMetaData);
Observer<Set<Integer>> observer = new Observer<Set<Integer>>() {
@Override
public void update(Observable<Set<Integer>> observable, Set<Integer> arg) {
assertTrue(arg == null);
wasCalled.set(true);
}
};
validator.addObserver(observer, false);
columnMetaData.get(2).setName("att2");
validator.validate(2);
assertTrue(wasCalled.get());
}
示例8: changeBetweenDifferentDuplicatesNoUpdateIndices2
import com.rapidminer.tools.Observable; //导入依赖的package包/类
@Test
public void changeBetweenDifferentDuplicatesNoUpdateIndices2() {
final AtomicBoolean wasCalled = new AtomicBoolean();
columnMetaData.get(1).setName("att1");
columnMetaData.get(2).setName("att1");
columnMetaData.get(3).setName("att2");
columnMetaData.add(new DefaultColumnMetaData("att2", ColumnType.BINARY));
validator.init(columnMetaData);
Observer<Set<Integer>> observer = new Observer<Set<Integer>>() {
@Override
public void update(Observable<Set<Integer>> observable, Set<Integer> arg) {
assertTrue(arg == null);
wasCalled.set(true);
}
};
validator.addObserver(observer, false);
columnMetaData.get(0).setName("att2");
validator.validate(0);
assertTrue(wasCalled.get());
}
示例9: duplicatesNoChange
import com.rapidminer.tools.Observable; //导入依赖的package包/类
@Test
public void duplicatesNoChange() {
final AtomicBoolean wasCalled = new AtomicBoolean();
columnMetaData.get(1).setName("att1");
columnMetaData.get(2).setName("att1");
columnMetaData.get(3).setName("att2");
columnMetaData.add(new DefaultColumnMetaData("att2", ColumnType.BINARY));
validator.init(columnMetaData);
Observer<Set<Integer>> observer = new Observer<Set<Integer>>() {
@Override
public void update(Observable<Set<Integer>> observable, Set<Integer> arg) {
wasCalled.set(true);
}
};
validator.addObserver(observer, false);
validator.validate(0);
assertFalse(wasCalled.get());
}
示例10: parsingErrorAffectedColumnChanged
import com.rapidminer.tools.Observable; //导入依赖的package包/类
@Test
public void parsingErrorAffectedColumnChanged() {
validator.setParsingErrors(parsingErrors);
final AtomicBoolean wasCalled = new AtomicBoolean();
Observer<Set<Integer>> observer = new Observer<Set<Integer>>() {
@Override
public void update(Observable<Set<Integer>> observable, Set<Integer> arg) {
assertTrue(arg == null);
wasCalled.set(true);
}
};
validator.addObserver(observer, false);
columnMetaData.get(0).setName("att");
validator.validate(0);
assertTrue(wasCalled.get());
}
示例11: initialize
import com.rapidminer.tools.Observable; //导入依赖的package包/类
/**
* Inits the {@link ConfigurationManager}. This includes initial configuration loading as well
* as registering listeners to remote repositories.
*/
public void initialize() {
if (initialized) {
loadConfiguration();
return;
}
loadConfiguration();
RepositoryManager.getInstance(null).addObserver(new Observer<Repository>() {
@Override
public void update(Observable<Repository> observable, final Repository arg) {
if (arg instanceof RemoteRepository) {
loadFromRepository((RemoteRepository) arg);
((RemoteRepository) arg).addConnectionListener(loadOnConnectListener);
arg.addRepositoryListener(loadOnRefreshListener);
}
}
}, false);
for (RemoteRepository ra : RepositoryManager.getInstance(null).getRemoteRepositories()) {
ra.addConnectionListener(this.loadOnConnectListener);
ra.addRepositoryListener(this.loadOnRefreshListener);
}
initialized = true;
}
示例12: update
import com.rapidminer.tools.Observable; //导入依赖的package包/类
@Override
public void update(final Observable<Process> observable, final Process arg) {
// if (process.getProcessState() == Process.PROCESS_STATE_RUNNING) {
// return;
// }
if (System.currentTimeMillis() - lastUpdate > 500) {
updateProcessNow();
} else {
if (getProcessState() == Process.PROCESS_STATE_RUNNING) {
if (!updateTimer.isRunning()) {
updateTimer.start();
}
} else {
updateProcessNow();
}
}
}
示例13: DistanceMeasureHelper
import com.rapidminer.tools.Observable; //导入依赖的package包/类
public DistanceMeasureHelper(Operator operator) {
this.operator = operator;
operator.getParameters().addObserver(new Observer<String>() {
@Override
public void update(Observable<String> observable, String arg) {
if (DistanceMeasures.PARAMETER_MEASURE_TYPES.equals(arg) ||
DistanceMeasures.PARAMETER_MIXED_MEASURE.equals(arg) ||
DistanceMeasures.PARAMETER_NUMERICAL_MEASURE.equals(arg) ||
DistanceMeasures.PARAMETER_NOMINAL_MEASURE.equals(arg) ||
DistanceMeasures.PARAMETER_DIVERGENCE.equals(arg)) {
updateMeasure();
}
}
}, false);
updateMeasure();
}
示例14: initialize
import com.rapidminer.tools.Observable; //导入依赖的package包/类
public void initialize() {
if (initialized) {
return;
}
loadConfiguration();
RepositoryManager.getInstance(null).addObserver(new Observer<Repository>() {
@Override
public void update(Observable<Repository> observable, final Repository arg) {
if (arg instanceof RemoteRepository) {
loadFromRepository((RemoteRepository) arg);
((RemoteRepository) arg).addConnectionListener(loadOnConnectListener);
arg.addRepositoryListener(loadOnRefreshListener);
}
}
}, false);
for (RemoteRepository ra : RepositoryManager.getInstance(null).getRemoteRepositories()) {
ra.addConnectionListener(this.loadOnConnectListener);
ra.addRepositoryListener(this.loadOnRefreshListener);
}
initialized = true;
}
示例15: update
import com.rapidminer.tools.Observable; //导入依赖的package包/类
@Override
public void update(Observable<Process> observable, Process arg) {
// if (process.getProcessState() == Process.PROCESS_STATE_RUNNING) {
// return;
// }
if (System.currentTimeMillis() - lastUpdate > 500) {
updateProcessNow();
} else {
if (process.getProcessState() == Process.PROCESS_STATE_RUNNING) {
if (!updateTimer.isRunning()) {
updateTimer.start();
}
} else {
updateProcessNow();
}
}
}