本文整理匯總了Java中com.typesafe.config.Config.getBoolean方法的典型用法代碼示例。如果您正苦於以下問題:Java Config.getBoolean方法的具體用法?Java Config.getBoolean怎麽用?Java Config.getBoolean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.typesafe.config.Config
的用法示例。
在下文中一共展示了Config.getBoolean方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: RelationExtractionRunner
import com.typesafe.config.Config; //導入方法依賴的package包/類
public RelationExtractionRunner(Config config) {
// load boolean values
this.exploitCore = config.getBoolean("exploit-core");
this.exploitContexts = config.getBoolean("exploit-contexts");
this.separateNounBased = config.getBoolean("separate-noun-based");
this.separatePurposes = config.getBoolean("separate-purposes");
this.separateAttributions = config.getBoolean("separate-attributions");
// instantiate extractor
String extractorClassName = config.getString("relation-extractor");
try {
Class<?> extractorClass = Class.forName(extractorClassName);
Constructor<?> extractorConst = extractorClass.getConstructor();
this.extractor = (RelationExtractor) extractorConst.newInstance();
} catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException | ClassNotFoundException e) {
logger.error("Failed to create instance of {}", extractorClassName);
throw new ConfigException.BadValue("relation-extractor." + extractorClassName, "Failed to create instance.");
}
this.elementCoreExtractionMap = new LinkedHashMap<>();
}
示例2: ALSUpdate
import com.typesafe.config.Config; //導入方法依賴的package包/類
public ALSUpdate(Config config) {
super(config);
iterations = config.getInt("oryx.als.iterations");
implicit = config.getBoolean("oryx.als.implicit");
logStrength = config.getBoolean("oryx.als.logStrength");
Preconditions.checkArgument(iterations > 0);
hyperParamValues = new ArrayList<>(Arrays.asList(
HyperParams.fromConfig(config, "oryx.als.hyperparams.features"),
HyperParams.fromConfig(config, "oryx.als.hyperparams.lambda"),
HyperParams.fromConfig(config, "oryx.als.hyperparams.alpha")));
if (logStrength) {
hyperParamValues.add(HyperParams.fromConfig(config, "oryx.als.hyperparams.epsilon"));
}
noKnownItems = config.getBoolean("oryx.als.no-known-items");
decayFactor = config.getDouble("oryx.als.decay.factor");
decayZeroThreshold = config.getDouble("oryx.als.decay.zero-threshold");
Preconditions.checkArgument(iterations > 0);
Preconditions.checkArgument(decayFactor > 0.0 && decayFactor <= 1.0);
Preconditions.checkArgument(decayZeroThreshold >= 0.0);
}
示例3: DataParams
import com.typesafe.config.Config; //導入方法依賴的package包/類
public DataParams(Config config, String prefix) {
train = new Train(config, prefix + KEY);
test = new Test(config, prefix + KEY);
delim = new Delim(config, prefix + KEY);
y_sampling = config.getStringList(prefix + KEY + "y_sampling");
assigned = config.getBoolean(prefix + KEY + "assigned");
unassigned_mode = UnassignedMode.getMode(config.getString(prefix + KEY + "unassigned_mode"));
for (String s : y_sampling) {
CheckUtils.check(s.matches("\\[email protected](-?\\d+)(\\.\\d+)?"),
"%sy_sampling:%s must be the format of [email protected] e.g [email protected]#0.1",
prefix + KEY, s);
}
CheckUtils.check(unassigned_mode != UnassignedMode.UNKNOWN,
"unknown %sunassigned_mode:%s, only support:%s",
prefix + KEY, unassigned_mode.toString(), UnassignedMode.allToString());
}
示例4: LossParams
import com.typesafe.config.Config; //導入方法依賴的package包/類
public LossParams(Config config, String prefix) {
loss_function = config.getString(prefix + KEY + "loss_function");
regularization = new Regularization(config, prefix + KEY);
evaluate_metric = config.getStringList(prefix + KEY + "evaluate_metric");
just_evaluate = config.getBoolean(prefix + KEY + "just_evaluate");
for (String metric : evaluate_metric) {
if (!EvaluatorFactory.EvalNameSet.contains(metric)) {
boolean hit = false;
for (String eval : EvaluatorFactory.EvalNameSet) {
if (metric.startsWith(eval)) {
hit = true;
}
}
CheckUtils.check(hit, "%sevaluate_metric:%s, only support:%s",
prefix + KEY, metric, EvaluatorFactory.EvalNameSet);
}
}
}
示例5: DataFlow
import com.typesafe.config.Config; //導入方法依賴的package包/類
public DataFlow(IFileSystem fs,
Config config,
ThreadCommSlave comm,
int threadNum,
boolean needPyTransform,
String pyTransformScript
) throws IOException {
this.config = config;
this.fs = fs;
this.comm = comm;
this.rank = comm.getRank();
this.slaveNum = comm.getSlaveNum();
this.threadNum = threadNum;
this.LOG_UTILS = new LogUtils(comm, config.getBoolean("verbose"));
this.needPyTransform = needPyTransform;
this.pyTransformFunc = DataUtils.getTranformFunction(needPyTransform, pyTransformScript);
this.threadTrainCoreDatas = new CoreData[threadNum];
this.threadTestCoreDatas = new CoreData[threadNum];
if (threadNum > MAX_THREAD_NUM) {
throw new YtkLearnException("thread number=" + threadNum + " is too large! please reset!");
}
}
示例6: MetricServiceConfiguration
import com.typesafe.config.Config; //導入方法依賴的package包/類
@Inject
public MetricServiceConfiguration(Config config) {
if (config.hasPath("metrics")) {
final Config metrics = config.getConfig("metrics");
this.enableLog = metrics.hasPath("enable-logging") && metrics.getBoolean("enable-logging");
if (metrics.hasPath("log-duration")) {
this.reportDuration = new Duration(metrics.getDuration("log-duration", TimeUnit.MILLISECONDS));
}
}
}
示例7: MemoryReporterServiceConfiguration
import com.typesafe.config.Config; //導入方法依賴的package包/類
@Inject
public MemoryReporterServiceConfiguration(final Config config) {
if (config.hasPath("debug")) {
final Config debug = config.getConfig("debug");
if (debug.hasPath("memory-reporter")) {
this.enable = debug.getBoolean("memory-reporter");
}
if (debug.hasPath("memory-reporter-interval")) {
this.interval = debug.getDuration("memory-reporter-interval", TimeUnit.MILLISECONDS);
}
}
}
示例8: XConfig
import com.typesafe.config.Config; //導入方法依賴的package包/類
/**
* Construct a config object using the provided configuration, falling back on the default
* configuration values <a
* href="https://github.com/Nordstrom/xrpc/blob/master/src/main/resources/com/nordstrom/xrpc/xrpc.conf">here</a>.
*/
public XConfig(Config configOverrides) {
Config defaultConfig = ConfigFactory.parseResources(this.getClass(), "xrpc.conf");
Config config = configOverrides.withFallback(defaultConfig);
readerIdleTimeout = config.getInt("reader_idle_timeout_seconds");
writerIdleTimeout = config.getInt("writer_idle_timeout_seconds");
allIdleTimeout = config.getInt("all_idle_timeout_seconds");
workerNameFormat = config.getString("worker_name_format");
bossThreadCount = config.getInt("boss_thread_count");
workerThreadCount = config.getInt("worker_thread_count");
maxConnections = config.getInt("max_connections");
rateLimiterPoolSize = config.getInt("rate_limiter_pool_size");
softReqPerSec = config.getDouble("soft_req_per_sec");
hardReqPerSec = config.getDouble("hard_req_per_sec");
gloablSoftReqPerSec = config.getDouble("global_soft_req_per_sec");
globalHardReqPerSec = config.getDouble("global_hard_req_per_sec");
cert = config.getString("cert");
key = config.getString("key");
port = config.getInt("server.port");
slf4jReporter = config.getBoolean("slf4j_reporter");
jmxReporter = config.getBoolean("jmx_reporter");
consoleReporter = config.getBoolean("console_reporter");
slf4jReporterPollingRate = config.getInt("slf4j_reporter_polling_rate");
consoleReporterPollingRate = config.getInt("console_reporter_polling_rate");
enableWhiteList = config.getBoolean("enable_white_list");
enableBlackList = config.getBoolean("enable_black_list");
ipBlackList =
ImmutableSet.<String>builder().addAll(config.getStringList("ip_black_list")).build();
ipWhiteList =
ImmutableSet.<String>builder().addAll(config.getStringList("ip_white_list")).build();
populateClientOverrideList(config.getObjectList("req_per_second_override"));
}
示例9: getRpcModules
import com.typesafe.config.Config; //導入方法依賴的package包/類
public List<ModuleDescription> getRpcModules() {
if (this.moduleDescriptions != null) {
return this.moduleDescriptions;
}
List<ModuleDescription> modules = new ArrayList<>();
if (!configFromFiles.hasPath("rpc.modules")) {
return modules;
}
List<? extends ConfigObject> list = configFromFiles.getObjectList("rpc.modules");
for (ConfigObject configObject : list) {
Config configElement = configObject.toConfig();
String name = configElement.getString("name");
String version = configElement.getString("version");
boolean enabled = configElement.getBoolean("enabled");
List<String> enabledMethods = null;
List<String> disabledMethods = null;
if (configElement.hasPath("methods.enabled")) {
enabledMethods = configElement.getStringList("methods.enabled");
}
if (configElement.hasPath("methods.disabled")) {
disabledMethods = configElement.getStringList("methods.disabled");
}
modules.add(new ModuleDescription(name, version, enabled, enabledMethods, disabledMethods));
}
this.moduleDescriptions = modules;
return modules;
}
示例10: apply
import com.typesafe.config.Config; //導入方法依賴的package包/類
/**
* @param actorSystem akka actor system
* @return return the configured ignite properties for the plugin
*/
@Override
public IgniteProperties apply(ActorSystem actorSystem) {
final Config config = actorSystem.settings().config();
if (config.getInt( PropertiesNames.ASYNC_THREADS.getPropertyName()) != 0) {
igniteProperties.setAsyncCallbackPoolSize(config
.getInt( PropertiesNames.ASYNC_THREADS.getPropertyName()));
}
if (config.getInt( PropertiesNames.DATA_STREAMER_THREADS.getPropertyName()) != 0) {
igniteProperties.setDataStreamerThreadPoolSize(config
.getInt( PropertiesNames.DATA_STREAMER_THREADS.getPropertyName()));
}
if (config.getInt( PropertiesNames.MANAGEMENT_THREADS.getPropertyName()) != 0) {
igniteProperties.setManagementThreadPoolSize(config
.getInt( PropertiesNames.MANAGEMENT_THREADS.getPropertyName()));
}
if (config.getInt( PropertiesNames.PUBLIC_THREADS.getPropertyName()) != 0) {
igniteProperties.setPublicThreadPoolSize(config
.getInt( PropertiesNames.PUBLIC_THREADS.getPropertyName()));
}
if (config.getInt( PropertiesNames.SYSTEM_THREADS.getPropertyName()) != 0) {
igniteProperties.setSystemThreadPoolSize(config
.getInt( PropertiesNames.SYSTEM_THREADS.getPropertyName()));
}
if (config.getInt( PropertiesNames.QUERY_THREADS.getPropertyName()) != 0) {
igniteProperties.setQueryThreadPoolSize(config
.getInt( PropertiesNames.QUERY_THREADS.getPropertyName()));
}
if (config.getInt( PropertiesNames.REBALANCE_THREADS.getPropertyName()) != 0) {
igniteProperties.setRebalanceThreadPoolSize(config
.getInt( PropertiesNames.REBALANCE_THREADS.getPropertyName()));
}
if (config.getInt( PropertiesNames.METRICS_LOG_FREQUENCY.getPropertyName()) > 0) {
igniteProperties.setMetricsLogFrequency(config
.getInt( PropertiesNames.METRICS_LOG_FREQUENCY.getPropertyName()));
}
if (config.getInt( PropertiesNames.IGNITE_CONNECTOR_PORT.getPropertyName()) != 0) {
igniteProperties.setIgniteConnectorPort(config
.getInt( PropertiesNames.IGNITE_CONNECTOR_PORT.getPropertyName()));
}
if (!StringUtils.isEmpty(config.getString( PropertiesNames.IGNITE_PERSISTANCE_FILE_PATH.getPropertyName()))) {
igniteProperties.setIgnitePersistenceFilePath(config
.getString( PropertiesNames.IGNITE_PERSISTANCE_FILE_PATH.getPropertyName()));
}
if (!StringUtils.isEmpty(config.getString( PropertiesNames.IGNITE_SERVER_PORT_RANGE.getPropertyName()))) {
igniteProperties.setIgniteServerPortRange(config
.getString( PropertiesNames.IGNITE_SERVER_PORT_RANGE.getPropertyName()));
}
if (!StringUtils.isEmpty(config.getString( PropertiesNames.TCP_DISCOVERY_ADDRESSES.getPropertyName()))) {
igniteProperties.setTcpDiscoveryAddresses(config
.getString( PropertiesNames.TCP_DISCOVERY_ADDRESSES.getPropertyName()));
}
if (config.getBoolean( PropertiesNames.IS_CLIENT_NODE.getPropertyName())) {
igniteProperties.setClientNode(config.getBoolean( PropertiesNames.IS_CLIENT_NODE.getPropertyName()));
}
if (config.getBoolean( PropertiesNames.ENABLE_FILE_PERSISTANCE.getPropertyName())) {
igniteProperties.setEnableFilePersistence(config
.getBoolean( PropertiesNames.ENABLE_FILE_PERSISTANCE.getPropertyName()));
}
if (config.getBoolean( PropertiesNames.PEER_CLASS_LOADING.getPropertyName())) {
igniteProperties.setPeerClassLoadingEnabled(config
.getBoolean( PropertiesNames.PEER_CLASS_LOADING.getPropertyName()));
}
return igniteProperties;
}
示例11: ModelParams
import com.typesafe.config.Config; //導入方法依賴的package包/類
public ModelParams(Config config, String prefix) {
data_path = config.getString(prefix + KEY + "data_path");
delim = config.getString(prefix + KEY + "delim");
need_dict = config.getBoolean(prefix + KEY + "need_dict");
dict_path = config.getString(prefix + KEY + "dict_path");
dump_freq = config.getInt(prefix + KEY + "dump_freq");
need_bias = config.getBoolean(prefix + KEY + "need_bias");
bias_feature_name = config.getString(prefix + KEY + "bias_feature_name");
continue_train = config.getBoolean(prefix + KEY + "continue_train");
}
示例12: HyperParams
import com.typesafe.config.Config; //導入方法依賴的package包/類
public HyperParams(Config config, String prefix) {
switch_on = config.getBoolean(prefix + KEY + "switch_on");
restart = config.getBoolean(prefix + KEY + "restart");
mode = Mode.getMode(config.getString(prefix + KEY + "mode"));
hoag = new Hoag(config, prefix + KEY);
grid = new Grid(config, prefix + KEY);
CheckUtils.check(mode != Mode.UNKNOWN, "unknown %smode:%s, only support:%s",
prefix + KEY, mode, Mode.allToString());
}
示例13: GBMLRDataFlow
import com.typesafe.config.Config; //導入方法依賴的package包/類
public GBMLRDataFlow(IFileSystem fs,
Config config,
ThreadCommSlave comm,
int threadNum,
boolean needPyTransform,
String pyTransformScript) throws Exception {
super(fs, config,
comm,
threadNum,
needPyTransform,
pyTransformScript);
this.K = config.getInt("k");
//this.seed = config.getInt("seed");
this.randomSampleRate = config.getDouble("instance_sample_rate");
this.randomFeatureRate = config.getDouble("feature_sample_rate");
this.uniformBaseScore = (float) LossFunctions.createLossFunction(commonParams.lossParams.loss_function).
pred2Score(config.getDouble("uniform_base_prediction"));
this.sampleDepdtBaseScore = config.getBoolean("sample_dependent_base_prediction");
this.treeNum = config.getInt("tree_num");
this.learningRate = config.getDouble("learning_rate");
this.randomParams = new RandomParams(config, "");
this.type = Type.getType(config.getString("type"));
if (type == Type.RF) {
this.learningRate = 1.0;
}
CheckUtils.check(K >= 2, "K:%d must >= 2", K);
LOG_UTILS.importantInfo("K:" + K);
//comm.LOG_UTILS.importantInfo("seed:" + seed);
LOG_UTILS.importantInfo("random:" + randomParams);
LOG_UTILS.importantInfo("instance_sample_rate:" + randomSampleRate);
LOG_UTILS.importantInfo("feature_sample_rate:" + randomFeatureRate);
LOG_UTILS.importantInfo("uniform_base_prediction:" + uniformBaseScore);
LOG_UTILS.importantInfo("tree_num:" + treeNum);
LOG_UTILS.importantInfo("learning_rate:" + learningRate);
LOG_UTILS.importantInfo("type:" + type);
}
示例14: GBDTModelParams
import com.typesafe.config.Config; //導入方法依賴的package包/類
public GBDTModelParams(Config config, String prefix) {
data_path = config.getString(prefix + KEY + "data_path");
need_dict = config.getBoolean(prefix + KEY + "need_dict");
dict_path = config.getString(prefix + KEY + "dict_path");
dump_freq = config.getInt(prefix + KEY + "dump_freq");
// do not dump
if (dump_freq == -1) {
dump_freq = Integer.MAX_VALUE;
}
continue_train = config.getBoolean(prefix + KEY + "continue_train");
feature_importance_path = config.getString(prefix + KEY + "feature_importance_path");
checkParams();
}
示例15: FMModelDataFlow
import com.typesafe.config.Config; //導入方法依賴的package包/類
public FMModelDataFlow(IFileSystem fs,
Config config,
ThreadCommSlave comm,
int threadNum,
boolean needPyTransform,
String pyTransformScript) throws Exception {
super(fs, config,
comm,
threadNum,
needPyTransform,
pyTransformScript);
List<Integer> klist = config.getIntList("k");
K = new int[klist.size()];
for (int i = 0; i < klist.size(); i++) {
K[i] = klist.get(i);
}
//seed = config.getInt("seed");
randomParams = new RandomParams(config, "");
biasNeedLatentFactor = config.getBoolean("bias_need_latent_factor");
needFirstOrder = (K[0] >= 1);
needSecondOrder = (K[1] >= 1);
LOG_UTILS.importantInfo("K:" + Arrays.toString(K));
//comm.LOG_UTILS.importantInfo("seed:" + seed);
LOG_UTILS.importantInfo("random:" + randomParams);
LOG_UTILS.importantInfo("bias_need_latent_factor:" + biasNeedLatentFactor);
LOG_UTILS.importantInfo("need_first_order:" + needFirstOrder + ", need_second_order:" + needSecondOrder);
}