本文整理汇总了Java中weka.gui.explorer.ExplorerDefaults.set方法的典型用法代码示例。如果您正苦于以下问题:Java ExplorerDefaults.set方法的具体用法?Java ExplorerDefaults.set怎么用?Java ExplorerDefaults.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.gui.explorer.ExplorerDefaults
的用法示例。
在下文中一共展示了ExplorerDefaults.set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeExplorerProps
import weka.gui.explorer.ExplorerDefaults; //导入方法依赖的package包/类
/**
* Remove any ExplorerDefaults properties specified in the supplied package
*
* @param installedPackageName the package specifying properties that should
* be removed from ExplorerDefaults
*/
public static void removeExplorerProps(String installedPackageName) {
try {
Properties expProps = new Properties();
String explorerProps =
getPackageHome().getAbsolutePath() + File.separator
+ installedPackageName + File.separator + "Explorer.props";
BufferedInputStream bi =
new BufferedInputStream(new FileInputStream(explorerProps));
expProps.load(bi);
bi.close();
bi = null;
Set<Object> keys = expProps.keySet();
Iterator<Object> keysI = keys.iterator();
while (keysI.hasNext()) {
String key = (String) keysI.next();
if (!key.endsWith("Policy")) {
// See if this key is in the Explorer props
String existingVal = ExplorerDefaults.get(key, "");
String toRemove = expProps.getProperty(key);
if (existingVal.length() > 0) {
// cover the case when the value to remove is at the start
// or middle of a list
existingVal = existingVal.replace(toRemove + ",", "");
// the case when it's at the end
existingVal = existingVal.replace("," + toRemove, "");
ExplorerDefaults.set(key, existingVal);
}
}
}
} catch (Exception ex) {
}
}
示例2: removeExplorerProps
import weka.gui.explorer.ExplorerDefaults; //导入方法依赖的package包/类
public static void removeExplorerProps(String installedPackageName) {
try {
Properties expProps = new Properties();
String explorerProps = getPackageHome().getAbsolutePath()
+ File.separator + installedPackageName + File.separator
+ "Explorer.props";
BufferedInputStream bi = new BufferedInputStream(new FileInputStream(
explorerProps));
expProps.load(bi);
bi.close();
bi = null;
Set keys = expProps.keySet();
Iterator keysI = keys.iterator();
while (keysI.hasNext()) {
String key = (String) keysI.next();
if (!key.endsWith("Policy")) {
// See if this key is in the Explorer props
String existingVal = ExplorerDefaults.get(key, "");
String toRemove = expProps.getProperty(key);
if (existingVal.length() > 0) {
// cover the case when the value to remove is at the start
// or middle of a list
existingVal = existingVal.replace(toRemove + ",", "");
// the case when it's at the end
existingVal = existingVal.replace("," + toRemove, "");
ExplorerDefaults.set(key, existingVal);
}
}
}
} catch (Exception ex) {
}
}