本文整理汇总了Java中weka.core.Utils.readProperties方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.readProperties方法的具体用法?Java Utils.readProperties怎么用?Java Utils.readProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.core.Utils
的用法示例。
在下文中一共展示了Utils.readProperties方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Performs some initialization.
*/
protected void initialize() {
Properties props;
try {
props = Utils.readProperties(PROPERTIES_FILE);
} catch (Exception e) {
e.printStackTrace();
props = new Properties();
}
m_FontColor = getColor(props.getProperty("FontColor", ""));
m_BackgroundColor = getColor(props.getProperty("BackgroundColor", ""));
m_NodeColor = getColor(props.getProperty("NodeColor", ""));
m_LineColor = getColor(props.getProperty("LineColor", ""));
m_ZoomBoxColor = getColor(props.getProperty("ZoomBoxColor", ""));
m_ZoomBoxXORColor = getColor(props.getProperty("ZoomBoxXORColor", ""));
m_ShowBorder = Boolean
.parseBoolean(props.getProperty("ShowBorder", "true"));
}
示例2: loadProps
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Load the properties file
*/
protected static void loadProps() {
if (WEKA_HADOOP_PROPS == null) {
try {
WEKA_HADOOP_PROPS = Utils.readProperties(HADOOP_PROPS);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
示例3: loadProperties
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Loads a properties file from an external file.
*
* @param propsFile the properties file to load, ignored if null or pointing
* to a directory
* @return the properties, null if ignored or an error occurred
*/
private static Properties loadProperties(File propsFile) {
Properties result;
Properties defaultProps = null;
try {
defaultProps = Utils.readProperties(PROPERTY_FILE);
} catch (Exception ex) {
System.err.println("Warning, unable to read default properties file(s).");
ex.printStackTrace();
}
if (propsFile == null) {
return defaultProps;
}
if (!propsFile.exists() || propsFile.isDirectory()) {
return defaultProps;
}
try {
result = new Properties(defaultProps);
result.load(new FileInputStream(propsFile));
} catch (Exception e) {
result = null;
System.err
.println("Failed to load properties file (DatabaseUtils.java) '"
+ propsFile + "':");
e.printStackTrace();
}
return result;
}
示例4: newCodePane
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Creates a new JTextPane for the code.
*
* @return the text pane
*/
protected JTextPane newCodePane() {
JTextPane result;
SyntaxDocument doc;
Properties props;
try {
props = Utils.readProperties(PROPERTIES_FILE);
}
catch (Exception e) {
e.printStackTrace();
props = new Properties();
}
result = new JTextPane();
if (props.getProperty("Syntax", "false").equals("true")) {
doc = new SyntaxDocument(props);
result.setDocument(doc);
result.setBackground(doc.getBackgroundColor());
}
else {
result.setForeground(VisualizeUtils.processColour(props.getProperty("ForegroundColor", "black"), Color.BLACK));
result.setBackground(VisualizeUtils.processColour(props.getProperty("BackgroundColor", "white"), Color.WHITE));
result.setFont(new Font(props.getProperty("FontName", "monospaced"), Font.PLAIN, Integer.parseInt(props.getProperty("FontSize", "12"))));
}
return result;
}
示例5: registerEditors
import weka.core.Utils; //导入方法依赖的package包/类
/**
* registers all the editors in Weka.
*/
public static void registerEditors() {
Properties props;
Enumeration<?> enm;
String name;
String value;
if (m_EditorsRegistered) {
return;
}
Logger.log(weka.core.logging.Logger.Level.INFO,
"---Registering Weka Editors---");
m_EditorsRegistered = true;
// load properties
try {
props = Utils.readProperties(GUIEDITORS_PROPERTY_FILE);
} catch (Exception e) {
props = new Properties();
e.printStackTrace();
}
// show the tool tip?
m_ShowGlobalInfoToolTip = props.getProperty(
"ShowGlobalInfoToolTip", "true").equals("true");
enm = props.propertyNames();
while (enm.hasMoreElements()) {
name = enm.nextElement().toString();
value = props.getProperty(name, "");
registerEditor(name, value);
}
}
示例6: initialize
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Initializes the database connection.
*
* @param props the properties to obtain the parameters from, ignored if null
*/
public void initialize(Properties props) {
try {
if (props != null) {
PROPERTIES = props;
} else {
PROPERTIES = Utils.readProperties(PROPERTY_FILE);
}
// Register the drivers in jdbc DriverManager
String drivers = PROPERTIES.getProperty("jdbcDriver", "jdbc.idbDriver");
if (drivers == null) {
throw new Exception("No database drivers (JDBC) specified");
}
// The call to newInstance() is necessary on some platforms
// (with some java VM implementations)
StringTokenizer st = new StringTokenizer(drivers, ", ");
while (st.hasMoreTokens()) {
String driver = st.nextToken();
boolean result;
try {
Class.forName(driver);
DRIVERS.addElement(driver);
result = true;
} catch (Exception e) {
result = false;
}
if (!result && !DRIVERS_ERRORS.contains(driver)) {
Logger.log(Logger.Level.WARNING,
"Trying to add database driver (JDBC): " + driver + " - "
+ "Warning, not in CLASSPATH?");
} else if (m_Debug) {
System.err.println("Trying to add database driver (JDBC): " + driver
+ " - " + (result ? "Success!" : "Warning, not in CLASSPATH?"));
}
if (!result) {
DRIVERS_ERRORS.add(driver);
}
}
} catch (Exception ex) {
System.err.println("Problem reading properties. Fix before continuing.");
System.err.println(ex);
}
m_DatabaseURL = PROPERTIES.getProperty("jdbcURL",
"jdbc:idb=experiments.prp");
m_stringType = PROPERTIES.getProperty("CREATE_STRING", "LONGVARCHAR");
m_intType = PROPERTIES.getProperty("CREATE_INT", "INT");
m_doubleType = PROPERTIES.getProperty("CREATE_DOUBLE", "DOUBLE");
m_checkForUpperCaseNames = PROPERTIES.getProperty("checkUpperCaseNames",
"false").equals("true");
m_checkForLowerCaseNames = PROPERTIES.getProperty("checkLowerCaseNames",
"false").equals("true");
m_setAutoCommit = PROPERTIES.getProperty("setAutoCommit", "true").equals(
"true");
m_createIndex = PROPERTIES.getProperty("createIndex", "false").equals(
"true");
setKeywords(PROPERTIES.getProperty("Keywords",
"AND,ASC,BY,DESC,FROM,GROUP,INSERT,ORDER,SELECT,UPDATE,WHERE"));
setKeywordsMaskChar(PROPERTIES.getProperty("KeywordsMaskChar", "_"));
}
示例7: loadInputProperties
import weka.core.Utils; //导入方法依赖的package包/类
/**
* loads the property file containing the layout and the packages of the
* output-property-file. The exlcude property file is also read here.
*
* @see #m_InputProperties
* @see #m_InputFilename
*/
protected void loadInputProperties() {
if (VERBOSE) {
System.out.println("Loading '" + getInputFilename() + "'...");
}
m_InputProperties = new Properties();
try {
File f = new File(getInputFilename());
if (getExplicitPropsFile() && f.exists()) {
m_InputProperties.load(new FileInputStream(getInputFilename()));
} else {
m_InputProperties = Utils.readProperties(getInputFilename());
}
// excludes
m_Excludes.clear();
Properties p = Utils.readProperties(EXCLUDE_FILE);
Enumeration<?> enm = p.propertyNames();
while (enm.hasMoreElements()) {
String name = enm.nextElement().toString();
// new Hashtable for key
Hashtable<String, Vector<String>> t =
new Hashtable<String, Vector<String>>();
m_Excludes.put(name, t);
t.put(EXCLUDE_INTERFACE, new Vector<String>());
t.put(EXCLUDE_CLASS, new Vector<String>());
t.put(EXCLUDE_SUPERCLASS, new Vector<String>());
// process entries
StringTokenizer tok = new StringTokenizer(p.getProperty(name), ",");
while (tok.hasMoreTokens()) {
String item = tok.nextToken();
// get list
Vector<String> list = new Vector<String>();
if (item.startsWith(EXCLUDE_INTERFACE + ":")) {
list = t.get(EXCLUDE_INTERFACE);
} else if (item.startsWith(EXCLUDE_CLASS + ":")) {
list = t.get(EXCLUDE_CLASS);
} else if (item.startsWith(EXCLUDE_SUPERCLASS)) {
list = t.get(EXCLUDE_SUPERCLASS);
}
// add to list
list.add(item.substring(item.indexOf(":") + 1));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}