List of usage examples for org.apache.commons.configuration Configuration getDouble
double getDouble(String key);
From source file:org.ublog.benchmark.social.SocialBenchmark.java
@Override public void initialize(Configuration conf) throws ConfigurationException { this.initialTweetsFactor = conf.getDouble("benchmark.social.initialTweetsFactor"); Utils.MAX_MESSAGES_IN_TIMELINE = conf.getInt("benchmark.social.maximumMessagesTimeline"); Utils.MaxNTweets = conf.getInt("benchmark.social.maximumTweetsPerUser"); long seedNextOperation = conf.containsKey("benchmark.social.seedNextOperation") ? conf.getLong("benchmark.social.seedNextOperation") : System.nanoTime();/* w ww . j av a 2 s. co m*/ long seedOwner = conf.containsKey("benchmark.social.seedOwner") ? conf.getLong("benchmark.social.seedOwner") : System.nanoTime(); long seedTopic = conf.containsKey("benchmark.social.seedTopic") ? conf.getLong("benchmark.social.seedTopic") : System.nanoTime(); long seedStartFollow = conf.containsKey("benchmark.social.seedStartFollow") ? conf.getLong("benchmark.social.seedStartFollow") : System.nanoTime(); this.rndOp = new Random(seedNextOperation); this.rndOwner = new Random(seedOwner); this.rndTopic = new Random(seedTopic); this.rndStartFollow = new Random(seedStartFollow); this.probabilitySearchPerTopic = conf.getDouble("benchmark.social.probabilities.probabilitySearchPerTopic"); this.probabilitySearchPerOwner = conf.getDouble("benchmark.social.probabilities.probabilitySearchPerOwner"); this.probabilityGetRecentTweets = conf .getDouble("benchmark.social.probabilities.probabilityGetRecentTweets"); this.probabilityGetFriendsTimeline = conf .getDouble("benchmark.social.probabilities.probabilityGetFriendsTimeline"); this.probabilityStartFollowing = conf.getDouble("benchmark.social.probabilities.probabilityStartFollowing"); this.probabilityStopFollowing = conf.getDouble("benchmark.social.probabilities.probabilityStopFollowing"); if (this.probabilityGetFriendsTimeline + this.probabilityGetRecentTweets + this.probabilitySearchPerOwner + this.probabilitySearchPerTopic + this.probabilityStartFollowing + this.probabilityStopFollowing > 1) { logger.warn("The sum of all probabilities must be less or equal than 1."); throw new ConfigurationException("The sum of all probabilities must be less or equal than 1."); } String serverName = conf.getString("benchmark.server.name"); int serverPort = conf.getInt("benchmark.server.port"); this.remoteGraphServer = this.getRemoteGraphServer(serverName, serverPort); try { this.hasInitiated = this.remoteGraphServer.init(this.totalSize); } catch (RemoteException e) { e.printStackTrace(); } }
From source file:playground.michalm.jtrrouter.JTRRouter.java
protected void initTurn(HierarchicalConfiguration nodeCfg) { int id = nodeCfg.getInt("[@id]"); int prev = nodeCfg.getInt("[@prev]"); int length = nodeCfg.getMaxIndex("next") + 1; int[] nodes = new int[length]; double[] probs = new double[length]; for (int i = 0; i < length; i++) { Configuration nextCfg = nodeCfg.subset("next(" + i + ')'); nodes[i] = nextCfg.getInt("[@node]"); probs[i] = nextCfg.getDouble("[@probability]"); }/*from w ww .ja v a2 s.c om*/ turns[prev][id] = new Turn(id, prev, nodes, probs); }