@Override public void loadState(final Graph graph, final Configuration configuration) { dampingFactor = configuration.getDouble(DAMPING_FACTOR, 0.85D); maxIterations = configuration.getInt(MAX_ITERATIONS, 10); vertexCount = configuration.getLong(VERTEX_COUNT, 1L); }
@Override public void loadState(final Graph graph, final Configuration configuration) { dampingFactor = configuration.getDouble(DAMPING_FACTOR, 0.85D); maxIterations = configuration.getInt(MAX_ITERATIONS, 10); vertexCount = configuration.getLong(VERTEX_COUNT, 1L); }
@Override public void loadState(final Graph graph, final Configuration configuration) { if (configuration.containsKey(INITIAL_RANK_TRAVERSAL)) this.initialRankTraversal = PureTraversal.loadState(configuration, INITIAL_RANK_TRAVERSAL, graph); if (configuration.containsKey(EDGE_TRAVERSAL)) { this.edgeTraversal = PureTraversal.loadState(configuration, EDGE_TRAVERSAL, graph); this.incidentMessageScope = MessageScope.Local.of(() -> this.edgeTraversal.get().clone()); this.countMessageScope = MessageScope.Local.of(new MessageScope.Local.ReverseTraversalSupplier(this.incidentMessageScope)); } this.alpha = configuration.getDouble(ALPHA, this.alpha); this.epsilon = configuration.getDouble(EPSILON, this.epsilon); this.maxIterations = configuration.getInt(MAX_ITERATIONS, 20); this.property = configuration.getString(PROPERTY, PAGE_RANK); this.vertexComputeKeys = new HashSet<>(Arrays.asList( VertexComputeKey.of(this.property, false), VertexComputeKey.of(EDGE_COUNT, true))); this.memoryComputeKeys = new HashSet<>(Arrays.asList( MemoryComputeKey.of(TELEPORTATION_ENERGY, Operator.sum, true, true), MemoryComputeKey.of(VERTEX_COUNT, Operator.sum, true, true), MemoryComputeKey.of(CONVERGENCE_ERROR, Operator.sum, false, true))); }
/** * Delegates to the underlying configuration. */ @Override public double getDouble(String key, double defaultValue) { return config.getDouble(key, defaultValue); }
/** * Delegates to the underlying configuration. */ @Override public double getDouble(String key) { return config.getDouble(key); }
/** * Delegates to the underlying configuration. */ @Override public double getDouble(String key, double defaultValue) { return config.getDouble(key, defaultValue); }
/** * Delegates to the underlying configuration. */ @Override public Double getDouble(String key, Double defaultValue) { return config.getDouble(key, defaultValue); }
/** * Delegates to the underlying configuration. */ @Override public Double getDouble(String key, Double defaultValue) { return config.getDouble(key, defaultValue); }
@Override public double getDouble(final String key) { return delegate.getDouble(key); }
@Override public double getDouble(final String key, final double defaultValue) { return delegate.getDouble(key, defaultValue); }
@Override public Double readValue(String name, Double defValue) { return config().getDouble(name, defValue); } }
@Override public Double getDouble(final String key, final Double defaultValue) { return delegate.getDouble(key, defaultValue); }
public double getDouble(String key, double defaultValue) { try { return configuration.getDouble(key, defaultValue); } catch (Exception e) { log.info("Return default value '{}' for '{}' because of '{}'", defaultValue, key , e.toString()); return defaultValue; } }
@Override @Nullable public Double resolve( @Nonnull Configuration configuration, @Nonnull String key ) { return configuration.getDouble( key ); }
public double getDouble(String key) { try { return configuration.getDouble(key); } catch (NoSuchElementException e) { log.info("Return '0D' for '{}' because of '{}'", key , e.toString()); return 0D; } }
@Override @Nullable public Double resolve( @NotNull Configuration configuration, @NotNull @NonNls String key ) { return configuration.getDouble( key ); }
@Override public void configure(Configuration conf) throws ConfigurationException { super.configure(conf); dateFormat = conf.getString(DATE_FORMAT, "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"); sample = conf.getDouble(SAMPLE, 0.01); Validate.notBlank(dateFormat); validateDateFormat(); }
@Override public void init(Configuration config) throws ConfigurationException { setSpamdHost(config.getString("spamdHost", "localhost")); setSpamdPort(config.getInt("spamdPort", 783)); setSpamdRejectionHits(config.getDouble("spamdRejectionHits", 0.0)); }
/** * Retrieve the setting from the configuration <tt>conf</tt> as a {@link Double} value. * * @param conf configuration to retrieve the setting * @return the value as a double number */ public double getDouble(Configuration conf) { checkArgument(type() == Type.DOUBLE, "'" + name() + "' is NOT a DOUBLE numeric setting"); return conf.getDouble(name(), (Double) defaultValue()); }
@Override public void loadState(final Configuration configuration) { this.traversalSupplier = LambdaHolder.loadState(configuration, INCIDENT_TRAVERSAL_SUPPLIER); if (null != this.traversalSupplier) { VertexProgramHelper.verifyReversibility(this.traversalSupplier.get().get().asAdmin()); this.incidentMessageScope = MessageScope.Local.of(this.traversalSupplier.get()); this.countMessageScope = MessageScope.Local.of(new MessageScope.Local.ReverseTraversalSupplier(this.incidentMessageScope)); } this.vertexCountAsDouble = configuration.getDouble(VERTEX_COUNT, 1.0d); this.alpha = configuration.getDouble(ALPHA, 0.85d); this.totalIterations = configuration.getInt(TOTAL_ITERATIONS, 30); }