Tabnine Logo
Environment
Code IndexAdd Tabnine to your IDE (free)

How to use
Environment
in
weka.core

Best Java code snippets using weka.core.Environment (Showing top 20 results out of 315)

origin: nz.ac.waikato.cms.weka/weka-stable

 @Override
 public void actionPerformed(ActionEvent e) {
  m_flowEnvironment = new Environment();
  loadLayout();
 }
};
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Add a a variable to the internal map of this properties object and to the
 * global system-wide environment;
 * 
 * @param key the name of the variable
 * @param value its value
 */
public void addVariableSystemWide(String key, String value) {
 addVariable(key, value); // local
 // system wide
 if (this != getSystemWide()) {
  getSystemWide().addVariableSystemWide(key, value);
 }
 System.setProperty(key, value);
}
origin: nz.ac.waikato.cms.weka/distributedWekaBase

/**
 * Substitute environment variables in the supplied string.
 *
 * @param orig the string to modify
 * @return the string with environment variables resolved
 */
public String environmentSubstitute(String orig) {
 if (m_env != null) {
  try {
   orig = m_env.substitute(orig);
  } catch (Exception ex) {
   // not interested if there are no variables substituted
  }
 }
 return orig;
}
origin: nz.ac.waikato.cms.weka/weka-stable

public String environmentSubstitute(String source) {
 Environment env = m_env != null ? m_env : Environment.getSystemWide();
 try {
  source = env.substitute(source);
 } catch (Exception ex) {
 }
 return source;
}
origin: nz.ac.waikato.cms.weka/weka-stable

 @Override
 public String getProperty(String key) {
  // allow system-wide properties to override
  if (m_env == null) {
   m_env = Environment.getSystemWide();
  }
  String result = m_env.getVariableValue(key);

  if (result == null) {
   result = super.getProperty(key);
  }

  return result;
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

 getMainApplication().getApplicationSettings().getSetting(
  getPerspectiveID(), PreprocessDefaults.ENABLE_UNDO_KEY,
  PreprocessDefaults.ENABLE_UNDO, Environment.getSystemWide());
if (!undoEnabled) {
 return;
   .getSetting(getPerspectiveID(), PreprocessDefaults.UNDO_DIR_KEY,
    PreprocessDefaults.UNDO_DIR).toString();
 if (Environment.getSystemWide().containsEnvVariables(dir)) {
  dir = Environment.getSystemWide().substitute(dir);
origin: nz.ac.waikato.cms.weka/weka-stable

@Override
public Filter getFilter() {
 AddUserFields temp = new AddUserFields();
 Environment env = new Environment();
 env.addVariable("NOM", "aNomValue");
 String params = "-A douglas@numeric@42 -A nomAtt@nominal@aValue -A "
  + "aDate@date:yyyy-MM-dd@2012-07-09 -A varTest@nominal@${NOM}";
 try {
  String[] opts = Utils.splitOptions(params);
  temp.setEnvironment(env);
  temp.setOptions(opts);
 } catch (Exception ex) {
  ex.printStackTrace();
 }
 return temp;
}
origin: nz.ac.waikato.cms.weka/weka-stable

String[] elements = doNotLoadIfUnsetVar.toString().split(",");
Environment env = Environment.getSystemWide();
 if (env.getVariableValue(var.trim()) == null) {
   dnlM = Environment.getSystemWide().substitute(dnlM);
  } catch (Exception e) {
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Constructor. Initializes with system-wide environment variables and uses no
 * status message and no log.
 * 
 * @param matchDetails the internally encoded match details string
 * @param inputStructure the incoming instances structure
 */
public SubstringReplacerRules(String matchDetails, Instances inputStructure) {
 this(matchDetails, inputStructure, "", null, Environment.getSystemWide());
}
origin: nz.ac.waikato.cms.weka/weka-stable

public void setCurrentDirectory(File directory) {
 String tmpString = directory.toString();
 if (Environment.containsEnvVariables(tmpString)) {
  try {
   tmpString = m_env.substitute(tmpString);
  } catch (Exception ex) {
   // ignore
  }
 }
 File tmp2 = new File((new File(tmpString)).getAbsolutePath());
 JFileChooser embeddedEditor = (JFileChooser) m_fileEditor.getCustomEditor();
 if (tmp2.isDirectory()) {
  embeddedEditor.setCurrentDirectory(tmp2);
  if (embeddedEditor.getFileSelectionMode() == JFileChooser.DIRECTORIES_ONLY) {
   super.setAsText(directory.toString());
  }
 } else {
  embeddedEditor.setSelectedFile(tmp2);
  if (embeddedEditor.getFileSelectionMode() == JFileChooser.FILES_ONLY) {
   super.setAsText(directory.toString());
  }
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Set the file path for the flow being edited by this layout
 *
 * @param path the path on disk for the flow being edited
 */
public void setFilePath(File path) {
 m_filePath = path != null ? path : new File("-NONE-");
 if (path != null) {
  File absolute = new File(path.getAbsolutePath());
  getEnvironment().addVariable(KFGUIConsts.FLOW_DIRECTORY_KEY,
   absolute.getParent());
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

Environment env = Environment.getSystemWide();
String wh = env.getVariableValue("WEKA_HOME");
if (wh != null) {
 WEKA_HOME = new File(wh);
 NATIVE_LIBS_DIR = new File(wh + File.separator + NATIVE_LIBS_DIR_NAME);
} else {
 env.addVariableSystemWide("WEKA_HOME", WEKA_HOME.toString());
  env.getVariableValue("weka.core.wekaPackageRepositoryURL");
 if (repURL == null || repURL.length() == 0) {
String offline = env.getVariableValue("weka.packageManager.offline");
if (offline != null) {
 m_offline = offline.equalsIgnoreCase("true");
 env.getVariableValue("weka.packageManager.loadPackages");
if (loadPackages == null) {
 loadPackages = env.getVariableValue("weka.core.loadPackages");
  if (loadPackages == null) {
   loadPackages = env.getVariableValue("weka.core.loadPackages");
origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * Main method for testing this class.
 * 
 * @param args a list of strings to replace variables in (e.g. "\${os.name}
 *          "\${java.version}")
 */
public static void main(String[] args) {
 Environment t = new Environment();
 // String test =
 // "Here is a string with the variable ${java.version} and ${os.name} in it";
 if (args.length == 0) {
  System.err
   .println("Usage: java weka.core.Environment <string> <string> ...");
 } else {
  try {
   for (String arg : args) {
    String newS = t.substitute(arg);
    System.out.println("Original string:\n" + arg + "\n\nNew string:\n"
     + newS);
   }
  } catch (Exception ex) {
   ex.printStackTrace();
  }
 }
}
origin: nz.ac.waikato.cms.weka/weka-stable

&& currentEnv.getVariableValue(key) == null) {
getStepManager()
 .logDetailed("Setting variable: " + key + " = " + value);
currentEnv.addVariable(key, value);
origin: nz.ac.waikato.cms.weka/weka-stable

if (value instanceof String) {
 try {
  value = (T) env.substitute((String) value);
 } catch (Exception ex) {
 String val = env.getVariableValue(key.getKey());
 if (val != null) {
  value = stringToT(val, defaultValue);
origin: nz.ac.waikato.cms.weka/weka-stable

 @Override
 public Object getSelectedItem() {
  Object item = super.getSelectedItem();
  if (item instanceof String) {
   if (env.getVariableValue((String) item) != null) {
    String newS = "${" + (String) item + "}";
    item = newS;
   }
  }
  return item;
 }
};
origin: nz.ac.waikato.cms.weka/weka-stable

 getStepManager().getExecutionEnvironment().getEnvironmentVariables();
if (flowEnv != null) {
 Set<String> vars = flowEnv.getVariableNames();
 for (String var : vars) {
  env.put(var, flowEnv.getVariableValue(var));
origin: nz.ac.waikato.cms.weka/weka-stable

containsEnv = Environment.containsEnvVariables(file);
origin: nz.ac.waikato.cms.weka/weka-stable

public void setEnvironment(final Environment env) {
 m_env = env;
 Vector<String> varKeys = new Vector<String>(env.getVariableNames());
origin: Waikato/weka-trunk

 getMainApplication().getApplicationSettings().getSetting(
  getPerspectiveID(), PreprocessDefaults.ENABLE_UNDO_KEY,
  PreprocessDefaults.ENABLE_UNDO, Environment.getSystemWide());
if (!undoEnabled) {
 return;
   .getSetting(getPerspectiveID(), PreprocessDefaults.UNDO_DIR_KEY,
    PreprocessDefaults.UNDO_DIR).toString();
 if (Environment.getSystemWide().containsEnvVariables(dir)) {
  dir = Environment.getSystemWide().substitute(dir);
weka.coreEnvironment

Javadoc

This class encapsulates a map of all environment and java system properties. There are methods for adding and removing variables to this Environment object as well as to the system wide global environment. There is also a method for replacing key names (enclosed by ${}) with their associated value in Strings.

Most used methods

  • <init>
    Constructor that makes a new Environment object containing all the entries in the supplied one
  • addVariable
    Add a variable to the internal map of this properties object.
  • getSystemWide
    Get the singleton system-wide (visible to every class in the running VM) set of environment variable
  • substitute
    Substitute a variable names for their values in the given string.
  • getVariableValue
    Get the value for a particular variable.
  • addVariableSystemWide
    Add a a variable to the internal map of this properties object and to the global system-wide environ
  • containsEnvVariables
    Tests for the presence of environment variables.
  • getVariableNames
    Get the names of the variables (keys) stored in the internal map.

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • putExtra (Intent)
  • getExternalFilesDir (Context)
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now