file_id
int64 1
215k
| content
stringlengths 7
454k
| repo
stringlengths 6
113
| path
stringlengths 6
251
|
---|---|---|---|
212,988 | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.ml.aggs.changepoint;
import org.elasticsearch.xpack.ml.aggs.MlAggsHelper;
import java.util.Arrays;
/**
* Detects spikes and dips in a time series.
*/
final class SpikeAndDipDetector {
private record SpikeOrDip(int index, int startExcluded, int endExcluded) {
double value(double[] values) {
return values[index];
}
boolean includes(int i) {
return i >= startExcluded && i < endExcluded;
}
}
private int argmax(double[] values, int start, int end, boolean negate) {
int argmax = 0;
double max = negate ? -values[0] : values[0];
for (int i = 1; i < values.length; i++) {
double value = negate ? -values[i] : values[i];
if (value > max) {
argmax = i;
max = value;
}
}
return argmax;
}
private double sum(double[] values, int start, int end, boolean negate) {
double sum = 0.0;
for (int i = start; i < end; i++) {
sum += values[i];
}
return negate ? -sum : sum;
}
private SpikeOrDip findSpikeOrDip(double[] values, int extent, boolean negate) {
extent = Math.min(extent, values.length - 1);
final int argmax = argmax(values, 0, values.length, negate);
// Find the maximum average interval of width extent which includes argmax.
int maxStart = Math.max(0, argmax + 1 - extent);
int maxEnd = Math.min(maxStart + extent, values.length);
double maxSum = sum(values, maxStart, maxEnd, negate);
for (int start = maxStart + 1; start <= argmax; start++) {
if (start + extent >= values.length) {
break;
}
double average = sum(values, start, start + extent, negate);
if (average > maxSum) {
maxStart = start;
maxSum = average;
}
}
return new SpikeOrDip(argmax, maxStart, maxStart + extent);
}
private interface ExcludedPredicate {
boolean exclude(int index);
}
private double[] removeIf(ExcludedPredicate should, double[] values) {
int numKept = 0;
for (int i = 0; i < values.length; i++) {
if (should.exclude(i) == false) {
numKept++;
}
}
double[] newValues = new double[numKept];
int j = 0;
for (int i = 0; i < values.length; i++) {
if (should.exclude(i) == false) {
newValues[j++] = values[i];
}
}
return newValues;
}
private final int numValues;
private final int dipIndex;
private final int spikeIndex;
private final double dipValue;
private final double spikeValue;
private final KDE spikeTestKDE;
private final KDE dipTestKDE;
SpikeAndDipDetector(double[] values) {
numValues = values.length;
if (values.length < 4) {
dipIndex = -1;
spikeIndex = -1;
dipValue = Double.NaN;
spikeValue = Double.NaN;
spikeTestKDE = null;
dipTestKDE = null;
return;
}
// Usually roughly 10% of values.
int spikeLength = Math.max((int) (0.1 * values.length + 0.5), 2) - 1;
SpikeOrDip dip = findSpikeOrDip(values, spikeLength, true);
SpikeOrDip spike = findSpikeOrDip(values, spikeLength, false);
dipIndex = dip.index();
spikeIndex = spike.index();
dipValue = dip.value(values);
spikeValue = spike.value(values);
double[] dipKDEValues = removeIf((i) -> (dip.includes(i) || i == spike.index()), values);
double[] spikeKDEValues = removeIf((i) -> (spike.includes(i) || i == dip.index()), values);
Arrays.sort(dipKDEValues);
Arrays.sort(spikeKDEValues);
// We purposely over smooth to only surface visually significant spikes and dips.
dipTestKDE = new KDE(dipKDEValues, 1.36);
spikeTestKDE = new KDE(spikeKDEValues, 1.36);
}
ChangeType at(double pValueThreshold, MlAggsHelper.DoubleBucketValues bucketValues) {
if (dipIndex == -1 || spikeIndex == -1) {
return new ChangeType.Indeterminable(
"not enough buckets to check for dip or spike. Requires at least [3]; found [" + numValues + "]"
);
}
KDE.ValueAndMagnitude dipLeftTailTest = dipTestKDE.cdf(dipValue);
KDE.ValueAndMagnitude spikeRightTailTest = spikeTestKDE.sf(spikeValue);
double dipPValue = dipLeftTailTest.pValue(numValues);
double spikePValue = spikeRightTailTest.pValue(numValues);
if (dipPValue < pValueThreshold && spikePValue < pValueThreshold) {
if (dipLeftTailTest.isMoreSignificant(spikeRightTailTest)) {
return new ChangeType.Dip(dipPValue, bucketValues.getBucketIndex(dipIndex));
}
return new ChangeType.Spike(spikePValue, bucketValues.getBucketIndex(spikeIndex));
}
if (dipPValue < pValueThreshold) {
return new ChangeType.Dip(dipPValue, bucketValues.getBucketIndex(dipIndex));
}
if (spikePValue < pValueThreshold) {
return new ChangeType.Spike(spikePValue, bucketValues.getBucketIndex(spikeIndex));
}
return new ChangeType.Stationary();
}
double dipValue() {
return dipValue;
}
double spikeValue() {
return spikeValue;
}
KDE spikeTestKDE() {
return spikeTestKDE;
}
KDE dipTestKDE() {
return dipTestKDE;
}
}
| elastic/elasticsearch | x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/aggs/changepoint/SpikeAndDipDetector.java |
212,989 | /**
* Copyright (C) 2011 Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.thoughtcrime.securesms;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.service.KeyCachingService;
/**
* Base Activity for changing/prompting local encryption passphrase.
*
* @author Moxie Marlinspike
*/
public abstract class PassphraseActivity extends BaseActivity {
private static final String TAG = Log.tag(PassphraseActivity.class);
private KeyCachingService keyCachingService;
private MasterSecret masterSecret;
protected void setMasterSecret(MasterSecret masterSecret) {
this.masterSecret = masterSecret;
Intent bindIntent = new Intent(this, KeyCachingService.class);
startService(bindIntent);
bindService(bindIntent, serviceConnection, Context.BIND_AUTO_CREATE);
}
protected abstract void cleanup();
private ServiceConnection serviceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className, IBinder service) {
keyCachingService = ((KeyCachingService.KeySetBinder)service).getService();
keyCachingService.setMasterSecret(masterSecret);
PassphraseActivity.this.unbindService(PassphraseActivity.this.serviceConnection);
masterSecret = null;
cleanup();
Intent nextIntent = getIntent().getParcelableExtra("next_intent");
if (nextIntent != null) {
try {
startActivity(nextIntent);
} catch (java.lang.SecurityException e) {
Log.w(TAG, "Access permission not passed from PassphraseActivity, retry sharing.");
}
}
finish();
}
@Override
public void onServiceDisconnected(ComponentName name) {
keyCachingService = null;
}
};
}
| signalapp/Signal-Android | app/src/main/java/org/thoughtcrime/securesms/PassphraseActivity.java |
212,990 | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.security;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.RefCountingListener;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.Maps;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.protocol.xpack.XPackUsageRequest;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.RemoteClusterPortSettings;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction;
import org.elasticsearch.xpack.core.action.XPackUsageFeatureResponse;
import org.elasticsearch.xpack.core.action.XPackUsageFeatureTransportAction;
import org.elasticsearch.xpack.core.security.SecurityFeatureSetUsage;
import org.elasticsearch.xpack.core.security.user.AnonymousUser;
import org.elasticsearch.xpack.security.audit.logfile.LoggingAuditTrail;
import org.elasticsearch.xpack.security.authc.ApiKeyService;
import org.elasticsearch.xpack.security.authc.Realms;
import org.elasticsearch.xpack.security.authc.support.mapper.NativeRoleMappingStore;
import org.elasticsearch.xpack.security.authz.store.CompositeRolesStore;
import org.elasticsearch.xpack.security.operator.OperatorPrivileges;
import org.elasticsearch.xpack.security.profile.ProfileService;
import org.elasticsearch.xpack.security.transport.filter.IPFilter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import static java.util.Collections.singletonMap;
import static org.elasticsearch.xpack.core.XPackSettings.API_KEY_SERVICE_ENABLED_SETTING;
import static org.elasticsearch.xpack.core.XPackSettings.FIPS_MODE_ENABLED;
import static org.elasticsearch.xpack.core.XPackSettings.HTTP_SSL_ENABLED;
import static org.elasticsearch.xpack.core.XPackSettings.REMOTE_CLUSTER_CLIENT_SSL_ENABLED;
import static org.elasticsearch.xpack.core.XPackSettings.REMOTE_CLUSTER_SERVER_SSL_ENABLED;
import static org.elasticsearch.xpack.core.XPackSettings.TOKEN_SERVICE_ENABLED_SETTING;
import static org.elasticsearch.xpack.core.XPackSettings.TRANSPORT_SSL_ENABLED;
import static org.elasticsearch.xpack.security.Security.ADVANCED_REMOTE_CLUSTER_SECURITY_FEATURE;
public class SecurityUsageTransportAction extends XPackUsageFeatureTransportAction {
private final Settings settings;
private final XPackLicenseState licenseState;
private final Realms realms;
private final CompositeRolesStore rolesStore;
private final NativeRoleMappingStore roleMappingStore;
private final IPFilter ipFilter;
private final ProfileService profileService;
private final ApiKeyService apiKeyService;
@Inject
public SecurityUsageTransportAction(
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver,
Settings settings,
XPackLicenseState licenseState,
SecurityUsageServices securityServices
) {
super(
XPackUsageFeatureAction.SECURITY.name(),
transportService,
clusterService,
threadPool,
actionFilters,
indexNameExpressionResolver
);
this.settings = settings;
this.licenseState = licenseState;
this.realms = securityServices.realms;
this.rolesStore = securityServices.rolesStore;
this.roleMappingStore = securityServices.roleMappingStore;
this.ipFilter = securityServices.ipFilter;
this.profileService = securityServices.profileService;
this.apiKeyService = securityServices.apiKeyService;
}
@Override
protected void masterOperation(
Task task,
XPackUsageRequest request,
ClusterState state,
ActionListener<XPackUsageFeatureResponse> listener
) {
Map<String, Object> sslUsage = sslUsage(settings);
Map<String, Object> tokenServiceUsage = tokenServiceUsage(settings);
Map<String, Object> apiKeyServiceUsage = apiKeyServiceUsage(settings);
Map<String, Object> auditUsage = auditUsage(settings);
Map<String, Object> ipFilterUsage = ipFilterUsage(ipFilter);
Map<String, Object> anonymousUsage = singletonMap("enabled", AnonymousUser.isAnonymousEnabled(settings));
Map<String, Object> fips140Usage = fips140Usage(settings);
Map<String, Object> operatorPrivilegesUsage = Map.of(
"available",
Security.OPERATOR_PRIVILEGES_FEATURE.checkWithoutTracking(licenseState),
"enabled",
OperatorPrivileges.OPERATOR_PRIVILEGES_ENABLED.get(settings)
);
final AtomicReference<Map<String, Object>> rolesUsageRef = new AtomicReference<>(Map.of());
final AtomicReference<Map<String, Object>> roleMappingUsageRef = new AtomicReference<>(Map.of());
final AtomicReference<Map<String, Object>> realmsUsageRef = new AtomicReference<>(Map.of());
final AtomicReference<Map<String, Object>> domainsUsageRef = new AtomicReference<>(Map.of());
final AtomicReference<Map<String, Object>> userProfileUsageRef = new AtomicReference<>(Map.of());
final AtomicReference<Map<String, Object>> remoteClusterServerUsageRef = new AtomicReference<>(Map.of());
final boolean enabled = XPackSettings.SECURITY_ENABLED.get(settings);
try (
var listeners = new RefCountingListener(
listener.map(
ignored -> new XPackUsageFeatureResponse(
new SecurityFeatureSetUsage(
enabled,
realmsUsageRef.get(),
rolesUsageRef.get(),
roleMappingUsageRef.get(),
sslUsage,
auditUsage,
ipFilterUsage,
anonymousUsage,
tokenServiceUsage,
apiKeyServiceUsage,
fips140Usage,
operatorPrivilegesUsage,
domainsUsageRef.get(),
userProfileUsageRef.get(),
remoteClusterServerUsageRef.get()
)
)
)
)
) {
if (enabled == false) {
return;
}
if (rolesStore != null) {
rolesStore.usageStats(listeners.acquire(rolesUsageRef::set));
}
if (roleMappingStore != null) {
roleMappingStore.usageStats(
listeners.acquire(nativeRoleMappingStoreUsage -> roleMappingUsageRef.set(Map.of("native", nativeRoleMappingStoreUsage)))
);
}
if (realms != null) {
domainsUsageRef.set(realms.domainUsageStats());
realms.usageStats(listeners.acquire(realmsUsageRef::set));
}
if (profileService != null) {
profileService.usageStats(listeners.acquire(userProfileUsageRef::set));
}
if (apiKeyService != null) {
apiKeyService.crossClusterApiKeyUsageStats(
listeners.acquire(
usage -> remoteClusterServerUsageRef.set(
Map.of(
"available",
ADVANCED_REMOTE_CLUSTER_SECURITY_FEATURE.checkWithoutTracking(licenseState),
"enabled",
RemoteClusterPortSettings.REMOTE_CLUSTER_SERVER_ENABLED.get(settings),
"api_keys",
usage
)
)
)
);
}
}
}
static Map<String, Object> sslUsage(Settings settings) {
// If security has been explicitly disabled in the settings, then SSL is also explicitly disabled, and we don't want to report
// these http/transport settings as they would be misleading (they could report `true` even though they were ignored)
if (XPackSettings.SECURITY_ENABLED.get(settings)) {
Map<String, Object> map = Maps.newMapWithExpectedSize(2);
map.put("http", singletonMap("enabled", HTTP_SSL_ENABLED.get(settings)));
map.put("transport", singletonMap("enabled", TRANSPORT_SSL_ENABLED.get(settings)));
if (RemoteClusterPortSettings.REMOTE_CLUSTER_SERVER_ENABLED.get(settings)) {
map.put("remote_cluster_server", singletonMap("enabled", REMOTE_CLUSTER_SERVER_SSL_ENABLED.get(settings)));
}
map.put("remote_cluster_client", singletonMap("enabled", REMOTE_CLUSTER_CLIENT_SSL_ENABLED.get(settings)));
return map;
} else {
return Collections.emptyMap();
}
}
static Map<String, Object> tokenServiceUsage(Settings settings) {
return singletonMap("enabled", TOKEN_SERVICE_ENABLED_SETTING.get(settings));
}
static Map<String, Object> apiKeyServiceUsage(Settings settings) {
return singletonMap("enabled", API_KEY_SERVICE_ENABLED_SETTING.get(settings));
}
static Map<String, Object> auditUsage(Settings settings) {
Map<String, Object> map = Maps.newMapWithExpectedSize(2);
map.put("enabled", XPackSettings.AUDIT_ENABLED.get(settings));
if (XPackSettings.AUDIT_ENABLED.get(settings)) {
// the only available output type is "logfile", but the optputs=<list> is to keep compatibility with previous reporting format
map.put("outputs", Arrays.asList(LoggingAuditTrail.NAME));
}
return map;
}
static Map<String, Object> ipFilterUsage(@Nullable IPFilter ipFilter) {
if (ipFilter == null) {
return IPFilter.DISABLED_USAGE_STATS;
}
return ipFilter.usageStats();
}
static Map<String, Object> fips140Usage(Settings settings) {
return singletonMap("enabled", FIPS_MODE_ENABLED.get(settings));
}
}
| elastic/elasticsearch | x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/SecurityUsageTransportAction.java |
212,991 | /*
* JBoss, Home of Professional Open Source
* Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
* contributors by the @authors tag. See the copyright.txt in the
* distribution for a full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package baeldung.model;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;
import javax.persistence.*;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@SuppressWarnings("serial")
@Entity
@XmlRootElement
@Table(uniqueConstraints = @UniqueConstraint(columnNames = "email"))
public class Member implements Serializable {
@Id
@GeneratedValue
private Long id;
@NotNull
@Size(min = 1, max = 25)
@Pattern(regexp = "[^0-9]*", message = "Must not contain numbers")
private String name;
@NotNull
@NotEmpty
@Email
private String email;
@NotNull
@Size(min = 10, max = 12)
@Digits(fraction = 0, integer = 12)
@Column(name = "phone_number")
private String phoneNumber;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
}
| eugenp/tutorials | persistence-modules/deltaspike/src/main/java/baeldung/model/Member.java |
212,992 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
import org.rocksdb.*;
import static java.nio.charset.StandardCharsets.UTF_8;
/**
* Demonstrates using Transactions on a TransactionDB with
* varying isolation guarantees
*/
public class TransactionSample {
private static final String dbPath = "/tmp/rocksdb_transaction_example";
public static final void main(final String args[]) throws RocksDBException {
try(final Options options = new Options()
.setCreateIfMissing(true);
final TransactionDBOptions txnDbOptions = new TransactionDBOptions();
final TransactionDB txnDb =
TransactionDB.open(options, txnDbOptions, dbPath)) {
try (final WriteOptions writeOptions = new WriteOptions();
final ReadOptions readOptions = new ReadOptions()) {
////////////////////////////////////////////////////////
//
// Simple Transaction Example ("Read Committed")
//
////////////////////////////////////////////////////////
readCommitted(txnDb, writeOptions, readOptions);
////////////////////////////////////////////////////////
//
// "Repeatable Read" (Snapshot Isolation) Example
// -- Using a single Snapshot
//
////////////////////////////////////////////////////////
repeatableRead(txnDb, writeOptions, readOptions);
////////////////////////////////////////////////////////
//
// "Read Committed" (Monotonic Atomic Views) Example
// --Using multiple Snapshots
//
////////////////////////////////////////////////////////
readCommitted_monotonicAtomicViews(txnDb, writeOptions, readOptions);
}
}
}
/**
* Demonstrates "Read Committed" isolation
*/
private static void readCommitted(final TransactionDB txnDb,
final WriteOptions writeOptions, final ReadOptions readOptions)
throws RocksDBException {
final byte key1[] = "abc".getBytes(UTF_8);
final byte value1[] = "def".getBytes(UTF_8);
final byte key2[] = "xyz".getBytes(UTF_8);
final byte value2[] = "zzz".getBytes(UTF_8);
// Start a transaction
try(final Transaction txn = txnDb.beginTransaction(writeOptions)) {
// Read a key in this transaction
byte[] value = txn.get(readOptions, key1);
assert(value == null);
// Write a key in this transaction
txn.put(key1, value1);
// Read a key OUTSIDE this transaction. Does not affect txn.
value = txnDb.get(readOptions, key1);
assert(value == null);
// Write a key OUTSIDE of this transaction.
// Does not affect txn since this is an unrelated key.
// If we wrote key 'abc' here, the transaction would fail to commit.
txnDb.put(writeOptions, key2, value2);
// Commit transaction
txn.commit();
}
}
/**
* Demonstrates "Repeatable Read" (Snapshot Isolation) isolation
*/
private static void repeatableRead(final TransactionDB txnDb,
final WriteOptions writeOptions, final ReadOptions readOptions)
throws RocksDBException {
final byte key1[] = "ghi".getBytes(UTF_8);
final byte value1[] = "jkl".getBytes(UTF_8);
// Set a snapshot at start of transaction by setting setSnapshot(true)
try(final TransactionOptions txnOptions = new TransactionOptions()
.setSetSnapshot(true);
final Transaction txn =
txnDb.beginTransaction(writeOptions, txnOptions)) {
final Snapshot snapshot = txn.getSnapshot();
// Write a key OUTSIDE of transaction
txnDb.put(writeOptions, key1, value1);
// Attempt to read a key using the snapshot. This will fail since
// the previous write outside this txn conflicts with this read.
readOptions.setSnapshot(snapshot);
try {
final byte[] value = txn.getForUpdate(readOptions, key1, true);
throw new IllegalStateException();
} catch(final RocksDBException e) {
assert(e.getStatus().getCode() == Status.Code.Busy);
}
txn.rollback();
} finally {
// Clear snapshot from read options since it is no longer valid
readOptions.setSnapshot(null);
}
}
/**
* Demonstrates "Read Committed" (Monotonic Atomic Views) isolation
*
* In this example, we set the snapshot multiple times. This is probably
* only necessary if you have very strict isolation requirements to
* implement.
*/
private static void readCommitted_monotonicAtomicViews(
final TransactionDB txnDb, final WriteOptions writeOptions,
final ReadOptions readOptions) throws RocksDBException {
final byte keyX[] = "x".getBytes(UTF_8);
final byte valueX[] = "x".getBytes(UTF_8);
final byte keyY[] = "y".getBytes(UTF_8);
final byte valueY[] = "y".getBytes(UTF_8);
try (final TransactionOptions txnOptions = new TransactionOptions()
.setSetSnapshot(true);
final Transaction txn =
txnDb.beginTransaction(writeOptions, txnOptions)) {
// Do some reads and writes to key "x"
Snapshot snapshot = txnDb.getSnapshot();
readOptions.setSnapshot(snapshot);
byte[] value = txn.get(readOptions, keyX);
txn.put(valueX, valueX);
// Do a write outside of the transaction to key "y"
txnDb.put(writeOptions, keyY, valueY);
// Set a new snapshot in the transaction
txn.setSnapshot();
txn.setSavePoint();
snapshot = txnDb.getSnapshot();
readOptions.setSnapshot(snapshot);
// Do some reads and writes to key "y"
// Since the snapshot was advanced, the write done outside of the
// transaction does not conflict.
value = txn.getForUpdate(readOptions, keyY, true);
txn.put(keyY, valueY);
// Decide we want to revert the last write from this transaction.
txn.rollbackToSavePoint();
// Commit.
txn.commit();
} finally {
// Clear snapshot from read options since it is no longer valid
readOptions.setSnapshot(null);
}
}
}
| XimalayaCloud/xcache | pika/third/rocksdb/java/samples/src/main/java/TransactionSample.java |
212,994 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.kafka.common.requests;
import org.apache.kafka.common.errors.UnsupportedVersionException;
import org.apache.kafka.common.network.Send;
import org.apache.kafka.common.protocol.ApiKeys;
import org.apache.kafka.common.protocol.Errors;
import org.apache.kafka.common.protocol.MessageUtil;
import org.apache.kafka.common.protocol.ObjectSerializationCache;
import org.apache.kafka.common.protocol.SendBuilder;
import java.nio.ByteBuffer;
import java.util.Map;
public abstract class AbstractRequest implements AbstractRequestResponse {
public static abstract class Builder<T extends AbstractRequest> {
private final ApiKeys apiKey;
private final short oldestAllowedVersion;
private final short latestAllowedVersion;
/**
* Construct a new builder which allows any supported version
*/
public Builder(ApiKeys apiKey, boolean enableUnstableLastVersion) {
this(apiKey, apiKey.oldestVersion(), apiKey.latestVersion(enableUnstableLastVersion));
}
/**
* Construct a new builder which allows any supported and released version
*/
public Builder(ApiKeys apiKey) {
this(apiKey, false);
}
/**
* Construct a new builder which allows only a specific version
*/
public Builder(ApiKeys apiKey, short allowedVersion) {
this(apiKey, allowedVersion, allowedVersion);
}
/**
* Construct a new builder which allows an inclusive range of versions
*/
public Builder(ApiKeys apiKey, short oldestAllowedVersion, short latestAllowedVersion) {
this.apiKey = apiKey;
this.oldestAllowedVersion = oldestAllowedVersion;
this.latestAllowedVersion = latestAllowedVersion;
}
public ApiKeys apiKey() {
return apiKey;
}
public short oldestAllowedVersion() {
return oldestAllowedVersion;
}
public short latestAllowedVersion() {
return latestAllowedVersion;
}
public T build() {
return build(latestAllowedVersion());
}
public abstract T build(short version);
}
private final short version;
private final ApiKeys apiKey;
public AbstractRequest(ApiKeys apiKey, short version) {
if (!apiKey.isVersionSupported(version))
throw new UnsupportedVersionException("The " + apiKey + " protocol does not support version " + version);
this.version = version;
this.apiKey = apiKey;
}
/**
* Get the version of this AbstractRequest object.
*/
public short version() {
return version;
}
public ApiKeys apiKey() {
return apiKey;
}
public final Send toSend(RequestHeader header) {
return SendBuilder.buildRequestSend(header, data());
}
/**
* Serializes header and body without prefixing with size (unlike `toSend`, which does include a size prefix).
*/
public final ByteBuffer serializeWithHeader(RequestHeader header) {
if (header.apiKey() != apiKey) {
throw new IllegalArgumentException("Could not build request " + apiKey + " with header api key " + header.apiKey());
}
if (header.apiVersion() != version) {
throw new IllegalArgumentException("Could not build request version " + version + " with header version " + header.apiVersion());
}
return RequestUtils.serialize(header.data(), header.headerVersion(), data(), version);
}
// Visible for testing
public final ByteBuffer serialize() {
return MessageUtil.toByteBuffer(data(), version);
}
// Visible for testing
final int sizeInBytes() {
return data().size(new ObjectSerializationCache(), version);
}
public String toString(boolean verbose) {
return data().toString();
}
@Override
public final String toString() {
return toString(true);
}
/**
* Get an error response for a request
*/
public AbstractResponse getErrorResponse(Throwable e) {
return getErrorResponse(AbstractResponse.DEFAULT_THROTTLE_TIME, e);
}
/**
* Get an error response for a request with specified throttle time in the response if applicable
*/
public abstract AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e);
/**
* Get the error counts corresponding to an error response. This is overridden for requests
* where response may be null (e.g produce with acks=0).
*/
public Map<Errors, Integer> errorCounts(Throwable e) {
AbstractResponse response = getErrorResponse(0, e);
if (response == null)
throw new IllegalStateException("Error counts could not be obtained for request " + this);
else
return response.errorCounts();
}
/**
* Factory method for getting a request object based on ApiKey ID and a version
*/
public static RequestAndSize parseRequest(ApiKeys apiKey, short apiVersion, ByteBuffer buffer) {
int bufferSize = buffer.remaining();
return new RequestAndSize(doParseRequest(apiKey, apiVersion, buffer), bufferSize);
}
private static AbstractRequest doParseRequest(ApiKeys apiKey, short apiVersion, ByteBuffer buffer) {
switch (apiKey) {
case PRODUCE:
return ProduceRequest.parse(buffer, apiVersion);
case FETCH:
return FetchRequest.parse(buffer, apiVersion);
case LIST_OFFSETS:
return ListOffsetsRequest.parse(buffer, apiVersion);
case METADATA:
return MetadataRequest.parse(buffer, apiVersion);
case OFFSET_COMMIT:
return OffsetCommitRequest.parse(buffer, apiVersion);
case OFFSET_FETCH:
return OffsetFetchRequest.parse(buffer, apiVersion);
case FIND_COORDINATOR:
return FindCoordinatorRequest.parse(buffer, apiVersion);
case JOIN_GROUP:
return JoinGroupRequest.parse(buffer, apiVersion);
case HEARTBEAT:
return HeartbeatRequest.parse(buffer, apiVersion);
case LEAVE_GROUP:
return LeaveGroupRequest.parse(buffer, apiVersion);
case SYNC_GROUP:
return SyncGroupRequest.parse(buffer, apiVersion);
case STOP_REPLICA:
return StopReplicaRequest.parse(buffer, apiVersion);
case CONTROLLED_SHUTDOWN:
return ControlledShutdownRequest.parse(buffer, apiVersion);
case UPDATE_METADATA:
return UpdateMetadataRequest.parse(buffer, apiVersion);
case LEADER_AND_ISR:
return LeaderAndIsrRequest.parse(buffer, apiVersion);
case DESCRIBE_GROUPS:
return DescribeGroupsRequest.parse(buffer, apiVersion);
case LIST_GROUPS:
return ListGroupsRequest.parse(buffer, apiVersion);
case SASL_HANDSHAKE:
return SaslHandshakeRequest.parse(buffer, apiVersion);
case API_VERSIONS:
return ApiVersionsRequest.parse(buffer, apiVersion);
case CREATE_TOPICS:
return CreateTopicsRequest.parse(buffer, apiVersion);
case DELETE_TOPICS:
return DeleteTopicsRequest.parse(buffer, apiVersion);
case DELETE_RECORDS:
return DeleteRecordsRequest.parse(buffer, apiVersion);
case INIT_PRODUCER_ID:
return InitProducerIdRequest.parse(buffer, apiVersion);
case OFFSET_FOR_LEADER_EPOCH:
return OffsetsForLeaderEpochRequest.parse(buffer, apiVersion);
case ADD_PARTITIONS_TO_TXN:
return AddPartitionsToTxnRequest.parse(buffer, apiVersion);
case ADD_OFFSETS_TO_TXN:
return AddOffsetsToTxnRequest.parse(buffer, apiVersion);
case END_TXN:
return EndTxnRequest.parse(buffer, apiVersion);
case WRITE_TXN_MARKERS:
return WriteTxnMarkersRequest.parse(buffer, apiVersion);
case TXN_OFFSET_COMMIT:
return TxnOffsetCommitRequest.parse(buffer, apiVersion);
case DESCRIBE_ACLS:
return DescribeAclsRequest.parse(buffer, apiVersion);
case CREATE_ACLS:
return CreateAclsRequest.parse(buffer, apiVersion);
case DELETE_ACLS:
return DeleteAclsRequest.parse(buffer, apiVersion);
case DESCRIBE_CONFIGS:
return DescribeConfigsRequest.parse(buffer, apiVersion);
case ALTER_CONFIGS:
return AlterConfigsRequest.parse(buffer, apiVersion);
case ALTER_REPLICA_LOG_DIRS:
return AlterReplicaLogDirsRequest.parse(buffer, apiVersion);
case DESCRIBE_LOG_DIRS:
return DescribeLogDirsRequest.parse(buffer, apiVersion);
case SASL_AUTHENTICATE:
return SaslAuthenticateRequest.parse(buffer, apiVersion);
case CREATE_PARTITIONS:
return CreatePartitionsRequest.parse(buffer, apiVersion);
case CREATE_DELEGATION_TOKEN:
return CreateDelegationTokenRequest.parse(buffer, apiVersion);
case RENEW_DELEGATION_TOKEN:
return RenewDelegationTokenRequest.parse(buffer, apiVersion);
case EXPIRE_DELEGATION_TOKEN:
return ExpireDelegationTokenRequest.parse(buffer, apiVersion);
case DESCRIBE_DELEGATION_TOKEN:
return DescribeDelegationTokenRequest.parse(buffer, apiVersion);
case DELETE_GROUPS:
return DeleteGroupsRequest.parse(buffer, apiVersion);
case ELECT_LEADERS:
return ElectLeadersRequest.parse(buffer, apiVersion);
case INCREMENTAL_ALTER_CONFIGS:
return IncrementalAlterConfigsRequest.parse(buffer, apiVersion);
case ALTER_PARTITION_REASSIGNMENTS:
return AlterPartitionReassignmentsRequest.parse(buffer, apiVersion);
case LIST_PARTITION_REASSIGNMENTS:
return ListPartitionReassignmentsRequest.parse(buffer, apiVersion);
case OFFSET_DELETE:
return OffsetDeleteRequest.parse(buffer, apiVersion);
case DESCRIBE_CLIENT_QUOTAS:
return DescribeClientQuotasRequest.parse(buffer, apiVersion);
case ALTER_CLIENT_QUOTAS:
return AlterClientQuotasRequest.parse(buffer, apiVersion);
case DESCRIBE_USER_SCRAM_CREDENTIALS:
return DescribeUserScramCredentialsRequest.parse(buffer, apiVersion);
case ALTER_USER_SCRAM_CREDENTIALS:
return AlterUserScramCredentialsRequest.parse(buffer, apiVersion);
case VOTE:
return VoteRequest.parse(buffer, apiVersion);
case BEGIN_QUORUM_EPOCH:
return BeginQuorumEpochRequest.parse(buffer, apiVersion);
case END_QUORUM_EPOCH:
return EndQuorumEpochRequest.parse(buffer, apiVersion);
case DESCRIBE_QUORUM:
return DescribeQuorumRequest.parse(buffer, apiVersion);
case ALTER_PARTITION:
return AlterPartitionRequest.parse(buffer, apiVersion);
case UPDATE_FEATURES:
return UpdateFeaturesRequest.parse(buffer, apiVersion);
case ENVELOPE:
return EnvelopeRequest.parse(buffer, apiVersion);
case FETCH_SNAPSHOT:
return FetchSnapshotRequest.parse(buffer, apiVersion);
case DESCRIBE_CLUSTER:
return DescribeClusterRequest.parse(buffer, apiVersion);
case DESCRIBE_PRODUCERS:
return DescribeProducersRequest.parse(buffer, apiVersion);
case BROKER_REGISTRATION:
return BrokerRegistrationRequest.parse(buffer, apiVersion);
case BROKER_HEARTBEAT:
return BrokerHeartbeatRequest.parse(buffer, apiVersion);
case UNREGISTER_BROKER:
return UnregisterBrokerRequest.parse(buffer, apiVersion);
case DESCRIBE_TRANSACTIONS:
return DescribeTransactionsRequest.parse(buffer, apiVersion);
case LIST_TRANSACTIONS:
return ListTransactionsRequest.parse(buffer, apiVersion);
case ALLOCATE_PRODUCER_IDS:
return AllocateProducerIdsRequest.parse(buffer, apiVersion);
case CONSUMER_GROUP_HEARTBEAT:
return ConsumerGroupHeartbeatRequest.parse(buffer, apiVersion);
case CONSUMER_GROUP_DESCRIBE:
return ConsumerGroupDescribeRequest.parse(buffer, apiVersion);
case CONTROLLER_REGISTRATION:
return ControllerRegistrationRequest.parse(buffer, apiVersion);
case GET_TELEMETRY_SUBSCRIPTIONS:
return GetTelemetrySubscriptionsRequest.parse(buffer, apiVersion);
case PUSH_TELEMETRY:
return PushTelemetryRequest.parse(buffer, apiVersion);
case ASSIGN_REPLICAS_TO_DIRS:
return AssignReplicasToDirsRequest.parse(buffer, apiVersion);
case LIST_CLIENT_METRICS_RESOURCES:
return ListClientMetricsResourcesRequest.parse(buffer, apiVersion);
case DESCRIBE_TOPIC_PARTITIONS:
return DescribeTopicPartitionsRequest.parse(buffer, apiVersion);
default:
throw new AssertionError(String.format("ApiKey %s is not currently handled in `parseRequest`, the " +
"code should be updated to do so.", apiKey));
}
}
}
| apache/kafka | clients/src/main/java/org/apache/kafka/common/requests/AbstractRequest.java |
212,995 | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.inference.services.openai;
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.inference.Model;
import org.elasticsearch.inference.ModelConfigurations;
import org.elasticsearch.inference.ModelSecrets;
import org.elasticsearch.inference.ServiceSettings;
import org.elasticsearch.inference.TaskSettings;
import org.elasticsearch.xpack.inference.external.action.ExecutableAction;
import org.elasticsearch.xpack.inference.external.action.openai.OpenAiActionVisitor;
import org.elasticsearch.xpack.inference.services.ServiceUtils;
import org.elasticsearch.xpack.inference.services.settings.ApiKeySecrets;
import java.util.Map;
import java.util.Objects;
public abstract class OpenAiModel extends Model {
private final OpenAiRateLimitServiceSettings rateLimitServiceSettings;
private final SecureString apiKey;
public OpenAiModel(
ModelConfigurations configurations,
ModelSecrets secrets,
OpenAiRateLimitServiceSettings rateLimitServiceSettings,
@Nullable ApiKeySecrets apiKeySecrets
) {
super(configurations, secrets);
this.rateLimitServiceSettings = Objects.requireNonNull(rateLimitServiceSettings);
apiKey = ServiceUtils.apiKey(apiKeySecrets);
}
protected OpenAiModel(OpenAiModel model, TaskSettings taskSettings) {
super(model, taskSettings);
rateLimitServiceSettings = model.rateLimitServiceSettings();
apiKey = model.apiKey();
}
protected OpenAiModel(OpenAiModel model, ServiceSettings serviceSettings) {
super(model, serviceSettings);
rateLimitServiceSettings = model.rateLimitServiceSettings();
apiKey = model.apiKey();
}
public SecureString apiKey() {
return apiKey;
}
public OpenAiRateLimitServiceSettings rateLimitServiceSettings() {
return rateLimitServiceSettings;
}
public abstract ExecutableAction accept(OpenAiActionVisitor creator, Map<String, Object> taskSettings);
}
| elastic/elasticsearch | x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/openai/OpenAiModel.java |
212,996 | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.core.security.action.apikey;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.xpack.core.security.authz.RoleDescriptor;
import java.util.List;
import java.util.Map;
import java.util.Objects;
public abstract class BaseSingleUpdateApiKeyRequest extends BaseUpdateApiKeyRequest {
private final String id;
public BaseSingleUpdateApiKeyRequest(
@Nullable final List<RoleDescriptor> roleDescriptors,
@Nullable final Map<String, Object> metadata,
@Nullable final TimeValue expiration,
String id
) {
super(roleDescriptors, metadata, expiration);
this.id = Objects.requireNonNull(id, "API key ID must not be null");
}
public String getId() {
return id;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass() || super.equals(o)) return false;
BaseSingleUpdateApiKeyRequest that = (BaseSingleUpdateApiKeyRequest) o;
return Objects.equals(getId(), that.getId())
&& Objects.equals(metadata, that.metadata)
&& Objects.equals(expiration, that.expiration)
&& Objects.equals(roleDescriptors, that.roleDescriptors);
}
@Override
public int hashCode() {
return Objects.hash(getId(), expiration, metadata, roleDescriptors);
}
}
| elastic/elasticsearch | x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/apikey/BaseSingleUpdateApiKeyRequest.java |
212,997 | package baeldung.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
/**
* Created by adam.
*/
@Entity
public class Address {
@Id
@GeneratedValue
private Long id;
private String street;
private String city;
private String postCode;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getPostCode() {
return postCode;
}
public void setPostCode(String postCode) {
this.postCode = postCode;
}
}
| eugenp/tutorials | persistence-modules/deltaspike/src/main/java/baeldung/model/Address.java |
212,999 |
package mage.cards.l;
import java.util.UUID;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.target.common.TargetPlayerOrPlaneswalker;
/**
*
* @author Loki
*/
public final class LavaSpike extends CardImpl {
public LavaSpike(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{R}");
this.subtype.add(SubType.ARCANE);
this.getSpellAbility().addTarget(new TargetPlayerOrPlaneswalker());
this.getSpellAbility().addEffect(new DamageTargetEffect(3));
}
private LavaSpike(final LavaSpike card) {
super(card);
}
@Override
public LavaSpike copy() {
return new LavaSpike(this);
}
}
| ElchananHaas/mage | Mage.Sets/src/mage/cards/l/LavaSpike.java |
213,000 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.kafka.common.requests;
import org.apache.kafka.common.network.Send;
import org.apache.kafka.common.protocol.ApiKeys;
import org.apache.kafka.common.protocol.Errors;
import org.apache.kafka.common.protocol.MessageUtil;
import org.apache.kafka.common.protocol.SendBuilder;
import java.nio.ByteBuffer;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public abstract class AbstractResponse implements AbstractRequestResponse {
public static final int DEFAULT_THROTTLE_TIME = 0;
private final ApiKeys apiKey;
protected AbstractResponse(ApiKeys apiKey) {
this.apiKey = apiKey;
}
public final Send toSend(ResponseHeader header, short version) {
return SendBuilder.buildResponseSend(header, data(), version);
}
/**
* Serializes header and body without prefixing with size (unlike `toSend`, which does include a size prefix).
*/
final ByteBuffer serializeWithHeader(ResponseHeader header, short version) {
return RequestUtils.serialize(header.data(), header.headerVersion(), data(), version);
}
// Visible for testing
final ByteBuffer serialize(short version) {
return MessageUtil.toByteBuffer(data(), version);
}
/**
* The number of each type of error in the response, including {@link Errors#NONE} and top-level errors as well as
* more specifically scoped errors (such as topic or partition-level errors).
* @return A count of errors.
*/
public abstract Map<Errors, Integer> errorCounts();
protected Map<Errors, Integer> errorCounts(Errors error) {
return Collections.singletonMap(error, 1);
}
protected Map<Errors, Integer> errorCounts(Stream<Errors> errors) {
return errors.collect(Collectors.groupingBy(e -> e, Collectors.summingInt(e -> 1)));
}
protected Map<Errors, Integer> errorCounts(Collection<Errors> errors) {
Map<Errors, Integer> errorCounts = new HashMap<>();
for (Errors error : errors)
updateErrorCounts(errorCounts, error);
return errorCounts;
}
protected Map<Errors, Integer> apiErrorCounts(Map<?, ApiError> errors) {
Map<Errors, Integer> errorCounts = new HashMap<>();
for (ApiError apiError : errors.values())
updateErrorCounts(errorCounts, apiError.error());
return errorCounts;
}
protected void updateErrorCounts(Map<Errors, Integer> errorCounts, Errors error) {
Integer count = errorCounts.getOrDefault(error, 0);
errorCounts.put(error, count + 1);
}
/**
* Parse a response from the provided buffer. The buffer is expected to hold both
* the {@link ResponseHeader} as well as the response payload.
*/
public static AbstractResponse parseResponse(ByteBuffer buffer, RequestHeader requestHeader) {
ApiKeys apiKey = requestHeader.apiKey();
short apiVersion = requestHeader.apiVersion();
ResponseHeader responseHeader = ResponseHeader.parse(buffer, apiKey.responseHeaderVersion(apiVersion));
if (requestHeader.correlationId() != responseHeader.correlationId()) {
throw new CorrelationIdMismatchException("Correlation id for response ("
+ responseHeader.correlationId() + ") does not match request ("
+ requestHeader.correlationId() + "), request header: " + requestHeader,
requestHeader.correlationId(), responseHeader.correlationId());
}
return AbstractResponse.parseResponse(apiKey, buffer, apiVersion);
}
public static AbstractResponse parseResponse(ApiKeys apiKey, ByteBuffer responseBuffer, short version) {
switch (apiKey) {
case PRODUCE:
return ProduceResponse.parse(responseBuffer, version);
case FETCH:
return FetchResponse.parse(responseBuffer, version);
case LIST_OFFSETS:
return ListOffsetsResponse.parse(responseBuffer, version);
case METADATA:
return MetadataResponse.parse(responseBuffer, version);
case OFFSET_COMMIT:
return OffsetCommitResponse.parse(responseBuffer, version);
case OFFSET_FETCH:
return OffsetFetchResponse.parse(responseBuffer, version);
case FIND_COORDINATOR:
return FindCoordinatorResponse.parse(responseBuffer, version);
case JOIN_GROUP:
return JoinGroupResponse.parse(responseBuffer, version);
case HEARTBEAT:
return HeartbeatResponse.parse(responseBuffer, version);
case LEAVE_GROUP:
return LeaveGroupResponse.parse(responseBuffer, version);
case SYNC_GROUP:
return SyncGroupResponse.parse(responseBuffer, version);
case STOP_REPLICA:
return StopReplicaResponse.parse(responseBuffer, version);
case CONTROLLED_SHUTDOWN:
return ControlledShutdownResponse.parse(responseBuffer, version);
case UPDATE_METADATA:
return UpdateMetadataResponse.parse(responseBuffer, version);
case LEADER_AND_ISR:
return LeaderAndIsrResponse.parse(responseBuffer, version);
case DESCRIBE_GROUPS:
return DescribeGroupsResponse.parse(responseBuffer, version);
case LIST_GROUPS:
return ListGroupsResponse.parse(responseBuffer, version);
case SASL_HANDSHAKE:
return SaslHandshakeResponse.parse(responseBuffer, version);
case API_VERSIONS:
return ApiVersionsResponse.parse(responseBuffer, version);
case CREATE_TOPICS:
return CreateTopicsResponse.parse(responseBuffer, version);
case DELETE_TOPICS:
return DeleteTopicsResponse.parse(responseBuffer, version);
case DELETE_RECORDS:
return DeleteRecordsResponse.parse(responseBuffer, version);
case INIT_PRODUCER_ID:
return InitProducerIdResponse.parse(responseBuffer, version);
case OFFSET_FOR_LEADER_EPOCH:
return OffsetsForLeaderEpochResponse.parse(responseBuffer, version);
case ADD_PARTITIONS_TO_TXN:
return AddPartitionsToTxnResponse.parse(responseBuffer, version);
case ADD_OFFSETS_TO_TXN:
return AddOffsetsToTxnResponse.parse(responseBuffer, version);
case END_TXN:
return EndTxnResponse.parse(responseBuffer, version);
case WRITE_TXN_MARKERS:
return WriteTxnMarkersResponse.parse(responseBuffer, version);
case TXN_OFFSET_COMMIT:
return TxnOffsetCommitResponse.parse(responseBuffer, version);
case DESCRIBE_ACLS:
return DescribeAclsResponse.parse(responseBuffer, version);
case CREATE_ACLS:
return CreateAclsResponse.parse(responseBuffer, version);
case DELETE_ACLS:
return DeleteAclsResponse.parse(responseBuffer, version);
case DESCRIBE_CONFIGS:
return DescribeConfigsResponse.parse(responseBuffer, version);
case ALTER_CONFIGS:
return AlterConfigsResponse.parse(responseBuffer, version);
case ALTER_REPLICA_LOG_DIRS:
return AlterReplicaLogDirsResponse.parse(responseBuffer, version);
case DESCRIBE_LOG_DIRS:
return DescribeLogDirsResponse.parse(responseBuffer, version);
case SASL_AUTHENTICATE:
return SaslAuthenticateResponse.parse(responseBuffer, version);
case CREATE_PARTITIONS:
return CreatePartitionsResponse.parse(responseBuffer, version);
case CREATE_DELEGATION_TOKEN:
return CreateDelegationTokenResponse.parse(responseBuffer, version);
case RENEW_DELEGATION_TOKEN:
return RenewDelegationTokenResponse.parse(responseBuffer, version);
case EXPIRE_DELEGATION_TOKEN:
return ExpireDelegationTokenResponse.parse(responseBuffer, version);
case DESCRIBE_DELEGATION_TOKEN:
return DescribeDelegationTokenResponse.parse(responseBuffer, version);
case DELETE_GROUPS:
return DeleteGroupsResponse.parse(responseBuffer, version);
case ELECT_LEADERS:
return ElectLeadersResponse.parse(responseBuffer, version);
case INCREMENTAL_ALTER_CONFIGS:
return IncrementalAlterConfigsResponse.parse(responseBuffer, version);
case ALTER_PARTITION_REASSIGNMENTS:
return AlterPartitionReassignmentsResponse.parse(responseBuffer, version);
case LIST_PARTITION_REASSIGNMENTS:
return ListPartitionReassignmentsResponse.parse(responseBuffer, version);
case OFFSET_DELETE:
return OffsetDeleteResponse.parse(responseBuffer, version);
case DESCRIBE_CLIENT_QUOTAS:
return DescribeClientQuotasResponse.parse(responseBuffer, version);
case ALTER_CLIENT_QUOTAS:
return AlterClientQuotasResponse.parse(responseBuffer, version);
case DESCRIBE_USER_SCRAM_CREDENTIALS:
return DescribeUserScramCredentialsResponse.parse(responseBuffer, version);
case ALTER_USER_SCRAM_CREDENTIALS:
return AlterUserScramCredentialsResponse.parse(responseBuffer, version);
case VOTE:
return VoteResponse.parse(responseBuffer, version);
case BEGIN_QUORUM_EPOCH:
return BeginQuorumEpochResponse.parse(responseBuffer, version);
case END_QUORUM_EPOCH:
return EndQuorumEpochResponse.parse(responseBuffer, version);
case DESCRIBE_QUORUM:
return DescribeQuorumResponse.parse(responseBuffer, version);
case ALTER_PARTITION:
return AlterPartitionResponse.parse(responseBuffer, version);
case UPDATE_FEATURES:
return UpdateFeaturesResponse.parse(responseBuffer, version);
case ENVELOPE:
return EnvelopeResponse.parse(responseBuffer, version);
case FETCH_SNAPSHOT:
return FetchSnapshotResponse.parse(responseBuffer, version);
case DESCRIBE_CLUSTER:
return DescribeClusterResponse.parse(responseBuffer, version);
case DESCRIBE_PRODUCERS:
return DescribeProducersResponse.parse(responseBuffer, version);
case BROKER_REGISTRATION:
return BrokerRegistrationResponse.parse(responseBuffer, version);
case BROKER_HEARTBEAT:
return BrokerHeartbeatResponse.parse(responseBuffer, version);
case UNREGISTER_BROKER:
return UnregisterBrokerResponse.parse(responseBuffer, version);
case DESCRIBE_TRANSACTIONS:
return DescribeTransactionsResponse.parse(responseBuffer, version);
case LIST_TRANSACTIONS:
return ListTransactionsResponse.parse(responseBuffer, version);
case ALLOCATE_PRODUCER_IDS:
return AllocateProducerIdsResponse.parse(responseBuffer, version);
case CONSUMER_GROUP_HEARTBEAT:
return ConsumerGroupHeartbeatResponse.parse(responseBuffer, version);
case CONSUMER_GROUP_DESCRIBE:
return ConsumerGroupDescribeResponse.parse(responseBuffer, version);
case CONTROLLER_REGISTRATION:
return ControllerRegistrationResponse.parse(responseBuffer, version);
case GET_TELEMETRY_SUBSCRIPTIONS:
return GetTelemetrySubscriptionsResponse.parse(responseBuffer, version);
case PUSH_TELEMETRY:
return PushTelemetryResponse.parse(responseBuffer, version);
case ASSIGN_REPLICAS_TO_DIRS:
return AssignReplicasToDirsResponse.parse(responseBuffer, version);
case LIST_CLIENT_METRICS_RESOURCES:
return ListClientMetricsResourcesResponse.parse(responseBuffer, version);
case DESCRIBE_TOPIC_PARTITIONS:
return DescribeTopicPartitionsResponse.parse(responseBuffer, version);
default:
throw new AssertionError(String.format("ApiKey %s is not currently handled in `parseResponse`, the " +
"code should be updated to do so.", apiKey));
}
}
/**
* Returns whether or not client should throttle upon receiving a response of the specified version with a non-zero
* throttle time. Client-side throttling is needed when communicating with a newer version of broker which, on
* quota violation, sends out responses before throttling.
*/
public boolean shouldClientThrottle(short version) {
return false;
}
public ApiKeys apiKey() {
return apiKey;
}
/**
* Get the throttle time in milliseconds. If the response schema does not
* support this field, then 0 will be returned.
*/
public abstract int throttleTimeMs();
/**
* Set the throttle time in the response if the schema supports it. Otherwise,
* this is a no-op.
*
* @param throttleTimeMs The throttle time in milliseconds
*/
public abstract void maybeSetThrottleTimeMs(int throttleTimeMs);
public String toString() {
return data().toString();
}
}
| apache/kafka | clients/src/main/java/org/apache/kafka/common/requests/AbstractResponse.java |
213,001 | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.core.security.action.apikey;
import org.elasticsearch.action.ActionType;
public final class UpdateCrossClusterApiKeyAction extends ActionType<UpdateApiKeyResponse> {
public static final String NAME = "cluster:admin/xpack/security/cross_cluster/api_key/update";
public static final UpdateCrossClusterApiKeyAction INSTANCE = new UpdateCrossClusterApiKeyAction();
private UpdateCrossClusterApiKeyAction() {
super(NAME);
}
}
| elastic/elasticsearch | x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/apikey/UpdateCrossClusterApiKeyAction.java |
213,002 | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.security.action.apikey;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.xpack.core.security.SecurityContext;
import org.elasticsearch.xpack.core.security.action.apikey.InvalidateApiKeyAction;
import org.elasticsearch.xpack.core.security.action.apikey.InvalidateApiKeyRequest;
import org.elasticsearch.xpack.core.security.action.apikey.InvalidateApiKeyResponse;
import org.elasticsearch.xpack.core.security.action.user.HasPrivilegesAction;
import org.elasticsearch.xpack.core.security.action.user.HasPrivilegesRequest;
import org.elasticsearch.xpack.core.security.action.user.HasPrivilegesResponse;
import org.elasticsearch.xpack.core.security.authc.Authentication;
import org.elasticsearch.xpack.core.security.authz.RoleDescriptor;
import org.elasticsearch.xpack.core.security.authz.privilege.ClusterPrivilegeResolver;
import org.elasticsearch.xpack.security.authc.ApiKeyService;
public final class TransportInvalidateApiKeyAction extends HandledTransportAction<InvalidateApiKeyRequest, InvalidateApiKeyResponse> {
private final ApiKeyService apiKeyService;
private final SecurityContext securityContext;
private final Client client;
@Inject
public TransportInvalidateApiKeyAction(
TransportService transportService,
ActionFilters actionFilters,
ApiKeyService apiKeyService,
SecurityContext context,
Client client
) {
super(
InvalidateApiKeyAction.NAME,
transportService,
actionFilters,
InvalidateApiKeyRequest::new,
EsExecutors.DIRECT_EXECUTOR_SERVICE
);
this.apiKeyService = apiKeyService;
this.securityContext = context;
this.client = client;
}
@Override
protected void doExecute(Task task, InvalidateApiKeyRequest request, ActionListener<InvalidateApiKeyResponse> listener) {
final Authentication authentication = securityContext.getAuthentication();
if (authentication == null) {
listener.onFailure(new IllegalStateException("authentication is required"));
return;
}
final String[] apiKeyIds = request.getIds();
final String apiKeyName = request.getName();
final String username = getUsername(authentication, request);
final String[] realms = getRealms(authentication, request);
checkHasManageSecurityPrivilege(
ActionListener.wrap(
hasPrivilegesResponse -> apiKeyService.invalidateApiKeys(
realms,
username,
apiKeyName,
apiKeyIds,
hasPrivilegesResponse.isCompleteMatch(),
listener
),
listener::onFailure
)
);
}
private String getUsername(Authentication authentication, InvalidateApiKeyRequest request) {
if (request.ownedByAuthenticatedUser()) {
assert request.getUserName() == null;
return authentication.getEffectiveSubject().getUser().principal();
}
return request.getUserName();
}
private String[] getRealms(Authentication authentication, InvalidateApiKeyRequest request) {
if (request.ownedByAuthenticatedUser()) {
assert request.getRealmName() == null;
return ApiKeyService.getOwnersRealmNames(authentication);
}
return Strings.hasText(request.getRealmName()) ? new String[] { request.getRealmName() } : null;
}
private void checkHasManageSecurityPrivilege(ActionListener<HasPrivilegesResponse> listener) {
final var hasPrivilegesRequest = new HasPrivilegesRequest();
hasPrivilegesRequest.username(securityContext.getUser().principal());
hasPrivilegesRequest.clusterPrivileges(ClusterPrivilegeResolver.MANAGE_SECURITY.name());
hasPrivilegesRequest.indexPrivileges(new RoleDescriptor.IndicesPrivileges[0]);
hasPrivilegesRequest.applicationPrivileges(new RoleDescriptor.ApplicationResourcePrivileges[0]);
client.execute(HasPrivilegesAction.INSTANCE, hasPrivilegesRequest, ActionListener.wrap(listener::onResponse, listener::onFailure));
}
}
| elastic/elasticsearch | x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/action/apikey/TransportInvalidateApiKeyAction.java |
213,003 | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.core.security.action.apikey;
import org.elasticsearch.action.ActionType;
/**
* ActionType for the creation of a cross-cluster API key
*/
public final class CreateCrossClusterApiKeyAction extends ActionType<CreateApiKeyResponse> {
public static final String NAME = "cluster:admin/xpack/security/cross_cluster/api_key/create";
public static final CreateCrossClusterApiKeyAction INSTANCE = new CreateCrossClusterApiKeyAction();
private CreateCrossClusterApiKeyAction() {
super(NAME);
}
}
| elastic/elasticsearch | x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/apikey/CreateCrossClusterApiKeyAction.java |
213,004 | package spring.certification.ioc.q017.example;
/**
* Colorless liquid with some implicit benefits.
*/
public interface Alcohol {
/**
* @return name of an alcoholic drink.
*/
String getName();
}
| vshemyako/spring-certification-5.0 | src/main/java/spring/certification/ioc/q017/example/Alcohol.java |
213,005 | package alcohol;
import java.io.*;
import java.util.*;
public class Alcohol {
public static void main(String[] args) throws IOException {
ArrayList<Long> data = new ArrayList<>();
long count = 0;
long c, h, o;
String str;
FileReader file = new FileReader("input.txt"); // Считывание данных из файла
Scanner sc = new Scanner(file);
str = sc.nextLine();
StringTokenizer st = new StringTokenizer(str, " ");
while(st.hasMoreTokens()){
data.add (Long.valueOf(st.nextToken()));
}
c = data.get(0) / 2;
h = data.get(1) / 6;
o = data.get(2);
if(c > 0 && h > 0 && o > 0){
count = (c < h && c < o) ? c :
(h < c && h < o) ? h : o;
}
FileWriter fileOut = new FileWriter("output.txt");
fileOut.write(String.valueOf(count));
fileOut.close();
}
}
| allicen/Java-1000 | alcohol/Alcohol.java |
213,006 | package com.javarush.test.level13.lesson02.task01;
/* Пиво
1. Подумай, какой из двух интерфейсов нужно реализовать в классе Beer.
2. Добавь к классу Beer этот интерфейс и реализуйте все нереализованные методы.
3. Подумай, как связаны переменная READY_TO_GO_HOME и метод isReadyToGoHome.
4. Верни значение переменной READY_TO_GO_HOME в методе isReadyToGoHome.
*/
public class Solution
{
public static void main(String[] args) throws Exception
{
}
public interface Drink
{
void askMore(String message);
void sayThankYou();
boolean isReadyToGoHome();
}
public interface Alcohol extends Drink
{
boolean READY_TO_GO_HOME = false;
void sleepOnTheFloor();
}
public static class Beer implements Alcohol
{
public void askMore(String message) {
System.out.println("Asking for more");
}
public void sayThankYou() {
System.out.println("Thank you!");
}
public boolean isReadyToGoHome() {
System.out.println("Yeah, I'm ready to go home");
return true;
}
public void sleepOnTheFloor() {
System.out.println("That is the true");
}
}
}
| ihor-berda/JavaRush | level13/lesson02/task01/Solution.java |
213,007 | package org.jhipster.health.domain;
import java.io.Serializable;
import java.time.LocalDate;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A Points.
*/
@Entity
@Table(name = "points")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@org.springframework.data.elasticsearch.annotations.Document(indexName = "points")
@SuppressWarnings("common-java:DuplicatedBlocks")
public class Points implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
@Column(name = "id")
private Long id;
@NotNull
@Column(name = "jhi_date", nullable = false)
private LocalDate date;
@Column(name = "exercise")
private Integer exercise;
@Column(name = "meals")
private Integer meals;
@Column(name = "alcohol")
private Integer alcohol;
@Size(max = 140)
@Column(name = "notes", length = 140)
private String notes;
@ManyToOne
private User user;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Points() {}
public Points(LocalDate date, Integer exercise, Integer meals, Integer alcohol, User user) {
this.date = date;
this.exercise = exercise;
this.meals = meals;
this.alcohol = alcohol;
this.user = user;
}
public Long getId() {
return this.id;
}
public Points id(Long id) {
this.setId(id);
return this;
}
public void setId(Long id) {
this.id = id;
}
public LocalDate getDate() {
return this.date;
}
public Points date(LocalDate date) {
this.setDate(date);
return this;
}
public void setDate(LocalDate date) {
this.date = date;
}
public Integer getExercise() {
return this.exercise;
}
public Points exercise(Integer exercise) {
this.setExercise(exercise);
return this;
}
public void setExercise(Integer exercise) {
this.exercise = exercise;
}
public Integer getMeals() {
return this.meals;
}
public Points meals(Integer meals) {
this.setMeals(meals);
return this;
}
public void setMeals(Integer meals) {
this.meals = meals;
}
public Integer getAlcohol() {
return this.alcohol;
}
public Points alcohol(Integer alcohol) {
this.setAlcohol(alcohol);
return this;
}
public void setAlcohol(Integer alcohol) {
this.alcohol = alcohol;
}
public String getNotes() {
return this.notes;
}
public Points notes(String notes) {
this.setNotes(notes);
return this;
}
public void setNotes(String notes) {
this.notes = notes;
}
public User getUser() {
return this.user;
}
public void setUser(User user) {
this.user = user;
}
public Points user(User user) {
this.setUser(user);
return this;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Points)) {
return false;
}
return id != null && id.equals(((Points) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "Points{" +
"id=" + getId() +
", date='" + getDate() + "'" +
", exercise=" + getExercise() +
", meals=" + getMeals() +
", alcohol=" + getAlcohol() +
", notes='" + getNotes() + "'" +
"}";
}
}
| mraible/21-points | src/main/java/org/jhipster/health/domain/Points.java |
213,009 | package com.planet_ink.coffee_mud.Abilities.Poisons;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2003-2024 Bo Zimmerman
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
public class Poison_Alcohol extends Poison
{
@Override
public String ID()
{
return "Poison_Alcohol";
}
private final static String localizedName = CMLib.lang().L("Alcohol");
@Override
public String name()
{
return localizedName;
}
public Poison_Alcohol()
{
super();
drunkness=5;
}
private static final String[] triggerStrings = I(new String[] { "POISONALCOHOL" });
@Override
public String displayText()
{
return (drunkness <= 0) ? "(Holding your own)" : (drunkness <= 3) ? "(Tipsy)" : ((drunkness < 10) ? "(Drunk)" : "(Smashed)");
}
@Override
public String[] triggerStrings()
{
return triggerStrings;
}
@Override
public long flags()
{
return super.flags() | Ability.FLAG_INTOXICATING;
}
@Override
protected int POISON_TICKS()
{
return 65;
}
@Override
protected int POISON_DELAY()
{
return 1;
}
@Override
protected String POISON_DONE()
{
return "You feel sober again.";
}
@Override
protected String POISON_START()
{
return "^G<S-NAME> burp(s)!^?";
}
@Override
protected String POISON_AFFECT()
{
return "";
}
@Override
protected String POISON_CAST()
{
return "^F^<FIGHT^><S-NAME> inebriate(s) <T-NAMESELF>!^</FIGHT^>^?";
}
@Override
protected String POISON_FAIL()
{
return "<S-NAME> attempt(s) to inebriate <T-NAMESELF>, but fail(s).";
}
@Override
protected int POISON_DAMAGE()
{
return 0;
}
protected boolean disableHappiness = false;
protected int alcoholContribution()
{
return 1;
}
protected int level()
{
return 1;
}
protected int drunkness = 5;
@Override
public int abilityCode()
{
return drunkness;
}
@Override
public void setAbilityCode(final int newCode)
{
drunkness=newCode;
}
protected Ability mood = null;
protected Ability getMood()
{
if(mood == null)
{
final Physical affected=this.affected;
if(affected == null)
return null;
mood = CMClass.getAbility("Mood");
if((mood == null)
||(affected.phyStats().isAmbiance(PhyStats.Ambiance.SUPPRESS_MOOD))
||(affected.phyStats().isAmbiance(PhyStats.Ambiance.SUPPRESS_DRUNKENNESS)))
return null;
final String moods[] = {"HAPPY","MEAN","SILLY","ANGRY","SAD",""};
final String moodStr = moods[Math.abs(affected.Name().hashCode())%moods.length];
if(moodStr.length()==0)
return null;
mood.setMiscText(moodStr);
mood.setAffectedOne(affected);
}
mood.setAffectedOne(affected);
return mood;
}
@Override
public void affectPhyStats(final Physical affected, final PhyStats affectableStats)
{
if((affected instanceof MOB)&&(drunkness>0))
affectableStats.setAttackAdjustment(affectableStats.attackAdjustment()-(drunkness+((MOB)affected).phyStats().level()));
}
@Override
public void affectCharStats(final MOB affected, final CharStats affectableStats)
{
affectableStats.setStat(CharStats.STAT_DEXTERITY,(affectableStats.getStat(CharStats.STAT_DEXTERITY)-drunkness));
if(affectableStats.getStat(CharStats.STAT_DEXTERITY)<=0)
affectableStats.setStat(CharStats.STAT_DEXTERITY,1);
}
@Override
protected int POISON_ADDICTION_CHANCE()
{
return (alcoholContribution()*alcoholContribution()*alcoholContribution()/10);
}
@Override
public void unInvoke()
{
if((affected instanceof MOB)&&(canBeUninvoked()))
{
final MOB mob=(MOB)affected;
if((CMLib.dice().rollPercentage()==1)&&(!((MOB)affected).isMonster())&&(drunkness>0))
{
final Ability A=CMClass.getAbility("Disease_Migraines");
if((A!=null)&&(mob.fetchEffect(A.ID())==null))
A.invoke(mob,mob,true,0);
}
CMLib.commands().postStand(mob,true, false);
}
super.unInvoke();
}
@Override
public boolean tick(final Tickable ticking, final int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(!(affected instanceof MOB))
return true;
if(disableHappiness)
{
disableHappiness=false;
return true;
}
final MOB mob=(MOB)affected;
if(mob==null)
return true;
final Ability mood = getMood();
if((mood != null)
&&(CMLib.dice().rollPercentage()<(4*drunkness)))
mood.tick(mob, Tickable.TICKID_MOB);
final Room room=mob.location();
if((CMLib.dice().rollPercentage()<(4*drunkness))
&&(CMLib.flags().isAliveAwakeMobile(mob,true))
&&(!mob.phyStats().isAmbiance(PhyStats.Ambiance.SUPPRESS_DRUNKENNESS))
&&(room!=null))
{
if(CMLib.flags().isEvil(mob))
switch(CMLib.dice().roll(1,9,-1))
{
case 0:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> stagger(s) around making ugly faces."));
break;
case 1:
room.show(mob,null,this,CMMsg.MSG_NOISE,L("<S-NAME> belch(es) grotesquely."));
break;
case 2:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> spin(s) <S-HIS-HER> head around."));
break;
case 3:
room.show(mob,null,this,CMMsg.MSG_NOISE,L("<S-NAME> can't stop snarling."));
break;
case 4:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> just fell over!"));
break;
case 5:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> look(s) around with glazed over eyes."));
break;
case 6:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> can't seem to focus."));
break;
case 7:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> <S-IS-ARE> definitely sh** faced!"));
break;
case 8:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> stare(s) blankly at the ground."));
break;
}
else
if(!CMLib.flags().isGood(mob))
switch(CMLib.dice().roll(1,9,-1))
{
case 0:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> stagger(s) around aimlessly."));
break;
case 1:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> burp(s) noncommitally."));
break;
case 2:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> look(s) around with glazed over eyes."));
break;
case 3:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> can't seem to focus."));
break;
case 4:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> almost fell over."));
break;
case 5:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> hiccup(s) and almost smile(s)."));
break;
case 6:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> belch(es)!"));
break;
case 7:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> <S-IS-ARE> definitely drunk!"));
break;
case 8:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> stare(s) blankly ahead."));
break;
}
else
switch(CMLib.dice().roll(1,9,-1))
{
case 0:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> stagger(s) around trying to hug everyone."));
break;
case 1:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> hiccup(s) and smile(s)."));
break;
case 2:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> bob(s) <S-HIS-HER> head back and forth."));
break;
case 3:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> can't stop smiling."));
break;
case 4:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> lean(s) slightly to one side."));
break;
case 5:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> look(s) around with glazed over eyes."));
break;
case 6:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> can't seem to focus."));
break;
case 7:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> <S-IS-ARE> definitely a bit tipsy!"));
break;
case 8:
room.show(mob,null,this,CMMsg.MSG_QUIETMOVEMENT,L("<S-NAME> stare(s) blankly at <S-HIS-HER> eyelids."));
break;
}
}
return true;
}
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(affected instanceof MOB)
{
if(msg.source()!=affected)
return true;
if(msg.source().location()==null)
return true;
final Ability mood = getMood();
if((mood != null)
&&(!mood.okMessage(msg.source(), msg)))
return false;
if((msg.amISource((MOB)affected))
&&(msg.sourceMessage()!=null)
&&(msg.tool()==null)
&&(drunkness>=5)
&&((msg.sourceMinor()==CMMsg.TYP_SPEAK)
||(msg.sourceMinor()==CMMsg.TYP_TELL)
||(CMath.bset(msg.sourceMajor(),CMMsg.MASK_CHANNEL)))
&&(!msg.source().phyStats().isAmbiance(PhyStats.Ambiance.SUPPRESS_DRUNKENNESS)))
{
final Ability A=CMClass.getAbility("Drunken");
if(A!=null)
{
A.setProficiency(100);
A.invoke(msg.source(),null,true,0);
A.setAffectedOne(msg.source());
if(!A.okMessage(myHost,msg))
return false;
}
}
else
if((!msg.targetMajor(CMMsg.MASK_ALWAYS))
&&(CMLib.dice().rollPercentage()<(drunkness*20))
&&(msg.targetMajor()>0)
&&(!msg.source().phyStats().isAmbiance(PhyStats.Ambiance.SUPPRESS_DRUNKENNESS)))
{
final Room room=msg.source().location();
if((msg.target() !=null)&&(msg.target() instanceof MOB)&&(room!=null))
{
Environmental target=msg.target();
if(room.numInhabitants()>2)
{
target=room.fetchInhabitant(CMLib.dice().roll(1,room.numInhabitants(),0)-1);
if(!CMLib.flags().canBeSeenBy(target, msg.source()))
target=msg.target();
}
msg.modify(msg.source(),target,msg.tool(),msg.sourceCode(),msg.sourceMessage(),msg.targetCode(),msg.targetMessage(),msg.othersCode(),msg.othersMessage());
}
}
}
else
{
}
return true;
}
@Override
public boolean invoke(final MOB mob, final List<String> commands, final Physical givenTarget, final boolean auto, final int asLevel)
{
int largest=alcoholContribution();
if((givenTarget instanceof MOB)&&(auto))
{
final Vector<Ability> found=new Vector<Ability>();
final Vector<Ability> remove=new Vector<Ability>();
largest=0;
for(final Enumeration<Ability> a=givenTarget.effects();a.hasMoreElements();)
{
final Ability A=a.nextElement();
if(A instanceof Poison_Alcohol)
{
largest+=((Poison_Alcohol)A).drunkness;
if(((Poison_Alcohol)A).level()>=level())
found.addElement(A);
else
remove.addElement(A);
}
}
largest+=alcoholContribution();
if(found.size()>0)
{
final CMMsg msg=CMClass.getMsg(mob,givenTarget,this,CMMsg.MSK_MALICIOUS_MOVE|CMMsg.TYP_POISON|CMMsg.MASK_ALWAYS,POISON_CAST());
final Room R=(((MOB)givenTarget).location()!=null)?((MOB)givenTarget).location():mob.location();
if(R.okMessage(mob,msg))
{
R.send(mob,msg);
if(msg.value()<=0)
{
R.show((MOB)givenTarget,null,CMMsg.MSG_OK_VISUAL,POISON_START());
for(int a=0;a<found.size();a++)
{
((Poison_Alcohol)found.elementAt(a)).drunkness=largest;
((Poison_Alcohol)found.elementAt(a)).tickDown=POISON_TICKS();
}
R.recoverRoomStats();
return true;
}
}
return false;
}
for(int i=0;i<remove.size();i++)
givenTarget.delEffect(remove.elementAt(i));
}
final boolean success=super.invoke(mob,commands,givenTarget,auto,asLevel);
if(success&&(givenTarget instanceof MOB)&&(auto))
{
final Ability A=givenTarget.fetchEffect(ID());
if(A!=null)
{
((Poison_Alcohol)A).drunkness=largest;
((Poison_Alcohol)A).tickDown=POISON_TICKS();
}
final Room R=(((MOB)givenTarget).location()!=null)?((MOB)givenTarget).location():mob.location();
R.recoverRoomStats();
}
return success;
}
}
| bozimmerman/CoffeeMud | com/planet_ink/coffee_mud/Abilities/Poisons/Poison_Alcohol.java |
213,010 | package binnie.extratrees.liquid;
import binnie.core.Constants;
import binnie.core.liquid.FluidContainerType;
import binnie.core.liquid.FluidType;
import binnie.core.liquid.IFluidDefinition;
import binnie.extratrees.ExtraTrees;
import binnie.extratrees.alcohol.CocktailLiquid;
import binnie.extratrees.alcohol.ICocktailIngredient;
import binnie.extratrees.alcohol.ICocktailIngredientProvider;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.List;
public enum Alcohol implements IFluidDefinition, ICocktailIngredientProvider {
Apple("cider.apple", 16432700, 0.3, 0.05F) {
@Override
protected void init() {
addFermentation(Juice.Apple);
}
},
Apricot("wine.apricot", 15781686, 0.3, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.Apricot);
}
},
Banana("wine.banana", 14993485, 0.3, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.Banana);
}
},
Cherry("wine.cherry", 11207702, 0.3, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.Cherry);
}
},
Elderberry("wine.elderberry", 9764865, 0.3, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.Elderberry);
}
},
Peach("cider.peach", 15361563, 0.3, 0.05F) {
@Override
protected void init() {
addFermentation(Juice.Peach);
}
},
Pear("ciderpear", 15061095, 0.3, 0.05F) {
@Override
protected void init() {
addFermentation(Juice.Pear);
}
},
Plum("wine.plum", 12063752, 0.3, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.Plum);
}
},
Carrot("wine.carrot", 16219394, 0.3, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.Carrot);
}
},
WhiteWine("wine.white", 15587989, 0.1, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.WhiteGrape);
}
},
RedWine("wine.red", 7670539, 0.2, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.RedGrape);
}
},
SparklingWine("wine.sparkling", 16709566, 0.1, 0.1F),
Agave("wine.agave", 13938276, 0.2, 0.1F),
Potato("fermented.potatoes", 12028240, 0.8, 0.1F) {
@Override
protected void init() {
addFermentation("cropPotato");
}
},
Citrus("wine.citrus", 16776960, 0.2, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.Lemon);
addFermentation(Juice.Lime);
addFermentation(Juice.Orange);
addFermentation(Juice.Grapefruit);
}
},
Cranberry("wine.cranberry", 11599874, 0.2, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.Cranberry);
}
},
Pineapple("wine.pineapple", 14724150, 0.2, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.Pineapple);
}
},
Tomato("wine.tomato", 12458521, 0.2, 0.1F) {
@Override
protected void init() {
addFermentation(Juice.Tomato);
}
},
Fruit("juice", 16432700, 0.2, 0.1F),
Ale("beer.ale", 12991009, 0.7, 0.05F),
Lager("beer.lager", 15301637, 0.7, 0.05F),
WheatBeer("beer.wheat", 14380552, 0.7, 0.05F),
RyeBeer("beer.rye", 10836007, 0.7, 0.05F),
CornBeer("beer.corn", 13411364, 0.7, 0.05F),
Stout("beer.stout", 5843201, 0.8, 0.05F),
Barley("mash.grain", 12991009, 0.9, 0.05F),
Wheat("mash.wheat", 12991009, 0.9, 0.05F),
Rye("mash.rye", 10836007, 0.9, 0.05F),
Corn("mash.corn", 13411364, 0.9, 0.05F);
private final List<String> fermentationLiquid;
private final FluidType type;
private String fermentationSolid;
private final CocktailLiquid cocktailLiquid;
Alcohol(final String ident, final int color, final double transparency, float abv) {
this.fermentationLiquid = new ArrayList<>();
this.fermentationSolid = "";
init();
type = new FluidType(ident, String.format("%s.fluid.%s.%s", ExtraTrees.instance.getModId(), "Alcohol", this.name()), color)
.setTransparency(transparency)
.setTextures(new ResourceLocation(Constants.EXTRA_TREES_MOD_ID, "blocks/liquids/liquid"))
.setPlaceHandler((type) -> type == FluidContainerType.GLASS);
cocktailLiquid = new CocktailLiquid(type, abv);
}
protected void init() {
}
@Override
public FluidType getType() {
return type;
}
@Override
public ICocktailIngredient getIngredient() {
return cocktailLiquid;
}
public List<String> getFermentationLiquid() {
return fermentationLiquid;
}
protected void addFermentation(final Juice juice) {
this.fermentationLiquid.add(juice.getType().getIdentifier());
}
protected void addFermentation(final String oreDict) {
this.fermentationSolid = oreDict;
}
@Override
public String toString() {
return type.getDisplayName();
}
@Override
public FluidStack get(final int amount) {
return type.get(amount);
}
}
| ForestryMC/Binnie | extratrees/src/main/java/binnie/extratrees/liquid/Alcohol.java |
213,011 | package com.javarush.task.task13.task1301;
/*
Пиво
1. Подумай, какой из двух интерфейсов нужно реализовать в классе Beer.
2. Добавь к классу Beer этот интерфейс и реализуй все его методы.
3. Подумай, как связаны переменная READY_TO_GO_HOME и метод isReadyToGoHome.
4. Верни значение переменной READY_TO_GO_HOME в методе isReadyToGoHome.
*/
public class Solution {
public static void main(String[] args) throws Exception {
}
public interface Drink {
void askMore(String message);
void sayThankYou();
boolean isReadyToGoHome();
}
public interface Alcohol extends Drink {
boolean READY_TO_GO_HOME = false;
void sleepOnTheFloor();
}
public static class Beer implements Alcohol{
@Override
public void askMore(String message) {
}
@Override
public void sayThankYou() {
}
@Override
public boolean isReadyToGoHome() {
return READY_TO_GO_HOME;
}
@Override
public void sleepOnTheFloor() {
}
}
} | avedensky/JavaRushTasks | 2.JavaCore/src/com/javarush/task/task13/task1301/Solution.java |
213,012 | package com.robmelfi.health.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import javax.validation.constraints.*;
import org.springframework.data.elasticsearch.annotations.Document;
import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;
/**
* A Points.
*/
@Entity
@Table(name = "points")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "points")
public class Points implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Column(name = "jhi_date", nullable = false)
private LocalDate date;
@Column(name = "excercise")
private Integer excercise;
@Column(name = "meals")
private Integer meals;
@Column(name = "alcohol")
private Integer alcohol;
@Size(max = 140)
@Column(name = "notes", length = 140)
private String notes;
@ManyToOne(optional = false)
@NotNull
@JsonIgnoreProperties("")
private User user;
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public LocalDate getDate() {
return date;
}
public Points date(LocalDate date) {
this.date = date;
return this;
}
public void setDate(LocalDate date) {
this.date = date;
}
public Integer getExcercise() {
return excercise;
}
public Points excercise(Integer excercise) {
this.excercise = excercise;
return this;
}
public void setExcercise(Integer excercise) {
this.excercise = excercise;
}
public Integer getMeals() {
return meals;
}
public Points meals(Integer meals) {
this.meals = meals;
return this;
}
public void setMeals(Integer meals) {
this.meals = meals;
}
public Integer getAlcohol() {
return alcohol;
}
public Points alcohol(Integer alcohol) {
this.alcohol = alcohol;
return this;
}
public void setAlcohol(Integer alcohol) {
this.alcohol = alcohol;
}
public String getNotes() {
return notes;
}
public Points notes(String notes) {
this.notes = notes;
return this;
}
public void setNotes(String notes) {
this.notes = notes;
}
public User getUser() {
return user;
}
public Points user(User user) {
this.user = user;
return this;
}
public void setUser(User user) {
this.user = user;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Points points = (Points) o;
if (points.getId() == null || getId() == null) {
return false;
}
return Objects.equals(getId(), points.getId());
}
@Override
public int hashCode() {
return Objects.hashCode(getId());
}
@Override
public String toString() {
return "Points{" +
"id=" + getId() +
", date='" + getDate() + "'" +
", excercise=" + getExcercise() +
", meals=" + getMeals() +
", alcohol=" + getAlcohol() +
", notes='" + getNotes() + "'" +
"}";
}
}
| robmelfi/21-points-react | src/main/java/com/robmelfi/health/domain/Points.java |
213,013 | //#############################################################################
//# #
//# Copyright (C) <2015> <IMS MAXIMS> #
//# #
//# This program is free software: you can redistribute it and/or modify #
//# it under the terms of the GNU Affero General Public License as #
//# published by the Free Software Foundation, either version 3 of the #
//# License, or (at your option) any later version. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU Affero General Public License for more details. #
//# #
//# You should have received a copy of the GNU Affero General Public License #
//# along with this program. If not, see <http://www.gnu.org/licenses/>. #
//# #
//# IMS MAXIMS provides absolutely NO GUARANTEE OF THE CLINICAL SAFTEY of #
//# this program. Users of this software do so entirely at their own risk. #
//# IMS MAXIMS only ensures the Clinical Safety of unaltered run-time #
//# software that it builds, deploys and maintains. #
//# #
//#############################################################################
//#EOH
// This code was generated by Barbara Worwood using IMS Development Environment (version 1.80 build 5589.25814)
// Copyright (C) 1995-2015 IMS MAXIMS. All rights reserved.
// WARNING: DO NOT MODIFY the content of this file
package ims.core.clinical.vo;
/**
* Linked to core.clinical.Alcohol business object (ID: 1003100037).
*/
public class AlcoholRefVo extends ims.vo.ValueObjectRef implements ims.domain.IDomainGetter
{
private static final long serialVersionUID = 1L;
public AlcoholRefVo()
{
}
public AlcoholRefVo(Integer id, int version)
{
super(id, version);
}
public final boolean getID_AlcoholIsNotNull()
{
return this.id != null;
}
public final Integer getID_Alcohol()
{
return this.id;
}
public final void setID_Alcohol(Integer value)
{
this.id = value;
}
public final int getVersion_Alcohol()
{
return this.version;
}
public Object clone()
{
return new AlcoholRefVo(this.id, this.version);
}
public final AlcoholRefVo toAlcoholRefVo()
{
if(this.id == null)
return this;
return new AlcoholRefVo(this.id, this.version);
}
public boolean equals(Object obj)
{
if(!(obj instanceof AlcoholRefVo))
return false;
AlcoholRefVo compareObj = (AlcoholRefVo)obj;
if(this.id != null && compareObj.getBoId() != null)
return this.id.equals(compareObj.getBoId());
if(this.id != null && compareObj.getBoId() == null)
return false;
if(this.id == null && compareObj.getBoId() != null)
return false;
return super.equals(obj);
}
public int hashCode()
{
if(this.id != null)
return this.id.intValue();
return super.hashCode();
}
public boolean isValidated()
{
return true;
}
public String[] validate()
{
return null;
}
public String getBoClassName()
{
return "ims.core.clinical.domain.objects.Alcohol";
}
public Class getDomainClass()
{
return ims.core.clinical.domain.objects.Alcohol.class;
}
public String getIItemText()
{
return toString();
}
public String toString()
{
return this.getClass().toString() + " (ID: " + (this.id == null ? "null" : this.id.toString()) + ")";
}
public int compareTo(Object obj)
{
if (obj == null)
return -1;
if (!(obj instanceof AlcoholRefVo))
throw new ClassCastException("A AlcoholRefVo object cannot be compared an Object of type " + obj.getClass().getName());
if (this.id == null)
return 1;
if (((AlcoholRefVo)obj).getBoId() == null)
return -1;
return this.id.compareTo(((AlcoholRefVo)obj).getBoId());
}
// this method is not needed. It is here for compatibility purpose only.
public int compareTo(Object obj, boolean caseInsensitive)
{
if(caseInsensitive); // this is to avoid Eclipse warning
return compareTo(obj);
}
public Object getFieldValueByFieldName(String fieldName)
{
if(fieldName == null)
throw new ims.framework.exceptions.CodingRuntimeException("Invalid field name");
fieldName = fieldName.toUpperCase();
if(fieldName.equals("ID_ALCOHOL"))
return getID_Alcohol();
return super.getFieldValueByFieldName(fieldName);
}
}
| IMS-MAXIMS/openMAXIMS | Source Library/openmaxims_workspace/ValueObjects/src/ims/core/clinical/vo/AlcoholRefVo.java |
213,014 | // Autogenerated from vk-api-schema. Please don't edit it manually.
package com.vk.api.sdk.objects.users;
import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;
import com.vk.api.sdk.objects.Validable;
import com.vk.api.sdk.objects.database.LanguageFull;
import java.util.List;
import java.util.Objects;
/**
* Personal object
*/
public class Personal implements Validable {
/**
* User's views on alcohol
*/
@SerializedName("alcohol")
private Integer alcohol;
/**
* User's inspired by
*/
@SerializedName("inspired_by")
private String inspiredBy;
@SerializedName("langs")
private List<String> langs;
/**
* User's languages with full info
*/
@SerializedName("langs_full")
private List<LanguageFull> langsFull;
/**
* User's personal priority in life
*/
@SerializedName("life_main")
private Integer lifeMain;
/**
* User's personal priority in people
*/
@SerializedName("people_main")
private Integer peopleMain;
/**
* User's political views
*/
@SerializedName("political")
private Integer political;
/**
* User's religion
*/
@SerializedName("religion")
private String religion;
/**
* User's religion id
*/
@SerializedName("religion_id")
private Integer religionId;
/**
* User's views on smoking
*/
@SerializedName("smoking")
private Integer smoking;
public Integer getAlcohol() {
return alcohol;
}
public Personal setAlcohol(Integer alcohol) {
this.alcohol = alcohol;
return this;
}
public String getInspiredBy() {
return inspiredBy;
}
public Personal setInspiredBy(String inspiredBy) {
this.inspiredBy = inspiredBy;
return this;
}
public List<String> getLangs() {
return langs;
}
public Personal setLangs(List<String> langs) {
this.langs = langs;
return this;
}
public List<LanguageFull> getLangsFull() {
return langsFull;
}
public Personal setLangsFull(List<LanguageFull> langsFull) {
this.langsFull = langsFull;
return this;
}
public Integer getLifeMain() {
return lifeMain;
}
public Personal setLifeMain(Integer lifeMain) {
this.lifeMain = lifeMain;
return this;
}
public Integer getPeopleMain() {
return peopleMain;
}
public Personal setPeopleMain(Integer peopleMain) {
this.peopleMain = peopleMain;
return this;
}
public Integer getPolitical() {
return political;
}
public Personal setPolitical(Integer political) {
this.political = political;
return this;
}
public String getReligion() {
return religion;
}
public Personal setReligion(String religion) {
this.religion = religion;
return this;
}
public Integer getReligionId() {
return religionId;
}
public Personal setReligionId(Integer religionId) {
this.religionId = religionId;
return this;
}
public Integer getSmoking() {
return smoking;
}
public Personal setSmoking(Integer smoking) {
this.smoking = smoking;
return this;
}
@Override
public int hashCode() {
return Objects.hash(alcohol, langsFull, peopleMain, smoking, political, lifeMain, langs, inspiredBy, religionId, religion);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Personal personal = (Personal) o;
return Objects.equals(alcohol, personal.alcohol) &&
Objects.equals(religionId, personal.religionId) &&
Objects.equals(lifeMain, personal.lifeMain) &&
Objects.equals(peopleMain, personal.peopleMain) &&
Objects.equals(smoking, personal.smoking) &&
Objects.equals(political, personal.political) &&
Objects.equals(langs, personal.langs) &&
Objects.equals(langsFull, personal.langsFull) &&
Objects.equals(inspiredBy, personal.inspiredBy) &&
Objects.equals(religion, personal.religion);
}
@Override
public String toString() {
final Gson gson = new Gson();
return gson.toJson(this);
}
public String toPrettyString() {
final StringBuilder sb = new StringBuilder("Personal{");
sb.append("alcohol=").append(alcohol);
sb.append(", religionId=").append(religionId);
sb.append(", lifeMain=").append(lifeMain);
sb.append(", peopleMain=").append(peopleMain);
sb.append(", smoking=").append(smoking);
sb.append(", political=").append(political);
sb.append(", langs='").append(langs).append("'");
sb.append(", langsFull=").append(langsFull);
sb.append(", inspiredBy='").append(inspiredBy).append("'");
sb.append(", religion='").append(religion).append("'");
sb.append('}');
return sb.toString();
}
}
| VKCOM/vk-java-sdk | sdk/src/main/java/com/vk/api/sdk/objects/users/Personal.java |
213,015 | package com.javarush.task.task13.task1301;
/*
Пиво
*/
public class Solution {
public static void main(String[] args) throws Exception {
}
public interface Drink {
void askMore(String message);
void sayThankYou();
boolean isReadyToGoHome();
}
public interface Alcohol extends Drink {
boolean READY_TO_GO_HOME = false;
void sleepOnTheFloor();
}
public static class Beer implements Alcohol {
public void sleepOnTheFloor() {}
public void askMore(String message) {}
public void sayThankYou() {}
public boolean isReadyToGoHome() {
return READY_TO_GO_HOME;
}
}
} | ksilerman/JavaExercises | JavaRushTasks/2.JavaCore/src/com/javarush/task/task13/task1301/Solution.java |
213,017 | /**
* Copyright (c) 2019 Gregorius Techneticies
*
* This file is part of GregTech.
*
* GregTech is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GregTech is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with GregTech. If not, see <http://www.gnu.org/licenses/>.
*/
package gregapi.damage;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
/**
* @author Gregorius Techneticies
*/
public class DamageSourceAlcohol extends DamageSource {
public DamageSourceAlcohol() {
super("alcohol");
setDamageBypassesArmor();
setDamageIsAbsolute();
}
@Override
public IChatComponent func_151519_b(EntityLivingBase aTarget) {
return new ChatComponentText(EnumChatFormatting.RED+aTarget.getCommandSenderName()+EnumChatFormatting.WHITE + " died from alcohol poisoning");
}
}
| GregTech6-Unofficial/GregTech6-Unofficial | src/main/java/gregapi/damage/DamageSourceAlcohol.java |
213,018 | package biz.dealnote.messenger.model;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;
import biz.dealnote.messenger.model.database.Country;
/**
* Created by ruslan.kolbasa on 25.11.2016.
* phoenix
*/
public final class UserDetails implements Parcelable {
private IdPair photoId;
private Audio statusAudio;
private int friendsCount;
private int onlineFriendsCount;
private int mutualFriendsCount;
private int followersCount;
private int groupsCount;
private int photosCount;
private int audiosCount;
private int videosCount;
private int allWallCount;
private int ownWallCount;
private int postponedWallCount;
private String bdate;
private City city;
private Country country;
private String hometown;
private String phone;
private String homePhone;
private String skype;
private String instagram;
private String twitter;
private String facebook;
private List<Career> careers;
private List<Military> militaries;
private List<University> universities;
private List<School> schools;
private List<Relative> relatives;
private int relation;
private Owner relationPartner;
private String[] languages;
private int political;
private int peopleMain;
private int lifeMain;
private int smoking;
private int alcohol;
private String inspiredBy;
private String religion;
private String site;
private String interests;
private String music;
private String activities;
private String movies;
private String tv;
private String games;
private String quotes;
private String about;
private String books;
public String getInterests() {
return interests;
}
public UserDetails setInterests(String interests) {
this.interests = interests;
return this;
}
public String getMusic() {
return music;
}
public UserDetails setMusic(String music) {
this.music = music;
return this;
}
public String getActivities() {
return activities;
}
public UserDetails setActivities(String activities) {
this.activities = activities;
return this;
}
public String getMovies() {
return movies;
}
public UserDetails setMovies(String movies) {
this.movies = movies;
return this;
}
public String getTv() {
return tv;
}
public UserDetails setTv(String tv) {
this.tv = tv;
return this;
}
public String getGames() {
return games;
}
public UserDetails setGames(String games) {
this.games = games;
return this;
}
public String getQuotes() {
return quotes;
}
public UserDetails setQuotes(String quotes) {
this.quotes = quotes;
return this;
}
public String getAbout() {
return about;
}
public UserDetails setAbout(String about) {
this.about = about;
return this;
}
public String getBooks() {
return books;
}
public UserDetails setBooks(String books) {
this.books = books;
return this;
}
public UserDetails setSite(String site) {
this.site = site;
return this;
}
public String getSite() {
return site;
}
public UserDetails setAlcohol(int alcohol) {
this.alcohol = alcohol;
return this;
}
public UserDetails setInspiredBy(String inspiredBy) {
this.inspiredBy = inspiredBy;
return this;
}
public UserDetails setLifeMain(int lifeMain) {
this.lifeMain = lifeMain;
return this;
}
public UserDetails setPeopleMain(int peopleMain) {
this.peopleMain = peopleMain;
return this;
}
public UserDetails setPolitical(int political) {
this.political = political;
return this;
}
public UserDetails setReligion(String religion) {
this.religion = religion;
return this;
}
public UserDetails setSmoking(int smoking) {
this.smoking = smoking;
return this;
}
public int getAlcohol() {
return alcohol;
}
public int getLifeMain() {
return lifeMain;
}
public int getPeopleMain() {
return peopleMain;
}
public int getPolitical() {
return political;
}
public int getSmoking() {
return smoking;
}
public String getInspiredBy() {
return inspiredBy;
}
public String getReligion() {
return religion;
}
public UserDetails setLanguages(String[] languages) {
this.languages = languages;
return this;
}
public String[] getLanguages() {
return languages;
}
public UserDetails setRelation(int relation) {
this.relation = relation;
return this;
}
public UserDetails setRelationPartner(Owner relationPartner) {
this.relationPartner = relationPartner;
return this;
}
public int getRelation() {
return relation;
}
public Owner getRelationPartner() {
return relationPartner;
}
public UserDetails setRelatives(List<Relative> relatives) {
this.relatives = relatives;
return this;
}
public List<Relative> getRelatives() {
return relatives;
}
public static final class Relative {
private User user;
private String type;
private String name;
public Relative setName(String name) {
this.name = name;
return this;
}
public String getName() {
return name;
}
public Relative setType(String type) {
this.type = type;
return this;
}
public Relative setUser(User user) {
this.user = user;
return this;
}
public User getUser() {
return user;
}
public String getType() {
return type;
}
}
public UserDetails setSchools(List<School> schools) {
this.schools = schools;
return this;
}
public List<School> getSchools() {
return schools;
}
public UserDetails setUniversities(List<University> universities) {
this.universities = universities;
return this;
}
public List<University> getUniversities() {
return universities;
}
public UserDetails setMilitaries(List<Military> militaries) {
this.militaries = militaries;
return this;
}
public List<Military> getMilitaries() {
return militaries;
}
public UserDetails setCareers(List<Career> careers) {
this.careers = careers;
return this;
}
public List<Career> getCareers() {
return careers;
}
public UserDetails setSkype(String skype) {
this.skype = skype;
return this;
}
public String getSkype() {
return skype;
}
public UserDetails setInstagram(String instagram) {
this.instagram = instagram;
return this;
}
public String getInstagram() {
return instagram;
}
public UserDetails setTwitter(String twitter) {
this.twitter = twitter;
return this;
}
public String getTwitter() {
return twitter;
}
public UserDetails setFacebook(String facebook) {
this.facebook = facebook;
return this;
}
public String getFacebook() {
return facebook;
}
public UserDetails setHomePhone(String homePhone) {
this.homePhone = homePhone;
return this;
}
public String getHomePhone() {
return homePhone;
}
public UserDetails setPhone(String phone) {
this.phone = phone;
return this;
}
public String getPhone() {
return phone;
}
public UserDetails(){
}
public UserDetails setHometown(String hometown) {
this.hometown = hometown;
return this;
}
public String getHometown() {
return hometown;
}
public UserDetails setCountry(Country country) {
this.country = country;
return this;
}
public Country getCountry() {
return country;
}
public City getCity() {
return city;
}
public UserDetails setCity(City city) {
this.city = city;
return this;
}
private UserDetails(Parcel in) {
photoId = in.readParcelable(IdPair.class.getClassLoader());
statusAudio = in.readParcelable(Audio.class.getClassLoader());
friendsCount = in.readInt();
onlineFriendsCount = in.readInt();
mutualFriendsCount = in.readInt();
followersCount = in.readInt();
groupsCount = in.readInt();
photosCount = in.readInt();
audiosCount = in.readInt();
videosCount = in.readInt();
allWallCount = in.readInt();
ownWallCount = in.readInt();
postponedWallCount = in.readInt();
bdate = in.readString();
}
public static final Creator<UserDetails> CREATOR = new Creator<UserDetails>() {
@Override
public UserDetails createFromParcel(Parcel in) {
return new UserDetails(in);
}
@Override
public UserDetails[] newArray(int size) {
return new UserDetails[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeParcelable(photoId, i);
parcel.writeParcelable(statusAudio, i);
parcel.writeInt(friendsCount);
parcel.writeInt(onlineFriendsCount);
parcel.writeInt(mutualFriendsCount);
parcel.writeInt(followersCount);
parcel.writeInt(groupsCount);
parcel.writeInt(photosCount);
parcel.writeInt(audiosCount);
parcel.writeInt(videosCount);
parcel.writeInt(allWallCount);
parcel.writeInt(ownWallCount);
parcel.writeInt(postponedWallCount);
parcel.writeString(bdate);
}
public String getBdate() {
return bdate;
}
public UserDetails setBdate(String bdate) {
this.bdate = bdate;
return this;
}
public IdPair getPhotoId() {
return photoId;
}
public UserDetails setPhotoId(IdPair photoId) {
this.photoId = photoId;
return this;
}
public Audio getStatusAudio() {
return statusAudio;
}
public UserDetails setStatusAudio(Audio statusAudio) {
this.statusAudio = statusAudio;
return this;
}
public int getFriendsCount() {
return friendsCount;
}
public UserDetails setFriendsCount(int friendsCount) {
this.friendsCount = friendsCount;
return this;
}
public int getOnlineFriendsCount() {
return onlineFriendsCount;
}
public UserDetails setOnlineFriendsCount(int onlineFriendsCount) {
this.onlineFriendsCount = onlineFriendsCount;
return this;
}
public int getMutualFriendsCount() {
return mutualFriendsCount;
}
public UserDetails setMutualFriendsCount(int mutualFriendsCount) {
this.mutualFriendsCount = mutualFriendsCount;
return this;
}
public int getFollowersCount() {
return followersCount;
}
public UserDetails setFollowersCount(int followersCount) {
this.followersCount = followersCount;
return this;
}
public int getGroupsCount() {
return groupsCount;
}
public UserDetails setGroupsCount(int groupsCount) {
this.groupsCount = groupsCount;
return this;
}
public int getPhotosCount() {
return photosCount;
}
public UserDetails setPhotosCount(int photosCount) {
this.photosCount = photosCount;
return this;
}
public int getAudiosCount() {
return audiosCount;
}
public UserDetails setAudiosCount(int audiosCount) {
this.audiosCount = audiosCount;
return this;
}
public int getVideosCount() {
return videosCount;
}
public UserDetails setVideosCount(int videosCount) {
this.videosCount = videosCount;
return this;
}
public int getAllWallCount() {
return allWallCount;
}
public UserDetails setAllWallCount(int allWallCount) {
this.allWallCount = allWallCount;
return this;
}
public int getOwnWallCount() {
return ownWallCount;
}
public UserDetails setOwnWallCount(int ownWallCount) {
this.ownWallCount = ownWallCount;
return this;
}
public int getPostponedWallCount() {
return postponedWallCount;
}
public UserDetails setPostponedWallCount(int postponedWallCount) {
this.postponedWallCount = postponedWallCount;
return this;
}
} | PhoenixDevTeam/Phoenix-for-VK | app/src/main/java/biz/dealnote/messenger/model/UserDetails.java |
213,019 | /**
* Kazunori Hayashi
* Version 1.0 29/7/2013
*/
public class MenuItem
{
//definition of menu item type
public final static int MAIN = 1;
public final static int DRINK = 2;
public final static int ALCOHOL = 3;
public final static int DESSERT = 4;
private int ID;
private String name;
private byte type;
private double price;
private byte state;
private double promotion_price;
public final static byte PROMOTION_ITEM = 1;
public final static byte SEASONAL_ITEM = 2;
public MenuItem(int newID, String newName, double newPrice, byte newType)
{
this.ID = newID;
this.name = newName;
this.price = newPrice;
this.type = newType;
this.state = 0;
this.promotion_price = 0;
}
//setter
public void setName( String newName)
{
this.name = newName;
}
public void setPrice( double newPrice)
{
this.price = newPrice;
}
public void setType( byte newType)
{
this.type = newType;
}
public void setState( byte newState, double tempPrice)
{
this.state = newState;
this.promotion_price = tempPrice;
}
public void resetState()
{
this.state = 0;
this.promotion_price = 0;
}
//getter
int getID()
{
return this.ID;
}
String getName()
{
return this.name;
}
double getPrice()
{
if(this.state != 0 && this.promotion_price != 0)
{
return this.promotion_price;
}
else
return this.price;
}
double gerRegularPrice()
{
return this.price;
}
byte getType()
{
return this.type;
}
byte getState()
{
return this.state;
}
}
| kishanrajput23/Java-Projects-Collections | Restaurant-management-system/MenuItem.java |
213,020 | package ivorius.psychedelicraft.fluids;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ivorius.ivtoolkit.gui.IntegerRange;
import ivorius.psychedelicraft.Psychedelicraft;
import ivorius.psychedelicraft.client.rendering.MCColorHelper;
import ivorius.psychedelicraft.entities.drugs.DrugInfluence;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.List;
/**
* Created by lukas on 25.11.14.
*/
public class FluidAlcohol extends FluidDrug implements FluidFermentable, FluidDistillable
{
public int fermentationSteps;
public double fermentationAlcohol;
public double distillationAlcohol;
public double maturationAlcohol;
private int matureColor;
private int distilledColor;
public TickInfo tickInfo;
public final List<NamedAlcohol> names = new ArrayList<>();
public final List<AlcoholIcon> alcIcons = new ArrayList<>();
public FluidAlcohol(String fluidName, int fermentationSteps, double fermentationAlcohol, double distillationAlcohol, double maturationAlcohol, TickInfo tickInfo)
{
super(fluidName);
this.fermentationSteps = fermentationSteps;
this.fermentationAlcohol = fermentationAlcohol;
this.distillationAlcohol = distillationAlcohol;
this.maturationAlcohol = maturationAlcohol;
this.tickInfo = tickInfo;
setDrinkable(true);
matureColor = 0xcc592518;
distilledColor = 0x33ffffff;
setStillIconName(Psychedelicraft.modBase + "slurry_still");
setFlowingIconName(Psychedelicraft.modBase + "slurry_flow");
}
public void addName(String iconName, IntegerRange maturationRange, IntegerRange distillationRange)
{
names.add(new NamedAlcohol(iconName, maturationRange, distillationRange));
}
public void addIcon(IntegerRange fermentationRange, IntegerRange maturationRange, IntegerRange distillationRange, String stillIconName, String flowingIconName)
{
alcIcons.add(new AlcoholIcon(fermentationRange, maturationRange, distillationRange, stillIconName, flowingIconName));
}
public int getMatureColor()
{
return matureColor;
}
public void setMatureColor(int matureColor)
{
this.matureColor = matureColor;
}
public int getDistilledColor()
{
return distilledColor;
}
public void setDistilledColor(int distilledColor)
{
this.distilledColor = distilledColor;
}
public <M extends AlcoholMatcher> M getMatchedValue(FluidStack stack, List<M> values)
{
int fermentation = getFermentation(stack);
int distillation = getDistillation(stack);
int maturation = getMaturation(stack);
for (M alc : values)
{
if (alc.matches(fermentation, fermentationSteps, distillation, maturation))
return alc;
}
return null;
}
public NamedAlcohol getSpecialName(FluidStack stack)
{
return getMatchedValue(stack, names);
}
public AlcoholIcon getSpecialIcon(FluidStack stack)
{
return getMatchedValue(stack, alcIcons);
}
public FluidStack fermentedFluidStack(int amount, int distillation, int maturation)
{
FluidStack fluidStack = new FluidStack(this, amount);
setFermentation(fluidStack, fermentationSteps);
setDistillation(fluidStack, distillation);
setMaturation(fluidStack, maturation);
return fluidStack;
}
public FluidStack fermentingFluidStack(int amount, int fermentation)
{
FluidStack fluidStack = new FluidStack(this, amount);
setFermentation(fluidStack, fermentation);
return fluidStack;
}
@Override
public void getDrugInfluencesPerLiter(FluidStack fluidStack, List<DrugInfluence> list)
{
super.getDrugInfluencesPerLiter(fluidStack, list);
int fermentation = getFermentation(fluidStack);
int distillation = getDistillation(fluidStack);
int maturation = getMaturation(fluidStack);
double alcohol = (double) fermentation / (double) fermentationSteps * fermentationAlcohol
+ distillationAlcohol * (1.0 - 1.0 / (1.0 + (double) distillation))
+ maturationAlcohol * (1.0 - 1.0 / (1.0 + (double) maturation * 0.2));
list.add(new DrugInfluence("Alcohol", 20, 0.003, 0.002, alcohol));
}
@Override
public void addCreativeSubtypes(String listType, List<FluidStack> list)
{
if (listType.equals(FluidFermentable.SUBTYPE_OPEN))
{
for (int fermentation = 0; fermentation <= fermentationSteps; fermentation++)
list.add(fermentingFluidStack(1, fermentation));
}
if (listType.equals(DrinkableFluid.SUBTYPE) || listType.equals(FluidFermentable.SUBTYPE_CLOSED))
{
for (int maturation = 0; maturation <= 1; maturation++)
list.add(fermentedFluidStack(1, 0, maturation));
for (int maturationW = 0; maturationW <= 2; maturationW++)
list.add(fermentedFluidStack(1, 2, maturationW * 7));
}
if (listType.equals(ExplodingFluid.SUBTYPE))
{
FluidStack fluidStack = fermentedFluidStack(1, 2, 3);
list.add(fluidStack);
}
}
@Override
public int fermentationTime(FluidStack stack, boolean openContainer)
{
if (getFermentation(stack) < fermentationSteps)
return openContainer ? tickInfo.ticksPerFermentation : UNFERMENTABLE;
else
return openContainer ? tickInfo.ticksUntilAcetification : tickInfo.ticksPerMaturation;
}
@Override
public ItemStack fermentStep(FluidStack stack, boolean openContainer)
{
int fermentation = getFermentation(stack);
if (openContainer)
{
if (fermentation < fermentationSteps)
setFermentation(stack, fermentation + 1);
else
setIsVinegar(stack, true);
}
else
setMaturation(stack, getMaturation(stack) + 1);
return null;
}
@Override
public int distillationTime(FluidStack stack)
{
int fermentation = getFermentation(stack);
int maturation = getMaturation(stack);
if (fermentation < fermentationSteps)
return UNDISTILLABLE;
else if (maturation == 0)
return tickInfo.ticksPerDistillation;
return UNDISTILLABLE;
}
@Override
public FluidStack distillStep(FluidStack stack)
{
int fermentation = getFermentation(stack);
if (fermentation < fermentationSteps)
return null;
else
{
int distillation = getDistillation(stack);
setDistillation(stack, distillation + 1);
int distilledAmount = MathHelper.floor_float(stack.amount * (1.0f - 0.5f / ((float) distillation + 1.0f)));
FluidStack slurry = new FluidStack(PSFluids.slurry, stack.amount - distilledAmount);
stack.amount = distilledAmount;
return slurry.amount > 0 ? slurry : null;
}
}
public int getFermentation(FluidStack stack)
{
return stack.tag != null ? MathHelper.clamp_int(stack.tag.getInteger("fermentation"), 0, fermentationSteps) : 0;
}
public void setFermentation(FluidStack stack, int fermentation)
{
FluidHelper.ensureTag(stack);
stack.tag.setInteger("fermentation", fermentation);
}
public int getDistillation(FluidStack stack)
{
return stack.tag != null ? Math.max(stack.tag.getInteger("distillation"), 0) : 0;
}
public void setDistillation(FluidStack stack, int distillation)
{
FluidHelper.ensureTag(stack);
stack.tag.setInteger("distillation", distillation);
}
public int getMaturation(FluidStack stack)
{
return stack.tag != null ? Math.max(stack.tag.getInteger("maturation"), 0) : 0;
}
public void setMaturation(FluidStack stack, int maturation)
{
FluidHelper.ensureTag(stack);
stack.tag.setInteger("maturation", maturation);
}
public boolean isVinegar(FluidStack stack)
{
return stack.tag != null && stack.tag.getBoolean("isVinegar");
}
public void setIsVinegar(FluidStack stack, boolean isVinegar)
{
FluidHelper.ensureTag(stack);
stack.tag.setBoolean("isVinegar", isVinegar);
}
@Override
public String getLocalizedName(FluidStack stack)
{
String baseName = this.getUnlocalizedName(stack);
if (isVinegar(stack))
return StatCollector.translateToLocalFormatted(String.format("%s.vinegar", baseName));
int fermentation = this.getFermentation(stack);
int distillation = this.getDistillation(stack);
int maturation = this.getMaturation(stack);
if (distillation == 0)
{
if (maturation > 0)
return StatCollector.translateToLocalFormatted(String.format("%s.mature", baseName), maturation);
else if (fermentation > 0)
return StatCollector.translateToLocalFormatted(String.format("%s.ferment.%d", baseName, fermentation));
else
return StatCollector.translateToLocalFormatted(baseName);
}
else
{
if (maturation > 0)
return StatCollector.translateToLocalFormatted(String.format("%s.dmature", baseName), maturation, distillation);
else
return StatCollector.translateToLocalFormatted(String.format("%s.distill", baseName), distillation);
}
}
@Override
public void registerIcons(IIconRegister iconRegister, int textureType)
{
super.registerIcons(iconRegister, textureType);
if (textureType == TEXTURE_TYPE_ITEM)
{
for (NamedAlcohol specialName : names)
specialName.registerIcons(iconRegister);
}
else if (textureType == TEXTURE_TYPE_BLOCK)
{
for (AlcoholIcon icon : alcIcons)
{
icon.stillIcon = icon.stillIconName != null ? iconRegister.registerIcon(icon.stillIconName) : null;
icon.flowingIcon = icon.flowingIconName != null ? iconRegister.registerIcon(icon.flowingIconName) : null;
}
}
}
@Override
public IIcon getIconSymbol(FluidStack fluidStack, int textureType)
{
if (textureType == TEXTURE_TYPE_ITEM)
{
NamedAlcohol specialName = getSpecialName(fluidStack);
if (specialName != null)
return specialName.icon;
}
return super.getIconSymbol(fluidStack, textureType);
}
@Override
public IIcon getIcon(FluidStack stack)
{
AlcoholIcon specialIcon = getSpecialIcon(stack);
if (specialIcon != null)
return specialIcon.stillIcon;
return super.getIcon(stack);
}
@Override
public int getColor(FluidStack stack)
{
int slurryColor = getColor();
int matureColor = getMatureColor(stack);
int clearColor = getDistilledColor(stack);
int distillation = getDistillation(stack);
int maturation = getMaturation(stack);
int baseFluidColor = MCColorHelper.mixColors(slurryColor, clearColor, (1.0f - 1.0f / (1.0f + (float) distillation)));
return MCColorHelper.mixColors(baseFluidColor, matureColor, (1.0f - 1.0f / (1.0f + (float) maturation * 0.2f)));
}
protected int getDistilledColor(FluidStack stack)
{
return distilledColor;
}
protected int getMatureColor(FluidStack stack)
{
return matureColor;
}
public static class TickInfo
{
public int ticksPerFermentation;
public int ticksPerDistillation;
public int ticksPerMaturation;
public int ticksUntilAcetification;
}
public static class AlcoholMatcher
{
public IntegerRange fermentationRange;
public IntegerRange maturationRange;
public IntegerRange distillationRange;
public AlcoholMatcher(IntegerRange fermentationRange, IntegerRange maturationRange, IntegerRange distillationRange)
{
this.fermentationRange = fermentationRange;
this.maturationRange = maturationRange;
this.distillationRange = distillationRange;
}
public boolean matches(int fermentation, int maxFermentation, int distillation, int maturation)
{
return (fermentationRange.getMin() < 0 ? fermentation >= maxFermentation : rangeContains(fermentationRange, fermentation))
&& rangeContains(distillationRange, distillation)
&& rangeContains(maturationRange, maturation);
}
private static boolean rangeContains(IntegerRange range, int value)
{
return value >= range.getMin() && (range.getMax() < 0 || value <= range.getMax());
}
}
public static class NamedAlcohol extends AlcoholMatcher
{
public String iconName;
@SideOnly(Side.CLIENT)
public IIcon icon;
public NamedAlcohol(String iconName, IntegerRange maturationRange, IntegerRange distillationRange)
{
super(new IntegerRange(-1, -1), maturationRange, distillationRange);
this.iconName = iconName;
}
public void registerIcons(IIconRegister register)
{
icon = iconName != null ? register.registerIcon(iconName) : null;
}
}
public static class AlcoholIcon extends AlcoholMatcher
{
public String stillIconName;
@SideOnly(Side.CLIENT)
public IIcon stillIcon;
public String flowingIconName;
@SideOnly(Side.CLIENT)
public IIcon flowingIcon;
public AlcoholIcon(IntegerRange fermentationRange, IntegerRange maturationRange, IntegerRange distillationRange, String stillIconName, String flowingIconName)
{
super(fermentationRange, maturationRange, distillationRange);
this.stillIconName = stillIconName;
this.flowingIconName = flowingIconName;
}
}
}
| Ivorforce/Psychedelicraft | src/main/java/ivorius/psychedelicraft/fluids/FluidAlcohol.java |
213,021 | package market.dto;
import org.springframework.hateoas.RepresentationModel;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Objects;
public class ProductDTO extends RepresentationModel<ProductDTO> {
private Long productId;
private String distillery;
@NotEmpty
@Pattern(regexp = "^[^#$%^&*()']*$")
private String name;
@NotNull
private Double price;
@Max(value = 2000)
private Integer age;
@NotNull
private Integer volume;
@NotNull
@Min(value = 1)
@Max(value = 96)
private Float alcohol;
private String description;
private boolean available;
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public String getDistillery() {
return distillery;
}
public void setDistillery(String distillery) {
this.distillery = distillery;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getPrice() {
return price;
}
public void setPrice(@NotNull Double price) {
this.price = price;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Integer getVolume() {
return volume;
}
public void setVolume(Integer volume) {
this.volume = volume;
}
public Float getAlcohol() {
return alcohol;
}
public void setAlcohol(Float alcohol) {
this.alcohol = alcohol;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public boolean isAvailable() {
return available;
}
public void setAvailable(boolean available) {
this.available = available;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ProductDTO that = (ProductDTO) o;
return available == that.available &&
Objects.equals(productId, that.productId) &&
Objects.equals(distillery, that.distillery) &&
Objects.equals(name, that.name) &&
Objects.equals(price, that.price) &&
Objects.equals(age, that.age) &&
Objects.equals(volume, that.volume) &&
Objects.equals(alcohol, that.alcohol) &&
Objects.equals(description, that.description);
}
@Override
public int hashCode() {
return Objects.hash(productId, distillery, name, price, age, volume, alcohol, description, available);
}
@Override
public String toString() {
return "ProductDTO{" +
"productId=" + productId +
", distillery='" + distillery + '\'' +
", name='" + name + '\'' +
", price=" + price +
", age=" + age +
", volume=" + volume +
", alcohol=" + alcohol +
", description='" + description + '\'' +
", available=" + available +
'}';
}
}
| aleksey-lukyanets/market | market-core/src/main/java/market/dto/ProductDTO.java |
213,022 | package com.epam;
/**
* @author Evgeny Borisov
*/
@Singleton
public class RecommendatorImpl implements Recommendator {
@InjectProperty("wisky")
private String alcohol;
public RecommendatorImpl() {
System.out.println("recommendator was created");
}
@Override
public void recommend() {
System.out.println("to protect from covid-2019, drink "+alcohol);
}
}
| Jeka1978/coronadesinfectorlifedemo | src/main/java/com/epam/RecommendatorImpl.java |
213,023 | package cn.mcmod.sakura.tags;
import cn.mcmod.sakura.SakuraMod;
import cn.mcmod_mmf.mmlib.utils.TagUtils;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.material.Fluid;
public class SakuraFluidTags {
public static final TagKey<Fluid> WATER_WATER = TagUtils.forgeFluidTag("water/water");
public static final TagKey<Fluid> FOOD_OIL = TagUtils.forgeFluidTag("food_oil");
public static final TagKey<Fluid> PLANTOIL = TagUtils.forgeFluidTag("plantoil");
public static final TagKey<Fluid> SOYSAUCE = TagUtils.forgeFluidTag("soysauce");
public static final TagKey<Fluid> BREWERS_ALCOHOL = TagUtils.modFluidTag(SakuraMod.MODID, "brewers_alcohol");
}
| 0999312/Sakura_mod | src/main/java/cn/mcmod/sakura/tags/SakuraFluidTags.java |
213,024 | /*
* Licensed under the EUPL, Version 1.2.
* You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*/
package net.dries007.tfc.common.fluids;
import java.util.Locale;
public enum Alcohol
{
BEER(0xFFC39E37),
CIDER(0xFFB0AE32),
RUM(0xFF6E0123),
SAKE(0xFFB7D9BC),
VODKA(0xFFDCDCDC),
WHISKEY(0xFF583719),
CORN_WHISKEY(0xFFD9C7B7),
RYE_WHISKEY(0xFFC77D51);
private final String id;
private final int color;
Alcohol(int color)
{
this.id = name().toLowerCase(Locale.ROOT);
this.color = color;
}
public String getId()
{
return id;
}
public int getColor()
{
return color;
}
}
| alcatrazEscapee/TerraFirmaCraft | src/main/java/net/dries007/tfc/common/fluids/Alcohol.java |
213,025 | package ca.spaz.cron.summary;
import java.awt.*;
import java.text.DecimalFormat;
import java.util.Iterator;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.border.Border;
import ca.spaz.cron.exercise.Exercise;
import ca.spaz.cron.foods.*;
import ca.spaz.cron.targets.Target;
import ca.spaz.cron.user.*;
import ca.spaz.util.ToolBox;
/**
* @TODO: break up into real components
*
* @author davidson
*/
public class TargetSummaryChart extends JComponent implements UserChangeListener {
public static final Color CALORIE_COLOR = Color.ORANGE;
public static final Color EXERCISE_COLOR = new Color(200, 160, 30);
public static final Color PROTEIN_COLOR = new Color(80, 220, 80);
public static final Color CARB_COLOR = new Color(80, 80, 220);
public static final Color LIPID_COLOR = new Color(220, 80, 80);
public static final Color ALCOHOL_COLOR = new Color(200, 230, 80);
public static final Color VITAMIN_COLOR = new Color(120, 180, 20);
public static final Color MINERAL_COLOR = new Color(80, 180, 180);
private static final double DISPLAY_THRESH = 2;
DecimalFormat valFormat = new DecimalFormat("00");
NutritionSummaryPanel summary;
List consumed;
List exercises;
boolean allSelected;
double energy = 0;
double energyBurned = 0;
double protein = 0;
double carbs = 0;
double lipid = 0;
double fiber = 0;
double vitamins = 0;
double minerals = 0;
double pcals = 0;
double fcals = 0;
double ccals = 0;
double acals = 0;
double total = 0;
public TargetSummaryChart(NutritionSummaryPanel summary) {
this.summary = summary;
UserManager.getUserManager().addUserChangeListener(this);
setFont(new Font("Application", Font.BOLD, 12));
setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
}
public void update(List consumed, boolean allSelected) {
this.consumed = consumed;
this.allSelected = allSelected;
update();
}
public void updateExercises(List exercises) {
this.exercises = exercises;
update();
}
public void update() {
energy = getAmount(consumed, NutrientInfo.getByName("Energy"));
if(allSelected) {
energyBurned = getEnergyBurned(exercises);
} else {
energyBurned = 0;
}
protein = getAmount(consumed, NutrientInfo.getProtein());
carbs = getAmount(consumed, NutrientInfo.getCarbs());
fiber = getAmount(consumed, NutrientInfo.getByName("Fiber"));
lipid = getAmount(consumed, NutrientInfo.getFat());
vitamins = summary.getVitaminsPanel().getTargetCompletion(false);
minerals = summary.getMineralsPanel().getTargetCompletion(false);
computeCalorieBreakdown(consumed);
repaint();
}
private void computeCalorieBreakdown(List servings) {
NutrientInfo pni = NutrientInfo.getByName("Protein");
NutrientInfo fni = NutrientInfo.getByName("Fat");
NutrientInfo cni = NutrientInfo.getByName("Carbs");
NutrientInfo ani = NutrientInfo.getByName("Alcohol");
pcals = ccals = fcals = acals = 0;
for (Iterator iter = servings.iterator(); iter.hasNext(); ) {
Serving serving = (Serving) iter.next();
Food f = serving.getFood();
if (serving.isLoaded()) {
double weight = serving.getGrams() / 100.0;
pcals += weight * f.getNutrientAmount(pni)
* f.getProteinConversionFactor();
fcals += weight * f.getNutrientAmount(fni)
* f.getLipidConversionFactor();
ccals += weight * f.getNutrientAmount(cni)
* f.getCarbConversionFactor();
acals += weight * f.getNutrientAmount(ani)
* f.getAlcoholConversionFactor();
}
}
total = pcals + ccals + fcals + acals;
if (total > 0 && energy - total > 0.1) {
ccals += (energy - total);
total = energy;
}
}
private double getAmount(List servings, NutrientInfo ni) {
double total = 0;
for (Iterator iter = servings.iterator(); iter.hasNext(); ) {
Serving serving = (Serving) iter.next();
if (serving.isLoaded()) {
double weight = serving.getGrams() / 100.0;
total += weight * serving.getFood().getNutrientAmount(ni);
}
}
return total;
}
private double getEnergyBurned(List exercises) {
double total = 0;
if(exercises != null) {
for (Iterator iter = exercises.iterator(); iter.hasNext(); ) {
Exercise exercise = (Exercise) iter.next();
total += exercise.getCalories();
}
}
return total;
}
private void paintBar(Graphics2D g, int x, int y, int w, int h, int w2, Color col) {
GradientPaint gradient = new GradientPaint(0, 0, Color.GRAY, w, 0, Color.LIGHT_GRAY, false);
g.setPaint(gradient);
g.fillRoundRect(x, y, w, h, h / 2, h / 2);
if (w2 > w) {
w2 = w;
}
if (w2 > DISPLAY_THRESH) {
gradient = new GradientPaint(0, 0, col.brighter(), w, 0, col.darker(), false);
g.setPaint(gradient);
g.fillRoundRect(x, y, w2, h, h / 2, h / 2);
}
g.setColor(Color.GRAY);
g.drawRoundRect(x, y, w, h, h / 2, h / 2);
}
private void paintBar(Graphics2D g, int x, int y, int w, int h, int w2, int secondaryW, Color col, Color secondCol) {
GradientPaint gradient = new GradientPaint(0, 0, Color.GRAY, w, 0, Color.LIGHT_GRAY, false);
g.setPaint(gradient);
g.fillRoundRect(x, y, w, h, h / 2, h / 2);
if (w2 > w) {
secondaryW = Math.max(secondaryW - (w2 - w), 0);
w2 = w;
}
if (secondaryW > w2) {
secondaryW = w2;
}
if (w2 > DISPLAY_THRESH) {
gradient = new GradientPaint(0, 0, col.brighter(), w, 0, col.darker(), false);
g.setPaint(gradient);
g.fillRoundRect(x, y, w2, h, h / 2, h / 2);
}
if (secondaryW > DISPLAY_THRESH) {
g.setColor(secondCol);
g.fillRoundRect(x + w2 - secondaryW, y, secondaryW, h, h / 2, h / 2);
}
g.setColor(Color.GRAY);
g.drawRoundRect(x, y, w, h, h / 2, h / 2);
}
private void paintCaloriesBar(Graphics2D g, int x, int y, int w, int h, int w2, Color col) {
GradientPaint gradient = new GradientPaint(0, 0, Color.GRAY, w, 0, Color.LIGHT_GRAY, false);
g.setPaint(gradient);
g.fillRect(x, y, w, h);
if (w2 > w) {
w2 = w;
}
if (w2 > DISPLAY_THRESH) {
int s = x;
int e = (int)(w2 * (pcals / total));
gradient = new GradientPaint(s, 0, PROTEIN_COLOR, s + e, 0, CARB_COLOR, false);
g.setPaint(gradient);
g.setColor(PROTEIN_COLOR);
g.fillRect(s, y, e, h);
s += e;
e = (int)(w2 * (ccals / total));
gradient = new GradientPaint(s, 0, CARB_COLOR, s + e, 0, LIPID_COLOR, false);
g.setPaint(gradient);
g.setColor(CARB_COLOR);
g.fillRect(s, y, e, h);
s += e;
e = (int)(w2 * (fcals / total));
gradient = new GradientPaint(s, 0, LIPID_COLOR, s + e, 0, ALCOHOL_COLOR, false);
g.setPaint(gradient);
g.setColor(LIPID_COLOR);
g.fillRect(s, y, e, h);
s += e;
e = (int)(w2 * (acals / total));
gradient = new GradientPaint(s, 0, ALCOHOL_COLOR, s + e, 0, ALCOHOL_COLOR, false);
g.setPaint(gradient);
g.setColor(ALCOHOL_COLOR);
g.fillRect(s, y, e, h);
}
g.setColor(Color.GRAY);
g.drawRect(x, y, w, h);
}
// @TODO: refactor this code more, as it's highly redundant
public void paintComponent(Graphics g) {
User user = UserManager.getCurrentUser();
int w = getWidth();
int h = getHeight();
int xo = 0;
int yo = 0;
Border border = getBorder();
if (border != null) {
Insets insets = border.getBorderInsets(this);
w -= insets.left + insets.right + 90;
h -= insets.top + insets.bottom;
xo = insets.left;
yo = insets.top;
}
int barHeight = (h / 6) - 5;
double barFill = 0;
g.setFont(g.getFont().deriveFont(Font.BOLD));
FontMetrics fm = g.getFontMetrics();
Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
Target energyTarget = user.getTarget(NutrientInfo.getByName("Energy"));
barFill = ToolBox.safeDivide(energy, energyTarget.getMin());
double secondaryBarFill = ToolBox.safeDivide(energyBurned, energyTarget.getMin());
paintBar(g2d, xo, yo + (barHeight + 5) * 0, w, barHeight, (int)(w * barFill), (int)(w * secondaryBarFill), CALORIE_COLOR, EXERCISE_COLOR);
g.setColor(Color.BLACK);
String calorieString = "Calories: " + (int)energy;
if(energyBurned > 0) {
calorieString += " (" + (int) (energy - energyBurned) + ")";
}
calorieString += " / " + (int)energyTarget.getMin()
+ " (" + Math.round(100 * barFill) + "%)";
g.drawString(calorieString, xo + 10, yo + barHeight / 2 + fm.getAscent() / 2);
Target proteinTarget = user.getTarget(NutrientInfo.getByName("Protein"));
barFill = ToolBox.safeDivide(protein, proteinTarget.getMin());
paintBar(g2d, xo, yo + (barHeight + 5) * 1, w, barHeight, (int)(w * barFill), PROTEIN_COLOR);
g.setColor(Color.BLACK);
g.drawString("Protein: " + (int)protein + "g / " + (int)proteinTarget.getMin()
+ "g (" + Math.round(100 * barFill) + "%)",
xo + 10, yo + (barHeight + 5) + barHeight / 2 + fm.getAscent() / 2);
Target carbTarget = user.getTarget(NutrientInfo.getByName("Carbs"));
barFill = ToolBox.safeDivide(carbs, carbTarget.getMin());
paintBar(g2d, xo, yo + (barHeight + 5) * 2, w, barHeight, (int)(w * barFill), CARB_COLOR);
g.setColor(Color.BLACK);
g.drawString("Carbohydrates: " + (int)carbs + "g / " + (int)carbTarget.getMin()
+ "g (" + Math.round(100 * barFill) + "%)",
xo + 10, yo + (barHeight + 5) * 2 + barHeight / 2 + fm.getAscent() / 2);
Target lipidTarget = user.getTarget(NutrientInfo.getByName("Fat"));
barFill = ToolBox.safeDivide(lipid, lipidTarget.getMin());
paintBar(g2d, xo, yo + (barHeight + 5) * 3, w, barHeight, (int)(w * barFill), LIPID_COLOR);
g.setColor(Color.BLACK);
g.drawString("Lipids: " + (int)lipid + "g / " + (int)lipidTarget.getMin()
+ "g (" + Math.round(100 * barFill) + "%)",
xo + 10, yo + (barHeight + 5) * 3 + barHeight / 2 + fm.getAscent() / 2);
barFill = vitamins;
paintBar(g2d, xo, yo + (barHeight + 5) * 4, w, barHeight, (int)(w * barFill), VITAMIN_COLOR);
g.setColor(Color.BLACK);
g.drawString("Vitamins: " + Math.round(100 * barFill) + "%",
xo + 10, yo + (barHeight + 5) * 4 + barHeight / 2 + fm.getAscent() / 2);
barFill = minerals;
paintBar(g2d, xo, yo + (barHeight + 5) * 5, w, barHeight, (int)(w * barFill), MINERAL_COLOR);
g.setColor(Color.BLACK);
g.drawString("Minerals: " + Math.round(100 * barFill) + "%",
xo + 10, yo + (barHeight + 5) * 5 + barHeight / 2 + fm.getAscent() / 2);
paintPFC(g, xo + w + 12, yo, 80);
}
private void paintPFC(Graphics g, int xo, int yo, int radius) {
if (total <= 0) {
return;
}
g.setColor(PROTEIN_COLOR);
int amount = 0;
g.fillArc(xo, yo, radius - 4, radius - 4, amount, (int)Math.round(360 * pcals / total));
amount += (int)(360 * (pcals / total));
g.setColor(CARB_COLOR);
g.fillArc(xo, yo, radius - 4, radius - 4, amount, (int)Math.round(360 * ccals / total));
amount += (int)(360 * (ccals / total));
g.setColor(LIPID_COLOR);
g.fillArc(xo, yo, radius - 4, radius - 4, amount, (int)Math.round((360 * fcals / total)));
amount += (int)(360 * (fcals / total));
g.setColor(ALCOHOL_COLOR);
g.fillArc(xo, yo, radius - 4, radius - 4, amount, (int)Math.round((360 * acals / total)));
g.setColor(Color.GRAY);
g.drawOval(xo, yo, radius - 5, radius - 5);
g.setFont(new Font("Courier", Font.BOLD, 12));
String str =
valFormat.format(((int)Math.round(100 * (pcals / total)))) + ":" +
valFormat.format(((int)Math.round(100 * (ccals / total)))) + ":" +
valFormat.format(((int)Math.round(100 * (fcals / total))));
if (acals > 0) {
str += ":" + valFormat.format(((int)Math.round(100 * (acals / total))));
}
int sw = xo + radius / 2 - g.getFontMetrics().stringWidth(str) / 2;
str = valFormat.format(((int)Math.round(100 * (pcals / total)))) + ":";
g.setColor(getBackground().darker());
g.drawString(str, sw - 1 + 1, yo + radius + 7 + 1);
g.setColor(PROTEIN_COLOR.darker());
g.drawString(str, sw - 1, yo + radius + 7);
str = " " + valFormat.format(((int)Math.round(100 * (ccals / total)))) + ":";
g.setColor(getBackground().darker());
g.drawString(str, sw - 1 + 1, yo + radius + 7 + 1);
g.setColor(CARB_COLOR);
g.drawString(str, sw - 1, yo + radius + 7);
str = " " + valFormat.format(((int)Math.round(100 * (fcals / total))));
if (acals > 0) {
str += ":";
}
g.setColor(getBackground().darker());
g.drawString(str, sw - 1 + 1, yo + radius + 7 + 1);
g.setColor(LIPID_COLOR);
g.drawString(str, sw - 1, yo + radius + 7);
if (acals > 0) {
str = " " + valFormat.format(((int)Math.round(100 * (acals / total))));
g.setColor(ALCOHOL_COLOR.darker());
g.drawString(str, sw - 1, yo + radius + 7);
}
}
public void userChanged(UserManager userMan) {
update();
}
}
| myint/cronometer | src/ca/spaz/cron/summary/TargetSummaryChart.java |
213,026 | package com.rs2.game.items;
/**
* Aug 14, 2017 : 2:03:05 AM
* ItemConstants.java
* @author Andrew (Mr Extremez)
*/
public class ItemConstants {
public static int BANK_SIZE = 352;
public final static boolean itemRequirements = true;
public final static int HAT = 0, CAPE = 1, AMULET = 2, WEAPON = 3,
CHEST = 4, SHIELD = 5, LEGS = 7, HANDS = 9, FEET = 10, RING = 12,
ARROWS = 13, ITEM_LIMIT = 15000, MAX_ITEM_AMOUNT = Integer.MAX_VALUE;
public final static int[] COMBAT_RELATED_ITEMS = { 35, 39, 40, 41, 42, 43,
44, 50, 53, 54, 60, 64, 75, 76, 78, 88, 546, 548, 577, 581, 598,
626, 628, 630, 632, 634, 667, 687, 746, 747, 767, 772, 775, 776,
777, 778, 818, 837, 839, 841, 843, 845, 847, 849, 851, 853, 855,
857, 859, 861, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872,
873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885,
886, 887, 888, 889, 890, 891, 892, 893, 942, 975, 1007, 1019, 1021,
1023, 1027, 1029, 1031, 1033, 1035, 1052, 1059, 1061, 1063, 1065,
1067, 1069, 1071, 1073, 1075, 1077, 1079, 1081, 1083, 1085, 1087,
1089, 1091, 1093, 1095, 1097, 1099, 1101, 1103, 1105, 1107, 1109,
1111, 1113, 1115, 1117, 1119, 1121, 1123, 1125, 1127, 1129, 1131,
1133, 1135, 1137, 1139, 1141, 1143, 1145, 1147, 1149, 1151, 1153,
1155, 1157, 1159, 1161, 1163, 1165, 1167, 1169, 1171, 1173, 1175,
1177, 1179, 1181, 1183, 1185, 1187, 1189, 1191, 1193, 1195, 1197,
1199, 1201, 1203, 1205, 1207, 1209, 1211, 1213, 1215, 1217, 1219,
1221, 1223, 1225, 1227, 1229, 1231, 1233, 1237, 1239, 1241, 1243,
1245, 1247, 1249, 1251, 1253, 1255, 1257, 1259, 1261, 1263, 1265,
1267, 1269, 1271, 1273, 1275, 1277, 1279, 1281, 1283, 1285, 1287,
1289, 1291, 1293, 1295, 1297, 1299, 1301, 1303, 1305, 1307, 1309,
1311, 1313, 1315, 1317, 1319, 1321, 1323, 1325, 1327, 1329, 1331,
1333, 1335, 1337, 1339, 1341, 1343, 1345, 1347, 1349, 1351, 1353,
1355, 1357, 1359, 1361, 1363, 1365, 1367, 1369, 1371, 1373, 1375,
1377, 1379, 1381, 1383, 1385, 1387, 1389, 1391, 1393, 1395, 1397,
1399, 1401, 1403, 1405, 1407, 1409, 1419, 1420, 1422, 1424, 1426,
1428, 1430, 1432, 1434, 1540, 1718, 1724, 2402, 2412, 2413, 2414,
2415, 2416, 2417, 2487, 2489, 2491, 2493, 2495, 2497, 2499, 2501,
2503, 2513, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540,
2541, 2577, 2579, 2581, 2583, 2585, 2587, 2589, 2591, 2593, 2595,
2597, 2599, 2601, 2603, 2605, 2607, 2609, 2611, 2613, 2615, 2617,
2619, 2621, 2623, 2625, 2627, 2629, 2653, 2655, 2659, 2661, 2663,
2667, 2669, 2671, 2673, 2861, 2864, 2865, 2866, 2890, 2896, 2906,
2916, 2926, 2936, 2961, 2963, 3053, 3054, 3095, 3096, 3097, 3098,
3099, 3100, 3101, 3105, 3107, 3122, 3140, 3170, 3171, 3172, 3173,
3174, 3175, 3176, 3190, 3192, 3194, 3196, 3198, 3200, 3202, 3204,
3327, 3329, 3331, 3333, 3335, 3337, 3339, 3341, 3343, 3385, 3387,
3389, 3391, 3393, 3472, 3473, 3474, 3475, 3476, 3477, 3479, 3481,
3483, 3485, 3486, 3488, 3748, 3749, 3751, 3753, 3755, 3757, 3758,
3759, 3761, 3763, 3765, 3767, 3769, 3771, 3773, 3775, 3777, 3779,
3781, 3783, 3785, 3787, 3789, 3791, 3797, 3840, 3841, 3842, 3843,
3844, 4087, 4089, 4091, 4093, 4095, 4097, 4099, 4101, 4103, 4105,
4107, 4109, 4111, 4113, 4115, 4117, 4119, 4121, 4123, 4125, 4127,
4129, 4131, 4150, 4151, 4153, 4156, 4158, 4160, 4170, 4172, 4173,
4174, 4175, 4212, 4214, 4215, 4216, 4217, 4218, 4219, 4220, 4221,
4222, 4223, 4224, 4226, 4227, 4228, 4229, 4230, 4231, 4232, 4233,
4234, 4298, 4300, 4302, 4304, 4308, 4310, 4502, 4503, 4504, 4505,
4506, 4507, 4508, 4509, 4510, 4511, 4512, 4580, 4582, 4585, 4587,
4600, 4675, 4708, 4710, 4712, 4714, 4716, 4718, 4720, 4722, 4724,
4726, 4728, 4730, 4732, 4734, 4736, 4738, 4740, 4745, 4747, 4749,
4751, 4753, 4755, 4757, 4759, 4778, 4783, 4788, 4793, 4803, 4827,
4860, 4866, 4872, 4878, 4884, 4890, 4896, 4902, 4908, 4914, 4920,
4926, 4932, 4938, 4944, 4950, 4956, 4962, 4968, 4974, 4980, 4986,
4992, 4998, 5014, 5016, 5018, 5553, 5554, 5555, 5556, 5557, 5574,
5575, 5576, 5616, 5617, 5618, 5619, 5620, 5621, 5622, 5623, 5624,
5625, 5626, 5627, 5648, 5654, 5655, 5656, 5657, 5658, 5659, 5660,
5661, 5662, 5663, 5664, 5665, 5666, 5667, 5668, 5670, 5672, 5674,
5676, 5678, 5680, 5682, 5686, 5688, 5690, 5692, 5694, 5696, 5698,
5700, 5704, 5706, 5708, 5710, 5712, 5714, 5716, 5718, 5720, 5722,
5724, 5726, 5728, 5730, 5734, 5736, 6061, 6062, 6106, 6107, 6108,
6109, 6110, 6111, 6128, 6129, 6130, 6131, 6133, 6135, 6137, 6139,
6141, 6143, 6145, 6147, 6149, 6151, 6153, 6235, 6257, 6279, 6313,
6315, 6317, 6322, 6324, 6326, 6328, 6330, 6416, 6522, 6523, 6524,
6525, 6526, 6527, 6528, 6562, 6563, 6568, 6570, 6587, 6589, 6591,
6593, 6595, 6597, 6599, 6601, 6603, 6605, 6607, 6609, 6611, 6613,
6615, 6617, 6619, 6621, 6623, 6625, 6627, 6629, 6631, 6633, 6720,
6724, 6726, 6739, 6745, 6746, 6760, 6762, 6764, 6809, 6889, 6893,
6894, 6895, 6897, 6908, 6910, 6912, 6914, 6916, 6918, 6920, 6922,
6924, 6959, 7158, 7159, 7332, 7334, 7336, 7338, 7340, 7342, 7344,
7346, 7348, 7350, 7352, 7354, 7356, 7358, 7360, 7362, 7364, 7366,
7368, 7374, 7390, 7392, 7394, 7396, 7398, 7399, 7400, 7410, 7433,
7435, 7437, 7439, 7441, 7443, 7445, 7447, 7449, 7451, 7453, 7454,
7455, 7456, 7457, 7458, 7459, 7460, 7461, 7462, 7539, 7552, 7553,
7639, 7640, 7641, 7642, 7643, 7644, 7645, 7646, 7647, 7648, 7668,
7686, 7687, 7806, 7807, 7808, 7809 };
public final static int[] ALCOHOL_RELATED_ITEMS = { 8940, 3803, 3712, 3711,
2092, 2074, 3801 };
public final static int[] ITEM_SELLABLE = { 3842, 3844, 3840, 8844, 8845,
8846, 8847, 8848, 8849, 8850, 10551, 6570, 7462, 7461, 7460, 7459,
7458, 7457, 7456, 7455, 7454, 8839, 8840, 8842, 11663, 11664, 11666,
10499, 9748, 9754, 9751, 9769, 9757, 9760, 9763, 9802, 9808, 9784,
9799, 9805, 9781, 9796, 9793, 9775, 9772, 9778, 9787, 9811, 9766,
9749, 9755, 9752, 9770, 9758, 9761, 9764, 9803, 9809, 9785, 9800,
9806, 9782, 9797, 9794, 9776, 9773, 9779, 9788, 9812, 9767, 9747,
9753, 9750, 9768, 9756, 9759, 9762, 9801, 9807, 9783, 9798, 9804,
9780, 9795, 9792, 9774, 9771, 9777, 9786, 9810, 9765, 995, 2415,
2416, 2417, 88, 1540, 2714, 432, 433, 1555, 1556, 1557, 1558, 1559,
1560, 1561, 1562, 1563, 1564, 1565, 7585, 7584, 300, 775, 776, 777,
6180, 6181, 6182, 6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447,
290, 666, 667, 4251, 4252, 4278};
public final static int[] ITEM_TRADEABLE = { 5317, 3842, 3844, 3840, 8844, 8845,
8846, 8847, 8848, 8849, 8850, 10551, 6570, 7462, 7461, 7460, 7459,
7458, 7457, 7456, 7455, 7454, 8839, 8840, 8842, 11663, 11664,
11665, 10499, 9748, 9754, 9751, 9769, 9757, 9760, 9763, 9802, 9808,
9784, 9799, 9805, 9781, 9796, 9793, 9775, 9772, 9778, 9787, 9811,
9766, 9749, 9755, 9752, 9770, 9758, 9761, 9764, 9803, 9809, 9785,
9800, 9806, 9782, 9797, 9794, 9776, 9773, 9779, 9788, 9812, 9767,
9747, 9753, 9750, 9768, 9756, 9759, 9762, 9801, 9807, 9783, 9798,
9804, 9780, 9795, 9792, 9774, 9771, 9777, 9786, 9810, 9765, 2528,
4447, 772, 6180, 6181, 6182, 6183, 6184, 6185, 6186, 6187, 6188,
775, 776, 777, 300, 88, 2415, 2416, 2417, 4214, 4215, 4216, 4217,
4218, 4219, 4220, 4221, 4222, 4223, 4224, 1555, 1556, 1557, 1558,
1559, 1560, 1561, 1562, 1563, 1564, 1565, 7585, 7584, 2714, 432,
433, 290, 5075, 5074, 5073, 5071, 5070, 7413, 6529, 4067, 2996, 1464, 666, 667,
2412, 2413, 2414, 771, 772, 4251, 4252, 4278};
public final static int[] ITEM_UNALCHABLE = { 995, 1555, 1556, 1557, 1558,
1559, 1560, 1561, 1562, 1563, 1564, 1565, 7583, 1566, 7585, 2528,
4214, 4212, 2714, 432, 433, 300, 775, 776, 777, 6180, 6181, 6182,
6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447, 290, 666, 667, 4278};
public final static int[] ITEM_BANKABLE = {2528, 4447};
public final static int[] DESTROYABLE_ITEMS = {775, 776, 777, 2528, 6570, 2714, 432, 433, 300, 666, 4251, 4252, 4278};
}
| 2006-Scape/2006Scape | 2006Scape Server/src/main/java/com/rs2/game/items/ItemConstants.java |
213,027 | package hands.on.grpc;
import java.util.Objects;
import io.micronaut.core.annotation.Introspected;
@Introspected
public class Beer {
public enum Type {
IndianPaleAle, SessionIpa, Lager
}
private String asin;
private String name;
private String brand;
private String country;
private float alcohol;
private Type type;
public Beer() {
}
public Beer(String asin, String name, String brand, String country, float alcohol, Type type) {
this.asin = asin;
this.name = name;
this.brand = brand;
this.country = country;
this.alcohol = alcohol;
this.type = type;
}
public String getAsin() {
return asin;
}
public void setAsin(String asin) {
this.asin = asin;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public float getAlcohol() {
return alcohol;
}
public void setAlcohol(float alcohol) {
this.alcohol = alcohol;
}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Beer that = (Beer) o;
return Float.compare(that.alcohol, alcohol) == 0 && Objects.equals(asin, that.asin) && Objects.equals(name, that.name) && Objects.equals(brand, that.brand) && Objects.equals(country, that.country) && type == that.type;
}
@Override
public int hashCode() {
return Objects.hash(asin, name, brand, country, alcohol, type);
}
}
| lreimer/from-rest-to-grpc | micronaut-beer-rest/src/main/java/hands/on/grpc/Beer.java |
213,028 | /*
fEMR - fast Electronic Medical Records
Copyright (C) 2014 Team fEMR
fEMR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fEMR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with fEMR. If not, see <http://www.gnu.org/licenses/>. If
you have any questions, contact <[email protected]>.
*/
package femr.business.helpers;
import io.ebean.ExpressionList;
import io.ebean.Query;
import femr.data.daos.IRepository;
import femr.data.models.core.IPatient;
import femr.data.models.core.IPatientEncounterVital;
import femr.data.models.mysql.MissionCity;
import femr.data.models.mysql.Patient;
import femr.data.models.mysql.PatientEncounterVital;
import femr.data.models.core.IMissionCity;
import java.util.List;
public class QueryHelper {
public static Float findPatientWeight(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Float weight = null;
Query<PatientEncounterVital> query2 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "weight")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query2);
if (patientEncounterVitals.size() > 0) {
weight = patientEncounterVitals.get(0).getVitalValue();
}
return weight;
}
public static Integer findWeeksPregnant(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Integer weeks_pregnant = null;
Query<PatientEncounterVital> query2 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "weeksPregnant")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query2);
if (patientEncounterVitals.size() > 0) {
weeks_pregnant = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return weeks_pregnant;
}
public static Integer findPatientHeightFeet(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Integer heightFeet = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "heightFeet")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
heightFeet = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return heightFeet;
}
public static Integer findPatientHeightInches(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId) {
Integer heightInches = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "heightInches")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
heightInches = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return heightInches;
}
public static Integer findPatientSmoker(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId) {
Integer smoker = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "smoker")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
smoker = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return smoker;
}
public static Integer findPatientDiabetic(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Integer diabetic = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "diabetic")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
diabetic = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return diabetic;
}
public static Integer findPatientAlcohol(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Integer alcohol = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "alcohol")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
alcohol = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return alcohol;
}
public static Integer findPatientCholesterol(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Integer cholesterol = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "cholesterol")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
cholesterol = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return cholesterol;
}
public static Integer findPatientHypertension(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Integer hypertension = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "hypertension")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
hypertension = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return hypertension;
}
/**
* AJ Saclayan
* Finds all cities*
*/
public static List<? extends IMissionCity> findCities(IRepository<IMissionCity> cityRepository){
return cityRepository.findAll(MissionCity.class);
}
}
| FEMR/femr | app/femr/business/helpers/QueryHelper.java |
213,030 | /*******************************************************************************
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
package org.worldgrower.goal;
import org.worldgrower.Constants;
import org.worldgrower.WorldObject;
public class AlcoholLevelPropertyUtils {
public static int getIntoxicatedLimit(WorldObject worldObject) {
return worldObject.getProperty(Constants.CONSTITUTION);
}
}
| WorldGrower/WorldGrower | src/org/worldgrower/goal/AlcoholLevelPropertyUtils.java |
213,031 | package rustic.common.advancements;
import javax.annotation.Nullable;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.advancements.critereon.MinMaxBounds;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.JsonUtils;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
import net.minecraftforge.oredict.OreDictionary;
import rustic.common.blocks.fluids.FluidBooze;
public class AlcoholItemPredicate extends ItemPredicate {
private final FluidBooze fluid;
private final MinMaxBounds quality;
public AlcoholItemPredicate(@Nullable FluidBooze fluid, MinMaxBounds quality) {
this.fluid = fluid;
this.quality = quality;
}
@Override
public boolean test(ItemStack stack) {
if (stack.isEmpty() || !stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null))
return false;
FluidStack fluidStack = FluidUtil.getFluidContained(stack);
if ((fluidStack == null) || (fluidStack.getFluid() == null) || (fluidStack.amount <= 0))
return false;
Fluid fluid = fluidStack.getFluid();
if (!(fluid instanceof FluidBooze))
return false;
if ((this.fluid != null) && (this.fluid != fluid))
return false;
float quality = ((FluidBooze) fluid).getQuality(fluidStack);
if ((this.quality != null) && !this.quality.test(quality))
return false;
return true;
}
public static AlcoholItemPredicate deserialize(JsonObject jsonObject) {
FluidBooze fluid = null;
if (JsonUtils.hasField(jsonObject, "fluid")) {
String fluidName = JsonUtils.getString(jsonObject, "fluid");
Fluid registeredFluid = FluidRegistry.getFluid(fluidName);
if (registeredFluid == null)
throw new JsonSyntaxException("Unknown fluid id '" + fluidName + "'");
if (registeredFluid instanceof FluidBooze)
fluid = (FluidBooze) registeredFluid;
else
throw new JsonSyntaxException("Fluid '" + fluidName + "' is not an instance of rustic.common.blocks.fluids.FluidBooze");
}
MinMaxBounds quality = MinMaxBounds.deserialize(jsonObject.get("quality"));
return new AlcoholItemPredicate(fluid, quality);
}
}
| cadaverous-eris/Rustic | src/main/java/rustic/common/advancements/AlcoholItemPredicate.java |
213,032 | /**
* Copyright (C) 2007 Heart & Stroke Foundation
* This software is published under the GPL GNU General Public License.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This software was written for the
* Department of Family Medicine
* McMaster University
* Hamilton
* Ontario, Canada
*/
package oscar.form.study.HSFO;
import java.util.Date;
/**
* Class used by the HSFO Study
*
*/
public class VisitData {
VisitData registrationData;
int ID;
String Patient_Id;
//add by Vic for XML transfer
String Provider_Id;
Date FormCreated;
Date FormEdited;
Date VisitDate_Id;
String Drugcoverage; // enum('yes', 'no');
int SBP;
int SBP_goal;
int DBP;
int DBP_goal;
String Bptru_used; //enum('yes', 'no');
double Weight; // double(3, 1);
String Weight_unit; // enum('kg', 'lb');
double Waist; // double(3, 1);
String Waist_unit; // enum('cm', 'inch');
double TC_HDL; // double(2, 1);
double LDL; // double(2, 1);
double HDL; // double(1, 1);
double A1C; // double(1, 2);,
String Nextvisit; // enum('Under1Mo', '1to2Mo', '3to6Mo', 'Over6Mo');
boolean Bpactionplan;
boolean PressureOff;
boolean PatientProvider;
boolean ABPM;
boolean Home;
boolean CommunityRes;
boolean ProRefer;
String HtnDxType; // enum('PrimaryHtn', 'ElevatedBpReadings');
boolean Dyslipid;
boolean Diabetes;
boolean KidneyDis;
boolean Obesity;
boolean CHD;
boolean Stroke_TIA;
boolean Risk_weight;
boolean Risk_activity;
boolean Risk_diet;
boolean Risk_smoking;
boolean Risk_alcohol;
boolean Risk_stress;
String PtView; // enum('Uninterested', 'Thinking', 'Deciding', 'TakingAction', 'Maintaining', 'Relapsing');
int Change_importance;
int Change_confidence;
int exercise_minPerWk;
int smoking_cigsPerDay;
int alcohol_drinksPerWk;
String sel_DashDiet; // enum('Always', 'Often', 'Sometimes', 'Never');
String sel_HighSaltFood; // enum('Always', 'Often', 'Sometimes', 'Never');
String sel_Stressed; // enum('Always', 'Often', 'Sometimes', 'Never');
String LifeGoal;
boolean FamHx_Htn; // enum('PrimaryHtn', 'ElevatedBpReadings');
boolean FamHx_Dyslipid;
boolean FamHx_Diabetes;
boolean FamHx_KidneyDis;
boolean FamHx_Obesity;
boolean FamHx_CHD;
boolean FamHx_Stroke_TIA;
boolean Diuret_rx;
boolean Diuret_SideEffects;
String Diuret_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
boolean Ace_rx;
boolean Ace_SideEffects;
String Ace_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
boolean Arecept_rx;
boolean Arecept_SideEffects;
String Arecept_RxDecToday;
boolean Beta_rx;
boolean Beta_SideEffects;
String Beta_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
boolean Calc_rx;
boolean Calc_SideEffects;
String Calc_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
boolean Anti_rx;
boolean Anti_SideEffects;
String Anti_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
boolean Statin_rx;
boolean Statin_SideEffects;
String Statin_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
boolean Lipid_rx;
boolean Lipid_SideEffects;
String Lipid_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
boolean Hypo_rx;
boolean Hypo_SideEffects;
String Hypo_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
boolean Insul_rx;
boolean Insul_SideEffects;
String Insul_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
int Often_miss;
String Herbal; // enum('yes', 'no');
Date TC_HDL_LabresultsDate;
Date LDL_LabresultsDate;
Date HDL_LabresultsDate;
Date A1C_LabresultsDate;
boolean locked;
/** Creates a new instance of VisitData */
public VisitData() {
}
public VisitData getVisitData() {
return registrationData;
}
public void setVisitData(
int ID,
String Patient_Id,
Date VisitDate_Id,
Date FormCreated,
Date FormEdited,
String Drugcoverage,
int SBP,
int SBP_goal,
int DBP,
int DBP_goal,
String Bptru_used,
double Weight,
String Weight_unit,
double Waist,
String Waist_unit,
double TC_HDL,
double LDL,
double HDL,
double A1C,
String Nextvisit,
boolean Bpactionplan,
boolean PressureOff,
boolean PatientProvider,
boolean ABPM,
boolean Home,
boolean CommunityRes,
boolean ProRefer,
String HtnDxType,
boolean Dyslipid,
boolean Diabetes,
boolean KidneyDis,
boolean Obesity,
boolean CHD,
boolean Stroke_TIA,
boolean Risk_weight,
boolean Risk_activity,
boolean Risk_diet,
boolean Risk_smoking,
boolean Risk_alcohol,
boolean Risk_stress,
String PtView,
int Change_importance,
int Change_confidence,
int exercise_minPerWk,
int smoking_cigsPerDay,
int alcohol_drinksPerWk,
String sel_DashDiet,
String sel_HighSaltFood,
String sel_Stressed,
String LifeGoal,
boolean FamHx_Htn,
boolean FamHx_Dyslipid,
boolean FamHx_Diabetes,
boolean FamHx_KidneyDis,
boolean FamHx_Obesity,
boolean FamHx_CHD,
boolean FamHx_Stroke_TIA,
boolean Diuret_rx,
boolean Diuret_SideEffects,
String Diuret_RxDecToday,
boolean Ace_rx,
boolean Ace_SideEffects,
String Ace_RxDecToday,
boolean Arecept_rx,
boolean Arecept_SideEffects,
String Arecept_RxDecToday,
boolean Beta_rx,
boolean Beta_SideEffects,
String Beta_RxDecToday,
boolean Calc_rx,
boolean Calc_SideEffects,
String Calc_RxDecToday,
boolean Anti_rx,
boolean Anti_SideEffects,
String Anti_RxDecToday,
boolean Statin_rx,
boolean Statin_SideEffects,
String Statin_RxDecToday,
boolean Lipid_rx,
boolean Lipid_SideEffects,
String Lipid_RxDecToday,
boolean Hypo_rx,
boolean Hypo_SideEffects,
String Hypo_RxDecToday,
boolean Insul_rx,
boolean Insul_SideEffects,
String Insul_RxDecToday,
int Often_miss,
String Herbal,
Date TC_HDL_LabresultsDate,
Date LDL_LabresultsDate,
Date HDL_LabresultsDate,
Date A1C_LabresultsDate,
boolean locked)
{
this.ID = ID;
this.Patient_Id = Patient_Id;
this.VisitDate_Id = VisitDate_Id;
this.FormCreated = FormCreated;
this.FormEdited = FormEdited;
this.Drugcoverage = Drugcoverage;
this.SBP = SBP;
this.SBP_goal = SBP_goal;
this.DBP = DBP;
this.DBP_goal = DBP_goal;
this.Bptru_used = Bptru_used;
this.Weight = Weight;
this.Weight_unit = Weight_unit;
this.Waist = Waist;
this.Waist_unit = Waist_unit;
this.TC_HDL = TC_HDL;
this.LDL = LDL;
this.HDL = HDL;
this.A1C = A1C;
this.Nextvisit = Nextvisit;
this.Bpactionplan = Bpactionplan;
this.PressureOff = PressureOff;
this.PatientProvider = PatientProvider;
this.ABPM = ABPM;
this.Home = Home;
this.CommunityRes = CommunityRes;
this.ProRefer = ProRefer;
this.HtnDxType = HtnDxType;
this.Dyslipid = Dyslipid;
this.Diabetes = Diabetes;
this.KidneyDis = KidneyDis;
this.Obesity = Obesity;
this.CHD = CHD;
this.Stroke_TIA = Stroke_TIA;
this.Risk_weight = Risk_weight;
this.Risk_activity = Risk_activity;
this.Risk_diet = Risk_diet;
//this.Risk_dietSalt = Risk_dietSalt;
this.Risk_smoking = Risk_smoking;
this.Risk_alcohol = Risk_alcohol;
this.Risk_stress = Risk_stress;
this.PtView = PtView;
this.Change_importance = Change_importance;
this.Change_confidence = Change_confidence;
this.exercise_minPerWk = exercise_minPerWk;
this.smoking_cigsPerDay = smoking_cigsPerDay;
this.alcohol_drinksPerWk = alcohol_drinksPerWk;
this.sel_DashDiet = sel_DashDiet;
this.sel_HighSaltFood = sel_HighSaltFood;
this.sel_Stressed = sel_Stressed;
this.LifeGoal = LifeGoal;
this.FamHx_Htn = FamHx_Htn;
this.FamHx_Dyslipid = FamHx_Dyslipid;
this.FamHx_Diabetes = FamHx_Diabetes;
this.FamHx_KidneyDis = FamHx_KidneyDis;
this.FamHx_Obesity = FamHx_Obesity;
this.FamHx_CHD = FamHx_CHD;
this.FamHx_Stroke_TIA = FamHx_Stroke_TIA;
this.Diuret_rx = Diuret_rx;
this.Diuret_SideEffects = Diuret_SideEffects;
this.Diuret_RxDecToday = Diuret_RxDecToday;
this.Ace_rx = Ace_rx;
this.Ace_SideEffects = Ace_SideEffects;
this.Ace_RxDecToday = Ace_RxDecToday;
this.Arecept_rx = Arecept_rx;
this.Arecept_SideEffects = Arecept_SideEffects;
this.Arecept_RxDecToday = Arecept_RxDecToday;
this.Beta_rx = Beta_rx;
this.Beta_SideEffects = Beta_SideEffects;
this.Beta_RxDecToday = Beta_RxDecToday;
this.Calc_rx = Calc_rx;
this.Calc_SideEffects = Calc_SideEffects;
this.Calc_RxDecToday = Calc_RxDecToday;
this.Anti_rx = Anti_rx;
this.Anti_SideEffects = Anti_SideEffects;
this.Anti_RxDecToday = Anti_RxDecToday;
this.Statin_rx = Statin_rx;
this.Statin_SideEffects = Statin_SideEffects;
this.Statin_RxDecToday = Statin_RxDecToday;
this.Lipid_rx = Lipid_rx;
this.Lipid_SideEffects = Lipid_SideEffects;
this.Lipid_RxDecToday = Lipid_RxDecToday;
this.Hypo_rx = Hypo_rx;
this.Hypo_SideEffects = Hypo_SideEffects;
this.Hypo_RxDecToday = Hypo_RxDecToday;
this.Insul_rx = Insul_rx;
this.Insul_SideEffects = Insul_SideEffects;
this.Insul_RxDecToday = Insul_RxDecToday;
this.Often_miss = Often_miss;
this.Herbal = Herbal;
this.TC_HDL_LabresultsDate = TC_HDL_LabresultsDate;
this.LDL_LabresultsDate = LDL_LabresultsDate;
this.HDL_LabresultsDate = HDL_LabresultsDate;
this.A1C_LabresultsDate = A1C_LabresultsDate;
this.locked = locked;
}
public double getA1C() {
return A1C;
}
public void setA1C(double a1c) {
A1C = a1c;
}
public boolean isABPM() {
return ABPM;
}
public void setABPM(boolean abpm) {
ABPM = abpm;
}
public boolean isAce_rx() {
return Ace_rx;
}
public void setAce_rx(boolean ace_rx) {
Ace_rx = ace_rx;
}
public String getAce_RxDecToday() {
return Ace_RxDecToday;
}
public void setAce_RxDecToday(String ace_RxDecToday) {
Ace_RxDecToday = ace_RxDecToday;
}
public boolean isAce_SideEffects() {
return Ace_SideEffects;
}
public void setAce_SideEffects(boolean ace_SideEffects) {
Ace_SideEffects = ace_SideEffects;
}
public int getAlcohol_drinksPerWk() {
return alcohol_drinksPerWk;
}
public void setAlcohol_drinksPerWk(int alcohol_drinksPerWk) {
this.alcohol_drinksPerWk = alcohol_drinksPerWk;
}
public boolean isAnti_rx() {
return Anti_rx;
}
public void setAnti_rx(boolean anti_rx) {
Anti_rx = anti_rx;
}
public String getAnti_RxDecToday() {
return Anti_RxDecToday;
}
public void setAnti_RxDecToday(String anti_RxDecToday) {
Anti_RxDecToday = anti_RxDecToday;
}
public boolean isAnti_SideEffects() {
return Anti_SideEffects;
}
public void setAnti_SideEffects(boolean anti_SideEffects) {
Anti_SideEffects = anti_SideEffects;
}
public boolean isBeta_rx() {
return Beta_rx;
}
public void setBeta_rx(boolean beta_rx) {
Beta_rx = beta_rx;
}
public String getBeta_RxDecToday() {
return Beta_RxDecToday;
}
public void setBeta_RxDecToday(String beta_RxDecToday) {
Beta_RxDecToday = beta_RxDecToday;
}
public boolean isBeta_SideEffects() {
return Beta_SideEffects;
}
public void setBeta_SideEffects(boolean beta_SideEffects) {
Beta_SideEffects = beta_SideEffects;
}
public boolean isBpactionplan() {
return Bpactionplan;
}
public void setBpactionplan(boolean bpactionplan) {
Bpactionplan = bpactionplan;
}
public String getBptru_used() {
return Bptru_used;
}
public void setBptru_used(String bptru_used) {
Bptru_used = bptru_used;
}
public boolean isCalc_rx() {
return Calc_rx;
}
public void setCalc_rx(boolean calc_rx) {
Calc_rx = calc_rx;
}
public String getCalc_RxDecToday() {
return Calc_RxDecToday;
}
public void setCalc_RxDecToday(String calc_RxDecToday) {
Calc_RxDecToday = calc_RxDecToday;
}
public boolean isCalc_SideEffects() {
return Calc_SideEffects;
}
public void setCalc_SideEffects(boolean calc_SideEffects) {
Calc_SideEffects = calc_SideEffects;
}
public int getChange_confidence() {
return Change_confidence;
}
public void setChange_confidence(int change_confidence) {
Change_confidence = change_confidence;
}
public int getChange_importance() {
return Change_importance;
}
public void setChange_importance(int change_importance) {
Change_importance = change_importance;
}
public boolean isCHD() {
return CHD;
}
public void setCHD(boolean chd) {
CHD = chd;
}
public boolean isCommunityRes() {
return CommunityRes;
}
public void setCommunityRes(boolean communityRes) {
CommunityRes = communityRes;
}
public int getDBP() {
return DBP;
}
public void setDBP(int dbp) {
DBP = dbp;
}
public int getDBP_goal() {
return DBP_goal;
}
public void setDBP_goal(int dbp_goal) {
DBP_goal = dbp_goal;
}
public boolean isDiabetes() {
return Diabetes;
}
public void setDiabetes(boolean diabetes) {
Diabetes = diabetes;
}
public boolean isDiuret_rx() {
return Diuret_rx;
}
public void setDiuret_rx(boolean diuret_rx) {
Diuret_rx = diuret_rx;
}
public String getDiuret_RxDecToday() {
return Diuret_RxDecToday;
}
public void setDiuret_RxDecToday(String diuret_RxDecToday) {
Diuret_RxDecToday = diuret_RxDecToday;
}
public boolean isDiuret_SideEffects() {
return Diuret_SideEffects;
}
public void setDiuret_SideEffects(boolean diuret_SideEffects) {
Diuret_SideEffects = diuret_SideEffects;
}
public String getDrugcoverage() {
return Drugcoverage;
}
public void setDrugcoverage(String drugcoverage) {
Drugcoverage = drugcoverage;
}
public boolean isDyslipid() {
return Dyslipid;
}
public void setDyslipid(boolean dyslipid) {
Dyslipid = dyslipid;
}
public int getExercise_minPerWk() {
return exercise_minPerWk;
}
public void setExercise_minPerWk(int exercise_minPerWk) {
this.exercise_minPerWk = exercise_minPerWk;
}
public boolean isFamHx_CHD() {
return FamHx_CHD;
}
public void setFamHx_CHD(boolean famHx_CHD) {
FamHx_CHD = famHx_CHD;
}
public boolean isFamHx_Diabetes() {
return FamHx_Diabetes;
}
public void setFamHx_Diabetes(boolean famHx_Diabetes) {
FamHx_Diabetes = famHx_Diabetes;
}
public boolean isFamHx_Dyslipid() {
return FamHx_Dyslipid;
}
public void setFamHx_Dyslipid(boolean famHx_Dyslipid) {
FamHx_Dyslipid = famHx_Dyslipid;
}
public boolean isFamHx_Htn() {
return FamHx_Htn;
}
public void setFamHx_Htn(boolean famHx_Htn) {
FamHx_Htn = famHx_Htn;
}
public boolean isFamHx_KidneyDis() {
return FamHx_KidneyDis;
}
public void setFamHx_KidneyDis(boolean famHx_KidneyDis) {
FamHx_KidneyDis = famHx_KidneyDis;
}
public boolean isFamHx_Obesity() {
return FamHx_Obesity;
}
public void setFamHx_Obesity(boolean famHx_Obesity) {
FamHx_Obesity = famHx_Obesity;
}
public boolean isFamHx_Stroke_TIA() {
return FamHx_Stroke_TIA;
}
public void setFamHx_Stroke_TIA(boolean famHx_Stroke_TIA) {
FamHx_Stroke_TIA = famHx_Stroke_TIA;
}
public double getHDL() {
return HDL;
}
public void setHDL(double hdl) {
HDL = hdl;
}
public String getHerbal() {
return Herbal;
}
public void setHerbal(String herbal) {
Herbal = herbal;
}
public boolean isHome() {
return Home;
}
public void setHome(boolean home) {
Home = home;
}
public String getHtnDxType() {
return HtnDxType;
}
public void setHtnDxType(String htnDxType) {
HtnDxType = htnDxType;
}
public boolean isHypo_rx() {
return Hypo_rx;
}
public void setHypo_rx(boolean hypo_rx) {
Hypo_rx = hypo_rx;
}
public String getHypo_RxDecToday() {
return Hypo_RxDecToday;
}
public void setHypo_RxDecToday(String hypo_RxDecToday) {
Hypo_RxDecToday = hypo_RxDecToday;
}
public boolean isHypo_SideEffects() {
return Hypo_SideEffects;
}
public void setHypo_SideEffects(boolean hypo_SideEffects) {
Hypo_SideEffects = hypo_SideEffects;
}
public boolean isInsul_rx() {
return Insul_rx;
}
public void setInsul_rx(boolean insul_rx) {
Insul_rx = insul_rx;
}
public String getInsul_RxDecToday() {
return Insul_RxDecToday;
}
public void setInsul_RxDecToday(String insul_RxDecToday) {
Insul_RxDecToday = insul_RxDecToday;
}
public boolean isInsul_SideEffects() {
return Insul_SideEffects;
}
public void setInsul_SideEffects(boolean insul_SideEffects) {
Insul_SideEffects = insul_SideEffects;
}
public boolean isKidneyDis() {
return KidneyDis;
}
public void setKidneyDis(boolean kidneyDis) {
KidneyDis = kidneyDis;
}
public double getLDL() {
return LDL;
}
public void setLDL(double ldl) {
LDL = ldl;
}
public boolean isLipid_rx() {
return Lipid_rx;
}
public void setLipid_rx(boolean lipid_rx) {
Lipid_rx = lipid_rx;
}
public String getLipid_RxDecToday() {
return Lipid_RxDecToday;
}
public void setLipid_RxDecToday(String lipid_RxDecToday) {
Lipid_RxDecToday = lipid_RxDecToday;
}
public boolean isLipid_SideEffects() {
return Lipid_SideEffects;
}
public void setLipid_SideEffects(boolean lipid_SideEffects) {
Lipid_SideEffects = lipid_SideEffects;
}
public String getNextvisit() {
return Nextvisit;
}
public void setNextvisit(String nextvisit) {
Nextvisit = nextvisit;
}
public boolean isObesity() {
return Obesity;
}
public void setObesity(boolean obesity) {
Obesity = obesity;
}
public int getOften_miss() {
return Often_miss;
}
public void setOften_miss(int often_miss) {
Often_miss = often_miss;
}
public String getPatient_Id() {
return Patient_Id;
}
public void setPatient_Id(String patient_Id) {
Patient_Id = patient_Id;
}
public boolean isPatientProvider() {
return PatientProvider;
}
public void setPatientProvider(boolean patientProvider) {
PatientProvider = patientProvider;
}
public boolean isPressureOff() {
return PressureOff;
}
public void setPressureOff(boolean pressureOff) {
PressureOff = pressureOff;
}
public boolean isProRefer() {
return ProRefer;
}
public void setProRefer(boolean proRefer) {
ProRefer = proRefer;
}
public String getPtView() {
return PtView;
}
public void setPtView(String ptView) {
PtView = ptView;
}
public boolean isRisk_activity() {
return Risk_activity;
}
public void setRisk_activity(boolean risk_activity) {
Risk_activity = risk_activity;
}
public boolean isRisk_alcohol() {
return Risk_alcohol;
}
public void setRisk_alcohol(boolean risk_alcohol) {
Risk_alcohol = risk_alcohol;
}
public boolean isRisk_diet() {
return Risk_diet;
}
public void setRisk_diet(boolean risk_diet) {
Risk_diet = risk_diet;
}
public boolean isRisk_smoking() {
return Risk_smoking;
}
public void setRisk_smoking(boolean risk_smoking) {
Risk_smoking = risk_smoking;
}
public boolean isRisk_stress() {
return Risk_stress;
}
public void setRisk_stress(boolean risk_stress) {
Risk_stress = risk_stress;
}
public boolean isRisk_weight() {
return Risk_weight;
}
public void setRisk_weight(boolean risk_weight) {
Risk_weight = risk_weight;
}
public int getSBP() {
return SBP;
}
public void setSBP(int sbp) {
SBP = sbp;
}
public int getSBP_goal() {
return SBP_goal;
}
public void setSBP_goal(int sbp_goal) {
SBP_goal = sbp_goal;
}
public String getSel_DashDiet() {
return sel_DashDiet;
}
public void setSel_DashDiet(String sel_DashDiet) {
this.sel_DashDiet = sel_DashDiet;
}
public String getSel_HighSaltFood() {
return sel_HighSaltFood;
}
public void setSel_HighSaltFood(String sel_HighSaltFood) {
this.sel_HighSaltFood = sel_HighSaltFood;
}
public String getSel_Stressed() {
return sel_Stressed;
}
public void setSel_Stressed(String sel_Stressed) {
this.sel_Stressed = sel_Stressed;
}
public int getSmoking_cigsPerDay() {
return smoking_cigsPerDay;
}
public void setSmoking_cigsPerDay(int smoking_cigsPerDay) {
this.smoking_cigsPerDay = smoking_cigsPerDay;
}
public boolean isStatin_rx() {
return Statin_rx;
}
public void setStatin_rx(boolean statin_rx) {
Statin_rx = statin_rx;
}
public String getStatin_RxDecToday() {
return Statin_RxDecToday;
}
public void setStatin_RxDecToday(String statin_RxDecToday) {
Statin_RxDecToday = statin_RxDecToday;
}
public boolean isStatin_SideEffects() {
return Statin_SideEffects;
}
public void setStatin_SideEffects(boolean statin_SideEffects) {
Statin_SideEffects = statin_SideEffects;
}
public boolean isStroke_TIA() {
return Stroke_TIA;
}
public void setStroke_TIA(boolean stroke_TIA) {
Stroke_TIA = stroke_TIA;
}
public double getTC_HDL() {
return TC_HDL;
}
public void setTC_HDL(double tc_hdl) {
TC_HDL = tc_hdl;
}
public Date getVisitDate_Id() {
return VisitDate_Id;
}
public void setVisitDateIdToday(){
VisitDate_Id = new Date();
}
public void setVisitDate_Id(Date visitDate_Id) {
VisitDate_Id = visitDate_Id;
}
public double getWaist() {
return Waist;
}
public void setWaist(double waist) {
Waist = waist;
}
public String getWaist_unit() {
return Waist_unit;
}
public void setWaist_unit(String waist_unit) {
Waist_unit = waist_unit;
}
public double getWeight() {
return Weight;
}
public void setWeight(double weight) {
Weight = weight;
}
public String getWeight_unit() {
return Weight_unit;
}
public void setWeight_unit(String weight_unit) {
Weight_unit = weight_unit;
}
public void setRegistrationData(VisitData registrationData) {
this.registrationData = registrationData;
}
public String getLifeGoal() {
return LifeGoal;
}
public void setLifeGoal(String lifeGoal) {
LifeGoal = lifeGoal;
}
public boolean isArecept_rx() {
return Arecept_rx;
}
public void setArecept_rx(boolean arecept_rx) {
Arecept_rx = arecept_rx;
}
public String getArecept_RxDecToday() {
return Arecept_RxDecToday;
}
public void setArecept_RxDecToday(String arecept_RxDecToday) {
Arecept_RxDecToday = arecept_RxDecToday;
}
public boolean isArecept_SideEffects() {
return Arecept_SideEffects;
}
public void setArecept_SideEffects(boolean arecept_SideEffects) {
Arecept_SideEffects = arecept_SideEffects;
}
public Date getA1C_LabresultsDate() {
return A1C_LabresultsDate;
}
public void setA1C_LabresultsDate(Date labresultsDate) {
A1C_LabresultsDate = labresultsDate;
}
public Date getHDL_LabresultsDate() {
return HDL_LabresultsDate;
}
public void setHDL_LabresultsDate(Date labresultsDate) {
HDL_LabresultsDate = labresultsDate;
}
public Date getLDL_LabresultsDate() {
return LDL_LabresultsDate;
}
public void setLDL_LabresultsDate(Date labresultsDate) {
LDL_LabresultsDate = labresultsDate;
}
public Date getTC_HDL_LabresultsDate() {
return TC_HDL_LabresultsDate;
}
public void setTC_HDL_LabresultsDate(Date labresultsDate) {
TC_HDL_LabresultsDate = labresultsDate;
}
public boolean isLocked() {
return locked;
}
public void setLocked(boolean locked) {
this.locked = locked;
}
public int getID() {
return ID;
}
public void setID(int id) {
ID = id;
}
public String getProvider_Id() {
return Provider_Id;
}
public void setProvider_Id(String provider_Id) {
Provider_Id = provider_Id;
}
public Date getFormCreated() {
return FormCreated;
}
public void setFormCreated(Date formCreated) {
FormCreated = formCreated;
}
public Date getFormEdited() {
return FormEdited;
}
public void setFormEdited(Date formEdited) {
FormEdited = formEdited;
}
}
| junoemr/junoemr | src/main/java/oscar/form/study/HSFO/VisitData.java |
213,034 | 404: Not Found | DaFuqs/Spectrum | src/main/java/de/dafuqs/spectrum/registries/SpectrumItems.java |
213,036 | /**
* Copyright (c) 2001-2002. Department of Family Medicine, McMaster University. All Rights Reserved.
* This software is published under the GPL GNU General Public License.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This software was written for the
* Department of Family Medicine
* McMaster University
* Hamilton
* Ontario, Canada
*/
package org.oscarehr.ws.transfer_objects;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.oscarehr.PMmodule.model.Program;
import org.springframework.beans.BeanUtils;
public final class ProgramTransfer {
private Integer id;
private boolean userDefined;
private Integer numOfMembers;
private Integer numOfIntakes;
private Integer queueSize;
private Integer maxAllowed;
private String type;
private String description;
private String functionalCentreId;
private String address;
private String phone;
private String fax;
private String url;
private String email;
private String emergencyNumber;
private String location;
private String name;
private boolean holdingTank;
private boolean allowBatchAdmission;
private boolean allowBatchDischarge;
private boolean hic;
private String programStatus;
private Integer intakeProgram;
private Integer bedProgramLinkId;
private String manOrWoman;
private String genderDesc;
private boolean transgender;
private boolean firstNation;
private boolean bedProgramAffiliated;
private boolean alcohol;
private String abstinenceSupport;
private boolean physicalHealth;
private boolean mentalHealth;
private boolean housing;
private String exclusiveView;
private Integer ageMin;
private Integer ageMax;
private Integer maximumServiceRestrictionDays;
private Integer defaultServiceRestrictionDays;
private Integer shelterId;
private int facilityId;
private String facilityDesc;
private String orgCd;
private Integer totalUsedRoom;
private String lastUpdateUser;
private Date lastUpdateDate;
private String siteSpecificField;
private Boolean enableEncounterTime = false;
private Boolean enableEncounterTransportationTime = false;
private String emailNotificationAddressesCsv = null;
private Date lastReferralNotification = null;
public Integer getId() {
return (id);
}
public void setId(Integer id) {
this.id = id;
}
public boolean isUserDefined() {
return (userDefined);
}
public void setUserDefined(boolean userDefined) {
this.userDefined = userDefined;
}
public Integer getNumOfMembers() {
return (numOfMembers);
}
public void setNumOfMembers(Integer numOfMembers) {
this.numOfMembers = numOfMembers;
}
public Integer getNumOfIntakes() {
return (numOfIntakes);
}
public void setNumOfIntakes(Integer numOfIntakes) {
this.numOfIntakes = numOfIntakes;
}
public Integer getQueueSize() {
return (queueSize);
}
public void setQueueSize(Integer queueSize) {
this.queueSize = queueSize;
}
public Integer getMaxAllowed() {
return (maxAllowed);
}
public void setMaxAllowed(Integer maxAllowed) {
this.maxAllowed = maxAllowed;
}
public String getType() {
return (type);
}
public void setType(String type) {
this.type = type;
}
public String getDescription() {
return (description);
}
public void setDescription(String description) {
this.description = description;
}
public String getFunctionalCentreId() {
return (functionalCentreId);
}
public void setFunctionalCentreId(String functionalCentreId) {
this.functionalCentreId = functionalCentreId;
}
public String getAddress() {
return (address);
}
public void setAddress(String address) {
this.address = address;
}
public String getPhone() {
return (phone);
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getFax() {
return (fax);
}
public void setFax(String fax) {
this.fax = fax;
}
public String getUrl() {
return (url);
}
public void setUrl(String url) {
this.url = url;
}
public String getEmail() {
return (email);
}
public void setEmail(String email) {
this.email = email;
}
public String getEmergencyNumber() {
return (emergencyNumber);
}
public void setEmergencyNumber(String emergencyNumber) {
this.emergencyNumber = emergencyNumber;
}
public String getLocation() {
return (location);
}
public void setLocation(String location) {
this.location = location;
}
public String getName() {
return (name);
}
public void setName(String name) {
this.name = name;
}
public boolean isHoldingTank() {
return (holdingTank);
}
public void setHoldingTank(boolean holdingTank) {
this.holdingTank = holdingTank;
}
public boolean isAllowBatchAdmission() {
return (allowBatchAdmission);
}
public void setAllowBatchAdmission(boolean allowBatchAdmission) {
this.allowBatchAdmission = allowBatchAdmission;
}
public boolean isAllowBatchDischarge() {
return (allowBatchDischarge);
}
public void setAllowBatchDischarge(boolean allowBatchDischarge) {
this.allowBatchDischarge = allowBatchDischarge;
}
public boolean isHic() {
return (hic);
}
public void setHic(boolean hic) {
this.hic = hic;
}
public String getProgramStatus() {
return (programStatus);
}
public void setProgramStatus(String programStatus) {
this.programStatus = programStatus;
}
public Integer getIntakeProgram() {
return (intakeProgram);
}
public void setIntakeProgram(Integer intakeProgram) {
this.intakeProgram = intakeProgram;
}
public Integer getBedProgramLinkId() {
return (bedProgramLinkId);
}
public void setBedProgramLinkId(Integer bedProgramLinkId) {
this.bedProgramLinkId = bedProgramLinkId;
}
public String getManOrWoman() {
return (manOrWoman);
}
public void setManOrWoman(String manOrWoman) {
this.manOrWoman = manOrWoman;
}
public String getGenderDesc() {
return (genderDesc);
}
public void setGenderDesc(String genderDesc) {
this.genderDesc = genderDesc;
}
public boolean isTransgender() {
return (transgender);
}
public void setTransgender(boolean transgender) {
this.transgender = transgender;
}
public boolean isFirstNation() {
return (firstNation);
}
public void setFirstNation(boolean firstNation) {
this.firstNation = firstNation;
}
public boolean isBedProgramAffiliated() {
return (bedProgramAffiliated);
}
public void setBedProgramAffiliated(boolean bedProgramAffiliated) {
this.bedProgramAffiliated = bedProgramAffiliated;
}
public boolean isAlcohol() {
return (alcohol);
}
public void setAlcohol(boolean alcohol) {
this.alcohol = alcohol;
}
public String getAbstinenceSupport() {
return (abstinenceSupport);
}
public void setAbstinenceSupport(String abstinenceSupport) {
this.abstinenceSupport = abstinenceSupport;
}
public boolean isPhysicalHealth() {
return (physicalHealth);
}
public void setPhysicalHealth(boolean physicalHealth) {
this.physicalHealth = physicalHealth;
}
public boolean isMentalHealth() {
return (mentalHealth);
}
public void setMentalHealth(boolean mentalHealth) {
this.mentalHealth = mentalHealth;
}
public boolean isHousing() {
return (housing);
}
public void setHousing(boolean housing) {
this.housing = housing;
}
public String getExclusiveView() {
return (exclusiveView);
}
public void setExclusiveView(String exclusiveView) {
this.exclusiveView = exclusiveView;
}
public Integer getAgeMin() {
return (ageMin);
}
public void setAgeMin(Integer ageMin) {
this.ageMin = ageMin;
}
public Integer getAgeMax() {
return (ageMax);
}
public void setAgeMax(Integer ageMax) {
this.ageMax = ageMax;
}
public Integer getMaximumServiceRestrictionDays() {
return (maximumServiceRestrictionDays);
}
public void setMaximumServiceRestrictionDays(Integer maximumServiceRestrictionDays) {
this.maximumServiceRestrictionDays = maximumServiceRestrictionDays;
}
public Integer getDefaultServiceRestrictionDays() {
return (defaultServiceRestrictionDays);
}
public void setDefaultServiceRestrictionDays(Integer defaultServiceRestrictionDays) {
this.defaultServiceRestrictionDays = defaultServiceRestrictionDays;
}
public Integer getShelterId() {
return (shelterId);
}
public void setShelterId(Integer shelterId) {
this.shelterId = shelterId;
}
public int getFacilityId() {
return (facilityId);
}
public void setFacilityId(int facilityId) {
this.facilityId = facilityId;
}
public String getFacilityDesc() {
return (facilityDesc);
}
public void setFacilityDesc(String facilityDesc) {
this.facilityDesc = facilityDesc;
}
public String getOrgCd() {
return (orgCd);
}
public void setOrgCd(String orgCd) {
this.orgCd = orgCd;
}
public Integer getTotalUsedRoom() {
return (totalUsedRoom);
}
public void setTotalUsedRoom(Integer totalUsedRoom) {
this.totalUsedRoom = totalUsedRoom;
}
public String getLastUpdateUser() {
return (lastUpdateUser);
}
public void setLastUpdateUser(String lastUpdateUser) {
this.lastUpdateUser = lastUpdateUser;
}
public Date getLastUpdateDate() {
return (lastUpdateDate);
}
public void setLastUpdateDate(Date lastUpdateDate) {
this.lastUpdateDate = lastUpdateDate;
}
public String getSiteSpecificField() {
return (siteSpecificField);
}
public void setSiteSpecificField(String siteSpecificField) {
this.siteSpecificField = siteSpecificField;
}
public Boolean getEnableEncounterTime() {
return (enableEncounterTime);
}
public void setEnableEncounterTime(Boolean enableEncounterTime) {
this.enableEncounterTime = enableEncounterTime;
}
public Boolean getEnableEncounterTransportationTime() {
return (enableEncounterTransportationTime);
}
public void setEnableEncounterTransportationTime(Boolean enableEncounterTransportationTime) {
this.enableEncounterTransportationTime = enableEncounterTransportationTime;
}
public String getEmailNotificationAddressesCsv() {
return (emailNotificationAddressesCsv);
}
public void setEmailNotificationAddressesCsv(String emailNotificationAddressesCsv) {
this.emailNotificationAddressesCsv = emailNotificationAddressesCsv;
}
public Date getLastReferralNotification() {
return (lastReferralNotification);
}
public void setLastReferralNotification(Date lastReferralNotification) {
this.lastReferralNotification = lastReferralNotification;
}
public static ProgramTransfer toTransfer(Program program) {
if (program == null) return (null);
ProgramTransfer programTransfer = new ProgramTransfer();
BeanUtils.copyProperties(program, programTransfer);
return (programTransfer);
}
public static ProgramTransfer[] toTransfers(List<Program> programs) {
ArrayList<ProgramTransfer> results = new ArrayList<ProgramTransfer>();
for (Program program : programs) {
results.add(toTransfer(program));
}
return (results.toArray(new ProgramTransfer[0]));
}
@Override
public String toString() {
return (ReflectionToStringBuilder.toString(this));
}
}
| scoophealth/oscar | src/main/java/org/oscarehr/ws/transfer_objects/ProgramTransfer.java |
213,037 | /*
* My-Wine-Cellar, copyright 2022
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*/
package info.mywinecellar.dto;
import info.mywinecellar.model.Wine;
import info.mywinecellar.util.Image;
import java.util.ArrayList;
import java.util.List;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Getter
@Setter
public class WineDetailsDto extends AbstractKeyDto {
private Long id;
private String name;
private Integer vintage;
private Float size;
private String description;
private String weblink;
private String image;
private Float alcohol;
private Float acid;
private Float pH;
private Integer bottleAging;
private String subarea;
private List<ReviewDto> reviews;
private List<GenericTastingNotesDto> genericTastingNotes;
private ColorDto color;
private TypeDto type;
private ShapeDto shape;
private ClosureDto closure;
private ProducerDto producer;
private List<Long> wset;
/**
* Default constructor
*/
public WineDetailsDto() {
}
/**
* Constructor
*
* @param w Wine w
*/
public WineDetailsDto(Wine w) {
super(toKey(w.getName()));
this.id = w.getId();
this.name = w.getName();
this.vintage = w.getVintage();
this.size = w.getSize();
this.description = w.getDescription();
this.weblink = w.getWeblink();
this.image = Image.encode(w.getImage());
this.acid = w.getAcid();
this.pH = w.getPH();
this.bottleAging = w.getBottleAging();
this.alcohol = w.getAlcohol();
this.subarea = w.getSubarea();
this.producer = new ProducerDto(w.getProducer());
this.closure = new ClosureDto(w.getClosure());
this.shape = new ShapeDto(w.getShape());
this.type = new TypeDto(w.getType());
this.color = new ColorDto(w.getColor());
this.reviews = new ArrayList<>();
w.getReviews().forEach(review -> reviews.add(new ReviewDto(review)));
this.genericTastingNotes = new ArrayList<>();
w.getGenericTastingNotes().forEach(gtn -> genericTastingNotes.add(new GenericTastingNotesDto(gtn)));
}
}
| My-Wine-Cellar/winecellar-webapp | src/main/java/info/mywinecellar/dto/WineDetailsDto.java |
213,038 | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 服务详情
*
* @author auto create
* @since 1.0, 2019-11-07 13:43:02
*/
public class StructureServiceInfo extends AlipayObject {
private static final long serialVersionUID = 8785469846597269792L;
/**
* 是否提供酒精饮料
*/
@ApiField("alcohol")
private Boolean alcohol;
/**
* 是否接受预约
*/
@ApiField("booking")
private Boolean booking;
/**
* 是否有包厢
*/
@ApiField("box")
private Boolean box;
/**
* 是否允许自带杯
*/
@ApiField("byo")
private Boolean byo;
/**
* 是否提供中文服务
*/
@ApiField("chinese_svc")
private Boolean chineseSvc;
/**
* 是否有停车位
*/
@ApiField("parking")
private Boolean parking;
/**
* 是否支持外带
*/
@ApiField("takeout")
private Boolean takeout;
/**
* 是否支持电话预定
*/
@ApiField("tel_rsvt")
private Boolean telRsvt;
/**
* 是否需要小费
*/
@ApiField("tips")
private Boolean tips;
/**
* 是否有wifi
*/
@ApiField("wifi")
private Boolean wifi;
public Boolean getAlcohol() {
return this.alcohol;
}
public void setAlcohol(Boolean alcohol) {
this.alcohol = alcohol;
}
public Boolean getBooking() {
return this.booking;
}
public void setBooking(Boolean booking) {
this.booking = booking;
}
public Boolean getBox() {
return this.box;
}
public void setBox(Boolean box) {
this.box = box;
}
public Boolean getByo() {
return this.byo;
}
public void setByo(Boolean byo) {
this.byo = byo;
}
public Boolean getChineseSvc() {
return this.chineseSvc;
}
public void setChineseSvc(Boolean chineseSvc) {
this.chineseSvc = chineseSvc;
}
public Boolean getParking() {
return this.parking;
}
public void setParking(Boolean parking) {
this.parking = parking;
}
public Boolean getTakeout() {
return this.takeout;
}
public void setTakeout(Boolean takeout) {
this.takeout = takeout;
}
public Boolean getTelRsvt() {
return this.telRsvt;
}
public void setTelRsvt(Boolean telRsvt) {
this.telRsvt = telRsvt;
}
public Boolean getTips() {
return this.tips;
}
public void setTips(Boolean tips) {
this.tips = tips;
}
public Boolean getWifi() {
return this.wifi;
}
public void setWifi(Boolean wifi) {
this.wifi = wifi;
}
}
| alipay/alipay-sdk-java-all | v2/src/main/java/com/alipay/api/domain/StructureServiceInfo.java |
213,039 | package spring.certification.ioc.advanced.q041.example;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* A colorless flammable liquid.
*/
@Scope(scopeName = "prototype")
@Component
public class Alcohol {
}
| vshemyako/spring-certification-5.0 | src/main/java/spring/certification/ioc/advanced/q041/example/Alcohol.java |
213,041 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.streampipes.vocabulary;
import java.util.Arrays;
import java.util.List;
public class SO {
public static final String NS = "http://schema.org/";
public static final String NS_PREFIX = "so";
public static final String GEO_JSON_LINE_STRING = "http://streampipes.org/GeoJsonLineString";
public static final String GEO_JSON_POLYGON = "http://streampipes.org/GeoJsonPolygon";
public static final String GEO_JSON_MULTI_POINT = "http://streampipes.org/GeoJsonMultiPoint";
public static final String GEO_JSON_MULTI_LINE_STRING = "http://streampipes.org/GeoJsonMultiLineString";
public static final String GEO_JSON_MULTI_POLYGON = "http://streampipes.org/GeoJsonMultiPolygon";
public static final String QUANTITATIVE_VALUE = "http://schema.org/QuantitativeValue";
public static final String PROPERTY_VALUE_SPECIFICATION = "http://schema.org/PropertyValueSpecification";
public static final String NUMBER = "http://schema.org/Number";
public static final String ORG_ENUMERATION = "http://schema.org/Enumeration";
public static final String ALTITUDE = "http://streampipes.org/Altitude";
public static final String ACCEPTS_RESERVATIONS = "http://schema.org/acceptsReservations";
public static final String ACCESS_CODE = "http://schema.org/accessCode";
public static final String ACCESSIBILITY_API = "http://schema.org/accessibilityAPI";
public static final String ACCESSIBILITY_CONTROL = "http://schema.org/accessibilityControl";
public static final String ACCESSIBILITY_FEATURE = "http://schema.org/accessibilityFeature";
public static final String ACCESSIBILITY_HAZARD = "http://schema.org/accessibilityHazard";
public static final String ACTION = "http://schema.org/action";
public static final String ORG_ACTIVE_INGREDIENT = "http://schema.org/activeIngredient";
public static final String ACTIVITY_DURATION = "http://schema.org/activityDuration";
public static final String ACTIVITY_FREQUENCY = "http://schema.org/activityFrequency";
public static final String ADDITIONAL_NAME = "http://schema.org/additionalName";
public static final String ADDITIONAL_PROPERTY = "http://schema.org/additionalProperty";
public static final String ADDITIONAL_VARIABLE = "http://schema.org/additionalVariable";
public static final String ADDRESS_LOCALITY = "http://schema.org/addressLocality";
public static final String ORG_ADDRESS_REGION = "http://schema.org/addressRegion";
public static final String ADMINISTRATION_ROUTE = "http://schema.org/administrationRoute";
public static final String ALCOHOL_WARNING = "http://schema.org/alcoholWarning";
public static final String ALGORITHM = "http://schema.org/algorithm";
public static final String ALIGNMENT_TYPE = "http://schema.org/alignmentType";
public static final String ALTERNATE_NAME = "http://schema.org/alternateName";
public static final String ALTERNATIVE_HEADLINE = "http://schema.org/alternativeHeadline";
public static final String AMOUNT_OF_THIS_GOOD = "http://schema.org/amountOfThisGood";
public static final String ANSWER_COUNT = "http://schema.org/answerCount";
public static final String APPLICATION_CATEGORY = "http://schema.org/applicationCategory";
public static final String APPLICATION_SUB_CATEGORY = "http://schema.org/applicationSubCategory";
public static final String APPLICATION_SUITE = "http://schema.org/applicationSuite";
public static final String ARRIVAL_GATE = "http://schema.org/arrivalGate";
public static final String ARRIVAL_PLATFORM = "http://schema.org/arrivalPlatform";
public static final String ARRIVAL_TERMINAL = "http://schema.org/arrivalTerminal";
public static final String ORG_ARRIVAL_TIME = "http://schema.org/arrivalTime";
public static final String ARTICLE_BODY = "http://schema.org/articleBody";
public static final String ARTICLE_SECTION = "http://schema.org/articleSection";
public static final String ASPECT = "http://schema.org/aspect";
public static final String ASSEMBLY = "http://schema.org/assembly";
public static final String ASSEMBLY_VERSION = "http://schema.org/assemblyVersion";
public static final String ASSOCIATED_PATHOPHYSIOLOGY = "http://schema.org/associatedPathophysiology";
public static final String AUDIENCE_TYPE = "http://schema.org/audienceType";
public static final String AVAILABILITY_ENDS = "http://schema.org/availabilityEnds";
public static final String AVAILABILITY_STARTS = "http://schema.org/availabilityStarts";
public static final String AVAILABLE_FROM = "http://schema.org/availableFrom";
public static final String AVAILABLE_THROUGH = "http://schema.org/availableThrough";
public static final String AWARD = "http://schema.org/award";
public static final String BACKGROUND = "http://schema.org/background";
public static final String BASE_SALARY = "http://schema.org/baseSalary";
public static final String BENEFITS = "http://schema.org/benefits";
public static final String BEST_RATING = "http://schema.org/bestRating";
public static final String BILLING_INCREMENT = "http://schema.org/billingIncrement";
public static final String BIOMECHNICAL_CLASS = "http://schema.org/biomechnicalClass";
public static final String BIRTH_DATE = "http://schema.org/birthDate";
public static final String BITRATE = "http://schema.org/bitrate";
public static final String BOARDING_GROUP = "http://schema.org/boardingGroup";
public static final String BODY_LOCATION = "http://schema.org/bodyLocation";
public static final String BOOK_EDITION = "http://schema.org/bookEdition";
public static final String BOOKING_TIME = "http://schema.org/bookingTime";
public static final String BOOLEAN = "http://schema.org/Boolean";
public static final String BOX = "http://schema.org/box";
public static final String BREADCRUMB = "http://schema.org/breadcrumb";
public static final String BREASTFEEDING_WARNING = "http://schema.org/breastfeedingWarning";
public static final String BROWSER_REQUIREMENTS = "http://schema.org/browserRequirements";
public static final String BUS_NAME = "http://schema.org/busName";
public static final String BUS_NUMBER = "http://schema.org/busNumber";
public static final String CALORIES = "http://schema.org/calories";
public static final String CAPTION = "http://schema.org/caption";
public static final String CARBOHYDRATE_CONTENT = "http://schema.org/carbohydrateContent";
public static final String CARRIER_REQUIREMENTS = "http://schema.org/carrierRequirements";
public static final String CHARACTER_NAME = "http://schema.org/characterName";
public static final String CHECKIN_TIME = "http://schema.org/checkinTime";
public static final String CHECKOUT_TIME = "http://schema.org/checkoutTime";
public static final String CHILD_MAX_AGE = "http://schema.org/childMaxAge";
public static final String CHILD_MIN_AGE = "http://schema.org/childMinAge";
public static final String CHOLESTEROL_CONTENT = "http://schema.org/cholesterolContent";
public static final String CIRCLE = "http://schema.org/circle";
public static final String CLINCAL_PHARMACOLOGY = "http://schema.org/clincalPharmacology";
public static final String CLIP_NUMBER = "http://schema.org/clipNumber";
public static final String CLOSES = "http://schema.org/closes";
public static final String CODE_REPOSITORY = "http://schema.org/codeRepository";
public static final String CODE_VALUE = "http://schema.org/codeValue";
public static final String CODING_SYSTEM = "http://schema.org/codingSystem";
public static final String COLOR = "http://schema.org/color";
public static final String COMMENT_COUNT = "http://schema.org/commentCount";
public static final String COMMENT_TEXT = "http://schema.org/commentText";
public static final String COMMENT_TIME = "http://schema.org/commentTime";
public static final String CONFIRMATION_NUMBER = "http://schema.org/confirmationNumber";
public static final String CONTACT_TYPE = "http://schema.org/contactType";
public static final String CONTENT_RATING = "http://schema.org/contentRating";
public static final String CONTENT_SIZE = "http://schema.org/contentSize";
public static final String CONTENT_TYPE = "http://schema.org/contentType";
public static final String CONTENT_URL = "http://schema.org/contentUrl";
public static final String COOK_TIME = "http://schema.org/cookTime";
public static final String COOKING_METHOD = "http://schema.org/cookingMethod";
public static final String COPYRIGHT_YEAR = "http://schema.org/copyrightYear";
public static final String COST_CURRENCY = "http://schema.org/costCurrency";
public static final String COST_ORIGIN = "http://schema.org/costOrigin";
public static final String COST_PER_UNIT = "http://schema.org/costPerUnit";
public static final String COUNTRIES_NOT_SUPPORTED = "http://schema.org/countriesNotSupported";
public static final String COUNTRIES_SUPPORTED = "http://schema.org/countriesSupported";
public static final String CURRENCIES_ACCEPTED = "http://schema.org/currenciesAccepted";
public static final String DATE_CREATED = "http://schema.org/dateCreated";
public static final String DATE_ISSUED = "http://schema.org/dateIssued";
public static final String DATE_MODIFIED = "http://schema.org/dateModified";
public static final String DATE_POSTED = "http://schema.org/datePosted";
public static final String ORG_DATE_PUBLISHED = "http://schema.org/datePublished";
public static final String DATE_TIME = "http://schema.org/DateTime";
public static final String DATELINE = "http://schema.org/dateline";
public static final String DEATH_DATE = "http://schema.org/deathDate";
public static final String DEPARTURE_GATE = "http://schema.org/departureGate";
public static final String DEPARTURE_PLATFORM = "http://schema.org/departurePlatform";
public static final String DEPARTURE_TERMINAL = "http://schema.org/departureTerminal";
public static final String DEPARTURE_TIME = "http://schema.org/departureTime";
public static final String DEPENDENCIES = "http://schema.org/dependencies";
public static final String DEVICE = "http://schema.org/device";
public static final String DIET_FEATURES = "http://schema.org/dietFeatures";
public static final String DISCOUNT = "http://schema.org/discount";
public static final String DISCOUNT_CODE = "http://schema.org/discountCode";
public static final String DISCOUNT_CURRENCY = "http://schema.org/discountCurrency";
public static final String DISCUSSION_URL = "http://schema.org/discussionUrl";
public static final String DISSOLUTION_DATE = "http://schema.org/dissolutionDate";
public static final String DISTANCE = "http://schema.org/distance";
public static final String DOOR_TIME = "http://schema.org/doorTime";
public static final String DOSAGE_FORM = "http://schema.org/dosageForm";
public static final String DOSE_UNIT = "http://schema.org/doseUnit";
public static final String DOSE_VALUE = "http://schema.org/doseValue";
public static final String DOWNLOAD_URL = "http://schema.org/downloadUrl";
public static final String DOWNVOTE_COUNT = "http://schema.org/downvoteCount";
public static final String DROPOFF_TIME = "http://schema.org/dropoffTime";
public static final String DRUG_UNIT = "http://schema.org/drugUnit";
public static final String DUNS = "http://schema.org/duns";
public static final String DURATION = "http://schema.org/duration";
public static final String EDUCATION_REQUIREMENTS = "http://schema.org/educationRequirements";
public static final String EDUCATIONAL_FRAMEWORK = "http://schema.org/educationalFramework";
public static final String EDUCATIONAL_ROLE = "http://schema.org/educationalRole";
public static final String ORG_EDUCATIONAL_USE = "http://schema.org/educationalUse";
public static final String ELEVATION = "http://schema.org/elevation";
public static final String EMAIL = "http://schema.org/email";
public static final String EMBED_URL = "http://schema.org/embedUrl";
public static final String EMPLOYMENT_TYPE = "http://schema.org/employmentType";
public static final String ENCODING_FORMAT = "http://schema.org/encodingFormat";
public static final String ENCODING_TYPE = "http://schema.org/encodingType";
public static final String END_DATE = "http://schema.org/endDate";
public static final String END_TIME = "http://schema.org/endTime";
public static final String ORG_EPIDEMIOLOGY = "http://schema.org/epidemiology";
public static final String EPISODE_NUMBER = "http://schema.org/episodeNumber";
public static final String ESTIMATED_FLIGHT_DURATION = "http://schema.org/estimatedFlightDuration";
public static final String EVIDENCE_ORIGIN = "http://schema.org/evidenceOrigin";
public static final String ORG_EXERCISE_TYPE = "http://schema.org/exerciseType";
public static final String EXIF_DATA = "http://schema.org/exifData";
public static final String EXPECTED_ARRIVAL_FROM = "http://schema.org/expectedArrivalFrom";
public static final String EXPECTED_ARRIVAL_UNTIL = "http://schema.org/expectedArrivalUntil";
public static final String EXPECTED_PROGNOSIS = "http://schema.org/expectedPrognosis";
public static final String EXPERIENCE_REQUIREMENTS = "http://schema.org/experienceRequirements";
public static final String EXPERT_CONSIDERATIONS = "http://schema.org/expertConsiderations";
public static final String EXPIRES = "http://schema.org/expires";
public static final String FAMILY_NAME = "http://schema.org/familyName";
public static final String FAT_CONTENT = "http://schema.org/fatContent";
public static final String FAX_NUMBER = "http://schema.org/faxNumber";
public static final String FEATURE_LIST = "http://schema.org/featureList";
public static final String FIBER_CONTENT = "http://schema.org/fiberContent";
public static final String FILE_FORMAT = "http://schema.org/fileFormat";
public static final String FILE_SIZE = "http://schema.org/fileSize";
public static final String FLIGHT_DISTANCE = "http://schema.org/flightDistance";
public static final String FLIGHT_NUMBER = "http://schema.org/flightNumber";
public static final String FOLLOWUP = "http://schema.org/followup";
public static final String FOOD_WARNING = "http://schema.org/foodWarning";
public static final String FOUNDING_DATE = "http://schema.org/foundingDate";
public static final String FREE = "http://schema.org/free";
public static final String FREQUENCY = "http://schema.org/frequency";
public static final String FROM_LOCATION = "http://schema.org/fromLocation";
public static final String FUNCTION = "http://schema.org/function";
public static final String FUNCTIONAL_CLASS = "http://schema.org/functionalClass";
public static final String GENDER = "http://schema.org/gender";
public static final String GENRE = "http://schema.org/genre";
public static final String GIVEN_NAME = "http://schema.org/givenName";
public static final String GLOBAL_LOCATION_NUMBER = "http://schema.org/globalLocationNumber";
public static final String GTIN_13 = "http://schema.org/gtin13";
public static final String GTIN_14 = "http://schema.org/gtin14";
public static final String GTIN_8 = "http://schema.org/gtin8";
public static final String GUIDELINE_DATE = "http://schema.org/guidelineDate";
public static final String HAS_MAP = "http://schema.org/hasMap";
public static final String HEADLINE = "http://schema.org/headline";
public static final String HIGH_PRICE = "http://schema.org/highPrice";
public static final String HONORIFIC_PREFIX = "http://schema.org/honorificPrefix";
public static final String HONORIFIC_SUFFIX = "http://schema.org/honorificSuffix";
public static final String HOW_PERFORMED = "http://schema.org/howPerformed";
public static final String HTTP_METHOD = "http://schema.org/httpMethod";
public static final String IATA_CODE = "http://schema.org/iataCode";
public static final String ICAO_CODE = "http://schema.org/icaoCode";
public static final String IMAGE = "http://schema.org/image";
public static final String IN_LANGUAGE = "http://schema.org/inLanguage";
public static final String INCENTIVES = "http://schema.org/incentives";
public static final String INDUSTRY = "http://schema.org/industry";
public static final String INFECTIOUS_AGENT = "http://schema.org/infectiousAgent";
public static final String INGREDIENTS = "http://schema.org/ingredients";
public static final String INSTALL_URL = "http://schema.org/installUrl";
public static final String INTENSITY = "http://schema.org/intensity";
public static final String INTERACTION_COUNT = "http://schema.org/interactionCount";
public static final String INTERACTIVITY_TYPE = "http://schema.org/interactivityType";
public static final String IS_AVAILABLE_GENERICALLY = "http://schema.org/isAvailableGenerically";
public static final String IS_BASED_ON_URL = "http://schema.org/isBasedOnUrl";
public static final String IS_FAMILY_FRIENDLY = "http://schema.org/isFamilyFriendly";
public static final String IS_GIFT = "http://schema.org/isGift";
public static final String IS_PROPRIETARY = "http://schema.org/isProprietary";
public static final String ISBN = "http://schema.org/isbn";
public static final String ISIC_V_4 = "http://schema.org/isicV4";
public static final String ISSN = "http://schema.org/issn";
public static final String ISSUE_NUMBER = "http://schema.org/issueNumber";
public static final String ITEM_LIST_ELEMENT = "http://schema.org/itemListElement";
public static final String ITEM_LIST_ORDER = "http://schema.org/itemListOrder";
public static final String JOB_TITLE = "http://schema.org/jobTitle";
public static final String KEYWORDS = "http://schema.org/keywords";
public static final String LABEL_DETAILS = "http://schema.org/labelDetails";
public static final String LAST_REVIEWED = "http://schema.org/lastReviewed";
public static final String LATITUDE = "http://schema.org/latitude";
public static final String LEARNING_RESOURCE_TYPE = "http://schema.org/learningResourceType";
public static final String LEGAL_NAME = "http://schema.org/legalName";
public static final String LICENSE = "http://schema.org/license";
public static final String LINE = "http://schema.org/line";
public static final String LODGING_UNIT_DESCRIPTION = "http://schema.org/lodgingUnitDescription";
public static final String LOGO = "http://schema.org/logo";
public static final String LONGITUDE = "http://schema.org/longitude";
public static final String LOW_PRICE = "http://schema.org/lowPrice";
public static final String MAP = "http://schema.org/map";
public static final String MAX_PRICE = "http://schema.org/maxPrice";
public static final String MAX_VALUE = "http://schema.org/maxValue";
public static final String MEAL_SERVICE = "http://schema.org/mealService";
public static final String MECHANISM_OF_ACTION = "http://schema.org/mechanismOfAction";
public static final String MEMBERSHIP_NUMBER = "http://schema.org/membershipNumber";
public static final String MEMORY_REQUIREMENTS = "http://schema.org/memoryRequirements";
public static final String MENU = "http://schema.org/menu";
public static final String MIN_PRICE = "http://schema.org/minPrice";
public static final String MIN_VALUE = "http://schema.org/minValue";
public static final String MODIFIED_TIME = "http://schema.org/modifiedTime";
public static final String MPN = "http://schema.org/mpn";
public static final String MULTIPLE_VALUES = "http://schema.org/multipleValues";
public static final String MUSCLE_ACTION = "http://schema.org/muscleAction";
public static final String NAICS = "http://schema.org/naics";
public static final String NAMED_POSITION = "http://schema.org/namedPosition";
public static final String NATURAL_PROGRESSION = "http://schema.org/naturalProgression";
public static final String NON_PROPRIETARY_NAME = "http://schema.org/nonProprietaryName";
public static final String NORMAL_RANGE = "http://schema.org/normalRange";
public static final String NUM_ADULTS = "http://schema.org/numAdults";
public static final String NUM_CHILDREN = "http://schema.org/numChildren";
public static final String NUM_TRACKS = "http://schema.org/numTracks";
public static final String NUMBER_OF_EPISODES = "http://schema.org/numberOfEpisodes";
public static final String NUMBER_OF_PAGES = "http://schema.org/numberOfPages";
public static final String NUMBER_OF_SEASONS = "http://schema.org/numberOfSeasons";
public static final String OCCUPATIONAL_CATEGORY = "http://schema.org/occupationalCategory";
public static final String OFFER_COUNT = "http://schema.org/offerCount";
public static final String OPENING_HOURS = "http://schema.org/openingHours";
public static final String OPENS = "http://schema.org/opens";
public static final String OPERATING_SYSTEM = "http://schema.org/operatingSystem";
public static final String ORDER_DATE = "http://schema.org/orderDate";
public static final String ORDER_NUMBER = "http://schema.org/orderNumber";
public static final String OUTCOME = "http://schema.org/outcome";
public static final String OVERDOSAGE = "http://schema.org/overdosage";
public static final String OVERVIEW = "http://schema.org/overview";
public static final String OWNED_FROM = "http://schema.org/ownedFrom";
public static final String OWNED_THROUGH = "http://schema.org/ownedThrough";
public static final String PAGE_END = "http://schema.org/pageEnd";
public static final String ORG_PAGE_START = "http://schema.org/pageStart";
public static final String PAGINATION = "http://schema.org/pagination";
public static final String PARTY_SIZE = "http://schema.org/partySize";
public static final String PATHOPHYSIOLOGY = "http://schema.org/pathophysiology";
public static final String PAYMENT_ACCEPTED = "http://schema.org/paymentAccepted";
public static final String PAYMENT_DUE = "http://schema.org/paymentDue";
public static final String PAYMENT_METHOD_ID = "http://schema.org/paymentMethodId";
public static final String PAYMENT_URL = "http://schema.org/paymentUrl";
public static final String PERMISSIONS = "http://schema.org/permissions";
public static final String PHASE = "http://schema.org/phase";
public static final String PHYSIOLOGICAL_BENEFITS = "http://schema.org/physiologicalBenefits";
public static final String PICKUP_TIME = "http://schema.org/pickupTime";
public static final String PLAYER_TYPE = "http://schema.org/playerType";
public static final String POLYGON = "http://schema.org/polygon";
public static final String POPULATION = "http://schema.org/population";
public static final String POSITION = "http://schema.org/position";
public static final String POSSIBLE_COMPLICATION = "http://schema.org/possibleComplication";
public static final String POST_OFFICE_BOX_NUMBER = "http://schema.org/postOfficeBoxNumber";
public static final String POST_OP = "http://schema.org/postOp";
public static final String POSTAL_CODE = "http://schema.org/postalCode";
public static final String PRE_OP = "http://schema.org/preOp";
public static final String PREGNANCY_WARNING = "http://schema.org/pregnancyWarning";
public static final String PREP_TIME = "http://schema.org/prepTime";
public static final String PREPARATION = "http://schema.org/preparation";
public static final String PRESCRIBING_INFO = "http://schema.org/prescribingInfo";
public static final String PREVIOUS_START_DATE = "http://schema.org/previousStartDate";
public static final String PRICE = "http://schema.org/price";
public static final String PRICE_CURRENCY = "http://schema.org/priceCurrency";
public static final String PRICE_RANGE = "http://schema.org/priceRange";
public static final String PRICE_TYPE = "http://schema.org/priceType";
public static final String PRICE_VALID_UNTIL = "http://schema.org/priceValidUntil";
public static final String PRINT_COLUMN = "http://schema.org/printColumn";
public static final String PRINT_EDITION = "http://schema.org/printEdition";
public static final String PRINT_PAGE = "http://schema.org/printPage";
public static final String PRINT_SECTION = "http://schema.org/printSection";
public static final String PROCEDURE = "http://schema.org/procedure";
public static final String PROCESSING_TIME = "http://schema.org/processingTime";
public static final String PROCESSOR_REQUIREMENTS = "http://schema.org/processorRequirements";
public static final String PRODUCT_ID = "http://schema.org/productID";
public static final String PROFICIENCY_LEVEL = "http://schema.org/proficiencyLevel";
public static final String PROGRAM_NAME = "http://schema.org/programName";
public static final String PROGRAMMING_MODEL = "http://schema.org/programmingModel";
public static final String PROPRIETARY_NAME = "http://schema.org/proprietaryName";
public static final String PROTEIN_CONTENT = "http://schema.org/proteinContent";
public static final String PUBLICATION_TYPE = "http://schema.org/publicationType";
public static final String PUBLISHING_PRINCIPLES = "http://schema.org/publishingPrinciples";
public static final String QUALIFICATIONS = "http://schema.org/qualifications";
public static final String QUESTION = "http://schema.org/question";
public static final String RATING_COUNT = "http://schema.org/ratingCount";
public static final String RATING_VALUE = "http://schema.org/ratingValue";
public static final String READONLY_VALUE = "http://schema.org/readonlyValue";
public static final String RECIPE_CATEGORY = "http://schema.org/recipeCategory";
public static final String RECIPE_CUISINE = "http://schema.org/recipeCuisine";
public static final String RECIPE_INSTRUCTIONS = "http://schema.org/recipeInstructions";
public static final String RECIPE_YIELD = "http://schema.org/recipeYield";
public static final String RECOMMENDATION_STRENGTH = "http://schema.org/recommendationStrength";
public static final String RELATED_LINK = "http://schema.org/relatedLink";
public static final String RELEASE_DATE = "http://schema.org/releaseDate";
public static final String RELEASE_NOTES = "http://schema.org/releaseNotes";
public static final String REPETITIONS = "http://schema.org/repetitions";
public static final String REPLY_TO_URL = "http://schema.org/replyToUrl";
public static final String REPRESENTATIVE_OF_PAGE = "http://schema.org/representativeOfPage";
public static final String REQUIRED_GENDER = "http://schema.org/requiredGender";
public static final String REQUIRED_MAX_AGE = "http://schema.org/requiredMaxAge";
public static final String REQUIRED_MIN_AGE = "http://schema.org/requiredMinAge";
public static final String REQUIREMENTS = "http://schema.org/requirements";
public static final String REQUIRES_SUBSCRIPTION = "http://schema.org/requiresSubscription";
public static final String RESERVATION_ID = "http://schema.org/reservationId";
public static final String RESPONSIBILITIES = "http://schema.org/responsibilities";
public static final String REST_PERIODS = "http://schema.org/restPeriods";
public static final String REVIEW_BODY = "http://schema.org/reviewBody";
public static final String REVIEW_COUNT = "http://schema.org/reviewCount";
public static final String RISKS = "http://schema.org/risks";
public static final String RUNTIME = "http://schema.org/runtime";
public static final String SAFETY_CONSIDERATION = "http://schema.org/safetyConsideration";
public static final String SALARY_CURRENCY = "http://schema.org/salaryCurrency";
public static final String SAME_AS = "http://schema.org/sameAs";
public static final String SAMPLE_TYPE = "http://schema.org/sampleType";
public static final String SATURATED_FAT_CONTENT = "http://schema.org/saturatedFatContent";
public static final String SCHEDULED_TIME = "http://schema.org/scheduledTime";
public static final String SCREENSHOT = "http://schema.org/screenshot";
public static final String SEASON_NUMBER = "http://schema.org/seasonNumber";
public static final String SEAT_NUMBER = "http://schema.org/seatNumber";
public static final String SEAT_ROW = "http://schema.org/seatRow";
public static final String SEAT_SECTION = "http://schema.org/seatSection";
public static final String SERIAL_NUMBER = "http://schema.org/serialNumber";
public static final String SERVES_CUISINE = "http://schema.org/servesCuisine";
public static final String SERVICE_TYPE = "http://schema.org/serviceType";
public static final String SERVICE_URL = "http://schema.org/serviceUrl";
public static final String SERVING_SIZE = "http://schema.org/servingSize";
public static final String SIGNIFICANCE = "http://schema.org/significance";
public static final String SIGNIFICANT_LINK = "http://schema.org/significantLink";
public static final String SKILLS = "http://schema.org/skills";
public static final String SKU = "http://schema.org/sku";
public static final String SODIUM_CONTENT = "http://schema.org/sodiumContent";
public static final String SOFTWARE_VERSION = "http://schema.org/softwareVersion";
public static final String SPECIAL_COMMITMENTS = "http://schema.org/specialCommitments";
public static final String STAGE_AS_NUMBER = "http://schema.org/stageAsNumber";
public static final String STATUS = "http://schema.org/status";
public static final String START_DATE = "http://schema.org/startDate";
public static final String START_TIME = "http://schema.org/startTime";
public static final String STEP = "http://schema.org/step";
public static final String STEP_VALUE = "http://schema.org/stepValue";
public static final String STORAGE_REQUIREMENTS = "http://schema.org/storageRequirements";
public static final String STREET_ADDRESS = "http://schema.org/streetAddress";
public static final String STRENGTH_UNIT = "http://schema.org/strengthUnit";
public static final String STRENGTH_VALUE = "http://schema.org/strengthValue";
public static final String STRUCTURAL_CLASS = "http://schema.org/structuralClass";
public static final String SUB_STAGE_SUFFIX = "http://schema.org/subStageSuffix";
public static final String SUBTYPE = "http://schema.org/subtype";
public static final String SUGAR_CONTENT = "http://schema.org/sugarContent";
public static final String SUGGESTED_GENDER = "http://schema.org/suggestedGender";
public static final String SUGGESTED_MAX_AGE = "http://schema.org/suggestedMaxAge";
public static final String SUGGESTED_MIN_AGE = "http://schema.org/suggestedMinAge";
public static final String TARGET_DESCRIPTION = "http://schema.org/targetDescription";
public static final String TARGET_NAME = "http://schema.org/targetName";
public static final String TARGET_PLATFORM = "http://schema.org/targetPlatform";
public static final String TARGET_POPULATION = "http://schema.org/targetPopulation";
public static final String TARGET_URL = "http://schema.org/targetUrl";
public static final String TAX_ID = "http://schema.org/taxID";
public static final String TELEPHONE = "http://schema.org/telephone";
public static final String TEMPORAL = "http://schema.org/temporal";
public static final String TEXT = "http://schema.org/text";
public static final String THUMBNAIL_URL = "http://schema.org/thumbnailUrl";
public static final String TICKER_SYMBOL = "http://schema.org/tickerSymbol";
public static final String TICKET_NUMBER = "http://schema.org/ticketNumber";
public static final String TICKET_TOKEN = "http://schema.org/ticketToken";
public static final String TIME_REQUIRED = "http://schema.org/timeRequired";
public static final String TISSUE_SAMPLE = "http://schema.org/tissueSample";
public static final String TITLE = "http://schema.org/title";
public static final String TO_LOCATION = "http://schema.org/toLocation";
public static final String TOTAL_PRICE = "http://schema.org/totalPrice";
public static final String TOTAL_TIME = "http://schema.org/totalTime";
public static final String TRACKING_NUMBER = "http://schema.org/trackingNumber";
public static final String TRACKING_URL = "http://schema.org/trackingUrl";
public static final String TRAIN_NAME = "http://schema.org/trainName";
public static final String TRAIN_NUMBER = "http://schema.org/trainNumber";
public static final String TRANS_FAT_CONTENT = "http://schema.org/transFatContent";
public static final String TRANSCRIPT = "http://schema.org/transcript";
public static final String TRANSMISSION_METHOD = "http://schema.org/transmissionMethod";
public static final String TYPICAL_AGE_RANGE = "http://schema.org/typicalAgeRange";
public static final String UNIT_CODE = "http://schema.org/unitCode";
public static final String UNSATURATED_FAT_CONTENT = "http://schema.org/unsaturatedFatContent";
public static final String UPLOAD_DATE = "http://schema.org/uploadDate";
public static final String UPVOTE_COUNT = "http://schema.org/upvoteCount";
public static final String URL_TEMPLATE = "http://schema.org/urlTemplate";
public static final String VALID_FOR = "http://schema.org/validFor";
public static final String VALID_FROM = "http://schema.org/validFrom";
public static final String VALID_THROUGH = "http://schema.org/validThrough";
public static final String VALID_UNTIL = "http://schema.org/validUntil";
public static final String VALUE = "http://schema.org/value";
public static final String VALUE_ADDED_TAX_INCLUDED = "http://schema.org/valueAddedTaxIncluded";
public static final String VALUE_MAX_LENGTH = "http://schema.org/valueMaxLength";
public static final String VALUE_MIN_LENGTH = "http://schema.org/valueMinLength";
public static final String VALUE_NAME = "http://schema.org/valueName";
public static final String VALUE_PATTERN = "http://schema.org/valuePattern";
public static final String VALUE_REQUIRED = "http://schema.org/valueRequired";
public static final String VAT_ID = "http://schema.org/vatID";
public static final String VERSION = "http://schema.org/version";
public static final String VIDEO_FRAME_SIZE = "http://schema.org/videoFrameSize";
public static final String VIDEO_QUALITY = "http://schema.org/videoQuality";
public static final String VOLUME_NUMBER = "http://schema.org/volumeNumber";
public static final String WARNING = "http://schema.org/warning";
public static final String WEB_CHECKIN_TIME = "http://schema.org/webCheckinTime";
public static final String WEIGHT = "http://schema.org/weight";
public static final String WORD_COUNT = "http://schema.org/wordCount";
public static final String WORK_HOURS = "http://schema.org/workHours";
public static final String WORKLOAD = "http://schema.org/workload";
public static final String WORST_RATING = "http://schema.org/worstRating";
public static List<String> getAll() {
return Arrays.asList(GEO_JSON_LINE_STRING,
GEO_JSON_POLYGON,
GEO_JSON_MULTI_POINT,
GEO_JSON_MULTI_LINE_STRING,
GEO_JSON_MULTI_POLYGON,
QUANTITATIVE_VALUE,
PROPERTY_VALUE_SPECIFICATION,
NUMBER,
ORG_ENUMERATION,
ALTITUDE,
ACCEPTS_RESERVATIONS,
ACCESS_CODE,
ACCESSIBILITY_API,
ACCESSIBILITY_CONTROL,
ACCESSIBILITY_FEATURE,
ACCESSIBILITY_HAZARD,
ACTION,
ORG_ACTIVE_INGREDIENT,
ACTIVITY_DURATION,
ACTIVITY_FREQUENCY,
ADDITIONAL_NAME,
ADDITIONAL_VARIABLE,
ADDRESS_LOCALITY,
ORG_ADDRESS_REGION,
ADMINISTRATION_ROUTE,
ALCOHOL_WARNING,
ALGORITHM,
ALIGNMENT_TYPE,
ALTERNATE_NAME,
ALTERNATIVE_HEADLINE,
AMOUNT_OF_THIS_GOOD,
ANSWER_COUNT,
APPLICATION_CATEGORY,
APPLICATION_SUB_CATEGORY,
APPLICATION_SUITE,
ARRIVAL_GATE,
ARRIVAL_PLATFORM,
ARRIVAL_TERMINAL,
ORG_ARRIVAL_TIME,
ARTICLE_BODY,
ARTICLE_SECTION,
ASPECT,
ASSEMBLY,
ASSEMBLY_VERSION,
ASSOCIATED_PATHOPHYSIOLOGY,
AUDIENCE_TYPE,
AVAILABILITY_ENDS,
AVAILABILITY_STARTS,
AVAILABLE_FROM,
AVAILABLE_THROUGH,
AWARD,
BACKGROUND,
BASE_SALARY,
BENEFITS,
BEST_RATING,
BILLING_INCREMENT,
BIOMECHNICAL_CLASS,
BIRTH_DATE,
BITRATE,
BOARDING_GROUP,
BODY_LOCATION,
BOOK_EDITION,
BOOKING_TIME,
BOOLEAN,
BOX,
BREADCRUMB,
BREASTFEEDING_WARNING,
BROWSER_REQUIREMENTS,
BUS_NAME,
BUS_NUMBER,
CALORIES,
CAPTION,
CARBOHYDRATE_CONTENT,
CARRIER_REQUIREMENTS,
CHARACTER_NAME,
CHECKIN_TIME,
CHECKOUT_TIME,
CHILD_MAX_AGE,
CHILD_MIN_AGE,
CHOLESTEROL_CONTENT,
CIRCLE,
CLINCAL_PHARMACOLOGY,
CLIP_NUMBER,
CLOSES,
CODE_REPOSITORY,
CODE_VALUE,
CODING_SYSTEM,
COLOR,
COMMENT_COUNT,
COMMENT_TEXT,
COMMENT_TIME,
CONFIRMATION_NUMBER,
CONTACT_TYPE,
CONTENT_RATING,
CONTENT_SIZE,
CONTENT_TYPE,
CONTENT_URL,
COOK_TIME,
COOKING_METHOD,
COPYRIGHT_YEAR,
COST_CURRENCY,
COST_ORIGIN,
COST_PER_UNIT,
COUNTRIES_NOT_SUPPORTED,
COUNTRIES_SUPPORTED,
CURRENCIES_ACCEPTED,
DATE_CREATED,
DATE_ISSUED,
DATE_MODIFIED,
DATE_POSTED,
ORG_DATE_PUBLISHED,
DATE_TIME,
DATELINE,
DEATH_DATE,
DEPARTURE_GATE,
DEPARTURE_PLATFORM,
DEPARTURE_TERMINAL,
DEPARTURE_TIME,
DEPENDENCIES,
DEVICE,
DIET_FEATURES,
DISCOUNT,
DISCOUNT_CODE,
DISCOUNT_CURRENCY,
DISCUSSION_URL,
DISSOLUTION_DATE,
DISTANCE,
DOOR_TIME,
DOSAGE_FORM,
DOSE_UNIT,
DOSE_VALUE,
DOWNLOAD_URL,
DOWNVOTE_COUNT,
DROPOFF_TIME,
DRUG_UNIT,
DUNS,
DURATION,
EDUCATION_REQUIREMENTS,
EDUCATIONAL_FRAMEWORK,
EDUCATIONAL_ROLE,
ORG_EDUCATIONAL_USE,
ELEVATION,
EMAIL,
EMBED_URL,
EMPLOYMENT_TYPE,
ENCODING_FORMAT,
ENCODING_TYPE,
END_DATE,
END_TIME,
ORG_EPIDEMIOLOGY,
EPISODE_NUMBER,
ESTIMATED_FLIGHT_DURATION,
EVIDENCE_ORIGIN,
ORG_EXERCISE_TYPE,
EXIF_DATA,
EXPECTED_ARRIVAL_FROM,
EXPECTED_ARRIVAL_UNTIL,
EXPECTED_PROGNOSIS,
EXPERIENCE_REQUIREMENTS,
EXPERT_CONSIDERATIONS,
EXPIRES,
FAMILY_NAME,
FAT_CONTENT,
FAX_NUMBER,
FEATURE_LIST,
FIBER_CONTENT,
FILE_FORMAT,
FILE_SIZE,
FLIGHT_DISTANCE,
FLIGHT_NUMBER,
FOLLOWUP,
FOOD_WARNING,
FOUNDING_DATE,
FREE,
FREQUENCY,
FROM_LOCATION,
FUNCTION,
FUNCTIONAL_CLASS,
GENDER,
GENRE,
GIVEN_NAME,
GLOBAL_LOCATION_NUMBER,
GTIN_13,
GTIN_14,
GTIN_8,
GUIDELINE_DATE,
HAS_MAP,
HEADLINE,
HIGH_PRICE,
HONORIFIC_PREFIX,
HONORIFIC_SUFFIX,
HOW_PERFORMED,
HTTP_METHOD,
IATA_CODE,
ICAO_CODE,
IMAGE,
IN_LANGUAGE,
INCENTIVES,
INDUSTRY,
INFECTIOUS_AGENT,
INGREDIENTS,
INSTALL_URL,
INTENSITY,
INTERACTION_COUNT,
INTERACTIVITY_TYPE,
IS_AVAILABLE_GENERICALLY,
IS_BASED_ON_URL,
IS_FAMILY_FRIENDLY,
IS_GIFT,
IS_PROPRIETARY,
ISBN,
ISIC_V_4,
ISSN,
ISSUE_NUMBER,
ITEM_LIST_ELEMENT,
ITEM_LIST_ORDER,
JOB_TITLE,
KEYWORDS,
LABEL_DETAILS,
LAST_REVIEWED,
LATITUDE,
LEARNING_RESOURCE_TYPE,
LEGAL_NAME,
LICENSE,
LINE,
LODGING_UNIT_DESCRIPTION,
LOGO,
LONGITUDE,
LOW_PRICE,
MAP,
MAX_PRICE,
MAX_VALUE,
MEAL_SERVICE,
MECHANISM_OF_ACTION,
MEMBERSHIP_NUMBER,
MEMORY_REQUIREMENTS,
MENU,
MIN_PRICE,
MIN_VALUE,
MODIFIED_TIME,
MPN,
MULTIPLE_VALUES,
MUSCLE_ACTION,
NAICS,
NAMED_POSITION,
NATURAL_PROGRESSION,
NON_PROPRIETARY_NAME,
NORMAL_RANGE,
NUM_ADULTS,
NUM_CHILDREN,
NUM_TRACKS,
NUMBER_OF_EPISODES,
NUMBER_OF_PAGES,
NUMBER_OF_SEASONS,
OCCUPATIONAL_CATEGORY,
OFFER_COUNT,
OPENING_HOURS,
OPENS,
OPERATING_SYSTEM,
ORDER_DATE,
ORDER_NUMBER,
OUTCOME,
OVERDOSAGE,
OVERVIEW,
OWNED_FROM,
OWNED_THROUGH,
PAGE_END,
ORG_PAGE_START,
PAGINATION,
PARTY_SIZE,
PATHOPHYSIOLOGY,
PAYMENT_ACCEPTED,
PAYMENT_DUE,
PAYMENT_METHOD_ID,
PAYMENT_URL,
PERMISSIONS,
PHASE,
PHYSIOLOGICAL_BENEFITS,
PICKUP_TIME,
PLAYER_TYPE,
POLYGON,
POPULATION,
POSITION,
POSSIBLE_COMPLICATION,
POST_OFFICE_BOX_NUMBER,
POST_OP,
POSTAL_CODE,
PRE_OP,
PREGNANCY_WARNING,
PREP_TIME,
PREPARATION,
PRESCRIBING_INFO,
PREVIOUS_START_DATE,
PRICE,
PRICE_CURRENCY,
PRICE_RANGE,
PRICE_TYPE,
PRICE_VALID_UNTIL,
PRINT_COLUMN,
PRINT_EDITION,
PRINT_PAGE,
PRINT_SECTION,
PROCEDURE,
PROCESSING_TIME,
PROCESSOR_REQUIREMENTS,
PRODUCT_ID,
PROFICIENCY_LEVEL,
PROGRAM_NAME,
PROGRAMMING_MODEL,
PROPRIETARY_NAME,
PROTEIN_CONTENT,
PUBLICATION_TYPE,
PUBLISHING_PRINCIPLES,
QUALIFICATIONS,
QUESTION,
RATING_COUNT,
RATING_VALUE,
READONLY_VALUE,
RECIPE_CATEGORY,
RECIPE_CUISINE,
RECIPE_INSTRUCTIONS,
RECIPE_YIELD,
RECOMMENDATION_STRENGTH,
RELATED_LINK,
RELEASE_DATE,
RELEASE_NOTES,
REPETITIONS,
REPLY_TO_URL,
REPRESENTATIVE_OF_PAGE,
REQUIRED_GENDER,
REQUIRED_MAX_AGE,
REQUIRED_MIN_AGE,
REQUIREMENTS,
REQUIRES_SUBSCRIPTION,
RESERVATION_ID,
RESPONSIBILITIES,
REST_PERIODS,
REVIEW_BODY,
REVIEW_COUNT,
RISKS,
RUNTIME,
SAFETY_CONSIDERATION,
SALARY_CURRENCY,
SAME_AS,
SAMPLE_TYPE,
SATURATED_FAT_CONTENT,
SCHEDULED_TIME,
SCREENSHOT,
SEASON_NUMBER,
SEAT_NUMBER,
SEAT_ROW,
SEAT_SECTION,
SERIAL_NUMBER,
SERVES_CUISINE,
SERVICE_TYPE,
SERVICE_URL,
SERVING_SIZE,
SIGNIFICANCE,
SIGNIFICANT_LINK,
SKILLS,
SKU,
SODIUM_CONTENT,
SOFTWARE_VERSION,
SPECIAL_COMMITMENTS,
STAGE_AS_NUMBER,
STATUS,
START_DATE,
START_TIME,
STEP,
STEP_VALUE,
STORAGE_REQUIREMENTS,
STREET_ADDRESS,
STRENGTH_UNIT,
STRENGTH_VALUE,
STRUCTURAL_CLASS,
SUB_STAGE_SUFFIX,
SUBTYPE,
SUGAR_CONTENT,
SUGGESTED_GENDER,
SUGGESTED_MAX_AGE,
SUGGESTED_MIN_AGE,
TARGET_DESCRIPTION,
TARGET_NAME,
TARGET_PLATFORM,
TARGET_POPULATION,
TARGET_URL,
TAX_ID,
TELEPHONE,
TEMPORAL,
TEXT,
THUMBNAIL_URL,
TICKER_SYMBOL,
TICKET_NUMBER,
TICKET_TOKEN,
TIME_REQUIRED,
TISSUE_SAMPLE,
TITLE,
TO_LOCATION,
TOTAL_PRICE,
TOTAL_TIME,
TRACKING_NUMBER,
TRACKING_URL,
TRAIN_NAME,
TRAIN_NUMBER,
TRANS_FAT_CONTENT,
TRANSCRIPT,
TRANSMISSION_METHOD,
TYPICAL_AGE_RANGE,
UNIT_CODE,
UNSATURATED_FAT_CONTENT,
UPLOAD_DATE,
UPVOTE_COUNT,
URL_TEMPLATE,
VALID_FOR,
VALID_FROM,
VALID_THROUGH,
VALID_UNTIL,
VALUE,
VALUE_ADDED_TAX_INCLUDED,
VALUE_MAX_LENGTH,
VALUE_MIN_LENGTH,
VALUE_NAME,
VALUE_PATTERN,
VALUE_REQUIRED,
VAT_ID,
VERSION,
VIDEO_FRAME_SIZE,
VIDEO_QUALITY,
VOLUME_NUMBER,
WARNING,
WEB_CHECKIN_TIME,
WORD_COUNT,
WORK_HOURS,
WORKLOAD,
WORST_RATING);
}
}
| apache/streampipes | streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SO.java |
213,042 | /*
fEMR - fast Electronic Medical Records
Copyright (C) 2014 Team fEMR
fEMR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fEMR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with fEMR. If not, see <http://www.gnu.org/licenses/>. If
you have any questions, contact <[email protected]>.
*/
package femr.common.models;
import java.util.Date;
public class PatientItem {
private int Id;
private String firstName;
private String lastName;
private String phoneNumber;
private String address;
private String city;
private String age;//this is a string representing an integer and "YO"(adult) or "MO"(infant)
private Integer yearsOld;//the age of the patient as an integer. 0 if the patient is less than a year old
private Integer monthsOld;
private Date birth;
private String friendlyDateOfBirth;
private String sex;
private Integer photoId;
private String pathToPhoto;
private int userId;
private Integer weeksPregnant;
private Integer heightFeet;
private Integer heightInches;
//added for femr-136 - dual unit display
private Integer heightFeetDual;
private Integer heightInchesDual;
private Float weight;
//added for femr-136 - dual unit display
private Float weightDual;
// Model in question to modify (thinking of adding my variables here)
private Integer smoker;
private Integer diabetic;
private Integer alcohol;
private Integer cholesterol;
private Integer hypertension;
public PatientItem(){
//default empty values
this.Id = 0;
this.pathToPhoto = "";
}
public int getId() {
return Id;
}
public void setId(int id) {
Id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPhoneNumber() { return phoneNumber; }
public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; }
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public Date getBirth() {
return birth;
}
public void setBirth(Date birth) {
this.birth = birth;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public Integer getPhotoId() {
return photoId;
}
public void setPhotoId(Integer photoId) {
this.photoId = photoId;
}
public String getPathToPhoto() {
return pathToPhoto;
}
public void setPathToPhoto(String pathToPhoto) {
this.pathToPhoto = pathToPhoto;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public Integer getWeeksPregnant() {
return weeksPregnant;
}
public void setWeeksPregnant(Integer weeksPregnant) {
this.weeksPregnant = weeksPregnant;
}
public Integer getHeightFeet() {
return heightFeet;
}
public void setHeightFeet(Integer heightFeet) {
this.heightFeet = heightFeet;
}
public Integer getHeightInches() {
return heightInches;
}
public void setHeightInches(Integer heightInches) {
this.heightInches = heightInches;
}
public Integer getHeightFeetDual() {
return heightFeetDual;
}
public void setHeightFeetDual(Integer heightFeetDual) {
this.heightFeetDual = heightFeetDual;
}
public Integer getHeightInchesDual() {
return heightInchesDual;
}
public void setHeightInchesDual(Integer heightInchesDual) {
this.heightInchesDual = heightInchesDual;
}
public Float getWeight() {
return weight;
}
public void setWeight(Float weight) {
this.weight = weight;
}
public Float getWeightDual() {
return weightDual;
}
public void setWeightDual(Float weightDual) {
this.weightDual = weightDual;
}
public String getFriendlyDateOfBirth() {
return friendlyDateOfBirth;
}
public void setFriendlyDateOfBirth(String friendlyDateOfBirth) {
this.friendlyDateOfBirth = friendlyDateOfBirth;
}
public Integer getYearsOld() {
return yearsOld;
}
public void setYearsOld(Integer yearsOld) {
this.yearsOld = yearsOld;
}
public Integer getMonthsOld() {
return monthsOld;
}
public void setMonthsOld(Integer monthsOld) {
this.monthsOld = monthsOld;
}
public Integer getSmoker() {return smoker;}
public void setSmoker(Integer smoker){this.smoker = smoker;}
public Integer getDiabetes() {return diabetic;}
public void setDiabetic(Integer diabetes){this.diabetic = diabetes;}
public Integer getAlcohol() {return alcohol;}
public void setAlcohol(Integer alcohol){this.alcohol = alcohol;}
public Integer getCholesterol() {return cholesterol;}
public void setCholesterol(Integer cholesterol){this.cholesterol = cholesterol;}
public Integer getHypertension() {return hypertension;}
public void setHypertension(Integer hypertension){this.hypertension = hypertension;}
}
| FEMR/femr | app/femr/common/models/PatientItem.java |
213,043 | /**
*
*/
package mmb.content.drugs;
import net.miginfocom.swing.MigLayout;
import static mmb.engine.settings.GlobalSettings.$res;
import javax.swing.JLabel;
import javax.swing.JList;
import mmb.content.drugs.AlcoholInfoGroup.AlcoholInfo;
import mmb.engine.item.ItemEntry;
import mmb.engine.recipe.CRConstants;
import mmb.engine.recipe.ItemStack;
import mmb.engine.recipe.RecipeView;
import mmb.engine.recipe.VectorUtils;
import mmb.menu.world.ItemStackCellRenderer;
/**
* Displays information about a single alcoholic beverage
* @author oskar
*/
public class AlcoholInfoView extends RecipeView<AlcoholInfo> {
private static final long serialVersionUID = -2864705123116802475L;
private JLabel lblIncoming;
private JLabel lblOutgoing;
private JLabel lblIn;
private JList<ItemStack> outList;
private JLabel lblMachine;
private JLabel lblIntoxication;
public static final String DOSE = " "+$res("alcodose")+" ";
/** Creates recipe view for alcoholic beverages */
public AlcoholInfoView() {
setLayout(new MigLayout("", "[grow][grow]", "[][][]"));
lblMachine = new JLabel(CRConstants.MACHINE);
add(lblMachine, "cell 0 0,growx");
lblIntoxication = new JLabel("New label");
add(lblIntoxication, "cell 1 0,alignx left");
lblIncoming = new JLabel(CRConstants.IN);
add(lblIncoming, "cell 0 1,growx");
lblOutgoing = new JLabel(CRConstants.OUT);
add(lblOutgoing, "cell 1 1,growx");
lblIn = new JLabel();
add(lblIn, "cell 0 2,grow");
outList = new JList<>();
outList.setCellRenderer(ItemStackCellRenderer.instance);
add(outList, "cell 1 2,growx,aligny center");
}
@Override public void set(AlcoholInfo recipe) {
lblMachine.setText(CRConstants.MACHINE+recipe.group().title());
ItemEntry item = recipe.input;
lblIntoxication.setText(DOSE+recipe.dose);
lblIn.setIcon(item.icon());
lblIn.setText(item.title());
outList.setListData(VectorUtils.list2arr(recipe.output));
}
static final ItemStackCellRenderer renderer = new ItemStackCellRenderer();
}
| MultiMachineBuilder/MultiMachineBuilder | src/mmb/content/drugs/AlcoholInfoView.java |
213,044 | package org.dataalgorithms.machinelearning.logistic.alcohol;
import org.apache.log4j.Logger;
//
import org.apache.commons.lang.StringUtils;
//
import scala.Tuple2;
//
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
//
import org.apache.spark.mllib.linalg.Vector;
import org.apache.spark.mllib.linalg.DenseVector;
import org.apache.spark.mllib.classification.LogisticRegressionModel;
/**
* Input format: feature columns: 1,2,3,4,5,7,8,9,12,14,17,18,19,23
*
* The goal is to use the built logistic regression model and
* to classify each query record into 5 categories.
*
* @author Mahmoud Parsian ([email protected])
*
*/
public final class StudentAlcoholDetection {
private static final Logger THE_LOGGER = Logger.getLogger(StudentAlcoholDetection.class);
/**
* Build a featurized Vector
*
* feature columns: 1,2,3,4,5,7,8,9,12,14,17,18,19,23
*
*/
static Vector buildVector(String record) {
//
String[] tokens = StringUtils.split(record, ",");
//
double[] features = new double[14];
//
features[0] = Double.parseDouble(tokens[0]);
features[1] = Double.parseDouble(tokens[1]);
features[2] = Double.parseDouble(tokens[2]);
features[3] = Double.parseDouble(tokens[3]);
features[4] = Double.parseDouble(tokens[4]);
features[5] = Double.parseDouble(tokens[6]);
features[6] = Double.parseDouble(tokens[7]);
features[7] = Double.parseDouble(tokens[8]);
features[8] = Double.parseDouble(tokens[11]);
features[9] = Double.parseDouble(tokens[13]);
features[10] = Double.parseDouble(tokens[16]);
features[11] = Double.parseDouble(tokens[17]);
features[12] = Double.parseDouble(tokens[18]);
features[13] = Double.parseDouble(tokens[22]);
//
return new DenseVector(features);
}
public static void main(String[] args) {
Util.debugArguments(args);
if (args.length != 2) {
throw new RuntimeException("usage: StudentAlcoholDetection <query-path> <saved-model-path>");
}
//
String queryInputPath = args[0];
String savedModelPath = args[1];
THE_LOGGER.info("queryInputPath=" + queryInputPath);
THE_LOGGER.info("savedModelPath=" + savedModelPath);
// create a Factory context object
JavaSparkContext context = Util.createJavaSparkContext("BreastCancerDetection");
// feature columns: 1,2,3,4,5,7,8,9,12,14,17,18,19,23
JavaRDD<String> query = context.textFile(queryInputPath);
// LOAD the MODEL from saved PATH:
//
// public static LogisticRegressionModel load(SparkContext sc, String path)
final LogisticRegressionModel model = LogisticRegressionModel.load(context.sc(), savedModelPath);
//
// classify:
//
// now that we have a logistic regression model, we can query
// the model to see how it responds.
//
// we create JavaPairRDD<String, Double> where ._1 is a input
// as a String and ._2 is classification we get from the logistic
// regression model
//
JavaPairRDD<String, Double> classifications = query.mapToPair((String record) -> {
// each record has the following features:
// feature columns: 1,2,3,4,5,7,8,9,12,14,17,18,19,23
Vector vector = buildVector(record);
double classification = model.predict(vector);
THE_LOGGER.info("classification="+classification);
//
return new Tuple2<String, Double>(record, classification);
});
//
// for debugging purposes: print the results
//
Iterable<Tuple2<String, Double>> predictions = classifications.collect();
for (Tuple2<String, Double> pair : predictions) {
THE_LOGGER.info("query: record="+pair._1);
THE_LOGGER.info("prediction="+pair._2);
}
// done
context.stop();
}
}
| mahmoudparsian/data-algorithms-book | src/main/java/org/dataalgorithms/machinelearning/logistic/alcohol/StudentAlcoholDetection.java |
213,046 | /*
fEMR - fast Electronic Medical Records
Copyright (C) 2014 Team fEMR
fEMR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fEMR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with fEMR. If not, see <http://www.gnu.org/licenses/>. If
you have any questions, contact <[email protected]>.
*/
package femr.common.models;
import java.util.Date;
public class PatientItem {
private int Id;
private String firstName;
private String lastName;
private String phoneNumber;
private String address;
private String city;
private String age;//this is a string representing an integer and "YO"(adult) or "MO"(infant)
private Integer yearsOld;//the age of the patient as an integer. 0 if the patient is less than a year old
private Integer monthsOld;
private Date birth;
private String friendlyDateOfBirth;
private String sex;
private Integer photoId;
private String pathToPhoto;
private int userId;
private Integer weeksPregnant;
private Integer heightFeet;
private Integer heightInches;
//added for femr-136 - dual unit display
private Integer heightFeetDual;
private Integer heightInchesDual;
private Float weight;
//added for femr-136 - dual unit display
private Float weightDual;
// Model in question to modify (thinking of adding my variables here)
private Integer smoker;
private Integer diabetic;
private Integer alcohol;
public PatientItem(){
//default empty values
this.Id = 0;
this.pathToPhoto = "";
}
public int getId() {
return Id;
}
public void setId(int id) {
Id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPhoneNumber() { return phoneNumber; }
public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; }
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public Date getBirth() {
return birth;
}
public void setBirth(Date birth) {
this.birth = birth;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public Integer getPhotoId() {
return photoId;
}
public void setPhotoId(Integer photoId) {
this.photoId = photoId;
}
public String getPathToPhoto() {
return pathToPhoto;
}
public void setPathToPhoto(String pathToPhoto) {
this.pathToPhoto = pathToPhoto;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public Integer getWeeksPregnant() {
return weeksPregnant;
}
public void setWeeksPregnant(Integer weeksPregnant) {
this.weeksPregnant = weeksPregnant;
}
public Integer getHeightFeet() {
return heightFeet;
}
public void setHeightFeet(Integer heightFeet) {
this.heightFeet = heightFeet;
}
public Integer getHeightInches() {
return heightInches;
}
public void setHeightInches(Integer heightInches) {
this.heightInches = heightInches;
}
public Integer getHeightFeetDual() {
return heightFeetDual;
}
public void setHeightFeetDual(Integer heightFeetDual) {
this.heightFeetDual = heightFeetDual;
}
public Integer getHeightInchesDual() {
return heightInchesDual;
}
public void setHeightInchesDual(Integer heightInchesDual) {
this.heightInchesDual = heightInchesDual;
}
public Float getWeight() {
return weight;
}
public void setWeight(Float weight) {
this.weight = weight;
}
public Float getWeightDual() {
return weightDual;
}
public void setWeightDual(Float weightDual) {
this.weightDual = weightDual;
}
public String getFriendlyDateOfBirth() {
return friendlyDateOfBirth;
}
public void setFriendlyDateOfBirth(String friendlyDateOfBirth) {
this.friendlyDateOfBirth = friendlyDateOfBirth;
}
public Integer getYearsOld() {
return yearsOld;
}
public void setYearsOld(Integer yearsOld) {
this.yearsOld = yearsOld;
}
public Integer getMonthsOld() {
return monthsOld;
}
public void setMonthsOld(Integer monthsOld) {
this.monthsOld = monthsOld;
}
public Integer getSmoker() {return smoker;}
public void setSmoker(Integer smoker){this.smoker = smoker;}
public Integer getDiabetes() {return diabetic;}
public void setDiabetic(Integer diabetes){this.diabetic = diabetes;}
public Integer getAlcohol() {return alcohol;}
public void setAlcohol(Integer alcohol){this.alcohol = alcohol;}
}
| kevinzurek/femr | app/femr/common/models/PatientItem.java |
213,047 | /**
* Copyright (C) 2007 Heart & Stroke Foundation
* This software is published under the GPL GNU General Public License.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This software was written for the
* Department of Family Medicine
* McMaster University
* Hamilton
* Ontario, Canada
*/
package org.oscarehr.common.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@Table(name="form_hsfo2_visit")
public class Hsfo2Visit extends AbstractModel<Integer> implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="ID")
private int id;
private int demographic_no;
private String provider_no;
private Date formCreated;
@Temporal(TemporalType.TIMESTAMP)
private Date formEdited;
private String Patient_Id;
private Date VisitDate_Id;
//VisitData registrationData;
private String Drugcoverage; // enum('yes', 'no');
private int SBP;
private int SBP_goal;
private int DBP;
private int DBP_goal;
private String Bptru_used; // enum('yes', 'no');
private double Height; // double(3, 1);
private String Height_unit; // enum('cm', 'inch');
private double Weight; // double(3, 1);
private String Weight_unit; // enum('kg', 'lb');
private double Waist; // double(3, 1);
private String Waist_unit; // enum('cm', 'inch');
private double TC_HDL; // double(2, 1);
private double LDL; // double(2, 1);
private double HDL; // double(1, 1);
private double Triglycerides;
private double A1C; // double(1, 2);,
private double FBS;
private String Nextvisit; // enum('Under1Mo', '1to2Mo', '3to6Mo', 'Over6Mo');
private int nextVisitInMonths;
private int nextVisitInWeeks;
private boolean Bpactionplan;
private boolean PressureOff;
private boolean PatientProvider;
private boolean ABPM;
private boolean Home;
private boolean CommunityRes;
private boolean ProRefer;
private String HtnDxType; // enum('PrimaryHtn', 'ElevatedBpReadings');
private boolean Dyslipid;
private boolean Diabetes;
private boolean KidneyDis;
private boolean Obesity;
private boolean CHD;
private boolean Stroke_TIA;
private boolean depression;
private Boolean Risk_weight;
private Boolean Risk_activity;
private Boolean Risk_diet;
private Boolean Risk_smoking;
private Boolean Risk_alcohol;
private Boolean Risk_stress;
private String PtView; // enum('Uninterested', 'Thinking', 'Deciding', 'TakingAction', 'Maintaining',
// 'Relapsing');
private int Change_importance;
private int Change_confidence;
private int exercise_minPerWk;
private int smoking_cigsPerDay;
private int alcohol_drinksPerWk;
private String sel_DashDiet; // enum('Always', 'Often', 'Sometimes', 'Never');
private String sel_HighSaltFood; // enum('Always', 'Often', 'Sometimes', 'Never');
private String sel_Stressed; // enum('Always', 'Often', 'Sometimes', 'Never');
private String LifeGoal;
private Integer assessActivity;
private Integer assessSmoking;
private Integer assessAlcohol;
private boolean FamHx_Htn; // enum('PrimaryHtn', 'ElevatedBpReadings');
private boolean FamHx_Dyslipid;
private boolean FamHx_Diabetes;
private boolean FamHx_KidneyDis;
private boolean FamHx_Obesity;
private boolean FamHx_CHD;
private boolean FamHx_Stroke_TIA;
private boolean FamHx_Depression;
private boolean Diuret_rx;
private boolean Diuret_SideEffects;
private String Diuret_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
private boolean Ace_rx;
private boolean Ace_SideEffects;
private String Ace_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
private boolean Arecept_rx;
private boolean Arecept_SideEffects;
private String Arecept_RxDecToday;
private boolean Beta_rx;
private boolean Beta_SideEffects;
private String Beta_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
private boolean Calc_rx;
private boolean Calc_SideEffects;
private String Calc_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
private boolean Anti_rx;
private boolean Anti_SideEffects;
private String Anti_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
private boolean Statin_rx;
private boolean Statin_SideEffects;
private String Statin_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
private boolean Lipid_rx;
private boolean Lipid_SideEffects;
private String Lipid_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
private boolean Hypo_rx;
private boolean Hypo_SideEffects;
private String Hypo_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
private boolean Insul_rx;
private boolean Insul_SideEffects;
private String Insul_RxDecToday; // enum('Same', 'Increase', 'Decrease', 'Stop', 'Start', 'InClassSwitch');
private boolean ASA_rx;
private boolean ASA_SideEffects;
private String ASA_RxDecToday;
private int Often_miss;
private String Herbal; // enum('yes', 'no');
private Date TC_HDL_LabresultsDate;
private Date LDL_LabresultsDate;
private Date HDL_LabresultsDate;
private Date A1C_LabresultsDate;
private boolean locked;
private Boolean monitor;
private Date egfrDate;
private int egfr;
private double acr;
//is this record the last base line record, the base line record can save multiple times
private boolean lastBaseLineRecord;
public Hsfo2Visit() {
}
public void setVisitData( String Patient_Id, Date VisitDate_Id, Date FormCreated, Date FormEdited,
String Drugcoverage, int SBP, int SBP_goal, int DBP, int DBP_goal, String Bptru_used,
double Height, String Height_unit, double Weight, String Weight_unit, double Waist, String Waist_unit, double TC_HDL,
double LDL, double HDL, double A1C, String Nextvisit, boolean Bpactionplan,
boolean PressureOff, boolean PatientProvider, boolean ABPM, boolean Home,
boolean CommunityRes, boolean ProRefer, String HtnDxType, boolean Dyslipid,
boolean Diabetes, boolean KidneyDis, boolean Obesity, boolean CHD, boolean Stroke_TIA,
Boolean Risk_weight, Boolean Risk_activity, Boolean Risk_diet, Boolean Risk_smoking,
Boolean Risk_alcohol, Boolean Risk_stress, String PtView, int Change_importance,
int Change_confidence, int exercise_minPerWk, int smoking_cigsPerDay,
int alcohol_drinksPerWk, String sel_DashDiet, String sel_HighSaltFood, String sel_Stressed,
String LifeGoal, boolean FamHx_Htn, boolean FamHx_Dyslipid, boolean FamHx_Diabetes,
boolean FamHx_KidneyDis, boolean FamHx_Obesity, boolean FamHx_CHD,
boolean FamHx_Stroke_TIA, boolean Diuret_rx, boolean Diuret_SideEffects,
String Diuret_RxDecToday, boolean Ace_rx, boolean Ace_SideEffects, String Ace_RxDecToday,
boolean Arecept_rx, boolean Arecept_SideEffects, String Arecept_RxDecToday,
boolean Beta_rx, boolean Beta_SideEffects, String Beta_RxDecToday, boolean Calc_rx,
boolean Calc_SideEffects, String Calc_RxDecToday, boolean Anti_rx,
boolean Anti_SideEffects, String Anti_RxDecToday, boolean Statin_rx,
boolean Statin_SideEffects, String Statin_RxDecToday, boolean Lipid_rx,
boolean Lipid_SideEffects, String Lipid_RxDecToday, boolean Hypo_rx,
boolean Hypo_SideEffects, String Hypo_RxDecToday, boolean Insul_rx,
boolean Insul_SideEffects, String Insul_RxDecToday, boolean ASA_rx,
boolean ASA_SideEffects, int Often_miss, String Herbal,
Date TC_HDL_LabresultsDate, Date LDL_LabresultsDate, Date HDL_LabresultsDate,
Date A1C_LabresultsDate, boolean locked, double Triglycerides, Boolean monitor )
{
this.Patient_Id = Patient_Id;
this.VisitDate_Id = VisitDate_Id;
if(FormCreated == null)
this.formCreated = new Date();
else
this.formCreated = FormCreated;
if(FormEdited == null)
this.formEdited = new Date();
else
this.formEdited = FormEdited;
this.Drugcoverage = Drugcoverage;
this.SBP = SBP;
this.SBP_goal = SBP_goal;
this.DBP = DBP;
this.DBP_goal = DBP_goal;
this.Bptru_used = Bptru_used;
this.Height = Height;
this.Height_unit = Height_unit;
this.Weight = Weight;
this.Weight_unit = Weight_unit;
this.Waist = Waist;
this.Waist_unit = Waist_unit;
this.TC_HDL = TC_HDL;
this.LDL = LDL;
this.HDL = HDL;
this.Triglycerides = Triglycerides;
this.A1C = A1C;
this.Nextvisit = Nextvisit;
this.Bpactionplan = Bpactionplan;
this.PressureOff = PressureOff;
this.PatientProvider = PatientProvider;
this.ABPM = ABPM;
this.Home = Home;
this.CommunityRes = CommunityRes;
this.ProRefer = ProRefer;
this.HtnDxType = HtnDxType;
this.Dyslipid = Dyslipid;
this.Diabetes = Diabetes;
this.KidneyDis = KidneyDis;
this.Obesity = Obesity;
this.CHD = CHD;
this.Stroke_TIA = Stroke_TIA;
this.Risk_weight = Risk_weight;
this.Risk_activity = Risk_activity;
this.Risk_diet = Risk_diet;
// this.Risk_dietSalt = Risk_dietSalt;
this.Risk_smoking = Risk_smoking;
this.Risk_alcohol = Risk_alcohol;
this.Risk_stress = Risk_stress;
this.PtView = PtView;
this.Change_importance = Change_importance;
this.Change_confidence = Change_confidence;
this.exercise_minPerWk = exercise_minPerWk;
this.smoking_cigsPerDay = smoking_cigsPerDay;
this.alcohol_drinksPerWk = alcohol_drinksPerWk;
this.sel_DashDiet = sel_DashDiet;
this.sel_HighSaltFood = sel_HighSaltFood;
this.sel_Stressed = sel_Stressed;
this.LifeGoal = LifeGoal;
this.FamHx_Htn = FamHx_Htn;
this.FamHx_Dyslipid = FamHx_Dyslipid;
this.FamHx_Diabetes = FamHx_Diabetes;
this.FamHx_KidneyDis = FamHx_KidneyDis;
this.FamHx_Obesity = FamHx_Obesity;
this.FamHx_CHD = FamHx_CHD;
this.FamHx_Stroke_TIA = FamHx_Stroke_TIA;
this.Diuret_rx = Diuret_rx;
this.Diuret_SideEffects = Diuret_SideEffects;
this.Diuret_RxDecToday = Diuret_RxDecToday;
this.Ace_rx = Ace_rx;
this.Ace_SideEffects = Ace_SideEffects;
this.Ace_RxDecToday = Ace_RxDecToday;
this.Arecept_rx = Arecept_rx;
this.Arecept_SideEffects = Arecept_SideEffects;
this.Arecept_RxDecToday = Arecept_RxDecToday;
this.Beta_rx = Beta_rx;
this.Beta_SideEffects = Beta_SideEffects;
this.Beta_RxDecToday = Beta_RxDecToday;
this.Calc_rx = Calc_rx;
this.Calc_SideEffects = Calc_SideEffects;
this.Calc_RxDecToday = Calc_RxDecToday;
this.Anti_rx = Anti_rx;
this.Anti_SideEffects = Anti_SideEffects;
this.Anti_RxDecToday = Anti_RxDecToday;
this.Statin_rx = Statin_rx;
this.Statin_SideEffects = Statin_SideEffects;
this.Statin_RxDecToday = Statin_RxDecToday;
this.Lipid_rx = Lipid_rx;
this.Lipid_SideEffects = Lipid_SideEffects;
this.Lipid_RxDecToday = Lipid_RxDecToday;
this.Hypo_rx = Hypo_rx;
this.Hypo_SideEffects = Hypo_SideEffects;
this.Hypo_RxDecToday = Hypo_RxDecToday;
this.Insul_rx = Insul_rx;
this.Insul_SideEffects = Insul_SideEffects;
this.Insul_RxDecToday = Insul_RxDecToday;
this.ASA_rx = ASA_rx;
this.ASA_SideEffects = ASA_SideEffects;
this.Often_miss = Often_miss;
this.Herbal = Herbal;
this.TC_HDL_LabresultsDate = TC_HDL_LabresultsDate;
this.LDL_LabresultsDate = LDL_LabresultsDate;
this.HDL_LabresultsDate = HDL_LabresultsDate;
this.A1C_LabresultsDate = A1C_LabresultsDate;
this.locked = locked;
this.monitor = monitor;
}
public double getA1C()
{
return A1C;
}
/**
* the A1C in this class in percentage
* @param a1c when display in the UI, the value should multiple 100 as it is percentage; when save to database, use the normal value;
*
*/
public void setA1C( double a1c )
{
A1C = a1c;
}
public int getA1CP1()
{
return (int) A1C;
}
public void setA1CP1( int a1cP1 )
{
A1C = a1cP1 + ( (double) getA1CP2() ) / 10;
}
// return 1 instead of 0.1 if A1C is 2.1
public int getA1CP2()
{
return (int)(A1C*10) - getA1CP1()*10;
}
public void setA1CP2( int a1cP2 )
{
A1C = getA1CP1() + ( (double) a1cP2 ) / 10;
}
public double getFBS()
{
return FBS;
}
public void setFBS( double fbs )
{
FBS = fbs;
}
public int getFBSP1()
{
return (int) FBS;
}
public void setFBSP1( int fbsP1 )
{
FBS = fbsP1 + ( (double) getFBSP2() ) / 10;
}
// return 1 instead of 0.1 if FBS is 2.1
public int getFBSP2()
{
return (int)(FBS*10) - getFBSP1()*10;
}
public void setFBSP2( int fbsP2 )
{
FBS = getFBSP1() + ( (double) fbsP2 ) / 10;
}
public boolean isABPM()
{
return ABPM;
}
public void setABPM( boolean abpm )
{
ABPM = abpm;
}
public boolean isAce_rx()
{
return Ace_rx;
}
public void setAce_rx( boolean ace_rx )
{
Ace_rx = ace_rx;
}
public String getAce_RxDecToday()
{
return Ace_RxDecToday;
}
public void setAce_RxDecToday( String ace_RxDecToday )
{
Ace_RxDecToday = ace_RxDecToday;
}
public boolean isAce_SideEffects()
{
return Ace_SideEffects;
}
public void setAce_SideEffects( boolean ace_SideEffects )
{
Ace_SideEffects = ace_SideEffects;
}
public int getAlcohol_drinksPerWk()
{
return alcohol_drinksPerWk;
}
public void setAlcohol_drinksPerWk( int alcohol_drinksPerWk )
{
this.alcohol_drinksPerWk = alcohol_drinksPerWk;
}
public boolean isAnti_rx()
{
return Anti_rx;
}
public void setAnti_rx( boolean anti_rx )
{
Anti_rx = anti_rx;
}
public String getAnti_RxDecToday()
{
return Anti_RxDecToday;
}
public void setAnti_RxDecToday( String anti_RxDecToday )
{
Anti_RxDecToday = anti_RxDecToday;
}
public boolean isAnti_SideEffects()
{
return Anti_SideEffects;
}
public void setAnti_SideEffects( boolean anti_SideEffects )
{
Anti_SideEffects = anti_SideEffects;
}
public boolean isBeta_rx()
{
return Beta_rx;
}
public void setBeta_rx( boolean beta_rx )
{
Beta_rx = beta_rx;
}
public String getBeta_RxDecToday()
{
return Beta_RxDecToday;
}
public void setBeta_RxDecToday( String beta_RxDecToday )
{
Beta_RxDecToday = beta_RxDecToday;
}
public boolean isBeta_SideEffects()
{
return Beta_SideEffects;
}
public void setBeta_SideEffects( boolean beta_SideEffects )
{
Beta_SideEffects = beta_SideEffects;
}
public boolean isBpactionplan()
{
return Bpactionplan;
}
public void setBpactionplan( boolean bpactionplan )
{
Bpactionplan = bpactionplan;
}
public String getBptru_used()
{
return Bptru_used;
}
public void setBptru_used( String bptru_used )
{
Bptru_used = bptru_used;
}
public boolean isCalc_rx()
{
return Calc_rx;
}
public void setCalc_rx( boolean calc_rx )
{
Calc_rx = calc_rx;
}
public String getCalc_RxDecToday()
{
return Calc_RxDecToday;
}
public void setCalc_RxDecToday( String calc_RxDecToday )
{
Calc_RxDecToday = calc_RxDecToday;
}
public boolean isCalc_SideEffects()
{
return Calc_SideEffects;
}
public void setCalc_SideEffects( boolean calc_SideEffects )
{
Calc_SideEffects = calc_SideEffects;
}
public int getChange_confidence()
{
return Change_confidence;
}
public void setChange_confidence( int change_confidence )
{
Change_confidence = change_confidence;
}
public int getChange_importance()
{
return Change_importance;
}
public void setChange_importance( int change_importance )
{
Change_importance = change_importance;
}
public boolean isCHD()
{
return CHD;
}
public void setCHD( boolean chd )
{
CHD = chd;
}
public boolean isCommunityRes()
{
return CommunityRes;
}
public void setCommunityRes( boolean communityRes )
{
CommunityRes = communityRes;
}
public int getDBP()
{
return DBP;
}
public void setDBP( int dbp )
{
DBP = dbp;
}
public int getDBP_goal()
{
return DBP_goal;
}
public void setDBP_goal( int dbp_goal )
{
DBP_goal = dbp_goal;
}
public boolean isDiabetes()
{
return Diabetes;
}
public void setDiabetes( boolean diabetes )
{
Diabetes = diabetes;
}
public boolean isDiuret_rx()
{
return Diuret_rx;
}
public void setDiuret_rx( boolean diuret_rx )
{
Diuret_rx = diuret_rx;
}
public String getDiuret_RxDecToday()
{
return Diuret_RxDecToday;
}
public void setDiuret_RxDecToday( String diuret_RxDecToday )
{
Diuret_RxDecToday = diuret_RxDecToday;
}
public boolean isDiuret_SideEffects()
{
return Diuret_SideEffects;
}
public void setDiuret_SideEffects( boolean diuret_SideEffects )
{
Diuret_SideEffects = diuret_SideEffects;
}
public String getDrugcoverage()
{
return Drugcoverage;
}
public void setDrugcoverage( String drugcoverage )
{
Drugcoverage = drugcoverage;
}
public boolean isDyslipid()
{
return Dyslipid;
}
public void setDyslipid( boolean dyslipid )
{
Dyslipid = dyslipid;
}
public int getExercise_minPerWk()
{
return exercise_minPerWk;
}
public void setExercise_minPerWk( int exercise_minPerWk )
{
this.exercise_minPerWk = exercise_minPerWk;
}
public boolean isFamHx_CHD()
{
return FamHx_CHD;
}
public void setFamHx_CHD( boolean famHx_CHD )
{
FamHx_CHD = famHx_CHD;
}
public boolean isFamHx_Diabetes()
{
return FamHx_Diabetes;
}
public void setFamHx_Diabetes( boolean famHx_Diabetes )
{
FamHx_Diabetes = famHx_Diabetes;
}
public boolean isFamHx_Dyslipid()
{
return FamHx_Dyslipid;
}
public void setFamHx_Dyslipid( boolean famHx_Dyslipid )
{
FamHx_Dyslipid = famHx_Dyslipid;
}
public boolean isFamHx_Htn()
{
return FamHx_Htn;
}
public void setFamHx_Htn( boolean famHx_Htn )
{
FamHx_Htn = famHx_Htn;
}
public boolean isFamHx_KidneyDis()
{
return FamHx_KidneyDis;
}
public void setFamHx_KidneyDis( boolean famHx_KidneyDis )
{
FamHx_KidneyDis = famHx_KidneyDis;
}
public boolean isFamHx_Obesity()
{
return FamHx_Obesity;
}
public void setFamHx_Obesity( boolean famHx_Obesity )
{
FamHx_Obesity = famHx_Obesity;
}
public boolean isFamHx_Stroke_TIA()
{
return FamHx_Stroke_TIA;
}
public void setFamHx_Stroke_TIA( boolean famHx_Stroke_TIA )
{
FamHx_Stroke_TIA = famHx_Stroke_TIA;
}
public boolean isFamHx_Depression()
{
return FamHx_Depression;
}
public void setFamHx_Depression( boolean famHx_Depression )
{
this.FamHx_Depression = famHx_Depression;
}
public double getHDL()
{
return HDL;
}
public void setHDL( double hdl )
{
HDL = hdl;
}
public int getHDLP1()
{
return (int) HDL;
}
public void setHDLP1( int hdlP1 )
{
HDL = hdlP1 + ( (double) getHDLP2() ) / 10;
}
// return 1 instead of 0.1 if HDL is 2.1
public int getHDLP2()
{
return (int)(HDL*10) - getHDLP1()*10;
}
public void setHDLP2( int hdlP2 )
{
HDL = getHDLP1() + ( (double) hdlP2 ) / 10;
}
public double getTriglycerides()
{
return Triglycerides;
}
public void setTriglycerides( double triglycerides )
{
Triglycerides = triglycerides;
}
public int getTriglyceridesP1()
{
return (int) Triglycerides;
}
public void setTriglyceridesP1( int triglyceridesP1 )
{
Triglycerides = triglyceridesP1 + ( (double) getTriglyceridesP2() ) / 10;
}
// return 1 instead of 0.1 if Triglycerides is 2.1
public int getTriglyceridesP2()
{
return (int)( Triglycerides*10 ) - getTriglyceridesP1()* 10;
}
public void setTriglyceridesP2( int triglyceridesP2 )
{
Triglycerides = getTriglyceridesP1() + ( (double) triglyceridesP2 ) / 10;
}
public String getHerbal()
{
return Herbal;
}
public void setHerbal( String herbal )
{
Herbal = herbal;
}
public boolean isHome()
{
return Home;
}
public void setHome( boolean home )
{
Home = home;
}
public String getHtnDxType()
{
return HtnDxType;
}
public void setHtnDxType( String htnDxType )
{
HtnDxType = htnDxType;
}
public boolean isHypo_rx()
{
return Hypo_rx;
}
public void setHypo_rx( boolean hypo_rx )
{
Hypo_rx = hypo_rx;
}
public String getHypo_RxDecToday()
{
return Hypo_RxDecToday;
}
public void setHypo_RxDecToday( String hypo_RxDecToday )
{
Hypo_RxDecToday = hypo_RxDecToday;
}
public boolean isHypo_SideEffects()
{
return Hypo_SideEffects;
}
public void setHypo_SideEffects( boolean hypo_SideEffects )
{
Hypo_SideEffects = hypo_SideEffects;
}
public boolean isInsul_rx()
{
return Insul_rx;
}
public void setInsul_rx( boolean insul_rx )
{
Insul_rx = insul_rx;
}
public boolean isASA_rx()
{
return ASA_rx;
}
public void setASA_rx( boolean asa_rx )
{
this.ASA_rx = asa_rx;
}
public String getInsul_RxDecToday()
{
return Insul_RxDecToday;
}
public void setInsul_RxDecToday( String insul_RxDecToday )
{
Insul_RxDecToday = insul_RxDecToday;
}
public String getASA_RxDecToday()
{
return ASA_RxDecToday;
}
public void setASA_RxDecToday( String asa_RxDecToday )
{
ASA_RxDecToday = asa_RxDecToday;
}
public boolean isInsul_SideEffects()
{
return Insul_SideEffects;
}
public void setInsul_SideEffects( boolean insul_SideEffects )
{
Insul_SideEffects = insul_SideEffects;
}
public boolean isASA_SideEffects()
{
return ASA_SideEffects;
}
public void setASA_SideEffects( boolean asa_SideEffects )
{
ASA_SideEffects = asa_SideEffects;
}
public boolean isKidneyDis()
{
return KidneyDis;
}
public void setKidneyDis( boolean kidneyDis )
{
KidneyDis = kidneyDis;
}
public double getLDL()
{
return LDL;
}
public void setLDL( double ldl )
{
LDL = ldl;
}
public int getLDLP1()
{
return (int) LDL;
}
public void setLDLP1( int ldlP1 )
{
LDL = ldlP1 + ( (double) getLDLP2() ) / 10;
}
// return 1 instead of 0.1 if LDL is 2.1
public int getLDLP2()
{
return (int)( LDL*10 ) - getLDLP1()* 10;
}
public void setLDLP2( int ldlP2 )
{
LDL = getLDLP1() + ( (double) ldlP2 ) / 10;
}
public boolean isLipid_rx()
{
return Lipid_rx;
}
public void setLipid_rx( boolean lipid_rx )
{
Lipid_rx = lipid_rx;
}
public String getLipid_RxDecToday()
{
return Lipid_RxDecToday;
}
public void setLipid_RxDecToday( String lipid_RxDecToday )
{
Lipid_RxDecToday = lipid_RxDecToday;
}
public boolean isLipid_SideEffects()
{
return Lipid_SideEffects;
}
public void setLipid_SideEffects( boolean lipid_SideEffects )
{
Lipid_SideEffects = lipid_SideEffects;
}
public String getNextvisit()
{
return Nextvisit;
}
public void setNextvisit( String nextvisit )
{
Nextvisit = nextvisit;
}
public boolean isObesity()
{
return Obesity;
}
public void setObesity( boolean obesity )
{
Obesity = obesity;
}
public int getOften_miss()
{
return Often_miss;
}
public void setOften_miss( int often_miss )
{
Often_miss = often_miss;
}
public String getPatient_Id()
{
return Patient_Id;
}
public void setPatient_Id( String patient_Id )
{
Patient_Id = patient_Id;
}
public boolean isPatientProvider()
{
return PatientProvider;
}
public void setPatientProvider( boolean patientProvider )
{
PatientProvider = patientProvider;
}
public boolean isPressureOff()
{
return PressureOff;
}
public void setPressureOff( boolean pressureOff )
{
PressureOff = pressureOff;
}
public boolean isProRefer()
{
return ProRefer;
}
public void setProRefer( boolean proRefer )
{
ProRefer = proRefer;
}
public String getPtView()
{
return PtView;
}
public void setPtView( String ptView )
{
PtView = ptView;
}
public Boolean isRisk_activity()
{
return Risk_activity;
}
public void setRisk_activity( Boolean risk_activity )
{
Risk_activity = risk_activity;
}
public Boolean isRisk_alcohol()
{
return Risk_alcohol;
}
public void setRisk_alcohol( Boolean risk_alcohol )
{
Risk_alcohol = risk_alcohol;
}
public Boolean isRisk_diet()
{
return Risk_diet;
}
public void setRisk_diet( Boolean risk_diet )
{
Risk_diet = risk_diet;
}
public Boolean isRisk_smoking()
{
return Risk_smoking;
}
public void setRisk_smoking( Boolean risk_smoking )
{
Risk_smoking = risk_smoking;
}
public Boolean isRisk_stress()
{
return Risk_stress;
}
public void setRisk_stress( Boolean risk_stress )
{
Risk_stress = risk_stress;
}
public Boolean isRisk_weight()
{
return Risk_weight;
}
public void setRisk_weight( Boolean risk_weight )
{
Risk_weight = risk_weight;
}
public int getSBP()
{
return SBP;
}
public void setSBP( int sbp )
{
SBP = sbp;
}
public int getSBP_goal()
{
return SBP_goal;
}
public void setSBP_goal( int sbp_goal )
{
SBP_goal = sbp_goal;
}
public String getSel_DashDiet()
{
return sel_DashDiet;
}
public void setSel_DashDiet( String sel_DashDiet )
{
this.sel_DashDiet = sel_DashDiet;
}
public String getSel_HighSaltFood()
{
return sel_HighSaltFood;
}
public void setSel_HighSaltFood( String sel_HighSaltFood )
{
this.sel_HighSaltFood = sel_HighSaltFood;
}
public String getSel_Stressed()
{
return sel_Stressed;
}
public void setSel_Stressed( String sel_Stressed )
{
this.sel_Stressed = sel_Stressed;
}
public int getSmoking_cigsPerDay()
{
return smoking_cigsPerDay;
}
public void setSmoking_cigsPerDay( int smoking_cigsPerDay )
{
this.smoking_cigsPerDay = smoking_cigsPerDay;
}
public boolean isStatin_rx()
{
return Statin_rx;
}
public void setStatin_rx( boolean statin_rx )
{
Statin_rx = statin_rx;
}
public String getStatin_RxDecToday()
{
return Statin_RxDecToday;
}
public void setStatin_RxDecToday( String statin_RxDecToday )
{
Statin_RxDecToday = statin_RxDecToday;
}
public boolean isStatin_SideEffects()
{
return Statin_SideEffects;
}
public void setStatin_SideEffects( boolean statin_SideEffects )
{
Statin_SideEffects = statin_SideEffects;
}
public boolean isStroke_TIA()
{
return Stroke_TIA;
}
public void setStroke_TIA( boolean stroke_TIA )
{
Stroke_TIA = stroke_TIA;
}
public boolean isDepression()
{
return depression;
}
public void setDepression( boolean depression )
{
this.depression = depression;
}
public double getTC_HDL()
{
return TC_HDL;
}
public void setTC_HDL( double tc_hdl )
{
TC_HDL = tc_hdl;
}
public int getTC_HDLP1()
{
return (int) TC_HDL;
}
public void setTC_HDLP1( int tcHdlP1 )
{
TC_HDL = tcHdlP1 + ( (double) getTC_HDLP2() ) / 10;
}
// return 1 instead of 0.1 if TC_HDL is 2.1
public int getTC_HDLP2()
{
return (int)(TC_HDL*10) - getTC_HDLP1()*10;
}
public void setTC_HDLP2( int tcHdlP2 )
{
TC_HDL = getTC_HDLP1() + ( (double) tcHdlP2 ) / 10;
}
public Date getVisitDate_Id()
{
return VisitDate_Id;
}
public void setVisitDateIdToday()
{
VisitDate_Id = new Date();
}
public void setVisitDate_Id( Date visitDate_Id )
{
VisitDate_Id = visitDate_Id;
}
public double getHeight()
{
return Height;
}
public void setHeight( double height )
{
Height = height;
}
public int getHeightP1()
{
return (int) Height;
}
public void setHeightP1( int heightP1 )
{
Height = heightP1 + ( (double) getHeightP2() ) / 10;
}
// return 1 instead of 0.1 if Height is 2.1
public int getHeightP2()
{
return (int) ( Height*10 - getHeightP1()*10 );
}
public void setHeightP2( int heightP2 )
{
Height = getHeightP1() + ( (double) heightP2 ) / 10;
}
public String getHeight_unit()
{
return Height_unit;
}
public void setHeight_unit( String height_unit )
{
Height_unit = height_unit;
}
public double getWaist()
{
return Waist;
}
public void setWaist( double waist )
{
Waist = waist;
}
public int getWaistP1()
{
return (int) Waist;
}
public void setWaistP1( int waistP1 )
{
Waist = waistP1 + ( (double) getWaistP2() ) / 10;
}
// return 1 instead of 0.1 if Waist is 2.1
public int getWaistP2()
{
return (int)(Waist*10) - getWaistP1()*10;
}
public void setWaistP2( int waistP2 )
{
Waist = getWaistP1() + ( (double) waistP2 ) / 10;
}
public String getWaist_unit()
{
return Waist_unit;
}
public void setWaist_unit( String waist_unit )
{
Waist_unit = waist_unit;
}
public double getWeight()
{
return Weight;
}
public void setWeight( double weight )
{
Weight = weight;
}
public int getWeightP1()
{
return (int) Weight;
}
public void setWeightP1( int weightP1 )
{
Weight = weightP1 + ( (double) getWeightP2() ) / 10;
}
// return 1 instead of 0.1 if Weight is 2.1
public int getWeightP2()
{
return (int)( Weight*10 ) - getWeightP1()*10;
}
public void setWeightP2( int weightP2 )
{
Weight = getWeightP1() + ( (double) weightP2 ) / 10;
}
public String getWeight_unit()
{
return Weight_unit;
}
public void setWeight_unit( String weight_unit )
{
Weight_unit = weight_unit;
}
/*
public void setRegistrationData( VisitData registrationData )
{
this.registrationData = registrationData;
}
*/
public String getLifeGoal()
{
return LifeGoal;
}
public void setLifeGoal( String lifeGoal )
{
LifeGoal = lifeGoal;
}
public Integer getAssessActivity()
{
return assessActivity;
}
public void setAssessActivity( Integer assessActivity )
{
this.assessActivity = assessActivity;
}
public Integer getAssessSmoking()
{
return assessSmoking;
}
public void setAssessSmoking( Integer assessSmoking )
{
this.assessSmoking = assessSmoking;
}
public Integer getAssessAlcohol()
{
return assessAlcohol;
}
public void setAssessAlcohol( Integer assessAlcohol )
{
this.assessAlcohol = assessAlcohol;
}
public boolean isArecept_rx()
{
return Arecept_rx;
}
public void setArecept_rx( boolean arecept_rx )
{
Arecept_rx = arecept_rx;
}
public String getArecept_RxDecToday()
{
return Arecept_RxDecToday;
}
public void setArecept_RxDecToday( String arecept_RxDecToday )
{
Arecept_RxDecToday = arecept_RxDecToday;
}
public boolean isArecept_SideEffects()
{
return Arecept_SideEffects;
}
public void setArecept_SideEffects( boolean arecept_SideEffects )
{
Arecept_SideEffects = arecept_SideEffects;
}
public Date getA1C_LabresultsDate()
{
return A1C_LabresultsDate;
}
public void setA1C_LabresultsDate( Date labresultsDate )
{
A1C_LabresultsDate = labresultsDate;
}
public Date getHDL_LabresultsDate()
{
return HDL_LabresultsDate;
}
public void setHDL_LabresultsDate( Date labresultsDate )
{
HDL_LabresultsDate = labresultsDate;
}
public Date getLDL_LabresultsDate()
{
return LDL_LabresultsDate;
}
public void setLDL_LabresultsDate( Date labresultsDate )
{
LDL_LabresultsDate = labresultsDate;
}
public Date getTC_HDL_LabresultsDate()
{
return TC_HDL_LabresultsDate;
}
public void setTC_HDL_LabresultsDate( Date labresultsDate )
{
TC_HDL_LabresultsDate = labresultsDate;
}
public boolean isLocked()
{
return locked;
}
public void setLocked( boolean locked )
{
this.locked = locked;
}
public Integer getId()
{
return id;
}
public void setId( Integer id )
{
this.id = id;
}
public int getDemographic_no() {
return demographic_no;
}
public void setDemographic_no(int demographic_no) {
this.demographic_no = demographic_no;
}
public String getProvider_no()
{
return provider_no;
}
public void setProvider_no( String Provider_no )
{
this.provider_no = Provider_no;
}
public Date getFormCreated()
{
return formCreated;
}
public void setFormCreated( Date FormCreated )
{
this.formCreated = FormCreated;
}
public Date getFormEdited()
{
return formEdited;
}
public void setFormEdited( Date formEdited )
{
this.formEdited = formEdited;
}
public int getNextVisitInMonths()
{
return nextVisitInMonths;
}
public void setNextVisitInMonths( int nextVisitInMonths )
{
this.nextVisitInMonths = nextVisitInMonths;
}
public int getNextVisitInWeeks()
{
return nextVisitInWeeks;
}
public void setNextVisitInWeeks( int nextVisitInWeeks )
{
this.nextVisitInWeeks = nextVisitInWeeks;
}
public Boolean isMonitor()
{
return monitor;
}
public void setMonitor( Boolean monitor )
{
this.monitor = monitor;
}
public Date getEgfrDate()
{
return egfrDate;
}
public void setEgfrDate( Date egfrDate )
{
this.egfrDate = egfrDate;
}
public Date getAcrDate()
{
//it is same as egfrDate
return getEgfrDate();
}
public int getEgfr()
{
return egfr;
}
public void setEgfr( int egfr )
{
this.egfr = egfr;
}
public double getAcr()
{
return acr;
}
public void setAcr( double acr )
{
this.acr = acr;
}
public int getAcrP1()
{
return (int) acr;
}
public void setAcrP1( int acrP1 )
{
acr = acrP1 + ( (double) getAcrP2() ) / 10;
}
// return 1 instead of 0.1 if ACR is 2.1
public int getAcrP2()
{
return (int)( acr*10 ) - getAcrP1()*10;
}
public void setAcrP2( int acrP2 )
{
acr = getAcrP1() + ( (double) acrP2 ) / 10;
}
public boolean isLastBaseLineRecord()
{
return lastBaseLineRecord;
}
public void setLastBaseLineRecord( boolean lastBaseLineRecord )
{
this.lastBaseLineRecord = lastBaseLineRecord;
}
}
| junoemr/junoemr | src/main/java/org/oscarehr/common/model/Hsfo2Visit.java |
213,049 | /*
fEMR - fast Electronic Medical Records
Copyright (C) 2014 Team fEMR
fEMR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fEMR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with fEMR. If not, see <http://www.gnu.org/licenses/>. If
you have any questions, contact <[email protected]>.
*/
package femr.ui.models.triage;
import java.util.Date;
public class IndexViewModelPost {
//begin patient
private String firstName;
private String lastName;
private String phoneNumber;
private String address;
private String city;
private Date age;
private String ageClassification;
private String sex;
public Boolean deletePhoto; //flag to determine if user would like to delete image file
//begin vitals
private Integer bloodPressureSystolic;
private Integer bloodPressureDiastolic;
private Integer heartRate;
private Float temperature;
private Integer respiratoryRate;
private Float oxygenSaturation;
private Integer heightFeet;
private Integer heightInches;
private Float weight;
private Integer glucose;
//begin encounter
private String chiefComplaint;
private Integer weeksPregnant;
//Osman
private Integer smoker;
private Integer diabetic;
private Integer alcohol;
private Integer cholesterol;
private Integer hypertension;
//multiple chief complaints if they exist
private String chiefComplaintsJSON;
//indicates if the "yes" button was clicked for the diabetes screening prompt
private String isDiabetesScreenPerformed;
private String patientPhotoCropped;
public String getPatientPhotoCropped() {
return patientPhotoCropped;
}
public void setPatientPhotoCropped(String patientPhotoCropped) {
this.patientPhotoCropped = patientPhotoCropped;
}
public Boolean getDeletePhoto() {
return deletePhoto;
}
//begin general info
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public Date getAge() {
return age;
}
public void setAge(Date age) {
this.age = age;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
//begin vitals
public Integer getBloodPressureSystolic() {
return bloodPressureSystolic;
}
public void setBloodPressureSystolic(Integer bloodPressureSystolic) {
this.bloodPressureSystolic = bloodPressureSystolic;
}
public Integer getBloodPressureDiastolic() {
return bloodPressureDiastolic;
}
public void setBloodPressureDiastolic(Integer bloodPressureDiastolic) {
this.bloodPressureDiastolic = bloodPressureDiastolic;
}
public Integer getHeartRate() {
return heartRate;
}
public void setHeartRate(Integer heartRate) {
this.heartRate = heartRate;
}
public Float getTemperature() {
return temperature;
}
public void setTemperature(Float temperature) {
this.temperature = temperature;
}
public Integer getHeightFeet() {
return heightFeet;
}
public void setHeightFeet(Integer heightFeet) {
this.heightFeet = heightFeet;
}
public Integer getHeightInches() {
return heightInches;
}
public void setHeightInches(Integer heightInches) {
this.heightInches = heightInches;
}
public Float getWeight() {
return weight;
}
public void setWeight(Float weight) {
this.weight = weight;
}
public String getChiefComplaint() {
return chiefComplaint;
}
public void setChiefComplaint(String chiefComplaint) {
this.chiefComplaint = chiefComplaint;
}
public Integer getRespiratoryRate() {
return respiratoryRate;
}
public void setRespiratoryRate(Integer respiratoryRate) {
this.respiratoryRate = respiratoryRate;
}
public Float getOxygenSaturation() {
return oxygenSaturation;
}
public void setOxygenSaturation(Float oxygenSaturation) {
this.oxygenSaturation = oxygenSaturation;
}
public Integer getWeeksPregnant() {
return weeksPregnant;
}
public void setWeeksPregnant(Integer weeksPregnant) {
this.weeksPregnant = weeksPregnant;
}
public Integer getGlucose() {
return glucose;
}
public void setGlucose(Integer glucose) {
this.glucose = glucose;
}
public String getChiefComplaintsJSON() {
return chiefComplaintsJSON;
}
public void setChiefComplaintsJSON(String chiefComplaintsJSON) {
this.chiefComplaintsJSON = chiefComplaintsJSON;
}
public String getAgeClassification() {
return ageClassification;
}
public void setAgeClassification(String ageClassification) {
this.ageClassification = ageClassification;
}
public String getIsDiabetesScreenPerformed() {
return isDiabetesScreenPerformed;
}
public Integer getSmoker() {return smoker;}
public void setSmoker(Integer smoker){this.smoker = smoker;}
public Integer getDiabetes() {return diabetic;}
public void setDiabetic(Integer diabetes){this.diabetic = diabetes;}
public Integer getAlcohol() {return alcohol;}
public void setAlcohol(Integer alcohol){this.alcohol = alcohol;}
public Integer getCholesterol() {return cholesterol;}
public void setCholesterol(Integer cholesterol){this.cholesterol = cholesterol;}
public Integer getHypertension() {return hypertension;}
public void setHypertension(Integer hypertension){this.hypertension = hypertension;}
public void setIsDiabetesScreenPerformed(String isDiabetesScreenPerformed) {
this.isDiabetesScreenPerformed = isDiabetesScreenPerformed;
}
}
| FEMR/femr | app/femr/ui/models/triage/IndexViewModelPost.java |
213,050 | /*
fEMR - fast Electronic Medical Records
Copyright (C) 2014 Team fEMR
fEMR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fEMR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with fEMR. If not, see <http://www.gnu.org/licenses/>. If
you have any questions, contact <[email protected]>.
*/
package femr.ui.models.medical;
public class UpdateVitalsModel {
private Float bloodPressureSystolic;
private Float bloodPressureDiastolic;
private Float heartRate;
private Float temperature;
private Float oxygenSaturation;
private Float respiratoryRate;
private Float heightFeet;
private Float heightInches;
private Float weight;
private Float glucose;
private Float weeksPregnant;
private Integer smoker;
private Integer diabetic;
private Integer alcohol;
private Integer cholesterol;
private Integer hypertension;
public Float getBloodPressureSystolic() {
return bloodPressureSystolic;
}
public void setBloodPressureSystolic(Float bloodPressureSystolic) {
this.bloodPressureSystolic = bloodPressureSystolic;
}
public Float getBloodPressureDiastolic() {
return bloodPressureDiastolic;
}
public void setBloodPressureDiastolic(Float bloodPressureDiastolic) {
this.bloodPressureDiastolic = bloodPressureDiastolic;
}
public Float getHeartRate() {
return heartRate;
}
public void setHeartRate(Float heartRate) {
this.heartRate = heartRate;
}
public Float getTemperature() {
return temperature;
}
public void setTemperature(Float temperature) {
this.temperature = temperature;
}
public Float getOxygenSaturation() {
return oxygenSaturation;
}
public void setOxygenSaturation(Float oxygenSaturation) {
this.oxygenSaturation = oxygenSaturation;
}
public Float getRespiratoryRate() {
return respiratoryRate;
}
public void setRespiratoryRate(Float respiratoryRate) {
this.respiratoryRate = respiratoryRate;
}
public Float getHeightFeet() {
return heightFeet;
}
public void setHeightFeet(Float heightFeet) {
this.heightFeet = heightFeet;
}
public Float getHeightInches() {
return heightInches;
}
public void setHeightInches(Float heightInches) {
this.heightInches = heightInches;
}
public Float getWeight() {
return weight;
}
public void setWeight(Float weight) {
this.weight = weight;
}
public Float getGlucose() {
return glucose;
}
public void setGlucose(Float glucose) {
this.glucose = glucose;
}
public Float getWeeksPregnant() { /*Sam Zanni*/
return weeksPregnant;
}
public void setWeeksPregnant(Float weeksPregnant) { /*Sam Zanni*/
this.weeksPregnant = weeksPregnant;
}
public Integer getSmoker() {return smoker;}
public void setSmoker(Integer smoker){this.smoker = smoker;}
public Integer getDiabetes() {return diabetic;}
public void setDiabetic(Integer diabetes){this.diabetic = diabetes;}
public Integer getAlcohol() {return alcohol;}
public void setAlcohol(Integer alcohol){this.alcohol = alcohol;}
public Integer getCholesterol() {return cholesterol;}
public void setCholesterol(Integer cholesterol){this.cholesterol = cholesterol;}
public Integer getHypertension() {return hypertension;}
public void setHypertension(Integer hypertension){this.hypertension = hypertension;}
}
| FEMR/femr | app/femr/ui/models/medical/UpdateVitalsModel.java |
213,051 | /**
* Copyright (c) 2001-2002. Department of Family Medicine, McMaster University. All Rights Reserved.
* This software is published under the GPL GNU General Public License.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This software was written for the
* Department of Family Medicine
* McMaster University
* Hamilton
* Ontario, Canada
*/
package org.oscarehr.ws.rest.to.model;
import java.io.Serializable;
import java.util.Date;
import javax.xml.bind.annotation.XmlRootElement;
import com.quatro.model.LookupCodeValue;
@XmlRootElement
public class ProgramTo1 implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private boolean userDefined = true;
private Integer numOfMembers;
private Integer numOfIntakes;
private Integer queueSize;
private Integer maxAllowed;
private String type;
private String description;
private String functionalCentreId;
private String address;
private String phone;
private String fax;
private String url;
private String email;
private String emergencyNumber;
private String location;
private String name;
private boolean holdingTank;
private boolean allowBatchAdmission;
private boolean allowBatchDischarge;
private boolean hic;
private String programStatus;
private Integer intakeProgram;
private Integer bedProgramLinkId;
private String manOrWoman;
private String genderDesc;
private boolean transgender;
private boolean firstNation;
private boolean bedProgramAffiliated;
private boolean alcohol;
private String abstinenceSupport;
private boolean physicalHealth;
private boolean mentalHealth;
private boolean housing;
private String exclusiveView;
private Integer ageMin;
private Integer ageMax;
private Integer maximumServiceRestrictionDays;
private Integer defaultServiceRestrictionDays;
private Integer shelterId;
private int facilityId;
private String facilityDesc;
private String orgCd;
private Integer capacity_funding = new Integer(0);
private Integer capacity_space = new Integer(0);
private Integer capacity_actual = new Integer(0);
private Integer totalUsedRoom = new Integer(0);
private String lastUpdateUser;
private Date lastUpdateDate;
private LookupCodeValue shelter;
private String siteSpecificField;
private Boolean enableEncounterTime = false;
private Boolean enableEncounterTransportationTime = false;
private String emailNotificationAddressesCsv = null;
private Date lastReferralNotification = null;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public boolean isUserDefined() {
return userDefined;
}
public void setUserDefined(boolean userDefined) {
this.userDefined = userDefined;
}
public Integer getNumOfMembers() {
return numOfMembers;
}
public void setNumOfMembers(Integer numOfMembers) {
this.numOfMembers = numOfMembers;
}
public Integer getNumOfIntakes() {
return numOfIntakes;
}
public void setNumOfIntakes(Integer numOfIntakes) {
this.numOfIntakes = numOfIntakes;
}
public Integer getQueueSize() {
return queueSize;
}
public void setQueueSize(Integer queueSize) {
this.queueSize = queueSize;
}
public Integer getMaxAllowed() {
return maxAllowed;
}
public void setMaxAllowed(Integer maxAllowed) {
this.maxAllowed = maxAllowed;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getFunctionalCentreId() {
return functionalCentreId;
}
public void setFunctionalCentreId(String functionalCentreId) {
this.functionalCentreId = functionalCentreId;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getFax() {
return fax;
}
public void setFax(String fax) {
this.fax = fax;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmergencyNumber() {
return emergencyNumber;
}
public void setEmergencyNumber(String emergencyNumber) {
this.emergencyNumber = emergencyNumber;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isHoldingTank() {
return holdingTank;
}
public void setHoldingTank(boolean holdingTank) {
this.holdingTank = holdingTank;
}
public boolean isAllowBatchAdmission() {
return allowBatchAdmission;
}
public void setAllowBatchAdmission(boolean allowBatchAdmission) {
this.allowBatchAdmission = allowBatchAdmission;
}
public boolean isAllowBatchDischarge() {
return allowBatchDischarge;
}
public void setAllowBatchDischarge(boolean allowBatchDischarge) {
this.allowBatchDischarge = allowBatchDischarge;
}
public boolean isHic() {
return hic;
}
public void setHic(boolean hic) {
this.hic = hic;
}
public String getProgramStatus() {
return programStatus;
}
public void setProgramStatus(String programStatus) {
this.programStatus = programStatus;
}
public Integer getIntakeProgram() {
return intakeProgram;
}
public void setIntakeProgram(Integer intakeProgram) {
this.intakeProgram = intakeProgram;
}
public Integer getBedProgramLinkId() {
return bedProgramLinkId;
}
public void setBedProgramLinkId(Integer bedProgramLinkId) {
this.bedProgramLinkId = bedProgramLinkId;
}
public String getManOrWoman() {
return manOrWoman;
}
public void setManOrWoman(String manOrWoman) {
this.manOrWoman = manOrWoman;
}
public String getGenderDesc() {
return genderDesc;
}
public void setGenderDesc(String genderDesc) {
this.genderDesc = genderDesc;
}
public boolean isTransgender() {
return transgender;
}
public void setTransgender(boolean transgender) {
this.transgender = transgender;
}
public boolean isFirstNation() {
return firstNation;
}
public void setFirstNation(boolean firstNation) {
this.firstNation = firstNation;
}
public boolean isBedProgramAffiliated() {
return bedProgramAffiliated;
}
public void setBedProgramAffiliated(boolean bedProgramAffiliated) {
this.bedProgramAffiliated = bedProgramAffiliated;
}
public boolean isAlcohol() {
return alcohol;
}
public void setAlcohol(boolean alcohol) {
this.alcohol = alcohol;
}
public String getAbstinenceSupport() {
return abstinenceSupport;
}
public void setAbstinenceSupport(String abstinenceSupport) {
this.abstinenceSupport = abstinenceSupport;
}
public boolean isPhysicalHealth() {
return physicalHealth;
}
public void setPhysicalHealth(boolean physicalHealth) {
this.physicalHealth = physicalHealth;
}
public boolean isMentalHealth() {
return mentalHealth;
}
public void setMentalHealth(boolean mentalHealth) {
this.mentalHealth = mentalHealth;
}
public boolean isHousing() {
return housing;
}
public void setHousing(boolean housing) {
this.housing = housing;
}
public String getExclusiveView() {
return exclusiveView;
}
public void setExclusiveView(String exclusiveView) {
this.exclusiveView = exclusiveView;
}
public Integer getAgeMin() {
return ageMin;
}
public void setAgeMin(Integer ageMin) {
this.ageMin = ageMin;
}
public Integer getAgeMax() {
return ageMax;
}
public void setAgeMax(Integer ageMax) {
this.ageMax = ageMax;
}
public Integer getMaximumServiceRestrictionDays() {
return maximumServiceRestrictionDays;
}
public void setMaximumServiceRestrictionDays(Integer maximumServiceRestrictionDays) {
this.maximumServiceRestrictionDays = maximumServiceRestrictionDays;
}
public Integer getDefaultServiceRestrictionDays() {
return defaultServiceRestrictionDays;
}
public void setDefaultServiceRestrictionDays(Integer defaultServiceRestrictionDays) {
this.defaultServiceRestrictionDays = defaultServiceRestrictionDays;
}
public Integer getShelterId() {
return shelterId;
}
public void setShelterId(Integer shelterId) {
this.shelterId = shelterId;
}
public int getFacilityId() {
return facilityId;
}
public void setFacilityId(int facilityId) {
this.facilityId = facilityId;
}
public String getFacilityDesc() {
return facilityDesc;
}
public void setFacilityDesc(String facilityDesc) {
this.facilityDesc = facilityDesc;
}
public String getOrgCd() {
return orgCd;
}
public void setOrgCd(String orgCd) {
this.orgCd = orgCd;
}
public Integer getCapacity_funding() {
return capacity_funding;
}
public void setCapacity_funding(Integer capacity_funding) {
this.capacity_funding = capacity_funding;
}
public Integer getCapacity_space() {
return capacity_space;
}
public void setCapacity_space(Integer capacity_space) {
this.capacity_space = capacity_space;
}
public Integer getCapacity_actual() {
return capacity_actual;
}
public void setCapacity_actual(Integer capacity_actual) {
this.capacity_actual = capacity_actual;
}
public Integer getTotalUsedRoom() {
return totalUsedRoom;
}
public void setTotalUsedRoom(Integer totalUsedRoom) {
this.totalUsedRoom = totalUsedRoom;
}
public String getLastUpdateUser() {
return lastUpdateUser;
}
public void setLastUpdateUser(String lastUpdateUser) {
this.lastUpdateUser = lastUpdateUser;
}
public Date getLastUpdateDate() {
return lastUpdateDate;
}
public void setLastUpdateDate(Date lastUpdateDate) {
this.lastUpdateDate = lastUpdateDate;
}
public LookupCodeValue getShelter() {
return shelter;
}
public void setShelter(LookupCodeValue shelter) {
this.shelter = shelter;
}
public String getSiteSpecificField() {
return siteSpecificField;
}
public void setSiteSpecificField(String siteSpecificField) {
this.siteSpecificField = siteSpecificField;
}
public Boolean getEnableEncounterTime() {
return enableEncounterTime;
}
public void setEnableEncounterTime(Boolean enableEncounterTime) {
this.enableEncounterTime = enableEncounterTime;
}
public Boolean getEnableEncounterTransportationTime() {
return enableEncounterTransportationTime;
}
public void setEnableEncounterTransportationTime(Boolean enableEncounterTransportationTime) {
this.enableEncounterTransportationTime = enableEncounterTransportationTime;
}
public String getEmailNotificationAddressesCsv() {
return emailNotificationAddressesCsv;
}
public void setEmailNotificationAddressesCsv(String emailNotificationAddressesCsv) {
this.emailNotificationAddressesCsv = emailNotificationAddressesCsv;
}
public Date getLastReferralNotification() {
return lastReferralNotification;
}
public void setLastReferralNotification(Date lastReferralNotification) {
this.lastReferralNotification = lastReferralNotification;
}
}
| junoemr/junoemr | src/main/java/org/oscarehr/ws/rest/to/model/ProgramTo1.java |
213,055 | package com.bioxx.tfc2.core;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import com.bioxx.tfc2.Core;
import com.bioxx.tfc2.api.types.EnumFoodGroup;
public class FoodStatsTFC
{
/** The player's food level. This measures how much food the player can handle.*/
public float stomachLevel = 100;
private float stomachMax = 100.0f;
private float prevFoodLevel = 100;
public float nutrFruit = 1.0f;
public float nutrVeg = 1.0f;
public float nutrGrain = 1.0f;
public float nutrDairy = 0.0f;
public float nutrProtein = 1.0f;
private boolean sendUpdate = true;
public long soberTime;
/**This is how full the player is from the food that they've eaten.
* It could also be how happy they are with what they've eaten*/
private float satisfaction;
private float foodExhaustionLevel;
//private float waterExhaustionLevel;
/** The player's food timer value. */
public long foodTimer;
public long foodHealTimer;
public float waterLevel = 100f;//TFC_Time.DAY_LENGTH*2;
public long waterTimer;
public EntityPlayer player;
private long nameSeed = Long.MIN_VALUE;
private boolean satFruit;
private boolean satVeg;
private boolean satGrain;
private boolean satProtein;
private boolean satDairy;
public FoodStatsTFC(EntityPlayer player)
{
this.player = player;
//waterTimer = Math.max(TFC_Time.getTotalTicks(),TFC_Time.startTime);
//foodTimer = Math.max(TFC_Time.getTotalTicks(),TFC_Time.startTime);
//foodHealTimer = Math.max(TFC_Time.getTotalTicks(),TFC_Time.startTime);
}
/**
* Handles the food game logic.
*/
public void onUpdate(EntityPlayer player)
{
if(!player.world.isRemote)
{
Timekeeper time = Timekeeper.instance;
/*
* Standard filling reduction based upon time.
*/
if (time.getTotalTicks() - this.foodTimer >= Timekeeper.HOUR_LENGTH && !player.capabilities.isCreativeMode)
{
//Increase our timer
this.foodTimer += Timekeeper.HOUR_LENGTH;
float drainMult = 1.0f;
//We dont want the player to starve to death while sleeping
if(player.isPlayerSleeping())
{
drainMult = 0.50f;
}
//Water
if(player.isSprinting())
waterLevel -= 5;
if(!player.capabilities.isCreativeMode)
waterLevel -= 1;
//Food
float hunger = (1 + foodExhaustionLevel) * drainMult;
if(this.satisfaction >= hunger)
{
satisfaction -= hunger;
hunger = 0;
foodExhaustionLevel = 0;
}
else
{
hunger -= satisfaction;
satisfaction = 0;
foodExhaustionLevel = 0;
}
this.stomachLevel = Math.max(this.stomachLevel - hunger, 0);
if(satisfaction == 0)
{
satProtein = false; satFruit = false; satVeg = false; satDairy = false; satGrain = false;
}
/*
* Reduce nutrients
*/
if (this.stomachLevel <= 0)
{
reduceNutrition(0.0024F);//3x penalty for starving
}
else if(this.satisfaction <= 0)
{
reduceNutrition(0.0008F);
}
else
{
if(this.satProtein)
this.addNutrition(EnumFoodGroup.Protein, this.satisfaction*((1-this.nutrProtein)/100), false);
if(this.satGrain)
this.addNutrition(EnumFoodGroup.Grain, this.satisfaction*((1-this.nutrGrain)/100), false);
if(this.satVeg)
this.addNutrition(EnumFoodGroup.Vegetable, this.satisfaction*((1-this.nutrVeg)/100), false);
if(this.satFruit)
this.addNutrition(EnumFoodGroup.Fruit, this.satisfaction*((1-this.nutrFruit)/100), false);
if(this.satDairy)
this.addNutrition(EnumFoodGroup.Dairy, this.satisfaction*((1-this.nutrDairy)/100), false);
}
sendUpdate = true;
}
if(!player.capabilities.isCreativeMode)
{
for(;waterTimer < time.getTotalTicks(); waterTimer++)
{
//Reduce the player's water for normal living
waterLevel -= 1;
if(waterLevel < 0)
waterLevel = 0;
/*if(!Core.isPlayerInDebugMode(player) && waterLevel == 0 && temp > 35)
player.attackEntityFrom(new DamageSource("heatStroke").setDamageBypassesArmor().setDamageIsAbsolute(), 2);*/
}
}
//Heal or hurt the player based on hunger.
if (time.getTotalTicks() - this.foodHealTimer >= Timekeeper.HOUR_LENGTH/2)
{
this.foodHealTimer += Timekeeper.HOUR_LENGTH/2;
if (this.stomachLevel >= this.getMaxStomach(player)/4 && player.shouldHeal())
{
//Player heals 1% per 30 in game minutes
player.heal((int) (player.getMaxHealth() * 0.01f));
}
else if (this.stomachLevel <= 0 && getNutritionHealthModifier() < 0.85f && !Core.isPlayerInDebugMode(player) && player.getSleepTimer() == 0)
{
//Players loses health at a rate of 5% per 30 minutes if they are starving
//Disabled so that the penalty for not eating is now entirely based upon nutrition.
//player.attackEntityFrom(DamageSource.starve, Math.max((int) (player.getMaxHealth() * 0.05f), 10));
}
}
}
}
protected void reduceNutrition(float amount)
{
nutrFruit = Math.max(this.nutrFruit - (amount + foodExhaustionLevel), 0);
nutrVeg = Math.max(this.nutrVeg - (amount + foodExhaustionLevel), 0);
nutrGrain = Math.max(this.nutrGrain - (amount + foodExhaustionLevel), 0);
nutrProtein = Math.max(this.nutrProtein - (amount + foodExhaustionLevel), 0);
nutrDairy = Math.max(this.nutrDairy - (amount + foodExhaustionLevel), 0);
sendUpdate = true;
}
public int getMaxWater(EntityPlayer player)
{
return 100;//return TFC_Time.DAY_LENGTH * 2 + 200 * player.experienceLevel;
}
public float getMaxStomach(EntityPlayer player)
{
return this.stomachMax;
}
/**
* Get the player's food level.
*/
public float getFoodLevel()
{
return this.stomachLevel;
}
@SideOnly(Side.CLIENT)
public float getPrevFoodLevel()
{
return this.prevFoodLevel ;
}
/**
* If foodLevel is not max.
*/
public boolean needFood()
{
return this.stomachLevel < getMaxStomach(this.player) && (getMaxStomach(this.player) - stomachLevel) > 0.1;
}
public boolean needDrink()
{
return this.waterLevel < getMaxWater(this.player) - 500;
}
/**
* Reads food stats from an NBT object.
*/
public void readNBT(NBTTagCompound par1NBTTagCompound)
{
if (par1NBTTagCompound.hasKey("foodCompound"))
{
NBTTagCompound foodCompound = par1NBTTagCompound.getCompoundTag("foodCompound");
this.waterLevel = foodCompound.getFloat("waterLevel");
this.stomachLevel = foodCompound.getFloat("foodLevel");
this.foodTimer = foodCompound.getLong("foodTickTimer");
this.foodHealTimer = foodCompound.getLong("foodHealTimer");
this.waterTimer = foodCompound.getLong("waterTimer");
this.soberTime = foodCompound.getLong("soberTime");
this.satisfaction = foodCompound.getFloat("foodSaturationLevel");
this.foodExhaustionLevel = foodCompound.getFloat("foodExhaustionLevel");
this.nutrFruit = foodCompound.getFloat("nutrFruit");
this.nutrVeg = foodCompound.getFloat("nutrVeg");
this.nutrGrain = foodCompound.getFloat("nutrGrain");
this.nutrProtein = foodCompound.getFloat("nutrProtein");
this.nutrDairy = foodCompound.getFloat("nutrDairy");
this.sendUpdate = foodCompound.getBoolean("shouldSendUpdate");
this.satFruit = foodCompound.getBoolean("satFruit");
this.satVeg = foodCompound.getBoolean("satVeg");
this.satGrain = foodCompound.getBoolean("satGrain");
this.satProtein = foodCompound.getBoolean("satProtein");
this.satDairy = foodCompound.getBoolean("satDairy");
}
}
/**
* Writes food stats to an NBT object.
*/
public void writeNBT(NBTTagCompound nbt)
{
NBTTagCompound foodNBT = new NBTTagCompound();
foodNBT.setFloat("waterLevel", this.waterLevel);
foodNBT.setFloat("foodLevel", this.stomachLevel);
foodNBT.setLong("foodTickTimer", this.foodTimer);
foodNBT.setLong("foodHealTimer", this.foodHealTimer);
foodNBT.setLong("waterTimer", this.waterTimer);
foodNBT.setLong("soberTime", this.soberTime);
foodNBT.setFloat("foodSaturationLevel", this.satisfaction);
foodNBT.setFloat("foodExhaustionLevel", this.foodExhaustionLevel);
foodNBT.setFloat("nutrFruit", nutrFruit);
foodNBT.setFloat("nutrVeg", nutrVeg);
foodNBT.setFloat("nutrGrain", nutrGrain);
foodNBT.setFloat("nutrProtein", nutrProtein);
foodNBT.setFloat("nutrDairy", nutrDairy);
foodNBT.setBoolean("shouldSendUpdate", sendUpdate);
foodNBT.setBoolean("satFruit", satFruit);
foodNBT.setBoolean("satVeg", satVeg);
foodNBT.setBoolean("satGrain", satGrain);
foodNBT.setBoolean("satProtein", satProtein);
foodNBT.setBoolean("satDairy", satDairy);
nbt.setTag("foodCompound", foodNBT);
}
public void addFoodExhaustion(float par1)
{
this.foodExhaustionLevel = par1;
}
/*public void addWaterExhaustion(float par1)
{
this.waterExhaustionLevel = par1;
}*/
public float getSatisfaction()
{
return this.satisfaction;
}
public void setFoodLevel(float par1)
{
if(par1 != this.stomachLevel)
sendUpdate = true;
this.stomachLevel = par1;
}
public void setSatisfaction(float par1, int[] fg)
{
this.satisfaction = Math.min(par1, 10);
}
public long getPlayerFoodSeed()
{
/*if(nameSeed == Long.MIN_VALUE)
{
long seed = 0;
byte[] nameBytes = player.getCommandSenderName().getBytes();
for(byte b : nameBytes)
seed+=b;
nameSeed = seed + player.world.getSeed();
}
return nameSeed;*/
return 0;
}
public float getNutritionHealthModifier()
{
float nMod = 0.00f;
nMod += 0.1f * nutrFruit;
nMod += 0.4f * nutrVeg;
nMod += 0.3f * nutrGrain;
nMod += 0.2f * nutrProtein;
return Math.max(nMod, 0.05f);
}
public static float getMaxHealth(EntityPlayer player)
{
/*return Math.min(20+(player.experienceLevel * TFCOptions.healthGainRate),
TFCOptions.healthGainCap) * Core.getPlayerFoodStats(player).getNutritionHealthModifier() * (1+0.2f * Core.getPlayerFoodStats(player).nutrDairy);
*/
return 0;
}
/**
*
* @return return true if the itemstack should be consumed, else return false
*/
public static boolean reduceFood(ItemStack is, float amount)
{
/*if(is.hasTagCompound())
{
float weight = is.getTagCompound().getFloat("foodWeight");
float decay = is.getTagCompound().hasKey("foodDecay") ? is.getTagCompound().getFloat("foodDecay") : 0;
if(decay >= 0 && (weight - decay) - amount <= 0)
return true;
else if(decay <= 0 && weight - amount <= 0)
return true;
else
{
is.getTagCompound().setFloat("foodWeight", Helper.roundNumber(weight - amount, 10));
//is.getTagCompound().setFloat("foodDecay", Helper.roundNumber(decay - amount, 10));
}
}*/
return false;
}
public void addNutrition(EnumFoodGroup fg, float foodAmt)
{
addNutrition(fg, foodAmt, true);
}
public void addNutrition(EnumFoodGroup fg, float foodAmt, boolean shouldDoMath)
{
float amount = foodAmt;
if(shouldDoMath)
amount = foodAmt/5f/50f;//converts it to 5% if it is 5oz of food
switch(fg)
{
case Dairy:
this.nutrDairy = Math.min(nutrDairy + amount, 1.0f);
break;
case Fruit:
this.nutrFruit = Math.min(nutrFruit + amount, 1.0f);
break;
case Grain:
this.nutrGrain = Math.min(nutrGrain + amount, 1.0f);
break;
case Protein:
this.nutrProtein = Math.min(nutrProtein + amount, 1.0f);
break;
case Vegetable:
this.nutrVeg = Math.min(nutrVeg + amount, 1.0f);
break;
default:
break;
}
}
public boolean shouldSendUpdate()
{
return sendUpdate;
}
public void restoreWater(EntityPlayer player, int w)
{
this.waterLevel = Math.min(this.waterLevel + w, this.getMaxWater(player));
sendUpdate = true;
this.writeNBT(player.getEntityData());
}
public void resetTimers()
{
//waterTimer = TFC_Time.getTotalTicks();
//foodTimer = TFC_Time.getTotalTicks();
//foodHealTimer = TFC_Time.getTotalTicks();
}
public void consumeAlcohol()
{
//TODO: Add a parameter for alcohol strength
/*if(soberTime <= TFC_Time.getTotalTicks())
soberTime = TFC_Time.getTotalTicks() + player.world.rand.nextInt(1000) + 400;
else
soberTime += player.world.rand.nextInt(1000) + 400;
sendUpdate = true;*/
}
}
| Deadrik/TFC2 | src/Common/com/bioxx/tfc2/core/FoodStatsTFC.java |
213,056 | package com.lilithsthrone.game.character.attributes;
import com.lilithsthrone.utils.Colour;
/**
* @since 0.2.8
* @version 0.2.8
* @author Innoxia
*/
public enum AlcoholLevel {
ZERO_SOBER("sober", 0, 0, 0.01f, Colour.ALCOHOL_LEVEL_ZERO),
ONE_TIPSY("tipsy", 0, 0.01f, 0.2f, Colour.ALCOHOL_LEVEL_ONE),
TWO_MERRY("merry", 12, 0.2f, 0.4f, Colour.ALCOHOL_LEVEL_TWO),
THREE_DRUNK("drunk", 8, 0.4f, 0.6f, Colour.ALCOHOL_LEVEL_THREE),
FOUR_HAMMERED("hammered", 6, 0.6f, 0.8f, Colour.ALCOHOL_LEVEL_FOUR),
FIVE_WASTED("wasted", 4, 0.8f, 1, Colour.ALCOHOL_LEVEL_FIVE);
private String name;
private float minimumValue;
private float maximumValue;
private Colour colour;
private int slurredSpeechFrequency;
private AlcoholLevel(String name, int slurredSpeechFrequency, float minimumValue, float maximumValue, Colour colour) {
this.name = name;
this.slurredSpeechFrequency = slurredSpeechFrequency;
this.minimumValue = minimumValue;
this.maximumValue = maximumValue;
this.colour = colour;
}
public String getName() {
return name;
}
public int getSlurredSpeechFrequency() {
return slurredSpeechFrequency;
}
public float getMinimumValue() {
return minimumValue;
}
public float getMaximumValue() {
return maximumValue;
}
public Colour getColour() {
return colour;
}
public static AlcoholLevel getAlcoholLevelFromValue(float value){
for(AlcoholLevel al : AlcoholLevel.values()) {
if(value>=al.getMinimumValue() && value<al.getMaximumValue())
return al;
}
return FIVE_WASTED;
}
}
| Felyndiira/liliths-throne-public | src/com/lilithsthrone/game/character/attributes/AlcoholLevel.java |
213,058 | package com.dre.brewery.recipe;
import com.dre.brewery.BIngredients;
import com.dre.brewery.Brew;
import com.dre.brewery.P;
import com.dre.brewery.filedata.BConfig;
import com.dre.brewery.utility.BUtil;
import com.dre.brewery.utility.StringParser;
import com.dre.brewery.utility.Tuple;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* A Recipe used to Brew a Brewery Potion.
*/
public class BRecipe {
private static List<BRecipe> recipes = new ArrayList<>();
public static int numConfigRecipes; // The number of recipes in the list that are from config
// info
private String[] name;
private boolean saveInData; // If this recipe should be saved in data and loaded again when the server restarts. Applicable to non-config recipes
private String optionalID; // ID that might be given by the config
// brewing
private List<RecipeItem> ingredients = new ArrayList<>(); // Items and amounts
private int difficulty; // difficulty to brew the potion, how exact the instruction has to be followed
private int cookingTime; // time to cook in cauldron
private byte distillruns; // runs through the brewer
private int distillTime; // time for one distill run in seconds
private byte wood; // type of wood the barrel has to consist of
private int age; // time in minecraft days for the potions to age in barrels
// outcome
private PotionColor color; // color of the distilled/finished potion
private int alcohol; // Alcohol in perfect potion
private List<Tuple<Integer, String>> lore; // Custom Lore on the Potion. The int is for Quality Lore, 0 = any, 1,2,3 = Bad,Middle,Good
private int[] cmData; // Custom Model Data[3] for each quality
// drinking
private List<BEffect> effects = new ArrayList<>(); // Special Effects when drinking
private @Nullable List<Tuple<Integer, String>> playercmds; // Commands executed as the player when drinking
private @Nullable List<Tuple<Integer, String>> servercmds; // Commands executed as the server when drinking
private String drinkMsg; // Message when drinking
private String drinkTitle; // Title to show when drinking
private BRecipe() {
}
/**
* New BRecipe with Name.
* <p>Use new BRecipe.Builder() for easier Recipe Creation
*
* @param name The name for all qualities
*/
public BRecipe(String name, @NotNull PotionColor color) {
this.name = new String[] {name};
this.color = color;
difficulty = 5;
}
/**
* New BRecipe with Names.
* <p>Use new BRecipe.Builder() for easier Recipe Creation
*
* @param names {name bad, name normal, name good}
*/
public BRecipe(String[] names, @NotNull PotionColor color) {
this.name = names;
this.color = color;
difficulty = 5;
}
@Nullable
public static BRecipe fromConfig(ConfigurationSection configSectionRecipes, String recipeId) {
BRecipe recipe = new BRecipe();
recipe.optionalID = recipeId;
String nameList = configSectionRecipes.getString(recipeId + ".name");
if (nameList != null) {
String[] name = nameList.split("/");
if (name.length > 2) {
recipe.name = name;
} else {
recipe.name = new String[1];
recipe.name[0] = name[0];
}
} else {
P.p.errorLog(recipeId + ": Recipe Name missing or invalid!");
return null;
}
if (recipe.getRecipeName() == null || recipe.getRecipeName().length() < 1) {
P.p.errorLog(recipeId + ": Recipe Name invalid");
return null;
}
recipe.ingredients = loadIngredients(configSectionRecipes, recipeId);
if (recipe.ingredients == null || recipe.ingredients.isEmpty()) {
P.p.errorLog("No ingredients for: " + recipe.getRecipeName());
return null;
}
recipe.cookingTime = configSectionRecipes.getInt(recipeId + ".cookingtime", 1);
int dis = configSectionRecipes.getInt(recipeId + ".distillruns", 0);
if (dis > Byte.MAX_VALUE) {
recipe.distillruns = Byte.MAX_VALUE;
} else {
recipe.distillruns = (byte) dis;
}
recipe.distillTime = configSectionRecipes.getInt(recipeId + ".distilltime", 0) * 20;
recipe.wood = (byte) configSectionRecipes.getInt(recipeId + ".wood", 0);
recipe.age = configSectionRecipes.getInt(recipeId + ".age", 0);
recipe.difficulty = configSectionRecipes.getInt(recipeId + ".difficulty", 0);
recipe.alcohol = configSectionRecipes.getInt(recipeId + ".alcohol", 0);
String col = configSectionRecipes.getString(recipeId + ".color", "BLUE");
recipe.color = PotionColor.fromString(col);
if (recipe.color == PotionColor.WATER && !col.equals("WATER")) {
P.p.errorLog("Invalid Color '" + col + "' in Recipe: " + recipe.getRecipeName());
return null;
}
recipe.lore = loadQualityStringList(configSectionRecipes, recipeId + ".lore", StringParser.ParseType.LORE);
recipe.servercmds = loadQualityStringList(configSectionRecipes, recipeId + ".servercommands", StringParser.ParseType.CMD);
recipe.playercmds = loadQualityStringList(configSectionRecipes, recipeId + ".playercommands", StringParser.ParseType.CMD);
recipe.drinkMsg = P.p.color(BUtil.loadCfgString(configSectionRecipes, recipeId + ".drinkmessage"));
recipe.drinkTitle = P.p.color(BUtil.loadCfgString(configSectionRecipes, recipeId + ".drinktitle"));
if (configSectionRecipes.isString(recipeId + ".customModelData")) {
String[] cmdParts = configSectionRecipes.getString(recipeId + ".customModelData", "").split("/");
if (cmdParts.length == 3) {
recipe.cmData = new int[]{P.p.parseInt(cmdParts[0]), P.p.parseInt(cmdParts[1]), P.p.parseInt(cmdParts[2])};
if (recipe.cmData[0] == 0 && recipe.cmData[1] == 0 && recipe.cmData[2] == 0) {
P.p.errorLog("Invalid customModelData in Recipe: " + recipe.getRecipeName());
recipe.cmData = null;
}
} else {
P.p.errorLog("Invalid customModelData in Recipe: " + recipe.getRecipeName());
}
} else {
int cmd = configSectionRecipes.getInt(recipeId + ".customModelData", 0);
if (cmd != 0) {
recipe.cmData = new int[]{cmd, cmd, cmd};
}
}
List<String> effectStringList = configSectionRecipes.getStringList(recipeId + ".effects");
if (effectStringList != null) {
for (String effectString : effectStringList) {
BEffect effect = new BEffect(effectString);
if (effect.isValid()) {
recipe.effects.add(effect);
} else {
P.p.errorLog("Error adding Effect to Recipe: " + recipe.getRecipeName());
}
}
}
return recipe;
}
public static List<RecipeItem> loadIngredients(ConfigurationSection cfg, String recipeId) {
List<String> ingredientsList;
if (cfg.isString(recipeId + ".ingredients")) {
ingredientsList = new ArrayList<>(1);
ingredientsList.add(cfg.getString(recipeId + ".ingredients", "x"));
} else {
ingredientsList = cfg.getStringList(recipeId + ".ingredients");
}
if (ingredientsList == null) {
return null;
}
List<RecipeItem> ingredients = new ArrayList<>(ingredientsList.size());
listLoop: for (String item : ingredientsList) {
String[] ingredParts = item.split("/");
int amount = 1;
if (ingredParts.length == 2) {
amount = P.p.parseInt(ingredParts[1]);
if (amount < 1) {
P.p.errorLog(recipeId + ": Invalid Item Amount: " + ingredParts[1]);
return null;
}
}
String[] matParts;
if (ingredParts[0].contains(",")) {
matParts = ingredParts[0].split(",");
} else if (ingredParts[0].contains(";")) {
matParts = ingredParts[0].split(";");
} else {
matParts = ingredParts[0].split("\\.");
}
if (!P.use1_14 && matParts[0].equalsIgnoreCase("sweet_berries")) {
// Using this in default recipes, but will error on < 1.14
ingredients.add(new SimpleItem(Material.BEDROCK));
continue;
}
// Check if this is a Plugin Item
String[] pluginItem = matParts[0].split(":");
if (pluginItem.length > 1) {
RecipeItem custom = PluginItem.fromConfig(pluginItem[0], pluginItem[1]);
if (custom != null) {
custom.setAmount(amount);
custom.makeImmutable();
ingredients.add(custom);
BCauldronRecipe.acceptedCustom.add(custom);
continue;
} else {
// TODO Maybe load later ie on first use of recipe?
P.p.errorLog(recipeId + ": Could not Find Plugin: " + ingredParts[1]);
return null;
}
}
// Try to find this Ingredient as Custom Item
for (RecipeItem custom : BConfig.customItems) {
if (custom.getConfigId().equalsIgnoreCase(matParts[0])) {
custom = custom.getMutableCopy();
custom.setAmount(amount);
custom.makeImmutable();
ingredients.add(custom);
if (custom.hasMaterials()) {
BCauldronRecipe.acceptedMaterials.addAll(custom.getMaterials());
}
// Add it as acceptedCustom
if (!BCauldronRecipe.acceptedCustom.contains(custom)) {
BCauldronRecipe.acceptedCustom.add(custom);
/*if (custom instanceof PluginItem || !custom.hasMaterials()) {
BCauldronRecipe.acceptedCustom.add(custom);
} else if (custom instanceof CustomMatchAnyItem) {
CustomMatchAnyItem ma = (CustomMatchAnyItem) custom;
if (ma.hasNames() || ma.hasLore()) {
BCauldronRecipe.acceptedCustom.add(ma);
}
}*/
}
continue listLoop;
}
}
Material mat = Material.matchMaterial(matParts[0]);
short durability = -1;
if (matParts.length == 2) {
durability = (short) P.p.parseInt(matParts[1]);
}
if (mat == null && BConfig.hasVault) {
try {
net.milkbowl.vault.item.ItemInfo vaultItem = net.milkbowl.vault.item.Items.itemByString(matParts[0]);
if (vaultItem != null) {
mat = vaultItem.getType();
if (durability == -1 && vaultItem.getSubTypeId() != 0) {
durability = vaultItem.getSubTypeId();
}
if (mat.name().contains("LEAVES")) {
if (durability > 3) {
durability -= 4; // Vault has leaves with higher durability
}
}
}
} catch (Exception e) {
P.p.errorLog("Could not check vault for Item Name");
e.printStackTrace();
}
}
if (mat != null) {
RecipeItem rItem;
if (durability > -1) {
rItem = new SimpleItem(mat, durability);
} else {
rItem = new SimpleItem(mat);
}
rItem.setAmount(amount);
rItem.makeImmutable();
ingredients.add(rItem);
BCauldronRecipe.acceptedMaterials.add(mat);
BCauldronRecipe.acceptedSimple.add(mat);
} else {
P.p.errorLog(recipeId + ": Unknown Material: " + ingredParts[0]);
return null;
}
}
return ingredients;
}
/**
* Load a list of strings from a ConfigurationSection and parse the quality
*/
@Nullable
public static List<Tuple<Integer, String>> loadQualityStringList(ConfigurationSection cfg, String path, StringParser.ParseType parseType) {
List<String> load = BUtil.loadCfgStringList(cfg, path);
if (load != null) {
return load.stream().map(line -> StringParser.parseQuality(line, parseType)).collect(Collectors.toList());
}
return null;
}
/**
* check every part of the recipe for validity.
*/
public boolean isValid() {
if (ingredients == null || ingredients.isEmpty()) {
P.p.errorLog("No ingredients could be loaded for Recipe: " + getRecipeName());
return false;
}
if (cookingTime < 1) {
P.p.errorLog("Invalid cooking time '" + cookingTime + "' in Recipe: " + getRecipeName());
return false;
}
if (distillruns < 0) {
P.p.errorLog("Invalid distillruns '" + distillruns + "' in Recipe: " + getRecipeName());
return false;
}
if (distillTime < 0) {
P.p.errorLog("Invalid distilltime '" + distillTime + "' in Recipe: " + getRecipeName());
return false;
}
if (wood < 0 || wood > 11) {
P.p.errorLog("Invalid wood type '" + wood + "' in Recipe: " + getRecipeName());
return false;
}
if (age < 0) {
P.p.errorLog("Invalid age time '" + age + "' in Recipe: " + getRecipeName());
return false;
}
if (difficulty < 0 || difficulty > 10) {
P.p.errorLog("Invalid difficulty '" + difficulty + "' in Recipe: " + getRecipeName());
return false;
}
return true;
}
/**
* allowed deviation to the recipes count of ingredients at the given difficulty
*/
public int allowedCountDiff(int count) {
if (count < 8) {
count = 8;
}
int allowedCountDiff = Math.round((float) ((11.0 - difficulty) * (count / 10.0)));
if (allowedCountDiff == 0) {
return 1;
}
return allowedCountDiff;
}
/**
* allowed deviation to the recipes cooking-time at the given difficulty
*/
public int allowedTimeDiff(int time) {
if (time < 8) {
time = 8;
}
int allowedTimeDiff = Math.round((float) ((11.0 - difficulty) * (time / 10.0)));
if (allowedTimeDiff == 0) {
return 1;
}
return allowedTimeDiff;
}
/**
* difference between given and recipe-wanted woodtype
*/
public float getWoodDiff(float wood) {
return Math.abs(wood - this.wood);
}
public boolean isCookingOnly() {
return age == 0 && distillruns == 0;
}
public boolean needsDistilling() {
return distillruns != 0;
}
public boolean needsToAge() {
return age != 0;
}
/**
* true if given list misses an ingredient
*/
public boolean isMissingIngredients(List<Ingredient> list) {
if (list.size() < ingredients.size()) {
return true;
}
for (RecipeItem rItem : ingredients) {
boolean matches = false;
for (Ingredient used : list) {
if (rItem.matches(used)) {
matches = true;
break;
}
}
if (!matches) {
return true;
}
}
return false;
}
public void applyDrinkFeatures(Player player, int quality) {
List<String> playerCmdsForQuality = getPlayercmdsForQuality(quality);
if (playerCmdsForQuality != null) {
for (String cmd : playerCmdsForQuality) {
player.performCommand(BUtil.applyPlaceholders(cmd, player.getName(), quality));
}
}
List<String> serverCmdsForQuality = getServercmdsForQuality(quality);
if (serverCmdsForQuality != null) {
for (String cmd : serverCmdsForQuality) {
P.p.getServer().dispatchCommand(P.p.getServer().getConsoleSender(), BUtil.applyPlaceholders(cmd, player.getName(), quality));
}
}
if (drinkMsg != null) {
player.sendMessage(BUtil.applyPlaceholders(drinkMsg, player.getName(), quality));
}
if (drinkTitle != null) {
player.sendTitle("", BUtil.applyPlaceholders(drinkTitle, player.getName(), quality), 10, 90, 30);
}
}
/**
* Create a Potion from this Recipe with best values.
* Quality can be set, but will reset to 10 if unset immutable and put in a barrel
*
* @param quality The Quality of the Brew
* @return The Created Item
*/
public ItemStack create(int quality) {
return createBrew(quality).createItem(this);
}
/**
* Create a Brew from this Recipe with best values.
* Quality can be set, but will reset to 10 if unset immutable and put in a barrel
*
* @param quality The Quality of the Brew
* @return The created Brew
*/
public Brew createBrew(int quality) {
List<Ingredient> list = new ArrayList<>(ingredients.size());
for (RecipeItem rItem : ingredients) {
Ingredient ing = rItem.toIngredientGeneric();
ing.setAmount(rItem.getAmount());
list.add(ing);
}
BIngredients bIngredients = new BIngredients(list, cookingTime);
return new Brew(bIngredients, quality, 0, distillruns, getAge(), wood, getRecipeName(), false, true, 0);
}
public void updateAcceptedLists() {
for (RecipeItem ingredient : getIngredients()) {
if (ingredient.hasMaterials()) {
BCauldronRecipe.acceptedMaterials.addAll(ingredient.getMaterials());
}
if (ingredient instanceof SimpleItem) {
BCauldronRecipe.acceptedSimple.add(((SimpleItem) ingredient).getMaterial());
} else {
// Add it as acceptedCustom
if (!BCauldronRecipe.acceptedCustom.contains(ingredient)) {
BCauldronRecipe.acceptedCustom.add(ingredient);
}
}
}
}
// Getter
/**
* how many of a specific ingredient in the recipe
*/
public int amountOf(Ingredient ing) {
for (RecipeItem rItem : ingredients) {
if (rItem.matches(ing)) {
return rItem.getAmount();
}
}
return 0;
}
/**
* how many of a specific ingredient in the recipe
*/
public int amountOf(ItemStack item) {
for (RecipeItem rItem : ingredients) {
if (rItem.matches(item)) {
return rItem.getAmount();
}
}
return 0;
}
/**
* Same as getName(5)
*/
public String getRecipeName() {
return getName(5);
}
/**
* name that fits the quality
*/
public String getName(int quality) {
if (name.length > 2) {
if (quality <= 3) {
return name[0];
} else if (quality <= 7) {
return name[1];
} else {
return name[2];
}
} else {
return name[0];
}
}
/**
* If one of the quality names equalIgnoreCase given name
*/
public boolean hasName(String name) {
for (String test : this.name) {
if (test.equalsIgnoreCase(name)) {
return true;
}
}
return false;
}
public Optional<String> getOptionalID() {
return Optional.ofNullable(optionalID);
}
public List<RecipeItem> getIngredients() {
return ingredients;
}
public int getCookingTime() {
return cookingTime;
}
public byte getDistillRuns() {
return distillruns;
}
public int getDistillTime() {
return distillTime;
}
@NotNull
public PotionColor getColor() {
return color;
}
/**
* get the woodtype
*/
public byte getWood() {
return wood;
}
public float getAge() {
return (float) age;
}
public int getDifficulty() {
return difficulty;
}
public int getAlcohol() {
return alcohol;
}
public boolean hasLore() {
return lore != null && !lore.isEmpty();
}
@Nullable
public List<Tuple<Integer, String>> getLore() {
return lore;
}
@Nullable
public List<String> getLoreForQuality(int quality) {
return getStringsForQuality(quality, lore);
}
@Nullable
public List<String> getPlayercmdsForQuality(int quality) {
return getStringsForQuality(quality, playercmds);
}
@Nullable
public List<String> getServercmdsForQuality(int quality) {
return getStringsForQuality(quality, servercmds);
}
/**
* Get a quality filtered list of supported attributes
*/
@Nullable
public List<String> getStringsForQuality(int quality, List<Tuple<Integer, String>> source) {
if (source == null) return null;
int plus;
if (quality <= 3) {
plus = 1;
} else if (quality <= 7) {
plus = 2;
} else {
plus = 3;
}
List<String> list = new ArrayList<>(source.size());
for (Tuple<Integer, String> line : source) {
if (line.first() == 0 || line.first() == plus) {
list.add(line.second());
}
}
return list;
}
/**
* Get the Custom Model Data array for bad, normal, good quality
*/
public int[] getCmData() {
return cmData;
}
@Nullable
public List<Tuple<Integer, String>> getPlayercmds() {
return playercmds;
}
@Nullable
public List<Tuple<Integer, String>> getServercmds() {
return servercmds;
}
public String getDrinkMsg() {
return drinkMsg;
}
public String getDrinkTitle() {
return drinkTitle;
}
public List<BEffect> getEffects() {
return effects;
}
public boolean isSaveInData() {
return saveInData;
}
// Setters
/**
* When Changing ingredients, Accepted Lists have to be updated in BCauldronRecipe
*/
public void setIngredients(List<RecipeItem> ingredients) {
this.ingredients = ingredients;
}
public void setCookingTime(int cookingTime) {
this.cookingTime = cookingTime;
}
public void setDistillruns(byte distillruns) {
this.distillruns = distillruns;
}
public void setDistillTime(int distillTime) {
this.distillTime = distillTime;
}
public void setWood(byte wood) {
this.wood = wood;
}
public void setAge(int age) {
this.age = age;
}
public void setColor(@NotNull PotionColor color) {
this.color = color;
}
public void setDifficulty(int difficulty) {
this.difficulty = difficulty;
}
public void setAlcohol(int alcohol) {
this.alcohol = alcohol;
}
public void setLore(List<Tuple<Integer, String>> lore) {
this.lore = lore;
}
public void setEffects(List<BEffect> effects) {
this.effects = effects;
}
public void setSaveInData(boolean saveInData) {
throw new UnsupportedOperationException();
//this.saveInData = saveInData;
}
@Override
public String toString() {
return "BRecipe{" + getRecipeName() + '}';
}
/**
* Gets a Modifiable Sublist of the Recipes that are loaded by config.
* <p>Changes are directly reflected by the main list of all recipes
* <br>Changes to the main List of all recipes will make the reference to this sublist invalid
*
* <p>After adding or removing elements, BRecipe.numConfigRecipes MUST be updated!
*/
public static List<BRecipe> getConfigRecipes() {
return recipes.subList(0, numConfigRecipes);
}
/**
* Gets a Modifiable Sublist of the Recipes that are added by plugins.
* <p>Changes are directly reflected by the main list of all recipes
* <br>Changes to the main List of all recipes will make the reference to this sublist invalid
*/
public static List<BRecipe> getAddedRecipes() {
return recipes.subList(numConfigRecipes, recipes.size());
}
/**
* Gets the main List of all recipes.
*/
public static List<BRecipe> getAllRecipes() {
return recipes;
}
/**
* Get the BRecipe that has the given name as one of its quality names.
*/
@Nullable
public static BRecipe getMatching(String name) {
BRecipe mainNameRecipe = get(name);
if (mainNameRecipe != null) {
return mainNameRecipe;
}
for (BRecipe recipe : recipes) {
if (recipe.getName(1).equalsIgnoreCase(name)) {
return recipe;
} else if (recipe.getName(10).equalsIgnoreCase(name)) {
return recipe;
}
}
for (BRecipe recipe : recipes) {
if (recipe.getOptionalID().isPresent() && recipe.getOptionalID().get().equalsIgnoreCase(name)) {
return recipe;
}
}
return null;
}
/**
* Get the BRecipe that has that name as its name
*/
@Nullable
public static BRecipe get(String name) {
for (BRecipe recipe : recipes) {
if (recipe.getRecipeName().equalsIgnoreCase(name)) {
return recipe;
}
}
return null;
}
/*public static void saveAddedRecipes(ConfigurationSection cfg) {
int i = 0;
for (BRecipe recipe : getAddedRecipes()) {
if (recipe.isSaveInData()) {
cfg.set(i + ".name", recipe.name);
}
}
}*/
/**
* Builder to easily create Recipes
*/
public static class Builder {
private BRecipe recipe;
public Builder(String name) {
recipe = new BRecipe(name, PotionColor.WATER);
}
public Builder(String... names) {
recipe = new BRecipe(names, PotionColor.WATER);
}
public Builder addIngredient(RecipeItem... item) {
Collections.addAll(recipe.ingredients, item);
return this;
}
public Builder addIngredient(ItemStack... item) {
for (ItemStack i : item) {
CustomItem customItem = new CustomItem(i);
customItem.setAmount(i.getAmount());
recipe.ingredients.add(customItem);
}
return this;
}
public Builder difficulty(int difficulty) {
recipe.difficulty = difficulty;
return this;
}
public Builder color(String colorString) {
recipe.color = PotionColor.fromString(colorString);
return this;
}
public Builder color(PotionColor color) {
recipe.color = color;
return this;
}
public Builder color(Color color) {
recipe.color = PotionColor.fromColor(color);
return this;
}
public Builder cook(int cookTime) {
recipe.cookingTime = cookTime;
return this;
}
public Builder distill(byte distillRuns, int distillTime) {
recipe.distillruns = distillRuns;
recipe.distillTime = distillTime;
return this;
}
public Builder age(int age, byte wood) {
recipe.age = age;
recipe.wood = wood;
return this;
}
public Builder alcohol(int alcohol) {
recipe.alcohol = alcohol;
return this;
}
public Builder addLore(String line) {
return addLore(0, line);
}
/**
* Add a Line of Lore
*
* @param quality 0 for any quality, 1: bad, 2: normal, 3: good
* @param line The Line for custom lore to add
* @return this
*/
public Builder addLore(int quality, String line) {
if (quality < 0 || quality > 3) {
throw new IllegalArgumentException("Lore Quality must be 0 - 3");
}
if (recipe.lore == null) {
recipe.lore = new ArrayList<>();
}
recipe.lore.add(new Tuple<>(quality, line));
return this;
}
/**
* Add Commands that are executed by the player on drinking
*/
public Builder addPlayerCmds(String... cmds) {
ArrayList<Tuple<Integer,String>> playercmds = new ArrayList<>(cmds.length);
for (String cmd : cmds) {
playercmds.add(StringParser.parseQuality(cmd, StringParser.ParseType.CMD));
}
if (recipe.playercmds == null) {
recipe.playercmds = playercmds;
} else {
recipe.playercmds.addAll(playercmds);
}
return this;
}
/**
* Add Commands that are executed by the server on drinking
*/
public Builder addServerCmds(String... cmds) {
ArrayList<Tuple<Integer,String>> servercmds = new ArrayList<>(cmds.length);
for (String cmd : cmds) {
servercmds.add(StringParser.parseQuality(cmd, StringParser.ParseType.CMD));
}
if (recipe.servercmds == null) {
recipe.servercmds = servercmds;
} else {
recipe.servercmds.addAll(servercmds);
}
return this;
}
/**
* Add Message that is sent to the player in chat when he drinks the brew
*/
public Builder drinkMsg(String msg) {
recipe.drinkMsg = msg;
return this;
}
/**
* Add Message that is sent to the player as a small title when he drinks the brew
*/
public Builder drinkTitle(String title) {
recipe.drinkTitle = title;
return this;
}
/**
* Set the Optional ID of this recipe
*/
public Builder setID(String id) {
recipe.optionalID = id;
return this;
}
/**
* Add Custom Model Data for each Quality
*/
public Builder addCustomModelData(int bad, int normal, int good) {
recipe.cmData = new int[] {bad, normal, good};
return this;
}
public Builder addEffects(BEffect... effects) {
Collections.addAll(recipe.effects, effects);
return this;
}
public BRecipe get() {
if (recipe.name == null) {
throw new IllegalArgumentException("Recipe name is null");
}
if (recipe.name.length != 1 && recipe.name.length != 3) {
throw new IllegalArgumentException("Recipe name neither 1 nor 3");
}
if (BRecipe.get(recipe.getRecipeName()) != null) {
throw new IllegalArgumentException("Recipe with name " + recipe.getRecipeName() + " already exists");
}
if (recipe.color == null) {
throw new IllegalArgumentException("Recipe has no color");
}
if (recipe.ingredients == null || recipe.ingredients.isEmpty()) {
throw new IllegalArgumentException("Recipe has no ingredients");
}
if (!recipe.isValid()) {
throw new IllegalArgumentException("Recipe has not valid");
}
for (RecipeItem ingredient : recipe.ingredients) {
ingredient.makeImmutable();
}
return recipe;
}
}
}
| EmeraldHaven/Brewery | src/com/dre/brewery/recipe/BRecipe.java |
213,060 | /*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.youtube.model;
/**
* Model definition for VideoAgeGating.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the YouTube Data API. For a detailed explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class VideoAgeGating extends com.google.api.client.json.GenericJson {
/**
* Indicates whether or not the video has alcoholic beverage content. Only users of legal
* purchasing age in a particular country, as identified by ICAP, can view the content.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.Boolean alcoholContent;
/**
* Age-restricted trailers. For redband trailers and adult-rated video-games. Only users aged 18+
* can view the content. The the field is true the content is restricted to viewers aged 18+.
* Otherwise The field won't be present.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.Boolean restricted;
/**
* Video game rating, if any.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String videoGameRating;
/**
* Indicates whether or not the video has alcoholic beverage content. Only users of legal
* purchasing age in a particular country, as identified by ICAP, can view the content.
* @return value or {@code null} for none
*/
public java.lang.Boolean getAlcoholContent() {
return alcoholContent;
}
/**
* Indicates whether or not the video has alcoholic beverage content. Only users of legal
* purchasing age in a particular country, as identified by ICAP, can view the content.
* @param alcoholContent alcoholContent or {@code null} for none
*/
public VideoAgeGating setAlcoholContent(java.lang.Boolean alcoholContent) {
this.alcoholContent = alcoholContent;
return this;
}
/**
* Age-restricted trailers. For redband trailers and adult-rated video-games. Only users aged 18+
* can view the content. The the field is true the content is restricted to viewers aged 18+.
* Otherwise The field won't be present.
* @return value or {@code null} for none
*/
public java.lang.Boolean getRestricted() {
return restricted;
}
/**
* Age-restricted trailers. For redband trailers and adult-rated video-games. Only users aged 18+
* can view the content. The the field is true the content is restricted to viewers aged 18+.
* Otherwise The field won't be present.
* @param restricted restricted or {@code null} for none
*/
public VideoAgeGating setRestricted(java.lang.Boolean restricted) {
this.restricted = restricted;
return this;
}
/**
* Video game rating, if any.
* @return value or {@code null} for none
*/
public java.lang.String getVideoGameRating() {
return videoGameRating;
}
/**
* Video game rating, if any.
* @param videoGameRating videoGameRating or {@code null} for none
*/
public VideoAgeGating setVideoGameRating(java.lang.String videoGameRating) {
this.videoGameRating = videoGameRating;
return this;
}
@Override
public VideoAgeGating set(String fieldName, Object value) {
return (VideoAgeGating) super.set(fieldName, value);
}
@Override
public VideoAgeGating clone() {
return (VideoAgeGating) super.clone();
}
}
| googleapis/google-api-java-client-services | clients/google-api-services-youtube/v3/1.27.0/com/google/api/services/youtube/model/VideoAgeGating.java |
213,064 | /*
* The MIT License (MIT)
*
* Copyright (c) 2015, 2016 IceDragon200
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package growthcraft.cellar.util;
import java.util.List;
import growthcraft.api.cellar.booze.BoozeEffect;
import growthcraft.api.cellar.booze.BoozeTag;
import growthcraft.api.cellar.CellarRegistry;
import growthcraft.api.core.CoreRegistry;
import growthcraft.api.core.description.Describer;
import growthcraft.core.util.UnitFormatter;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
public class BoozeUtils
{
private BoozeUtils() {}
public static float alcoholToTipsy(float alcoholRate)
{
return alcoholRate * 4;
}
public static boolean isFermentedBooze(Fluid booze)
{
return CoreRegistry.instance().fluidDictionary().hasFluidTags(booze, BoozeTag.FERMENTED);
}
public static void addEffects(Fluid booze, ItemStack stack, World world, EntityPlayer player)
{
if (booze == null) return;
final BoozeEffect effect = CellarRegistry.instance().booze().getEffect(booze);
if (effect != null)
{
effect.apply(world, player, world.rand, null);
}
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static void addInformation(Fluid booze, ItemStack stack, EntityPlayer player, List list, boolean bool)
{
if (booze == null) return;
final String s = UnitFormatter.fluidModifier(booze);
if (s != null) list.add(s);
Describer.getDescription((List<String>)list, booze);
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static void addEffectInformation(Fluid booze, ItemStack stack, EntityPlayer player, List list, boolean bool)
{
if (booze == null) return;
final BoozeEffect effect = CellarRegistry.instance().booze().getEffect(booze);
if (effect != null)
{
effect.getDescription((List<String>)list);
}
}
@SuppressWarnings({"rawtypes", "unchecked"})
public static void addBottleInformation(Fluid booze, ItemStack stack, EntityPlayer player, List list, boolean bool, boolean showDetailed)
{
if (booze == null) return;
addInformation(booze, stack, player, list, bool);
if (showDetailed)
addEffectInformation(booze, stack, player, list, bool);
}
public static boolean hasEffect(Fluid booze)
{
final BoozeEffect effect = CellarRegistry.instance().booze().getEffect(booze);
if (effect != null) return effect.isValid();
return false;
}
}
| GrowthcraftCE/Growthcraft-1.7 | src/java/growthcraft/cellar/util/BoozeUtils.java |
213,065 | package day09_IfStatements;
public class EligibleToBuyAlcohol {
public static void main(String[] args) {
int age = 30;
if(age >= 21){
System.out.println("Eligible");
}else{ // otherwise: age < 21
System.out.println("Not Eligible");
}
}
}
| emuratalieva/JavaProgramming_B23_2021 | src/day09_IfStatements/EligibleToBuyAlcohol.java |
213,066 | package net.tropicraft.core.common.entity.neutral;
import com.google.common.base.Predicate;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.*;
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
import net.minecraft.world.entity.ai.goal.target.OwnerHurtByTargetGoal;
import net.minecraft.world.entity.ai.goal.target.OwnerHurtTargetGoal;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.Arrow;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.HitResult;
import net.tropicraft.core.common.drinks.Drink;
import net.tropicraft.core.common.entity.ai.vmonkey.*;
import net.tropicraft.core.common.item.CocktailItem;
import net.tropicraft.core.common.item.TropicraftItems;
import javax.annotation.Nullable;
public class VMonkeyEntity extends TamableAnimal {
private static final EntityDataAccessor<Byte> DATA_FLAGS = SynchedEntityData.defineId(VMonkeyEntity.class, EntityDataSerializers.BYTE);
private static final int FLAG_CLIMBING = 1 << 0;
public static final Predicate<LivingEntity> FOLLOW_PREDICATE = ent -> {
if (ent == null) return false;
if (!(ent instanceof Player)) return false;
Player player = (Player) ent;
ItemStack heldMain = player.getMainHandItem();
ItemStack heldOff = player.getOffhandItem();
if (heldMain.getItem() instanceof CocktailItem) {
if (CocktailItem.getDrink(heldMain) == Drink.PINA_COLADA) {
return true;
}
}
if (heldOff.getItem() instanceof CocktailItem) {
return CocktailItem.getDrink(heldOff) == Drink.PINA_COLADA;
}
return false;
};
/** Entity this monkey is following around */
private LivingEntity following;
private boolean madAboutStolenAlcohol;
public VMonkeyEntity(EntityType<? extends TamableAnimal> type, Level world) {
super(type, world);
}
@Override
protected void defineSynchedData() {
super.defineSynchedData();
entityData.define(DATA_FLAGS, (byte) 0);
}
public static AttributeSupplier.Builder createAttributes() {
return TamableAnimal.createMobAttributes()
.add(Attributes.MAX_HEALTH, 20.0)
.add(Attributes.MOVEMENT_SPEED, 0.3)
.add(Attributes.ATTACK_DAMAGE, 2.0);
}
@Override
protected void registerGoals() {
super.registerGoals();
goalSelector.addGoal(1, new FloatGoal(this));
goalSelector.addGoal(3, new MonkeyFollowNearestPinaColadaHolderGoal(this, 1.0D, 2.0F, 10.0F));
goalSelector.addGoal(3, new LeapAtTargetGoal(this, 0.4F));
goalSelector.addGoal(3, new MonkeyPickUpPinaColadaGoal(this));
goalSelector.addGoal(2, new MonkeyStealDrinkGoal(this));
goalSelector.addGoal(2, new MonkeySitAndDrinkGoal(this));
goalSelector.addGoal(2, new MonkeyAngryThrowGoal(this));
goalSelector.addGoal(4, new MonkeySitInChairGoal(this));
goalSelector.addGoal(4, new SitWhenOrderedToGoal(this));
goalSelector.addGoal(6, new MeleeAttackGoal(this, 1.0D, true));
goalSelector.addGoal(7, new FollowOwnerGoal(this, 1.0D, 10.0F, 2.0F, false));
goalSelector.addGoal(8, new RandomStrollGoal(this, 1.0D));
goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 8.0F));
goalSelector.addGoal(9, new RandomLookAroundGoal(this));
targetSelector.addGoal(1, new OwnerHurtByTargetGoal(this));
targetSelector.addGoal(2, new OwnerHurtTargetGoal(this));
targetSelector.addGoal(3, new HurtByTargetGoal(this));
}
@Override
public void addAdditionalSaveData(final CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.putByte("MonkeyFlags", getMonkeyFlags());
}
@Override
public void readAdditionalSaveData(final CompoundTag compound) {
super.readAdditionalSaveData(compound);
setMonkeyFlags(compound.getByte("MonkeyFlags"));
}
public LivingEntity getFollowing() {
return following;
}
public void setFollowing(@Nullable final LivingEntity following) {
this.following = following;
}
public boolean selfHoldingDrink(Drink drink) {
ItemStack heldItem = getMainHandItem();
if (heldItem.getItem() instanceof CocktailItem) {
return CocktailItem.getDrink(heldItem) == drink;
}
return false;
}
private void setMonkeyFlags(final byte flags) {
getEntityData().set(DATA_FLAGS, flags);
}
private byte getMonkeyFlags() {
return getEntityData().get(DATA_FLAGS);
}
public boolean isClimbing() {
return getMonkeyFlag(FLAG_CLIMBING);
}
private void setClimbing(boolean state) {
setMonkeyFlag(FLAG_CLIMBING, state);
}
public void setMonkeyFlag(int id, boolean flag) {
if (flag) {
entityData.set(DATA_FLAGS, (byte)(entityData.get(DATA_FLAGS) | id));
} else {
entityData.set(DATA_FLAGS, (byte)(entityData.get(DATA_FLAGS) & ~id));
}
}
private boolean getMonkeyFlag(int flag) {
return (entityData.get(DATA_FLAGS) & flag) != 0;
}
@Override
public InteractionResult mobInteract(Player player, InteractionHand hand) {
ItemStack stack = player.getItemInHand(hand);
if (isTame()) {
if (isOwnedBy(player) && !level().isClientSide) {
this.setOrderedToSit(!isOrderedToSit());
jumping = false;
navigation.stop();
setTarget(null);
setAggressive(false);
}
} else if (!stack.isEmpty() && isFood(stack)) {
if (!player.getAbilities().instabuild) {
stack.shrink(1);
}
if (!level().isClientSide) {
if (random.nextInt(3) == 0) {
setTame(true);
navigation.stop();
setTarget(null);
this.setOrderedToSit(true);
setHealth(20.0F);
setOwnerUUID(player.getUUID());
level().broadcastEntityEvent(this, (byte) 7);
} else {
level().broadcastEntityEvent(this, (byte) 6);
}
}
return InteractionResult.PASS;
}
return super.mobInteract(player, hand);
}
@Override
public boolean isFood(ItemStack stack) {
return CocktailItem.getDrink(stack) == Drink.PINA_COLADA;
}
@Nullable
@Override
public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) {
return null;
}
@Override
public boolean wantsToAttack(LivingEntity target, LivingEntity owner) {
// Only attack players, and only when not tamed
// NOTE: Maybe we want to attack other players though?
return !isTame() && target.getType() == EntityType.PLAYER;
}
@Override
public boolean doHurtTarget(Entity entity) {
boolean damaged = entity.hurt(damageSources().mobAttack(this), (float) getAttribute(Attributes.ATTACK_DAMAGE).getValue());
if (damaged) {
doEnchantDamageEffects(this, entity);
}
return damaged;
}
@Override
public boolean hurt(DamageSource source, float amount) {
if (isInvulnerableTo(source)) {
return false;
} else {
Entity entity = source.getEntity();
this.setOrderedToSit(false);
if (entity != null && entity.getType() != EntityType.PLAYER && !(entity instanceof Arrow)) {
amount = (amount + 1.0F) / 2.0F;
}
return super.hurt(source, amount);
}
}
public boolean isMadAboutStolenAlcohol() {
return madAboutStolenAlcohol;
}
public void setMadAboutStolenAlcohol(boolean madAboutStolenAlcohol) {
this.madAboutStolenAlcohol = madAboutStolenAlcohol;
}
}
| Tropicraft/Tropicraft | src/main/java/net/tropicraft/core/common/entity/neutral/VMonkeyEntity.java |
213,067 | /*
fEMR - fast Electronic Medical Records
Copyright (C) 2014 Team fEMR
fEMR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fEMR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with fEMR. If not, see <http://www.gnu.org/licenses/>. If
you have any questions, contact <[email protected]>.
*/
package femr.common.models;
import java.util.Date;
public class PatientItem {
private int Id;
private int globallyUniqueId;
private String firstName;
private String lastName;
private String phoneNumber;
private String address;
private String city;
private String age;//this is a string representing an integer and "YO"(adult) or "MO"(infant)
private Integer yearsOld;//the age of the patient as an integer. 0 if the patient is less than a year old
private Integer monthsOld;
private Date birth;
private String friendlyDateOfBirth;
private String sex;
private Integer photoId;
private String pathToPhoto;
private int userId;
private Integer weeksPregnant;
private Integer heightFeet;
private Integer heightInches;
//added for femr-136 - dual unit display
private Integer heightFeetDual;
private Integer heightInchesDual;
private Float weight;
//added for femr-136 - dual unit display
private Float weightDual;
// Model in question to modify (thinking of adding my variables here)
private Integer smoker;
private Integer diabetic;
private Integer alcohol;
public PatientItem(){
//default empty values
this.Id = 0;
this.pathToPhoto = "";
}
public int getId() {
return Id;
}
public void setId(int id) {
Id = id;
}
public int getGloballyUniqueId() { return globallyUniqueId; }
public void setGloballyUniqueId(int globallyUniqueId) { this.globallyUniqueId = globallyUniqueId; }
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPhoneNumber() { return phoneNumber; }
public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; }
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public Date getBirth() {
return birth;
}
public void setBirth(Date birth) {
this.birth = birth;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public Integer getPhotoId() {
return photoId;
}
public void setPhotoId(Integer photoId) {
this.photoId = photoId;
}
public String getPathToPhoto() {
return pathToPhoto;
}
public void setPathToPhoto(String pathToPhoto) {
this.pathToPhoto = pathToPhoto;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public Integer getWeeksPregnant() {
return weeksPregnant;
}
public void setWeeksPregnant(Integer weeksPregnant) {
this.weeksPregnant = weeksPregnant;
}
public Integer getHeightFeet() {
return heightFeet;
}
public void setHeightFeet(Integer heightFeet) {
this.heightFeet = heightFeet;
}
public Integer getHeightInches() {
return heightInches;
}
public void setHeightInches(Integer heightInches) {
this.heightInches = heightInches;
}
public Integer getHeightFeetDual() {
return heightFeetDual;
}
public void setHeightFeetDual(Integer heightFeetDual) {
this.heightFeetDual = heightFeetDual;
}
public Integer getHeightInchesDual() {
return heightInchesDual;
}
public void setHeightInchesDual(Integer heightInchesDual) {
this.heightInchesDual = heightInchesDual;
}
public Float getWeight() {
return weight;
}
public void setWeight(Float weight) {
this.weight = weight;
}
public Float getWeightDual() {
return weightDual;
}
public void setWeightDual(Float weightDual) {
this.weightDual = weightDual;
}
public String getFriendlyDateOfBirth() {
return friendlyDateOfBirth;
}
public void setFriendlyDateOfBirth(String friendlyDateOfBirth) {
this.friendlyDateOfBirth = friendlyDateOfBirth;
}
public Integer getYearsOld() {
return yearsOld;
}
public void setYearsOld(Integer yearsOld) {
this.yearsOld = yearsOld;
}
public Integer getMonthsOld() {
return monthsOld;
}
public void setMonthsOld(Integer monthsOld) {
this.monthsOld = monthsOld;
}
public Integer getSmoker() {return smoker;}
public void setSmoker(Integer smoker){this.smoker = smoker;}
public Integer getDiabetes() {return diabetic;}
public void setDiabetic(Integer diabetes){this.diabetic = diabetes;}
public Integer getAlcohol() {return alcohol;}
public void setAlcohol(Integer alcohol){this.alcohol = alcohol;}
}
| CPSECapstone/lemur-femr | app/femr/common/models/PatientItem.java |
213,068 | /*
* Licensed under the EUPL, Version 1.2.
* You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*/
package net.dries007.tfc.common.blocks;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.function.ToIntFunction;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.BedItem;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.FlowerPotBlock;
import net.minecraft.world.level.block.GravelBlock;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.SeaPickleBlock;
import net.minecraft.world.level.block.SignBlock;
import net.minecraft.world.level.block.SlabBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.StairBlock;
import net.minecraft.world.level.block.WallBlock;
import net.minecraft.world.level.block.entity.BellBlockEntity;
import net.minecraft.world.level.block.entity.SignBlockEntity;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
import net.minecraft.world.level.block.state.properties.WoodType;
import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.PushReaction;
import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
import org.jetbrains.annotations.Nullable;
import net.dries007.tfc.client.TFCSounds;
import net.dries007.tfc.common.TFCTags;
import net.dries007.tfc.common.blockentities.AbstractFirepitBlockEntity;
import net.dries007.tfc.common.blockentities.BellowsBlockEntity;
import net.dries007.tfc.common.blockentities.BlastFurnaceBlockEntity;
import net.dries007.tfc.common.blockentities.BloomeryBlockEntity;
import net.dries007.tfc.common.blockentities.BurningLogPileBlockEntity;
import net.dries007.tfc.common.blockentities.CharcoalForgeBlockEntity;
import net.dries007.tfc.common.blockentities.CrucibleBlockEntity;
import net.dries007.tfc.common.blockentities.DecayingBlockEntity;
import net.dries007.tfc.common.blockentities.GlassBasinBlockEntity;
import net.dries007.tfc.common.blockentities.rotation.HandWheelBlockEntity;
import net.dries007.tfc.common.blockentities.HotPouredGlassBlockEntity;
import net.dries007.tfc.common.blockentities.NestBoxBlockEntity;
import net.dries007.tfc.common.blockentities.PitKilnBlockEntity;
import net.dries007.tfc.common.blockentities.PowderkegBlockEntity;
import net.dries007.tfc.common.blockentities.QuernBlockEntity;
import net.dries007.tfc.common.blockentities.TFCBlockEntities;
import net.dries007.tfc.common.blockentities.rotation.PumpBlockEntity;
import net.dries007.tfc.common.blockentities.rotation.TripHammerBlockEntity;
import net.dries007.tfc.common.blocks.crop.Crop;
import net.dries007.tfc.common.blocks.crop.DecayingBlock;
import net.dries007.tfc.common.blocks.crop.TFCPumpkinBlock;
import net.dries007.tfc.common.blocks.devices.BarrelRackBlock;
import net.dries007.tfc.common.blocks.devices.BellowsBlock;
import net.dries007.tfc.common.blocks.devices.BlastFurnaceBlock;
import net.dries007.tfc.common.blocks.devices.BloomeryBlock;
import net.dries007.tfc.common.blocks.devices.BurningLogPileBlock;
import net.dries007.tfc.common.blocks.devices.CharcoalForgeBlock;
import net.dries007.tfc.common.blocks.devices.CrucibleBlock;
import net.dries007.tfc.common.blocks.devices.DoubleIngotPileBlock;
import net.dries007.tfc.common.blocks.devices.FirepitBlock;
import net.dries007.tfc.common.blocks.devices.GrillBlock;
import net.dries007.tfc.common.blocks.devices.IngotPileBlock;
import net.dries007.tfc.common.blocks.devices.JackOLanternBlock;
import net.dries007.tfc.common.blocks.devices.LogPileBlock;
import net.dries007.tfc.common.blocks.devices.NestBoxBlock;
import net.dries007.tfc.common.blocks.devices.PitKilnBlock;
import net.dries007.tfc.common.blocks.devices.PlacedItemBlock;
import net.dries007.tfc.common.blocks.devices.PotBlock;
import net.dries007.tfc.common.blocks.devices.PowderkegBlock;
import net.dries007.tfc.common.blocks.devices.QuernBlock;
import net.dries007.tfc.common.blocks.devices.ScrapingBlock;
import net.dries007.tfc.common.blocks.devices.SheetPileBlock;
import net.dries007.tfc.common.blocks.devices.TFCComposterBlock;
import net.dries007.tfc.common.blocks.plant.KrummholzBlock;
import net.dries007.tfc.common.blocks.rotation.CrankshaftBlock;
import net.dries007.tfc.common.blocks.rotation.FluidPumpBlock;
import net.dries007.tfc.common.blocks.rotation.HandWheelBlock;
import net.dries007.tfc.common.blocks.rotation.FluidPipeBlock;
import net.dries007.tfc.common.blocks.plant.Plant;
import net.dries007.tfc.common.blocks.plant.coral.Coral;
import net.dries007.tfc.common.blocks.plant.coral.TFCSeaPickleBlock;
import net.dries007.tfc.common.blocks.plant.fruit.DeadBananaPlantBlock;
import net.dries007.tfc.common.blocks.plant.fruit.DeadBerryBushBlock;
import net.dries007.tfc.common.blocks.plant.fruit.DeadCaneBlock;
import net.dries007.tfc.common.blocks.plant.fruit.FruitBlocks;
import net.dries007.tfc.common.blocks.rock.Ore;
import net.dries007.tfc.common.blocks.rock.Rock;
import net.dries007.tfc.common.blocks.rock.RockAnvilBlock;
import net.dries007.tfc.common.blocks.rock.RockCategory;
import net.dries007.tfc.common.blocks.soil.ConnectedGrassBlock;
import net.dries007.tfc.common.blocks.soil.SandBlockType;
import net.dries007.tfc.common.blocks.soil.SoilBlockType;
import net.dries007.tfc.common.blocks.wood.TFCCeilingHangingSignBlock;
import net.dries007.tfc.common.blocks.wood.TFCSlabBlock;
import net.dries007.tfc.common.blocks.wood.TFCStairBlock;
import net.dries007.tfc.common.blocks.wood.TFCWallHangingSignBlock;
import net.dries007.tfc.common.blocks.wood.Wood;
import net.dries007.tfc.common.fluids.Alcohol;
import net.dries007.tfc.common.fluids.FluidId;
import net.dries007.tfc.common.fluids.IFluidLoggable;
import net.dries007.tfc.common.fluids.SimpleFluid;
import net.dries007.tfc.common.fluids.TFCFluids;
import net.dries007.tfc.common.items.CandleBlockItem;
import net.dries007.tfc.common.items.TFCItems;
import net.dries007.tfc.common.items.TooltipBlockItem;
import net.dries007.tfc.mixin.accessor.BlockBehaviourAccessor;
import net.dries007.tfc.mixin.accessor.BlockStateBaseAccessor;
import net.dries007.tfc.util.Helpers;
import net.dries007.tfc.util.Metal;
import net.dries007.tfc.util.registry.RegistrationHelpers;
import static net.dries007.tfc.TerraFirmaCraft.*;
/**
* Collection of all TFC blocks.
* Unused is as the registry object fields themselves may be unused but they are required to register each item.
* Whenever possible, avoid using hardcoded references to these, prefer tags or recipes.
*/
@SuppressWarnings("unused")
public final class TFCBlocks
{
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(Registries.BLOCK, MOD_ID);
// Earth
public static final Map<SoilBlockType, Map<SoilBlockType.Variant, RegistryObject<Block>>> SOIL = Helpers.mapOfKeys(SoilBlockType.class, type ->
Helpers.mapOfKeys(SoilBlockType.Variant.class, variant ->
register((type.name() + "/" + variant.name()), () -> type.create(variant))
)
);
public static final Map<SoilBlockType.Variant, DecorationBlockRegistryObject> MUD_BRICK_DECORATIONS = Helpers.mapOfKeys(SoilBlockType.Variant.class, variant -> new DecorationBlockRegistryObject(
register(("mud_bricks/" + variant.name() + "_slab"), () -> new SlabBlock(Properties.of().mapColor(MapColor.DIRT).strength(2.6f).sound(SoundType.WART_BLOCK))),
register(("mud_bricks/" + variant.name() + "_stairs"), () -> new StairBlock(() -> SOIL.get(SoilBlockType.MUD_BRICKS).get(variant).get().defaultBlockState(), Properties.of().mapColor(MapColor.DIRT).strength(2.6f).sound(SoundType.WART_BLOCK).instrument(NoteBlockInstrument.BASEDRUM))),
register(("mud_bricks/" + variant.name() + "_wall"), () -> new WallBlock(Properties.of().mapColor(MapColor.DIRT).strength(2.6f).sound(SoundType.WART_BLOCK)))
));
public static final RegistryObject<Block> SMOOTH_MUD_BRICKS = register("smooth_mud_bricks", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).sound(SoundType.MUD_BRICKS).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.6f)));
public static final RegistryObject<Block> PEAT = register("peat", () -> new Block(Properties.of().mapColor(MapColor.TERRACOTTA_BLACK).strength(3.0F).sound(TFCSounds.PEAT)));
public static final RegistryObject<Block> PEAT_GRASS = register("peat_grass", () -> new ConnectedGrassBlock(Properties.of().mapColor(MapColor.GRASS).randomTicks().strength(3.0F).sound(TFCSounds.PEAT), PEAT, null, null));
public static final RegistryObject<Block> RED_KAOLIN_CLAY = register("red_kaolin_clay", () -> new Block(Properties.of().mapColor(MapColor.COLOR_RED).strength(4.0F).sound(SoundType.GRAVEL)));
public static final RegistryObject<Block> PINK_KAOLIN_CLAY = register("pink_kaolin_clay", () -> new Block(Properties.of().mapColor(MapColor.COLOR_PINK).strength(4.5F).sound(SoundType.GRAVEL)));
public static final RegistryObject<Block> WHITE_KAOLIN_CLAY = register("white_kaolin_clay", () -> new Block(Properties.of().mapColor(MapColor.TERRACOTTA_WHITE).strength(5.0F).sound(SoundType.GRAVEL)));
public static final RegistryObject<Block> KAOLIN_CLAY_GRASS = register("kaolin_clay_grass", () -> new ConnectedGrassBlock(Properties.of().mapColor(MapColor.GRASS).randomTicks().strength(5.0F).sound(SoundType.GRAVEL), RED_KAOLIN_CLAY, null, null));
public static final Map<SandBlockType, RegistryObject<Block>> SAND = Helpers.mapOfKeys(SandBlockType.class, type ->
register(("sand/" + type.name()), type::create)
);
public static final Map<SandBlockType, Map<SandstoneBlockType, RegistryObject<Block>>> SANDSTONE = Helpers.mapOfKeys(SandBlockType.class, color ->
Helpers.mapOfKeys(SandstoneBlockType.class, type ->
register((type.name() + "_sandstone/" + color.name()), () -> new Block(type.properties(color)))
)
);
public static final Map<SandBlockType, Map<SandstoneBlockType, DecorationBlockRegistryObject>> SANDSTONE_DECORATIONS = Helpers.mapOfKeys(SandBlockType.class, color ->
Helpers.mapOfKeys(SandstoneBlockType.class, type -> new DecorationBlockRegistryObject(
register((type.name() + "_sandstone/" + color.name() + "_slab"), () -> new SlabBlock(type.properties(color))),
register((type.name() + "_sandstone/" + color.name() + "_stairs"), () -> new StairBlock(() -> SANDSTONE.get(color).get(type).get().defaultBlockState(), type.properties(color))),
register((type.name() + "_sandstone/" + color.name() + "_wall"), () -> new WallBlock(type.properties(color)))
))
);
public static final Map<GroundcoverBlockType, RegistryObject<Block>> GROUNDCOVER = Helpers.mapOfKeys(GroundcoverBlockType.class, type ->
register(("groundcover/" + type.name()), () -> new GroundcoverBlock(type), type.createBlockItem())
);
public static final RegistryObject<Block> SEA_ICE = register("sea_ice", () -> new SeaIceBlock(Properties.copy(Blocks.ICE).isValidSpawn(TFCBlocks::onlyColdMobs)));
public static final RegistryObject<SnowPileBlock> SNOW_PILE = register("snow_pile", () -> new SnowPileBlock(ExtendedProperties.of(Blocks.SNOW).randomTicks().blockEntity(TFCBlockEntities.PILE)));
public static final RegistryObject<IcePileBlock> ICE_PILE = register("ice_pile", () -> new IcePileBlock(ExtendedProperties.of(Blocks.ICE).randomTicks().blockEntity(TFCBlockEntities.PILE)));
public static final RegistryObject<ThinSpikeBlock> ICICLE = register("icicle", () -> new IcicleBlock(Properties.of().mapColor(MapColor.ICE).pushReaction(PushReaction.DESTROY).noLootTable().strength(0.4f).sound(SoundType.GLASS).noOcclusion().randomTicks()));
public static final RegistryObject<ThinSpikeBlock> CALCITE = register("calcite", () -> new ThinSpikeBlock(Properties.of().mapColor(MapColor.ICE).pushReaction(PushReaction.DESTROY).noLootTable().strength(0.2f).sound(TFCSounds.THIN)));
// Ores
public static final Map<Rock, Map<Ore, RegistryObject<Block>>> ORES = Helpers.mapOfKeys(Rock.class, rock ->
Helpers.mapOfKeys(Ore.class, ore -> !ore.isGraded(), ore ->
register(("ore/" + ore.name() + "/" + rock.name()), () -> ore.create(rock))
)
);
public static final Map<Rock, Map<Ore, Map<Ore.Grade, RegistryObject<Block>>>> GRADED_ORES = Helpers.mapOfKeys(Rock.class, rock ->
Helpers.mapOfKeys(Ore.class, Ore::isGraded, ore ->
Helpers.mapOfKeys(Ore.Grade.class, grade ->
register(("ore/" + grade.name() + "_" + ore.name() + "/" + rock.name()), () -> ore.create(rock))
)
)
);
public static final Map<Ore, RegistryObject<Block>> SMALL_ORES = Helpers.mapOfKeys(Ore.class, Ore::isGraded, type ->
register(("ore/small_" + type.name()), () -> GroundcoverBlock.looseOre(Properties.of().mapColor(MapColor.GRASS).strength(0.05F, 0.0F).sound(SoundType.NETHER_ORE).noCollission().pushReaction(PushReaction.DESTROY)))
);
public static final Map<Rock, Map<OreDeposit, RegistryObject<Block>>> ORE_DEPOSITS = Helpers.mapOfKeys(Rock.class, rock ->
Helpers.mapOfKeys(OreDeposit.class, ore ->
register("deposit/" + ore.name() + "/" + rock.name(), () -> new Block(Block.Properties.of().mapColor(MapColor.STONE).sound(SoundType.GRAVEL).strength(rock.category().hardness(2.0f)))) // Same hardness as gravel
)
);
// Rock Stuff
public static final Map<Rock, Map<Rock.BlockType, RegistryObject<Block>>> ROCK_BLOCKS = Helpers.mapOfKeys(Rock.class, rock ->
Helpers.mapOfKeys(Rock.BlockType.class, type ->
register(("rock/" + type.name() + "/" + rock.name()), () -> type.create(rock))
)
);
public static final Map<Rock, Map<Rock.BlockType, DecorationBlockRegistryObject>> ROCK_DECORATIONS = Helpers.mapOfKeys(Rock.class, rock ->
Helpers.mapOfKeys(Rock.BlockType.class, Rock.BlockType::hasVariants, type -> new DecorationBlockRegistryObject(
register(("rock/" + type.name() + "/" + rock.name()) + "_slab", () -> type.createSlab(rock)),
register(("rock/" + type.name() + "/" + rock.name()) + "_stairs", () -> type.createStairs(rock)),
register(("rock/" + type.name() + "/" + rock.name()) + "_wall", () -> type.createWall(rock))
))
);
public static final Map<Rock, RegistryObject<Block>> ROCK_ANVILS = Helpers.mapOfKeys(Rock.class, rock -> rock.category() == RockCategory.IGNEOUS_EXTRUSIVE || rock.category() == RockCategory.IGNEOUS_INTRUSIVE, rock ->
register("rock/anvil/" + rock.name(), () -> new RockAnvilBlock(ExtendedProperties.of().mapColor(MapColor.STONE).sound(SoundType.STONE).strength(2, 10).requiresCorrectToolForDrops().blockEntity(TFCBlockEntities.ANVIL), TFCBlocks.ROCK_BLOCKS.get(rock).get(Rock.BlockType.RAW)))
);
public static final Map<Rock, RegistryObject<Block>> MAGMA_BLOCKS = Helpers.mapOfKeys(Rock.class, rock -> rock.category() == RockCategory.IGNEOUS_EXTRUSIVE || rock.category() == RockCategory.IGNEOUS_INTRUSIVE, rock ->
register("rock/magma/" + rock.name(), () -> new TFCMagmaBlock(Properties.of().mapColor(MapColor.NETHER).requiresCorrectToolForDrops().lightLevel(s -> 6).randomTicks().strength(0.5F).isValidSpawn((state, level, pos, type) -> type.fireImmune()).hasPostProcess(TFCBlocks::always)))
);
// Metals
public static final Map<Metal.Default, Map<Metal.BlockType, RegistryObject<Block>>> METALS = Helpers.mapOfKeys(Metal.Default.class, metal ->
Helpers.mapOfKeys(Metal.BlockType.class, type -> type.has(metal), type ->
register(type.createName(metal), type.create(metal), type.createBlockItem(new Item.Properties()))
)
);
public static final Map<FluidId, RegistryObject<FluidCauldronBlock>> CAULDRONS = FluidId.mapOf(fluid ->
registerNoItem("cauldron/" + fluid.name(), () -> new FluidCauldronBlock(Properties.copy(Blocks.CAULDRON)))
);
// Wood
public static final Map<Wood, Map<Wood.BlockType, RegistryObject<Block>>> WOODS = Helpers.mapOfKeys(Wood.class, wood ->
Helpers.mapOfKeys(Wood.BlockType.class, type ->
register(type.nameFor(wood), type.create(wood), type.createBlockItem(wood, new Item.Properties()))
)
);
public static final Map<Wood, Map<Metal.Default, RegistryObject<TFCCeilingHangingSignBlock>>> CEILING_HANGING_SIGNS = registerHangingSigns("hanging_sign", TFCCeilingHangingSignBlock::new);
public static final Map<Wood, Map<Metal.Default, RegistryObject<TFCWallHangingSignBlock>>> WALL_HANGING_SIGNS = registerHangingSigns("wall_hanging_sign", TFCWallHangingSignBlock::new);
public static final RegistryObject<Block> PALM_MOSAIC = register("wood/planks/palm_mosaic", () -> new Block(Properties.copy(Blocks.BAMBOO_MOSAIC)));
public static final RegistryObject<Block> PALM_MOSAIC_STAIRS = register("wood/planks/palm_mosaic_stairs", () -> new TFCStairBlock(() -> PALM_MOSAIC.get().defaultBlockState(), ExtendedProperties.of(Blocks.BAMBOO_MOSAIC_STAIRS).flammableLikePlanks()));
public static final RegistryObject<Block> PALM_MOSAIC_SLAB = register("wood/planks/palm_mosaic_slab", () -> new TFCSlabBlock(ExtendedProperties.of(Blocks.BAMBOO_MOSAIC_SLAB).flammableLikePlanks()));
public static final RegistryObject<Block> TREE_ROOTS = register("tree_roots", () -> new TreeRootsBlock(ExtendedProperties.of().mapColor(MapColor.PODZOL).instrument(NoteBlockInstrument.BASS).strength(0.7F).randomTicks().sound(SoundType.MANGROVE_ROOTS).noOcclusion().isSuffocating(TFCBlocks::never).isViewBlocking(TFCBlocks::never).noOcclusion().ignitedByLava()));
// Flora
public static final Map<Plant, RegistryObject<Block>> PLANTS = Helpers.mapOfKeys(Plant.class, plant ->
register(("plant/" + plant.name()), plant::create, plant.createBlockItem(new Item.Properties()))
);
public static final Map<Plant, RegistryObject<Block>> POTTED_PLANTS = Helpers.mapOfKeys(Plant.class, Plant::hasFlowerPot, plant ->
registerNoItem(("plant/potted/" + plant.name()), () -> new FlowerPotBlock(() -> (FlowerPotBlock) Blocks.FLOWER_POT, PLANTS.get(plant), BlockBehaviour.Properties.copy(Blocks.POTTED_ACACIA_SAPLING)))
);
public static final Map<Crop, RegistryObject<Block>> CROPS = Helpers.mapOfKeys(Crop.class, crop ->
registerNoItem("crop/" + crop.name(), crop::create)
);
public static final Map<Crop, RegistryObject<Block>> DEAD_CROPS = Helpers.mapOfKeys(Crop.class, crop ->
registerNoItem("dead_crop/" + crop.name(), crop::createDead)
);
public static final Map<Crop, RegistryObject<Block>> WILD_CROPS = Helpers.mapOfKeys(Crop.class, crop ->
register("wild_crop/" + crop.name(), crop::createWild)
);
public static final Map<Coral, Map<Coral.BlockType, RegistryObject<Block>>> CORAL = Helpers.mapOfKeys(Coral.class, color ->
Helpers.mapOfKeys(Coral.BlockType.class, type ->
register("coral/" + color.toString() + "_" + type.toString(), type.create(color), type.createBlockItem(new Item.Properties()))
)
);
public static final RegistryObject<Block> PINE_KRUMMHOLZ = register("plant/pine_krummholz", () -> new KrummholzBlock(ExtendedProperties.of().mapColor(MapColor.PLANT).strength(8f).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY).flammableLikeLogs()));
public static final RegistryObject<Block> SPRUCE_KRUMMHOLZ = register("plant/spruce_krummholz", () -> new KrummholzBlock(ExtendedProperties.of().mapColor(MapColor.PLANT).strength(8f).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY).flammableLikeLogs()));
public static final RegistryObject<Block> WHITE_CEDAR_KRUMMHOLZ = register("plant/white_cedar_krummholz", () -> new KrummholzBlock(ExtendedProperties.of().mapColor(MapColor.PLANT).strength(8f).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY).flammableLikeLogs()));
public static final RegistryObject<Block> DOUGLAS_FIR_KRUMMHOLZ = register("plant/douglas_fir_krummholz", () -> new KrummholzBlock(ExtendedProperties.of().mapColor(MapColor.PLANT).strength(8f).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY).flammableLikeLogs()));
public static final RegistryObject<Block> ASPEN_KRUMMHOLZ = register("plant/aspen_krummholz", () -> new KrummholzBlock(ExtendedProperties.of().mapColor(MapColor.PLANT).strength(8f).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY).flammableLikeLogs()));
public static final RegistryObject<Block> POTTED_PINE_KRUMMHOLZ = registerNoItem("plant/potted/pine_krummholz", () -> new FlowerPotBlock(() -> (FlowerPotBlock) Blocks.FLOWER_POT, PINE_KRUMMHOLZ, BlockBehaviour.Properties.copy(Blocks.POTTED_ACACIA_SAPLING)));
public static final RegistryObject<Block> POTTED_SPRUCE_KRUMMHOLZ = registerNoItem("plant/potted/spruce_krummholz", () -> new FlowerPotBlock(() -> (FlowerPotBlock) Blocks.FLOWER_POT, PINE_KRUMMHOLZ, BlockBehaviour.Properties.copy(Blocks.POTTED_ACACIA_SAPLING)));
public static final RegistryObject<Block> POTTED_WHITE_CEDAR_KRUMMHOLZ = registerNoItem("plant/potted/white_cedar_krummholz", () -> new FlowerPotBlock(() -> (FlowerPotBlock) Blocks.FLOWER_POT, PINE_KRUMMHOLZ, BlockBehaviour.Properties.copy(Blocks.POTTED_ACACIA_SAPLING)));
public static final RegistryObject<Block> POTTED_DOUGLAS_FIR_KRUMMHOLZ = registerNoItem("plant/potted/douglas_fir_krummholz", () -> new FlowerPotBlock(() -> (FlowerPotBlock) Blocks.FLOWER_POT, PINE_KRUMMHOLZ, BlockBehaviour.Properties.copy(Blocks.POTTED_ACACIA_SAPLING)));
public static final RegistryObject<Block> POTTED_ASPEN_KRUMMHOLZ = registerNoItem("plant/potted/aspen_krummholz", () -> new FlowerPotBlock(() -> (FlowerPotBlock) Blocks.FLOWER_POT, PINE_KRUMMHOLZ, BlockBehaviour.Properties.copy(Blocks.POTTED_ACACIA_SAPLING)));
public static final RegistryObject<Block> ROTTEN_PUMPKIN = registerNoItem("rotten_pumpkin", () -> new Block(Properties.of().mapColor(MapColor.COLOR_ORANGE).strength(1.0F).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY)));
public static final RegistryObject<Block> ROTTEN_MELON = registerNoItem("rotten_melon", () -> new Block(Properties.of().mapColor(MapColor.COLOR_GREEN).strength(1.0F).sound(SoundType.WOOD).pushReaction(PushReaction.DESTROY)));
public static final RegistryObject<Block> PUMPKIN = register("pumpkin", () -> new TFCPumpkinBlock(ExtendedProperties.of(MapColor.COLOR_ORANGE).mapColor(MapColor.COLOR_ORANGE).strength(1.0F).sound(SoundType.WOOD).blockEntity(TFCBlockEntities.DECAYING).serverTicks(DecayingBlockEntity::serverTick).instrument(NoteBlockInstrument.DIDGERIDOO).pushReaction(PushReaction.DESTROY), ROTTEN_PUMPKIN), b -> new BlockItem(b, new Item.Properties()));
public static final RegistryObject<Block> MELON = register("melon", () -> new DecayingBlock(ExtendedProperties.of(MapColor.COLOR_ORANGE).mapColor(MapColor.COLOR_GREEN).strength(1.0F).sound(SoundType.WOOD).blockEntity(TFCBlockEntities.DECAYING).serverTicks(DecayingBlockEntity::serverTick).instrument(NoteBlockInstrument.DIDGERIDOO).pushReaction(PushReaction.DESTROY), ROTTEN_MELON), b -> new BlockItem(b, new Item.Properties()));
public static final RegistryObject<Block> SEA_PICKLE = register("sea_pickle", () -> new TFCSeaPickleBlock(Properties.of().pushReaction(PushReaction.DESTROY).mapColor(MapColor.COLOR_GREEN).pushReaction(PushReaction.DESTROY).lightLevel((state) -> TFCSeaPickleBlock.isDead(state) ? 0 : 3 + 3 * state.getValue(SeaPickleBlock.PICKLES)).sound(SoundType.SLIME_BLOCK).noOcclusion()));
public static final Map<FruitBlocks.StationaryBush, RegistryObject<Block>> STATIONARY_BUSHES = Helpers.mapOfKeys(FruitBlocks.StationaryBush.class, bush -> register("plant/" + bush.name() + "_bush", bush::create));
public static final Map<FruitBlocks.SpreadingBush, RegistryObject<Block>> SPREADING_CANES = Helpers.mapOfKeys(FruitBlocks.SpreadingBush.class, bush -> registerNoItem("plant/" + bush.name() + "_bush_cane", bush::createCane));
public static final Map<FruitBlocks.SpreadingBush, RegistryObject<Block>> SPREADING_BUSHES = Helpers.mapOfKeys(FruitBlocks.SpreadingBush.class, bush -> register("plant/" + bush.name() + "_bush", bush::createBush));
public static final RegistryObject<Block> CRANBERRY_BUSH = register("plant/cranberry_bush", FruitBlocks::createCranberry);
public static final RegistryObject<Block> DEAD_BERRY_BUSH = registerNoItem("plant/dead_berry_bush", () -> new DeadBerryBushBlock(ExtendedProperties.of(MapColor.PLANT).strength(0.6f).noOcclusion().sound(SoundType.SWEET_BERRY_BUSH).randomTicks().blockEntity(TFCBlockEntities.TICK_COUNTER).flammable(120, 90)));
public static final RegistryObject<Block> DEAD_BANANA_PLANT = registerNoItem("plant/dead_banana_plant", () -> new DeadBananaPlantBlock(ExtendedProperties.of(MapColor.PLANT).strength(0.6f).noOcclusion().sound(SoundType.SWEET_BERRY_BUSH).blockEntity(TFCBlockEntities.TICK_COUNTER).flammable(120, 90)));
public static final RegistryObject<Block> DEAD_CANE = registerNoItem("plant/dead_cane", () -> new DeadCaneBlock(ExtendedProperties.of(MapColor.PLANT).strength(0.6f).noOcclusion().sound(SoundType.SWEET_BERRY_BUSH).randomTicks().blockEntity(TFCBlockEntities.TICK_COUNTER).flammable(120, 90)));
public static final Map<FruitBlocks.Tree, RegistryObject<Block>> FRUIT_TREE_LEAVES = Helpers.mapOfKeys(FruitBlocks.Tree.class, tree -> register("plant/" + tree.name() + "_leaves", tree::createLeaves));
public static final Map<FruitBlocks.Tree, RegistryObject<Block>> FRUIT_TREE_BRANCHES = Helpers.mapOfKeys(FruitBlocks.Tree.class, tree -> registerNoItem("plant/" + tree.name() + "_branch", tree::createBranch));
public static final Map<FruitBlocks.Tree, RegistryObject<Block>> FRUIT_TREE_GROWING_BRANCHES = Helpers.mapOfKeys(FruitBlocks.Tree.class, tree -> registerNoItem("plant/" + tree.name() + "_growing_branch", tree::createGrowingBranch));
public static final Map<FruitBlocks.Tree, RegistryObject<Block>> FRUIT_TREE_SAPLINGS = Helpers.mapOfKeys(FruitBlocks.Tree.class, tree -> register("plant/" + tree.name() + "_sapling", tree::createSapling));
public static final Map<FruitBlocks.Tree, RegistryObject<Block>> FRUIT_TREE_POTTED_SAPLINGS = Helpers.mapOfKeys(FruitBlocks.Tree.class, tree -> registerNoItem("plant/potted/" + tree.name() + "_sapling", tree::createPottedSapling));
public static final RegistryObject<Block> BANANA_PLANT = registerNoItem("plant/banana_plant", FruitBlocks::createBananaPlant);
public static final RegistryObject<Block> BANANA_SAPLING = register("plant/banana_sapling", FruitBlocks::createBananaSapling);
public static final RegistryObject<Block> BANANA_POTTED_SAPLING = registerNoItem("plant/potted/banana_sapling", FruitBlocks::createPottedBananaSapling);
// Decorations
public static final RegistryObject<Block> PLAIN_ALABASTER = register("alabaster/raw", () -> new Block(Properties.of().mapColor(MapColor.STONE).requiresCorrectToolForDrops().strength(1.5F, 6.0F)));
public static final RegistryObject<Block> PLAIN_ALABASTER_BRICKS = register("alabaster/bricks", () -> new Block(Properties.of().mapColor(MapColor.STONE).requiresCorrectToolForDrops().strength(1.5F, 6.0F)));
public static final RegistryObject<Block> PLAIN_POLISHED_ALABASTER = register("alabaster/polished", () -> new Block(Properties.of().mapColor(MapColor.STONE).requiresCorrectToolForDrops().strength(1.5F, 6.0F)));
public static final RegistryObject<Block> AGGREGATE = register("aggregate", () -> new GravelBlock(Properties.copy(Blocks.GRAVEL).strength(0.6F).sound(SoundType.GRAVEL)));
public static final Map<DyeColor, RegistryObject<Block>> RAW_ALABASTER = Helpers.mapOfKeys(DyeColor.class, color ->
register(("alabaster/raw/" + color.getName()), () -> new Block(Properties.of().mapColor(color.getMapColor()).requiresCorrectToolForDrops().strength(1.0F, 6.0F)))
);
public static final Map<DyeColor, RegistryObject<Block>> ALABASTER_BRICKS = Helpers.mapOfKeys(DyeColor.class, color ->
register(("alabaster/bricks/" + color.getName()), () -> new Block(Properties.of().mapColor(color.getMapColor()).requiresCorrectToolForDrops().strength(1.5F, 6.0F)))
);
public static final Map<DyeColor, RegistryObject<Block>> POLISHED_ALABASTER = Helpers.mapOfKeys(DyeColor.class, color ->
register(("alabaster/polished/" + color.getName()), () -> new Block(Properties.of().mapColor(color.getMapColor()).requiresCorrectToolForDrops().strength(1.5F, 6.0F)))
);
public static final Map<DyeColor, DecorationBlockRegistryObject> ALABASTER_BRICK_DECORATIONS = Helpers.mapOfKeys(DyeColor.class, color -> new DecorationBlockRegistryObject(
register(("alabaster/bricks/" + color.getName() + "_slab"), () -> new SlabBlock(Properties.of().mapColor(color.getMapColor()).requiresCorrectToolForDrops().strength(1.5F, 6.0F))),
register(("alabaster/bricks/" + color.getName() + "_stairs"), () -> new StairBlock(() -> ALABASTER_BRICKS.get(color).get().defaultBlockState(), Properties.of().mapColor(color.getMapColor()).requiresCorrectToolForDrops().strength(1.5F, 6.0F))),
register(("alabaster/bricks/" + color.getName() + "_wall"), () -> new WallBlock(Properties.of().mapColor(color.getMapColor()).requiresCorrectToolForDrops().strength(1.5F, 6.0F)))
)
);
public static final Map<DyeColor, DecorationBlockRegistryObject> ALABASTER_POLISHED_DECORATIONS = Helpers.mapOfKeys(DyeColor.class, color -> new DecorationBlockRegistryObject(
register(("alabaster/polished/" + color.getName() + "_slab"), () -> new SlabBlock(Properties.of().mapColor(color.getMapColor()).requiresCorrectToolForDrops().strength(1.5F, 6.0F))),
register(("alabaster/polished/" + color.getName() + "_stairs"), () -> new StairBlock(() -> ALABASTER_BRICKS.get(color).get().defaultBlockState(), Properties.of().mapColor(color.getMapColor()).requiresCorrectToolForDrops().strength(1.5F, 6.0F))),
register(("alabaster/polished/" + color.getName() + "_wall"), () -> new WallBlock(Properties.of().mapColor(color.getMapColor()).requiresCorrectToolForDrops().strength(1.5F, 6.0F)))
)
);
public static final Map<DyeColor, RegistryObject<Block>> COLORED_POURED_GLASS = Helpers.mapOfKeys(DyeColor.class, color -> register(color.getSerializedName() + "_poured_glass", () -> new PouredGlassBlock(ExtendedProperties.of().pushReaction(PushReaction.DESTROY).strength(0.3F).sound(SoundType.GLASS).noOcclusion().requiresCorrectToolForDrops(), () -> PouredGlassBlock.getStainedGlass(color))));
public static final RegistryObject<Block> POURED_GLASS = register("poured_glass", () -> new PouredGlassBlock(ExtendedProperties.of().strength(0.3F).sound(SoundType.GLASS).pushReaction(PushReaction.DESTROY).noOcclusion().requiresCorrectToolForDrops(), () -> Items.GLASS_PANE));
public static final RegistryObject<Block> HOT_POURED_GLASS = registerNoItem("hot_poured_glass", () -> new HotPouredGlassBlock(ExtendedProperties.of().strength(0.3F).lightLevel(s -> 10).sound(SoundType.GLASS).pushReaction(PushReaction.DESTROY).noOcclusion().noLootTable().pathType(BlockPathTypes.DANGER_FIRE).blockEntity(TFCBlockEntities.HOT_POURED_GLASS).ticks(HotPouredGlassBlockEntity::tick)));
public static final RegistryObject<Block> GLASS_BASIN = registerNoItem("glass_basin", () -> new GlassBasinBlock(ExtendedProperties.of().strength(0.3f).lightLevel(s -> 10).sound(SoundType.GLASS).pushReaction(PushReaction.DESTROY).noOcclusion().noLootTable().pathType(BlockPathTypes.DANGER_FIRE).blockEntity(TFCBlockEntities.GLASS_BASIN).dynamicShape().ticks(GlassBasinBlockEntity::ticks)));
public static final RegistryObject<Block> FIRE_BRICKS = register("fire_bricks", () -> new Block(Properties.of().mapColor(MapColor.COLOR_RED).requiresCorrectToolForDrops().strength(2.0F, 6.0F)));
public static final RegistryObject<Block> FIRE_CLAY_BLOCK = register("fire_clay_block", () -> new Block(Properties.of().mapColor(MapColor.CLAY).strength(0.6F).sound(SoundType.GRAVEL)));
public static final RegistryObject<Block> WATTLE = register("wattle", () -> new WattleBlock(ExtendedProperties.of(MapColor.WOOD).strength(0.3F).noOcclusion().sound(SoundType.SCAFFOLDING).flammable(60, 30)));
public static final RegistryObject<Block> UNSTAINED_WATTLE = register("wattle/unstained", () -> new StainedWattleBlock(ExtendedProperties.of(MapColor.WOOD).strength(0.3F).sound(SoundType.SCAFFOLDING).flammable(60, 30)));
public static final Map<DyeColor, RegistryObject<Block>> STAINED_WATTLE = Helpers.mapOfKeys(DyeColor.class, color ->
register("wattle/" + color.getName(), () -> new StainedWattleBlock(ExtendedProperties.of(MapColor.WOOD).strength(0.3F).sound(SoundType.SCAFFOLDING).flammable(60, 30)))
);
// Misc
public static final RegistryObject<Block> THATCH = register("thatch", () -> new ThatchBlock(ExtendedProperties.of(MapColor.SAND).strength(0.6F, 0.4F).noOcclusion().isViewBlocking(TFCBlocks::never).sound(TFCSounds.THATCH).flammable(50, 100)));
public static final RegistryObject<Block> THATCH_BED = register("thatch_bed", () -> new ThatchBedBlock(ExtendedProperties.of(MapColor.SAND).sound(TFCSounds.THATCH).strength(0.6F, 0.4F).flammable(50, 100).pushReaction(PushReaction.DESTROY).blockEntity(TFCBlockEntities.THATCH_BED)), b -> new BedItem(b, new Item.Properties()));
public static final RegistryObject<Block> LOG_PILE = registerNoItem("log_pile", () -> new LogPileBlock(ExtendedProperties.of(MapColor.WOOD).strength(0.6F).sound(SoundType.WOOD).flammable(60, 30).blockEntity(TFCBlockEntities.LOG_PILE)));
public static final RegistryObject<Block> BURNING_LOG_PILE = registerNoItem("burning_log_pile", () -> new BurningLogPileBlock(ExtendedProperties.of(MapColor.WOOD).randomTicks().strength(0.6F).sound(SoundType.WOOD).flammableLikeLogs().blockEntity(TFCBlockEntities.BURNING_LOG_PILE).serverTicks(BurningLogPileBlockEntity::serverTick)));
public static final RegistryObject<Block> FIREPIT = register("firepit", () -> new FirepitBlock(ExtendedProperties.of(MapColor.DIRT).strength(0.4F, 0.4F).sound(SoundType.NETHER_WART).randomTicks().noOcclusion().lightLevel(litBlockEmission(15)).blockEntity(TFCBlockEntities.FIREPIT).pathType(BlockPathTypes.DAMAGE_FIRE).<AbstractFirepitBlockEntity<?>>ticks(AbstractFirepitBlockEntity::serverTick, AbstractFirepitBlockEntity::clientTick)));
public static final RegistryObject<Block> GRILL = register("grill", () -> new GrillBlock(ExtendedProperties.of(MapColor.DIRT).strength(0.4F, 0.4F).sound(SoundType.NETHER_WART).randomTicks().noOcclusion().lightLevel(litBlockEmission(15)).blockEntity(TFCBlockEntities.GRILL).pathType(BlockPathTypes.DAMAGE_FIRE).<AbstractFirepitBlockEntity<?>>ticks(AbstractFirepitBlockEntity::serverTick, AbstractFirepitBlockEntity::clientTick)));
public static final RegistryObject<Block> POT = register("pot", () -> new PotBlock(ExtendedProperties.of(MapColor.DIRT).strength(0.4F, 0.4F).sound(SoundType.NETHER_WART).randomTicks().noOcclusion().lightLevel(litBlockEmission(15)).blockEntity(TFCBlockEntities.POT).pathType(BlockPathTypes.DAMAGE_FIRE).<AbstractFirepitBlockEntity<?>>ticks(AbstractFirepitBlockEntity::serverTick, AbstractFirepitBlockEntity::clientTick)));
public static final RegistryObject<Block> BELLOWS = register("bellows", () -> new BellowsBlock(ExtendedProperties.of(MapColor.WOOD).noOcclusion().dynamicShape().pushReaction(PushReaction.DESTROY).sound(SoundType.WOOD).strength(3.0f).blockEntity(TFCBlockEntities.BELLOWS).ticks(BellowsBlockEntity::tickBoth)));
public static final RegistryObject<Block> POWDERKEG = register("powderkeg", () -> new PowderkegBlock(ExtendedProperties.of(MapColor.WOOD).noOcclusion().dynamicShape().sound(SoundType.WOOD).strength(2.5f).blockEntity(TFCBlockEntities.POWDERKEG).serverTicks(PowderkegBlockEntity::serverTick)), block -> new TooltipBlockItem(block, new Item.Properties()));
public static final RegistryObject<Block> BARREL_RACK = register("barrel_rack", () -> new BarrelRackBlock(ExtendedProperties.of(MapColor.WOOD).sound(SoundType.WOOD).flammableLikePlanks().strength(4f)));
public static final RegistryObject<Block> PLACED_ITEM = registerNoItem("placed_item", () -> new PlacedItemBlock(ExtendedProperties.of().instabreak().sound(SoundType.STEM).noOcclusion().blockEntity(TFCBlockEntities.PLACED_ITEM)));
public static final RegistryObject<Block> SCRAPING = registerNoItem("scraping", () -> new ScrapingBlock(ExtendedProperties.of().strength(0.2F).sound(SoundType.STEM).noOcclusion().blockEntity(TFCBlockEntities.SCRAPING)));
public static final RegistryObject<Block> PIT_KILN = registerNoItem("pit_kiln", () -> new PitKilnBlock(ExtendedProperties.of(MapColor.WOOD).sound(SoundType.WOOD).strength(0.6f).noOcclusion().blockEntity(TFCBlockEntities.PIT_KILN).serverTicks(PitKilnBlockEntity::serverTick)));
public static final RegistryObject<Block> QUERN = register("quern", () -> new QuernBlock(ExtendedProperties.of().mapColor(MapColor.STONE).strength(0.5F, 2.0F).sound(SoundType.BASALT).noOcclusion().blockEntity(TFCBlockEntities.QUERN).ticks(QuernBlockEntity::serverTick, QuernBlockEntity::clientTick)));
public static final RegistryObject<Block> CHARCOAL_PILE = registerNoItem("charcoal_pile", () -> new CharcoalPileBlock(Properties.of().mapColor(MapColor.COLOR_BLACK).strength(0.2F).sound(TFCSounds.CHARCOAL).pushReaction(PushReaction.DESTROY).isViewBlocking((state, level, pos) -> state.getValue(CharcoalPileBlock.LAYERS) >= 8).isSuffocating((state, level, pos) -> state.getValue(CharcoalPileBlock.LAYERS) >= 8)));
public static final RegistryObject<Block> CHARCOAL_FORGE = registerNoItem("charcoal_forge", () -> new CharcoalForgeBlock(ExtendedProperties.of(MapColor.COLOR_BLACK).pushReaction(PushReaction.DESTROY).strength(0.2F).randomTicks().sound(TFCSounds.CHARCOAL).lightLevel(state -> state.getValue(CharcoalForgeBlock.HEAT) * 2).pathType(BlockPathTypes.DAMAGE_FIRE).blockEntity(TFCBlockEntities.CHARCOAL_FORGE).serverTicks(CharcoalForgeBlockEntity::serverTick)));
public static final RegistryObject<Block> TORCH = registerNoItem("torch", () -> new TFCTorchBlock(ExtendedProperties.of().noCollission().instabreak().randomTicks().lightLevel(state -> 14).sound(SoundType.WOOD).blockEntity(TFCBlockEntities.TICK_COUNTER), ParticleTypes.FLAME));
public static final RegistryObject<Block> WALL_TORCH = registerNoItem("wall_torch", () -> new TFCWallTorchBlock(ExtendedProperties.of().noCollission().instabreak().randomTicks().lightLevel(state -> 14).sound(SoundType.WOOD).dropsLike(TORCH).blockEntity(TFCBlockEntities.TICK_COUNTER), ParticleTypes.FLAME));
public static final RegistryObject<Block> DEAD_TORCH = registerNoItem("dead_torch", () -> new DeadTorchBlock(Properties.of().noCollission().instabreak().sound(SoundType.WOOD), ParticleTypes.FLAME));
public static final RegistryObject<Block> DEAD_WALL_TORCH = registerNoItem("dead_wall_torch", () -> new DeadWallTorchBlock(Properties.of().noCollission().instabreak().sound(SoundType.WOOD).lootFrom(DEAD_TORCH), ParticleTypes.FLAME));
public static final RegistryObject<Block> JACK_O_LANTERN = register("jack_o_lantern", () -> new JackOLanternBlock(ExtendedProperties.of(MapColor.COLOR_ORANGE).strength(1.0F).sound(SoundType.WOOD).randomTicks().lightLevel(alwaysLit()).blockEntity(TFCBlockEntities.TICK_COUNTER), () -> Blocks.CARVED_PUMPKIN));
public static final RegistryObject<Block> BRONZE_BELL = register("bronze_bell", () -> new TFCBellBlock(ExtendedProperties.of(MapColor.GOLD).requiresCorrectToolForDrops().strength(5.0F).sound(SoundType.ANVIL).blockEntity(TFCBlockEntities.BELL).ticks(BellBlockEntity::serverTick, BellBlockEntity::clientTick), 0.8f, "bronze"));
public static final RegistryObject<Block> BRASS_BELL = register("brass_bell", () -> new TFCBellBlock(ExtendedProperties.of(MapColor.GOLD).requiresCorrectToolForDrops().strength(5.0F).sound(SoundType.ANVIL).blockEntity(TFCBlockEntities.BELL).ticks(BellBlockEntity::serverTick, BellBlockEntity::clientTick), 0.6f, "brass"));
public static final RegistryObject<Block> CRUCIBLE = register("crucible", () -> new CrucibleBlock(ExtendedProperties.of(MapColor.METAL).strength(3).sound(SoundType.METAL).blockEntity(TFCBlockEntities.CRUCIBLE).serverTicks(CrucibleBlockEntity::serverTick)), block -> new TooltipBlockItem(block, new Item.Properties()));
public static final RegistryObject<Block> COMPOSTER = register("composter", () -> new TFCComposterBlock(ExtendedProperties.of(MapColor.WOOD).strength(0.6F).noOcclusion().sound(SoundType.WOOD).randomTicks().flammable(60, 90).blockEntity(TFCBlockEntities.COMPOSTER)));
public static final RegistryObject<Block> BLOOMERY = register("bloomery", () -> new BloomeryBlock(ExtendedProperties.of(MapColor.METAL).strength(3).sound(SoundType.METAL).lightLevel(litBlockEmission(15)).blockEntity(TFCBlockEntities.BLOOMERY).serverTicks(BloomeryBlockEntity::serverTick)));
public static final RegistryObject<Block> BLAST_FURNACE = register("blast_furnace", () -> new BlastFurnaceBlock(ExtendedProperties.of(MapColor.METAL).strength(5f).sound(SoundType.METAL).lightLevel(litBlockEmission(15)).blockEntity(TFCBlockEntities.BLAST_FURNACE).serverTicks(BlastFurnaceBlockEntity::serverTick)));
public static final RegistryObject<Block> BLOOM = register("bloom", () -> new BloomBlock(ExtendedProperties.of().mapColor(MapColor.STONE).requiresCorrectToolForDrops().strength(3F, 6F).noOcclusion().blockEntity(TFCBlockEntities.BLOOM)));
public static final RegistryObject<Block> MOLTEN = register("molten", () -> new MoltenBlock(ExtendedProperties.of().mapColor(MapColor.STONE).requiresCorrectToolForDrops().strength(-1.0F, 3600000.0F).noOcclusion().lightLevel(litBlockEmission(15)).pathType(BlockPathTypes.DAMAGE_FIRE)));
public static final RegistryObject<Block> WOODEN_BOWL = registerNoItem("wooden_bowl", () -> new BowlBlock(ExtendedProperties.of().mapColor(MapColor.WOOD).sound(SoundType.WOOD).strength(0.3f).noOcclusion().blockEntity(TFCBlockEntities.BOWL))); // No item, since we use the vanilla one
public static final RegistryObject<Block> CERAMIC_BOWL = register("ceramic/bowl", () -> new BowlBlock(ExtendedProperties.of().mapColor(MapColor.STONE).sound(SoundType.STONE).strength(0.3f).noOcclusion().blockEntity(TFCBlockEntities.BOWL)));
public static final RegistryObject<Block> NEST_BOX = register("nest_box", () -> new NestBoxBlock(ExtendedProperties.of(MapColor.WOOD).strength(3f).noOcclusion().sound(TFCSounds.THATCH).blockEntity(TFCBlockEntities.NEST_BOX).serverTicks(NestBoxBlockEntity::serverTick).flammable(60, 30)));
public static final RegistryObject<Block> LIGHT = register("light", () -> new TFCLightBlock(Properties.copy(Blocks.LIGHT).replaceable().lightLevel(state -> state.getValue(TFCLightBlock.LEVEL)).randomTicks()));
public static final RegistryObject<Block> FRESHWATER_BUBBLE_COLUMN = registerNoItem("freshwater_bubble_column", () -> new TFCBubbleColumnBlock(Properties.copy(Blocks.BUBBLE_COLUMN).noCollission().noLootTable(), () -> Fluids.WATER));
public static final RegistryObject<Block> SALTWATER_BUBBLE_COLUMN = registerNoItem("saltwater_bubble_column", () -> new TFCBubbleColumnBlock(Properties.copy(Blocks.BUBBLE_COLUMN).noCollission().noLootTable(), TFCFluids.SALT_WATER::getSource));
public static final RegistryObject<Block> SHEET_PILE = registerNoItem("sheet_pile", () -> new SheetPileBlock(ExtendedProperties.of(MapColor.METAL).strength(4, 60).sound(SoundType.METAL).noOcclusion().blockEntity(TFCBlockEntities.SHEET_PILE)));
public static final RegistryObject<Block> INGOT_PILE = registerNoItem("ingot_pile", () -> new IngotPileBlock(ExtendedProperties.of(MapColor.METAL).strength(4, 60).sound(SoundType.METAL).noOcclusion().blockEntity(TFCBlockEntities.INGOT_PILE)));
public static final RegistryObject<Block> DOUBLE_INGOT_PILE = registerNoItem("double_ingot_pile", () -> new DoubleIngotPileBlock(ExtendedProperties.of(MapColor.METAL).strength(4, 60).sound(SoundType.METAL).noOcclusion().blockEntity(TFCBlockEntities.INGOT_PILE)));
public static final RegistryObject<Block> CAKE = register("cake", () -> new TFCCakeBlock(Properties.copy(Blocks.CAKE).strength(0.5f).sound(SoundType.WOOL)));
public static final RegistryObject<Block> CANDLE_CAKE = registerNoItem("candle_cake", () -> new TFCCandleCakeBlock(ExtendedProperties.of(Blocks.CANDLE_CAKE).strength(0.5f).sound(SoundType.WOOL).randomTicks().lightLevel(litBlockEmission(3)).blockEntity(TFCBlockEntities.TICK_COUNTER)));
public static final RegistryObject<Block> CANDLE = register("candle", () -> new TFCCandleBlock(ExtendedProperties.of(Blocks.CANDLE).mapColor(MapColor.SAND).randomTicks().noOcclusion().strength(0.1F).sound(SoundType.CANDLE).lightLevel(TFCCandleBlock.LIGHTING_SCALE).blockEntity(TFCBlockEntities.TICK_COUNTER)), b -> new CandleBlockItem(new Item.Properties(), b, TFCBlocks.CANDLE_CAKE));
public static final RegistryObject<Block> HAND_WHEEL_BASE = register("hand_wheel_base", () -> new HandWheelBlock(ExtendedProperties.of().strength(2f).noOcclusion().blockEntity(TFCBlockEntities.HAND_WHEEL).pushReaction(PushReaction.DESTROY).ticks(HandWheelBlockEntity::serverTick, HandWheelBlockEntity::clientTick).sound(SoundType.STONE)));
public static final RegistryObject<Block> CRANKSHAFT = register("crankshaft", () -> new CrankshaftBlock(ExtendedProperties.of().sound(SoundType.METAL).strength(3f).noOcclusion().pushReaction(PushReaction.DESTROY).blockEntity(TFCBlockEntities.CRANKSHAFT)));
public static final RegistryObject<Block> TRIP_HAMMER = register("trip_hammer", () -> new TripHammerBlock(ExtendedProperties.of().sound(SoundType.METAL).strength(3f).noOcclusion().pushReaction(PushReaction.DESTROY).blockEntity(TFCBlockEntities.TRIP_HAMMER).serverTicks(TripHammerBlockEntity::serverTick)));
public static final RegistryObject<Block> STEEL_PIPE = register("steel_pipe", () -> new FluidPipeBlock(ExtendedProperties.of().strength(5f).sound(SoundType.METAL)));
public static final RegistryObject<Block> STEEL_PUMP = register("steel_pump", () -> new FluidPumpBlock(ExtendedProperties.of().strength(5f).sound(SoundType.METAL).blockEntity(TFCBlockEntities.PUMP).serverTicks(PumpBlockEntity::serverTick).forceSolidOn()));
public static final Map<DyeColor, RegistryObject<Block>> DYED_CANDLE_CAKES = Helpers.mapOfKeys(DyeColor.class, color ->
registerNoItem("candle_cake/" + color.getName(), () -> new TFCCandleCakeBlock(ExtendedProperties.of(MapColor.SAND).randomTicks().noOcclusion().strength(0.5F).sound(SoundType.WOOL).lightLevel(litBlockEmission(3)).blockEntity(TFCBlockEntities.TICK_COUNTER)))
);
public static final Map<DyeColor, RegistryObject<Block>> DYED_CANDLE = Helpers.mapOfKeys(DyeColor.class, color ->
register("candle/" + color.getName(), () -> new TFCCandleBlock(ExtendedProperties.of(MapColor.SAND).randomTicks().noOcclusion().strength(0.1F).sound(SoundType.CANDLE).lightLevel(TFCCandleBlock.LIGHTING_SCALE).blockEntity(TFCBlockEntities.TICK_COUNTER)), b -> new CandleBlockItem(new Item.Properties(), b, TFCBlocks.DYED_CANDLE_CAKES.get(color)))
);
public static final RegistryObject<Block> JARS = registerNoItem("jars", () -> new JarsBlock(ExtendedProperties.of().noOcclusion().instabreak().sound(SoundType.GLASS).randomTicks().blockEntity(TFCBlockEntities.JARS)));
public static final RegistryObject<Block> LARGE_VESSEL = register("ceramic/large_vessel", () -> new LargeVesselBlock(ExtendedProperties.of(MapColor.CLAY).strength(2.5F).noOcclusion().blockEntity(TFCBlockEntities.LARGE_VESSEL)), block -> new TooltipBlockItem(block, new Item.Properties()));
public static final Map<DyeColor, RegistryObject<Block>> GLAZED_LARGE_VESSELS = Helpers.mapOfKeys(DyeColor.class, color ->
register("ceramic/large_vessel/" + color.getName(), () -> new LargeVesselBlock(ExtendedProperties.of(MapColor.CLAY).strength(2.5F).noOcclusion().blockEntity(TFCBlockEntities.LARGE_VESSEL)), block -> new TooltipBlockItem(block, new Item.Properties()))
);
// Fluids
public static final Map<Metal.Default, RegistryObject<LiquidBlock>> METAL_FLUIDS = Helpers.mapOfKeys(Metal.Default.class, metal ->
registerNoItem("fluid/metal/" + metal.name(), () -> new LiquidBlock(TFCFluids.METALS.get(metal).source(), Properties.copy(Blocks.LAVA).noLootTable()))
);
public static final Map<SimpleFluid, RegistryObject<LiquidBlock>> SIMPLE_FLUIDS = Helpers.mapOfKeys(SimpleFluid.class, fluid ->
registerNoItem("fluid/" + fluid.getId(), () -> new LiquidBlock(TFCFluids.SIMPLE_FLUIDS.get(fluid).source(), Properties.copy(Blocks.WATER).noLootTable()))
);
public static final Map<DyeColor, RegistryObject<LiquidBlock>> COLORED_FLUIDS = Helpers.mapOfKeys(DyeColor.class, fluid ->
registerNoItem("fluid/" + fluid.getName() + "_dye", () -> new LiquidBlock(TFCFluids.COLORED_FLUIDS.get(fluid).source(), Properties.copy(Blocks.WATER).noLootTable()))
);
public static final Map<Alcohol, RegistryObject<LiquidBlock>> ALCOHOLS = Helpers.mapOfKeys(Alcohol.class, fluid ->
registerNoItem("fluid/" + fluid.getId(), () -> new LiquidBlock(TFCFluids.ALCOHOLS.get(fluid).source(), Properties.copy(Blocks.WATER)))
);
public static final RegistryObject<LiquidBlock> SALT_WATER = registerNoItem("fluid/salt_water", () -> new LiquidBlock(TFCFluids.SALT_WATER.flowing(), Properties.copy(Blocks.WATER).noLootTable()));
public static final RegistryObject<LiquidBlock> SPRING_WATER = registerNoItem("fluid/spring_water", () -> new HotWaterBlock(TFCFluids.SPRING_WATER.source(), Properties.copy(Blocks.WATER).noLootTable()));
public static final RegistryObject<RiverWaterBlock> RIVER_WATER = registerNoItem("fluid/river_water", () -> new RiverWaterBlock(Properties.copy(Blocks.WATER).noLootTable()));
public static void registerFlowerPotFlowers()
{
FlowerPotBlock pot = (FlowerPotBlock) Blocks.FLOWER_POT;
POTTED_PLANTS.forEach((plant, reg) -> pot.addPlant(PLANTS.get(plant).getId(), reg));
WOODS.forEach((wood, map) -> pot.addPlant(map.get(Wood.BlockType.SAPLING).getId(), map.get(Wood.BlockType.POTTED_SAPLING)));
FRUIT_TREE_POTTED_SAPLINGS.forEach((plant, reg) -> pot.addPlant(FRUIT_TREE_SAPLINGS.get(plant).getId(), reg));
pot.addPlant(BANANA_SAPLING.getId(), BANANA_POTTED_SAPLING);
pot.addPlant(PINE_KRUMMHOLZ.getId(), POTTED_PINE_KRUMMHOLZ);
pot.addPlant(ASPEN_KRUMMHOLZ.getId(), POTTED_ASPEN_KRUMMHOLZ);
pot.addPlant(WHITE_CEDAR_KRUMMHOLZ.getId(), POTTED_WHITE_CEDAR_KRUMMHOLZ);
pot.addPlant(SPRUCE_KRUMMHOLZ.getId(), POTTED_SPRUCE_KRUMMHOLZ);
pot.addPlant(DOUGLAS_FIR_KRUMMHOLZ.getId(), POTTED_DOUGLAS_FIR_KRUMMHOLZ);
}
public static void editBlockRequiredTools()
{
for (Block block : new Block[] {
// All glass blocks are edited to require a tool (the gem saw), and loot tables that always drop themselves.
// We have to edit their 'required tool'-ness here
Blocks.GLASS,
Blocks.GLASS_PANE,
Blocks.TINTED_GLASS,
Blocks.WHITE_STAINED_GLASS, Blocks.ORANGE_STAINED_GLASS, Blocks.MAGENTA_STAINED_GLASS, Blocks.LIGHT_BLUE_STAINED_GLASS, Blocks.YELLOW_STAINED_GLASS, Blocks.LIME_STAINED_GLASS, Blocks.PINK_STAINED_GLASS, Blocks.GRAY_STAINED_GLASS, Blocks.LIGHT_GRAY_STAINED_GLASS, Blocks.CYAN_STAINED_GLASS, Blocks.PURPLE_STAINED_GLASS, Blocks.BLUE_STAINED_GLASS, Blocks.BROWN_STAINED_GLASS, Blocks.GREEN_STAINED_GLASS, Blocks.RED_STAINED_GLASS, Blocks.BLACK_STAINED_GLASS,
Blocks.WHITE_STAINED_GLASS_PANE, Blocks.ORANGE_STAINED_GLASS_PANE, Blocks.MAGENTA_STAINED_GLASS_PANE, Blocks.LIGHT_BLUE_STAINED_GLASS_PANE, Blocks.YELLOW_STAINED_GLASS_PANE, Blocks.LIME_STAINED_GLASS_PANE, Blocks.PINK_STAINED_GLASS_PANE, Blocks.GRAY_STAINED_GLASS_PANE, Blocks.LIGHT_GRAY_STAINED_GLASS_PANE, Blocks.CYAN_STAINED_GLASS_PANE, Blocks.PURPLE_STAINED_GLASS_PANE, Blocks.BLUE_STAINED_GLASS_PANE, Blocks.BROWN_STAINED_GLASS_PANE, Blocks.GREEN_STAINED_GLASS_PANE, Blocks.RED_STAINED_GLASS_PANE, Blocks.BLACK_STAINED_GLASS_PANE,
})
{
// Need to do both the block settings and the block state since the value is copied there for every state
((BlockBehaviourAccessor) block).getProperties().requiresCorrectToolForDrops();
for (BlockState state : block.getStateDefinition().getPossibleStates())
{
((BlockStateBaseAccessor) state).setRequiresCorrectToolForDrops(true);
}
}
}
public static boolean always(BlockState state, BlockGetter level, BlockPos pos)
{
return true;
}
public static boolean never(BlockState state, BlockGetter level, BlockPos pos)
{
return false;
}
public static boolean never(BlockState state, BlockGetter world, BlockPos pos, EntityType<?> type)
{
return false;
}
public static boolean onlyColdMobs(BlockState state, BlockGetter world, BlockPos pos, EntityType<?> type)
{
return Helpers.isEntity(type, TFCTags.Entities.SPAWNS_ON_COLD_BLOCKS);
}
public static ToIntFunction<BlockState> alwaysLit()
{
return s -> 15;
}
public static ToIntFunction<BlockState> lavaLoggedBlockEmission()
{
// This is resolved only at registration time, so we can't use the fast check (.getFluid() == Fluids.LAVA) and we have to use the slow check instead
return state -> state.getValue(TFCBlockStateProperties.WATER_AND_LAVA).is(((IFluidLoggable) state.getBlock()).getFluidProperty().keyFor(Fluids.LAVA)) ? 15 : 0;
}
public static ToIntFunction<BlockState> litBlockEmission(int lightValue)
{
return (state) -> state.getValue(BlockStateProperties.LIT) ? lightValue : 0;
}
private static <B extends SignBlock> Map<Wood, Map<Metal.Default, RegistryObject<B>>> registerHangingSigns(String variant, BiFunction<ExtendedProperties, WoodType, B> factory)
{
return Helpers.mapOfKeys(Wood.class, wood ->
Helpers.mapOfKeys(Metal.Default.class, Metal.Default::hasUtilities, metal -> register(
"wood/planks/" + variant + "/" + metal.getSerializedName() + "/" + wood.getSerializedName(),
() -> factory.apply(ExtendedProperties.of(wood.woodColor()).sound(SoundType.WOOD).noCollission().strength(1F).flammableLikePlanks().blockEntity(TFCBlockEntities.HANGING_SIGN).ticks(SignBlockEntity::tick), wood.getVanillaWoodType()),
(Function<B, BlockItem>) null)
)
);
}
private static <T extends Block> RegistryObject<T> registerNoItem(String name, Supplier<T> blockSupplier)
{
return register(name, blockSupplier, (Function<T, ? extends BlockItem>) null);
}
private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> blockSupplier)
{
return register(name, blockSupplier, block -> new BlockItem(block, new Item.Properties()));
}
private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> blockSupplier, Item.Properties blockItemProperties)
{
return register(name, blockSupplier, block -> new BlockItem(block, blockItemProperties));
}
private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> blockSupplier, @Nullable Function<T, ? extends BlockItem> blockItemFactory)
{
return RegistrationHelpers.registerBlock(TFCBlocks.BLOCKS, TFCItems.ITEMS, name, blockSupplier, blockItemFactory);
}
} | TerraFirmaCraft/TerraFirmaCraft | src/main/java/net/dries007/tfc/common/blocks/TFCBlocks.java |
213,069 | /**
*
* Copyright (c) 2005-2012. Centre for Research on Inner City Health, St. Michael's Hospital, Toronto. All Rights Reserved.
* This software is published under the GPL GNU General Public License.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This software was written for
* Centre for Research on Inner City Health, St. Michael's Hospital,
* Toronto, Ontario, Canada
*/
package org.oscarehr.PMmodule.model;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.quatro.model.LookupCodeValue;
/**
* This is the object class that relates to the program table. Any customizations belong here.
*/
public class Program implements Serializable {
public static final Integer DEFAULT_COMMUNITY_PROGRAM_ID = new Integer(10010);
public static final String EXTERNAL_TYPE = "external";
public static final String BED_TYPE = "Bed";
public static final String COMMUNITY_TYPE = "community";
public static final String SERVICE_TYPE = "Service";
public static final String PROGRAM_STATUS_ACTIVE = "active";
public static final String PROGRAM_STATUS_INACTIVE = "inactive";
private final Integer DEFAULT_SERVICE_RESTRICTION_DAYS = 30;
private final Integer MIN_AGE = 1;
private final Integer MAX_AGE = 200;
private int hashCode = Integer.MIN_VALUE;// primary key
private Integer id;
private boolean userDefined = true;
private Integer numOfMembers;
private Integer numOfIntakes;
private Integer queueSize;
private Integer maxAllowed;
private String type;
private String description;
private String functionalCentreId;
private String address;
private String phone;
private String fax;
private String url;
private String email;
private String emergencyNumber;
private String location;
private String name;
private boolean holdingTank;
private boolean allowBatchAdmission;
private boolean allowBatchDischarge;
private boolean hic;
private String programStatus = "active";
private Integer intakeProgram;
private Integer bedProgramLinkId;
private String manOrWoman;
private String genderDesc;
private boolean transgender;
private boolean firstNation;
private boolean bedProgramAffiliated;
private boolean alcohol;
private String abstinenceSupport;
private boolean physicalHealth;
private boolean mentalHealth;
private boolean housing;
private String exclusiveView = "no";
private Integer ageMin;
private Integer ageMax;
private Integer maximumServiceRestrictionDays;
private Integer defaultServiceRestrictionDays;
private Integer shelterId;
private int facilityId;
private String facilityDesc;
private String orgCd;
private Integer capacity_funding = new Integer(0);
private Integer capacity_space = new Integer(0);
private Integer capacity_actual = new Integer(0);
private Integer totalUsedRoom = new Integer(0);
private String lastUpdateUser;
private Date lastUpdateDate = new Date();
private LookupCodeValue shelter;
private String siteSpecificField;
private Boolean enableEncounterTime = false;
private Boolean enableEncounterTransportationTime = false;
private String emailNotificationAddressesCsv = null;
private Date lastReferralNotification = null;
private boolean enableOCAN;
//these are all transient - these need to be removed, we shouldn't be having fields like this in JPA model objects.
private Integer noOfVacancy = 0;
private String vacancyName;
private String dateCreated;
private double matches;
private Integer vacancyId;
private String vacancyTemplateName;
/**
* Constructor for required fields
*/
public Program(Integer id, boolean isUserDefined, Integer maxAllowed, String address, String phone, String fax, String url, String email, String emergencyNumber, String name, boolean holdingTank, String programStatus) {
setId(id);
setUserDefined(isUserDefined);
setMaxAllowed(maxAllowed);
setAddress(address);
setPhone(phone);
setFax(fax);
setUrl(url);
setEmail(email);
setEmergencyNumber(emergencyNumber);
setName(name);
setHoldingTank(holdingTank);
setProgramStatus(programStatus);
}
public String getSiteSpecificField() {
return siteSpecificField;
}
public void setSiteSpecificField(String siteSpecificField) {
this.siteSpecificField = siteSpecificField;
}
public Date getLastUpdateDate() {
return lastUpdateDate;
}
public void setLastUpdateDate(Date lastUpdateDate) {
this.lastUpdateDate = lastUpdateDate;
}
public String getLastUpdateUser() {
return lastUpdateUser;
}
public String getFunctionalCentreId() {
return functionalCentreId;
}
public void setFunctionalCentreId(String functionalCentreId) {
this.functionalCentreId = functionalCentreId;
}
public void setLastUpdateUser(String lastUpdateUser) {
this.lastUpdateUser = lastUpdateUser;
}
public Integer getCapacity_actual() {
return capacity_actual;
}
public void setCapacity_actual(Integer capacity_actual) {
this.capacity_actual = capacity_actual;
}
public Integer getCapacity_funding() {
return capacity_funding;
}
public void setCapacity_funding(Integer capacity_funding) {
this.capacity_funding = capacity_funding;
}
public Integer getCapacity_space() {
return capacity_space;
}
public void setCapacity_space(Integer capacity_space) {
this.capacity_space = capacity_space;
}
// constructors
public Program() {
// no arg constructor for JPA
}
public Integer getShelterId() {
return shelterId;
}
public void setShelterId(Integer shelterId) {
this.shelterId = shelterId;
}
public int getFacilityId() {
return facilityId;
}
public void setFacilityId(int facilityId) {
this.facilityId = facilityId;
}
public String getOrgCd() {
return orgCd;
}
public void setOrgCd(String orgCd) {
this.orgCd = orgCd;
}
/**
* Constructor for primary key
*/
public Program(Integer id) {
this.setId(id);
}
public boolean isUserDefined() {
return userDefined;
}
public void setUserDefined(boolean userDefined) {
this.userDefined = userDefined;
}
public boolean isActive() {
return PROGRAM_STATUS_ACTIVE.equals(programStatus);
}
public boolean isFull() {
return getNumOfMembers().intValue() >= getMaxAllowed().intValue();
}
public boolean isExternal() {
return EXTERNAL_TYPE.equalsIgnoreCase(getType());
}
public boolean isBed() {
return BED_TYPE.equalsIgnoreCase(getType());
}
public boolean isCommunity() {
return COMMUNITY_TYPE.equalsIgnoreCase(getType());
}
public boolean isService() {
return SERVICE_TYPE.equalsIgnoreCase(getType());
}
public boolean getHoldingTank() {
return isHoldingTank();
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
this.hashCode = Integer.MIN_VALUE;
}
/**
* Return the value associated with the column: numOfMembers
*/
public Integer getNumOfMembers() {
return numOfMembers;
}
/**
* Set the value related to the column: numOfMembers
*
* @param numOfMembers
* the numOfMembers value
*/
public void setNumOfMembers(Integer numOfMembers) {
this.numOfMembers = numOfMembers;
}
/**
* Return the value associated with the column: queueSize
*/
public Integer getQueueSize() {
return queueSize;
}
/**
* Set the value related to the column: queueSize
*
* @param queueSize
* the queueSize value
*/
public void setQueueSize(Integer queueSize) {
this.queueSize = queueSize;
}
public Integer getMaxAllowed() {
return maxAllowed;
}
public void setMaxAllowed(Integer maxAllowed) {
this.maxAllowed = maxAllowed;
}
/**
* Return the value associated with the column: type
*/
public String getType() {
return type;
}
/**
* Set the value related to the column: type
*
* @param type
* the type value
*/
public void setType(String type) {
this.type = type;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
/**
* Return the value associated with the column: address
*/
public String getAddress() {
return address;
}
/**
* Set the value related to the column: address
*
* @param address
* the address value
*/
public void setAddress(String address) {
this.address = address;
}
/**
* Return the value associated with the column: phone
*/
public String getPhone() {
return phone;
}
/**
* Set the value related to the column: phone
*
* @param phone
* the phone value
*/
public void setPhone(String phone) {
this.phone = phone;
}
/**
* Return the value associated with the column: fax
*/
public String getFax() {
return fax;
}
/**
* Set the value related to the column: fax
*
* @param fax
* the fax value
*/
public void setFax(String fax) {
this.fax = fax;
}
/**
* Return the value associated with the column: url
*/
public String getUrl() {
return url;
}
/**
* Set the value related to the column: url
*
* @param url
* the url value
*/
public void setUrl(String url) {
this.url = url;
}
/**
* Return the value associated with the column: email
*/
public String getEmail() {
return email;
}
/**
* Set the value related to the column: email
*
* @param email
* the email value
*/
public void setEmail(String email) {
this.email = email;
}
public String getEmergencyNumber() {
return emergencyNumber;
}
public void setEmergencyNumber(String emergencyNumber) {
this.emergencyNumber = emergencyNumber;
}
/**
* Return the value associated with the column: location
*/
public String getLocation() {
return location;
}
/**
* Set the value related to the column: location
*
* @param location
* the location value
*/
public void setLocation(String location) {
this.location = location;
}
/**
* Return the value associated with the column: name
*/
public String getName() {
return name;
}
public String getNameJs() {
return oscar.Misc.getStringJs(name);
}
/**
* Set the value related to the column: name
*
* @param name
* the name value
*/
public void setName(String name) {
this.name = name;
}
public boolean isHoldingTank() {
return holdingTank;
}
public void setHoldingTank(boolean holdingTank) {
this.holdingTank = holdingTank;
}
public boolean isAllowBatchAdmission() {
return allowBatchAdmission;
}
public void setAllowBatchAdmission(boolean allowBatchAdmission) {
this.allowBatchAdmission = allowBatchAdmission;
}
public boolean isAllowBatchDischarge() {
return allowBatchDischarge;
}
public void setAllowBatchDischarge(boolean allowBatchDischarge) {
this.allowBatchDischarge = allowBatchDischarge;
}
/**
* Return the value associated with the column: hic
*/
public boolean isHic() {
return hic;
}
/**
* Set the value related to the column: hic
*
* @param hic
* the hic value
*/
public void setHic(boolean hic) {
this.hic = hic;
}
public String getProgramStatus() {
return programStatus;
}
/**
* Set the value related to the column: program_status
*
* @param programStatus
* the program_status value
*/
public void setProgramStatus(String programStatus) {
this.programStatus = programStatus;
}
public Integer getIntakeProgram() {
return intakeProgram;
}
public void setIntakeProgram(Integer intakeProgram) {
this.intakeProgram = intakeProgram;
}
public Integer getBedProgramLinkId() {
return bedProgramLinkId;
}
public void setBedProgramLinkId(Integer bedProgramLinkId) {
this.bedProgramLinkId = bedProgramLinkId;
}
public String getAbstinenceSupport() {
return abstinenceSupport;
}
public void setAbstinenceSupport(String abstinenceSupport) {
this.abstinenceSupport = abstinenceSupport;
}
public boolean isAlcohol() {
return alcohol;
}
public void setAlcohol(boolean alcohol) {
this.alcohol = alcohol;
}
public boolean isBedProgramAffiliated() {
return bedProgramAffiliated;
}
public void setBedProgramAffiliated(boolean bedProgramAffiliated) {
this.bedProgramAffiliated = bedProgramAffiliated;
}
public boolean isFirstNation() {
return firstNation;
}
public void setFirstNation(boolean firstNation) {
this.firstNation = firstNation;
}
public int getHashCode() {
return hashCode;
}
public void setHashCode(int hashCode) {
this.hashCode = hashCode;
}
public boolean isHousing() {
return housing;
}
public void setHousing(boolean housing) {
this.housing = housing;
}
public String getManOrWoman() {
return manOrWoman;
}
public void setManOrWoman(String manOrWoman) {
this.manOrWoman = manOrWoman;
}
public boolean isMentalHealth() {
return mentalHealth;
}
public void setMentalHealth(boolean mentalHealth) {
this.mentalHealth = mentalHealth;
}
public boolean isPhysicalHealth() {
return physicalHealth;
}
public void setPhysicalHealth(boolean physicalHealth) {
this.physicalHealth = physicalHealth;
}
public boolean isTransgender() {
return transgender;
}
public void setTransgender(boolean transgender) {
this.transgender = transgender;
}
public String getExclusiveView() {
return exclusiveView;
}
public void setExclusiveView(String exclusiveView) {
this.exclusiveView = exclusiveView;
}
public Integer getAgeMin() {
if (this.ageMin != null) {
return ageMin;
}
return this.MIN_AGE;
}
public void setAgeMin(Integer ageMin) {
this.ageMin = ageMin;
}
public Integer getAgeMax() {
if (this.ageMax != null) {
return ageMax;
}
return this.MAX_AGE;
}
public void setAgeMax(Integer ageMax) {
this.ageMax = ageMax;
}
public Integer getMaximumServiceRestrictionDays() {
return maximumServiceRestrictionDays;
}
public void setMaximumServiceRestrictionDays(Integer maximumServiceRestrictionDays) {
this.maximumServiceRestrictionDays = maximumServiceRestrictionDays;
}
public Integer getDefaultServiceRestrictionDays() {
if ((this.defaultServiceRestrictionDays != null) && (this.defaultServiceRestrictionDays > 0)) {
return defaultServiceRestrictionDays;
}
return this.DEFAULT_SERVICE_RESTRICTION_DAYS;
}
public void setDefaultServiceRestrictionDays(Integer defaultServiceRestrictionDays) {
this.defaultServiceRestrictionDays = defaultServiceRestrictionDays;
}
public boolean equals(Object obj) {
if (null == obj) return false;
if (!(obj instanceof Program)) return false;
else {
Program program = (Program) obj;
if (null == this.getId() || null == program.getId()) return false;
else return (this.getId().equals(program.getId()));
}
}
public int hashCode() {
if (Integer.MIN_VALUE == this.hashCode) {
if (null == this.getId()) return super.hashCode();
else {
String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
this.hashCode = hashStr.hashCode();
}
}
return this.hashCode;
}
public String toString() {
return super.toString();
}
public String getFacilityDesc() {
return facilityDesc;
}
public void setFacilityDesc(String facilityDesc) {
this.facilityDesc = facilityDesc;
}
public Integer getTotalUsedRoom() {
return totalUsedRoom;
}
public void setTotalUsedRoom(Integer totalUsedRoom) {
this.totalUsedRoom = totalUsedRoom;
}
public Integer getNumOfIntakes() {
return numOfIntakes;
}
public void setNumOfIntakes(Integer numOfIntakes) {
this.numOfIntakes = numOfIntakes;
}
public String getGenderDesc() {
return genderDesc;
}
public void setGenderDesc(String genderDesc) {
this.genderDesc = genderDesc;
}
public LookupCodeValue getShelter() {
return shelter;
}
public void setShelter(LookupCodeValue shelter) {
this.shelter = shelter;
}
public Boolean isEnableEncounterTime() {
return enableEncounterTime;
}
public Boolean getEnableEncounterTime() {
return enableEncounterTime;
}
public void setEnableEncounterTime(Boolean enableEncounterTime) {
this.enableEncounterTime = enableEncounterTime;
}
public Boolean isEnableEncounterTransportationTime() {
return enableEncounterTransportationTime;
}
public Boolean getEnableEncounterTransportationTime() {
return enableEncounterTransportationTime;
}
public void setEnableEncounterTransportationTime(Boolean enableEncounterTransportationTime) {
this.enableEncounterTransportationTime = enableEncounterTransportationTime;
}
public String getEmailNotificationAddressesCsv() {
return emailNotificationAddressesCsv;
}
public void setEmailNotificationAddressesCsv(String emailNotificationAddressesCsv) {
this.emailNotificationAddressesCsv = emailNotificationAddressesCsv;
}
public Date getLastReferralNotification() {
return lastReferralNotification;
}
public void setLastReferralNotification(Date lastReferralNotification) {
this.lastReferralNotification = lastReferralNotification;
}
public Integer getNoOfVacancy() {
return noOfVacancy;
}
public void setNoOfVacancy(Integer noOfVacancy) {
this.noOfVacancy = noOfVacancy;
}
public String getVacancyName() {
return vacancyName;
}
public void setVacancyName(String vacancyName) {
this.vacancyName = vacancyName;
}
public String getDateCreated() {
return dateCreated;
}
public void setDateCreated(String dateCreated) {
this.dateCreated = dateCreated;
}
public double getMatches() {
return matches;
}
public void setMatches(double matches) {
this.matches = matches;
}
public Integer getVacancyId() {
return vacancyId;
}
public void setVacancyId(Integer vacancyId) {
this.vacancyId = vacancyId;
}
public String getVacancyTemplateName() {
return vacancyTemplateName;
}
public void setVacancyTemplateName(String vacancyTemplateName) {
this.vacancyTemplateName = vacancyTemplateName;
}
public static String getIdsAsStringList(List<Program> results) {
StringBuilder sb = new StringBuilder();
for (Program model : results) {
sb.append(model.getId().toString());
sb.append(',');
}
return (sb.toString());
}
public boolean isEnableOCAN() {
return enableOCAN;
}
public void setEnableOCAN(boolean enableOCAN) {
this.enableOCAN = enableOCAN;
}
}
| junoemr/junoemr | src/main/java/org/oscarehr/PMmodule/model/Program.java |
213,072 | package org.kie.karaf.itest.blueprint.domain;
import java.io.Serializable;
public class Drink implements Serializable {
private final String name;
private final boolean containsAlcohol;
public Drink(final String name, final boolean containsAlcohol) {
this.name = name;
this.containsAlcohol = containsAlcohol;
}
public String getName() {
return this.name;
}
public boolean containsAlcohol() {
return this.containsAlcohol;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Drink drink = (Drink) o;
if (containsAlcohol != drink.containsAlcohol) return false;
return !(name != null ? !name.equals(drink.name) : drink.name != null);
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (containsAlcohol ? 1 : 0);
return result;
}
@Override
public String toString() {
return "Drink{" +
"name='" + name + '\'' +
", containsAlcohol=" + containsAlcohol +
'}';
}
}
| kiegroup/droolsjbpm-integration | kie-osgi/kie-karaf-itests-domain-model/src/main/java/org/kie/karaf/itest/blueprint/domain/Drink.java |
213,073 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.order;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int add=0x7f020000;
public static final int alcohol=0x7f020001;
public static final int busy_table=0x7f020002;
public static final int dessert=0x7f020003;
public static final int empty_table=0x7f020004;
public static final int food1=0x7f020005;
public static final int ic_launcher=0x7f020006;
public static final int main_dish=0x7f020007;
public static final int non_alcoholic=0x7f020008;
public static final int other=0x7f020009;
public static final int pancakes=0x7f02000a;
public static final int pasta=0x7f02000b;
public static final int soda_cans=0x7f02000c;
public static final int soup=0x7f02000d;
}
public static final class id {
public static final int categoriesGridView=0x7f050001;
public static final int categoriesTitle=0x7f050000;
public static final int categoryImage=0x7f050002;
public static final int categoryNameText=0x7f050003;
public static final int gridView=0x7f050005;
public static final int linearLayout1=0x7f050007;
public static final int linearLayout2=0x7f05000b;
public static final int orderAddButton=0x7f05001a;
public static final int orderCostText=0x7f050008;
public static final int orderDurationText=0x7f050009;
public static final int orderListView=0x7f05000c;
public static final int orderProdImage=0x7f050012;
public static final int orderProdNameText=0x7f05000f;
public static final int orderProductAdd=0x7f05000a;
public static final int orderProductAddButton=0x7f05000d;
public static final int orderProductPriceText=0x7f050011;
public static final int orderProductQuantityText=0x7f050010;
public static final int orderProductRemoveButton=0x7f05000e;
public static final int orderTitle=0x7f050006;
public static final int productImage=0x7f050015;
public static final int productNameText=0x7f050016;
public static final int productPriceText=0x7f050017;
public static final int productsGridView=0x7f050014;
public static final int productsTitle=0x7f050013;
public static final int tableCustomers=0x7f050019;
public static final int tableListView=0x7f05001c;
public static final int tableOrderFinalizaButton=0x7f05001b;
public static final int tableTitle=0x7f050018;
public static final int textView1=0x7f050004;
}
public static final class layout {
public static final int categories=0x7f030000;
public static final int categories_list=0x7f030001;
public static final int main=0x7f030002;
public static final int order=0x7f030003;
public static final int order_product_list=0x7f030004;
public static final int products=0x7f030005;
public static final int products_list=0x7f030006;
public static final int table=0x7f030007;
}
public static final class string {
public static final int Tables=0x7f040000;
public static final int app_name=0x7f040001;
public static final int table_activity=0x7f040002;
}
}
| cosminstefanxp/Restaurant-Table-Order-Management-Demo | gen/com/order/R.java |
213,074 | package org.dataalgorithms.machinelearning.logistic.alcohol;
import org.apache.commons.lang.StringUtils;
//
import org.apache.log4j.Logger;
//
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.Function;
//
import org.apache.spark.mllib.classification.LogisticRegressionModel;
import org.apache.spark.mllib.classification.LogisticRegressionWithLBFGS;
import org.apache.spark.mllib.linalg.DenseVector;
import org.apache.spark.mllib.linalg.Vector;
import org.apache.spark.mllib.regression.LabeledPoint;
/**
* Input format:
* feature columns: 1,2,3,4,5,7,8,9,12,14,17,18,19,23
* classification column: 20
*
* Classification values: {1, 2,3,4,5}
*
*# awk 'BEGIN{FS=","}{print $20}' data/student_alcohol_training_data.txt | sort | grep 1 | wc -l
* 249
*# awk 'BEGIN{FS=","}{print $20}' data/student_alcohol_training_data.txt | sort | grep 2 | wc -l
* 67
*# awk 'BEGIN{FS=","}{print $20}' data/student_alcohol_training_data.txt | sort | grep 3 | wc -l
* 19
*# awk 'BEGIN{FS=","}{print $20}' data/student_alcohol_training_data.txt | sort | grep 4 | wc -l
* 6
*# awk 'BEGIN{FS=","}{print $20}' data/student_alcohol_training_data.txt | sort | grep 5 | wc -l
* 8
* *
* @author Mahmoud Parsian ([email protected])
*
*/
public final class StudentAlcoholDetectionBuildModel {
private static final Logger THE_LOGGER = Logger.getLogger(StudentAlcoholDetectionBuildModel.class);
public static void main(String[] args) {
//
Util.debugArguments(args);
//
if (args.length != 2) {
throw new RuntimeException("usage: StudentAlcoholDetectionBuildModel <training-data-set-path> <built-model-path>");
}
//
String trainingInputPath = args[0];
String builtModelPath = args[1];
THE_LOGGER.info("trainingInputPath=" + trainingInputPath);
THE_LOGGER.info("builtModelPath=" + builtModelPath);
// create a Factory context object
JavaSparkContext context = Util.createJavaSparkContext("StudentAlcoholDetectionBuildModel");
// Each line has a breast cancer record
JavaRDD<String> records = context.textFile(trainingInputPath); // e.g.: /breastcancer/input/breast-cancer-wisconsin-wdbc-data.txt
// feature columns: 1,2,3,4,5,7,8,9,12,14,17,18,19,23
// classification column: 20
JavaRDD<LabeledPoint> training = records.map(new Function<String, LabeledPoint>() {
@Override
public LabeledPoint call(String record) {
//
String[] tokens = StringUtils.split(record, ",");
//
double[] features = new double[14];
//
features[0] = Double.parseDouble(tokens[0]);
features[1] = Double.parseDouble(tokens[1]);
features[2] = Double.parseDouble(tokens[2]);
features[3] = Double.parseDouble(tokens[3]);
features[4] = Double.parseDouble(tokens[4]);
features[5] = Double.parseDouble(tokens[6]);
features[6] = Double.parseDouble(tokens[7]);
features[7] = Double.parseDouble(tokens[8]);
features[8] = Double.parseDouble(tokens[11]);
features[9] = Double.parseDouble(tokens[13]);
features[10] = Double.parseDouble(tokens[16]);
features[11] = Double.parseDouble(tokens[17]);
features[12] = Double.parseDouble(tokens[18]);
features[13] = Double.parseDouble(tokens[22]);
//
Vector vector = new DenseVector(features);
//
String classLevel = tokens[19];
THE_LOGGER.info("training data: classLevel=" + classLevel);
double classification = getClassification5(classLevel);
THE_LOGGER.info("training data: classification=" + classification);
//
return new LabeledPoint(classification, vector);
}
});
// Split initial RDD into two... [60% training data, 40% testing data].
//JavaRDD<LabeledPoint>[] splits = data.randomSplit(new double[] {0.6, 0.4}, 11L);
//JavaRDD<LabeledPoint> training = splits[0].cache();
//JavaRDD<LabeledPoint> test = splits[1];
// Cache data since Logistic Regression is an iterative algorithm.
training.cache();
// Run training algorithm to build the model.
final LogisticRegressionModel model = new LogisticRegressionWithLBFGS()
.setNumClasses(5)
.run(training.rdd());
// SAVE the MODEL: for the future use
//
// you may save the model for future use:
// public void save(SparkContext sc, String path)
// Description copied from interface: Saveable
// Save this model to the given path.
model.save(context.sc(), builtModelPath);
// Compute raw scores on the test set.
/*
JavaRDD<Tuple2<Object, Object>> predictionAndLabels = test.map(
new Function<LabeledPoint, Tuple2<Object, Object>>() {
public Tuple2<Object, Object> call(LabeledPoint p) {
Double prediction = model.predict(p.features());
System.out.println("prediction="+prediction+"\t p.label()="+p.label());
return new Tuple2<Object, Object>(prediction, p.label());
}
}
);
*/
// Then later, you may LOAD the MODEL from saved PATH:
//
// later on you may load the model from the saved path
// public static LogisticRegressionModel load(SparkContext sc, String path)
// done
context.stop();
}
private static double getClassification2(String classLevel) {
if (classLevel.equals("1") | classLevel.equals("2") | classLevel.equals("3")) {
// classLevel is "mild" and in {"1", "2", "3"}
return 0.0;
}
else {
// classLevel is severe and in {"4", "5" }
return 1.0;
}
}
/**
* Classify from 0 to K-1 when K is the number of classifications
*
* @param classLevel
* @return
*/
private static double getClassification5(String classLevel) {
if (classLevel.equals("1")) {
return 0.0;
}
else if (classLevel.equals("2")) {
return 1.0;
}
else if (classLevel.equals("3")) {
return 2.0;
}
else if (classLevel.equals("4")) {
return 3.0;
}
else {
// must be "5"
return 4.0;
}
}
} | mahmoudparsian/data-algorithms-book | src/main/java/org/dataalgorithms/machinelearning/logistic/alcohol/StudentAlcoholDetectionBuildModel.java |
213,075 | /*
Copyright (c) 2015-2019, Tom Schoonjans
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY Teemu Ikonen and Tom Schoonjans ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Teemu Ikonen and Tom Schoonjans BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.github.tschoonj.xraylib;
import java.io.DataInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.BufferUnderflowException;
import java.nio.ByteOrder;
import java.lang.Math;
import java.util.Arrays;
import java.util.ArrayList;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
import java.text.Format;
import org.apache.commons.math3.complex.Complex;
/**
* This is the main class of the xraylib package, containing all static methods.
*
* If an invalid argument has been passed to any of these methods,
* an @see IllegalArgumentException will be thrown.
*
* @author Tom Schoonjans ([email protected])
* @since 3.2.0
*/
public class Xraylib {
static {
try {
XRayInit();
}
catch (Exception e){
e.printStackTrace();
System.exit(1);
}
}
/* predefined error messages */
public static final String Z_OUT_OF_RANGE = "Z out of range";
public static final String NEGATIVE_ENERGY = "Energy must be strictly positive";
public static final String NEGATIVE_DENSITY = "Density must be strictly positive";
public static final String NEGATIVE_Q = "q must be positive";
public static final String NEGATIVE_PZ = "pz must be positive";
public static final String INVALID_SHELL = "Invalid shell for this atomic number";
public static final String INVALID_LINE = "Invalid line for this atomic number";
public static final String INVALID_CK = "Invalid Coster-Kronig transition for this atomic number";
public static final String INVALID_AUGER = "Invalid Auger transition macro for this atomic number";
public static final String UNKNOWN_SHELL = "Unknown shell macro provided";
public static final String UNKNOWN_LINE = "Unknown line macro provided";
public static final String UNKNOWN_CK = "Unknown Coster-Kronig transition macro provided";
public static final String UNKNOWN_AUGER = "Unknown Auger transition macro provided";
public static final String UNAVAILABLE_JUMP_FACTOR = "Jump factor unavailable for element and shell";
public static final String UNAVAILABLE_FLUOR_YIELD = "Fluorescence yield unavailable for atomic number and shell";
public static final String TOO_LOW_EXCITATION_ENERGY = "The excitation energy too low to excite the shell";
public static final String UNAVAILABLE_PHOTO_CS = "Photoionization cross section unavailable for atomic number and energy";
public static final String UNAVAILABLE_RAD_RATE = "Radiative rate unavailable for this atomic number and line macro";
public static final String UNAVAILABLE_CK = "Coster-Kronig transition probability unavailable for this atomic number and transition macro";
public static final String UNKNOWN_COMPOUND = "Compound is not a valid chemical formula and is not present in the NIST compound database";
public static final String MALLOC_ERROR = "Could not allocate memory";
public static final String INVALID_MILLER = "Miller indices cannot all be zero";
public static final String NEGATIVE_DEBYE_FACTOR = "Debye-Waller factor must be strictly positive";
public static final String CRYSTAL_NULL = "Crystal cannot be NULL";
protected static String readString(ByteBuffer byte_buffer) {
ArrayList<Byte> al = new ArrayList<>();
while (true) {
byte my_char = byte_buffer.get();
if (my_char == 0)
break;
al.add(my_char);
}
byte[] temp = new byte[al.size()];
Iterator<Byte> iterator = al.iterator();
for (int i = 0 ; i < temp.length ; i++) {
temp[i] = iterator.next().byteValue();
}
return new String(temp, StandardCharsets.US_ASCII);
}
protected static double[][][] readDoubleArrayOfArraysOfArrays(int[][] N, ByteBuffer byte_buffer) throws BufferUnderflowException {
double[][][] rv = new double[N.length][][];
for (int i = 0 ; i < N.length ; i++) {
rv[i] = readDoubleArrayOfArrays(N[i], byte_buffer);
}
return rv;
}
protected static double[][] readDoubleArrayOfArrays(int[] N, ByteBuffer byte_buffer) throws BufferUnderflowException {
double [][] rv = new double[N.length][];
for (int i = 0 ; i < N.length ; i++) {
if (N[i] <= 0) {
rv[i] = null;
continue;
}
rv[i] = readDoubleArray(N[i], byte_buffer);
}
return rv;
}
protected static double[] readDoubleArray(int n, ByteBuffer byte_buffer) throws BufferUnderflowException {
//System.out.println("readDoubleArray n: " + n);
double[] rv = new double[n];
for (int i = 0 ; i < n ; i++) {
try {
rv[i] = byte_buffer.getDouble();
//System.out.println("rv["+i+"]: "+ rv[i]);
}
catch (BufferUnderflowException e) {
throw new BufferUnderflowException();
}
}
return rv;
}
protected static int[] readIntArray(int n, ByteBuffer byte_buffer) throws BufferUnderflowException {
int[] rv = new int[n];
for (int i = 0 ; i < n ; i++) {
try {
rv[i] = byte_buffer.getInt();
//System.out.println("rv["+i+"]: "+ rv[i]);
}
catch (BufferUnderflowException e) {
throw new BufferUnderflowException();
}
}
return rv;
}
protected static int[][] arrayReshape(int[] array, int m, int n) {
if (m*n != array.length)
throw new RuntimeException("new array dimensions incompatible with old ones");
int[][] rv = new int[m][n];
int index_old = 0;
for (int i = 0 ; i < m ; i++) {
for (int j = 0 ; j < n ; j++) {
rv[i][j] = array[index_old++];
}
}
return rv;
}
private static void XRayInit() throws Exception {
try (
DataInputStream inputStream = new DataInputStream(Xraylib.class.getClassLoader().getResourceAsStream("xraylib.dat"));
) {
int bytes_total = inputStream.available();
byte[] bytes = new byte[bytes_total];
inputStream.readFully(bytes);
ByteBuffer byte_buffer = ByteBuffer.wrap(bytes);
byte_buffer.order(ByteOrder.LITTLE_ENDIAN);
ZMAX = byte_buffer.getInt();
SHELLNUM = byte_buffer.getInt();
SHELLNUM_K = byte_buffer.getInt();
SHELLNUM_A = byte_buffer.getInt();
TRANSNUM = byte_buffer.getInt();
LINENUM = byte_buffer.getInt();
AUGERNUM = byte_buffer.getInt();
RE2 = byte_buffer.getDouble();
MEC2 = byte_buffer.getDouble();
AVOGNUM = byte_buffer.getDouble();
KEV2ANGST = byte_buffer.getDouble();
R_E = byte_buffer.getDouble();
//System.out.println("ZMAX: " + ZMAX);
//System.out.println("SHELLNUM: " + SHELLNUM);
//System.out.println("TRANSNUM: " + TRANSNUM);
AtomicWeight_arr = readDoubleArray(ZMAX + 1, byte_buffer);
ElementDensity_arr = readDoubleArray(ZMAX + 1, byte_buffer);
EdgeEnergy_arr = readDoubleArray((ZMAX + 1) * SHELLNUM, byte_buffer);
AtomicLevelWidth_arr = readDoubleArray((ZMAX + 1) * SHELLNUM, byte_buffer);
LineEnergy_arr = readDoubleArray((ZMAX + 1) * LINENUM, byte_buffer);
FluorYield_arr = readDoubleArray((ZMAX + 1) * SHELLNUM, byte_buffer);
JumpFactor_arr = readDoubleArray((ZMAX + 1) * SHELLNUM, byte_buffer);
CosKron_arr = readDoubleArray((ZMAX + 1) * TRANSNUM, byte_buffer);
RadRate_arr = readDoubleArray((ZMAX + 1) * LINENUM, byte_buffer);
NE_Photo_arr = readIntArray(ZMAX + 1, byte_buffer);
E_Photo_arr = readDoubleArrayOfArrays(NE_Photo_arr, byte_buffer);
CS_Photo_arr = readDoubleArrayOfArrays(NE_Photo_arr, byte_buffer);
CS_Photo_arr2 = readDoubleArrayOfArrays(NE_Photo_arr, byte_buffer);
NE_Rayl_arr = readIntArray(ZMAX + 1, byte_buffer);
E_Rayl_arr = readDoubleArrayOfArrays(NE_Rayl_arr, byte_buffer);
CS_Rayl_arr = readDoubleArrayOfArrays(NE_Rayl_arr, byte_buffer);
CS_Rayl_arr2 = readDoubleArrayOfArrays(NE_Rayl_arr, byte_buffer);
NE_Compt_arr = readIntArray(ZMAX + 1, byte_buffer);
E_Compt_arr = readDoubleArrayOfArrays(NE_Compt_arr, byte_buffer);
CS_Compt_arr = readDoubleArrayOfArrays(NE_Compt_arr, byte_buffer);
CS_Compt_arr2 = readDoubleArrayOfArrays(NE_Compt_arr, byte_buffer);
NE_Energy_arr = readIntArray(ZMAX + 1, byte_buffer);
E_Energy_arr = readDoubleArrayOfArrays(NE_Energy_arr, byte_buffer);
CS_Energy_arr = readDoubleArrayOfArrays(NE_Energy_arr, byte_buffer);
CS_Energy_arr2 = readDoubleArrayOfArrays(NE_Energy_arr, byte_buffer);
Nq_Rayl_arr = readIntArray(ZMAX +1, byte_buffer);
q_Rayl_arr = readDoubleArrayOfArrays(Nq_Rayl_arr, byte_buffer);
FF_Rayl_arr = readDoubleArrayOfArrays(Nq_Rayl_arr, byte_buffer);
FF_Rayl_arr2 = readDoubleArrayOfArrays(Nq_Rayl_arr, byte_buffer);
Nq_Compt_arr = readIntArray(ZMAX +1, byte_buffer);
q_Compt_arr = readDoubleArrayOfArrays(Nq_Compt_arr, byte_buffer);
SF_Compt_arr = readDoubleArrayOfArrays(Nq_Compt_arr, byte_buffer);
SF_Compt_arr2 = readDoubleArrayOfArrays(Nq_Compt_arr, byte_buffer);
NE_Fi_arr = readIntArray(ZMAX +1, byte_buffer);
E_Fi_arr = readDoubleArrayOfArrays(NE_Fi_arr, byte_buffer);
Fi_arr = readDoubleArrayOfArrays(NE_Fi_arr, byte_buffer);
Fi_arr2 = readDoubleArrayOfArrays(NE_Fi_arr, byte_buffer);
NE_Fii_arr = readIntArray(ZMAX +1, byte_buffer);
E_Fii_arr = readDoubleArrayOfArrays(NE_Fii_arr, byte_buffer);
Fii_arr = readDoubleArrayOfArrays(NE_Fii_arr, byte_buffer);
Fii_arr2 = readDoubleArrayOfArrays(NE_Fii_arr, byte_buffer);
Electron_Config_Kissel_arr = readDoubleArray((ZMAX + 1) * SHELLNUM_K, byte_buffer);
EdgeEnergy_Kissel_arr = readDoubleArray((ZMAX + 1) * SHELLNUM_K, byte_buffer);
NE_Photo_Total_Kissel_arr = readIntArray(ZMAX +1, byte_buffer);
E_Photo_Total_Kissel_arr = readDoubleArrayOfArrays(NE_Photo_Total_Kissel_arr, byte_buffer);
Photo_Total_Kissel_arr = readDoubleArrayOfArrays(NE_Photo_Total_Kissel_arr, byte_buffer);
Photo_Total_Kissel_arr2 = readDoubleArrayOfArrays(NE_Photo_Total_Kissel_arr, byte_buffer);
//NE_Photo_Partial_Kissel_arr = readIntArray((ZMAX + 1) * SHELLNUM_K, byte_buffer);
int[] temp_arr = readIntArray((ZMAX + 1) * SHELLNUM_K, byte_buffer);
NE_Photo_Partial_Kissel_arr = arrayReshape(temp_arr, ZMAX+1, SHELLNUM_K);
E_Photo_Partial_Kissel_arr = readDoubleArrayOfArraysOfArrays(NE_Photo_Partial_Kissel_arr, byte_buffer);
Photo_Partial_Kissel_arr = readDoubleArrayOfArraysOfArrays(NE_Photo_Partial_Kissel_arr, byte_buffer);
Photo_Partial_Kissel_arr2 = readDoubleArrayOfArraysOfArrays(NE_Photo_Partial_Kissel_arr, byte_buffer);
NShells_ComptonProfiles_arr = readIntArray(ZMAX +1, byte_buffer);
Npz_ComptonProfiles_arr = readIntArray(ZMAX +1, byte_buffer);
UOCCUP_ComptonProfiles_arr = readDoubleArrayOfArrays(NShells_ComptonProfiles_arr, byte_buffer);
pz_ComptonProfiles_arr = readDoubleArrayOfArrays(Npz_ComptonProfiles_arr, byte_buffer);
Total_ComptonProfiles_arr = readDoubleArrayOfArrays(Npz_ComptonProfiles_arr, byte_buffer);
Total_ComptonProfiles_arr2 = readDoubleArrayOfArrays(Npz_ComptonProfiles_arr, byte_buffer);
Partial_ComptonProfiles_arr = new double[ZMAX+1][][];
Partial_ComptonProfiles_arr2 = new double[ZMAX+1][][];
for (int i = 0 ; i < ZMAX+1 ; i++) {
if (NShells_ComptonProfiles_arr[i] <= 0) {
continue;
}
Partial_ComptonProfiles_arr[i] = new double[NShells_ComptonProfiles_arr[i]][];
for (int j = 0 ; j < NShells_ComptonProfiles_arr[i] ; j++) {
if (Npz_ComptonProfiles_arr[i] > 0 && UOCCUP_ComptonProfiles_arr[i][j] > 0) {
Partial_ComptonProfiles_arr[i][j] = readDoubleArray(Npz_ComptonProfiles_arr[i], byte_buffer);
}
}
}
for (int i = 0 ; i < ZMAX+1 ; i++) {
if (NShells_ComptonProfiles_arr[i] <= 0) {
continue;
}
Partial_ComptonProfiles_arr2[i] = new double[NShells_ComptonProfiles_arr[i]][];
for (int j = 0 ; j < NShells_ComptonProfiles_arr[i] ; j++) {
if (Npz_ComptonProfiles_arr[i] > 0 && UOCCUP_ComptonProfiles_arr[i][j] > 0) {
Partial_ComptonProfiles_arr2[i][j] = readDoubleArray(Npz_ComptonProfiles_arr[i], byte_buffer);
}
}
}
Auger_Yields_arr = readDoubleArray((ZMAX + 1)*SHELLNUM_A, byte_buffer);
Auger_Rates_arr = readDoubleArray((ZMAX + 1)*AUGERNUM, byte_buffer);
int nCompoundDataNISTList = byte_buffer.getInt();
compoundDataNISTList = new compoundDataNIST[nCompoundDataNISTList];
for (int i = 0 ; i < nCompoundDataNISTList ; i++) {
compoundDataNISTList[i] = new compoundDataNIST(byte_buffer);
}
int nNuclideDataList = byte_buffer.getInt();
nuclideDataList = new radioNuclideData[nNuclideDataList];
for (int i = 0 ; i < nNuclideDataList ; i++) {
nuclideDataList[i] = new radioNuclideData(byte_buffer);
}
//crystals
int nCrystals = byte_buffer.getInt();
crystalDataList = new Crystal_Struct[nCrystals];
for (int i = 0 ; i < nCrystals ; i++) {
crystalDataList[i] = new Crystal_Struct(byte_buffer);
}
// precalculated XRF CS components...
xrf_cross_sections_constants_full = readDoubleArray((ZMAX + 1) * (M5_SHELL + 1) * (L3_SHELL + 1), byte_buffer);
xrf_cross_sections_constants_auger_only = readDoubleArray((ZMAX + 1) * (M5_SHELL + 1) * (L3_SHELL + 1), byte_buffer);
//this should never happen!
if (byte_buffer.hasRemaining()) {
throw new RuntimeException("byte_buffer not empty when closing!");
}
}
}
/**
* Returns the @see <a href="https://en.wikipedia.org/wiki/Standard_atomic_weight">standard atomic weight</a>
*
* @param Z The atomic number
* @return The standard atomic weight (dimensionless)
*/
public static double AtomicWeight(int Z) {
double atomic_weight;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
atomic_weight = AtomicWeight_arr[Z];
if (atomic_weight <= 0.) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
return atomic_weight;
}
/**
* For a given atomic number, returns the @see <a href="https://en.wikipedia.org/wiki/Density">element density</a>.
*
* @param Z The atomic number
* @return The element density, expressed in g/cm<sup>3</sup>
*/
public static double ElementDensity(int Z) {
double element_density;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
element_density = ElementDensity_arr[Z];
if (element_density <= 0.) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
return element_density;
}
/**
* For a given atomic number and shell, returns the corresponding @see <a href="https://en.wikipedia.org/wiki/Absorption_edge">absorption edge energy</a>.
*
* This is also known as the electron binding energy.
*
* @param Z The atomic number
* @param shell A macro identifying the shell, such as #K_SHELL
* @return The absorption edge energy, expressed in keV
*/
public static double EdgeEnergy(int Z, int shell) {
double edge_energy;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (shell < 0 || shell >= SHELLNUM) {
throw new IllegalArgumentException(UNKNOWN_SHELL);
}
edge_energy = EdgeEnergy_arr[shell + (Z * SHELLNUM)];
if (edge_energy <= 0.) {
throw new IllegalArgumentException(INVALID_SHELL);
}
return edge_energy;
}
/**
* For a given atomic number and shell, returns the corresponding atomic level width.
*
* @param Z The atomic number
* @param shell A macro identifying the shell, such as #K_SHELL
* @return The atomic level width, expressed in keV
*/
public static double AtomicLevelWidth(int Z, int shell) {
double atomic_level_width;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (shell<0 || shell>=SHELLNUM) {
throw new IllegalArgumentException(UNKNOWN_SHELL);
}
atomic_level_width = AtomicLevelWidth_arr[Z * SHELLNUM + shell];
if (atomic_level_width <= 0.) {
throw new IllegalArgumentException(INVALID_SHELL);
}
return atomic_level_width;
}
/**
* For a given atomic number and shell, returns the corresponding fluorescence yield.
*
* The returned value will be between 0 and 1.
*
* @param Z The atomic number
* @param shell A macro identifying the shell, such as #K_SHELL
* @return The fluorescence yield (dimensionless)
*/
public static double FluorYield(int Z, int shell) {
double fluor_yield;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (shell < 0 || shell >= SHELLNUM) {
throw new IllegalArgumentException(UNKNOWN_SHELL);
}
fluor_yield = FluorYield_arr[Z * SHELLNUM + shell];
if (fluor_yield <= 0.) {
throw new IllegalArgumentException(INVALID_SHELL);
}
return fluor_yield;
}
/**
* For a given atomic number and shell, returns the corresponding jump factor.
*
* @param Z The atomic number
* @param shell A macro identifying the shell, such as #K_SHELL
* @return The jump factor (dimensionless)
*/
public static double JumpFactor(int Z, int shell) {
double jump_factor;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (shell < 0 || shell >= SHELLNUM) {
throw new IllegalArgumentException(UNKNOWN_SHELL);
}
jump_factor = JumpFactor_arr[Z * SHELLNUM + shell];
if (jump_factor <= 0.) {
throw new IllegalArgumentException(INVALID_SHELL);
}
return jump_factor;
}
/**
* For a given atomic number and transition, returns the corresponding @see <a href="https://en.wikipedia.org/wiki/Coster%E2%80%93Kronig_transition">Coster-Kronig transition probability</a>.
*
* The returned value will be between 0 and 1.
*
* @param Z The atomic number
* @param trans A macro identifying the Coster-Kronig transition, such as #FL12_TRANS.
* @return The Coster-Kronig transition probability (dimensionless)
*/
public static double CosKronTransProb(int Z, int trans) {
double trans_prob;
if (Z < 1 || Z > ZMAX){
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (trans < 1 || trans >= TRANSNUM) {
throw new IllegalArgumentException(UNKNOWN_CK);
}
trans_prob = CosKron_arr[Z * TRANSNUM + trans];
if (trans_prob <= 0.) {
throw new IllegalArgumentException(INVALID_CK);
}
return trans_prob;
}
/**
* For a given atomic number and line, returns the corresponding radiative rate.
*
* The returned value will be between 0 and 1.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @return The radiative rate (dimensionless)
*/
public static double RadRate(int Z, int line) {
double rad_rate, rr;
int i;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (line == KA_LINE) {
rr = 0.0;
for (i= 0 ; i <= 2 ; i++) {
rr += RadRate_arr[Z * LINENUM + i];
}
if (rr == 0.0) {
throw new IllegalArgumentException(INVALID_LINE);
}
return rr;
}
else if (line == KB_LINE) {
/*
* we assume that RR(Ka)+RR(Kb) = 1.0
*/
rr = RadRate(Z, KA_LINE);
if (rr == 1.0) {
throw new IllegalArgumentException(INVALID_LINE);
}
else if (rr == 0.0) {
throw new IllegalArgumentException(INVALID_LINE);
}
return 1.0 - rr;
}
else if (line == LA_LINE) {
line = -L3M5_LINE - 1;
rr = RadRate_arr[Z * LINENUM + line];
line = -L3M4_LINE - 1;
rr += RadRate_arr[Z * LINENUM + line];
if (rr == 0.0) {
throw new IllegalArgumentException(INVALID_LINE);
}
return rr;
}
else if (line == LB_LINE) {
throw new IllegalArgumentException(INVALID_LINE);
}
/*
* in Siegbahn notation: use only KA, KB and LA. The radrates of other lines are nonsense
*/
line = -line - 1;
if (line < 0 || line >= LINENUM) {
throw new IllegalArgumentException(UNKNOWN_LINE);
}
rad_rate = RadRate_arr[Z * LINENUM + line];
if (rad_rate <= 0.) {
throw new IllegalArgumentException(INVALID_LINE);
}
return rad_rate;
}
private static double CS_Factory(int Z, double E, int[] NE_arr, double[][] E_arr, double[][] CS_arr, double[][] CS_arr2) {
double ln_E, ln_sigma, sigma;
if (Z < 1 || Z > ZMAX || NE_arr[Z] < 0) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
ln_E = Math.log(E * 1000.0);
ln_sigma = splint(E_arr[Z], CS_arr[Z], CS_arr2[Z], NE_arr[Z], ln_E);
sigma = Math.exp(ln_sigma);
return sigma;
}
/**
* For a given atomic number and energy, returns the corresponding photoionization cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Photo(int Z, double E) {
double rv = CS_Factory(Z, E, NE_Photo_arr, E_Photo_arr, CS_Photo_arr, CS_Photo_arr2);
return rv;
}
/**
* For a given atomic number and energy, returns the corresponding Rayleigh scattering cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Rayl(int Z, double E) {
double rv = CS_Factory(Z, E, NE_Rayl_arr, E_Rayl_arr, CS_Rayl_arr, CS_Rayl_arr2);
return rv;
}
/**
* For a given atomic number and energy, returns the corresponding Compton scattering cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Compt(int Z, double E) {
double rv = CS_Factory(Z, E, NE_Compt_arr, E_Compt_arr, CS_Compt_arr, CS_Compt_arr2);
return rv;
}
/**
* For a given atomic number and energy, returns the corresponding mass-energy absorption cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Energy(int Z, double E) {
double rv = CS_Factory(Z, E / 1000.0, NE_Energy_arr, E_Energy_arr, CS_Energy_arr, CS_Energy_arr2);
return rv;
}
/**
* For a given atomic number and energy, returns the corresponding total attenuation cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Total(int Z, double E) {
if (Z<1 || Z>ZMAX || NE_Photo_arr[Z] < 0 || NE_Rayl_arr[Z] < 0 || NE_Compt_arr[Z] < 0) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
return CS_Photo(Z, E) + CS_Rayl(Z, E) + CS_Compt(Z, E);
}
/**
* For a given atomic number and momentum transfer, returns the corresponding atomic form factor for Rayleigh scattering.
*
* @param Z The atomic number
* @param q The momentum transfer, expressed in Å<sup>-1</sup>
* @return The atomic form factor
*/
public static double FF_Rayl(int Z, double q) {
double FF;
if (Z < 1 || Z > ZMAX || Nq_Rayl_arr[Z] <= 0.0) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (q == 0)
return Z;
if (q < 0.0) {
throw new IllegalArgumentException(NEGATIVE_Q);
}
FF = splint(q_Rayl_arr[Z], FF_Rayl_arr[Z], FF_Rayl_arr2[Z], Nq_Rayl_arr[Z], q);
return FF;
}
/**
* For a given atomic number and momentum transfer, returns the corresponding incoherent scattering function for Compton scattering.
*
* @param Z The atomic number
* @param q The momentum transfer, expressed in Å<sup>-1</sup>
* @return The incoherent scattering function
*/
public static double SF_Compt(int Z, double q) {
double SF;
if (Z<1 || Z>ZMAX || Nq_Compt_arr[Z] <= 0.0) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (q <= 0.) {
throw new IllegalArgumentException(NEGATIVE_Q);
}
SF = splint(q_Compt_arr[Z], SF_Compt_arr[Z], SF_Compt_arr2[Z], Nq_Compt_arr[Z], q);
return SF;
}
/**
* For a given scattering angle, returns the @see <a href="https://en.wikipedia.org/wiki/Thomson_scattering">Thomson differential cross section</a>
*
* @param theta The scattering angle, between indicent and observed photon or wave.
* @return The Thomson differential cross section, expressed in barn
*/
public static double DCS_Thoms(double theta) {
double cos_theta;
cos_theta = Math.cos(theta);
return (RE2/2.0) * (1.0 + cos_theta * cos_theta);
}
/**
* For a given energy and scattering angle, returns the @see <a href="https://en.wikipedia.org/wiki/Klein%E2%80%93Nishina_formula">Klein-Nishina differential cross section</a>
*
* @param E The photon energy, expressed in keV
* @param theta The scattering angle, between indicent and observed photon.
* @return The Klein-Nishina differential cross section, expressed in barn
*/
public static double DCS_KN(double E, double theta) {
double cos_theta, t1, t2;
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
cos_theta = Math.cos(theta);
t1 = (1.0 - cos_theta) * E / MEC2 ;
t2 = 1.0 + t1;
return (RE2/2.) * (1.0 + cos_theta * cos_theta + t1 *t1 / t2) /t2 /t2;
}
/**
* For a given atomic number, energy and scattering angle, returns the Rayleigh differential cross section.
*
* @param Z The atomic number
* @param E The photon energy, expressed in keV
* @param theta The scattering angle, between indicent and observed photon.
* @return The Rayleigh differential cross section, expressed in cm<sup>2</sup>/g/sterad
*/
public static double DCS_Rayl(int Z, double E, double theta) {
double F, q ;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
q = MomentTransf(E, theta);
F = FF_Rayl(Z, q);
return AVOGNUM / AtomicWeight_arr[Z] * F * F * DCS_Thoms(theta);
}
/**
* For a given atomic number, energy and scattering angle, returns the Compton differential cross section.
*
* @param Z The atomic number
* @param E The photon energy, expressed in keV
* @param theta The scattering angle, between indicent and observed photon.
* @return The Compton differential cross section, expressed in cm<sup>2</sup>/g/sterad
*/
public static double DCS_Compt(int Z, double E, double theta) {
double S, q ;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
q = MomentTransf(E, theta);
S = SF_Compt(Z, q);
return AVOGNUM / AtomicWeight_arr[Z] * S * DCS_KN(E, theta);
}
/**
* For a given energy and scattering angle, returns the @see <a href="https://en.wikipedia.org/wiki/Momentum_transfer">momentum transfer</a>
*
* @param E The photon energy, expressed in keV
* @param theta The scattering angle, between indicent and observed photon.
* @return The momentum transfer for X-ray photon scattering, expressed in Å<sup>-1</sup>
*/
public static double MomentTransf(double E, double theta) {
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
return E / KEV2ANGST * Math.sin(theta / 2.0) ;
}
/**
* For a given energy, returns the @see <a href="https://en.wikipedia.org/wiki/Klein%E2%80%93Nishina_formula">Klein-Nishina cross section</a>
*
* @param E The photon energy, expressed in keV
* @return The Klein-Nishina cross section, expressed in barn
*/
public static double CS_KN(double E) {
double a, a3, b, b2, lb;
double sigma;
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
a = E / MEC2;
a3 = a * a * a;
b = 1 + 2 * a;
b2 = b * b;
lb = Math.log(b);
sigma = 2 * Math.PI * RE2*( (1 + a) / a3 * ( 2 * a * (1 + a) / b - lb) + 0.5 * lb / a - (1 + 3 * a) / b2);
return sigma;
}
/**
* For a given energy and scattering angle, returns the photon energy after @see <a href="https://en.wikipedia.org/wiki/Compton_scattering#Derivation_of_the_scattering_formula">Compton scattering</a>.
*
* @param E0 The initial photon energy, expressed in keV
* @param theta The scattering angle, between indicent and observed photon.
* @return The photon energy after scattering, expressed in keV.
*/
public static double ComptonEnergy(double E0, double theta) {
double cos_theta, alpha;
if (E0 <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
cos_theta = Math.cos(theta);
alpha = E0 / MEC2;
return E0 / (1 + alpha * (1 - cos_theta));
}
/**
* For a given atomic number and energy, returns the corresponding photoionization cross section.
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Photo_Total(int Z, double E) {
int shell;
double rv = 0.0;
if (Z < 1 || Z > ZMAX || NE_Photo_Total_Kissel_arr[Z] < 0) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (E <= 0.) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
for (shell = K_SHELL ; shell <= Q3_SHELL ; shell++) {
if (Electron_Config_Kissel_arr[Z * SHELLNUM_K + shell] > 1.0E-06) {
try {
rv += CSb_Photo_Partial(Z, shell, E) * Electron_Config_Kissel_arr[Z * SHELLNUM_K + shell];
} catch (IllegalArgumentException e) {
}
}
}
if (rv <= 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_PHOTO_CS);
}
return rv;
}
/**
* For a given atomic number and energy, returns the corresponding photoionization cross section.
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Photo_Total(int Z, double E) {
return CSb_Photo_Total(Z, E) * AVOGNUM / AtomicWeight_arr[Z];
}
/**
* For a given atomic number, shell and energy, returns the corresponding partial photoionization cross section.
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param shell A macro identifying the shell, such as #K_SHELL
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/electron.
*/
public static double CSb_Photo_Partial(int Z, int shell, double E) {
double ln_E, ln_sigma, sigma;
double x0, x1, y0, y1;
double m;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (shell < 0 || shell >= SHELLNUM_K) {
throw new IllegalArgumentException(UNKNOWN_SHELL);
}
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
if (Electron_Config_Kissel_arr[Z * SHELLNUM_K + shell] < 1.0E-06 || EdgeEnergy_arr[Z * SHELLNUM + shell] <= 0.0){
throw new IllegalArgumentException(INVALID_SHELL);
}
if (EdgeEnergy_arr[Z * SHELLNUM + shell] > E) {
throw new IllegalArgumentException(TOO_LOW_EXCITATION_ENERGY);
}
ln_E = Math.log(E);
if (EdgeEnergy_Kissel_arr[Z * SHELLNUM_K + shell] > EdgeEnergy_arr[Z * SHELLNUM + shell] && E < EdgeEnergy_Kissel_arr[Z * SHELLNUM_K + shell]) {
/*
* use log-log extrapolation
*/
x0 = E_Photo_Partial_Kissel_arr[Z][shell][0];
x1 = E_Photo_Partial_Kissel_arr[Z][shell][1];
y0 = Photo_Partial_Kissel_arr[Z][shell][0];
y1 = Photo_Partial_Kissel_arr[Z][shell][1];
/*
* do not allow "extreme" slopes... force them to be within -1;1
*/
m = (y1-y0)/(x1-x0);
if (m > 1.0)
m=1.0;
else if (m < -1.0)
m=-1.0;
ln_sigma = y0+m*(ln_E-x0);
}
else {
ln_sigma = splint(E_Photo_Partial_Kissel_arr[Z][shell], Photo_Partial_Kissel_arr[Z][shell], Photo_Partial_Kissel_arr2[Z][shell],NE_Photo_Partial_Kissel_arr[Z][shell], ln_E);
}
sigma = Math.exp(ln_sigma);
return sigma;
}
/**
* For a given atomic number, shell and energy, returns the corresponding partial photoionization cross section.
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param shell A macro identifying the shell, such as #K_SHELL
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Photo_Partial(int Z, int shell, double E) {
return CSb_Photo_Partial(Z, shell, E) * Electron_Config_Kissel_arr[Z * SHELLNUM_K + shell] * AVOGNUM/AtomicWeight_arr[Z];
}
/**
* For a given atomic number and energy, returns the corresponding total attenuation cross section.
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Total_Kissel(int Z, double E) {
if (Z < 1 || Z > ZMAX || NE_Photo_Total_Kissel_arr[Z] < 0 || NE_Rayl_arr[Z] < 0 || NE_Compt_arr[Z] < 0) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
return CS_Photo_Total(Z, E) + CS_Rayl(Z, E) + CS_Compt(Z, E);
}
/**
* For a given atomic number and energy, returns the corresponding total attenuation cross section.
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Total_Kissel(int Z, double E) {
return CS_Total_Kissel(Z, E) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number and shell, returns the corresponding @see <a href="https://en.wikipedia.org/wiki/Electron_configuration">electron configuration</a>.
*
* This method used the Kissel database to determine the electron configuration.
*
* @param Z The atomic number
* @param shell A macro identifying the shell, such as #K_SHELL
* @return The number of electrons that occupy the shell
*/
public static double ElectronConfig(int Z, int shell) {
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (shell < 0 || shell >= SHELLNUM_K) {
throw new IllegalArgumentException(UNKNOWN_SHELL);
}
double rv = Electron_Config_Kissel_arr[Z * SHELLNUM_K + shell];
if (rv == 0.0) {
throw new IllegalArgumentException(INVALID_SHELL);
}
return rv;
}
/**
* For a given atomic number and momentum, returns the corresponding Compton scattering profile, summed over all shells.
*
* @param Z The atomic number
* @param pz The momentum
* @return The Compton scattering profile
*/
public static double ComptonProfile(int Z, double pz) {
double q, ln_q;
double ln_pz;
if (Z < 1 || Z > ZMAX || NShells_ComptonProfiles_arr[Z] < 0) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (pz < 0.0) {
throw new IllegalArgumentException(NEGATIVE_PZ);
}
ln_pz = Math.log(pz + 1.0);
ln_q = splint(pz_ComptonProfiles_arr[Z], Total_ComptonProfiles_arr[Z], Total_ComptonProfiles_arr2[Z], Npz_ComptonProfiles_arr[Z], ln_pz);
q = Math.exp(ln_q);
return q;
}
/**
* For a given atomic number, shell and momentum, returns the corresponding Compton scattering profile.
*
* @param Z The atomic number
* @param shell A macro identifying the shell, such as #K_SHELL
* @param pz The momentum
* @return The Compton scattering profile
*/
public static double ComptonProfile_Partial(int Z, int shell, double pz) {
double q, ln_q;
double ln_pz;
if (Z < 1 || Z > ZMAX || NShells_ComptonProfiles_arr[Z] < 1) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (shell >= NShells_ComptonProfiles_arr[Z] || shell < K_SHELL || UOCCUP_ComptonProfiles_arr[Z][shell] == 0.0 ) {
throw new IllegalArgumentException(INVALID_SHELL);
}
if (pz < 0.0) {
throw new IllegalArgumentException(NEGATIVE_PZ);
}
ln_pz = Math.log(pz + 1.0);
ln_q = splint(pz_ComptonProfiles_arr[Z], Partial_ComptonProfiles_arr[Z][shell], Partial_ComptonProfiles_arr2[Z][shell], Npz_ComptonProfiles_arr[Z], ln_pz);
q = Math.exp(ln_q);
return q;
}
/**
* For a given atomic number and shell, returns the corresponding @see <a href="https://en.wikipedia.org/wiki/Electron_configuration">electron configuration</a>.
*
* This method used the Biggs database to determine the electron configuration.
*
* @param Z The atomic number
* @param shell A macro identifying the shell, such as #K_SHELL
* @return The number of electrons that occupy the shell
*/
public static double ElectronConfig_Biggs(int Z, int shell) {
if (Z < 1 || Z > ZMAX || NShells_ComptonProfiles_arr[Z] < 0) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (shell >= NShells_ComptonProfiles_arr[Z] || UOCCUP_ComptonProfiles_arr[Z][shell] == 0.0 ) {
throw new IllegalArgumentException(INVALID_SHELL);
}
return UOCCUP_ComptonProfiles_arr[Z][shell];
}
/**
* For a given atomic number and Auger transition, returns the corresponding non-radiative Auger rate.
*
* Transitions that correspond to Coster-Kronig transitions (such as #L2_L3N6_AUGER) will throw an exception.
*
* The returned value will be between 0 and 1.
*
* @param Z The atomic number
* @param auger_trans A macro identifying the transition, such as #K_L2O7_AUGER
* @return The Auger radiative rate (dimensionless)
*/
public static double AugerRate(int Z, int auger_trans) {
double rv;
double yield, yield2;
rv = 0.0;
if (Z > ZMAX || Z < 1) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
else if (auger_trans < K_L1L1_AUGER || auger_trans > M4_M5Q3_AUGER) {
throw new IllegalArgumentException(UNKNOWN_AUGER);
}
rv = Auger_Rates_arr[Z * AUGERNUM + auger_trans];
if (rv <= 0.) {
throw new IllegalArgumentException(INVALID_AUGER);
}
return rv;
}
/**
* For a given atomic number and shell, returns the corresponding non-radiative Auger yield.
*
* The returned values does not cover Coster-Kronig transitions! Use #CosKronTransProb to obtain those values.
*
* The returned value will be between 0 and 1.
*
* @param Z The atomic number
* @param shell A macro identifying the shell, such as #K_SHELL
* @return The non-radiative Auger yield (dimensionless)
*/
public static double AugerYield(int Z, int shell) {
double rv;
if (Z > ZMAX || Z < 1) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
else if (shell < K_SHELL || shell > M5_SHELL) {
throw new IllegalArgumentException(UNKNOWN_SHELL);
}
rv = Auger_Yields_arr[Z * SHELLNUM_A + shell];
if (rv == 0.0) {
throw new IllegalArgumentException(INVALID_SHELL);
}
return rv;
}
private static double RadRate_catch(int Z, int line) {
try {
return RadRate(Z, line);
}
catch (IllegalArgumentException e) {
return 0.0;
}
}
private static double CS_FluorLine_catch(int Z, int line, double E) {
try {
return CS_FluorLine(Z, line, E);
}
catch (IllegalArgumentException e) {
return 0.0;
}
}
private static double EdgeEnergy_catch(int Z, int shell) {
try {
return EdgeEnergy(Z, shell);
}
catch (IllegalArgumentException e) {
return 0.0;
}
}
private static double FluorYield_catch(int Z, int shell) {
try {
return FluorYield(Z, shell);
}
catch (IllegalArgumentException e) {
return 0.0;
}
}
private static double JumpFactor_catch(int Z, int shell) {
try {
return JumpFactor(Z, shell);
}
catch (IllegalArgumentException e) {
return 0.0;
}
}
private static double LineEnergy_catch(int Z, int line) {
try {
return LineEnergy(Z, line);
}
catch (IllegalArgumentException e) {
return 0.0;
}
}
private static double CS_Photo_Partial_catch(int Z, int shell, double E) {
try {
return CS_Photo_Partial(Z, shell, E);
}
catch (IllegalArgumentException e) {
return 0.0;
}
}
private static double CosKronTransProb_catch(int Z, int trans) {
try {
return CosKronTransProb(Z, trans);
}
catch (IllegalArgumentException e) {
return 0.0;
}
}
private static int get_kissel_offset(int n1, int n2, int n3) {
return (M5_SHELL + 1) * (L3_SHELL + 1) * n1 + (L3_SHELL + 1) * n2 + n3;
}
public static double PL1_pure_kissel(int Z, double E) {
return CS_Photo_Partial(Z, L1_SHELL, E);
}
public static double PL1_rad_cascade_kissel(int Z, double E, double PK) {
double rv;
rv = CS_Photo_Partial(Z,L1_SHELL, E);
if (PK > 0.0) {
rv += FluorYield_catch(Z, K_SHELL) * PK * RadRate_catch(Z, KL1_LINE);
}
return rv;
}
public static double PL1_auger_cascade_kissel(int Z, double E, double PK) {
double rv;
rv = CS_Photo_Partial(Z, L1_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, L1_SHELL, K_SHELL)];
return rv;
}
public static double PL1_full_cascade_kissel(int Z, double E, double PK) {
double rv;
rv = CS_Photo_Partial(Z, L1_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_full[get_kissel_offset(Z, L1_SHELL, K_SHELL)];
return rv;
}
public static double PL2_pure_kissel(int Z, double E, double PL1) {
double rv;
rv = CS_Photo_Partial(Z, L2_SHELL, E);
if (PL1 > 0.0)
rv += CosKronTransProb_catch(Z, FL12_TRANS) * PL1;
return rv;
}
public static double PL2_rad_cascade_kissel(int Z, double E, double PK, double PL1) {
double rv;
rv = CS_Photo_Partial(Z, L2_SHELL, E);
if (PK > 0.0)
rv += FluorYield_catch(Z, K_SHELL) * PK * RadRate_catch(Z, KL2_LINE);
if (PL1 > 0.0)
rv += CosKronTransProb_catch(Z, FL12_TRANS) * PL1;
return rv;
}
public static double PL2_auger_cascade_kissel(int Z, double E, double PK, double PL1) {
double rv;
rv = CS_Photo_Partial(Z, L2_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, L2_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += CosKronTransProb_catch(Z, FL12_TRANS) * PL1;
return rv;
}
public static double PL2_full_cascade_kissel(int Z, double E, double PK, double PL1) {
double rv;
rv = CS_Photo_Partial(Z,L2_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_full[get_kissel_offset(Z, L2_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += CosKronTransProb_catch(Z, FL12_TRANS) * PL1;
return rv;
}
public static double PL3_pure_kissel(int Z, double E, double PL1, double PL2) {
double rv;
rv = CS_Photo_Partial(Z, L3_SHELL, E);
if (PL1 > 0.0)
rv += (CosKronTransProb_catch(Z, FL13_TRANS) + CosKronTransProb_catch(Z, FLP13_TRANS)) * PL1;
if (PL2 > 0.0)
rv += CosKronTransProb_catch(Z, FL23_TRANS) * PL2;
return rv;
}
public static double PL3_rad_cascade_kissel(int Z, double E, double PK, double PL1, double PL2) {
double rv;
rv = CS_Photo_Partial(Z, L3_SHELL, E);
if (PK > 0.0)
rv += FluorYield_catch(Z, K_SHELL) * PK * RadRate_catch(Z, KL3_LINE);
if (PL1 > 0.0)
rv += (CosKronTransProb_catch(Z, FL13_TRANS) + CosKronTransProb_catch(Z, FLP13_TRANS))* PL1;
if (PL2 > 0.0)
rv += CosKronTransProb_catch(Z, FL23_TRANS) * PL2;
return rv;
}
public static double PL3_auger_cascade_kissel(int Z, double E, double PK, double PL1, double PL2) {
double rv;
rv = CS_Photo_Partial(Z,L3_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, L3_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += (CosKronTransProb_catch(Z, FL13_TRANS) + CosKronTransProb_catch(Z, FLP13_TRANS))* PL1;
if (PL2 > 0.0)
rv += CosKronTransProb_catch(Z, FL23_TRANS) * PL2;
return rv;
}
public static double PL3_full_cascade_kissel(int Z, double E, double PK, double PL1, double PL2) {
double rv;
rv = CS_Photo_Partial(Z,L3_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_full[get_kissel_offset(Z, L3_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += CosKronTransProb_catch(Z, FL13_TRANS) * PL1;
if (PL2 > 0.0)
rv += CosKronTransProb_catch(Z, FL23_TRANS) * PL2;
return rv;
}
public static double PM1_pure_kissel(int Z, double E) {
return CS_Photo_Partial(Z, M1_SHELL, E);
}
public static double PM1_rad_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3) {
double rv;
rv = CS_Photo_Partial(Z, M1_SHELL, E);
if (PK > 0.0)
rv += FluorYield_catch(Z, K_SHELL) * PK * RadRate_catch(Z, KM1_LINE);
if (PL1 > 0.0)
rv += FluorYield_catch(Z, L1_SHELL) * PL1 * RadRate_catch(Z, L1M1_LINE);
if (PL2 > 0.0)
rv += FluorYield_catch(Z, L2_SHELL) * PL2 * RadRate_catch(Z, L2M1_LINE);
if (PL3 > 0.0)
rv += FluorYield_catch(Z, L3_SHELL) * PL3 * RadRate_catch(Z, L3M1_LINE);
return rv;
}
public static double PM1_auger_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3) {
double rv;
rv = CS_Photo_Partial(Z, M1_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M1_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += PL1 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M1_SHELL, L1_SHELL)];
if (PL2 > 0.0)
rv += PL2 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M1_SHELL, L2_SHELL)];
if (PL3 > 0.0)
rv += PL3 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M1_SHELL, L3_SHELL)];
return rv;
}
public static double PM1_full_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3) {
double rv;
rv = CS_Photo_Partial(Z, M1_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_full[get_kissel_offset(Z, M1_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += PL1 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M1_SHELL, L1_SHELL)];
if (PL2 > 0.0)
rv += PL2 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M1_SHELL, L2_SHELL)];
if (PL3 > 0.0)
rv += PL3 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M1_SHELL, L3_SHELL)];
return rv;
}
public static double PM2_pure_kissel(int Z, double E, double PM1) {
double rv;
rv = CS_Photo_Partial(Z, M2_SHELL, E);
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM12_TRANS) * PM1;
return rv;
}
public static double PM2_rad_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1) {
double rv;
rv = CS_Photo_Partial(Z, M2_SHELL, E);
if (PK > 0.0)
rv += FluorYield_catch(Z, K_SHELL) * PK * RadRate_catch(Z, KM2_LINE);
if (PL1 > 0.0)
rv += FluorYield_catch(Z, L1_SHELL) * PL1 * RadRate_catch(Z, L1M2_LINE);
if (PL2 > 0.0)
rv += FluorYield_catch(Z, L2_SHELL) * PL2 * RadRate_catch(Z, L2M2_LINE);
if (PL3 > 0.0)
rv += FluorYield_catch(Z, L3_SHELL) * PL3 * RadRate_catch(Z, L3M2_LINE);
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM12_TRANS) * PM1;
return rv;
}
public static double PM2_auger_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1) {
double rv;
rv = CS_Photo_Partial(Z, M2_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M2_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += PL1 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M2_SHELL, L1_SHELL)];
if (PL2 > 0.0)
rv += PL2 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M2_SHELL, L2_SHELL)];
if (PL3 > 0.0)
rv += PL3 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M2_SHELL, L3_SHELL)];
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM12_TRANS) * PM1;
return rv;
}
public static double PM2_full_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1) {
double rv;
rv = CS_Photo_Partial(Z, M2_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_full[get_kissel_offset(Z, M2_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += PL1 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M2_SHELL, L1_SHELL)];
if (PL2 > 0.0)
rv += PL2 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M2_SHELL, L2_SHELL)];
if (PL3 > 0.0)
rv += PL3 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M2_SHELL, L3_SHELL)];
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM12_TRANS) * PM1;
return rv;
}
public static double PM3_pure_kissel(int Z, double E, double PM1, double PM2) {
double rv;
rv = CS_Photo_Partial(Z, M3_SHELL, E);
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM13_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM23_TRANS) * PM2;
return rv;
}
public static double PM3_rad_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2) {
double rv;
rv = CS_Photo_Partial(Z, M3_SHELL, E);
if (PK > 0.0)
rv += FluorYield_catch(Z, K_SHELL) * PK * RadRate_catch(Z, KM3_LINE);
if (PL1 > 0.0)
rv += FluorYield_catch(Z, L1_SHELL) * PL1 * RadRate_catch(Z, L1M3_LINE);
if (PL2 > 0.0)
rv += FluorYield_catch(Z, L2_SHELL) * PL2 * RadRate_catch(Z, L2M3_LINE);
if (PL3 > 0.0)
rv += FluorYield_catch(Z, L3_SHELL) * PL3 * RadRate_catch(Z, L3M3_LINE);
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM13_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM23_TRANS) * PM2;
return rv;
}
public static double PM3_auger_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2) {
double rv;
rv = CS_Photo_Partial(Z, M3_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M3_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += PL1 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M3_SHELL, L1_SHELL)];
if (PL2 > 0.0)
rv += PL2 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M3_SHELL, L2_SHELL)];
if (PL3 > 0.0)
rv += PL3 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M3_SHELL, L3_SHELL)];
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM13_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM23_TRANS) * PM2;
return rv;
}
public static double PM3_full_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2) {
double rv;
rv = CS_Photo_Partial(Z, M3_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_full[get_kissel_offset(Z, M3_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += PL1 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M3_SHELL, L1_SHELL)];
if (PL2 > 0.0)
rv += PL2 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M3_SHELL, L2_SHELL)];
if (PL3 > 0.0)
rv += PL3 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M3_SHELL, L3_SHELL)];
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM13_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM23_TRANS) * PM2;
return rv;
}
public static double PM4_pure_kissel(int Z, double E, double PM1, double PM2, double PM3) {
double rv;
rv = CS_Photo_Partial(Z, M4_SHELL, E);
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM14_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM24_TRANS) * PM2;
if (PM3 > 0.0)
rv += CosKronTransProb_catch(Z, FM34_TRANS) * PM3;
return rv;
}
public static double PM4_rad_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3) {
double rv;
rv = CS_Photo_Partial(Z, M4_SHELL, E);
/*yes I know that KM4 lines are forbidden... */
if (PK > 0.0)
rv += FluorYield_catch(Z, K_SHELL) * PK * RadRate_catch(Z, KM4_LINE);
if (PL1 > 0.0)
rv += FluorYield_catch(Z, L1_SHELL) * PL1 * RadRate_catch(Z, L1M4_LINE);
if (PL2 > 0.0)
rv += FluorYield_catch(Z, L2_SHELL) * PL2 * RadRate_catch(Z, L2M4_LINE);
if (PL3 > 0.0)
rv += FluorYield_catch(Z, L3_SHELL) * PL3 * RadRate_catch(Z, L3M4_LINE);
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM14_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM24_TRANS) * PM2;
if (PM3 > 0.0)
rv += CosKronTransProb_catch(Z, FM34_TRANS) * PM3;
return rv;
}
public static double PM4_auger_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3) {
double rv;
rv = CS_Photo_Partial(Z, M4_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M4_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += PL1 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M4_SHELL, L1_SHELL)];
if (PL2 > 0.0)
rv += PL2 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M4_SHELL, L2_SHELL)];
if (PL3 > 0.0)
rv += PL3 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M4_SHELL, L3_SHELL)];
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM14_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM24_TRANS) * PM2;
if (PM3 > 0.0)
rv += CosKronTransProb_catch(Z, FM34_TRANS) * PM3;
return rv;
}
public static double PM4_full_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3) {
double rv;
rv = CS_Photo_Partial(Z, M4_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_full[get_kissel_offset(Z, M4_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += PL1 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M4_SHELL, L1_SHELL)];
if (PL2 > 0.0)
rv += PL2 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M4_SHELL, L2_SHELL)];
if (PL3 > 0.0)
rv += PL3 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M4_SHELL, L3_SHELL)];
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM14_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM24_TRANS) * PM2;
if (PM3 > 0.0)
rv += CosKronTransProb_catch(Z, FM34_TRANS) * PM3;
return rv;
}
public static double PM5_pure_kissel(int Z, double E, double PM1, double PM2, double PM3, double PM4) {
double rv;
rv = CS_Photo_Partial(Z, M5_SHELL, E);
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM15_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM25_TRANS) * PM2;
if (PM3 > 0.0)
rv += CosKronTransProb_catch(Z, FM35_TRANS) * PM3;
if (PM4 > 0.0)
rv += CosKronTransProb_catch(Z, FM45_TRANS) * PM4;
return rv;
}
public static double PM5_rad_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3, double PM4) {
double rv;
rv = CS_Photo_Partial(Z, M5_SHELL, E);
/*yes I know that KM5 lines are forbidden... */
if (PK > 0.0)
rv += FluorYield_catch(Z, K_SHELL) * PK * RadRate_catch(Z, KM5_LINE);
if (PL1 > 0.0)
rv += FluorYield_catch(Z, L1_SHELL) * PL1 * RadRate_catch(Z, L1M5_LINE);
if (PL2 > 0.0)
rv += FluorYield_catch(Z, L2_SHELL) * PL2 * RadRate_catch(Z, L2M5_LINE);
if (PL3 > 0.0)
rv += FluorYield_catch(Z, L3_SHELL) * PL3 * RadRate_catch(Z, L3M5_LINE);
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM15_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM25_TRANS) * PM2;
if (PM3 > 0.0)
rv += CosKronTransProb_catch(Z, FM35_TRANS) * PM3;
if (PM4 > 0.0)
rv += CosKronTransProb_catch(Z, FM45_TRANS) * PM4;
return rv;
}
public static double PM5_auger_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3, double PM4) {
double rv;
rv = CS_Photo_Partial(Z, M5_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M5_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += PL1 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M5_SHELL, L1_SHELL)];
if (PL2 > 0.0)
rv += PL2 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M5_SHELL, L2_SHELL)];
if (PL3 > 0.0)
rv += PL3 * xrf_cross_sections_constants_auger_only[get_kissel_offset(Z, M5_SHELL, L3_SHELL)];
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM15_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM25_TRANS) * PM2;
if (PM3 > 0.0)
rv += CosKronTransProb_catch(Z, FM35_TRANS) * PM3;
if (PM4 > 0.0)
rv += CosKronTransProb_catch(Z, FM45_TRANS) * PM4;
return rv;
}
public static double PM5_full_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3, double PM4) {
double rv;
rv = CS_Photo_Partial(Z, M5_SHELL, E);
if (PK > 0.0)
rv += PK * xrf_cross_sections_constants_full[get_kissel_offset(Z, M5_SHELL, K_SHELL)];
if (PL1 > 0.0)
rv += PL1 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M5_SHELL, L1_SHELL)];
if (PL2 > 0.0)
rv += PL2 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M5_SHELL, L2_SHELL)];
if (PL3 > 0.0)
rv += PL3 * xrf_cross_sections_constants_full[get_kissel_offset(Z, M5_SHELL, L3_SHELL)];
if (PM1 > 0.0)
rv += CosKronTransProb_catch(Z, FM15_TRANS) * PM1;
if (PM2 > 0.0)
rv += CosKronTransProb_catch(Z, FM25_TRANS) * PM2;
if (PM3 > 0.0)
rv += CosKronTransProb_catch(Z, FM35_TRANS) * PM3;
if (PM4 > 0.0)
rv += CosKronTransProb_catch(Z, FM45_TRANS) * PM4;
return rv;
}
/**
* For a given atomic number, shell and excitation energy, returns the corresponding XRF production cross section.
*
* This method is an alias for #CS_FluorLine_Kissel_Cascade, meaning that the cascade effect will be taken into account.
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @param E The energy of the photon, expressed in keV.
* @return The XRF production cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_FluorLine_Kissel(int Z, int line, double E) {
return CS_FluorLine_Kissel_Cascade(Z, line, E);
}
/**
* For a given atomic number, shell and excitation energy, returns the corresponding XRF production cross section.
*
* This method excludes the cascade effect from the calculation!
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @param E The energy of the photon, expressed in keV.
* @return The XRF production cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_FluorLine_Kissel_no_Cascade(int Z, int line, double E) {
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
if (line >= KN5_LINE && line <= KB_LINE) {
/*
* K lines -> never cascade effect!
*/
return CS_Photo_Partial(Z, K_SHELL, E) * FluorYield(Z, K_SHELL) * RadRate(Z, line);
}
else if (line >= L1P5_LINE && line <= L1M1_LINE) {
/*
* L1 lines
*/
return PL1_pure_kissel(Z, E) * FluorYield(Z, L1_SHELL) * RadRate(Z, line);
}
else if (line >= L2Q1_LINE && line <= L2M1_LINE) {
/*
* L2 lines
*/
double PL1 = 0.0;
try {
PL1 = PL1_pure_kissel(Z, E);
} catch (IllegalArgumentException e) {
}
return FluorYield(Z, L2_SHELL) * RadRate(Z, line)* PL2_pure_kissel(Z, E, PL1);
}
else if (line >= L3Q1_LINE && line <= L3M1_LINE) {
/*
* L3 lines
*/
double PL1 = 0.0;
double PL2 = 0.0;
try {
PL1 = PL1_pure_kissel(Z, E);
} catch (IllegalArgumentException e) {
}
try {
PL2 = PL2_pure_kissel(Z, E, PL1);
} catch (IllegalArgumentException e) {
}
return FluorYield(Z, L3_SHELL) * RadRate(Z, line) * PL3_pure_kissel(Z, E, PL1, PL2);
}
else if (line == LA_LINE) {
double cs_L3M4 = 0.0;
double cs_L3M5 = 0.0;
try {
cs_L3M4 = CS_FluorLine_Kissel_no_Cascade(Z, L3M4_LINE, E);
} catch (IllegalArgumentException e) {
}
try {
cs_L3M5 = CS_FluorLine_Kissel_no_Cascade(Z, L3M5_LINE, E);
} catch (IllegalArgumentException e) {
}
double rv = cs_L3M4 + cs_L3M5;
if (rv == 0.0)
throw new IllegalArgumentException(TOO_LOW_EXCITATION_ENERGY);
return rv;
}
else if (line == LB_LINE) {
double rv = 0.0;
for (int _line : LB_LINE_MACROS) {
try {
rv += CS_FluorLine_Kissel_no_Cascade(Z, _line, E);
} catch (IllegalArgumentException e) {
}
}
if (rv == 0.0)
throw new IllegalArgumentException(TOO_LOW_EXCITATION_ENERGY);
return rv;
}
else if (line >= M1P5_LINE && line <= M1N1_LINE) {
/*
* M1 lines
*/
return PM1_pure_kissel(Z, E) * FluorYield(Z, M1_SHELL) * RadRate(Z, line);
}
else if (line>=M2P5_LINE && line<=M2N1_LINE) {
/*
* M2 lines
*/
double PM1 = 0.0;
try {
PM1 = PM1_pure_kissel(Z, E);
} catch (IllegalArgumentException e) {
}
return FluorYield(Z, M2_SHELL) * RadRate(Z,line) * PM2_pure_kissel(Z, E, PM1);
}
else if (line>=M3Q1_LINE && line<=M3N1_LINE) {
/*
* M3 lines
*/
double PM1 = 0.0;
double PM2 = 0.0;
try {
PM1 = PM1_pure_kissel(Z, E);
} catch (IllegalArgumentException e) {
}
try {
PM2 = PM2_pure_kissel(Z, E, PM1);
} catch (IllegalArgumentException e) {
}
return FluorYield(Z, M3_SHELL) * RadRate(Z,line) * PM3_pure_kissel(Z, E, PM1, PM2);
}
else if (line >= M4P5_LINE && line <= M4N1_LINE) {
/*
* M4 lines
*/
double PM1 = 0.0;
double PM2 = 0.0;
double PM3 = 0.0;
try {
PM1 = PM1_pure_kissel(Z, E);
} catch (IllegalArgumentException e) {
}
try {
PM2 = PM2_pure_kissel(Z, E, PM1);
} catch (IllegalArgumentException e) {
}
try {
PM3 = PM3_pure_kissel(Z, E, PM1, PM2);
} catch (IllegalArgumentException e) {
}
return FluorYield(Z, M4_SHELL) * RadRate(Z,line) * PM4_pure_kissel(Z, E, PM1, PM2, PM3);
}
else if (line >= M5P5_LINE && line <= M5N1_LINE) {
/*
* M5 lines
*/
double PM1 = 0.0;
double PM2 = 0.0;
double PM3 = 0.0;
double PM4 = 0.0;
try {
PM1 = PM1_pure_kissel(Z, E);
} catch (IllegalArgumentException e) {
}
try {
PM2 = PM2_pure_kissel(Z, E, PM1);
} catch (IllegalArgumentException e) {
}
try {
PM3 = PM3_pure_kissel(Z, E, PM1, PM2);
} catch (IllegalArgumentException e) {
}
try {
PM4 = PM4_pure_kissel(Z, E, PM1, PM2, PM3);
} catch (IllegalArgumentException e) {
}
return FluorYield(Z, M5_SHELL) * RadRate(Z,line) * PM5_pure_kissel(Z, E, PM1, PM2, PM3, PM4);
}
else {
throw new IllegalArgumentException(INVALID_LINE);
}
}
private static abstract class CS_FluorLine_Cascade_Body {
public final double execute(int Z, int line, double E) {
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
if (line >= KN5_LINE && line <= KB_LINE) {
/*
* K lines -> never cascade effect!
*/
return CS_Photo_Partial(Z, K_SHELL, E) * FluorYield(Z, K_SHELL) * RadRate(Z, line);
}
else if (line >= L1P5_LINE && line <= L1M1_LINE) {
/*
* L1 lines
*/
double PK = CS_Photo_Partial_catch(Z, K_SHELL, E);
return PL1_cascade_kissel(Z, E, PK) * FluorYield(Z, L1_SHELL) * RadRate(Z, line);
}
else if (line >= L2Q1_LINE && line <= L2M1_LINE) {
/*
* L2 lines
*/
double PK = CS_Photo_Partial_catch(Z, K_SHELL, E);
double PL1 = PL1_cascade_kissel_catch(Z, E, PK);
return FluorYield(Z, L2_SHELL) * RadRate(Z,line) * PL2_cascade_kissel(Z, E, PK, PL1);
}
else if (line >= L3Q1_LINE && line <= L3M1_LINE) {
/*
* L3 lines
*/
double PK = CS_Photo_Partial_catch(Z, K_SHELL, E);
double PL1 = PL1_cascade_kissel_catch(Z, E, PK);
double PL2 = PL2_cascade_kissel_catch(Z, E, PK, PL1);
return FluorYield(Z, L3_SHELL) * RadRate(Z, line) * PL3_cascade_kissel(Z, E, PK, PL1, PL2);
}
else if (line == LA_LINE) {
double cs_L3M4 = 0.0;
double cs_L3M5 = 0.0;
try {
cs_L3M4 = execute(Z, L3M4_LINE, E);
} catch (IllegalArgumentException e) {
}
try {
cs_L3M5 = execute(Z, L3M5_LINE, E);
} catch (IllegalArgumentException e) {
}
double rv = cs_L3M4 + cs_L3M5;
if (rv == 0.0)
throw new IllegalArgumentException(TOO_LOW_EXCITATION_ENERGY);
return rv;
}
else if (line == LB_LINE) {
double rv = 0.0;
for (int _line : LB_LINE_MACROS) {
try {
rv += execute(Z, _line, E);
} catch (IllegalArgumentException e) {
}
}
if (rv == 0.0)
throw new IllegalArgumentException(TOO_LOW_EXCITATION_ENERGY);
return rv;
}
else if (line >= M1P5_LINE && line <= M1N1_LINE) {
/*
* M1 lines
*/
double PK = CS_Photo_Partial_catch(Z, K_SHELL, E);
double PL1 = PL1_cascade_kissel_catch(Z, E, PK);
double PL2 = PL2_cascade_kissel_catch(Z, E, PK, PL1);
double PL3 = PL3_cascade_kissel_catch(Z, E, PK, PL1, PL2);
return FluorYield(Z, M1_SHELL) * RadRate(Z, line) * PM1_cascade_kissel(Z, E, PK, PL1, PL2, PL3);
}
else if (line>=M2P5_LINE && line<=M2N1_LINE) {
/*
* M2 lines
*/
double PK = CS_Photo_Partial_catch(Z, K_SHELL, E);
double PL1 = PL1_cascade_kissel_catch(Z, E, PK);
double PL2 = PL2_cascade_kissel_catch(Z, E, PK, PL1);
double PL3 = PL3_cascade_kissel_catch(Z, E, PK, PL1, PL2);
double PM1 = PM1_cascade_kissel_catch(Z, E, PK, PL1, PL2, PL3);
return FluorYield(Z, M2_SHELL) * RadRate(Z, line) * PM2_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1);
}
else if (line>=M3Q1_LINE && line<=M3N1_LINE) {
/*
* M3 lines
*/
double PK = CS_Photo_Partial_catch(Z, K_SHELL, E);
double PL1 = PL1_cascade_kissel_catch(Z, E, PK);
double PL2 = PL2_cascade_kissel_catch(Z, E, PK, PL1);
double PL3 = PL3_cascade_kissel_catch(Z, E, PK, PL1, PL2);
double PM1 = PM1_cascade_kissel_catch(Z, E, PK, PL1, PL2, PL3);
double PM2 = PM2_cascade_kissel_catch(Z, E, PK, PL1, PL2, PL3, PM1);
return FluorYield(Z, M3_SHELL) * RadRate(Z, line) * PM3_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2);
}
else if (line >= M4P5_LINE && line <= M4N1_LINE) {
/*
* M4 lines
*/
double PK = CS_Photo_Partial_catch(Z, K_SHELL, E);
double PL1 = PL1_cascade_kissel_catch(Z, E, PK);
double PL2 = PL2_cascade_kissel_catch(Z, E, PK, PL1);
double PL3 = PL3_cascade_kissel_catch(Z, E, PK, PL1, PL2);
double PM1 = PM1_cascade_kissel_catch(Z, E, PK, PL1, PL2, PL3);
double PM2 = PM2_cascade_kissel_catch(Z, E, PK, PL1, PL2, PL3, PM1);
double PM3 = PM3_cascade_kissel_catch(Z, E, PK, PL1, PL2, PL3, PM1, PM2);
return FluorYield(Z, M4_SHELL) * RadRate(Z, line) * PM4_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2, PM3);
}
else if (line >= M5P5_LINE && line <= M5N1_LINE) {
/*
* M5 lines
*/
double PK = CS_Photo_Partial_catch(Z, K_SHELL, E);
double PL1 = PL1_cascade_kissel_catch(Z, E, PK);
double PL2 = PL2_cascade_kissel_catch(Z, E, PK, PL1);
double PL3 = PL3_cascade_kissel_catch(Z, E, PK, PL1, PL2);
double PM1 = PM1_cascade_kissel_catch(Z, E, PK, PL1, PL2, PL3);
double PM2 = PM2_cascade_kissel_catch(Z, E, PK, PL1, PL2, PL3, PM1);
double PM3 = PM3_cascade_kissel_catch(Z, E, PK, PL1, PL2, PL3, PM1, PM2);
double PM4 = PM4_cascade_kissel_catch(Z, E, PK, PL1, PL2, PL3, PM1, PM2, PM3);
return FluorYield(Z, M5_SHELL) * RadRate(Z, line) * PM5_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2, PM3, PM4);
}
else {
throw new IllegalArgumentException(INVALID_LINE);
}
}
public abstract double PL1_cascade_kissel(int Z, double E, double PK);
public abstract double PL2_cascade_kissel(int Z, double E, double PK, double PL1);
public abstract double PL3_cascade_kissel(int Z, double E, double PK, double PL1, double PL2);
public abstract double PM1_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3);
public abstract double PM2_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1);
public abstract double PM3_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2);
public abstract double PM4_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3);
public abstract double PM5_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3, double PM4);
public double PL1_cascade_kissel_catch(int Z, double E, double PK) {
try {
return PL1_cascade_kissel(Z, E, PK);
} catch (IllegalArgumentException e) {
return 0.0;
}
}
public double PL2_cascade_kissel_catch(int Z, double E, double PK, double PL1) {
try {
return PL2_cascade_kissel(Z, E, PK, PL1);
} catch (IllegalArgumentException e) {
return 0.0;
}
}
public double PL3_cascade_kissel_catch(int Z, double E, double PK, double PL1, double PL2) {
try {
return PL3_cascade_kissel(Z, E, PK, PL1, PL2);
} catch (IllegalArgumentException e) {
return 0.0;
}
}
public double PM1_cascade_kissel_catch(int Z, double E, double PK, double PL1, double PL2, double PL3) {
try {
return PM1_cascade_kissel(Z, E, PK, PL1, PL2, PL3);
} catch (IllegalArgumentException e) {
return 0.0;
}
}
public double PM2_cascade_kissel_catch(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1) {
try {
return PM2_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1);
} catch (IllegalArgumentException e) {
return 0.0;
}
}
public double PM3_cascade_kissel_catch(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2) {
try {
return PM3_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2);
} catch (IllegalArgumentException e) {
return 0.0;
}
}
public double PM4_cascade_kissel_catch(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3) {
try {
return PM4_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2, PM3);
} catch (IllegalArgumentException e) {
return 0.0;
}
}
public double PM5_cascade_kissel_catch(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3, double PM4) {
try {
return PM5_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2, PM3, PM4);
} catch (IllegalArgumentException e) {
return 0.0;
}
}
}
private static final class CS_FluorLine_Kissel_Radiative_CascadeImpl extends CS_FluorLine_Cascade_Body {
public double PL1_cascade_kissel(int Z, double E, double PK) {
return PL1_rad_cascade_kissel(Z, E, PK);
}
public double PL2_cascade_kissel(int Z, double E, double PK, double PL1) {
return PL2_rad_cascade_kissel(Z, E, PK, PL1);
}
public double PL3_cascade_kissel(int Z, double E, double PK, double PL1, double PL2) {
return PL3_rad_cascade_kissel(Z, E, PK, PL1, PL2);
}
public double PM1_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3) {
return PM1_rad_cascade_kissel(Z, E, PK, PL1, PL2, PL3);
}
public double PM2_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1) {
return PM2_rad_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1);
}
public double PM3_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2) {
return PM3_rad_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2);
}
public double PM4_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3) {
return PM4_rad_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2, PM3);
}
public double PM5_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3, double PM4) {
return PM5_rad_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2, PM3, PM4);
}
}
private static final class CS_FluorLine_Kissel_Nonradiative_CascadeImpl extends CS_FluorLine_Cascade_Body {
public double PL1_cascade_kissel(int Z, double E, double PK) {
return PL1_auger_cascade_kissel(Z, E, PK);
}
public double PL2_cascade_kissel(int Z, double E, double PK, double PL1) {
return PL2_auger_cascade_kissel(Z, E, PK, PL1);
}
public double PL3_cascade_kissel(int Z, double E, double PK, double PL1, double PL2) {
return PL3_auger_cascade_kissel(Z, E, PK, PL1, PL2);
}
public double PM1_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3) {
return PM1_auger_cascade_kissel(Z, E, PK, PL1, PL2, PL3);
}
public double PM2_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1) {
return PM2_auger_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1);
}
public double PM3_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2) {
return PM3_auger_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2);
}
public double PM4_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3) {
return PM4_auger_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2, PM3);
}
public double PM5_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3, double PM4) {
return PM5_auger_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2, PM3, PM4);
}
}
private static final class CS_FluorLine_Kissel_CascadeImpl extends CS_FluorLine_Cascade_Body {
public double PL1_cascade_kissel(int Z, double E, double PK) {
return PL1_full_cascade_kissel(Z, E, PK);
}
public double PL2_cascade_kissel(int Z, double E, double PK, double PL1) {
return PL2_full_cascade_kissel(Z, E, PK, PL1);
}
public double PL3_cascade_kissel(int Z, double E, double PK, double PL1, double PL2) {
return PL3_full_cascade_kissel(Z, E, PK, PL1, PL2);
}
public double PM1_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3) {
return PM1_full_cascade_kissel(Z, E, PK, PL1, PL2, PL3);
}
public double PM2_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1) {
return PM2_full_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1);
}
public double PM3_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2) {
return PM3_full_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2);
}
public double PM4_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3) {
return PM4_full_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2, PM3);
}
public double PM5_cascade_kissel(int Z, double E, double PK, double PL1, double PL2, double PL3, double PM1, double PM2, double PM3, double PM4) {
return PM5_full_cascade_kissel(Z, E, PK, PL1, PL2, PL3, PM1, PM2, PM3, PM4);
}
}
private static final CS_FluorLine_Cascade_Body CS_FLUORLINE_KISSEL_RADIATIVE = new CS_FluorLine_Kissel_Radiative_CascadeImpl();
private static final CS_FluorLine_Cascade_Body CS_FLUORLINE_KISSEL_NONRADIATIVE = new CS_FluorLine_Kissel_Nonradiative_CascadeImpl();
private static final CS_FluorLine_Cascade_Body CS_FLUORLINE_KISSEL_FULL = new CS_FluorLine_Kissel_CascadeImpl();
/**
* For a given atomic number, shell and excitation energy, returns the corresponding XRF production cross section.
*
* This implementation includes the radiative cascade contributions but excludes the non-radiative cascade effect!
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @param E The energy of the photon, expressed in keV.
* @return The XRF production cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_FluorLine_Kissel_Radiative_Cascade(int Z, int line, double E) {
return CS_FLUORLINE_KISSEL_RADIATIVE.execute(Z, line, E);
}
/**
* For a given atomic number, shell and excitation energy, returns the corresponding XRF production cross section.
*
* This implementation includes the non-radiative cascade contributions but excludes the radiative cascade effect!
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @param E The energy of the photon, expressed in keV.
* @return The XRF production cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_FluorLine_Kissel_Nonradiative_Cascade(int Z, int line, double E) {
return CS_FLUORLINE_KISSEL_NONRADIATIVE.execute(Z, line, E);
}
/**
* For a given atomic number, shell and excitation energy, returns the corresponding XRF production cross section.
*
* This implementation includes both non-radiative and radiative cascade effect contributions!
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @param E The energy of the photon, expressed in keV.
* @return The XRF production cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_FluorLine_Kissel_Cascade(int Z, int line, double E) {
return CS_FLUORLINE_KISSEL_FULL.execute(Z, line, E);
}
/**
* For a given atomic number, shell and excitation energy, returns the corresponding XRF production cross section.
*
* This implementation includes both non-radiative and radiative cascade effect contributions!
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @param E The energy of the photon, expressed in keV.
* @return The XRF production cross section, expressed in barn/atom.
*/
public static double CSb_FluorLine_Kissel_Cascade(int Z, int line, double E) {
return CS_FluorLine_Kissel_Cascade(Z, line, E) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number, shell and excitation energy, returns the corresponding XRF production cross section.
*
* This implementation includes the non-radiative cascade contributions but excludes the radiative cascade effect!
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @param E The energy of the photon, expressed in keV.
* @return The XRF production cross section, expressed in barn/atom.
*/
public static double CSb_FluorLine_Kissel_Nonradiative_Cascade(int Z, int line, double E) {
return CS_FluorLine_Kissel_Nonradiative_Cascade(Z, line, E) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number, shell and excitation energy, returns the corresponding XRF production cross section.
*
* This implementation includes the radiative cascade contributions but excludes the non-radiative cascade effect!
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @param E The energy of the photon, expressed in keV.
* @return The XRF production cross section, expressed in barn/atom.
*/
public static double CSb_FluorLine_Kissel_Radiative_Cascade(int Z, int line, double E) {
return CS_FluorLine_Kissel_Radiative_Cascade(Z, line, E) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number, shell and excitation energy, returns the corresponding XRF production cross section.
*
* This method excludes the cascade effect from the calculation!
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @param E The energy of the photon, expressed in keV.
* @return The XRF production cross section, expressed in barn/atom.
*/
public static double CSb_FluorLine_Kissel_no_Cascade(int Z, int line, double E) {
return CS_FluorLine_Kissel_no_Cascade(Z, line, E) * AtomicWeight_arr[Z] / AVOGNUM;
}
private static double Jump_from_L1(int Z, double E) {
double Factor = 1.0, JumpL1, JumpK;
double edgeK = EdgeEnergy_catch(Z, K_SHELL);
double edgeL1 = EdgeEnergy_catch(Z, L1_SHELL);
double yield;
if (E > edgeK && edgeK > 0.0) {
JumpK = JumpFactor_catch(Z, K_SHELL);
if (JumpK == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_JUMP_FACTOR);
}
Factor /= JumpK ;
}
if (E > edgeL1 && edgeL1 > 0.0) {
JumpL1 = JumpFactor_catch(Z, L1_SHELL);
if (JumpL1 == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_JUMP_FACTOR);
}
yield = FluorYield_catch(Z, L1_SHELL);
if (yield == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_FLUOR_YIELD);
}
Factor *= ((JumpL1 - 1) / JumpL1) * yield;
}
else {
throw new IllegalArgumentException(TOO_LOW_EXCITATION_ENERGY);
}
return Factor;
}
private static double Jump_from_L2(int Z, double E) {
double Factor = 1.0, JumpL1, JumpL2, JumpK;
double TaoL1 = 0.0, TaoL2 = 0.0;
double edgeK = EdgeEnergy_catch(Z, K_SHELL);
double edgeL1 = EdgeEnergy_catch(Z, L1_SHELL);
double edgeL2 = EdgeEnergy_catch(Z, L2_SHELL);
double ck_L12, yield;
if (E > edgeK && edgeK > 0.0) {
JumpK = JumpFactor_catch(Z, K_SHELL);
if (JumpK == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_JUMP_FACTOR);
}
Factor /= JumpK ;
}
JumpL1 = JumpFactor_catch(Z, L1_SHELL);
JumpL2 = JumpFactor_catch(Z, L2_SHELL);
if (E > edgeL1 && edgeL1 > 0.0) {
if (JumpL1 == 0.0 || JumpL2 == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_JUMP_FACTOR);
}
TaoL1 = (JumpL1 - 1) / JumpL1 ;
TaoL2 = (JumpL2 - 1) / (JumpL2 * JumpL1) ;
}
else if (E > edgeL2 && edgeL2 > 0.0) {
if (JumpL2 == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_JUMP_FACTOR);
}
TaoL1 = 0.0;
TaoL2 = (JumpL2 - 1) / JumpL2;
}
else {
throw new IllegalArgumentException(TOO_LOW_EXCITATION_ENERGY);
}
ck_L12 = CosKronTransProb_catch(Z, FL12_TRANS);
if (TaoL1 > 0 && ck_L12 == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_CK);
}
yield = FluorYield_catch(Z, L2_SHELL);
if (yield == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_FLUOR_YIELD);
}
Factor *= (TaoL2 + TaoL1 * ck_L12) * yield;
return Factor;
}
private static double Jump_from_L3(int Z, double E) {
double Factor = 1.0, JumpL1, JumpL2, JumpL3, JumpK;
double TaoL1 = 0.0, TaoL2 = 0.0, TaoL3 = 0.0;
double edgeK = EdgeEnergy_catch(Z, K_SHELL);
double edgeL1 = EdgeEnergy_catch(Z, L1_SHELL);
double edgeL2 = EdgeEnergy_catch(Z, L2_SHELL);
double edgeL3 = EdgeEnergy_catch(Z, L3_SHELL);
double ck_L23, ck_L13, ck_LP13, ck_L12;
double yield;
if (E > edgeK && edgeK > 0.0) {
JumpK = JumpFactor_catch(Z, K_SHELL);
if (JumpK == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_JUMP_FACTOR);
}
Factor /= JumpK ;
}
JumpL1 = JumpFactor_catch(Z, L1_SHELL);
JumpL2 = JumpFactor_catch(Z, L2_SHELL);
JumpL3 = JumpFactor_catch(Z, L3_SHELL);
if (E > edgeL1 && edgeL1 > 0.0) {
if (JumpL1 == 0.0 || JumpL2 == 0.0 || JumpL3 == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_JUMP_FACTOR);
}
TaoL1 = (JumpL1 - 1) / JumpL1 ;
TaoL2 = (JumpL2 - 1) / (JumpL2 * JumpL1) ;
TaoL3 = (JumpL3 - 1) / (JumpL3 * JumpL2 * JumpL1) ;
}
else if (E > edgeL2 && edgeL2 > 0.0) {
if (JumpL2 == 0.0 || JumpL3 == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_JUMP_FACTOR);
}
TaoL1 = 0.0;
TaoL2 = (JumpL2 - 1) / (JumpL2) ;
TaoL3 = (JumpL3 - 1) / (JumpL3 * JumpL2) ;
}
else if (E > edgeL3 && edgeL3 > 0.0) {
TaoL1 = 0.0;
TaoL2 = 0.0;
if (JumpL3 == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_JUMP_FACTOR);
}
TaoL3 = (JumpL3 - 1) / JumpL3 ;
}
else {
throw new IllegalArgumentException(TOO_LOW_EXCITATION_ENERGY);
}
ck_L23 = CosKronTransProb_catch(Z, FL23_TRANS);
ck_L13 = CosKronTransProb_catch(Z, FL13_TRANS);
ck_LP13 = CosKronTransProb_catch(Z, FLP13_TRANS);
ck_L12 = CosKronTransProb_catch(Z, FL12_TRANS);
if (TaoL2 > 0.0 && ck_L23 == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_CK);
}
if (TaoL1 > 0.0 && (ck_L13 + ck_LP13 == 0.0 || ck_L12 == 0.0 || ck_L23 == 0.0)) {
throw new IllegalArgumentException(UNAVAILABLE_CK);
}
Factor *= TaoL3 + TaoL2 * ck_L23 + TaoL1 * (ck_L13 + ck_LP13 + ck_L12 * ck_L23);
yield = FluorYield_catch(Z, L3_SHELL);
if (yield == 0.0) {
throw new IllegalArgumentException(UNAVAILABLE_FLUOR_YIELD);
}
Factor *= yield;
return Factor;
}
private static double Jump_from_L1_catch(int Z, double E) {
try {
return Jump_from_L1(Z, E);
} catch (IllegalArgumentException e) {
return 0.0;
}
}
private static double Jump_from_L2_catch(int Z, double E) {
try {
return Jump_from_L2(Z, E);
} catch (IllegalArgumentException e) {
return 0.0;
}
}
private static double Jump_from_L3_catch(int Z, double E) {
try {
return Jump_from_L3(Z, E);
} catch (IllegalArgumentException e) {
return 0.0;
}
}
/**
* For a given atomic number, shell and excitation energy, returns the corresponding XRF production cross section.
*
* This method used the jump factor approximation to calculate the photoionization cross section,
* which is only support for K- and L-lines.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @param E The energy of the photon, expressed in keV.
* @return The XRF production cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_FluorLine(int Z, int line, double E) {
double JumpK;
double cs_line, Factor = 1.0;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
if (line >= KN5_LINE && line <= KB_LINE) {
double edgeK = EdgeEnergy(Z, K_SHELL);
double cs, rr;
if (E > edgeK) {
double yield;
JumpK = JumpFactor(Z, K_SHELL);
yield = FluorYield(Z, K_SHELL);
Factor = ((JumpK - 1)/JumpK) * yield;
}
else {
throw new IllegalArgumentException(TOO_LOW_EXCITATION_ENERGY);
}
cs = CS_Photo(Z, E);
rr = RadRate(Z, line);
cs_line = cs * Factor * rr;
}
else if ((line <= L1L2_LINE && line >= L3Q1_LINE) || line == LA_LINE) {
double cs, rr;
cs = CS_Photo(Z, E);
rr = RadRate(Z, line);
if (line >= L1P5_LINE && line <= L1L2_LINE) {
Factor = Jump_from_L1(Z, E);
}
else if (line >= L2Q1_LINE && line <= L2L3_LINE) {
Factor = Jump_from_L2(Z, E);
}
/*
* it's safe to use LA_LINE since it's only composed of 2 L3-lines
*/
else if ((line >= L3Q1_LINE && line <= L3M1_LINE) || line == LA_LINE) {
Factor = Jump_from_L3(Z, E);
}
cs_line = cs * Factor * rr;
}
else if (line == LB_LINE) {
/*
* b1->b17
*/
double cs;
cs_line =
Jump_from_L2_catch(Z, E) * (RadRate_catch(Z, L2M4_LINE) + RadRate_catch(Z, L2M3_LINE)) +
Jump_from_L3_catch(Z, E) * (RadRate_catch(Z, L3N5_LINE) + RadRate_catch(Z, L3O4_LINE) + RadRate_catch(Z, L3O5_LINE) + RadRate_catch(Z, L3O45_LINE) + RadRate_catch(Z, L3N1_LINE) + RadRate_catch(Z, L3O1_LINE) + RadRate_catch(Z, L3N6_LINE) + RadRate_catch(Z, L3N7_LINE) + RadRate_catch(Z, L3N4_LINE)) +
Jump_from_L1_catch(Z, E) * (RadRate_catch(Z, L1M3_LINE) + RadRate_catch(Z, L1M2_LINE) + RadRate_catch(Z, L1M5_LINE) + RadRate_catch(Z, L1M4_LINE));
if (cs_line == 0.0) {
throw new IllegalArgumentException(TOO_LOW_EXCITATION_ENERGY);
}
cs = CS_Photo(Z, E);
cs_line *= cs;
}
else {
throw new IllegalArgumentException(INVALID_LINE);
}
return cs_line;
}
private static double LineEnergyComposed(int Z, int line1, int line2) {
double line_tmp1 = LineEnergy_catch(Z, line1);
double line_tmp2 = LineEnergy_catch(Z, line2);
double rate_tmp1 = RadRate_catch(Z, line1);
double rate_tmp2 = RadRate_catch(Z, line2);
double rv = line_tmp1 * rate_tmp1 + line_tmp2 * rate_tmp2;
if (rv > 0.0) {
return rv/(rate_tmp1 + rate_tmp2);
}
else if ((line_tmp1 + line_tmp2) > 0.0) {
return (line_tmp1 + line_tmp2) / 2.0; /* in case of both radiative rates missing, use the average of both line energies. */
}
throw new IllegalArgumentException(INVALID_LINE);
}
/**
* For a given atomic number, line, returns the corresponding XRF line energy
*
* The line energies are equal to the difference of the absorption edge energies of the two shells
* that are involved in the transition.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @return The XRF line energy, expressed in keV.
*/
public static double LineEnergy(int Z, int line) {
double line_energy;
double lE, rr;
double tmp = 0.0, tmp1 = 0.0, tmp2 = 0.0;
int i;
int temp_line;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (line == KA_LINE || line == KB_LINE) {
if (line == KA_LINE) {
for (i = KL1; i <= KL3 ; i++) {
lE = LineEnergy_arr[Z * LINENUM + i];
rr = RadRate_arr[Z * LINENUM + i];
tmp1 += rr;
tmp += lE * rr;
}
}
else if (line == KB_LINE) {
for (i = KM1; i < KP5; i++) {
lE = LineEnergy_arr[Z * LINENUM + i];
rr = RadRate_arr[Z * LINENUM + i];
tmp1 += rr;
tmp += lE * rr;
}
}
if (tmp1 > 0) {
return tmp / tmp1;
}
else {
throw new IllegalArgumentException(INVALID_LINE);
}
}
if (line == LA_LINE) {
return LineEnergyComposed(Z, L3M4_LINE, L3M5_LINE);
}
else if (line == LB_LINE) {
tmp2 = 0.0;
tmp = 0.0;
for (LineShellPair pair : lb_pairs) {
tmp1 = CS_FluorLine_catch(Z, pair.line, EdgeEnergy_catch(Z, pair.shell) + 0.1);
tmp2 += tmp1;
tmp += LineEnergy_catch(Z, pair.line) * tmp1;
}
if (tmp2 > 0) {
return tmp / tmp2;
}
else {
throw new IllegalArgumentException(INVALID_LINE);
}
}
/*
* special cases for composed lines
*/
else if (line == L1N67_LINE) {
return LineEnergyComposed(Z, L1N6_LINE, L1N7_LINE);
}
else if (line == L1O45_LINE) {
return LineEnergyComposed(Z, L1O4_LINE, L1O5_LINE);
}
else if (line == L1P23_LINE) {
return LineEnergyComposed(Z, L1P2_LINE, L1P3_LINE);
}
else if (line == L2P23_LINE) {
return LineEnergyComposed(Z, L2P2_LINE, L2P3_LINE);
}
else if (line == L3O45_LINE) {
return LineEnergyComposed(Z, L3O4_LINE, L3O5_LINE);
}
else if (line == L3P23_LINE) {
return LineEnergyComposed(Z, L3O4_LINE, L3O5_LINE);
}
else if (line == L3P45_LINE) {
return LineEnergyComposed(Z, L3P4_LINE, L3P5_LINE);
}
/*
* KO_LINE and KP_LINE only have entries in the radrate database, not in the fluor_lines one.
* So to get the line energies, we should map to a macro that will work as long as there is an appropriate
* line energy in the fluor_lines database.
*/
else if (line == KO_LINE) {
line = KO1_LINE;
}
else if (line == KP_LINE) {
line = KP1_LINE;
}
line = -line - 1;
if (line < 0 || line >= LINENUM) {
throw new IllegalArgumentException(UNKNOWN_LINE);
}
line_energy = LineEnergy_arr[Z * LINENUM + line];
if (line_energy <= 0.0) {
throw new IllegalArgumentException(INVALID_LINE);
}
return line_energy;
}
/**
* For a given atomic number and energy, returns the corresponding total attenuation cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Total(int Z, double E) {
return CS_Total(Z, E) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number and energy, returns the corresponding photoionization cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Photo(int Z, double E) {
return CS_Photo(Z, E) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number and energy, returns the corresponding Rayleigh scattering cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Rayl(int Z, double E) {
return CS_Rayl(Z, E) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number and energy, returns the corresponding Compton scattering cross section.
*
* @param Z The atomic number
* @param E The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Compt(int Z, double E) {
return CS_Compt(Z, E) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number, shell and excitation energy, returns the corresponding XRF production cross section.
*
* This method used the jump factor approximation to calculate the photoionization cross section,
* which is only support for K- and L-lines.
*
* @param Z The atomic number
* @param line A macro identifying the line, such as #KL3_LINE or #LA1_LINE.
* @param E The energy of the photon, expressed in keV.
* @return The XRF production cross section, expressed in barn/atom.
*/
public static double CSb_FluorLine(int Z, int line, double E) {
return CS_FluorLine(Z, line, E) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number, energy and scattering angle, returns the Rayleigh differential cross section.
*
* @param Z The atomic number
* @param E The photon energy, expressed in keV
* @param theta The scattering angle, between indicent and observed photon.
* @return The Rayleigh differential cross section, expressed in barn/atom/sterad
*/
public static double DCSb_Rayl(int Z, double E, double theta) {
return DCS_Rayl(Z, E, theta) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number, energy and scattering angle, returns the Compton differential cross section.
*
* @param Z The atomic number
* @param E The photon energy, expressed in keV
* @param theta The scattering angle, between indicent and observed photon.
* @return The Compton differential cross section, expressed in barn/atom/sterad
*/
public static double DCSb_Compt(int Z, double E, double theta) {
return DCS_Compt(Z, E, theta) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number, energy and scattering angles, returns the Rayleigh differential cross section for a polarized beam.
*
* @param Z The atomic number
* @param E The photon energy, expressed in keV
* @param theta The polar scattering angle, between indicent and observed photon.
* @param phi The azimuthal scattering angle, between indicent and observed photon.
* @return The Rayleigh differential cross section, expressed in barn/atom/sterad
*/
public static double DCSPb_Rayl(int Z, double E, double theta, double phi) {
return DCSP_Rayl(Z, E, theta, phi) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number, energy and scattering angles, returns the Compton differential cross section for a polarized beam.
*
* @param Z The atomic number
* @param E The photon energy, expressed in keV
* @param theta The polar scattering angle, between indicent and observed photon.
* @param phi The azimuthal scattering angle, between indicent and observed photon.
* @return The Compton differential cross section, expressed in barn/atom/sterad
*/
public static double DCSPb_Compt(int Z, double E, double theta, double phi) {
return DCSP_Compt(Z, E, theta, phi) * AtomicWeight_arr[Z] / AVOGNUM;
}
/**
* For a given atomic number and energy, returns the anomalous scattering factor Δf′.
*
* @param Z The atomic number
* @param E The photon energy, expressed in keV
* @return The anomalous scattering factor Δf′
*/
public static double Fi(int Z, double E) {
double fi;
if (Z < 1 || Z > ZMAX || NE_Fi_arr[Z] < 0) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
fi = splint(E_Fi_arr[Z], Fi_arr[Z], Fi_arr2[Z], NE_Fii_arr[Z], E);
return fi;
}
/**
* For a given atomic number and energy, returns the anomalous scattering factor Δf″.
*
* @param Z The atomic number
* @param E The photon energy, expressed in keV
* @return The anomalous scattering factor Δf″
*/
public static double Fii(int Z, double E) {
double fii;
if (Z < 1 || Z > ZMAX || NE_Fii_arr[Z] < 0) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
fii = splint(E_Fii_arr[Z], Fii_arr[Z], Fii_arr2[Z], NE_Fii_arr[Z], E);
return fii;
}
/**
* For a given atomic number, energy and scattering angles, returns the Rayleigh differential cross section for a polarized beam.
*
* @param Z The atomic number
* @param E The photon energy, expressed in keV
* @param theta The polar scattering angle, between indicent and observed photon.
* @param phi The azimuthal scattering angle, between indicent and observed photon.
* @return The Rayleigh differential cross section, expressed in cm<sup>2</sup>/g/sterad.
*/
public static double DCSP_Rayl(int Z, double E, double theta, double phi) {
double F, q;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
q = MomentTransf(E , theta);
F = FF_Rayl(Z, q);
return AVOGNUM / AtomicWeight(Z) * F*F * DCSP_Thoms(theta, phi);
}
/**
* For a given atomic number, energy and scattering angles, returns the Compton differential cross section for a polarized beam.
*
* @param Z The atomic number
* @param E The photon energy, expressed in keV
* @param theta The polar scattering angle, between indicent and observed photon.
* @param phi The azimuthal scattering angle, between indicent and observed photon.
* @return The Compton differential cross section, expressed in cm<sup>2</sup>/g/sterad.
*/
public static double DCSP_Compt(int Z, double E, double theta, double phi) {
double S, q;
if (Z < 1 || Z > ZMAX) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
q = MomentTransf(E, theta);
S = SF_Compt(Z, q);
return AVOGNUM / AtomicWeight(Z) * S * DCSP_KN(E, theta, phi);
}
/**
* For a given energy and scattering angles, returns the Klein-Nishina differential cross section for a polarized beam.
*
* @param E The photon energy, expressed in keV
* @param theta The polar scattering angle, between indicent and observed photon.
* @param phi The azimuthal scattering angle, between indicent and observed photon.
* @return The Klein-Nishina differential cross section, expressed in cm<sup>2</sup>/g/sterad.
*/
public static double DCSP_KN(double E, double theta, double phi) {
double k0_k, k_k0, k_k0_2, cos_th, sin_th, cos_phi;
if (E <= 0.0) {
throw new IllegalArgumentException(NEGATIVE_ENERGY);
}
cos_th = Math.cos(theta);
sin_th = Math.sin(theta);
cos_phi = Math.cos(phi);
k0_k = 1.0 + (1.0 - cos_th) * E / MEC2 ;
k_k0 = 1.0 / k0_k;
k_k0_2 = k_k0 * k_k0;
return (RE2/2.) * k_k0_2 * (k_k0 + k0_k - 2 * sin_th * sin_th
* cos_phi * cos_phi);
}
/**
* For the given scattering angles, returns the @see <a href="https://en.wikipedia.org/wiki/Thomson_scattering">Thomson differential cross section for a polarized beam</a>
*
* @param theta The scattering angle, between indicent and observed photon or wave.
* @param phi The azimuthal scattering angle, between indicent and observed photon or wave.
* @return The Thomson differential cross section, expressed in barn
*/
public static double DCSP_Thoms(double theta, double phi) {
double sin_th, cos_phi ;
sin_th = Math.sin(theta) ;
cos_phi = Math.cos(phi);
return RE2 * (1.0 - sin_th * sin_th * cos_phi * cos_phi);
}
/**
* For the given atomic number, return the corresponding chemical symbol
*
* @param Z The atomic number
* @return The chemical symbol
*/
public static String AtomicNumberToSymbol(int Z) {
if (Z < 1 || Z >= MendelArray.length) {
throw new IllegalArgumentException(Z_OUT_OF_RANGE);
}
return MendelArray[Z];
}
/**
* For the given chemical symbol, return the corresponding atomic number
*
* @param symbol The chemical symbol
* @return The atomic number
*/
public static int SymbolToAtomicNumber(String symbol) {
int i;
if (symbol == null)
throw new IllegalArgumentException("Invalid chemical symbol");
for (i=1 ; i < MendelArray.length ; i++) {
if (symbol.equals(MendelArray[i])) {
return i;
}
}
throw new IllegalArgumentException("Invalid chemical symbol");
}
/**
* Parse the given chemical compound, and return its information as a @see compoundData instance.
*
* @param compoundString the chemical compound
* @return A @see compoundData instance
*/
public static compoundData CompoundParser(String compoundString) {
return new compoundData(compoundString);
}
private static compoundDataBase parseCompoundFull(String compound) {
try {
return CompoundParser(compound);
} catch (IllegalArgumentException e) {
try {
return GetCompoundDataNISTByName(compound);
} catch (IllegalArgumentException e2) {
throw new IllegalArgumentException(UNKNOWN_COMPOUND);
}
}
}
@FunctionalInterface
private static interface CS_Body_Energy {
public default double execute(String compound, double energy) {
compoundDataBase cd = parseCompoundFull(compound);
double rv = 0.0;
for (int i = 0 ; i < cd.getNElements() ; i++)
rv += cd.getMassFractions()[i] * CS_base(cd.getElements()[i], energy);
return rv;
}
public abstract double CS_base(int Z, double energy);
}
@FunctionalInterface
private static interface CS_Body_Energy_Theta {
public default double execute(String compound, double energy, double theta) {
compoundDataBase cd = parseCompoundFull(compound);
double rv = 0.0;
for (int i = 0 ; i < cd.getNElements() ; i++)
rv += cd.getMassFractions()[i] * CS_base(cd.getElements()[i], energy, theta);
return rv;
}
public abstract double CS_base(int Z, double energy, double theta);
}
@FunctionalInterface
private static interface CS_Body_Energy_Theta_Phi {
public default double execute(String compound, double energy, double theta, double phi) {
compoundDataBase cd = parseCompoundFull(compound);
double rv = 0.0;
for (int i = 0 ; i < cd.getNElements() ; i++)
rv += cd.getMassFractions()[i] * CS_base(cd.getElements()[i], energy, theta, phi);
return rv;
}
public abstract double CS_base(int Z, double energy, double theta, double phi);
}
private static final CS_Body_Energy CS_TOTAL_CP = Xraylib::CS_Total;
private static final CS_Body_Energy CS_TOTAL_KISSEL_CP = Xraylib::CS_Total_Kissel;
private static final CS_Body_Energy CS_RAYL_CP = Xraylib::CS_Rayl;
private static final CS_Body_Energy CS_COMPT_CP = Xraylib::CS_Compt;
private static final CS_Body_Energy CS_PHOTO_CP = Xraylib::CS_Photo;
private static final CS_Body_Energy CS_PHOTO_TOTAL_CP = Xraylib::CS_Photo_Total;
private static final CS_Body_Energy CS_ENERGY_CP = Xraylib::CS_Energy;
private static final CS_Body_Energy CSB_TOTAL_CP = Xraylib::CSb_Total;
private static final CS_Body_Energy CSB_TOTAL_KISSEL_CP = Xraylib::CSb_Total_Kissel;
private static final CS_Body_Energy CSB_RAYL_CP = Xraylib::CSb_Rayl;
private static final CS_Body_Energy CSB_COMPT_CP = Xraylib::CSb_Compt;
private static final CS_Body_Energy CSB_PHOTO_CP = Xraylib::CSb_Photo;
private static final CS_Body_Energy CSB_PHOTO_TOTAL_CP = Xraylib::CSb_Photo_Total;
private static final CS_Body_Energy_Theta DCS_RAYL_CP = Xraylib::DCS_Rayl;
private static final CS_Body_Energy_Theta DCS_COMPT_CP = Xraylib::DCS_Compt;
private static final CS_Body_Energy_Theta DCSB_RAYL_CP = Xraylib::DCSb_Rayl;
private static final CS_Body_Energy_Theta DCSB_COMPT_CP = Xraylib::DCSb_Compt;
private static final CS_Body_Energy_Theta_Phi DCSP_RAYL_CP = Xraylib::DCSP_Rayl;
private static final CS_Body_Energy_Theta_Phi DCSP_COMPT_CP = Xraylib::DCSP_Compt;
private static final CS_Body_Energy_Theta_Phi DCSPB_RAYL_CP = Xraylib::DCSPb_Rayl;
private static final CS_Body_Energy_Theta_Phi DCSPB_COMPT_CP = Xraylib::DCSPb_Compt;
/**
* For a given compound and energy, returns the corresponding total attenuation cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Total_CP(String compound, double energy) {
return CS_TOTAL_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding total attenuation cross section.
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Total_Kissel_CP(String compound, double energy) {
return CS_TOTAL_KISSEL_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding Rayleigh scattering cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Rayl_CP(String compound, double energy) {
return CS_RAYL_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding Compton scattering cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Compt_CP(String compound, double energy) {
return CS_COMPT_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding photoionization cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Photo_CP(String compound, double energy) {
return CS_PHOTO_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding photoionization cross section.
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Photo_Total_CP(String compound, double energy) {
return CS_PHOTO_TOTAL_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding total attenuation cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Total_CP(String compound, double energy) {
return CSB_TOTAL_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding total attenuation cross section.
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Total_Kissel_CP(String compound, double energy) {
return CSB_TOTAL_KISSEL_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding Rayleigh scattering cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Rayl_CP(String compound, double energy) {
return CSB_RAYL_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding Compton scattering cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Compt_CP(String compound, double energy) {
return CSB_COMPT_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding photoionization cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Photo_CP(String compound, double energy) {
return CSB_PHOTO_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding photoionization cross section.
*
* This method used the Kissel database to calculate the photoionization cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in barn/atom.
*/
public static double CSb_Photo_Total_CP(String compound, double energy) {
return CSB_PHOTO_TOTAL_CP.execute(compound, energy);
}
/**
* For a given compound and energy, returns the corresponding mass-energy absorption cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The energy of the photon, expressed in keV.
* @return The cross section, expressed in cm<sup>2</sup>/g.
*/
public static double CS_Energy_CP(String compound, double energy) {
return CS_ENERGY_CP.execute(compound, energy);
}
/**
* For a given compound, energy and scattering angle, returns the Rayleigh differential cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The photon energy, expressed in keV
* @param theta The scattering angle, between indicent and observed photon.
* @return The Rayleigh differential cross section, expressed in cm<sup>2</sup>/g/sterad
*/
public static double DCS_Rayl_CP(String compound, double energy, double theta) {
return DCS_RAYL_CP.execute(compound, energy, theta);
}
/**
* For a given compound, energy and scattering angle, returns the Compton differential cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The photon energy, expressed in keV
* @param theta The scattering angle, between indicent and observed photon.
* @return The Compton differential cross section, expressed in cm<sup>2</sup>/g/sterad
*/
public static double DCS_Compt_CP(String compound, double energy, double theta) {
return DCS_COMPT_CP.execute(compound, energy, theta);
}
/**
* For a given compound, energy and scattering angle, returns the Rayleigh differential cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The photon energy, expressed in keV
* @param theta The scattering angle, between indicent and observed photon.
* @return The Rayleigh differential cross section, expressed in barn/atom/sterad
*/
public static double DCSb_Rayl_CP(String compound, double energy, double theta) {
return DCSB_RAYL_CP.execute(compound, energy, theta);
}
/**
* For a given compound, energy and scattering angle, returns the Compton differential cross section.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The photon energy, expressed in keV
* @param theta The scattering angle, between indicent and observed photon.
* @return The Compton differential cross section, expressed in barn/atom/sterad
*/
public static double DCSb_Compt_CP(String compound, double energy, double theta) {
return DCSB_COMPT_CP.execute(compound, energy, theta);
}
/**
* For a given compound, energy and scattering angles, returns the Rayleigh differential cross section for a polarized beam.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The photon energy, expressed in keV
* @param theta The polar scattering angle, between indicent and observed photon.
* @param phi The azimuthal scattering angle, between indicent and observed photon.
* @return The Rayleigh differential cross section, expressed in cm<sup>2</sup>/g/sterad.
*/
public static double DCSP_Rayl_CP(String compound, double energy, double theta, double phi) {
return DCSP_RAYL_CP.execute(compound, energy, theta, phi);
}
/**
* For a given compound, energy and scattering angles, returns the Compton differential cross section for a polarized beam.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The photon energy, expressed in keV
* @param theta The polar scattering angle, between indicent and observed photon.
* @param phi The azimuthal scattering angle, between indicent and observed photon.
* @return The Compton differential cross section, expressed in cm<sup>2</sup>/g/sterad.
*/
public static double DCSP_Compt_CP(String compound, double energy, double theta, double phi) {
return DCSP_COMPT_CP.execute(compound, energy, theta, phi);
}
/**
* For a given compound, energy and scattering angles, returns the Rayleigh differential cross section for a polarized beam.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The photon energy, expressed in keV
* @param theta The polar scattering angle, between indicent and observed photon.
* @param phi The azimuthal scattering angle, between indicent and observed photon.
* @return The Rayleigh differential cross section, expressed in barn/atom/sterad.
*/
public static double DCSPb_Rayl_CP(String compound, double energy, double theta, double phi) {
return DCSPB_RAYL_CP.execute(compound, energy, theta, phi);
}
/**
* For a given compound, energy and scattering angles, returns the Compton differential cross section for a polarized beam.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param energy The photon energy, expressed in keV
* @param theta The polar scattering angle, between indicent and observed photon.
* @param phi The azimuthal scattering angle, between indicent and observed photon.
* @return The Compton differential cross section, expressed in barn/atom/sterad.
*/
public static double DCSPb_Compt_CP(String compound, double energy, double theta, double phi) {
return DCSPB_COMPT_CP.execute(compound, energy, theta, phi);
}
/**
* For a given compound name, return the corresponding @see compoundDataNIST instance, if found in the NIST database
*
* @param compoundString a valid NIST database compound name
* @return an instance of @see compoundDataNIST
*/
public static compoundDataNIST GetCompoundDataNISTByName(String compoundString) {
for (compoundDataNIST cdn : compoundDataNISTList) {
if (cdn.name.equals(compoundString))
return new compoundDataNIST(cdn);
}
throw new IllegalArgumentException(String.format("%s was not found in the NIST compound database", compoundString));
}
/**
* For a given index, return the corresponding @see compoundDataNIST instance, if found in the NIST database
*
* @param compoundIndex the index at which the requested compound is stored the database
* @return an instance of @see compoundDataNIST
*/
public static compoundDataNIST GetCompoundDataNISTByIndex(int compoundIndex) {
if (compoundIndex < 0 || compoundIndex >= compoundDataNISTList.length) {
throw new IllegalArgumentException(String.format("%d is out of the range of indices covered by the NIST compound database", compoundIndex));
}
return new compoundDataNIST(compoundDataNISTList[compoundIndex]);
}
/**
* @return a list of all compound names present in the NIST database
*/
public static String[] GetCompoundDataNISTList() {
return Arrays.stream(compoundDataNISTList).map(compound -> compound.name).toArray(String[]::new);
}
/**
* For a given radionuclide name, return the corresponding @see radioNuclideData instance, if found in the database
*
* @param radioNuclideString a valid radionuclide name
* @return an instance of @see radioNuclideData
*/
public static radioNuclideData GetRadioNuclideDataByName(String radioNuclideString) {
for (radioNuclideData rnd : nuclideDataList) {
if (rnd.name.equals(radioNuclideString))
return new radioNuclideData(rnd);
}
throw new IllegalArgumentException(String.format("%s was not found in the radionuclide database", radioNuclideString));
}
/**
* For a given index, return the corresponding @see radioNuclideData instance, if found in the database
*
* @param radioNuclideIndex the index at which the requested radionuclide is stored the database
* @return an instance of @see radioNuclideData
*/
public static radioNuclideData GetRadioNuclideDataByIndex(int radioNuclideIndex) {
if (radioNuclideIndex < 0 || radioNuclideIndex >= nuclideDataList.length) {
throw new IllegalArgumentException(String.format("%d is out of the range of indices covered by the radionuclide database", radioNuclideIndex));
}
return new radioNuclideData(nuclideDataList[radioNuclideIndex]);
}
/**
* @return a list of all radionuclide names present in the database
*/
public static String[] GetRadioNuclideDataList() {
return Arrays.stream(nuclideDataList).map(nuclide -> nuclide.name).toArray(String[]::new);
}
private static final double KD = 4.15179082788e-4;
/**
* For a given compound, energy and density, returns the real part of the refractive index.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param E The photon energy, expressed in keV
* @param density The density, expressed in g/cm<sup>3</sup>. If the compound is found in the NIST database, this argument will only be used if it is greater than zero, otherwise the density from the database will used instead.
* @return The real part of the refractive index
*/
public static double Refractive_Index_Re(String compound, double E, double density) {
compoundDataBase cd = parseCompoundFull(compound);
double delta = 0.0;
if (E <= 0.0)
throw new IllegalArgumentException(NEGATIVE_ENERGY);
else if (density <= 0.0) {
if (compoundDataNIST.class.isInstance(cd)) {
density = compoundDataNIST.class.cast(cd).density;
} else {
throw new IllegalArgumentException(NEGATIVE_DENSITY);
}
}
for (int i = 0 ; i < cd.getNElements() ; i++)
delta += cd.getMassFractions()[i] * KD * (cd.getElements()[i] + Fi(cd.getElements()[i], E)) / AtomicWeight(cd.getElements()[i]) / E / E;
return 1.0 - delta * density;
}
/**
* For a given compound, energy and density, returns the imaginary part of the refractive index.
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param E The photon energy, expressed in keV
* @param density The density, expressed in g/cm<sup>3</sup>. If the compound is found in the NIST database, this argument will only be used if it is greater than zero, otherwise the density from the database will used instead.
* @return The imaginary part of the refractive index
*/
public static double Refractive_Index_Im(String compound, double E, double density) {
compoundDataBase cd = parseCompoundFull(compound);
double rv = 0.0;
if (E <= 0.0)
throw new IllegalArgumentException(NEGATIVE_ENERGY);
else if (density <= 0.0) {
if (compoundDataNIST.class.isInstance(cd)) {
density = compoundDataNIST.class.cast(cd).density;
} else {
throw new IllegalArgumentException(NEGATIVE_DENSITY);
}
}
for (int i = 0 ; i < cd.getNElements() ; i++)
rv += CS_Total(cd.getElements()[i], E) * cd.getMassFractions()[i];
return rv * density * 9.8663479e-9 / E;
}
/**
* For a given compound, energy and density, returns the refractive index as a complex number .
*
* @param compound Either a valid chemical formula, or a compound from the NIST database (see #GetCompoundDataNISTList for a list)
* @param E The photon energy, expressed in keV
* @param density The density, expressed in g/cm<sup>3</sup>. If the compound is found in the NIST database, this argument will only be used if it is greater than zero, otherwise the density from the database will used instead.
* @return The refractive index as a complex number
*/
public static Complex Refractive_Index(String compound, double E, double density) {
double re = 0.0;
double im = 0.0;
compoundDataBase cd = parseCompoundFull(compound);
if (E <= 0.0)
throw new IllegalArgumentException(NEGATIVE_ENERGY);
else if (density <= 0.0) {
if (compoundDataNIST.class.isInstance(cd)) {
density = compoundDataNIST.class.cast(cd).density;
} else {
throw new IllegalArgumentException(NEGATIVE_DENSITY);
}
}
for (int i = 0 ; i < cd.getNElements() ; i++) {
re += cd.getMassFractions()[i] * KD * (cd.getElements()[i] + Fi(cd.getElements()[i], E)) / AtomicWeight(cd.getElements()[i]) / E / E;
im += CS_Total(cd.getElements()[i], E) * cd.getMassFractions()[i];
}
re = 1.0 - re * density;
im = im * density * 9.8663479e-9 / E;
return new Complex(re, im);
}
/**
* @return a list of all currently available crystals
*/
public static String[] Crystal_GetCrystalsList() {
return Arrays.stream(crystalDataList).map(crystal -> crystal.name).toArray(String[]::new);
}
/**
* For a given crystal name, returns the corresponding @see Crystal_Struct instance
*
* @param material The name of the crystal
* @return an instance of @see Crystal_Struct
*/
public static Crystal_Struct Crystal_GetCrystal(String material) {
for (Crystal_Struct cs : crystalDataList) {
if (cs.name.equals(material))
return new Crystal_Struct(cs);
}
throw new IllegalArgumentException(String.format("Crystal %s is not present in the array", material));
}
/** Calculates the Bragg angle, given an energy and set of Miller indices
*
* @param cs an instance of @see Crystal_Struct
* @param energy expressed in keV
* @param i_miller Miller index i
* @param j_miller Miller index j
* @param k_miller Miller index k
* @return the Bragg angle
*/
public static double Bragg_angle(Crystal_Struct cs, double energy, int i_miller, int j_miller, int k_miller) {
return cs.Bragg_angle(energy, i_miller, j_miller, k_miller);
}
/** Calculates the crystal structure factor
*
* @param cs an instance of @see Crystal_Struct
* @param energy expressed in keV
* @param i_miller Miller index i
* @param j_miller Miller index j
* @param k_miller Miller index k
* @param debye_factor The Debye factor
* @param rel_angle expressed in radians
* @return the crystal structure factor, as a complex number
*/
public static Complex Crystal_F_H_StructureFactor (Crystal_Struct cs, double energy, int i_miller, int j_miller, int k_miller, double debye_factor, double rel_angle) {
return cs.Crystal_F_H_StructureFactor(energy, i_miller, j_miller, k_miller, debye_factor, rel_angle);
}
/** Calculates the partial crystal structure factor
*
* @param cs an instance of @see Crystal_Struct
* @param energy expressed in keV
* @param i_miller Miller index i
* @param j_miller Miller index j
* @param k_miller Miller index k
* @param debye_factor The Debye factor
* @param rel_angle expressed in radians
* @param f0_flag
* @param f_prime_flag
* @param f_prime2_flag
* @return the crystal structure factor, as a complex number
*/
public static Complex Crystal_F_H_StructureFactor_Partial(Crystal_Struct cs, double energy,
int i_miller, int j_miller, int k_miller, double debye_factor, double rel_angle,
int f0_flag, int f_prime_flag, int f_prime2_flag) {
return cs.Crystal_F_H_StructureFactor_Partial(energy, i_miller, j_miller, k_miller, debye_factor, rel_angle, f0_flag, f_prime_flag, f_prime2_flag);
}
/** Calculate the unit cell volume
*
* @param cs an instance of @see Crystal_Struct
* @return The unit cell volume
*/
public static double Crystal_UnitCellVolume(Crystal_Struct cs) {
return cs.Crystal_UnitCellVolume();
}
/** Calculates the d-spacing for the crystal and Miller indices.
*
* @param cs an instance of @see Crystal_Struct
* @param i_miller Miller index i
* @param j_miller Miller index j
* @param k_miller Miller index k
* @return The crystal D-spacing
*/
public static double Crystal_dSpacing(Crystal_Struct cs, int i_miller, int j_miller, int k_miller) {
return cs.Crystal_dSpacing(i_miller, j_miller, k_miller);
}
/** Calculates the Q scattering amplitude, given an energy, Miller indices and relative angle
*
* @param cs an instance of @see Crystal_Struct
* @param energy expressed in keV
* @param i_miller Miller index i
* @param j_miller Miller index j
* @param k_miller Miller index k
* @param rel_angle expressed in radians
* @return The Q scattering amplitude
*/
public static double Q_scattering_amplitude(Crystal_Struct cs, double energy, int i_miller, int j_miller, int k_miller, double rel_angle) {
return cs.Q_scattering_amplitude(energy, i_miller, j_miller, k_miller, rel_angle);
}
/**
* For a given atomic number, energy, momentum transfer and Debye factor, returns
* an array with the atomic factors f<sub>0</sub>, Δf′ and Δf″.
*
* @param Z The atomic number
* @param energy The energy of the photon, expressed in keV.
* @param q The momentum transfer
* @param debye_factor The Debye factor
* @return an array with the three atomic factors
*/
public static double[] Atomic_Factors(int Z, double energy, double q, double debye_factor) {
if (debye_factor <= 0.0)
throw new IllegalArgumentException(NEGATIVE_DEBYE_FACTOR);
double f0 = FF_Rayl(Z, q) * debye_factor;
double f_prime = Fi(Z, energy) * debye_factor;
double f_prime2 = -Fii(Z, energy) * debye_factor;
return new double[]{f0, f_prime, f_prime2};
}
private static double splint(double[] xa, double[] ya, double[] y2a, int n, double x) {
int klo, khi, k;
double h, b, a;
if (x >= xa[n-1]) {
return ya[n-1];
}
if (x <= xa[0]) {
return ya[0];
}
klo = 0;
khi = n-1;
while (khi-klo > 1) {
k = (khi + klo) >> 1;
if (xa[k] > x) {
khi = k;
}
else {
klo = k;
}
}
h = xa[khi] - xa[klo];
if (h == 0.0) {
return (ya[klo] + ya[khi])/2.0;
}
a = (xa[khi] - x) / h;
b = (x - xa[klo]) / h;
return a*ya[klo] + b*ya[khi] + ((a*a*a-a)*y2a[klo]
+ (b*b*b-b)*y2a[khi])*(h*h)/6.0;
}
private static double[] AtomicWeight_arr;
private static double[] ElementDensity_arr;
private static double[] EdgeEnergy_arr;
private static double[] AtomicLevelWidth_arr;
private static double[] LineEnergy_arr;
private static double[] FluorYield_arr;
private static double[] JumpFactor_arr;
private static double[] CosKron_arr;
private static double[] RadRate_arr;
private static double[] xrf_cross_sections_constants_full;
private static double[] xrf_cross_sections_constants_auger_only;
private static int[] NE_Photo_arr;
private static double[][] E_Photo_arr;
private static double[][] CS_Photo_arr;
private static double[][] CS_Photo_arr2;
private static int[] NE_Rayl_arr;
private static double[][] E_Rayl_arr;
private static double[][] CS_Rayl_arr;
private static double[][] CS_Rayl_arr2;
private static int[] NE_Compt_arr;
private static double[][] E_Compt_arr;
private static double[][] CS_Compt_arr;
private static double[][] CS_Compt_arr2;
private static int[] NE_Energy_arr;
private static double[][] E_Energy_arr;
private static double[][] CS_Energy_arr;
private static double[][] CS_Energy_arr2;
private static int[] Nq_Rayl_arr;
private static double[][] q_Rayl_arr;
private static double[][] FF_Rayl_arr;
private static double[][] FF_Rayl_arr2;
private static int[] Nq_Compt_arr;
private static double[][] q_Compt_arr;
private static double[][] SF_Compt_arr;
private static double[][] SF_Compt_arr2;
private static int[] NE_Fi_arr;
private static double[][] E_Fi_arr;
private static double[][] Fi_arr;
private static double[][] Fi_arr2;
private static int[] NE_Fii_arr;
private static double[][] E_Fii_arr;
private static double[][] Fii_arr;
private static double[][] Fii_arr2;
private static int[] NE_Photo_Total_Kissel_arr;
private static double[][] E_Photo_Total_Kissel_arr;
private static double[][] Photo_Total_Kissel_arr;
private static double[][] Photo_Total_Kissel_arr2;
private static double[] Electron_Config_Kissel_arr;
private static double[] EdgeEnergy_Kissel_arr;
private static int[][] NE_Photo_Partial_Kissel_arr;
private static double[][][] E_Photo_Partial_Kissel_arr;
private static double[][][] Photo_Partial_Kissel_arr;
private static double[][][] Photo_Partial_Kissel_arr2;
private static int[] NShells_ComptonProfiles_arr;
private static int[] Npz_ComptonProfiles_arr;
private static double[][] UOCCUP_ComptonProfiles_arr;
private static double[][] pz_ComptonProfiles_arr;
private static double[][] Total_ComptonProfiles_arr;
private static double[][] Total_ComptonProfiles_arr2;
private static double[][][] Partial_ComptonProfiles_arr;
private static double[][][] Partial_ComptonProfiles_arr2;
private static double[] Auger_Yields_arr;
private static double[] Auger_Rates_arr;
private static compoundDataNIST[] compoundDataNISTList;
private static radioNuclideData[] nuclideDataList;
private static Crystal_Struct[] crystalDataList;
public static int ZMAX;
public static int SHELLNUM;
public static int SHELLNUM_K;
public static int SHELLNUM_A;
public static int TRANSNUM;
public static int LINENUM;
public static int AUGERNUM;
public static double RE2;
public static double MEC2;
public static double AVOGNUM;
public static double KEV2ANGST;
public static double R_E;
public static final int K_SHELL = 0;
public static final int L1_SHELL = 1;
public static final int L2_SHELL = 2;
public static final int L3_SHELL = 3;
public static final int M1_SHELL = 4;
public static final int M2_SHELL = 5;
public static final int M3_SHELL = 6;
public static final int M4_SHELL = 7;
public static final int M5_SHELL = 8;
public static final int N1_SHELL = 9;
public static final int N2_SHELL = 10;
public static final int N3_SHELL = 11;
public static final int N4_SHELL = 12;
public static final int N5_SHELL = 13;
public static final int N6_SHELL = 14;
public static final int N7_SHELL = 15;
public static final int O1_SHELL = 16;
public static final int O2_SHELL = 17;
public static final int O3_SHELL = 18;
public static final int O4_SHELL = 19;
public static final int O5_SHELL = 20;
public static final int O6_SHELL = 21;
public static final int O7_SHELL = 22;
public static final int P1_SHELL = 23;
public static final int P2_SHELL = 24;
public static final int P3_SHELL = 25;
public static final int P4_SHELL = 26;
public static final int P5_SHELL = 27;
public static final int Q1_SHELL = 28;
public static final int Q2_SHELL = 29;
public static final int Q3_SHELL = 30;
public static final int KL1_LINE = -1;
public static final int KL2_LINE = -2;
public static final int KL3_LINE = -3;
public static final int KM1_LINE = -4;
public static final int KM2_LINE = -5;
public static final int KM3_LINE = -6;
public static final int KM4_LINE = -7;
public static final int KM5_LINE = -8;
public static final int KN1_LINE = -9;
public static final int KN2_LINE = -10;
public static final int KN3_LINE = -11;
public static final int KN4_LINE = -12;
public static final int KN5_LINE = -13;
public static final int KN6_LINE = -14;
public static final int KN7_LINE = -15;
public static final int KO_LINE = -16;
public static final int KO1_LINE = -17;
public static final int KO2_LINE = -18;
public static final int KO3_LINE = -19;
public static final int KO4_LINE = -20;
public static final int KO5_LINE = -21;
public static final int KO6_LINE = -22;
public static final int KO7_LINE = -23;
public static final int KP_LINE = -24;
public static final int KP1_LINE = -25;
public static final int KP2_LINE = -26;
public static final int KP3_LINE = -27;
public static final int KP4_LINE = -28;
public static final int KP5_LINE = -29;
public static final int L1L2_LINE = -30;
public static final int L1L3_LINE = -31;
public static final int L1M1_LINE = -32;
public static final int L1M2_LINE = -33;
public static final int L1M3_LINE = -34;
public static final int L1M4_LINE = -35;
public static final int L1M5_LINE = -36;
public static final int L1N1_LINE = -37;
public static final int L1N2_LINE = -38;
public static final int L1N3_LINE = -39;
public static final int L1N4_LINE = -40;
public static final int L1N5_LINE = -41;
public static final int L1N6_LINE = -42;
public static final int L1N67_LINE = -43;
public static final int L1N7_LINE = -44;
public static final int L1O1_LINE = -45;
public static final int L1O2_LINE = -46;
public static final int L1O3_LINE = -47;
public static final int L1O4_LINE = -48;
public static final int L1O45_LINE = -49;
public static final int L1O5_LINE = -50;
public static final int L1O6_LINE = -51;
public static final int L1O7_LINE = -52;
public static final int L1P1_LINE = -53;
public static final int L1P2_LINE = -54;
public static final int L1P23_LINE = -55;
public static final int L1P3_LINE = -56;
public static final int L1P4_LINE = -57;
public static final int L1P5_LINE = -58;
public static final int L2L3_LINE = -59;
public static final int L2M1_LINE = -60;
public static final int L2M2_LINE = -61;
public static final int L2M3_LINE = -62;
public static final int L2M4_LINE = -63;
public static final int L2M5_LINE = -64;
public static final int L2N1_LINE = -65;
public static final int L2N2_LINE = -66;
public static final int L2N3_LINE = -67;
public static final int L2N4_LINE = -68;
public static final int L2N5_LINE = -69;
public static final int L2N6_LINE = -70;
public static final int L2N7_LINE = -71;
public static final int L2O1_LINE = -72;
public static final int L2O2_LINE = -73;
public static final int L2O3_LINE = -74;
public static final int L2O4_LINE = -75;
public static final int L2O5_LINE = -76;
public static final int L2O6_LINE = -77;
public static final int L2O7_LINE = -78;
public static final int L2P1_LINE = -79;
public static final int L2P2_LINE = -80;
public static final int L2P23_LINE = -81;
public static final int L2P3_LINE = -82;
public static final int L2P4_LINE = -83;
public static final int L2P5_LINE = -84;
public static final int L2Q1_LINE = -85;
public static final int L3M1_LINE = -86;
public static final int L3M2_LINE = -87;
public static final int L3M3_LINE = -88;
public static final int L3M4_LINE = -89;
public static final int L3M5_LINE = -90;
public static final int L3N1_LINE = -91;
public static final int L3N2_LINE = -92;
public static final int L3N3_LINE = -93;
public static final int L3N4_LINE = -94;
public static final int L3N5_LINE = -95;
public static final int L3N6_LINE = -96;
public static final int L3N7_LINE = -97;
public static final int L3O1_LINE = -98;
public static final int L3O2_LINE = -99;
public static final int L3O3_LINE = -100;
public static final int L3O4_LINE = -101;
public static final int L3O45_LINE = -102;
public static final int L3O5_LINE = -103;
public static final int L3O6_LINE = -104;
public static final int L3O7_LINE = -105;
public static final int L3P1_LINE = -106;
public static final int L3P2_LINE = -107;
public static final int L3P23_LINE = -108;
public static final int L3P3_LINE = -109;
public static final int L3P4_LINE = -110;
public static final int L3P45_LINE = -111;
public static final int L3P5_LINE = -112;
public static final int L3Q1_LINE = -113;
public static final int M1M2_LINE = -114;
public static final int M1M3_LINE = -115;
public static final int M1M4_LINE = -116;
public static final int M1M5_LINE = -117;
public static final int M1N1_LINE = -118;
public static final int M1N2_LINE = -119;
public static final int M1N3_LINE = -120;
public static final int M1N4_LINE = -121;
public static final int M1N5_LINE = -122;
public static final int M1N6_LINE = -123;
public static final int M1N7_LINE = -124;
public static final int M1O1_LINE = -125;
public static final int M1O2_LINE = -126;
public static final int M1O3_LINE = -127;
public static final int M1O4_LINE = -128;
public static final int M1O5_LINE = -129;
public static final int M1O6_LINE = -130;
public static final int M1O7_LINE = -131;
public static final int M1P1_LINE = -132;
public static final int M1P2_LINE = -133;
public static final int M1P3_LINE = -134;
public static final int M1P4_LINE = -135;
public static final int M1P5_LINE = -136;
public static final int M2M3_LINE = -137;
public static final int M2M4_LINE = -138;
public static final int M2M5_LINE = -139;
public static final int M2N1_LINE = -140;
public static final int M2N2_LINE = -141;
public static final int M2N3_LINE = -142;
public static final int M2N4_LINE = -143;
public static final int M2N5_LINE = -144;
public static final int M2N6_LINE = -145;
public static final int M2N7_LINE = -146;
public static final int M2O1_LINE = -147;
public static final int M2O2_LINE = -148;
public static final int M2O3_LINE = -149;
public static final int M2O4_LINE = -150;
public static final int M2O5_LINE = -151;
public static final int M2O6_LINE = -152;
public static final int M2O7_LINE = -153;
public static final int M2P1_LINE = -154;
public static final int M2P2_LINE = -155;
public static final int M2P3_LINE = -156;
public static final int M2P4_LINE = -157;
public static final int M2P5_LINE = -158;
public static final int M3M4_LINE = -159;
public static final int M3M5_LINE = -160;
public static final int M3N1_LINE = -161;
public static final int M3N2_LINE = -162;
public static final int M3N3_LINE = -163;
public static final int M3N4_LINE = -164;
public static final int M3N5_LINE = -165;
public static final int M3N6_LINE = -166;
public static final int M3N7_LINE = -167;
public static final int M3O1_LINE = -168;
public static final int M3O2_LINE = -169;
public static final int M3O3_LINE = -170;
public static final int M3O4_LINE = -171;
public static final int M3O5_LINE = -172;
public static final int M3O6_LINE = -173;
public static final int M3O7_LINE = -174;
public static final int M3P1_LINE = -175;
public static final int M3P2_LINE = -176;
public static final int M3P3_LINE = -177;
public static final int M3P4_LINE = -178;
public static final int M3P5_LINE = -179;
public static final int M3Q1_LINE = -180;
public static final int M4M5_LINE = -181;
public static final int M4N1_LINE = -182;
public static final int M4N2_LINE = -183;
public static final int M4N3_LINE = -184;
public static final int M4N4_LINE = -185;
public static final int M4N5_LINE = -186;
public static final int M4N6_LINE = -187;
public static final int M4N7_LINE = -188;
public static final int M4O1_LINE = -189;
public static final int M4O2_LINE = -190;
public static final int M4O3_LINE = -191;
public static final int M4O4_LINE = -192;
public static final int M4O5_LINE = -193;
public static final int M4O6_LINE = -194;
public static final int M4O7_LINE = -195;
public static final int M4P1_LINE = -196;
public static final int M4P2_LINE = -197;
public static final int M4P3_LINE = -198;
public static final int M4P4_LINE = -199;
public static final int M4P5_LINE = -200;
public static final int M5N1_LINE = -201;
public static final int M5N2_LINE = -202;
public static final int M5N3_LINE = -203;
public static final int M5N4_LINE = -204;
public static final int M5N5_LINE = -205;
public static final int M5N6_LINE = -206;
public static final int M5N7_LINE = -207;
public static final int M5O1_LINE = -208;
public static final int M5O2_LINE = -209;
public static final int M5O3_LINE = -210;
public static final int M5O4_LINE = -211;
public static final int M5O5_LINE = -212;
public static final int M5O6_LINE = -213;
public static final int M5O7_LINE = -214;
public static final int M5P1_LINE = -215;
public static final int M5P2_LINE = -216;
public static final int M5P3_LINE = -217;
public static final int M5P4_LINE = -218;
public static final int M5P5_LINE = -219;
public static final int N1N2_LINE = -220;
public static final int N1N3_LINE = -221;
public static final int N1N4_LINE = -222;
public static final int N1N5_LINE = -223;
public static final int N1N6_LINE = -224;
public static final int N1N7_LINE = -225;
public static final int N1O1_LINE = -226;
public static final int N1O2_LINE = -227;
public static final int N1O3_LINE = -228;
public static final int N1O4_LINE = -229;
public static final int N1O5_LINE = -230;
public static final int N1O6_LINE = -231;
public static final int N1O7_LINE = -232;
public static final int N1P1_LINE = -233;
public static final int N1P2_LINE = -234;
public static final int N1P3_LINE = -235;
public static final int N1P4_LINE = -236;
public static final int N1P5_LINE = -237;
public static final int N2N3_LINE = -238;
public static final int N2N4_LINE = -239;
public static final int N2N5_LINE = -240;
public static final int N2N6_LINE = -241;
public static final int N2N7_LINE = -242;
public static final int N2O1_LINE = -243;
public static final int N2O2_LINE = -244;
public static final int N2O3_LINE = -245;
public static final int N2O4_LINE = -246;
public static final int N2O5_LINE = -247;
public static final int N2O6_LINE = -248;
public static final int N2O7_LINE = -249;
public static final int N2P1_LINE = -250;
public static final int N2P2_LINE = -251;
public static final int N2P3_LINE = -252;
public static final int N2P4_LINE = -253;
public static final int N2P5_LINE = -254;
public static final int N3N4_LINE = -255;
public static final int N3N5_LINE = -256;
public static final int N3N6_LINE = -257;
public static final int N3N7_LINE = -258;
public static final int N3O1_LINE = -259;
public static final int N3O2_LINE = -260;
public static final int N3O3_LINE = -261;
public static final int N3O4_LINE = -262;
public static final int N3O5_LINE = -263;
public static final int N3O6_LINE = -264;
public static final int N3O7_LINE = -265;
public static final int N3P1_LINE = -266;
public static final int N3P2_LINE = -267;
public static final int N3P3_LINE = -268;
public static final int N3P4_LINE = -269;
public static final int N3P5_LINE = -270;
public static final int N4N5_LINE = -271;
public static final int N4N6_LINE = -272;
public static final int N4N7_LINE = -273;
public static final int N4O1_LINE = -274;
public static final int N4O2_LINE = -275;
public static final int N4O3_LINE = -276;
public static final int N4O4_LINE = -277;
public static final int N4O5_LINE = -278;
public static final int N4O6_LINE = -279;
public static final int N4O7_LINE = -280;
public static final int N4P1_LINE = -281;
public static final int N4P2_LINE = -282;
public static final int N4P3_LINE = -283;
public static final int N4P4_LINE = -284;
public static final int N4P5_LINE = -285;
public static final int N5N6_LINE = -286;
public static final int N5N7_LINE = -287;
public static final int N5O1_LINE = -288;
public static final int N5O2_LINE = -289;
public static final int N5O3_LINE = -290;
public static final int N5O4_LINE = -291;
public static final int N5O5_LINE = -292;
public static final int N5O6_LINE = -293;
public static final int N5O7_LINE = -294;
public static final int N5P1_LINE = -295;
public static final int N5P2_LINE = -296;
public static final int N5P3_LINE = -297;
public static final int N5P4_LINE = -298;
public static final int N5P5_LINE = -299;
public static final int N6N7_LINE = -300;
public static final int N6O1_LINE = -301;
public static final int N6O2_LINE = -302;
public static final int N6O3_LINE = -303;
public static final int N6O4_LINE = -304;
public static final int N6O5_LINE = -305;
public static final int N6O6_LINE = -306;
public static final int N6O7_LINE = -307;
public static final int N6P1_LINE = -308;
public static final int N6P2_LINE = -309;
public static final int N6P3_LINE = -310;
public static final int N6P4_LINE = -311;
public static final int N6P5_LINE = -312;
public static final int N7O1_LINE = -313;
public static final int N7O2_LINE = -314;
public static final int N7O3_LINE = -315;
public static final int N7O4_LINE = -316;
public static final int N7O5_LINE = -317;
public static final int N7O6_LINE = -318;
public static final int N7O7_LINE = -319;
public static final int N7P1_LINE = -320;
public static final int N7P2_LINE = -321;
public static final int N7P3_LINE = -322;
public static final int N7P4_LINE = -323;
public static final int N7P5_LINE = -324;
public static final int O1O2_LINE = -325;
public static final int O1O3_LINE = -326;
public static final int O1O4_LINE = -327;
public static final int O1O5_LINE = -328;
public static final int O1O6_LINE = -329;
public static final int O1O7_LINE = -330;
public static final int O1P1_LINE = -331;
public static final int O1P2_LINE = -332;
public static final int O1P3_LINE = -333;
public static final int O1P4_LINE = -334;
public static final int O1P5_LINE = -335;
public static final int O2O3_LINE = -336;
public static final int O2O4_LINE = -337;
public static final int O2O5_LINE = -338;
public static final int O2O6_LINE = -339;
public static final int O2O7_LINE = -340;
public static final int O2P1_LINE = -341;
public static final int O2P2_LINE = -342;
public static final int O2P3_LINE = -343;
public static final int O2P4_LINE = -344;
public static final int O2P5_LINE = -345;
public static final int O3O4_LINE = -346;
public static final int O3O5_LINE = -347;
public static final int O3O6_LINE = -348;
public static final int O3O7_LINE = -349;
public static final int O3P1_LINE = -350;
public static final int O3P2_LINE = -351;
public static final int O3P3_LINE = -352;
public static final int O3P4_LINE = -353;
public static final int O3P5_LINE = -354;
public static final int O4O5_LINE = -355;
public static final int O4O6_LINE = -356;
public static final int O4O7_LINE = -357;
public static final int O4P1_LINE = -358;
public static final int O4P2_LINE = -359;
public static final int O4P3_LINE = -360;
public static final int O4P4_LINE = -361;
public static final int O4P5_LINE = -362;
public static final int O5O6_LINE = -363;
public static final int O5O7_LINE = -364;
public static final int O5P1_LINE = -365;
public static final int O5P2_LINE = -366;
public static final int O5P3_LINE = -367;
public static final int O5P4_LINE = -368;
public static final int O5P5_LINE = -369;
public static final int O6O7_LINE = -370;
public static final int O6P4_LINE = -371;
public static final int O6P5_LINE = -372;
public static final int O7P4_LINE = -373;
public static final int O7P5_LINE = -374;
public static final int P1P2_LINE = -375;
public static final int P1P3_LINE = -376;
public static final int P1P4_LINE = -377;
public static final int P1P5_LINE = -378;
public static final int P2P3_LINE = -379;
public static final int P2P4_LINE = -380;
public static final int P2P5_LINE = -381;
public static final int P3P4_LINE = -382;
public static final int P3P5_LINE = -383;
public static final int F1_TRANS = 0;
public static final int F12_TRANS = 1;
public static final int F13_TRANS = 2;
public static final int FP13_TRANS = 3;
public static final int F23_TRANS = 4;
public static final int FL12_TRANS = 1;
public static final int FL13_TRANS = 2;
public static final int FLP13_TRANS = 3;
public static final int FL23_TRANS = 4;
public static final int FM12_TRANS = 5;
public static final int FM13_TRANS = 6;
public static final int FM14_TRANS = 7;
public static final int FM15_TRANS = 8;
public static final int FM23_TRANS = 9;
public static final int FM24_TRANS = 10;
public static final int FM25_TRANS = 11;
public static final int FM34_TRANS = 12;
public static final int FM35_TRANS = 13;
public static final int FM45_TRANS = 14;
/*
* Siegbahn notation
* according to Table VIII.2 from Nomenclature system for X-ray spectroscopy
* Linegroups -> usage is discouraged
*
*/
public static final int KA_LINE = 0;
public static final int KB_LINE = 1;
public static final int LA_LINE = 2;
public static final int LB_LINE = 3;
/* single lines */
public static final int KA1_LINE = KL3_LINE;
public static final int KA2_LINE = KL2_LINE;
public static final int KA3_LINE = KL1_LINE;
public static final int KB1_LINE = KM3_LINE;
public static final int KB2_LINE = KN3_LINE;
public static final int KB3_LINE = KM2_LINE;
public static final int KB4_LINE = KN5_LINE;
public static final int KB5_LINE = KM5_LINE;
public static final int LA1_LINE = L3M5_LINE;
public static final int LA2_LINE = L3M4_LINE;
public static final int LB1_LINE = L2M4_LINE;
public static final int LB2_LINE = L3N5_LINE;
public static final int LB3_LINE = L1M3_LINE;
public static final int LB4_LINE = L1M2_LINE;
public static final int LB5_LINE = L3O45_LINE;
public static final int LB6_LINE = L3N1_LINE;
public static final int LB7_LINE = L3O1_LINE;
public static final int LB9_LINE = L1M5_LINE;
public static final int LB10_LINE = L1M4_LINE;
public static final int LB15_LINE = L3N4_LINE;
public static final int LB17_LINE = L2M3_LINE;
public static final int LG1_LINE = L2N4_LINE;
public static final int LG2_LINE = L1N2_LINE;
public static final int LG3_LINE = L1N3_LINE;
public static final int LG4_LINE = L1O3_LINE;
public static final int LG5_LINE = L2N1_LINE;
public static final int LG6_LINE = L2O4_LINE;
public static final int LG8_LINE = L2O1_LINE;
public static final int LE_LINE = L2M1_LINE;
public static final int LH_LINE = L2M1_LINE;
public static final int LL_LINE = L3M1_LINE;
public static final int LS_LINE = L3M3_LINE;
public static final int LT_LINE = L3M2_LINE;
public static final int LU_LINE = L3N6_LINE;
public static final int LV_LINE = L2N6_LINE;
public static final int MA1_LINE = M5N7_LINE;
public static final int MA2_LINE = M5N6_LINE;
public static final int MB_LINE = M4N6_LINE;
public static final int MG_LINE = M3N5_LINE;
public static final int K_L1L1_AUGER = 0;
public static final int K_L1L2_AUGER = 1;
public static final int K_L1L3_AUGER = 2;
public static final int K_L1M1_AUGER = 3;
public static final int K_L1M2_AUGER = 4;
public static final int K_L1M3_AUGER = 5;
public static final int K_L1M4_AUGER = 6;
public static final int K_L1M5_AUGER = 7;
public static final int K_L1N1_AUGER = 8;
public static final int K_L1N2_AUGER = 9;
public static final int K_L1N3_AUGER = 10;
public static final int K_L1N4_AUGER = 11;
public static final int K_L1N5_AUGER = 12;
public static final int K_L1N6_AUGER = 13;
public static final int K_L1N7_AUGER = 14;
public static final int K_L1O1_AUGER = 15;
public static final int K_L1O2_AUGER = 16;
public static final int K_L1O3_AUGER = 17;
public static final int K_L1O4_AUGER = 18;
public static final int K_L1O5_AUGER = 19;
public static final int K_L1O6_AUGER = 20;
public static final int K_L1O7_AUGER = 21;
public static final int K_L1P1_AUGER = 22;
public static final int K_L1P2_AUGER = 23;
public static final int K_L1P3_AUGER = 24;
public static final int K_L1P4_AUGER = 25;
public static final int K_L1P5_AUGER = 26;
public static final int K_L1Q1_AUGER = 27;
public static final int K_L1Q2_AUGER = 28;
public static final int K_L1Q3_AUGER = 29;
public static final int K_L2L1_AUGER = 30;
public static final int K_L2L2_AUGER = 31;
public static final int K_L2L3_AUGER = 32;
public static final int K_L2M1_AUGER = 33;
public static final int K_L2M2_AUGER = 34;
public static final int K_L2M3_AUGER = 35;
public static final int K_L2M4_AUGER = 36;
public static final int K_L2M5_AUGER = 37;
public static final int K_L2N1_AUGER = 38;
public static final int K_L2N2_AUGER = 39;
public static final int K_L2N3_AUGER = 40;
public static final int K_L2N4_AUGER = 41;
public static final int K_L2N5_AUGER = 42;
public static final int K_L2N6_AUGER = 43;
public static final int K_L2N7_AUGER = 44;
public static final int K_L2O1_AUGER = 45;
public static final int K_L2O2_AUGER = 46;
public static final int K_L2O3_AUGER = 47;
public static final int K_L2O4_AUGER = 48;
public static final int K_L2O5_AUGER = 49;
public static final int K_L2O6_AUGER = 50;
public static final int K_L2O7_AUGER = 51;
public static final int K_L2P1_AUGER = 52;
public static final int K_L2P2_AUGER = 53;
public static final int K_L2P3_AUGER = 54;
public static final int K_L2P4_AUGER = 55;
public static final int K_L2P5_AUGER = 56;
public static final int K_L2Q1_AUGER = 57;
public static final int K_L2Q2_AUGER = 58;
public static final int K_L2Q3_AUGER = 59;
public static final int K_L3L1_AUGER = 60;
public static final int K_L3L2_AUGER = 61;
public static final int K_L3L3_AUGER = 62;
public static final int K_L3M1_AUGER = 63;
public static final int K_L3M2_AUGER = 64;
public static final int K_L3M3_AUGER = 65;
public static final int K_L3M4_AUGER = 66;
public static final int K_L3M5_AUGER = 67;
public static final int K_L3N1_AUGER = 68;
public static final int K_L3N2_AUGER = 69;
public static final int K_L3N3_AUGER = 70;
public static final int K_L3N4_AUGER = 71;
public static final int K_L3N5_AUGER = 72;
public static final int K_L3N6_AUGER = 73;
public static final int K_L3N7_AUGER = 74;
public static final int K_L3O1_AUGER = 75;
public static final int K_L3O2_AUGER = 76;
public static final int K_L3O3_AUGER = 77;
public static final int K_L3O4_AUGER = 78;
public static final int K_L3O5_AUGER = 79;
public static final int K_L3O6_AUGER = 80;
public static final int K_L3O7_AUGER = 81;
public static final int K_L3P1_AUGER = 82;
public static final int K_L3P2_AUGER = 83;
public static final int K_L3P3_AUGER = 84;
public static final int K_L3P4_AUGER = 85;
public static final int K_L3P5_AUGER = 86;
public static final int K_L3Q1_AUGER = 87;
public static final int K_L3Q2_AUGER = 88;
public static final int K_L3Q3_AUGER = 89;
public static final int K_M1L1_AUGER = 90;
public static final int K_M1L2_AUGER = 91;
public static final int K_M1L3_AUGER = 92;
public static final int K_M1M1_AUGER = 93;
public static final int K_M1M2_AUGER = 94;
public static final int K_M1M3_AUGER = 95;
public static final int K_M1M4_AUGER = 96;
public static final int K_M1M5_AUGER = 97;
public static final int K_M1N1_AUGER = 98;
public static final int K_M1N2_AUGER = 99;
public static final int K_M1N3_AUGER = 100;
public static final int K_M1N4_AUGER = 101;
public static final int K_M1N5_AUGER = 102;
public static final int K_M1N6_AUGER = 103;
public static final int K_M1N7_AUGER = 104;
public static final int K_M1O1_AUGER = 105;
public static final int K_M1O2_AUGER = 106;
public static final int K_M1O3_AUGER = 107;
public static final int K_M1O4_AUGER = 108;
public static final int K_M1O5_AUGER = 109;
public static final int K_M1O6_AUGER = 110;
public static final int K_M1O7_AUGER = 111;
public static final int K_M1P1_AUGER = 112;
public static final int K_M1P2_AUGER = 113;
public static final int K_M1P3_AUGER = 114;
public static final int K_M1P4_AUGER = 115;
public static final int K_M1P5_AUGER = 116;
public static final int K_M1Q1_AUGER = 117;
public static final int K_M1Q2_AUGER = 118;
public static final int K_M1Q3_AUGER = 119;
public static final int K_M2L1_AUGER = 120;
public static final int K_M2L2_AUGER = 121;
public static final int K_M2L3_AUGER = 122;
public static final int K_M2M1_AUGER = 123;
public static final int K_M2M2_AUGER = 124;
public static final int K_M2M3_AUGER = 125;
public static final int K_M2M4_AUGER = 126;
public static final int K_M2M5_AUGER = 127;
public static final int K_M2N1_AUGER = 128;
public static final int K_M2N2_AUGER = 129;
public static final int K_M2N3_AUGER = 130;
public static final int K_M2N4_AUGER = 131;
public static final int K_M2N5_AUGER = 132;
public static final int K_M2N6_AUGER = 133;
public static final int K_M2N7_AUGER = 134;
public static final int K_M2O1_AUGER = 135;
public static final int K_M2O2_AUGER = 136;
public static final int K_M2O3_AUGER = 137;
public static final int K_M2O4_AUGER = 138;
public static final int K_M2O5_AUGER = 139;
public static final int K_M2O6_AUGER = 140;
public static final int K_M2O7_AUGER = 141;
public static final int K_M2P1_AUGER = 142;
public static final int K_M2P2_AUGER = 143;
public static final int K_M2P3_AUGER = 144;
public static final int K_M2P4_AUGER = 145;
public static final int K_M2P5_AUGER = 146;
public static final int K_M2Q1_AUGER = 147;
public static final int K_M2Q2_AUGER = 148;
public static final int K_M2Q3_AUGER = 149;
public static final int K_M3L1_AUGER = 150;
public static final int K_M3L2_AUGER = 151;
public static final int K_M3L3_AUGER = 152;
public static final int K_M3M1_AUGER = 153;
public static final int K_M3M2_AUGER = 154;
public static final int K_M3M3_AUGER = 155;
public static final int K_M3M4_AUGER = 156;
public static final int K_M3M5_AUGER = 157;
public static final int K_M3N1_AUGER = 158;
public static final int K_M3N2_AUGER = 159;
public static final int K_M3N3_AUGER = 160;
public static final int K_M3N4_AUGER = 161;
public static final int K_M3N5_AUGER = 162;
public static final int K_M3N6_AUGER = 163;
public static final int K_M3N7_AUGER = 164;
public static final int K_M3O1_AUGER = 165;
public static final int K_M3O2_AUGER = 166;
public static final int K_M3O3_AUGER = 167;
public static final int K_M3O4_AUGER = 168;
public static final int K_M3O5_AUGER = 169;
public static final int K_M3O6_AUGER = 170;
public static final int K_M3O7_AUGER = 171;
public static final int K_M3P1_AUGER = 172;
public static final int K_M3P2_AUGER = 173;
public static final int K_M3P3_AUGER = 174;
public static final int K_M3P4_AUGER = 175;
public static final int K_M3P5_AUGER = 176;
public static final int K_M3Q1_AUGER = 177;
public static final int K_M3Q2_AUGER = 178;
public static final int K_M3Q3_AUGER = 179;
public static final int K_M4L1_AUGER = 180;
public static final int K_M4L2_AUGER = 181;
public static final int K_M4L3_AUGER = 182;
public static final int K_M4M1_AUGER = 183;
public static final int K_M4M2_AUGER = 184;
public static final int K_M4M3_AUGER = 185;
public static final int K_M4M4_AUGER = 186;
public static final int K_M4M5_AUGER = 187;
public static final int K_M4N1_AUGER = 188;
public static final int K_M4N2_AUGER = 189;
public static final int K_M4N3_AUGER = 190;
public static final int K_M4N4_AUGER = 191;
public static final int K_M4N5_AUGER = 192;
public static final int K_M4N6_AUGER = 193;
public static final int K_M4N7_AUGER = 194;
public static final int K_M4O1_AUGER = 195;
public static final int K_M4O2_AUGER = 196;
public static final int K_M4O3_AUGER = 197;
public static final int K_M4O4_AUGER = 198;
public static final int K_M4O5_AUGER = 199;
public static final int K_M4O6_AUGER = 200;
public static final int K_M4O7_AUGER = 201;
public static final int K_M4P1_AUGER = 202;
public static final int K_M4P2_AUGER = 203;
public static final int K_M4P3_AUGER = 204;
public static final int K_M4P4_AUGER = 205;
public static final int K_M4P5_AUGER = 206;
public static final int K_M4Q1_AUGER = 207;
public static final int K_M4Q2_AUGER = 208;
public static final int K_M4Q3_AUGER = 209;
public static final int K_M5L1_AUGER = 210;
public static final int K_M5L2_AUGER = 211;
public static final int K_M5L3_AUGER = 212;
public static final int K_M5M1_AUGER = 213;
public static final int K_M5M2_AUGER = 214;
public static final int K_M5M3_AUGER = 215;
public static final int K_M5M4_AUGER = 216;
public static final int K_M5M5_AUGER = 217;
public static final int K_M5N1_AUGER = 218;
public static final int K_M5N2_AUGER = 219;
public static final int K_M5N3_AUGER = 220;
public static final int K_M5N4_AUGER = 221;
public static final int K_M5N5_AUGER = 222;
public static final int K_M5N6_AUGER = 223;
public static final int K_M5N7_AUGER = 224;
public static final int K_M5O1_AUGER = 225;
public static final int K_M5O2_AUGER = 226;
public static final int K_M5O3_AUGER = 227;
public static final int K_M5O4_AUGER = 228;
public static final int K_M5O5_AUGER = 229;
public static final int K_M5O6_AUGER = 230;
public static final int K_M5O7_AUGER = 231;
public static final int K_M5P1_AUGER = 232;
public static final int K_M5P2_AUGER = 233;
public static final int K_M5P3_AUGER = 234;
public static final int K_M5P4_AUGER = 235;
public static final int K_M5P5_AUGER = 236;
public static final int K_M5Q1_AUGER = 237;
public static final int K_M5Q2_AUGER = 238;
public static final int K_M5Q3_AUGER = 239;
public static final int L1_L2L2_AUGER = 240;
public static final int L1_L2L3_AUGER = 241;
public static final int L1_L2M1_AUGER = 242;
public static final int L1_L2M2_AUGER = 243;
public static final int L1_L2M3_AUGER = 244;
public static final int L1_L2M4_AUGER = 245;
public static final int L1_L2M5_AUGER = 246;
public static final int L1_L2N1_AUGER = 247;
public static final int L1_L2N2_AUGER = 248;
public static final int L1_L2N3_AUGER = 249;
public static final int L1_L2N4_AUGER = 250;
public static final int L1_L2N5_AUGER = 251;
public static final int L1_L2N6_AUGER = 252;
public static final int L1_L2N7_AUGER = 253;
public static final int L1_L2O1_AUGER = 254;
public static final int L1_L2O2_AUGER = 255;
public static final int L1_L2O3_AUGER = 256;
public static final int L1_L2O4_AUGER = 257;
public static final int L1_L2O5_AUGER = 258;
public static final int L1_L2O6_AUGER = 259;
public static final int L1_L2O7_AUGER = 260;
public static final int L1_L2P1_AUGER = 261;
public static final int L1_L2P2_AUGER = 262;
public static final int L1_L2P3_AUGER = 263;
public static final int L1_L2P4_AUGER = 264;
public static final int L1_L2P5_AUGER = 265;
public static final int L1_L2Q1_AUGER = 266;
public static final int L1_L2Q2_AUGER = 267;
public static final int L1_L2Q3_AUGER = 268;
public static final int L1_L3L2_AUGER = 269;
public static final int L1_L3L3_AUGER = 270;
public static final int L1_L3M1_AUGER = 271;
public static final int L1_L3M2_AUGER = 272;
public static final int L1_L3M3_AUGER = 273;
public static final int L1_L3M4_AUGER = 274;
public static final int L1_L3M5_AUGER = 275;
public static final int L1_L3N1_AUGER = 276;
public static final int L1_L3N2_AUGER = 277;
public static final int L1_L3N3_AUGER = 278;
public static final int L1_L3N4_AUGER = 279;
public static final int L1_L3N5_AUGER = 280;
public static final int L1_L3N6_AUGER = 281;
public static final int L1_L3N7_AUGER = 282;
public static final int L1_L3O1_AUGER = 283;
public static final int L1_L3O2_AUGER = 284;
public static final int L1_L3O3_AUGER = 285;
public static final int L1_L3O4_AUGER = 286;
public static final int L1_L3O5_AUGER = 287;
public static final int L1_L3O6_AUGER = 288;
public static final int L1_L3O7_AUGER = 289;
public static final int L1_L3P1_AUGER = 290;
public static final int L1_L3P2_AUGER = 291;
public static final int L1_L3P3_AUGER = 292;
public static final int L1_L3P4_AUGER = 293;
public static final int L1_L3P5_AUGER = 294;
public static final int L1_L3Q1_AUGER = 295;
public static final int L1_L3Q2_AUGER = 296;
public static final int L1_L3Q3_AUGER = 297;
public static final int L1_M1L2_AUGER = 298;
public static final int L1_M1L3_AUGER = 299;
public static final int L1_M1M1_AUGER = 300;
public static final int L1_M1M2_AUGER = 301;
public static final int L1_M1M3_AUGER = 302;
public static final int L1_M1M4_AUGER = 303;
public static final int L1_M1M5_AUGER = 304;
public static final int L1_M1N1_AUGER = 305;
public static final int L1_M1N2_AUGER = 306;
public static final int L1_M1N3_AUGER = 307;
public static final int L1_M1N4_AUGER = 308;
public static final int L1_M1N5_AUGER = 309;
public static final int L1_M1N6_AUGER = 310;
public static final int L1_M1N7_AUGER = 311;
public static final int L1_M1O1_AUGER = 312;
public static final int L1_M1O2_AUGER = 313;
public static final int L1_M1O3_AUGER = 314;
public static final int L1_M1O4_AUGER = 315;
public static final int L1_M1O5_AUGER = 316;
public static final int L1_M1O6_AUGER = 317;
public static final int L1_M1O7_AUGER = 318;
public static final int L1_M1P1_AUGER = 319;
public static final int L1_M1P2_AUGER = 320;
public static final int L1_M1P3_AUGER = 321;
public static final int L1_M1P4_AUGER = 322;
public static final int L1_M1P5_AUGER = 323;
public static final int L1_M1Q1_AUGER = 324;
public static final int L1_M1Q2_AUGER = 325;
public static final int L1_M1Q3_AUGER = 326;
public static final int L1_M2L2_AUGER = 327;
public static final int L1_M2L3_AUGER = 328;
public static final int L1_M2M1_AUGER = 329;
public static final int L1_M2M2_AUGER = 330;
public static final int L1_M2M3_AUGER = 331;
public static final int L1_M2M4_AUGER = 332;
public static final int L1_M2M5_AUGER = 333;
public static final int L1_M2N1_AUGER = 334;
public static final int L1_M2N2_AUGER = 335;
public static final int L1_M2N3_AUGER = 336;
public static final int L1_M2N4_AUGER = 337;
public static final int L1_M2N5_AUGER = 338;
public static final int L1_M2N6_AUGER = 339;
public static final int L1_M2N7_AUGER = 340;
public static final int L1_M2O1_AUGER = 341;
public static final int L1_M2O2_AUGER = 342;
public static final int L1_M2O3_AUGER = 343;
public static final int L1_M2O4_AUGER = 344;
public static final int L1_M2O5_AUGER = 345;
public static final int L1_M2O6_AUGER = 346;
public static final int L1_M2O7_AUGER = 347;
public static final int L1_M2P1_AUGER = 348;
public static final int L1_M2P2_AUGER = 349;
public static final int L1_M2P3_AUGER = 350;
public static final int L1_M2P4_AUGER = 351;
public static final int L1_M2P5_AUGER = 352;
public static final int L1_M2Q1_AUGER = 353;
public static final int L1_M2Q2_AUGER = 354;
public static final int L1_M2Q3_AUGER = 355;
public static final int L1_M3L2_AUGER = 356;
public static final int L1_M3L3_AUGER = 357;
public static final int L1_M3M1_AUGER = 358;
public static final int L1_M3M2_AUGER = 359;
public static final int L1_M3M3_AUGER = 360;
public static final int L1_M3M4_AUGER = 361;
public static final int L1_M3M5_AUGER = 362;
public static final int L1_M3N1_AUGER = 363;
public static final int L1_M3N2_AUGER = 364;
public static final int L1_M3N3_AUGER = 365;
public static final int L1_M3N4_AUGER = 366;
public static final int L1_M3N5_AUGER = 367;
public static final int L1_M3N6_AUGER = 368;
public static final int L1_M3N7_AUGER = 369;
public static final int L1_M3O1_AUGER = 370;
public static final int L1_M3O2_AUGER = 371;
public static final int L1_M3O3_AUGER = 372;
public static final int L1_M3O4_AUGER = 373;
public static final int L1_M3O5_AUGER = 374;
public static final int L1_M3O6_AUGER = 375;
public static final int L1_M3O7_AUGER = 376;
public static final int L1_M3P1_AUGER = 377;
public static final int L1_M3P2_AUGER = 378;
public static final int L1_M3P3_AUGER = 379;
public static final int L1_M3P4_AUGER = 380;
public static final int L1_M3P5_AUGER = 381;
public static final int L1_M3Q1_AUGER = 382;
public static final int L1_M3Q2_AUGER = 383;
public static final int L1_M3Q3_AUGER = 384;
public static final int L1_M4L2_AUGER = 385;
public static final int L1_M4L3_AUGER = 386;
public static final int L1_M4M1_AUGER = 387;
public static final int L1_M4M2_AUGER = 388;
public static final int L1_M4M3_AUGER = 389;
public static final int L1_M4M4_AUGER = 390;
public static final int L1_M4M5_AUGER = 391;
public static final int L1_M4N1_AUGER = 392;
public static final int L1_M4N2_AUGER = 393;
public static final int L1_M4N3_AUGER = 394;
public static final int L1_M4N4_AUGER = 395;
public static final int L1_M4N5_AUGER = 396;
public static final int L1_M4N6_AUGER = 397;
public static final int L1_M4N7_AUGER = 398;
public static final int L1_M4O1_AUGER = 399;
public static final int L1_M4O2_AUGER = 400;
public static final int L1_M4O3_AUGER = 401;
public static final int L1_M4O4_AUGER = 402;
public static final int L1_M4O5_AUGER = 403;
public static final int L1_M4O6_AUGER = 404;
public static final int L1_M4O7_AUGER = 405;
public static final int L1_M4P1_AUGER = 406;
public static final int L1_M4P2_AUGER = 407;
public static final int L1_M4P3_AUGER = 408;
public static final int L1_M4P4_AUGER = 409;
public static final int L1_M4P5_AUGER = 410;
public static final int L1_M4Q1_AUGER = 411;
public static final int L1_M4Q2_AUGER = 412;
public static final int L1_M4Q3_AUGER = 413;
public static final int L1_M5L2_AUGER = 414;
public static final int L1_M5L3_AUGER = 415;
public static final int L1_M5M1_AUGER = 416;
public static final int L1_M5M2_AUGER = 417;
public static final int L1_M5M3_AUGER = 418;
public static final int L1_M5M4_AUGER = 419;
public static final int L1_M5M5_AUGER = 420;
public static final int L1_M5N1_AUGER = 421;
public static final int L1_M5N2_AUGER = 422;
public static final int L1_M5N3_AUGER = 423;
public static final int L1_M5N4_AUGER = 424;
public static final int L1_M5N5_AUGER = 425;
public static final int L1_M5N6_AUGER = 426;
public static final int L1_M5N7_AUGER = 427;
public static final int L1_M5O1_AUGER = 428;
public static final int L1_M5O2_AUGER = 429;
public static final int L1_M5O3_AUGER = 430;
public static final int L1_M5O4_AUGER = 431;
public static final int L1_M5O5_AUGER = 432;
public static final int L1_M5O6_AUGER = 433;
public static final int L1_M5O7_AUGER = 434;
public static final int L1_M5P1_AUGER = 435;
public static final int L1_M5P2_AUGER = 436;
public static final int L1_M5P3_AUGER = 437;
public static final int L1_M5P4_AUGER = 438;
public static final int L1_M5P5_AUGER = 439;
public static final int L1_M5Q1_AUGER = 440;
public static final int L1_M5Q2_AUGER = 441;
public static final int L1_M5Q3_AUGER = 442;
public static final int L2_L3L3_AUGER = 443;
public static final int L2_L3M1_AUGER = 444;
public static final int L2_L3M2_AUGER = 445;
public static final int L2_L3M3_AUGER = 446;
public static final int L2_L3M4_AUGER = 447;
public static final int L2_L3M5_AUGER = 448;
public static final int L2_L3N1_AUGER = 449;
public static final int L2_L3N2_AUGER = 450;
public static final int L2_L3N3_AUGER = 451;
public static final int L2_L3N4_AUGER = 452;
public static final int L2_L3N5_AUGER = 453;
public static final int L2_L3N6_AUGER = 454;
public static final int L2_L3N7_AUGER = 455;
public static final int L2_L3O1_AUGER = 456;
public static final int L2_L3O2_AUGER = 457;
public static final int L2_L3O3_AUGER = 458;
public static final int L2_L3O4_AUGER = 459;
public static final int L2_L3O5_AUGER = 460;
public static final int L2_L3O6_AUGER = 461;
public static final int L2_L3O7_AUGER = 462;
public static final int L2_L3P1_AUGER = 463;
public static final int L2_L3P2_AUGER = 464;
public static final int L2_L3P3_AUGER = 465;
public static final int L2_L3P4_AUGER = 466;
public static final int L2_L3P5_AUGER = 467;
public static final int L2_L3Q1_AUGER = 468;
public static final int L2_L3Q2_AUGER = 469;
public static final int L2_L3Q3_AUGER = 470;
public static final int L2_M1L3_AUGER = 471;
public static final int L2_M1M1_AUGER = 472;
public static final int L2_M1M2_AUGER = 473;
public static final int L2_M1M3_AUGER = 474;
public static final int L2_M1M4_AUGER = 475;
public static final int L2_M1M5_AUGER = 476;
public static final int L2_M1N1_AUGER = 477;
public static final int L2_M1N2_AUGER = 478;
public static final int L2_M1N3_AUGER = 479;
public static final int L2_M1N4_AUGER = 480;
public static final int L2_M1N5_AUGER = 481;
public static final int L2_M1N6_AUGER = 482;
public static final int L2_M1N7_AUGER = 483;
public static final int L2_M1O1_AUGER = 484;
public static final int L2_M1O2_AUGER = 485;
public static final int L2_M1O3_AUGER = 486;
public static final int L2_M1O4_AUGER = 487;
public static final int L2_M1O5_AUGER = 488;
public static final int L2_M1O6_AUGER = 489;
public static final int L2_M1O7_AUGER = 490;
public static final int L2_M1P1_AUGER = 491;
public static final int L2_M1P2_AUGER = 492;
public static final int L2_M1P3_AUGER = 493;
public static final int L2_M1P4_AUGER = 494;
public static final int L2_M1P5_AUGER = 495;
public static final int L2_M1Q1_AUGER = 496;
public static final int L2_M1Q2_AUGER = 497;
public static final int L2_M1Q3_AUGER = 498;
public static final int L2_M2L3_AUGER = 499;
public static final int L2_M2M1_AUGER = 500;
public static final int L2_M2M2_AUGER = 501;
public static final int L2_M2M3_AUGER = 502;
public static final int L2_M2M4_AUGER = 503;
public static final int L2_M2M5_AUGER = 504;
public static final int L2_M2N1_AUGER = 505;
public static final int L2_M2N2_AUGER = 506;
public static final int L2_M2N3_AUGER = 507;
public static final int L2_M2N4_AUGER = 508;
public static final int L2_M2N5_AUGER = 509;
public static final int L2_M2N6_AUGER = 510;
public static final int L2_M2N7_AUGER = 511;
public static final int L2_M2O1_AUGER = 512;
public static final int L2_M2O2_AUGER = 513;
public static final int L2_M2O3_AUGER = 514;
public static final int L2_M2O4_AUGER = 515;
public static final int L2_M2O5_AUGER = 516;
public static final int L2_M2O6_AUGER = 517;
public static final int L2_M2O7_AUGER = 518;
public static final int L2_M2P1_AUGER = 519;
public static final int L2_M2P2_AUGER = 520;
public static final int L2_M2P3_AUGER = 521;
public static final int L2_M2P4_AUGER = 522;
public static final int L2_M2P5_AUGER = 523;
public static final int L2_M2Q1_AUGER = 524;
public static final int L2_M2Q2_AUGER = 525;
public static final int L2_M2Q3_AUGER = 526;
public static final int L2_M3L3_AUGER = 527;
public static final int L2_M3M1_AUGER = 528;
public static final int L2_M3M2_AUGER = 529;
public static final int L2_M3M3_AUGER = 530;
public static final int L2_M3M4_AUGER = 531;
public static final int L2_M3M5_AUGER = 532;
public static final int L2_M3N1_AUGER = 533;
public static final int L2_M3N2_AUGER = 534;
public static final int L2_M3N3_AUGER = 535;
public static final int L2_M3N4_AUGER = 536;
public static final int L2_M3N5_AUGER = 537;
public static final int L2_M3N6_AUGER = 538;
public static final int L2_M3N7_AUGER = 539;
public static final int L2_M3O1_AUGER = 540;
public static final int L2_M3O2_AUGER = 541;
public static final int L2_M3O3_AUGER = 542;
public static final int L2_M3O4_AUGER = 543;
public static final int L2_M3O5_AUGER = 544;
public static final int L2_M3O6_AUGER = 545;
public static final int L2_M3O7_AUGER = 546;
public static final int L2_M3P1_AUGER = 547;
public static final int L2_M3P2_AUGER = 548;
public static final int L2_M3P3_AUGER = 549;
public static final int L2_M3P4_AUGER = 550;
public static final int L2_M3P5_AUGER = 551;
public static final int L2_M3Q1_AUGER = 552;
public static final int L2_M3Q2_AUGER = 553;
public static final int L2_M3Q3_AUGER = 554;
public static final int L2_M4L3_AUGER = 555;
public static final int L2_M4M1_AUGER = 556;
public static final int L2_M4M2_AUGER = 557;
public static final int L2_M4M3_AUGER = 558;
public static final int L2_M4M4_AUGER = 559;
public static final int L2_M4M5_AUGER = 560;
public static final int L2_M4N1_AUGER = 561;
public static final int L2_M4N2_AUGER = 562;
public static final int L2_M4N3_AUGER = 563;
public static final int L2_M4N4_AUGER = 564;
public static final int L2_M4N5_AUGER = 565;
public static final int L2_M4N6_AUGER = 566;
public static final int L2_M4N7_AUGER = 567;
public static final int L2_M4O1_AUGER = 568;
public static final int L2_M4O2_AUGER = 569;
public static final int L2_M4O3_AUGER = 570;
public static final int L2_M4O4_AUGER = 571;
public static final int L2_M4O5_AUGER = 572;
public static final int L2_M4O6_AUGER = 573;
public static final int L2_M4O7_AUGER = 574;
public static final int L2_M4P1_AUGER = 575;
public static final int L2_M4P2_AUGER = 576;
public static final int L2_M4P3_AUGER = 577;
public static final int L2_M4P4_AUGER = 578;
public static final int L2_M4P5_AUGER = 579;
public static final int L2_M4Q1_AUGER = 580;
public static final int L2_M4Q2_AUGER = 581;
public static final int L2_M4Q3_AUGER = 582;
public static final int L2_M5L3_AUGER = 583;
public static final int L2_M5M1_AUGER = 584;
public static final int L2_M5M2_AUGER = 585;
public static final int L2_M5M3_AUGER = 586;
public static final int L2_M5M4_AUGER = 587;
public static final int L2_M5M5_AUGER = 588;
public static final int L2_M5N1_AUGER = 589;
public static final int L2_M5N2_AUGER = 590;
public static final int L2_M5N3_AUGER = 591;
public static final int L2_M5N4_AUGER = 592;
public static final int L2_M5N5_AUGER = 593;
public static final int L2_M5N6_AUGER = 594;
public static final int L2_M5N7_AUGER = 595;
public static final int L2_M5O1_AUGER = 596;
public static final int L2_M5O2_AUGER = 597;
public static final int L2_M5O3_AUGER = 598;
public static final int L2_M5O4_AUGER = 599;
public static final int L2_M5O5_AUGER = 600;
public static final int L2_M5O6_AUGER = 601;
public static final int L2_M5O7_AUGER = 602;
public static final int L2_M5P1_AUGER = 603;
public static final int L2_M5P2_AUGER = 604;
public static final int L2_M5P3_AUGER = 605;
public static final int L2_M5P4_AUGER = 606;
public static final int L2_M5P5_AUGER = 607;
public static final int L2_M5Q1_AUGER = 608;
public static final int L2_M5Q2_AUGER = 609;
public static final int L2_M5Q3_AUGER = 610;
public static final int L3_M1M1_AUGER = 611;
public static final int L3_M1M2_AUGER = 612;
public static final int L3_M1M3_AUGER = 613;
public static final int L3_M1M4_AUGER = 614;
public static final int L3_M1M5_AUGER = 615;
public static final int L3_M1N1_AUGER = 616;
public static final int L3_M1N2_AUGER = 617;
public static final int L3_M1N3_AUGER = 618;
public static final int L3_M1N4_AUGER = 619;
public static final int L3_M1N5_AUGER = 620;
public static final int L3_M1N6_AUGER = 621;
public static final int L3_M1N7_AUGER = 622;
public static final int L3_M1O1_AUGER = 623;
public static final int L3_M1O2_AUGER = 624;
public static final int L3_M1O3_AUGER = 625;
public static final int L3_M1O4_AUGER = 626;
public static final int L3_M1O5_AUGER = 627;
public static final int L3_M1O6_AUGER = 628;
public static final int L3_M1O7_AUGER = 629;
public static final int L3_M1P1_AUGER = 630;
public static final int L3_M1P2_AUGER = 631;
public static final int L3_M1P3_AUGER = 632;
public static final int L3_M1P4_AUGER = 633;
public static final int L3_M1P5_AUGER = 634;
public static final int L3_M1Q1_AUGER = 635;
public static final int L3_M1Q2_AUGER = 636;
public static final int L3_M1Q3_AUGER = 637;
public static final int L3_M2M1_AUGER = 638;
public static final int L3_M2M2_AUGER = 639;
public static final int L3_M2M3_AUGER = 640;
public static final int L3_M2M4_AUGER = 641;
public static final int L3_M2M5_AUGER = 642;
public static final int L3_M2N1_AUGER = 643;
public static final int L3_M2N2_AUGER = 644;
public static final int L3_M2N3_AUGER = 645;
public static final int L3_M2N4_AUGER = 646;
public static final int L3_M2N5_AUGER = 647;
public static final int L3_M2N6_AUGER = 648;
public static final int L3_M2N7_AUGER = 649;
public static final int L3_M2O1_AUGER = 650;
public static final int L3_M2O2_AUGER = 651;
public static final int L3_M2O3_AUGER = 652;
public static final int L3_M2O4_AUGER = 653;
public static final int L3_M2O5_AUGER = 654;
public static final int L3_M2O6_AUGER = 655;
public static final int L3_M2O7_AUGER = 656;
public static final int L3_M2P1_AUGER = 657;
public static final int L3_M2P2_AUGER = 658;
public static final int L3_M2P3_AUGER = 659;
public static final int L3_M2P4_AUGER = 660;
public static final int L3_M2P5_AUGER = 661;
public static final int L3_M2Q1_AUGER = 662;
public static final int L3_M2Q2_AUGER = 663;
public static final int L3_M2Q3_AUGER = 664;
public static final int L3_M3M1_AUGER = 665;
public static final int L3_M3M2_AUGER = 666;
public static final int L3_M3M3_AUGER = 667;
public static final int L3_M3M4_AUGER = 668;
public static final int L3_M3M5_AUGER = 669;
public static final int L3_M3N1_AUGER = 670;
public static final int L3_M3N2_AUGER = 671;
public static final int L3_M3N3_AUGER = 672;
public static final int L3_M3N4_AUGER = 673;
public static final int L3_M3N5_AUGER = 674;
public static final int L3_M3N6_AUGER = 675;
public static final int L3_M3N7_AUGER = 676;
public static final int L3_M3O1_AUGER = 677;
public static final int L3_M3O2_AUGER = 678;
public static final int L3_M3O3_AUGER = 679;
public static final int L3_M3O4_AUGER = 680;
public static final int L3_M3O5_AUGER = 681;
public static final int L3_M3O6_AUGER = 682;
public static final int L3_M3O7_AUGER = 683;
public static final int L3_M3P1_AUGER = 684;
public static final int L3_M3P2_AUGER = 685;
public static final int L3_M3P3_AUGER = 686;
public static final int L3_M3P4_AUGER = 687;
public static final int L3_M3P5_AUGER = 688;
public static final int L3_M3Q1_AUGER = 689;
public static final int L3_M3Q2_AUGER = 690;
public static final int L3_M3Q3_AUGER = 691;
public static final int L3_M4M1_AUGER = 692;
public static final int L3_M4M2_AUGER = 693;
public static final int L3_M4M3_AUGER = 694;
public static final int L3_M4M4_AUGER = 695;
public static final int L3_M4M5_AUGER = 696;
public static final int L3_M4N1_AUGER = 697;
public static final int L3_M4N2_AUGER = 698;
public static final int L3_M4N3_AUGER = 699;
public static final int L3_M4N4_AUGER = 700;
public static final int L3_M4N5_AUGER = 701;
public static final int L3_M4N6_AUGER = 702;
public static final int L3_M4N7_AUGER = 703;
public static final int L3_M4O1_AUGER = 704;
public static final int L3_M4O2_AUGER = 705;
public static final int L3_M4O3_AUGER = 706;
public static final int L3_M4O4_AUGER = 707;
public static final int L3_M4O5_AUGER = 708;
public static final int L3_M4O6_AUGER = 709;
public static final int L3_M4O7_AUGER = 710;
public static final int L3_M4P1_AUGER = 711;
public static final int L3_M4P2_AUGER = 712;
public static final int L3_M4P3_AUGER = 713;
public static final int L3_M4P4_AUGER = 714;
public static final int L3_M4P5_AUGER = 715;
public static final int L3_M4Q1_AUGER = 716;
public static final int L3_M4Q2_AUGER = 717;
public static final int L3_M4Q3_AUGER = 718;
public static final int L3_M5M1_AUGER = 719;
public static final int L3_M5M2_AUGER = 720;
public static final int L3_M5M3_AUGER = 721;
public static final int L3_M5M4_AUGER = 722;
public static final int L3_M5M5_AUGER = 723;
public static final int L3_M5N1_AUGER = 724;
public static final int L3_M5N2_AUGER = 725;
public static final int L3_M5N3_AUGER = 726;
public static final int L3_M5N4_AUGER = 727;
public static final int L3_M5N5_AUGER = 728;
public static final int L3_M5N6_AUGER = 729;
public static final int L3_M5N7_AUGER = 730;
public static final int L3_M5O1_AUGER = 731;
public static final int L3_M5O2_AUGER = 732;
public static final int L3_M5O3_AUGER = 733;
public static final int L3_M5O4_AUGER = 734;
public static final int L3_M5O5_AUGER = 735;
public static final int L3_M5O6_AUGER = 736;
public static final int L3_M5O7_AUGER = 737;
public static final int L3_M5P1_AUGER = 738;
public static final int L3_M5P2_AUGER = 739;
public static final int L3_M5P3_AUGER = 740;
public static final int L3_M5P4_AUGER = 741;
public static final int L3_M5P5_AUGER = 742;
public static final int L3_M5Q1_AUGER = 743;
public static final int L3_M5Q2_AUGER = 744;
public static final int L3_M5Q3_AUGER = 745;
public static final int M1_M2M2_AUGER = 746;
public static final int M1_M2M3_AUGER = 747;
public static final int M1_M2M4_AUGER = 748;
public static final int M1_M2M5_AUGER = 749;
public static final int M1_M2N1_AUGER = 750;
public static final int M1_M2N2_AUGER = 751;
public static final int M1_M2N3_AUGER = 752;
public static final int M1_M2N4_AUGER = 753;
public static final int M1_M2N5_AUGER = 754;
public static final int M1_M2N6_AUGER = 755;
public static final int M1_M2N7_AUGER = 756;
public static final int M1_M2O1_AUGER = 757;
public static final int M1_M2O2_AUGER = 758;
public static final int M1_M2O3_AUGER = 759;
public static final int M1_M2O4_AUGER = 760;
public static final int M1_M2O5_AUGER = 761;
public static final int M1_M2O6_AUGER = 762;
public static final int M1_M2O7_AUGER = 763;
public static final int M1_M2P1_AUGER = 764;
public static final int M1_M2P2_AUGER = 765;
public static final int M1_M2P3_AUGER = 766;
public static final int M1_M2P4_AUGER = 767;
public static final int M1_M2P5_AUGER = 768;
public static final int M1_M2Q1_AUGER = 769;
public static final int M1_M2Q2_AUGER = 770;
public static final int M1_M2Q3_AUGER = 771;
public static final int M1_M3M2_AUGER = 772;
public static final int M1_M3M3_AUGER = 773;
public static final int M1_M3M4_AUGER = 774;
public static final int M1_M3M5_AUGER = 775;
public static final int M1_M3N1_AUGER = 776;
public static final int M1_M3N2_AUGER = 777;
public static final int M1_M3N3_AUGER = 778;
public static final int M1_M3N4_AUGER = 779;
public static final int M1_M3N5_AUGER = 780;
public static final int M1_M3N6_AUGER = 781;
public static final int M1_M3N7_AUGER = 782;
public static final int M1_M3O1_AUGER = 783;
public static final int M1_M3O2_AUGER = 784;
public static final int M1_M3O3_AUGER = 785;
public static final int M1_M3O4_AUGER = 786;
public static final int M1_M3O5_AUGER = 787;
public static final int M1_M3O6_AUGER = 788;
public static final int M1_M3O7_AUGER = 789;
public static final int M1_M3P1_AUGER = 790;
public static final int M1_M3P2_AUGER = 791;
public static final int M1_M3P3_AUGER = 792;
public static final int M1_M3P4_AUGER = 793;
public static final int M1_M3P5_AUGER = 794;
public static final int M1_M3Q1_AUGER = 795;
public static final int M1_M3Q2_AUGER = 796;
public static final int M1_M3Q3_AUGER = 797;
public static final int M1_M4M2_AUGER = 798;
public static final int M1_M4M3_AUGER = 799;
public static final int M1_M4M4_AUGER = 800;
public static final int M1_M4M5_AUGER = 801;
public static final int M1_M4N1_AUGER = 802;
public static final int M1_M4N2_AUGER = 803;
public static final int M1_M4N3_AUGER = 804;
public static final int M1_M4N4_AUGER = 805;
public static final int M1_M4N5_AUGER = 806;
public static final int M1_M4N6_AUGER = 807;
public static final int M1_M4N7_AUGER = 808;
public static final int M1_M4O1_AUGER = 809;
public static final int M1_M4O2_AUGER = 810;
public static final int M1_M4O3_AUGER = 811;
public static final int M1_M4O4_AUGER = 812;
public static final int M1_M4O5_AUGER = 813;
public static final int M1_M4O6_AUGER = 814;
public static final int M1_M4O7_AUGER = 815;
public static final int M1_M4P1_AUGER = 816;
public static final int M1_M4P2_AUGER = 817;
public static final int M1_M4P3_AUGER = 818;
public static final int M1_M4P4_AUGER = 819;
public static final int M1_M4P5_AUGER = 820;
public static final int M1_M4Q1_AUGER = 821;
public static final int M1_M4Q2_AUGER = 822;
public static final int M1_M4Q3_AUGER = 823;
public static final int M1_M5M2_AUGER = 824;
public static final int M1_M5M3_AUGER = 825;
public static final int M1_M5M4_AUGER = 826;
public static final int M1_M5M5_AUGER = 827;
public static final int M1_M5N1_AUGER = 828;
public static final int M1_M5N2_AUGER = 829;
public static final int M1_M5N3_AUGER = 830;
public static final int M1_M5N4_AUGER = 831;
public static final int M1_M5N5_AUGER = 832;
public static final int M1_M5N6_AUGER = 833;
public static final int M1_M5N7_AUGER = 834;
public static final int M1_M5O1_AUGER = 835;
public static final int M1_M5O2_AUGER = 836;
public static final int M1_M5O3_AUGER = 837;
public static final int M1_M5O4_AUGER = 838;
public static final int M1_M5O5_AUGER = 839;
public static final int M1_M5O6_AUGER = 840;
public static final int M1_M5O7_AUGER = 841;
public static final int M1_M5P1_AUGER = 842;
public static final int M1_M5P2_AUGER = 843;
public static final int M1_M5P3_AUGER = 844;
public static final int M1_M5P4_AUGER = 845;
public static final int M1_M5P5_AUGER = 846;
public static final int M1_M5Q1_AUGER = 847;
public static final int M1_M5Q2_AUGER = 848;
public static final int M1_M5Q3_AUGER = 849;
public static final int M2_M3M3_AUGER = 850;
public static final int M2_M3M4_AUGER = 851;
public static final int M2_M3M5_AUGER = 852;
public static final int M2_M3N1_AUGER = 853;
public static final int M2_M3N2_AUGER = 854;
public static final int M2_M3N3_AUGER = 855;
public static final int M2_M3N4_AUGER = 856;
public static final int M2_M3N5_AUGER = 857;
public static final int M2_M3N6_AUGER = 858;
public static final int M2_M3N7_AUGER = 859;
public static final int M2_M3O1_AUGER = 860;
public static final int M2_M3O2_AUGER = 861;
public static final int M2_M3O3_AUGER = 862;
public static final int M2_M3O4_AUGER = 863;
public static final int M2_M3O5_AUGER = 864;
public static final int M2_M3O6_AUGER = 865;
public static final int M2_M3O7_AUGER = 866;
public static final int M2_M3P1_AUGER = 867;
public static final int M2_M3P2_AUGER = 868;
public static final int M2_M3P3_AUGER = 869;
public static final int M2_M3P4_AUGER = 870;
public static final int M2_M3P5_AUGER = 871;
public static final int M2_M3Q1_AUGER = 872;
public static final int M2_M3Q2_AUGER = 873;
public static final int M2_M3Q3_AUGER = 874;
public static final int M2_M4M3_AUGER = 875;
public static final int M2_M4M4_AUGER = 876;
public static final int M2_M4M5_AUGER = 877;
public static final int M2_M4N1_AUGER = 878;
public static final int M2_M4N2_AUGER = 879;
public static final int M2_M4N3_AUGER = 880;
public static final int M2_M4N4_AUGER = 881;
public static final int M2_M4N5_AUGER = 882;
public static final int M2_M4N6_AUGER = 883;
public static final int M2_M4N7_AUGER = 884;
public static final int M2_M4O1_AUGER = 885;
public static final int M2_M4O2_AUGER = 886;
public static final int M2_M4O3_AUGER = 887;
public static final int M2_M4O4_AUGER = 888;
public static final int M2_M4O5_AUGER = 889;
public static final int M2_M4O6_AUGER = 890;
public static final int M2_M4O7_AUGER = 891;
public static final int M2_M4P1_AUGER = 892;
public static final int M2_M4P2_AUGER = 893;
public static final int M2_M4P3_AUGER = 894;
public static final int M2_M4P4_AUGER = 895;
public static final int M2_M4P5_AUGER = 896;
public static final int M2_M4Q1_AUGER = 897;
public static final int M2_M4Q2_AUGER = 898;
public static final int M2_M4Q3_AUGER = 899;
public static final int M2_M5M3_AUGER = 900;
public static final int M2_M5M4_AUGER = 901;
public static final int M2_M5M5_AUGER = 902;
public static final int M2_M5N1_AUGER = 903;
public static final int M2_M5N2_AUGER = 904;
public static final int M2_M5N3_AUGER = 905;
public static final int M2_M5N4_AUGER = 906;
public static final int M2_M5N5_AUGER = 907;
public static final int M2_M5N6_AUGER = 908;
public static final int M2_M5N7_AUGER = 909;
public static final int M2_M5O1_AUGER = 910;
public static final int M2_M5O2_AUGER = 911;
public static final int M2_M5O3_AUGER = 912;
public static final int M2_M5O4_AUGER = 913;
public static final int M2_M5O5_AUGER = 914;
public static final int M2_M5O6_AUGER = 915;
public static final int M2_M5O7_AUGER = 916;
public static final int M2_M5P1_AUGER = 917;
public static final int M2_M5P2_AUGER = 918;
public static final int M2_M5P3_AUGER = 919;
public static final int M2_M5P4_AUGER = 920;
public static final int M2_M5P5_AUGER = 921;
public static final int M2_M5Q1_AUGER = 922;
public static final int M2_M5Q2_AUGER = 923;
public static final int M2_M5Q3_AUGER = 924;
public static final int M3_M4M4_AUGER = 925;
public static final int M3_M4M5_AUGER = 926;
public static final int M3_M4N1_AUGER = 927;
public static final int M3_M4N2_AUGER = 928;
public static final int M3_M4N3_AUGER = 929;
public static final int M3_M4N4_AUGER = 930;
public static final int M3_M4N5_AUGER = 931;
public static final int M3_M4N6_AUGER = 932;
public static final int M3_M4N7_AUGER = 933;
public static final int M3_M4O1_AUGER = 934;
public static final int M3_M4O2_AUGER = 935;
public static final int M3_M4O3_AUGER = 936;
public static final int M3_M4O4_AUGER = 937;
public static final int M3_M4O5_AUGER = 938;
public static final int M3_M4O6_AUGER = 939;
public static final int M3_M4O7_AUGER = 940;
public static final int M3_M4P1_AUGER = 941;
public static final int M3_M4P2_AUGER = 942;
public static final int M3_M4P3_AUGER = 943;
public static final int M3_M4P4_AUGER = 944;
public static final int M3_M4P5_AUGER = 945;
public static final int M3_M4Q1_AUGER = 946;
public static final int M3_M4Q2_AUGER = 947;
public static final int M3_M4Q3_AUGER = 948;
public static final int M3_M5M4_AUGER = 949;
public static final int M3_M5M5_AUGER = 950;
public static final int M3_M5N1_AUGER = 951;
public static final int M3_M5N2_AUGER = 952;
public static final int M3_M5N3_AUGER = 953;
public static final int M3_M5N4_AUGER = 954;
public static final int M3_M5N5_AUGER = 955;
public static final int M3_M5N6_AUGER = 956;
public static final int M3_M5N7_AUGER = 957;
public static final int M3_M5O1_AUGER = 958;
public static final int M3_M5O2_AUGER = 959;
public static final int M3_M5O3_AUGER = 960;
public static final int M3_M5O4_AUGER = 961;
public static final int M3_M5O5_AUGER = 962;
public static final int M3_M5O6_AUGER = 963;
public static final int M3_M5O7_AUGER = 964;
public static final int M3_M5P1_AUGER = 965;
public static final int M3_M5P2_AUGER = 966;
public static final int M3_M5P3_AUGER = 967;
public static final int M3_M5P4_AUGER = 968;
public static final int M3_M5P5_AUGER = 969;
public static final int M3_M5Q1_AUGER = 970;
public static final int M3_M5Q2_AUGER = 971;
public static final int M3_M5Q3_AUGER = 972;
public static final int M4_M5M5_AUGER = 973;
public static final int M4_M5N1_AUGER = 974;
public static final int M4_M5N2_AUGER = 975;
public static final int M4_M5N3_AUGER = 976;
public static final int M4_M5N4_AUGER = 977;
public static final int M4_M5N5_AUGER = 978;
public static final int M4_M5N6_AUGER = 979;
public static final int M4_M5N7_AUGER = 980;
public static final int M4_M5O1_AUGER = 981;
public static final int M4_M5O2_AUGER = 982;
public static final int M4_M5O3_AUGER = 983;
public static final int M4_M5O4_AUGER = 984;
public static final int M4_M5O5_AUGER = 985;
public static final int M4_M5O6_AUGER = 986;
public static final int M4_M5O7_AUGER = 987;
public static final int M4_M5P1_AUGER = 988;
public static final int M4_M5P2_AUGER = 989;
public static final int M4_M5P3_AUGER = 990;
public static final int M4_M5P4_AUGER = 991;
public static final int M4_M5P5_AUGER = 992;
public static final int M4_M5Q1_AUGER = 993;
public static final int M4_M5Q2_AUGER = 994;
public static final int M4_M5Q3_AUGER = 995;
public static final int NIST_COMPOUND_A_150_TISSUE_EQUIVALENT_PLASTIC = 0;
public static final int NIST_COMPOUND_ACETONE = 1;
public static final int NIST_COMPOUND_ACETYLENE = 2;
public static final int NIST_COMPOUND_ADENINE = 3;
public static final int NIST_COMPOUND_ADIPOSE_TISSUE_ICRP = 4;
public static final int NIST_COMPOUND_AIR_DRY_NEAR_SEA_LEVEL = 5;
public static final int NIST_COMPOUND_ALANINE = 6;
public static final int NIST_COMPOUND_ALUMINUM_OXIDE = 7;
public static final int NIST_COMPOUND_AMBER = 8;
public static final int NIST_COMPOUND_AMMONIA = 9;
public static final int NIST_COMPOUND_ANILINE = 10;
public static final int NIST_COMPOUND_ANTHRACENE = 11;
public static final int NIST_COMPOUND_B_100_BONE_EQUIVALENT_PLASTIC = 12;
public static final int NIST_COMPOUND_BAKELITE = 13;
public static final int NIST_COMPOUND_BARIUM_FLUORIDE = 14;
public static final int NIST_COMPOUND_BARIUM_SULFATE = 15;
public static final int NIST_COMPOUND_BENZENE = 16;
public static final int NIST_COMPOUND_BERYLLIUM_OXIDE = 17;
public static final int NIST_COMPOUND_BISMUTH_GERMANIUM_OXIDE = 18;
public static final int NIST_COMPOUND_BLOOD_ICRP = 19;
public static final int NIST_COMPOUND_BONE_COMPACT_ICRU = 20;
public static final int NIST_COMPOUND_BONE_CORTICAL_ICRP = 21;
public static final int NIST_COMPOUND_BORON_CARBIDE = 22;
public static final int NIST_COMPOUND_BORON_OXIDE = 23;
public static final int NIST_COMPOUND_BRAIN_ICRP = 24;
public static final int NIST_COMPOUND_BUTANE = 25;
public static final int NIST_COMPOUND_N_BUTYL_ALCOHOL = 26;
public static final int NIST_COMPOUND_C_552_AIR_EQUIVALENT_PLASTIC = 27;
public static final int NIST_COMPOUND_CADMIUM_TELLURIDE = 28;
public static final int NIST_COMPOUND_CADMIUM_TUNGSTATE = 29;
public static final int NIST_COMPOUND_CALCIUM_CARBONATE = 30;
public static final int NIST_COMPOUND_CALCIUM_FLUORIDE = 31;
public static final int NIST_COMPOUND_CALCIUM_OXIDE = 32;
public static final int NIST_COMPOUND_CALCIUM_SULFATE = 33;
public static final int NIST_COMPOUND_CALCIUM_TUNGSTATE = 34;
public static final int NIST_COMPOUND_CARBON_DIOXIDE = 35;
public static final int NIST_COMPOUND_CARBON_TETRACHLORIDE = 36;
public static final int NIST_COMPOUND_CELLULOSE_ACETATE_CELLOPHANE = 37;
public static final int NIST_COMPOUND_CELLULOSE_ACETATE_BUTYRATE = 38;
public static final int NIST_COMPOUND_CELLULOSE_NITRATE = 39;
public static final int NIST_COMPOUND_CERIC_SULFATE_DOSIMETER_SOLUTION = 40;
public static final int NIST_COMPOUND_CESIUM_FLUORIDE = 41;
public static final int NIST_COMPOUND_CESIUM_IODIDE = 42;
public static final int NIST_COMPOUND_CHLOROBENZENE = 43;
public static final int NIST_COMPOUND_CHLOROFORM = 44;
public static final int NIST_COMPOUND_CONCRETE_PORTLAND = 45;
public static final int NIST_COMPOUND_CYCLOHEXANE = 46;
public static final int NIST_COMPOUND_12_DDIHLOROBENZENE = 47;
public static final int NIST_COMPOUND_DICHLORODIETHYL_ETHER = 48;
public static final int NIST_COMPOUND_12_DICHLOROETHANE = 49;
public static final int NIST_COMPOUND_DIETHYL_ETHER = 50;
public static final int NIST_COMPOUND_NN_DIMETHYL_FORMAMIDE = 51;
public static final int NIST_COMPOUND_DIMETHYL_SULFOXIDE = 52;
public static final int NIST_COMPOUND_ETHANE = 53;
public static final int NIST_COMPOUND_ETHYL_ALCOHOL = 54;
public static final int NIST_COMPOUND_ETHYL_CELLULOSE = 55;
public static final int NIST_COMPOUND_ETHYLENE = 56;
public static final int NIST_COMPOUND_EYE_LENS_ICRP = 57;
public static final int NIST_COMPOUND_FERRIC_OXIDE = 58;
public static final int NIST_COMPOUND_FERROBORIDE = 59;
public static final int NIST_COMPOUND_FERROUS_OXIDE = 60;
public static final int NIST_COMPOUND_FERROUS_SULFATE_DOSIMETER_SOLUTION = 61;
public static final int NIST_COMPOUND_FREON_12 = 62;
public static final int NIST_COMPOUND_FREON_12B2 = 63;
public static final int NIST_COMPOUND_FREON_13 = 64;
public static final int NIST_COMPOUND_FREON_13B1 = 65;
public static final int NIST_COMPOUND_FREON_13I1 = 66;
public static final int NIST_COMPOUND_GADOLINIUM_OXYSULFIDE = 67;
public static final int NIST_COMPOUND_GALLIUM_ARSENIDE = 68;
public static final int NIST_COMPOUND_GEL_IN_PHOTOGRAPHIC_EMULSION = 69;
public static final int NIST_COMPOUND_GLASS_PYREX = 70;
public static final int NIST_COMPOUND_GLASS_LEAD = 71;
public static final int NIST_COMPOUND_GLASS_PLATE = 72;
public static final int NIST_COMPOUND_GLUCOSE = 73;
public static final int NIST_COMPOUND_GLUTAMINE = 74;
public static final int NIST_COMPOUND_GLYCEROL = 75;
public static final int NIST_COMPOUND_GUANINE = 76;
public static final int NIST_COMPOUND_GYPSUM_PLASTER_OF_PARIS = 77;
public static final int NIST_COMPOUND_N_HEPTANE = 78;
public static final int NIST_COMPOUND_N_HEXANE = 79;
public static final int NIST_COMPOUND_KAPTON_POLYIMIDE_FILM = 80;
public static final int NIST_COMPOUND_LANTHANUM_OXYBROMIDE = 81;
public static final int NIST_COMPOUND_LANTHANUM_OXYSULFIDE = 82;
public static final int NIST_COMPOUND_LEAD_OXIDE = 83;
public static final int NIST_COMPOUND_LITHIUM_AMIDE = 84;
public static final int NIST_COMPOUND_LITHIUM_CARBONATE = 85;
public static final int NIST_COMPOUND_LITHIUM_FLUORIDE = 86;
public static final int NIST_COMPOUND_LITHIUM_HYDRIDE = 87;
public static final int NIST_COMPOUND_LITHIUM_IODIDE = 88;
public static final int NIST_COMPOUND_LITHIUM_OXIDE = 89;
public static final int NIST_COMPOUND_LITHIUM_TETRABORATE = 90;
public static final int NIST_COMPOUND_LUNG_ICRP = 91;
public static final int NIST_COMPOUND_M3_WAX = 92;
public static final int NIST_COMPOUND_MAGNESIUM_CARBONATE = 93;
public static final int NIST_COMPOUND_MAGNESIUM_FLUORIDE = 94;
public static final int NIST_COMPOUND_MAGNESIUM_OXIDE = 95;
public static final int NIST_COMPOUND_MAGNESIUM_TETRABORATE = 96;
public static final int NIST_COMPOUND_MERCURIC_IODIDE = 97;
public static final int NIST_COMPOUND_METHANE = 98;
public static final int NIST_COMPOUND_METHANOL = 99;
public static final int NIST_COMPOUND_MIX_D_WAX = 100;
public static final int NIST_COMPOUND_MS20_TISSUE_SUBSTITUTE = 101;
public static final int NIST_COMPOUND_MUSCLE_SKELETAL = 102;
public static final int NIST_COMPOUND_MUSCLE_STRIATED = 103;
public static final int NIST_COMPOUND_MUSCLE_EQUIVALENT_LIQUID_WITH_SUCROSE = 104;
public static final int NIST_COMPOUND_MUSCLE_EQUIVALENT_LIQUID_WITHOUT_SUCROSE = 105;
public static final int NIST_COMPOUND_NAPHTHALENE = 106;
public static final int NIST_COMPOUND_NITROBENZENE = 107;
public static final int NIST_COMPOUND_NITROUS_OXIDE = 108;
public static final int NIST_COMPOUND_NYLON_DU_PONT_ELVAMIDE_8062 = 109;
public static final int NIST_COMPOUND_NYLON_TYPE_6_AND_TYPE_66 = 110;
public static final int NIST_COMPOUND_NYLON_TYPE_610 = 111;
public static final int NIST_COMPOUND_NYLON_TYPE_11_RILSAN = 112;
public static final int NIST_COMPOUND_OCTANE_LIQUID = 113;
public static final int NIST_COMPOUND_PARAFFIN_WAX = 114;
public static final int NIST_COMPOUND_N_PENTANE = 115;
public static final int NIST_COMPOUND_PHOTOGRAPHIC_EMULSION = 116;
public static final int NIST_COMPOUND_PLASTIC_SCINTILLATOR_VINYLTOLUENE_BASED = 117;
public static final int NIST_COMPOUND_PLUTONIUM_DIOXIDE = 118;
public static final int NIST_COMPOUND_POLYACRYLONITRILE = 119;
public static final int NIST_COMPOUND_POLYCARBONATE_MAKROLON_LEXAN = 120;
public static final int NIST_COMPOUND_POLYCHLOROSTYRENE = 121;
public static final int NIST_COMPOUND_POLYETHYLENE = 122;
public static final int NIST_COMPOUND_POLYETHYLENE_TEREPHTHALATE_MYLAR = 123;
public static final int NIST_COMPOUND_POLYMETHYL_METHACRALATE_LUCITE_PERSPEX = 124;
public static final int NIST_COMPOUND_POLYOXYMETHYLENE = 125;
public static final int NIST_COMPOUND_POLYPROPYLENE = 126;
public static final int NIST_COMPOUND_POLYSTYRENE = 127;
public static final int NIST_COMPOUND_POLYTETRAFLUOROETHYLENE_TEFLON = 128;
public static final int NIST_COMPOUND_POLYTRIFLUOROCHLOROETHYLENE = 129;
public static final int NIST_COMPOUND_POLYVINYL_ACETATE = 130;
public static final int NIST_COMPOUND_POLYVINYL_ALCOHOL = 131;
public static final int NIST_COMPOUND_POLYVINYL_BUTYRAL = 132;
public static final int NIST_COMPOUND_POLYVINYL_CHLORIDE = 133;
public static final int NIST_COMPOUND_POLYVINYLIDENE_CHLORIDE_SARAN = 134;
public static final int NIST_COMPOUND_POLYVINYLIDENE_FLUORIDE = 135;
public static final int NIST_COMPOUND_POLYVINYL_PYRROLIDONE = 136;
public static final int NIST_COMPOUND_POTASSIUM_IODIDE = 137;
public static final int NIST_COMPOUND_POTASSIUM_OXIDE = 138;
public static final int NIST_COMPOUND_PROPANE = 139;
public static final int NIST_COMPOUND_PROPANE_LIQUID = 140;
public static final int NIST_COMPOUND_N_PROPYL_ALCOHOL = 141;
public static final int NIST_COMPOUND_PYRIDINE = 142;
public static final int NIST_COMPOUND_RUBBER_BUTYL = 143;
public static final int NIST_COMPOUND_RUBBER_NATURAL = 144;
public static final int NIST_COMPOUND_RUBBER_NEOPRENE = 145;
public static final int NIST_COMPOUND_SILICON_DIOXIDE = 146;
public static final int NIST_COMPOUND_SILVER_BROMIDE = 147;
public static final int NIST_COMPOUND_SILVER_CHLORIDE = 148;
public static final int NIST_COMPOUND_SILVER_HALIDES_IN_PHOTOGRAPHIC_EMULSION = 149;
public static final int NIST_COMPOUND_SILVER_IODIDE = 150;
public static final int NIST_COMPOUND_SKIN_ICRP = 151;
public static final int NIST_COMPOUND_SODIUM_CARBONATE = 152;
public static final int NIST_COMPOUND_SODIUM_IODIDE = 153;
public static final int NIST_COMPOUND_SODIUM_MONOXIDE = 154;
public static final int NIST_COMPOUND_SODIUM_NITRATE = 155;
public static final int NIST_COMPOUND_STILBENE = 156;
public static final int NIST_COMPOUND_SUCROSE = 157;
public static final int NIST_COMPOUND_TERPHENYL = 158;
public static final int NIST_COMPOUND_TESTES_ICRP = 159;
public static final int NIST_COMPOUND_TETRACHLOROETHYLENE = 160;
public static final int NIST_COMPOUND_THALLIUM_CHLORIDE = 161;
public static final int NIST_COMPOUND_TISSUE_SOFT_ICRP = 162;
public static final int NIST_COMPOUND_TISSUE_SOFT_ICRU_FOUR_COMPONENT = 163;
public static final int NIST_COMPOUND_TISSUE_EQUIVALENT_GAS_METHANE_BASED = 164;
public static final int NIST_COMPOUND_TISSUE_EQUIVALENT_GAS_PROPANE_BASED = 165;
public static final int NIST_COMPOUND_TITANIUM_DIOXIDE = 166;
public static final int NIST_COMPOUND_TOLUENE = 167;
public static final int NIST_COMPOUND_TRICHLOROETHYLENE = 168;
public static final int NIST_COMPOUND_TRIETHYL_PHOSPHATE = 169;
public static final int NIST_COMPOUND_TUNGSTEN_HEXAFLUORIDE = 170;
public static final int NIST_COMPOUND_URANIUM_DICARBIDE = 171;
public static final int NIST_COMPOUND_URANIUM_MONOCARBIDE = 172;
public static final int NIST_COMPOUND_URANIUM_OXIDE = 173;
public static final int NIST_COMPOUND_UREA = 174;
public static final int NIST_COMPOUND_VALINE = 175;
public static final int NIST_COMPOUND_VITON_FLUOROELASTOMER = 176;
public static final int NIST_COMPOUND_WATER_LIQUID = 177;
public static final int NIST_COMPOUND_WATER_VAPOR = 178;
public static final int NIST_COMPOUND_XYLENE = 179;
private static final String[] MendelArray = { "",
"H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne",
"Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca",
"Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn",
"Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr",
"Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn",
"Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd",
"Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb",
"Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg",
"Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th",
"Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm",
"Md", "No", "Lr", "Rf", "Db", "Sg", "Bh"
};
public static final int RADIO_NUCLIDE_55FE = 0;
public static final int RADIO_NUCLIDE_57CO = 1;
public static final int RADIO_NUCLIDE_109CD = 2;
public static final int RADIO_NUCLIDE_125I = 3;
public static final int RADIO_NUCLIDE_137CS = 4;
public static final int RADIO_NUCLIDE_133BA = 5;
public static final int RADIO_NUCLIDE_153GD = 6;
public static final int RADIO_NUCLIDE_238PU = 7;
public static final int RADIO_NUCLIDE_241AM = 8;
public static final int RADIO_NUCLIDE_244CM = 9;
private static final int[] LB_LINE_MACROS = new int[]{
L2M4_LINE,
L2M3_LINE,
L3N5_LINE,
L3O4_LINE,
L3O5_LINE,
L3O45_LINE,
L3N1_LINE,
L3O1_LINE,
L3N6_LINE,
L3N7_LINE,
L3N4_LINE,
L1M3_LINE,
L1M2_LINE,
L1M5_LINE,
L1M4_LINE
};
private static class LineShellPair {
public final int line;
public final int shell;
public LineShellPair(int line, int shell) {
this.line = line;
this.shell = shell;
}
}
private static final LineShellPair[] lb_pairs = new LineShellPair[]{
new LineShellPair(L2M4_LINE, L2_SHELL), /* b1 */
new LineShellPair(L3N5_LINE, L3_SHELL), /* b2 */
new LineShellPair(L1M3_LINE, L1_SHELL), /* b3 */
new LineShellPair(L1M2_LINE, L1_SHELL), /* b4 */
new LineShellPair(L3O3_LINE, L3_SHELL), /* b5 */
new LineShellPair(L3O4_LINE, L3_SHELL), /* b5 */
new LineShellPair(L3N1_LINE, L3_SHELL) /* b6 */
};
private static final int KL1 = -KL1_LINE - 1;
private static final int KL2 = -KL2_LINE - 1;
private static final int KL3 = -KL3_LINE - 1;
private static final int KM1 = -KM1_LINE - 1;
private static final int KM2 = -KM2_LINE - 1;
private static final int KM3 = -KM3_LINE - 1;
private static final int KP5 = -KP5_LINE - 1;
private Xraylib() {
// intentionally empty constructor
}
}
| gitter-badger/xraylib | java/Xraylib.java |
213,076 | /*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.manufacturers.v1.model;
/**
* Model definition for Grocery.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Manufacturer Center API. For a detailed explanation
* see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class Grocery extends com.google.api.client.json.GenericJson {
/**
* Active ingredients.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String activeIngredients;
/**
* Alcohol by volume.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.Double alcoholByVolume;
/**
* Allergens.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String allergens;
/**
* Derived nutrition claim.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> derivedNutritionClaim;
/**
* Directions.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String directions;
/**
* Indications.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String indications;
/**
* Ingredients.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String ingredients;
/**
* Nutrition claim.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.List<java.lang.String> nutritionClaim;
/**
* Storage instructions.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String storageInstructions;
/**
* Active ingredients.
* @return value or {@code null} for none
*/
public java.lang.String getActiveIngredients() {
return activeIngredients;
}
/**
* Active ingredients.
* @param activeIngredients activeIngredients or {@code null} for none
*/
public Grocery setActiveIngredients(java.lang.String activeIngredients) {
this.activeIngredients = activeIngredients;
return this;
}
/**
* Alcohol by volume.
* @return value or {@code null} for none
*/
public java.lang.Double getAlcoholByVolume() {
return alcoholByVolume;
}
/**
* Alcohol by volume.
* @param alcoholByVolume alcoholByVolume or {@code null} for none
*/
public Grocery setAlcoholByVolume(java.lang.Double alcoholByVolume) {
this.alcoholByVolume = alcoholByVolume;
return this;
}
/**
* Allergens.
* @return value or {@code null} for none
*/
public java.lang.String getAllergens() {
return allergens;
}
/**
* Allergens.
* @param allergens allergens or {@code null} for none
*/
public Grocery setAllergens(java.lang.String allergens) {
this.allergens = allergens;
return this;
}
/**
* Derived nutrition claim.
* @return value or {@code null} for none
*/
public java.util.List<java.lang.String> getDerivedNutritionClaim() {
return derivedNutritionClaim;
}
/**
* Derived nutrition claim.
* @param derivedNutritionClaim derivedNutritionClaim or {@code null} for none
*/
public Grocery setDerivedNutritionClaim(java.util.List<java.lang.String> derivedNutritionClaim) {
this.derivedNutritionClaim = derivedNutritionClaim;
return this;
}
/**
* Directions.
* @return value or {@code null} for none
*/
public java.lang.String getDirections() {
return directions;
}
/**
* Directions.
* @param directions directions or {@code null} for none
*/
public Grocery setDirections(java.lang.String directions) {
this.directions = directions;
return this;
}
/**
* Indications.
* @return value or {@code null} for none
*/
public java.lang.String getIndications() {
return indications;
}
/**
* Indications.
* @param indications indications or {@code null} for none
*/
public Grocery setIndications(java.lang.String indications) {
this.indications = indications;
return this;
}
/**
* Ingredients.
* @return value or {@code null} for none
*/
public java.lang.String getIngredients() {
return ingredients;
}
/**
* Ingredients.
* @param ingredients ingredients or {@code null} for none
*/
public Grocery setIngredients(java.lang.String ingredients) {
this.ingredients = ingredients;
return this;
}
/**
* Nutrition claim.
* @return value or {@code null} for none
*/
public java.util.List<java.lang.String> getNutritionClaim() {
return nutritionClaim;
}
/**
* Nutrition claim.
* @param nutritionClaim nutritionClaim or {@code null} for none
*/
public Grocery setNutritionClaim(java.util.List<java.lang.String> nutritionClaim) {
this.nutritionClaim = nutritionClaim;
return this;
}
/**
* Storage instructions.
* @return value or {@code null} for none
*/
public java.lang.String getStorageInstructions() {
return storageInstructions;
}
/**
* Storage instructions.
* @param storageInstructions storageInstructions or {@code null} for none
*/
public Grocery setStorageInstructions(java.lang.String storageInstructions) {
this.storageInstructions = storageInstructions;
return this;
}
@Override
public Grocery set(String fieldName, Object value) {
return (Grocery) super.set(fieldName, value);
}
@Override
public Grocery clone() {
return (Grocery) super.clone();
}
}
| googleapis/google-api-java-client-services | clients/google-api-services-manufacturers/v1/2.0.0/com/google/api/services/manufacturers/v1/model/Grocery.java |
213,077 | /*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.comprehendmedical.model;
import javax.annotation.Generated;
/**
*
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public enum EntitySubType {
NAME("NAME"),
DX_NAME("DX_NAME"),
DOSAGE("DOSAGE"),
ROUTE_OR_MODE("ROUTE_OR_MODE"),
FORM("FORM"),
FREQUENCY("FREQUENCY"),
DURATION("DURATION"),
GENERIC_NAME("GENERIC_NAME"),
BRAND_NAME("BRAND_NAME"),
STRENGTH("STRENGTH"),
RATE("RATE"),
ACUITY("ACUITY"),
TEST_NAME("TEST_NAME"),
TEST_VALUE("TEST_VALUE"),
TEST_UNITS("TEST_UNITS"),
TEST_UNIT("TEST_UNIT"),
PROCEDURE_NAME("PROCEDURE_NAME"),
TREATMENT_NAME("TREATMENT_NAME"),
DATE("DATE"),
AGE("AGE"),
CONTACT_POINT("CONTACT_POINT"),
PHONE_OR_FAX("PHONE_OR_FAX"),
EMAIL("EMAIL"),
IDENTIFIER("IDENTIFIER"),
ID("ID"),
URL("URL"),
ADDRESS("ADDRESS"),
PROFESSION("PROFESSION"),
SYSTEM_ORGAN_SITE("SYSTEM_ORGAN_SITE"),
DIRECTION("DIRECTION"),
QUALITY("QUALITY"),
QUANTITY("QUANTITY"),
TIME_EXPRESSION("TIME_EXPRESSION"),
TIME_TO_MEDICATION_NAME("TIME_TO_MEDICATION_NAME"),
TIME_TO_DX_NAME("TIME_TO_DX_NAME"),
TIME_TO_TEST_NAME("TIME_TO_TEST_NAME"),
TIME_TO_PROCEDURE_NAME("TIME_TO_PROCEDURE_NAME"),
TIME_TO_TREATMENT_NAME("TIME_TO_TREATMENT_NAME"),
AMOUNT("AMOUNT"),
GENDER("GENDER"),
RACE_ETHNICITY("RACE_ETHNICITY"),
ALLERGIES("ALLERGIES"),
TOBACCO_USE("TOBACCO_USE"),
ALCOHOL_CONSUMPTION("ALCOHOL_CONSUMPTION"),
REC_DRUG_USE("REC_DRUG_USE");
private String value;
private EntitySubType(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
/**
* Use this in place of valueOf.
*
* @param value
* real value
* @return EntitySubType corresponding to the value
*
* @throws IllegalArgumentException
* If the specified value does not map to one of the known values in this enum.
*/
public static EntitySubType fromValue(String value) {
if (value == null || "".equals(value)) {
throw new IllegalArgumentException("Value cannot be null or empty!");
}
for (EntitySubType enumEntry : EntitySubType.values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
}
}
throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
}
}
| aws/aws-sdk-java | aws-java-sdk-comprehendmedical/src/main/java/com/amazonaws/services/comprehendmedical/model/EntitySubType.java |
213,078 | package com.petrolpark.destroy.item;
import com.petrolpark.destroy.util.InebriationHelper;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.stats.Stats;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.UseAnim;
import net.minecraft.world.level.Level;
public class AlcoholicDrinkItem extends Item {
private static final int DRINK_DURATION = 40;
private int strength;
/**
* @param pProperties
* @param strength How many levels of the Inebriation effect this item adds
*/
public AlcoholicDrinkItem(Properties properties, int strength) {
super(properties);
this.strength = strength;
};
public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity entityLiving) {
super.finishUsingItem(stack, level, entityLiving);
if (entityLiving instanceof ServerPlayer serverplayer) {
CriteriaTriggers.CONSUME_ITEM.trigger(serverplayer, stack);
serverplayer.awardStat(Stats.ITEM_USED.get(this));
};
if (!level.isClientSide) {
InebriationHelper.increaseInebriation(entityLiving, getStrength());
};
if (stack.isEmpty()) {
return new ItemStack(Items.GLASS_BOTTLE);
} else {
if (entityLiving instanceof Player player && !player.getAbilities().instabuild) {
ItemStack itemstack = new ItemStack(Items.GLASS_BOTTLE);
if (!player.getInventory().add(itemstack)) {
player.drop(itemstack, false);
}
}
return stack;
}
};
/**
* Returns the number of levels of the Inebriation effect the item should add
*/
public int getStrength() {
return this.strength;
};
public int getUseDuration(ItemStack stack) {
return DRINK_DURATION;
};
public UseAnim getUseAnimation(ItemStack stack) {
return UseAnim.DRINK;
}
public SoundEvent getEatingSound() {
return getDrinkingSound();
};
public SoundEvent getDrinkingSound() {
return SoundEvents.GENERIC_DRINK;
};
}
| petrolpark/Destroy | src/main/java/com/petrolpark/destroy/item/AlcoholicDrinkItem.java |
213,079 | package com.cezarykluczynski.stapi.model.food.entity;
import com.cezarykluczynski.stapi.model.common.annotation.TrackedEntity;
import com.cezarykluczynski.stapi.model.common.annotation.enums.TrackedEntityType;
import com.cezarykluczynski.stapi.model.common.entity.PageAwareEntity;
import com.cezarykluczynski.stapi.model.food.repository.FoodRepository;
import com.cezarykluczynski.stapi.model.page.entity.PageAware;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.SequenceGenerator;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Data
@Entity
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@TrackedEntity(type = TrackedEntityType.FICTIONAL_PRIMARY, repository = FoodRepository.class, singularName = "food", pluralName = "foods")
public class Food extends PageAwareEntity implements PageAware {
@Id
@Column(nullable = false)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "food_sequence_generator")
@SequenceGenerator(name = "food_sequence_generator", sequenceName = "food_sequence", allocationSize = 1)
private Long id;
@Column(nullable = false)
private String name;
private Boolean earthlyOrigin;
private Boolean dessert;
private Boolean fruit;
private Boolean herbOrSpice;
private Boolean sauce;
private Boolean soup;
private Boolean beverage;
private Boolean alcoholicBeverage;
private Boolean juice;
private Boolean tea;
}
| cezarykluczynski/stapi | model/src/main/java/com/cezarykluczynski/stapi/model/food/entity/Food.java |
213,081 | package org.dataalgorithms.machinelearning.logistic.alcohol;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
/**
*
* @author Mahmoud Parsian ([email protected])
*
*/
public class Util {
/**
* for debugging purposes only.
*
*/
static void debugArguments(String[] args) {
if ((args == null) || (args.length == 0)) {
System.out.println("no arguments passed...");
return;
}
for (int i=0; i < args.length; i++){
System.out.println("args["+i+"]="+args[i]);
}
}
/**
* create a Factory context object
*
*/
static JavaSparkContext createJavaSparkContext(String appName) {
SparkConf sparkConf = new SparkConf().setAppName(appName);
return new JavaSparkContext(sparkConf);
}
} | mahmoudparsian/data-algorithms-book | src/main/java/org/dataalgorithms/machinelearning/logistic/alcohol/Util.java |
213,082 | /*
* $Id: Recipe.java,v 1.74 2012/06/03 19:29:17 dougedey Exp $
* Created on Oct 4, 2004 @author aavis recipe class
*/
/**
* StrangeBrew Java - a homebrew recipe calculator
Copyright (C) 2005 Drew Avis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package ca.strangebrew.recipe;
import com.sb.common.SBStringUtils;
import com.sb.elsinore.BrewServer;
import com.sb.elsinore.Messages;
import com.sb.elsinore.Temp;
import com.sb.elsinore.TriggerControl;
import com.sb.elsinore.triggers.TemperatureTrigger;
import com.sb.elsinore.triggers.WaitTrigger;
import java.text.MessageFormat;
import java.util.*;
@SuppressWarnings("unused")
public class Recipe {
// basics:
private String version = "";
private boolean isDirty = false;
public boolean allowRecalcs = true;
private double attenuation;
private int boilMinutes = 60;
private String brewer;
private String comments;
private GregorianCalendar created;
private double efficiency = 75;
private double estOg = 1.050;
private double estFg;
private double ibu;
private boolean mashed;
private String name;
private Style style = new Style();
private List<Yeast> yeasts = new ArrayList<>();
private WaterProfile sourceWater = new WaterProfile();
private WaterProfile targetWater = new WaterProfile();
private List<Salt> brewingSalts = new ArrayList<>();
private Acid acid = Acid.getAcidByName(Acid.CITRIC);
public Mash mash = null;
// water use:
//
// All water use is now based on calculation from mash and always done
// on-the-fly with getters <-------------
//
// Only hard data deserves a variable!
// initial vol = mash + sparge
// pre boil = initial
// post boil = pre - evap - chill
// final - post - kettle loss - trub loss - misc loss (+ dillution) (- tun
// dead space)
// total = initial (+ dillution)
private Quantity postBoilVol = new Quantity();
private Quantity kettleLossVol = new Quantity();
private Quantity trubLossVol = new Quantity();
private Quantity miscLossVol = new Quantity();
// Carbonation
private double bottleTemp = 0.0;
private double servTemp = 0.0;
private double targetVol = 0.0;
private PrimeSugar primeSugar = new PrimeSugar();
private String carbTempU = "";
private boolean kegged = false;
private double kegPSI = 0.0;
// options:
private String colourMethod = "";
private String hopUnits = "";
private String maltUnits = "";
private String ibuCalcMethod = "";
private double ibuHopUtil = 1.0;
private String evapMethod = "percent";
private String alcMethod = BrewCalcs.ALC_BY_VOLUME;
private double pelletHopPct = 0.0;
private String bottleU = "";
private double bottleSize = 0.0;
private double otherCost = 0.0;
private int fwhTime;
private int dryHopTime;
private int mashHopTime;
// totals:
private double totalMaltCost;
private double totalHopsCost;
private double totalMiscCost;
private double totalMaltLbs;
private double totalHopsOz;
private double totalMashLbs;
private int totalFermentTime;
// ingredients
private List<Hop> hops = new ArrayList<>();
private List<Fermentable> fermentables = new ArrayList<>();
private List<Misc> misc = new ArrayList<>();
private List<FermentStep> fermentationSteps = new ArrayList<>();
// notes
private List<Note> notes = new ArrayList<>();
private Equipment equipmentProfile;
private Quantity preBoilVol = new Quantity();
private String tasteNotes;
private double tasteRating;
private double measuredOg;
private double measuredFg;
private String dateBrewed;
private double primeSugarEquiv;
private double kegPrimingFactor;
private String gravUnits = "SG";
private String carbMethod;
// default constuctor
public Recipe() {
}
// Recipe copy constructor
public Recipe(Recipe r) {
this.version = r.version;
this.isDirty = r.getDirty();
this.allowRecalcs = r.allowRecalcs;
this.attenuation = r.getAttenuation();
this.boilMinutes = r.getBoilMinutes();
this.brewer = r.getBrewer();
this.comments = r.getComments();
this.created = r.getCreated();
this.efficiency = r.getEfficiency();
this.estOg = r.estOg;
this.estFg = r.getEstFg();
this.ibu = r.ibu;
this.mashed = r.mashed;
this.name = r.getName();
this.style = r.getStyleObj();
this.yeasts = r.getYeasts();
this.sourceWater = r.getSourceWater();
this.targetWater = r.getTargetWater();
this.brewingSalts = new ArrayList<>(r.getSalts());
this.acid = r.getAcid();
this.mash = r.mash;
// water use:
this.kettleLossVol = new Quantity(r.getVolUnits(), r.getKettleLoss(r.getVolUnits()));
this.trubLossVol = new Quantity(r.getVolUnits(), r.getTrubLoss(r.getVolUnits()));
this.miscLossVol = new Quantity(r.getVolUnits(), r.getMiscLoss(r.getVolUnits()));
this.postBoilVol = new Quantity(r.getVolUnits(), r.getPostBoilVol(r.getVolUnits()));
// Carbonation
this.bottleTemp = r.getBottleTemp();
this.servTemp = r.getServTemp();
this.targetVol = r.getTargetVol();
this.primeSugar = r.getPrimeSugar();
this.carbTempU = r.getCarbTempU();
this.kegged = r.isKegged();
this.kegPSI = r.getKegPSI();
this.colourMethod = r.getColourMethod();
this.hopUnits = r.getHopUnits();
this.maltUnits = r.getMaltUnits();
this.ibuCalcMethod = r.getIBUMethod();
this.ibuHopUtil = r.ibuHopUtil;
this.evapMethod = r.getEvapMethod();
this.alcMethod = r.getAlcMethod();
this.pelletHopPct = r.getPelletHopPct();
this.bottleU = r.getBottleU();
this.bottleSize = r.getBottleSize();
this.otherCost = r.getOtherCost();
this.fwhTime = r.fwhTime;
this.dryHopTime = r.dryHopTime;
this.mashHopTime = r.mashHopTime;
// totals: (all should be pure calculation, not stored!!!
this.totalMaltCost = r.getTotalMaltCost();
this.totalHopsCost = r.getTotalHopsCost();
this.totalMiscCost = r.getTotalMiscCost();
this.totalMaltLbs = r.getTotalMaltLbs();
this.totalHopsOz = r.getTotalHopsOz();
this.totalMashLbs = r.getTotalMaltLbs();
this.totalFermentTime = r.getTotalFermentTime();
// ingredients
this.hops = new ArrayList<>(r.hops);
this.fermentables = new ArrayList<>(r.fermentables);
this.misc = new ArrayList<>(r.misc);
// Fermentation
this.fermentationSteps = new ArrayList<>(r.fermentationSteps);
// notes
this.notes = new ArrayList<>(r.notes);
}
// Getters:
public double getAlcohol() {
return BrewCalcs.calcAlcohol(getAlcMethod(), estOg, getEstFg());
}
public String getAlcMethod() {
return alcMethod;
}
public double getAttenuation() {
if (yeasts.size() > 0 && yeasts.get(0).getAttenuation() > 0.0) {
return yeasts.get(0).getAttenuation();
}
return attenuation;
}
public int getBoilMinutes() {
return boilMinutes;
}
public String getBottleU() {
return bottleU;
}
public double getBottleSize() {
return bottleSize;
}
public double getBUGU() {
double bugu = 0.0;
if (estOg != 1.0) {
bugu = ibu / ((estOg - 1) * 1000);
}
return bugu;
}
public String getBrewer() {
return brewer;
}
public String getComments() {
return comments;
}
public double getColour() {
return getColour(getColourMethod());
}
public double getMcu() {
double mcu = 0;
for (final Fermentable m : fermentables) {
mcu += m.getLov() * m.getAmountAs(Quantity.LB) / getPostBoilVol(Quantity.GAL);
}
return mcu;
}
public double getColour(final String method) {
return BrewCalcs.calcColour(getMcu(), method);
}
public String getColourMethod() {
return colourMethod;
}
public GregorianCalendar getCreated() {
return created;
}
public double getEfficiency() {
return efficiency;
}
public double getEstOg() {
return estOg;
}
public double getEstFg() {
return estFg;
}
public double getEvap() {
return this.equipmentProfile.getEvapRate();
}
public String getEvapMethod() {
return evapMethod;
}
public Mash getMash() {
return mash;
}
public double getIbu() {
return ibu;
}
public String getIBUMethod() {
return ibuCalcMethod;
}
public String getMaltUnits() {
return maltUnits;
}
public String getName() {
return name;
}
public double getOtherCost() {
return otherCost;
}
public double getPelletHopPct() {
return pelletHopPct;
}
// Water getters - the calculated version
public double getKettleLoss(final String s) {
return kettleLossVol.getValueAs(s);
}
public double getMiscLoss(final String s) {
return miscLossVol.getValueAs(s);
}
public double getTotalWaterVol(final String s) {
Quantity q = new Quantity(Quantity.QT, mash.getTotalWaterQts() + mash.getSpargeVol());
return q.getValueAs(s);
}
public double getChillShrinkVol(final String s) {
if (equipmentProfile != null) {
return getPostBoilVol(s) * equipmentProfile.getChillPercent();
}
double CHILLPERCENT = 0.03;
return getPostBoilVol(s) * CHILLPERCENT;
}
public double getPreBoilVol(final String s) {
if (this.equipmentProfile != null && this.equipmentProfile.isCalcBoilVol()) {
return getPostBoilVol(s)
+ getEvapVol(s)
+ getChillShrinkVol(s)
+ equipmentProfile.getTopupKettle()
+ equipmentProfile.getTrubChillerLoss().getValueAs(s)
+ equipmentProfile.getLauterDeadspace().getValueAs(s);
}
return this.preBoilVol.getValueAs(s);
}
public double getFinalWortVol(final String s) {
return getPostBoilVol(s) - (getKettleLoss(s) + getTrubLoss(s) + getMiscLoss(s));
}
public Quantity getPostBoilVol() {
return postBoilVol;
}
public double getPostBoilVol(final String s) {
return postBoilVol.getValueAs(s);
}
public double getTrubLoss(final String s) {
return trubLossVol.getValueAs(s);
}
public double getEvapVol(final String s) {
// JvH changing the boiltime, changes the post boil volume (NOT the pre
// boil)
double e;
if (evapMethod.equals("Constant")) {
e = getEvap() * getBoilMinutes() / 60;
Quantity tVol = new Quantity(getVolUnits(), e);
return tVol.getValueAs(s);
} else { // %
e = (getPostBoilVol(s)// - equipmentProfile.getTopupKettle()
- equipmentProfile.getTrubChillerLoss().getValueAs(s)
- equipmentProfile.getLauterDeadspace().getValueAs(s))
* (getEvap() / 100) * getBoilMinutes() / 60;
}
return e;
}
public String getVolUnits() {
if(postBoilVol != null){
return postBoilVol.getUnits();
}
return "";
}
public double getSparge() {
// return (getVolConverted(spargeQTS));
return mash.getSpargeVol();
}
public String getStyle() {
return style.getName();
}
public Style getStyleObj() {
return style;
}
public double getTotalHopsOz() {
return totalHopsOz;
}
public double getTotalHops() {
return Quantity.convertUnit(Quantity.OZ, hopUnits, totalHopsOz);
}
public double getTotalHopsCost() {
return totalHopsCost;
}
public double getTotalMaltCost() {
return totalMaltCost;
}
public double getTotalMashLbs() {
return totalMashLbs;
}
public double getTotalMash() {
return Quantity.convertUnit(Quantity.LB, getMaltUnits(), totalMashLbs);
}
public double getTotalMaltLbs() {
return totalMaltLbs;
}
public double getTotalMalt() {
return Quantity.convertUnit(Quantity.LB, maltUnits, totalMaltLbs);
}
public double getTotalMiscCost() {
return totalMiscCost;
}
public String getYeast(int i) {
return yeasts.get(i).getName();
}
public Yeast getYeastObj(int i) {
return yeasts.get(i);
}
public boolean getDirty() {
return isDirty;
}
// Setters:
// Set saved flag
public void setDirty(final boolean d) {
isDirty = d;
}
/*
* Turn off allowRecalcs when you are importing a recipe, so that strange
* things don't happen. BE SURE TO TURN BACK ON!
*/
public void setAllowRecalcs(final boolean b) {
allowRecalcs = b;
}
public void setAlcMethod(final String s) {
isDirty = true;
alcMethod = s;
}
public void setBoilMinutes(final int b) {
isDirty = true;
boilMinutes = b;
}
public void setBottleSize(final double b) {
isDirty = true;
bottleSize = b;
}
public void setBottleU(final String u) {
isDirty = true;
bottleU = u;
}
public void setBrewer(final String b) {
isDirty = true;
brewer = b;
}
public void setComments(final String c) {
isDirty = true;
comments = c;
}
public void setColourMethod(final String c) {
isDirty = true;
colourMethod = c;
calcMaltTotals();
}
public void setCreated(final Date d) {
isDirty = true;
created.setTime(d);
}
public void setEvap(final double e) {
isDirty = true;
this.equipmentProfile.setEvapRate(e);
calcMaltTotals();
calcHopsTotals();
}
public void setEvapMethod(final String e) {
isDirty = true;
evapMethod = e;
}
public void setHopsUnits(final String h) {
isDirty = true;
hopUnits = h;
}
public void setIBUMethod(final String s) {
if (s == null || s.equals("")) {
return;
}
isDirty = true;
ibuCalcMethod = s;
calcHopsTotals();
}
public void setKettleLoss(final Quantity q) {
isDirty = true;
kettleLossVol = q;
calcMaltTotals();
}
public void setMaltUnits(final String m) {
isDirty = true;
maltUnits = m;
}
public void setMashed(final boolean m) {
isDirty = true;
mashed = m;
}
public void setMashRatio(final double m) {
isDirty = true;
mash.setMashRatio(m);
}
public void setMashRatioU(final String u) {
isDirty = true;
mash.setMashRatioU(u);
}
public void setMiscLoss(final Quantity m) {
isDirty = true;
miscLossVol = m;
calcMaltTotals();
}
public void setName(final String n) {
isDirty = true;
name = n;
}
public void setOtherCost(final double c) {
isDirty = true;
otherCost = c;
}
public void setPelletHopPct(final double p) {
isDirty = true;
pelletHopPct = p;
calcHopsTotals();
}
public void setStyle(final String s) {
isDirty = true;
style.setName(s);
}
public void setStyle(final Style s) {
isDirty = true;
style = s;
style.setComplete();
}
public void setTrubLoss(final Quantity t) {
isDirty = true;
trubLossVol = t;
calcMaltTotals();
}
public void setYeastName(final int i, final String s) {
isDirty = true;
yeasts.get(i).setName(s);
}
public void setYeast(final int i, final Yeast y) {
isDirty = true;
yeasts.add(i, y);
}
public void setVersion(final String v) {
isDirty = true;
version = v;
}
// Fermentation Steps
// Getters
public int getFermentStepSize() {
return fermentationSteps.size();
}
public String getFermentStepType(final int i) {
return fermentationSteps.get(i).getType();
}
public int getFermentStepTime(final int i) {
return fermentationSteps.get(i).getTime();
}
public int getFermentStepTimeMins(final int i) {
return fermentationSteps.get(i).getTime()*24*60;
}
public double getFermentStepTemp(final int i) {
return fermentationSteps.get(i).getTemp();
}
public String getFermentStepTempU(final int i) {
return fermentationSteps.get(i).getTempU();
}
public FermentStep getFermentStep(final int i) {
return fermentationSteps.get(i);
}
public FermentStep getFermentStep(final String stepType) {
for(FermentStep fs: fermentationSteps) {
if (fs.getType().equals(stepType)) {
return fs;
}
}
return new FermentStep();
}
public int getTotalFermentTime() {
return totalFermentTime;
}
// Setters
public void setFermentStepType(final int i, final String s) {
isDirty = true;
fermentationSteps.get(i).setType(s);
}
public void setFermentStepTime(final int i, final int t) {
isDirty = true;
fermentationSteps.get(i).setTime(t);
}
public void setFermentStepTemp(final int i, final double d) {
isDirty = true;
fermentationSteps.get(i).setTemp(d);
}
public void setFermentStepTempU(final int i, final String s) {
isDirty = true;
fermentationSteps.get(i).setTempU(s);
}
public void addFermentStep(final FermentStep fs) {
isDirty = true;
fermentationSteps.add(fs);
calcFermentTotals();
}
public FermentStep delFermentStep(final int i) {
isDirty = true;
FermentStep temp = null;
if (!fermentationSteps.isEmpty() && (i > -1) && (i < fermentationSteps.size())) {
temp = fermentationSteps.remove(i);
calcFermentTotals();
}
return temp;
}
public void calcFermentTotals() {
totalFermentTime = 0;
for (FermentStep fermentationStep : fermentationSteps) {
totalFermentTime += fermentationStep.getTime();
}
Collections.sort(fermentationSteps);
}
// hop list get functions:
public String getHopUnits() {
return hopUnits;
}
public Hop getHop(final int i) {
if(i < hops.size()) {
return hops.get(i);
} else {
return null;
}
}
public int getHopsListSize() {
return hops.size();
}
public String getHopName(final int i) {
return hops.get(i).getName();
}
public String getHopType(final int i) {
return hops.get(i).getType();
}
public double getHopAlpha(final int i) {
return hops.get(i).getAlpha();
}
public String getHopUnits(final int i) {
return hops.get(i).getUnits();
}
public String getHopAdd(final int i) {
return hops.get(i).getAdd();
}
public int getHopMinutes(final int i) {
return hops.get(i).getMinutes();
}
public double getHopIBU(final int i) {
return hops.get(i).getIBU();
}
public double getHopCostPerU(final int i) {
return hops.get(i).getCostPerU();
}
public double getHopAmountAs(final int i, final String s) {
return hops.get(i).getAmountAs(s);
}
public String getHopDescription(final int i) {
return hops.get(i).getDescription();
}
// hop list set functions
public void setHopUnits(final int i, final String u) {
isDirty = true;
hops.get(i).setUnits(u);
}
public void setHopName(final int i, final String n) {
isDirty = true;
hops.get(i).setName(n);
}
public void setHopType(final int i, final String t) {
isDirty = true;
hops.get(i).setType(t);
}
public void setHopAdd(final int i, final String a) {
isDirty = true;
hops.get(i).setAdd(a);
}
public void setHopAlpha(final int i, final double a) {
isDirty = true;
hops.get(i).setAlpha(a);
}
public void setHopMinutes(final int i, final int m) {
isDirty = true;
// have to re-sort hops
hops.get(i).setMinutes(m);
}
public void setHopCost(final int i, final String c) {
isDirty = true;
hops.get(i).setCost(c);
}
public void setHopAmount(final int i, final double a) {
isDirty = true;
hops.get(i).setAmount(a);
}
// fermentable get methods
// public ArrayList getFermentablesList() { return fermentables; }
public Fermentable getFermentable(final int i) {
if (i < fermentables.size()) {
return fermentables.get(i);
} else {
return null;
}
}
public int getMaltListSize() {
return fermentables.size();
}
public String getMaltName(final int i) {
return fermentables.get(i).getName();
}
public String getMaltUnits(final int i) {
return fermentables.get(i).getUnits();
}
public double getMaltPppg(final int i) {
return fermentables.get(i).getPppg();
}
public double getMaltLov(final int i) {
return fermentables.get(i).getLov();
}
public double getMaltCostPerU(final int i) {
return fermentables.get(i).getCostPerU();
}
public double getMaltCostPerUAs(final int i, String s) {
return fermentables.get(i).getCostPerUAs(s);
}
public double getMaltPercent(final int i) {
return fermentables.get(i).getPercent();
}
public double getMaltAmountAs(final int i, final String s) {
return fermentables.get(i).getAmountAs(s);
}
public String getMaltDescription(final int i) {
return fermentables.get(i).getDescription();
}
public boolean getMaltMashed(final int i) {
return fermentables.get(i).getMashed();
}
public boolean getMaltSteep(final int i) {
return fermentables.get(i).getSteep();
}
public boolean getMaltFerments(final int i) {
return fermentables.get(i).ferments();
}
// fermentable set methods
public void setMaltName(final int i, final String n) {
// have to re-sort
isDirty = true;
fermentables.get(i).setName(n);
}
public void setMaltUnits(final int i, final String u) {
isDirty = true;
fermentables.get(i).setUnits(u);
fermentables.get(i).setCost(fermentables.get(i).getCostPerUAs(u));
}
public void setMaltAmount(final int i, final double a) {
setMaltAmount(i, a, false);
}
public void setMaltAmount(final int i, final double a, final boolean sort) {
isDirty = true;
fermentables.get(i).setAmount(a);
Comparator<Fermentable> c = new Comparator<Fermentable>() {
public int compare(Fermentable h1, Fermentable h2){
if(h1.getAmountAs(Quantity.LB) > h2.getAmountAs(Quantity.LB))
return 1;
if(h1.getAmountAs(Quantity.LB) < h2.getAmountAs(Quantity.LB))
return -1;
if(h1.getAmountAs(Quantity.LB) == h2.getAmountAs(Quantity.LB))
// same amount, check later
return 0;
return 0;
}
};
if (sort) {
calcMaltTotals();
}
}
public void setMaltAmountAs(final int i, final double a, final String u) {
isDirty = true;
fermentables.get(i).setAmountAs(a, u);
fermentables.get(i).setCost(fermentables.get(i).getCostPerUAs(u));
}
public void setMaltPppg(final int i, final double p) {
isDirty = true;
fermentables.get(i).setPppg(p);
}
public void setMaltLov(final int i, final double l) {
isDirty = true;
fermentables.get(i).setLov(l);
}
public void setMaltCost(final int i, final String c) {
isDirty = true;
fermentables.get(i).setCost(c);
}
public void setMaltCost(final int i, final Double c) {
isDirty = true;
fermentables.get(i).setCost(c);
}
public void setMaltPercent(final int i, final double p) {
isDirty = true;
fermentables.get(i).setPercent(p);
}
public void setMaltSteep(final int i, final boolean c) {
isDirty = true;
fermentables.get(i).setSteep(c);
}
public void setMaltMashed(final int i, final boolean c) {
isDirty = true;
fermentables.get(i).setMashed(c);
}
public void setMaltFerments(final int i, final boolean c) {
isDirty = true;
fermentables.get(i).ferments(c);
}
// misc get/set functions
public int getMiscListSize() {
return misc.size();
}
public Misc getMisc(final int i) {
return misc.get(i);
}
public String getMiscName(final int i) {
return misc.get(i).getName();
}
public void setMiscName(final int i, final String n) {
isDirty = true;
misc.get(i).setName(n);
}
public double getMiscAmount(final int i) {
final Misc m = misc.get(i);
return m.getAmountAs(m.getUnits());
}
public void setMiscAmount(final int i, final double a) {
isDirty = true;
misc.get(i).setAmount(a);
calcMiscCost();
}
public String getMiscUnits(final int i) {
return misc.get(i).getUnits();
}
public void setMiscUnits(final int i, final String u) {
isDirty = true;
misc.get(i).setUnits(u);
calcMiscCost();
}
public double getMiscCost(final int i) {
return misc.get(i).getCostPerU();
}
public void setMiscCost(final int i, final double c) {
isDirty = true;
misc.get(i).setCost(c);
calcMiscCost();
}
public String getMiscStage(final int i) {
return misc.get(i).getStage();
}
public void setMiscStage(final int i, final String s) {
isDirty = true;
misc.get(i).setStage(s);
}
public int getMiscTime(final int i) {
return misc.get(i).getTime();
}
public void setMiscTime(final int i, final int t) {
isDirty = true;
misc.get(i).setTime(t);
}
public String getMiscDescription(final int i) {
return misc.get(i).getDescription();
}
public void setMiscComments(final int i, final String c) {
isDirty = true;
misc.get(i).setComments(c);
}
public String getMiscComments(final int i) {
return misc.get(i).getComments();
}
// notes get/set methods
public Note getNote(int i) {
return notes.get(i);
}
public int getNotesListSize() {
return notes.size();
}
public Date getNoteDate(final int i) {
return notes.get(i).getDate();
}
public void setNoteDate(final int i, final Date d) {
isDirty = true;
notes.get(i).setDate(d);
}
public String getNoteType(final int i) {
return notes.get(i).getType();
}
public void setNoteType(final int i, final String t) {
isDirty = true;
if (i > -1) {
notes.get(i).setType(t);
}
}
public String getNoteNote(final int i) {
return notes.get(i).getNote();
}
public void setNoteNote(final int i, final String n) {
isDirty = true;
notes.get(i).setNote(n);
}
// Setters that need to do extra work:
public void setVolUnits(final String v) {
isDirty = true;
kettleLossVol.convertTo(v);
postBoilVol.convertTo(v);
trubLossVol.convertTo(v);
miscLossVol.convertTo(v);
calcMaltTotals();
calcHopsTotals();
}
public void setReadVolUnits(final String v) {
isDirty = true;
kettleLossVol.setUnits(v);
postBoilVol.setUnits(v);
trubLossVol.setUnits(v);
miscLossVol.setUnits(v);
calcMaltTotals();
calcHopsTotals();
}
public void setEstFg(final double f) {
isDirty = true;
if ((f != estFg) && (f > 0)) {
estFg = f;
attenuation = 100 - ((estFg - 1) / (estOg - 1) * 100);
}
}
public void setEstOg(final double o) {
if (o == 0) {
return;
}
isDirty = true;
if ((o != estOg) && (o > 0)) {
estOg = o;
attenuation = 100 - ((estFg - 1) / (estOg - 1) * 100);
calcEfficiency();
}
}
public void setEfficiency(final double e) {
isDirty = true;
if ((e != efficiency) && (e > 0)) {
efficiency = e;
calcMaltTotals();
}
}
public void setAttenuation(final double a) {
isDirty = true;
if ((a != attenuation) && (a > 0)) {
attenuation = a;
calcMaltTotals();
}
}
public void setPreBoil(final Quantity p) {
isDirty = true;
// The one-true-volume is postBoil.. so calc it, and set it
if (this.equipmentProfile != null && this.equipmentProfile.isCalcBoilVol()) {
Quantity post = new Quantity(getVolUnits(), p.getValueAs(getVolUnits()) - getEvapVol(getVolUnits())
- getChillShrinkVol(getVolUnits()));
setPostBoil(post);
} else {
this.preBoilVol = p;
}
}
public void setPostBoil(final Quantity p) {
isDirty = true;
// One-true vol, set it and all the getters will go from there
// Hack alert; chop off "double ugglyness" rounding errors at umtenth
// decimal place
// this is causing recalc problems:
// long hackNumber = (long)(p.getValue() * 100);
// p.setAmount((double)hackNumber / 100);
postBoilVol = p;
// Recalc all the bits
calcMaltTotals();
calcHopsTotals();
calcPrimeSugar();
calcKegPSI();
}
public void setFinalWortVol(final Quantity p) {
isDirty = true;
// The one-true-volume is postBoil.. so calc it, and set it
Quantity post = new Quantity(getVolUnits(), p.getValueAs(getVolUnits()) + getKettleLoss(getVolUnits())
+ getTrubLoss(getVolUnits()) + getMiscLoss(getVolUnits()));
setPostBoil(post);
}
/*
* Functions that add/remove from ingredient lists
*/
public void addMalt(final Fermentable m) {
isDirty = true;
fermentables.add(m);
calcMaltTotals();
}
public void delMalt(final int i) {
isDirty = true;
if (!fermentables.isEmpty() && (i > -1) && (i < fermentables.size())) {
fermentables.remove(i);
calcMaltTotals();
}
}
public void addHop(final Hop h) {
isDirty = true;
hops.add(h);
calcHopsTotals();
}
public void delHop(final int i) {
isDirty = true;
if (!hops.isEmpty() && (i > -1) && (i < hops.size())) {
hops.remove(i);
calcHopsTotals();
}
}
public void addMisc(final Misc m) {
isDirty = true;
misc.add(m);
calcMiscCost();
}
public void delMisc(final int i) {
isDirty = true;
if (!misc.isEmpty() && (i > -1) && (i < misc.size())) {
misc.remove(i);
calcMiscCost();
}
}
private void calcMiscCost() {
totalMiscCost = 0;
for (final Misc m : misc) {
totalMiscCost += m.getAmountAs(m.getUnits()) * m.getCostPerU();
}
}
public void addNote(final Note n) {
isDirty = true;
notes.add(n);
}
public void delNote(final int i) {
isDirty = true;
if (!notes.isEmpty() && (i > -1) && (i < notes.size())) {
notes.remove(i);
}
}
/**
* Handles a string of the form "d u", where d is a double amount, and u is
* a string of units. For importing the quantity attribute from QBrew xml.
*
* @param a The Amount and unit string to parse.
*/
public void setAmountAndUnits(final String a) {
isDirty = true;
final int i = a.indexOf(" ");
final String d = a.substring(0, i);
final String u = a.substring(i);
Quantity post = new Quantity(u.trim(), Double.parseDouble(d.trim()));
setPostBoil(post);
}
/**
* Calculate all the malt totals from the array of malt objects TODO: Other
* things to implement: - cost tracking - hopped malt extracts (IBUs) - the %
* that this malt represents - error checking
*/
// Calc functions.
private void calcEfficiency() {
double possiblePoints = 0;
for (final Fermentable m : fermentables) {
possiblePoints += (m.getPppg() - 1) * m.getAmountAs(Quantity.LB) / getPostBoilVol(Quantity.GAL);
}
efficiency = (estOg - 1) / possiblePoints * 100;
}
public void calcMaltTotals() {
if (!allowRecalcs) {
return;
}
double maltPoints = 0;
double fermentingMaltPoints = 0;
totalMaltLbs = 0;
totalMaltCost = 0;
totalMashLbs = 0;
double curPoints = 0.0;
// first figure out the total we're dealing with
for (final Fermentable m : fermentables) {
if (m.getName().equals("") || m.getAmountAs(Quantity.LB) <= 0.00) {
continue;
}
totalMaltLbs += (m.getAmountAs(Quantity.LB));
if (m.getMashed()) { // apply efficiency and add to mash weight
curPoints = (m.getPppg() - 1) * m.getAmountAs(Quantity.LB) * getEfficiency()
/ getPostBoilVol(Quantity.GAL);
totalMashLbs += (m.getAmountAs(Quantity.LB));
} else {
curPoints += (m.getPppg() - 1) * m.getAmountAs(Quantity.LB) * 100 / getPostBoilVol(Quantity.GAL);
}
maltPoints += curPoints;
// Check to see if we can ferment this sugar
if (m.ferments()) {
fermentingMaltPoints += curPoints;
}
}
// Now calculate the percentages
for (Fermentable m : fermentables) {
// Malt % By Weight
if (m.getAmountAs(Quantity.LB) == 0) {
m.setPercent(0);
} else {
m.setPercent((m.getAmountAs(Quantity.LB) / totalMaltLbs * 100));
}
totalMaltCost += m.getCostPerU() * m.getAmountAs(m.getUnits());
}
// set the fields in the object
estOg = (maltPoints / 100) + 1;
double estFermOg = (fermentingMaltPoints / 100) + 1;
double attGrav = (estFermOg - 1) * (getAttenuation() / 100);
// FG
estFg = estOg - attGrav;
// mash.setMaltWeight(totalMashLbs);
Collections.sort(fermentables, fermCompare);
Collections.reverse(fermentables);
}
public void calcHopsTotals() {
if (!allowRecalcs) {
return;
}
Collections.sort(hops);
double ibuTotal = 0;
totalHopsCost = 0;
totalHopsOz = 0;
for (Hop hop : hops) {
// calculate the average OG of the boil
// first, the OG at the time of addition:
double adjPreSize, aveOg;
int time = hop.getMinutes();
if (hop.getAdd().equalsIgnoreCase(Hop.FWH)) {
time = time - fwhTime;
} else if (hop.getAdd().equalsIgnoreCase(Hop.MASH)) {
time = mashHopTime;
} else if (hop.getAdd().equalsIgnoreCase(Hop.DRY)) {
time = dryHopTime;
}
if (hop.getMinutes() > 0) {
adjPreSize = getPostBoilVol(Quantity.GAL)
+ (getPreBoilVol(Quantity.GAL) - getPostBoilVol(Quantity.GAL))
/ (getBoilMinutes() / hop.getMinutes());
} else {
adjPreSize = getPostBoilVol(Quantity.GAL);
}
aveOg = 1 + (((estOg - 1) + ((estOg - 1) / (adjPreSize / getPostBoilVol(Quantity.GAL)))) / 2);
BrewServer.LOG.warning(String.format("IBU Util: %.2f, OG: %.3f, adjPreSize: %.2f", ibuHopUtil, aveOg, adjPreSize));
switch (ibuCalcMethod) {
case BrewCalcs.TINSETH:
hop.setIBU(BrewCalcs.calcTinseth(hop.getAmountAs(Quantity.OZ), getPostBoilVol(Quantity.GAL), aveOg,
time, hop.getAlpha()));
break;
case BrewCalcs.RAGER:
hop.setIBU(BrewCalcs.CalcRager(hop.getAmountAs(Quantity.OZ), getPostBoilVol(Quantity.GAL), aveOg,
time, hop.getAlpha()));
break;
default:
hop.setIBU(BrewCalcs.CalcGaretz(hop.getAmountAs(Quantity.OZ), getPostBoilVol(Quantity.GAL), aveOg, time,
getPreBoilVol(Quantity.GAL), 1, hop.getAlpha()));
break;
}
BrewServer.LOG.warning("Precalc: " + hop.getIBU());
if (hop.getType().equalsIgnoreCase(Hop.PELLET)) {
hop.setIBU(hop.getIBU() * (1.0 + (getPelletHopPct() / 100)));
}
BrewServer.LOG.warning("Postcalc: " + hop.getIBU());
ibuTotal += hop.getIBU();
totalHopsCost += hop.getCostPerU() * hop.getAmountAs(hop.getUnits());
totalHopsOz += hop.getAmountAs(Quantity.OZ);
}
ibu = ibuTotal;
}
private String addXMLHeader(String in) {
in = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
+ "<?xml-stylesheet type=\"text/xsl\" href=\"http://strangebrewcloud.appspot.com/html/recipeToHtml.xslt\"?>"
+ in;
return in;
}
public static String buildString(final char ch, final int length) {
final char newStr[] = new char[length];
for (int i = 0; i < length; ++i) {
newStr[i] = ch;
}
return new String(newStr);
}
public String toText() {
return toText(false);
}
public static String padLeft(final String str, final int fullLength, final char ch) {
return (fullLength > str.length()) ? str.concat(Recipe.buildString(ch, fullLength - str.length())) : str;
}
public static String padRight(final String str, final int fullLength, final char ch) {
return (fullLength > str.length()) ? Recipe.buildString(ch, fullLength - str.length()).concat(str) : str;
}
public String toText(boolean detailed) {
MessageFormat mf;
final StringBuilder sb = new StringBuilder();
sb.append("StrangeBrew J v.").append(version).append(" recipe text output\n\n");
sb.append("Details:\n");
sb.append("Name: ").append(name).append("\n");
sb.append("Brewer: ").append(brewer).append("\n");
sb.append("Size: ").append(SBStringUtils.format(getPostBoilVol(getVolUnits()), 1)).append(" ").append(getVolUnits()).append("\n");
sb.append("Style: ").append(style.getName()).append("\n");
mf = new MessageFormat(
"OG: {0,number,0.000},\tFG:{1,number,0.000}, \tAlc:{2,number,0.0}, \tIBU:{3,number,0.0}\n");
final Object[] objs = {estOg, estFg, getAlcohol(), ibu};
sb.append(mf.format(objs));
sb.append("(Alc method: by ").append(getAlcMethod()).append("; IBU method: ").append(ibuCalcMethod).append(")\n");
if (yeasts.size() == 1) {
sb.append("\nYeast: ");
} else {
sb.append("\nYeasts: ");
}
for (Yeast yeast: yeasts) {
sb.append(yeast.getName()).append("\n");
}
sb.append("\nFermentables:\n");
sb.append(Recipe.padLeft("Name ", 30, ' ')).append(" amount units pppg lov %\n");
mf = new MessageFormat("{0} {1} {2} {3,number,0.000} {4} {5}%\n");
for (Fermentable fermentable : fermentables) {
final Object[] objf = {Recipe.padLeft(fermentable.getName(), 30, ' '),
Recipe.padRight(" " + SBStringUtils.format(fermentable.getAmountAs(fermentable.getUnits()), 2), 6, ' '),
Recipe.padRight(" " + fermentable.getUnitsAbrv(), 5, ' '), fermentable.getPppg(),
Recipe.padRight(" " + SBStringUtils.format(fermentable.getLov(), 1), 6, ' '),
Recipe.padRight(" " + SBStringUtils.format(fermentable.getPercent(), 1), 5, ' ')};
sb.append(mf.format(objf));
}
sb.append("\nHops:\n");
sb.append(Recipe.padLeft("Name ", 20, ' ')).append(" amount units Alpha Min IBU\n");
mf = new MessageFormat("{0} {1} {2} {3} {4} {5}\n");
for (final Hop h : hops) {
final Object[] objh = {Recipe.padLeft(h.getName() + " (" + h.getType() + ")", 20, ' '),
Recipe.padRight(" " + SBStringUtils.format(h.getAmountAs(h.getUnits()), 2), 6, ' '),
Recipe.padRight(" " + h.getUnitsAbrv(), 5, ' '), Recipe.padRight(" " + h.getAlpha(), 6, ' '),
Recipe.padRight(" " + SBStringUtils.format(h.getMinutes(), 1), 6, ' '),
Recipe.padRight(" " + SBStringUtils.format(h.getIBU(), 1), 5, ' ')};
sb.append(mf.format(objh));
}
if (mash.getStepSize() > 0) {
sb.append("\nMash:\n");
sb.append(Recipe.padLeft("Step ", 10, ' ')).append(" Temp End Ramp Min Input Output Water Temp\n");
mf = new MessageFormat("{0} {1} {2} {3} {4} {5} {6} {7}\n");
for (int i = 0; i < mash.getStepSize(); i++) {
final Object[] objm = { Recipe.padLeft(mash.getStepType(i), 10, ' '),
Recipe.padRight(" " + mash.getStepStartTemp(i), 6, ' '),
Recipe.padRight(" " + mash.getStepEndTemp(i), 6, ' '),
Recipe.padRight(" " + mash.getStepRampMin(i), 4, ' '),
Recipe.padRight(" " + mash.getStepMin(i), 6, ' '),
Recipe.padRight(" " + SBStringUtils.format(mash.getStepInVol(i), 2) , 6, ' '),
Recipe.padRight(" " + SBStringUtils.format(mash.getStepOutVol(i), 2), 6, ' '),
Recipe.padRight(" " + mash.getStepTemp(i), 6, ' ')};
sb.append(mf.format(objm));
}
}
if (notes.size() > 0) {
sb.append("\nNotes:\n");
for (Note note : notes) {
sb.append(note.toString());
}
}
// only print this stuff for detailed text output:
if (detailed) {
// Fermentation Schedule
if (fermentationSteps.size() > 0) {
sb.append("\nFermentation Schedule:\n");
sb.append(Recipe.padLeft("Step ", 10, ' ')).append(" Time Days\n");
mf = new MessageFormat("{0} {1} {2}\n");
for (final FermentStep f : fermentationSteps) {
final Object[] objm = {Recipe.padLeft(f.getType(), 10, ' '),
Recipe.padRight(" " + f.getTime(), 6, ' '),
Recipe.padRight(" " + f.getTemp() + f.getTempU(), 6, ' ')};
sb.append(mf.format(objm));
}
}
// Carb
sb.append("\nCarbonation: ").append(targetVol).append(" volumes CO2\n");
sb.append(" Bottle Temp: ").append(bottleTemp).append(carbTempU).append(" Serving Temp:").append(servTemp).append(carbTempU).append("\n");
sb.append(" Priming: ").append(SBStringUtils.format(primeSugar.getAmountAs(primeSugar.getUnits()), 1)).append(primeSugar.getUnitsAbrv()).append(" of ").append(primeSugar.getName()).append("\n");
sb.append(" Or keg at: ").append(kegPSI).append("PSI\n");
if ((!Objects.equals(sourceWater.getName(), "")) || (!Objects.equals(targetWater.getName(), ""))) {
sb.append("\nWater Profile\n");
sb.append(" Source Water: ").append(sourceWater.toString()).append("\n");
sb.append(" Target Water: ").append(targetWater.toString()).append("\n");
if (brewingSalts.size() > 0) {
sb.append(" Salt Additions per Gal\n");
for (Salt brewingSalt : brewingSalts) {
sb.append(" ").append(brewingSalt.toString()).append("\n");
}
}
sb.append(" Acid: ").append(SBStringUtils.format(getAcidAmount(), 2)).append(acid.getAcidUnit()).append(" per gal of ").append(acid.getName()).append(" Acid\n");
}
}
return sb.toString();
}
/*
* Scale the recipe up or down, so that the new OG = old OG, and new IBU =
* old IBU
*/
public void scaleRecipe(final Quantity newSize) {
final double currentSize = getPostBoilVol(newSize.getUnits());
final double conversionFactor = newSize.getValue() / currentSize;
if (conversionFactor != 1) {
// TODO: figure out a way to make sure old IBU = new IBU
for (int i = 0; i < getHopsListSize(); i++) {
final Hop h = getHop(i);
h.setAmount(h.getAmountAs(h.getUnits()) * conversionFactor);
}
for (int i = 0; i < getMaltListSize(); i++) {
final Fermentable f = getFermentable(i);
f.setAmount(f.getAmountAs(f.getUnits()) * conversionFactor);
}
setPostBoil(newSize);
setVolUnits(newSize.getUnits());
}
}
public double getBottleTemp() {
return bottleTemp;
}
public void setBottleTemp(final double bottleTemp) {
isDirty = true;
this.bottleTemp = bottleTemp;
calcPrimeSugar();
}
public String getCarbTempU() {
return carbTempU;
}
public void setCarbTempU(final String carbU) {
isDirty = true;
this.carbTempU = carbU;
}
public boolean isKegged() {
return kegged;
}
public void setKegged(final boolean kegged) {
isDirty = true;
this.kegged = kegged;
calcKegPSI();
}
public double getKegPSI() {
return this.kegPSI;
}
public void setKegPSI(final double psi) {
isDirty = true;
this.kegPSI = psi;
}
public double getKegTubeLength() {
double resistance;
if (getKegTubeID().equals("3/16")) {
resistance = 2.4;
} else {
resistance = 0.7;
}
return (getKegPSI() - (getKegTubeHeight() * 0.5) - 1) / resistance;
}
public double getKegTubeVol() {
double mlPerFoot;
if (getKegTubeID().equals("3/16")) {
mlPerFoot = 4.9;
} else {
mlPerFoot = 9.9;
}
return getKegTubeLength() * mlPerFoot;
}
public double getKegTubeHeight() {
return 0.0;
}
public String getKegTubeID() {
return "";
}
public String getPrimeSugarName() {
return primeSugar.getName();
}
public String getPrimeSugarU() {
return primeSugar.getUnitsAbrv();
}
public void setPrimeSugarU(final String primeU) {
isDirty = true;
this.primeSugar.setUnits(primeU);
calcPrimeSugar();
}
public double getPrimeSugarAmt() {
return primeSugar.getAmountAs(primeSugar.getUnitsAbrv());
}
public void calcPrimeSugar() {
if (!allowRecalcs) {
return;
}
final double dissolvedCO2 = BrewCalcs.dissolvedCO2(getBottleTemp());
final double primeSugarGL = BrewCalcs.PrimingSugarGL(dissolvedCO2, getTargetVol(), getPrimeSugar());
// Convert to selected Units
double neededPrime = Quantity.convertUnit(Quantity.G, getPrimeSugarU(), primeSugarGL);
neededPrime *= Quantity.convertUnit(Quantity.L, getVolUnits(), primeSugarGL);
neededPrime *= getFinalWortVol(getVolUnits());
primeSugar.setAmount(neededPrime);
}
public void calcKegPSI() {
if (!allowRecalcs) {
return;
}
kegPSI = BrewCalcs.KegPSI(servTemp, getTargetVol());
}
public void setPrimeSugarName(final String n) {
isDirty = true;
this.primeSugar.setName(n);
}
public void setPrimeSugarYield(final double yield) {
isDirty = true;
this.primeSugar.setYield(yield);
}
public void setPrimeSugarAmount(final double q) {
isDirty = true;
this.primeSugar.setAmount(q);
}
public double getServTemp() {
return servTemp;
}
public void setServTemp(final double servTemp) {
isDirty = true;
this.servTemp = servTemp;
calcKegPSI();
}
public double getTargetVol() {
return targetVol;
}
public void setTargetVol(final double targetVol) {
isDirty = true;
this.targetVol = targetVol;
calcPrimeSugar();
calcKegPSI();
}
public PrimeSugar getPrimeSugar() {
return primeSugar;
}
public void setPrimeSugar(final PrimeSugar primeSugar) {
this.primeSugar = primeSugar;
calcPrimeSugar();
}
public WaterProfile getSourceWater() {
return sourceWater;
}
public WaterProfile getTargetWater() {
return targetWater;
}
public void setSourceWater(final WaterProfile sourceWater) {
this.sourceWater = sourceWater;
}
public void setTargetWater(final WaterProfile targetWater) {
this.targetWater = targetWater;
}
public WaterProfile getWaterDifference() {
final WaterProfile diff = new WaterProfile();
diff.setCa(getTargetWater().getCa() - getSourceWater().getCa());
diff.setCl(getTargetWater().getCl() - getSourceWater().getCl());
diff.setMg(getTargetWater().getMg() - getSourceWater().getMg());
diff.setNa(getTargetWater().getNa() - getSourceWater().getNa());
diff.setSo4(getTargetWater().getSo4() - getSourceWater().getSo4());
diff.setHco3(getTargetWater().getHco3() - getSourceWater().getHco3());
diff.setHardness(getTargetWater().getHardness() - getSourceWater().getHardness());
diff.setAlkalinity(getTargetWater().getAlkalinity() - getSourceWater().getAlkalinity());
diff.setTds(getTargetWater().getTds() - getSourceWater().getTds());
diff.setPh(getTargetWater().getPh() - getSourceWater().getPh());
return diff;
}
public void addSalt(final Salt s) {
// Check if ths salt already exists!
final Salt temp = getSaltByName(s.getName());
if (temp != null) {
this.delSalt(temp);
}
this.brewingSalts.add(s);
}
public void delSalt(final Salt s) {
this.brewingSalts.remove(s);
}
public void delSalt(final int i) {
if(!brewingSalts.isEmpty() && (i > -1) && (i < brewingSalts.size()))
this.brewingSalts.remove(i);
}
public void setSalts(final ArrayList<Salt> s) {
this.brewingSalts = s;
}
public List<Salt> getSalts() {
return this.brewingSalts;
}
public Salt getSalt(final int i) {
return this.brewingSalts.get(i);
}
public Salt getSaltByName(final String name) {
for (final Salt s : brewingSalts) {
if (s.getName().equals(name)) {
return s;
}
}
return null;
}
public Acid getAcid() {
return acid;
}
public void setAcid(final Acid acid) {
this.acid = acid;
}
public double getAcidAmount() {
final double millEs = BrewCalcs.acidMillequivelantsPerLiter(getSourceWater().getPh(), getSourceWater()
.getAlkalinity(), getTargetWater().getPh());
final double moles = BrewCalcs.molesByAcid(getAcid(), millEs, getTargetWater().getPh());
final double acidPerL = BrewCalcs.acidAmountPerL(getAcid(), moles);
return Quantity.convertUnit(Quantity.GAL, Quantity.L, acidPerL);
}
public double getAcidAmount5_2() {
final double millEs = BrewCalcs.acidMillequivelantsPerLiter(getSourceWater().getPh(), getSourceWater()
.getAlkalinity(), 5.2);
final double moles = BrewCalcs.molesByAcid(getAcid(), millEs, 5.2);
final double acidPerL = BrewCalcs.acidAmountPerL(getAcid(), moles);
return Quantity.convertUnit(Quantity.GAL, Quantity.L, acidPerL);
}
/**
* Implement a local comparator.
*/
Comparator<Fermentable> fermCompare = new Comparator<Fermentable>() {
public int compare(Fermentable h1, Fermentable h2){
if (h1.getAmountAs(Quantity.LB) > h2.getAmountAs(Quantity.LB))
return 1;
if (h1.getAmountAs(Quantity.LB) < h2.getAmountAs(Quantity.LB))
return -1;
if (h1.getAmountAs(Quantity.LB) == h2.getAmountAs(Quantity.LB))
return 0;
return 0;
}
};
public List<Yeast> getYeasts() {
return yeasts;
}
/**
* Identify the type of this recipe.
* @return ALL GRAIN, PARTIAL MASH, or EXTRACT or UNKNOWN.
*/
public final String getType() {
int mashedCount = 0;
for (Fermentable f : this.fermentables) {
if (f.getMashed())
{
mashedCount++;
}
}
if (mashedCount == this.fermentables.size()) {
return "ALL GRAIN";
} else if (mashedCount > 0) {
return "PARTIAL MASH";
} else if (mashedCount == 0) {
return "EXTRACT";
}
return "UNKNOWN";
}
public void setEquipmentProfile(Equipment equipmentProfile) {
this.equipmentProfile = equipmentProfile;
}
public Equipment getEquipmentProfile() {
return equipmentProfile;
}
public void setTasteNotes(String tasteNotes) {
this.tasteNotes = tasteNotes;
}
public String getTasteNotes() {
return tasteNotes;
}
public void setTasteRating(double tasteRating) {
this.tasteRating = tasteRating;
}
public double getTasteRating() {
return tasteRating;
}
public void setMeasuredOg(double measuredOg) {
this.measuredOg = measuredOg;
}
public double getMeasuredOg() {
return measuredOg;
}
public void setMeasuredFg(double measuredFg) {
this.measuredFg = measuredFg;
}
public double getMeasuredFg() {
return measuredFg;
}
public void setDateBrewed(String dateBrewed) {
this.dateBrewed = dateBrewed;
}
public String getDateBrewed() {
return dateBrewed;
}
public void setPrimeSugarEquiv(double primeSugarEquiv) {
this.primeSugarEquiv = primeSugarEquiv;
}
public double getPrimeSugarEquiv() {
return primeSugarEquiv;
}
public void setKegPrimingFactor(double kegPrimingFactor) {
this.kegPrimingFactor = kegPrimingFactor;
}
public double getKegPrimingFactor() {
return kegPrimingFactor;
}
public double getMeasuredAlcohol() {
return BrewCalcs.calcAlcohol(getAlcMethod(), measuredOg, measuredFg);
}
public double getMeasuredEfficiency() {
double possiblePoints = 0;
for (final Fermentable m : fermentables) {
possiblePoints += (m.getPppg() - 1) * m.getAmountAs(Quantity.LB) / getPostBoilVol(Quantity.GAL);
}
return (measuredOg - 1) / possiblePoints * 100;
}
public String calcCalories() {
double alcCal = 1881.22 * measuredFg * (measuredOg - measuredFg) / (1.775 - measuredOg);
double carbCal = 3550.0 * measuredFg * ((0.1808 * measuredOg) + (0.8192 * measuredFg) - 1.0004);
double totalCal = alcCal + carbCal;
return Double.toString(totalCal) + "Cal/12oz";
}
public void setGravUnit(String newUnit) {
gravUnits = newUnit;
}
public String getGravUnits() {
return gravUnits;
}
public void setPostBoil(String display_batch_size) {
if (display_batch_size == null || display_batch_size.equals("")) {
return;
}
this.postBoilVol = new Quantity(display_batch_size);
}
public void setPreBoil(String preBoilString) {
if (preBoilString == null || preBoilString.equals("")) {
return;
}
Quantity p = new Quantity(preBoilString);
// The one-true-volume is postBoil.. so calc it, and set it
if (this.equipmentProfile != null && this.equipmentProfile.isCalcBoilVol()) {
Quantity post = new Quantity(getVolUnits(), p.getValueAs(getVolUnits()) - getEvapVol(getVolUnits())
- getChillShrinkVol(getVolUnits()));
setPostBoil(post);
} else {
this.preBoilVol = p;
}
}
public void setCarbMethod(String carbMethod) {
this.carbMethod = carbMethod;
}
public String getCarbMethod() {
return carbMethod;
}
public void setMash(Mash mash) {
this.mash = mash;
}
public void setMashProfile(Temp tempProbe) {
TriggerControl triggerControl = tempProbe.getTriggerControl();
if (triggerControl.getTriggersSize() > 0) {
triggerControl.clear();
}
for (int i = 0; i < mash.getStepSize(); i++) {
TemperatureTrigger temperatureTrigger = new TemperatureTrigger(i * 2, tempProbe.getName(),
mash.getStepStartTemp(i), mash.getStepType(i), mash.getStepMethod(i));
temperatureTrigger.setExitTemp(mash.getStepEndTemp(i));
triggerControl.addTrigger(temperatureTrigger);
WaitTrigger waitTrigger = new WaitTrigger((i*2)+1, mash.getStepMin(i), 0);
waitTrigger.setNote(String.format(Messages.HOLD_STEP, String.format("%.2f", mash.getStepEndTemp(i)) + mash.getStepTempU(i)));
triggerControl.addTrigger(waitTrigger);
}
}
public void setBoilHops(Temp tempProbe) {
// Base this from the time different between steps. When they press activate the first step goes immediately (just annotate)
TriggerControl triggerControl = tempProbe.getTriggerControl();
if (triggerControl.getTriggersSize() > 0) {
triggerControl.clear();
}
int j = 0;
Hop prevHop = null;
for (Hop h : hops) {
// Skip to the next hop if it's not a boil hop
if (!h.getAdd().equals(Hop.BOIL)) {
continue;
}
double mins;
if (prevHop != null) {
mins = prevHop.getMinutes() - h.getMinutes();
} else {
mins = boilMinutes - h.getMinutes();
}
WaitTrigger waitTrigger = new WaitTrigger(j, mins, 0);
waitTrigger.setNote(String.format(Messages.ADD_HOP, h.getAmount().toString(), h.getName()));
triggerControl.addTrigger(waitTrigger);
j++;
prevHop = h;
}
}
public void setFermProfile(Temp tempProbe) {
TriggerControl triggerControl = tempProbe.getTriggerControl();
if (triggerControl.getTriggersSize() > 0) {
triggerControl.clear();
}
int i = 0;
for (FermentStep fermentStep: fermentationSteps) {
TemperatureTrigger temperatureTrigger = new TemperatureTrigger(i * 2, tempProbe.getName(),
fermentStep.getTemp(), fermentStep.getType(), "");
triggerControl.addTrigger(temperatureTrigger);
i++;
WaitTrigger waitTrigger = new WaitTrigger(i, fermentStep.getTimeMins(), 0);
waitTrigger.setNote(String.format(Messages.HOLD_STEP, String.format("%.2f", fermentStep.getTemp()) + fermentStep.getTempU()));
triggerControl.addTrigger(waitTrigger);
i++;
}
}
public void setDryHops(Temp tempProbe) {
// Base this from the time different between steps. When they press activate the first step goes immediately (just annotate)
TriggerControl triggerControl = tempProbe.getTriggerControl();
if (triggerControl.getTriggersSize() > 0) {
triggerControl.clear();
}
int j = 0;
Hop prevHop = null;
for (Hop h : hops) {
// Skip to the next hop if it's not a boil hop
if (!h.getAdd().equals(Hop.DRY)) {
continue;
}
double mins;
if (prevHop != null) {
mins = prevHop.getMinutes() - h.getMinutes();
} else {
mins = h.getMinutes();
}
WaitTrigger waitTrigger = new WaitTrigger(j, mins, 0);
waitTrigger.setNote(String.format(Messages.ADD_HOP, h.getAmount().toString(), h.getName()));
triggerControl.addTrigger(waitTrigger);
j++;
prevHop = h;
}
}
} | DougEdey/SB_Elsinore_Server | src/main/java/ca/strangebrew/recipe/Recipe.java |
213,083 | package org.mitre.synthea.modules;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.mitre.synthea.engine.Module;
import org.mitre.synthea.helpers.Attributes;
import org.mitre.synthea.helpers.Attributes.Inventory;
import org.mitre.synthea.helpers.Config;
import org.mitre.synthea.helpers.PhysiologyValueGenerator;
import org.mitre.synthea.helpers.RandomCollection;
import org.mitre.synthea.helpers.SimpleCSV;
import org.mitre.synthea.helpers.TrendingValueGenerator;
import org.mitre.synthea.helpers.Utilities;
import org.mitre.synthea.modules.BloodPressureValueGenerator.SysDias;
import org.mitre.synthea.world.agents.Person;
import org.mitre.synthea.world.agents.behaviors.planeligibility.QualifyingConditionCodesEligibility;
import org.mitre.synthea.world.concepts.BMI;
import org.mitre.synthea.world.concepts.BiometricsConfig;
import org.mitre.synthea.world.concepts.BirthStatistics;
import org.mitre.synthea.world.concepts.Employment;
import org.mitre.synthea.world.concepts.GrowthChart;
import org.mitre.synthea.world.concepts.GrowthChartEntry;
import org.mitre.synthea.world.concepts.HealthRecord.Code;
import org.mitre.synthea.world.concepts.HealthRecord.Encounter;
import org.mitre.synthea.world.concepts.HealthRecord.EncounterType;
import org.mitre.synthea.world.concepts.HealthRecord.Procedure;
import org.mitre.synthea.world.concepts.Names;
import org.mitre.synthea.world.concepts.PediatricGrowthTrajectory;
import org.mitre.synthea.world.concepts.VitalSign;
import org.mitre.synthea.world.geography.Location;
public final class LifecycleModule extends Module {
private static final Map<GrowthChart.ChartType, GrowthChart> growthChart =
GrowthChart.loadCharts();
private static final List<LinkedHashMap<String, String>> weightForLengthChart =
loadWeightForLengthChart();
private static final QualifyingConditionCodesEligibility disabilityCriteria =
loadDisabilityData();
private static final String AGE = "AGE";
private static final String AGE_MONTHS = "AGE_MONTHS";
public static final String DAYS_UNTIL_DEATH = "days_until_death";
public static final String QUIT_SMOKING_PROBABILITY = "quit smoking probability";
public static final String QUIT_SMOKING_AGE = "quit smoking age";
public static final String QUIT_ALCOHOLISM_PROBABILITY = "quit alcoholism probability";
public static final String QUIT_ALCOHOLISM_AGE = "quit alcoholism age";
public static final String ADHERENCE_PROBABILITY = "adherence probability";
private static final String COUNTRY_CODE = Config.get("generate.geography.country_code");
private static final Double MIDDLE_NAME_PROBABILITY =
Config.getAsDouble("generate.middle_names", 0.80);
private static RandomCollection<String> sexualOrientationData = loadSexualOrientationData();
public LifecycleModule() {
this.name = "Lifecycle";
}
private static List<LinkedHashMap<String, String>> loadWeightForLengthChart() {
String filename = "cdc_wtleninf.csv";
try {
String data = Utilities.readResource(filename);
return SimpleCSV.parse(data);
} catch (Exception e) {
System.err.println("ERROR: unable to load csv: " + filename);
e.printStackTrace();
throw new ExceptionInInitializerError(e);
}
}
private static RandomCollection<String> loadSexualOrientationData() {
RandomCollection<String> soDistribution = new RandomCollection<String>();
double[] soPercentages = BiometricsConfig.doubles("lifecycle.sexual_orientation");
// [heterosexual, homosexual, bisexual]
soDistribution.add(soPercentages[0], "heterosexual");
soDistribution.add(soPercentages[1], "homosexual");
soDistribution.add(soPercentages[2], "bisexual");
return soDistribution;
}
private static QualifyingConditionCodesEligibility loadDisabilityData() {
QualifyingConditionCodesEligibility criteria = null;
String filename = "payers/eligibility_input_files/ssd_eligibility.csv";
try {
criteria = new QualifyingConditionCodesEligibility(filename);
} catch (Exception e) {
System.err.println("ERROR: unable to load disability csv: " + filename);
e.printStackTrace();
}
return criteria;
}
public Module clone() {
return this;
}
@Override
public boolean process(Person person, long time) {
if (!person.alive(time)) {
return true;
}
// run through all of the rules defined
// ruby "rules" are converted to static functions here
// since this is intended to only be temporary
// birth(person, time); intentionally left out - call it only once from Generator
if (age(person, time)) {
grow(person, time);
}
startSmoking(person, time);
startAlcoholism(person, time);
quitSmoking(person, time);
quitAlcoholism(person, time);
adherence(person, time);
calculateVitalSigns(person, time);
calculateFallRisk(person, time);
person.attributes.put(Person.DISABLED, isDisabled(person, time));
if (person.ageInYears(time) >= 18) {
((Employment) person.attributes.get(Person.EMPLOYMENT_MODEL)).checkEmployment(person, time);
}
death(person, time);
// java modules will never "finish"
return false;
}
/**
* For unto us a child is born.
* @param person The baby.
* @param time The time of birth.
*/
public static void birth(Person person, long time) {
Map<String, Object> attributes = person.attributes;
attributes.put(Person.ID, person.randUUID().toString());
String language = (String) attributes.get(Person.FIRST_LANGUAGE);
String gender = (String) attributes.get(Person.GENDER);
if (attributes.get(Person.ENTITY) == null) {
attributes.put(Person.BIRTHDATE, time);
String firstName = Names.fakeFirstName(gender, language, person);
String lastName = Names.fakeLastName(language, person);
attributes.put(Person.FIRST_NAME, firstName);
String middleName = null;
if (person.rand() <= MIDDLE_NAME_PROBABILITY) {
middleName = Names.fakeFirstName(gender, language, person);
attributes.put(Person.MIDDLE_NAME, middleName);
}
attributes.put(Person.LAST_NAME, lastName);
attributes.put(Person.NAME, firstName + " " + lastName);
String phoneNumber = "555-" + ((person.randInt(999 - 100 + 1) + 100)) + "-"
+ ((person.randInt(9999 - 1000 + 1) + 1000));
attributes.put(Person.TELECOM, phoneNumber);
boolean hasStreetAddress2 = person.rand() < 0.5;
attributes.put(Person.ADDRESS, Names.fakeAddress(hasStreetAddress2, person));
}
String motherFirstName = Names.fakeFirstName("F", language, person);
String motherLastName = Names.fakeLastName(language, person);
attributes.put(Person.NAME_MOTHER, motherFirstName + " " + motherLastName);
String fatherFirstName = Names.fakeFirstName("M", language, person);
// this is anglocentric where the baby gets the father's last name
attributes.put(Person.NAME_FATHER, fatherFirstName + " " + attributes.get(Person.LAST_NAME));
double prevalenceOfTwins =
(double) BiometricsConfig.get("lifecycle.prevalence_of_twins", 0.02);
if ((person.rand() < prevalenceOfTwins)) {
attributes.put(Person.MULTIPLE_BIRTH_STATUS, person.randInt(3) + 1);
}
String ssn = "999-" + ((person.randInt(99 - 10 + 1) + 10)) + "-"
+ ((person.randInt(9999 - 1000 + 1) + 1000));
attributes.put(Person.IDENTIFIER_SSN, ssn);
String city = (String) attributes.get(Person.CITY);
Location location = (Location) attributes.get(Person.LOCATION);
if (location != null) {
// A null location should never happen in practice, but can happen in unit tests
location.assignPoint(person, city);
String zipCode = location.getZipCode(city, person);
person.attributes.put(Person.ZIP, zipCode);
person.attributes.put(Person.FIPS, Location.getFipsCodeByZipCode(zipCode));
String[] birthPlace;
if ("english".equalsIgnoreCase((String) attributes.get(Person.FIRST_LANGUAGE))) {
birthPlace = location.randomBirthPlace(person);
} else {
birthPlace = location.randomBirthplaceByLanguage(
person, (String) person.attributes.get(Person.FIRST_LANGUAGE));
}
attributes.put(Person.BIRTH_CITY, birthPlace[0]);
attributes.put(Person.BIRTH_STATE, birthPlace[1]);
attributes.put(Person.BIRTH_COUNTRY, birthPlace[2]);
// For CSV exports so we don't break any existing schemas
attributes.put(Person.BIRTHPLACE, birthPlace[3]);
}
attributes.put(Person.ACTIVE_WEIGHT_MANAGEMENT, false);
// TODO: Why are the percentiles a vital sign? Sounds more like an attribute?
double heightPercentile = person.rand();
PediatricGrowthTrajectory pgt = new PediatricGrowthTrajectory(person.getSeed(), time);
double weightPercentile = pgt.reverseWeightPercentile(gender, heightPercentile);
// make the head percentile within 5% of the height percentile
double headPercentile = heightPercentile + person.rand(0.025, 0.025);
if (headPercentile < 0.01) {
headPercentile = 0.01;
} else if (headPercentile > 1) {
headPercentile = 1.0;
}
// Convert and store as percentage (0 to 100%) because it is recorded in an Observation.
headPercentile = (100.0 * headPercentile);
person.setVitalSign(VitalSign.HEIGHT_PERCENTILE, heightPercentile);
person.setVitalSign(VitalSign.WEIGHT_PERCENTILE, weightPercentile);
person.setVitalSign(VitalSign.HEAD_PERCENTILE, headPercentile);
person.attributes.put(Person.GROWTH_TRAJECTORY, pgt);
// Temporarily generate a mother
Person mother = new Person(person.randLong());
mother.attributes.put(Person.GENDER, "F");
mother.attributes.put("pregnant", true);
mother.attributes.put(Person.RACE, person.attributes.get(Person.RACE));
mother.attributes.put(Person.ETHNICITY, person.attributes.get(Person.ETHNICITY));
mother.attributes.put(BirthStatistics.BIRTH_SEX, person.attributes.get(Person.GENDER));
BirthStatistics.setBirthStatistics(mother, time);
person.setVitalSign(VitalSign.HEIGHT,
(double) mother.attributes.get(BirthStatistics.BIRTH_HEIGHT)); // cm
person.setVitalSign(VitalSign.WEIGHT,
(double) mother.attributes.get(BirthStatistics.BIRTH_WEIGHT)); // kg
person.setVitalSign(VitalSign.HEAD, childHeadCircumference(person, time)); // cm
attributes.put(AGE, 0);
attributes.put(AGE_MONTHS, 0);
boolean isRHNeg = person.rand() < 0.15;
attributes.put("RH_NEG", isRHNeg);
double adherenceBaseline = Config.getAsDouble("lifecycle.adherence.baseline", 0.05);
person.attributes.put(ADHERENCE_PROBABILITY, adherenceBaseline);
grow(person, time); // set initial height and weight from percentiles
calculateVitalSigns(person, time); // Set initial values for many vital signs.
String orientation = sexualOrientationData.next(person);
attributes.put(Person.SEXUAL_ORIENTATION, orientation);
// Setup vital signs which follow the generator approach
setupVitalSignGenerators(person);
}
/**
* Set up the generators for vital signs which use the generator-based approach already.
* @param person The person to generate vital signs for.
*/
private static void setupVitalSignGenerators(Person person) {
person.setVitalSign(VitalSign.SYSTOLIC_BLOOD_PRESSURE,
new BloodPressureValueGenerator(person, SysDias.SYSTOLIC));
person.setVitalSign(VitalSign.DIASTOLIC_BLOOD_PRESSURE,
new BloodPressureValueGenerator(person, SysDias.DIASTOLIC));
if (ENABLE_PHYSIOLOGY_GENERATORS) {
List<PhysiologyValueGenerator> physioGenerators = PhysiologyValueGenerator.loadAll(person);
for (PhysiologyValueGenerator physioGenerator : physioGenerators) {
person.setVitalSign(physioGenerator.getVitalSign(), physioGenerator);
}
}
}
/**
* Age the patient.
*
* @return whether or not the patient should grow
*/
private static boolean age(Person person, long time) {
int prevAge = (int) person.attributes.get(AGE);
int prevAgeMos = (int) person.attributes.get(AGE_MONTHS);
int newAge = person.ageInYears(time);
int newAgeMos = person.ageInMonths(time);
person.attributes.put(AGE, newAge);
person.attributes.put(AGE_MONTHS, newAgeMos);
switch (newAge) {
case 16:
// driver's license
if (person.attributes.get(Person.IDENTIFIER_DRIVERS) == null) {
String identifierDrivers = "S999" + ((person.randInt(99999 - 10000 + 1) + 10000));
person.attributes.put(Person.IDENTIFIER_DRIVERS, identifierDrivers);
}
break;
case 18:
// name prefix
if (person.attributes.get(Person.NAME_PREFIX) == null) {
String namePrefix;
if ("M".equals(person.attributes.get(Person.GENDER))) {
namePrefix = "Mr.";
} else {
namePrefix = "Ms.";
}
person.attributes.put(Person.NAME_PREFIX, namePrefix);
}
break;
case 20:
// passport number
if (person.attributes.get(Person.IDENTIFIER_PASSPORT) == null) {
Boolean getsPassport = (person.rand() < 0.5);
if (getsPassport) {
String identifierPassport = "X" + (person.randInt(99999999 - 10000000 + 1) + "X");
person.attributes.put(Person.IDENTIFIER_PASSPORT, identifierPassport);
}
}
if (person.attributes.get("veteran") != null) {
if (person.attributes.get("veteran_provider_reset") == null) {
// reset providers for veterans, they'll switch to VA facilities
person.attributes.remove(Person.CURRENTPROVIDER);
for (EncounterType type : EncounterType.values()) {
person.attributes.remove(Person.PREFERREDYPROVIDER + type);
}
person.attributes.put("veteran_provider_reset", true);
}
}
break;
case 28:
// get married
if (person.attributes.get(Person.MARITAL_STATUS) == null) {
Boolean getsMarried = (person.rand() < 0.8);
if (getsMarried) {
person.attributes.put(Person.MARITAL_STATUS, "M");
if ("F".equals(person.attributes.get(Person.GENDER))) {
person.attributes.put(Person.NAME_PREFIX, "Mrs.");
person.attributes.put(Person.MAIDEN_NAME, person.attributes.get(Person.LAST_NAME));
String firstName = ((String) person.attributes.get(Person.FIRST_NAME));
String middleName = null;
if (person.attributes.containsKey(Person.MIDDLE_NAME)) {
middleName = (String) person.attributes.get(Person.MIDDLE_NAME);
}
String language = (String) person.attributes.get(Person.FIRST_LANGUAGE);
String newLastName = Names.fakeLastName(language, person);
person.attributes.put(Person.LAST_NAME, newLastName);
if (middleName != null) {
person.attributes.put(Person.NAME,
firstName + " " + middleName + " " + newLastName);
} else {
person.attributes.put(Person.NAME, firstName + " " + newLastName);
}
}
} else {
person.attributes.put(Person.MARITAL_STATUS, "S");
}
}
break;
case 30:
// "overeducated" -> suffix
if ((person.attributes.get(Person.NAME_SUFFIX) == null)
&& ((double) person.attributes.get(Person.EDUCATION_LEVEL) >= 0.95)) {
List<String> suffixList = Arrays.asList("PhD", "JD", "MD");
person.attributes.put(Person.NAME_SUFFIX,
suffixList.get(person.randInt(suffixList.size())));
}
break;
case 35:
if (person.attributes.get(Person.MARITAL_STATUS + "Decade3") == null) {
// divorce and widowing...
// gross approximations for next 10 years based on:
// https://www.census.gov/content/dam/Census/library/publications/2021/demo/p70-167.pdf
if (person.attributes.get(Person.MARITAL_STATUS).equals("M")) {
double check = person.rand();
if (check < 0.02) {
// widow
person.attributes.put(Person.MARITAL_STATUS, "W");
} else if (check < 0.20) {
// divorce
person.attributes.put(Person.MARITAL_STATUS, "D");
}
}
person.attributes.put(Person.MARITAL_STATUS + "Decade3", true);
}
break;
case 45:
if (person.attributes.get(Person.MARITAL_STATUS + "Decade4") == null) {
// divorce and widowing...
// gross approximations for next 10 years based on:
// https://www.census.gov/content/dam/Census/library/publications/2021/demo/p70-167.pdf
if (person.attributes.get(Person.MARITAL_STATUS).equals("M")) {
double check = person.rand();
if (check < 0.03) {
// widow
person.attributes.put(Person.MARITAL_STATUS, "W");
} else if (check < 0.05) {
// divorce
person.attributes.put(Person.MARITAL_STATUS, "D");
}
}
person.attributes.put(Person.MARITAL_STATUS + "Decade4", true);
}
break;
case 55:
if (person.attributes.get(Person.MARITAL_STATUS + "Decade5") == null) {
// divorce and widowing...
// gross approximations for next 10 years based on:
// https://www.census.gov/content/dam/Census/library/publications/2021/demo/p70-167.pdf
if (person.attributes.get(Person.MARITAL_STATUS).equals("M")) {
double check = person.rand();
if (check < 0.06) {
// widow
person.attributes.put(Person.MARITAL_STATUS, "W");
} else if (check < 0.11) {
// divorce
person.attributes.put(Person.MARITAL_STATUS, "D");
}
}
person.attributes.put(Person.MARITAL_STATUS + "Decade5", true);
}
break;
default:
break;
}
boolean shouldGrow;
if (newAge >= 20) {
// adults 20 and over grow once per year
shouldGrow = (newAge > prevAge);
} else {
// people under 20 grow once per month
shouldGrow = (newAgeMos > prevAgeMos);
}
return shouldGrow;
}
private static final int ADULT_MAX_WEIGHT_AGE =
(int) BiometricsConfig.get("lifecycle.adult_max_weight_age", 49);
private static final int GERIATRIC_WEIGHT_LOSS_AGE =
(int) BiometricsConfig.get("lifecycle.geriatric_weight_loss_age", 60);
private static final double[] ADULT_WEIGHT_GAIN_RANGE =
BiometricsConfig.doubles("lifecycle.adult_weight_gain");
private static final double[] GERIATRIC_WEIGHT_LOSS_RANGE =
BiometricsConfig.doubles("lifecycle.geriatric_weight_loss");
private static void grow(Person person, long time) {
int age = person.ageInYears(time);
int ageInMonths = 0; // we only need this if they are less than 20 years old.
double height = person.getVitalSign(VitalSign.HEIGHT, time);
if (age < 20) {
height = childHeightGrowth(person, time);
ageInMonths = person.ageInMonths(time);
}
double weight = adjustWeight(person, time);
person.setVitalSign(VitalSign.HEIGHT, height);
person.setVitalSign(VitalSign.WEIGHT, weight);
double bmi = BMI.calculate(height, weight);
person.setVitalSign(VitalSign.BMI, bmi);
if (age <= 3) {
setCurrentWeightForLengthPercentile(person, time);
if (ageInMonths <= 36) {
double headCircumference = childHeadCircumference(person, time);
person.setVitalSign(VitalSign.HEAD, headCircumference);
}
}
if (age >= 2 && age < 20) {
String gender = (String) person.attributes.get(Person.GENDER);
double percentile = percentileForBMI(bmi, gender, ageInMonths);
person.attributes.put(Person.BMI_PERCENTILE, percentile * 100.0);
}
}
private static double childHeightGrowth(Person person, long time) {
String gender = (String) person.attributes.get(Person.GENDER);
int ageInMonths = person.ageInMonths(time);
return lookupGrowthChart("height", gender, ageInMonths,
person.getVitalSign(VitalSign.HEIGHT_PERCENTILE, time));
}
private static double childHeadCircumference(Person person, long time) {
String gender = (String) person.attributes.get(Person.GENDER);
int ageInMonths = person.ageInMonths(time);
return lookupGrowthChart("head", gender, ageInMonths,
(person.getVitalSign(VitalSign.HEAD_PERCENTILE, time) / 100.0));
}
private static double adjustWeight(Person person, long time) {
double weight = person.getVitalSign(VitalSign.WEIGHT, time);
String gender = (String) person.attributes.get(Person.GENDER);
double heightPercentile = person.getVitalSign(VitalSign.HEIGHT_PERCENTILE, time);
PediatricGrowthTrajectory pgt =
(PediatricGrowthTrajectory) person.attributes.get(Person.GROWTH_TRAJECTORY);
int age = person.ageInYears(time);
int ageInMonths = person.ageInMonths(time);
if (age < 3 && pgt.beforeInitialSample(time)) {
// follow growth charts
weight = lookupGrowthChart("weight", gender, ageInMonths,
person.getVitalSign(VitalSign.WEIGHT_PERCENTILE, time));
} else if (age < 20) {
double currentBMI = pgt.currentBMI(person, time);
double height = growthChart.get(GrowthChart.ChartType.HEIGHT).lookUp(ageInMonths,
gender, heightPercentile);
weight = BMI.weightForHeightAndBMI(height, currentBMI);
} else {
Object weightManagement = person.attributes.get(Person.ACTIVE_WEIGHT_MANAGEMENT);
// If there is active weight management,
// changing of weight will be handled by the WeightLossModule
if (weightManagement != null && ! (boolean) weightManagement) {
if (age <= ADULT_MAX_WEIGHT_AGE) {
// getting older and fatter
double adultWeightGain = person.rand(ADULT_WEIGHT_GAIN_RANGE);
weight += adultWeightGain;
} else if (age >= GERIATRIC_WEIGHT_LOSS_AGE) {
// getting older and wasting away
double geriatricWeightLoss = person.rand(GERIATRIC_WEIGHT_LOSS_RANGE);
weight -= geriatricWeightLoss;
}
}
// If the person needs to gain weight that's been triggered by a module:
Object kgToGain = person.attributes.get(Person.KILOGRAMS_TO_GAIN);
if (kgToGain != null && ((double) kgToGain) > 0.0) {
// We'll reuse the same adult weight gain used for standard adult weight gain.
// This will result in about double weight gained per year until target kilograms to gain
// has been reached.
double adultWeightGain = person.rand(ADULT_WEIGHT_GAIN_RANGE);
weight += adultWeightGain;
// Update the weight they have yet to gain.
double remainingKgToGain = ((double) kgToGain) - adultWeightGain;
person.attributes.put(Person.KILOGRAMS_TO_GAIN, remainingKgToGain);
}
}
return weight;
}
/**
* Lookup and calculate values from the CDC growth charts, using the LMS
* values to calculate the intermediate values.
* Reference : https://www.cdc.gov/growthcharts/percentile_data_files.htm
*
* <p>Note: BMI values only available for ageInMonths 24 - 240 as BMI is
* not typically useful in patients under 24 months.</p>
*
* @param chartType "height" | "weight" | "bmi" | "head"
* @param gender "M" | "F"
* @param ageInMonths 0 - 240
* @param percentile 0.0 - 1.0
* @return The height (cm), weight (kg), bmi (%), or head (cm)
*/
public static double lookupGrowthChart(String chartType, String gender, int ageInMonths,
double percentile) {
switch (chartType) {
case "height":
return growthChart.get(GrowthChart.ChartType.HEIGHT).lookUp(ageInMonths,
gender, percentile);
case "weight":
return growthChart.get(GrowthChart.ChartType.WEIGHT).lookUp(ageInMonths,
gender, percentile);
case "bmi":
return growthChart.get(GrowthChart.ChartType.BMI).lookUp(ageInMonths, gender, percentile);
case "head":
return growthChart.get(GrowthChart.ChartType.HEAD).lookUp(ageInMonths, gender, percentile);
default:
throw new IllegalArgumentException("Unknown chart type: " + chartType);
}
}
/**
* Look up the percentile that a given BMI falls into based on gender and age in months.
* @param bmi the BMI to find the percentile for
* @param gender "M" | "F"
* @param ageInMonths 24 - 240
* @return 0 - 1.0
*/
public static double percentileForBMI(double bmi, String gender, int ageInMonths) {
return growthChart.get(GrowthChart.ChartType.BMI).percentileFor(ageInMonths, gender, bmi);
}
/**
* If the person is 36 months old or less, then the "weight for length"
* percentile attribute is set. Otherwise, it is removed.
*
* @param person The person.
* @param time The time during the simulation.
*/
public static void setCurrentWeightForLengthPercentile(Person person, long time) {
if (person.ageInMonths(time) <= 36) {
double height = person.getVitalSign(VitalSign.HEIGHT, time);
double weight = person.getVitalSign(VitalSign.WEIGHT, time);
String gender = (String) person.attributes.get(Person.GENDER);
LinkedHashMap<String, String> entry = null;
for (LinkedHashMap<String, String> row : weightForLengthChart) {
if (row.get("Sex").equals(gender)
&& height < Double.parseDouble(row.get("Length"))) {
entry = row;
break;
}
}
if (entry == null) {
person.attributes.put(Person.CURRENT_WEIGHT_LENGTH_PERCENTILE, 99.0);
} else {
double l = Double.parseDouble(entry.get("L"));
double m = Double.parseDouble(entry.get("M"));
double s = Double.parseDouble(entry.get("S"));
double z = new GrowthChartEntry(l, m, s).zscoreForValue(weight);
double percentile = GrowthChart.zscoreToPercentile(z) * 100.0;
person.attributes.put(Person.CURRENT_WEIGHT_LENGTH_PERCENTILE, percentile);
}
}
}
/**
* Map of RxNorm drug codes to the expected impact to HbA1c.
* Impacts should be negative numbers.
*/
private static final Map<String, Double> DIABETES_DRUG_HBA1C_IMPACTS = createDrugImpactsMap();
/**
* Populate the entries of the drug -> impacts map.
* @return a map of drug code -> expected hba1c delta
*/
private static Map<String, Double> createDrugImpactsMap() {
// How much does A1C need to be lowered to get to goal?
// Metformin and sulfonylureas may lower A1C 1.5 to 2 percentage points,
// GLP-1 agonists and DPP-4 inhibitors 0.5 to 1 percentage point on average, and
// insulin as much as 6 points or more, depending on where you start.
// -- http://www.diabetesforecast.org/2013/mar/your-a1c-achieving-personal-blood-glucose-goals.html
// [:metformin, :glp1ra, :sglt2i, :basal_insulin, :prandial_insulin]
// mono bi tri insulin insulin++
Map<String,Double> impacts = new HashMap<>();
// key is the RxNorm code
impacts.put("860975", -1.5); // metformin
impacts.put("897122", -0.5); // liraglutide
impacts.put("1373463", -0.5); // canagliflozin
impacts.put("106892", -3.0); // basal insulin
impacts.put("865098", -6.0); // prandial insulin
return impacts;
}
private static final int[] CHOLESTEROL_RANGE =
BiometricsConfig.ints("metabolic.lipid_panel.cholesterol");
private static final int[] TRIGLYCERIDES_RANGE =
BiometricsConfig.ints("metabolic.lipid_panel.triglycerides");
private static final int[] HDL_RANGE =
BiometricsConfig.ints("metabolic.lipid_panel.hdl");
private static final int[] GLUCOSE_RANGE =
BiometricsConfig.ints("metabolic.basic_panel.glucose");
private static final int[] UREA_NITROGEN_RANGE =
BiometricsConfig.ints("metabolic.basic_panel.normal.urea_nitrogen");
private static final double[] CALCIUM_RANGE =
BiometricsConfig.doubles("metabolic.basic_panel.normal.calcium");
private static final int[] MILD_KIDNEY_DMG_CC_RANGE =
BiometricsConfig.ints("metabolic.basic_panel.creatinine_clearance.mild_kidney_damage");
private static final int[] MODERATE_KIDNEY_DMG_CC_RANGE =
BiometricsConfig.ints("metabolic.basic_panel.creatinine_clearance.moderate_kidney_damage");
private static final int[] SEVERE_KIDNEY_DMG_CC_RANGE =
BiometricsConfig.ints("metabolic.basic_panel.creatinine_clearance.severe_kidney_damage");
private static final int[] ESRD_CC_RANGE =
BiometricsConfig.ints("metabolic.basic_panel.creatinine_clearance.esrd");
private static final int[] NORMAL_FEMALE_CC_RANGE =
BiometricsConfig.ints("metabolic.basic_panel.creatinine_clearance.normal.female");
private static final int[] NORMAL_MALE_CC_RANGE =
BiometricsConfig.ints("metabolic.basic_panel.creatinine_clearance.normal.male");
private static final int[] NORMAL_MCR_RANGE =
BiometricsConfig.ints("metabolic.basic_panel.microalbumin_creatinine_ratio.normal");
private static final int[] CONTROLLED_MCR_RANGE =
BiometricsConfig
.ints("metabolic.basic_panel.microalbumin_creatinine_ratio.microalbuminuria_controlled");
private static final int[] UNCONTROLLED_MCR_RANGE =
BiometricsConfig
.ints("metabolic.basic_panel.microalbumin_creatinine_ratio.microalbuminuria_uncontrolled");
private static final int[] PROTEINURIA_MCR_RANGE =
BiometricsConfig
.ints("metabolic.basic_panel.microalbumin_creatinine_ratio.proteinuria");
private static final double[] CHLORIDE_RANGE =
BiometricsConfig.doubles("metabolic.basic_panel.normal.chloride");
private static final double[] POTASSIUM_RANGE =
BiometricsConfig.doubles("metabolic.basic_panel.normal.potassium");
private static final double[] CO2_RANGE =
BiometricsConfig.doubles("metabolic.basic_panel.normal.carbon_dioxide");
private static final double[] SODIUM_RANGE =
BiometricsConfig.doubles("metabolic.basic_panel.normal.sodium");
private static final int[] BLOOD_OXYGEN_SATURATION_NORMAL =
BiometricsConfig.ints("cardiovascular.oxygen_saturation.normal");
private static final int[] BLOOD_OXYGEN_SATURATION_HYPOXEMIA =
BiometricsConfig.ints("cardiovascular.oxygen_saturation.hypoxemia");
private static final double[] HEART_RATE_NORMAL =
BiometricsConfig.doubles("cardiovascular.heart_rate.normal");
private static final double[] RESPIRATION_RATE_NORMAL =
BiometricsConfig.doubles("respiratory.respiration_rate.normal");
/**
* Calculate this person's vital signs,
* based on their conditions, medications, body composition, etc.
* @param person The person
* @param time Current simulation timestamp
*/
private static void calculateVitalSigns(Person person, long time) {
int index = 0;
if (person.attributes.containsKey("diabetes_severity")) {
index = (Integer) person.attributes.getOrDefault("diabetes_severity", 1);
}
double totalCholesterol;
double triglycerides = person.rand(TRIGLYCERIDES_RANGE[index], TRIGLYCERIDES_RANGE[index + 1]);
double hdl;
if (index == 0) {
// for patients without diabetes
// source for the below: https://www.cdc.gov/nchs/data/databriefs/db363-h.pdf
// NCHS Data Brief - No. 363 - April 2020
// Total and High-density Lipoprotein Cholesterol in Adults: United States, 2015-2018
boolean lowHDL;
boolean highTotalChol;
if (person.attributes.containsKey("low_hdl")) {
// cache low or high status, so it's consistent
lowHDL = (boolean)person.attributes.get("low_hdl");
highTotalChol = (boolean)person.attributes.get("high_total_chol");
} else {
boolean female = "F".equals(person.attributes.get(Person.GENDER));
// gender is the largest factor, much more than age or race/ethnicity
// from the above source ("Key findings" section):
// "Over one-quarter of men (26.6%) and 8.5% of women
// had low high-density lipoprotein cholesterol (HDL-C)."
double chanceOfLowHDL = female ? .085 : .266;
lowHDL = person.rand() < chanceOfLowHDL;
person.attributes.put("low_hdl", lowHDL);
// from the above source:
// "During 2015-2018, 11.4% of adults had high total cholesterol,
// and prevalence was similar by race and Hispanic origin."
highTotalChol = person.rand() < .114;
person.attributes.put("high_total_chol", highTotalChol);
}
// normal distribution: sd * randGaussian() + mean
// these numbers do not come from any formal source
// but are intended to generate a normal rather than uniform distribution
if (lowHDL) {
// low HDL is defined as < 40
hdl = 3 * person.randGaussian() + 30;
} else {
hdl = 5 * person.randGaussian() + 55;
}
if (highTotalChol) {
// high is 240 or more
totalCholesterol = 20 * person.randGaussian() + 280;
} else {
totalCholesterol = 30 * person.randGaussian() + 170;
}
} else {
totalCholesterol = person.rand(CHOLESTEROL_RANGE[index], CHOLESTEROL_RANGE[index + 1]);
hdl = person.rand(HDL_RANGE[index], HDL_RANGE[index + 1]);
}
double ldl = totalCholesterol - hdl - (0.2 * triglycerides);
person.setVitalSign(VitalSign.TOTAL_CHOLESTEROL, totalCholesterol);
person.setVitalSign(VitalSign.TRIGLYCERIDES, triglycerides);
person.setVitalSign(VitalSign.HDL, hdl);
person.setVitalSign(VitalSign.LDL, ldl);
double bmi = person.getVitalSign(VitalSign.BMI, time);
boolean prediabetes = (boolean)person.attributes.getOrDefault("prediabetes", false);
boolean diabetes = (boolean)person.attributes.getOrDefault("diabetes", false);
double hbA1c = estimateHbA1c(bmi, prediabetes, diabetes, person);
if (prediabetes || diabetes) {
// drugs reduce hbA1c.
// only do this for people that have pre/diabetes,
// because these drugs are only prescribed if they do
for (Map.Entry<String, Double> e : DIABETES_DRUG_HBA1C_IMPACTS.entrySet()) {
String medicationCode = e.getKey();
double impact = e.getValue();
if (person.record.medicationActive(medicationCode)) {
// impacts are negative, so add them
hbA1c += impact;
}
}
}
person.setVitalSign(VitalSign.BLOOD_GLUCOSE, hbA1c);
int oxygenSaturation;
if (person.attributes.containsKey("chf")) {
oxygenSaturation = (int) person.rand(BLOOD_OXYGEN_SATURATION_HYPOXEMIA);
} else {
oxygenSaturation = (int) person.rand(BLOOD_OXYGEN_SATURATION_NORMAL);
}
person.setVitalSign(VitalSign.OXYGEN_SATURATION, oxygenSaturation);
// CKD == stage of "Chronic Kidney Disease" or the level of diabetic kidney damage
int kidneyDamage = (Integer) person.attributes.getOrDefault("ckd", 0);
int[] ccRange;
int[] mcrRange;
switch (kidneyDamage) {
case 1:
ccRange = MILD_KIDNEY_DMG_CC_RANGE;
mcrRange = NORMAL_MCR_RANGE;
break;
case 2:
ccRange = MODERATE_KIDNEY_DMG_CC_RANGE;
mcrRange = CONTROLLED_MCR_RANGE;
break;
case 3:
ccRange = SEVERE_KIDNEY_DMG_CC_RANGE;
mcrRange = UNCONTROLLED_MCR_RANGE;
break;
case 4:
ccRange = ESRD_CC_RANGE;
mcrRange = PROTEINURIA_MCR_RANGE;
break;
default:
if ("F".equals(person.attributes.get(Person.GENDER))) {
ccRange = NORMAL_FEMALE_CC_RANGE;
} else {
ccRange = NORMAL_MALE_CC_RANGE;
}
mcrRange = NORMAL_MCR_RANGE;
}
double creatinineClearance = person.rand(ccRange);
person.setVitalSign(VitalSign.EGFR, creatinineClearance);
double microalbuminCreatinineRatio = person.rand(mcrRange);
person.setVitalSign(VitalSign.MICROALBUMIN_CREATININE_RATIO, microalbuminCreatinineRatio);
double creatinine = reverseCalculateCreatinine(person, creatinineClearance, time);
person.setVitalSign(VitalSign.CREATININE, creatinine);
person.setVitalSign(VitalSign.UREA_NITROGEN, person.rand(UREA_NITROGEN_RANGE));
person.setVitalSign(VitalSign.CALCIUM, person.rand(CALCIUM_RANGE));
index = Math.min(index, 2); // note this continues from the index logic above
double glucose = person.rand(GLUCOSE_RANGE[index], GLUCOSE_RANGE[index + 1]);
person.setVitalSign(VitalSign.GLUCOSE, glucose);
person.setVitalSign(VitalSign.CHLORIDE, person.rand(CHLORIDE_RANGE));
person.setVitalSign(VitalSign.POTASSIUM, person.rand(POTASSIUM_RANGE));
person.setVitalSign(VitalSign.CARBON_DIOXIDE, person.rand(CO2_RANGE));
person.setVitalSign(VitalSign.SODIUM, person.rand(SODIUM_RANGE));
long timestep = Long.parseLong(Config.get("generate.timestep"));
double heartStart = person.rand(HEART_RATE_NORMAL);
double heartEnd = person.rand(HEART_RATE_NORMAL);
person.setVitalSign(VitalSign.HEART_RATE,
new TrendingValueGenerator(person, 1.0, heartStart, heartEnd,
time, time + timestep, HEART_RATE_NORMAL[0], HEART_RATE_NORMAL[1]));
double respirationStart = person.rand(RESPIRATION_RATE_NORMAL);
double respirationEnd = person.rand(RESPIRATION_RATE_NORMAL);
person.setVitalSign(VitalSign.RESPIRATION_RATE,
new TrendingValueGenerator(person, 1.0, respirationStart, respirationEnd,
time, time + timestep, RESPIRATION_RATE_NORMAL[0], RESPIRATION_RATE_NORMAL[1]));
}
/**
* Estimate the person's HbA1c using BMI and whether or not they have diabetes or prediabetes as a
* rough guideline.
*
* @param bmi
* The person's BMI.
* @param prediabetes
* Whether or not the person is prediabetic. (Diagnosed or undiagnosed)
* @param diabetes
* Whether or not the person is diabetic. (Diagnosed or undiagnosed)
* @param p
* The person
* @return A calculated HbA1c value.
*/
private static double estimateHbA1c(double bmi, boolean prediabetes, boolean diabetes, Person p) {
if (diabetes) {
if (bmi > 48.0) {
return 12.0;
} else if (bmi <= 27.0) {
return 6.6;
} else {
return bmi / 4.0;
// very simple BMI function so that BMI 40 --> blood glucose ~ 10,
// but with a bounded min at 6.6 and bounded max at 12.0
}
} else if (prediabetes) {
return p.rand(5.8, 6.4);
} else {
return p.rand(5.0, 5.7);
}
}
/**
* Calculate Creatinine from Creatinine Clearance.
* Source: http://www.mcw.edu/calculators/creatinine.htm
* @param person The person
* @param crcl Creatinine Clearance
* @param time Current Time
* @return Estimated Creatinine
*/
private static double reverseCalculateCreatinine(Person person, double crcl, long time) {
try {
int age = person.ageInYears(time);
boolean female = "F".equals(person.attributes.get(Person.GENDER));
double weight = person.getVitalSign(VitalSign.WEIGHT, time); // kg
crcl = Math.max(1, Math.min(crcl, 100)); // clamp between 1-100
double creatinine = ((140.0 - age) * weight) / (72.0 * crcl);
if (female) {
creatinine *= 0.85;
}
return creatinine;
} catch (Exception e) {
return 1.0;
}
}
protected static boolean ENABLE_DEATH_BY_NATURAL_CAUSES =
Config.getAsBoolean("lifecycle.death_by_natural_causes");
protected static boolean ENABLE_DEATH_BY_LOSS_OF_CARE =
Config.getAsBoolean("lifecycle.death_by_loss_of_care");
public static boolean ENABLE_PHYSIOLOGY_GENERATORS =
Config.getAsBoolean("physiology.generators.enabled", false);
// Death From Natural Causes SNOMED Code
private static final Code NATURAL_CAUSES = new Code("SNOMED-CT", "9855000",
"Natural death with unknown cause");
// Death From Lack of Treatment SNOMED Code (Due to a Payer not covering treatment)
// Note: This SNOMED Code (397709008) is just for death - not death from lack of treatment.
public static final Code LOSS_OF_CARE = new Code("SNOMED-CT", "397709008",
"Death due to Uncovered and Unreceived Treatment");
protected static void death(Person person, long time) {
if (ENABLE_DEATH_BY_NATURAL_CAUSES) {
double roll = person.rand();
double likelihoodOfDeath = likelihoodOfDeath(person.ageInYears(time));
if (roll < likelihoodOfDeath) {
person.recordDeath(time, NATURAL_CAUSES);
}
}
if (ENABLE_DEATH_BY_LOSS_OF_CARE && deathFromLossOfCare(person)) {
person.recordDeath(time, LOSS_OF_CARE);
}
if (person.attributes.containsKey(Person.DEATHDATE)) {
Long deathDate = (Long) person.attributes.get(Person.DEATHDATE);
long diff = deathDate - time;
long days = TimeUnit.MILLISECONDS.toDays(diff);
person.attributes.put(DAYS_UNTIL_DEATH, Long.valueOf(days));
}
}
protected static double likelihoodOfDeath(int age) {
double yearlyRisk;
if (age < 1) {
yearlyRisk = 508.1 / 100_000.0;
} else if (age >= 1 && age <= 4) {
yearlyRisk = 15.6 / 100_000.0;
} else if (age >= 5 && age <= 14) {
yearlyRisk = 10.6 / 100_000.0;
} else if (age >= 15 && age <= 24) {
yearlyRisk = 56.4 / 100_000.0;
} else if (age >= 25 && age <= 34) {
yearlyRisk = 74.7 / 100_000.0;
} else if (age >= 35 && age <= 44) {
yearlyRisk = 145.7 / 100_000.0;
} else if (age >= 45 && age <= 54) {
yearlyRisk = 326.5 / 100_000.0;
} else if (age >= 55 && age <= 64) {
yearlyRisk = 737.8 / 100_000.0;
} else if (age >= 65 && age <= 74) {
yearlyRisk = 1817.0 / 100_000.0;
} else if (age >= 75 && age <= 84) {
yearlyRisk = 4877.3 / 100_000.0;
} else if (age >= 85 && age <= 94) {
yearlyRisk = 13_499.4 / 100_000.0;
} else {
yearlyRisk = 50_000.0 / 100_000.0;
}
double oneYearInMs = TimeUnit.DAYS.toMillis(365);
double adjustedRisk = Utilities.convertRiskToTimestep(yearlyRisk, oneYearInMs);
return adjustedRisk;
}
/**
* Determines whether a person dies due to loss-of-care and lack of
* necessary treatment.
*
* @param person the person to check for loss of care death.
*/
public static boolean deathFromLossOfCare(Person person) {
// Search the person's lossOfCareHealthRecord for missed treatments.
// Based on missed treatments, increase likelihood of death.
if (person.lossOfCareEnabled) {
for (Encounter encounter : person.lossOfCareRecord.encounters) {
for (Procedure procedure : encounter.procedures) {
for (Code code : procedure.codes) {
/*
* TODO USE A LOOKUP TABLE FOR DEATH PROBABILITIES FOR LACK OF TREATMENTS HERE
*/
if (code.code.equals("33195004")) {
return person.rand() < 0.6;
}
}
}
}
}
return false;
}
private static void startSmoking(Person person, long time) {
// 9/10 smokers start before age 18. We will use 16.
// http://www.cdc.gov/tobacco/data_statistics/fact_sheets/youth_data/tobacco_use/
if (person.attributes.get(Person.SMOKER) == null && person.ageInYears(time) == 16) {
int year = Utilities.getYear(time);
Boolean smoker = person.rand() < likelihoodOfBeingASmoker(year);
person.attributes.put(Person.SMOKER, smoker);
double quitSmokingBaseline = Config.getAsDouble("lifecycle.quit_smoking.baseline", 0.01);
person.attributes.put(LifecycleModule.QUIT_SMOKING_PROBABILITY, quitSmokingBaseline);
}
}
private static double likelihoodOfBeingASmoker(int year) {
// 16.1% of MA are smokers in 2016.
// http://www.cdc.gov/tobacco/data_statistics/state_data/state_highlights/2010/states/massachusetts/
// but the rate is decreasing over time
// http://www.cdc.gov/tobacco/data_statistics/tables/trends/cig_smoking/
// selected #s:
// 1965 - 42.4%
// 1975 - 37.1%
// 1985 - 30.1%
// 1995 - 24.7%
// 2005 - 20.9%
// 2015 - 16.1%
// assume that it was never significantly higher than 42% pre-1960s, but will continue to drop
// slowly after 2016
// it's decreasing about .5% per year
if (year < 1965) {
return 0.424;
}
return ((year * -0.4865) + 996.41) / 100.0;
}
private static void startAlcoholism(Person person, long time) {
// there are various types of alcoholics with different characteristics
// including age of onset of dependence. we pick 25 as a starting point
// https://www.therecoveryvillage.com/alcohol-abuse/types-alcoholics/
if (person.attributes.get(Person.ALCOHOLIC) == null && person.ageInYears(time) == 25) {
// assume about 8 mil alcoholics/320 mil gen pop
Boolean alcoholic = person.rand() < 0.025;
person.attributes.put(Person.ALCOHOLIC, alcoholic);
double quitAlcoholismBaseline =
Config.getAsDouble("lifecycle.quit_alcoholism.baseline", 0.05);
person.attributes.put(QUIT_ALCOHOLISM_PROBABILITY, quitAlcoholismBaseline);
}
}
/**
* If the person is a smoker, there is a small chance they will quit.
* @param person The person who might quit smoking.
* @param time The current time in the simulation.
*/
public static void quitSmoking(Person person, long time) {
int age = person.ageInYears(time);
if (person.attributes.containsKey(Person.SMOKER)) {
if (person.attributes.get(Person.SMOKER).equals(true)) {
double probability = (double) person.attributes.get(QUIT_SMOKING_PROBABILITY);
if (person.rand() < probability) {
person.attributes.put(Person.SMOKER, false);
person.attributes.put(QUIT_SMOKING_AGE, age);
} else {
double quitSmokingBaseline = Config.getAsDouble("lifecycle.quit_smoking.baseline", 0.01);
double quitSmokingTimestepDelta =
Config.getAsDouble("lifecycle.quit_smoking.timestep_delta", -0.1);
probability += quitSmokingTimestepDelta;
if (probability < quitSmokingBaseline) {
probability = quitSmokingBaseline;
}
person.attributes.put(QUIT_SMOKING_PROBABILITY, probability);
}
}
}
}
/**
* If the person is an alcoholic, there is a small chance they will quit.
* @param person The person who might quit drinking.
* @param time The current time in the simulation.
*/
public static void quitAlcoholism(Person person, long time) {
int age = person.ageInYears(time);
if (person.attributes.containsKey(Person.ALCOHOLIC)) {
if (person.attributes.get(Person.ALCOHOLIC).equals(true)) {
double probability = (double) person.attributes.get(QUIT_ALCOHOLISM_PROBABILITY);
if (person.rand() < probability) {
person.attributes.put(Person.ALCOHOLIC, false);
person.attributes.put(QUIT_ALCOHOLISM_AGE, age);
} else {
double quitAlcoholismBaseline =
Config.getAsDouble("lifecycle.quit_alcoholism.baseline", 0.01);
double quitAlcoholismTimestepDelta =
Config.getAsDouble("lifecycle.quit_alcoholism.timestep_delta", -0.1);
probability += quitAlcoholismTimestepDelta;
if (probability < quitAlcoholismBaseline) {
probability = quitAlcoholismBaseline;
}
person.attributes.put(QUIT_ALCOHOLISM_PROBABILITY, probability);
}
}
}
}
/**
* Adjust the probability of a patients adherence to Doctor orders, whether
* medication, careplans, whatever.
* @param person The patient to consider.
* @param time The time in the simulation.
*/
public static void adherence(Person person, long time) {
if (person.attributes.containsKey(Person.ADHERENCE)) {
double probability = (double) person.attributes.get(ADHERENCE_PROBABILITY);
double adherenceBaseline = Config.getAsDouble("lifecycle.adherence.baseline", 0.05);
double adherenceTimestepDelta =
Config.getAsDouble("lifecycle.adherence.timestep_delta", -0.01);
probability += adherenceTimestepDelta;
if (probability < adherenceBaseline) {
probability = adherenceBaseline;
}
person.attributes.put(ADHERENCE_PROBABILITY, probability);
}
}
/**
* Creates a "probability_of_fall_injury" attribute that gets referenced in the Injuries module
* where adults > age 65 have multiple screenings that affect fall.
* @param person The person to calculate risk for.
* @param time The time within the simulation.
*/
private void calculateFallRisk(Person person, long time) {
if (person.ageInYears(time) >= 65) {
boolean hasOsteoporosis = (boolean) person.attributes.getOrDefault("osteoporosis", false);
double baselineFallRisk = hasOsteoporosis ? 0.06 : 0.035;// numbers from injuries module
int activeInterventions = 0;
// careplan for exercise or PT
if (person.record.careplanActive("Physical therapy procedure")
|| person.record.careplanActive("Physical activity target light exercise")) {
activeInterventions++;
}
// taking vitamin D
if (person.record.medicationActive("Cholecalciferol 600 UNT")) {
activeInterventions++;
}
// osteoporosis diagnosis makes them more careful
if (person.record.conditionActive("Osteoporosis (disorder)")) {
activeInterventions++;
}
double fallRisk = baselineFallRisk * (1 - 0.02 * activeInterventions);
// reduce the fall risk by 2% per intervention
// TODO - research actual effectiveness of these interventions
person.attributes.put("probability_of_fall_injury", fallRisk);
}
}
/**
* Determines if the person is disabled according to input file
* criteria. If the input file is unavailable, the default is false.
* @param person The person.
* @param time The time.
* @return true or false.
*/
public static boolean isDisabled(Person person, long time) {
if (disabilityCriteria != null) {
return disabilityCriteria.isPersonEligible(person, time);
} else {
return false;
}
}
/**
* Determines earliest disability diagnosis time according to input file
* criteria. If the input file is unavailable, the default is Long.MAX_VALUE.
* @param person The person.
* @return Time of earliest disability diagnosis.
*/
public static long getEarliestDisabilityDiagnosisTime(Person person) {
if (disabilityCriteria != null) {
return disabilityCriteria.getEarliestDiagnosis(person);
} else {
return Long.MAX_VALUE;
}
}
/**
* Get all of the Codes this module uses, for inventory purposes.
*
* @return Collection of all codes and concepts this module uses
*/
public static Collection<Code> getAllCodes() {
return Collections.singleton(NATURAL_CAUSES);
}
/**
* Populate the given attribute map with the list of attributes that this
* module reads/writes with example values when appropriate.
*
* @param attributes Attribute map to populate.
*/
public static void inventoryAttributes(Map<String,Inventory> attributes) {
String m = LifecycleModule.class.getSimpleName();
// Read
Attributes.inventory(attributes, m, Person.ADHERENCE, true, false, null);
Attributes.inventory(attributes, m, ADHERENCE_PROBABILITY, true, false, "1.0");
Attributes.inventory(attributes, m, AGE, true, false, null);
Attributes.inventory(attributes, m, AGE_MONTHS, true, false, null);
Attributes.inventory(attributes, m, Person.ALCOHOLIC, true, false, null);
Attributes.inventory(attributes, m, "ckd", true, false, null);
Attributes.inventory(attributes, m, "diabetes", true, false, null);
Attributes.inventory(attributes, m, "diabetes_severity", true, false, null);
Attributes.inventory(attributes, m, Person.EDUCATION_LEVEL, true, false, null);
Attributes.inventory(attributes, m, Person.ETHNICITY, true, false, null);
Attributes.inventory(attributes, m, Person.FIRST_NAME, true, false, null);
Attributes.inventory(attributes, m, Person.FIRST_LANGUAGE, true, false, null);
Attributes.inventory(attributes, m, Person.GENDER, true, false, "M");
Attributes.inventory(attributes, m, Person.IDENTIFIER_DRIVERS, true, false, null);
Attributes.inventory(attributes, m, Person.IDENTIFIER_PASSPORT, true, false, null);
Attributes.inventory(attributes, m, Person.LAST_NAME, true, false, null);
Attributes.inventory(attributes, m, Person.NAME_PREFIX, true, false, null);
Attributes.inventory(attributes, m, Person.NAME_SUFFIX, true, false, null);
Attributes.inventory(attributes, m, Person.MARITAL_STATUS, true, false, null);
Attributes.inventory(attributes, m, Person.MIDDLE_NAME, true, true, null);
Attributes.inventory(attributes, m, "osteoporosis", true, false, null);
Attributes.inventory(attributes, m, "prediabetes", true, false, null);
Attributes.inventory(attributes, m, QUIT_ALCOHOLISM_PROBABILITY, true, false, null);
Attributes.inventory(attributes, m, QUIT_SMOKING_PROBABILITY, true, false, null);
Attributes.inventory(attributes, m, Person.RACE, true, false, null);
Attributes.inventory(attributes, m, Person.SMOKER, true, false, "Boolean");
Attributes.inventory(attributes, m, Person.DEATHDATE, true, false, "1046327126000");
// Write
Attributes.inventory(attributes, m, "pregnant", false, true, "Boolean");
Attributes.inventory(attributes, m, "probability_of_fall_injury", false, true, "1.0");
Attributes.inventory(attributes, m, "RH_NEG", false, true, "Boolean");
Attributes.inventory(attributes, m, ADHERENCE_PROBABILITY, false, true, "1.0");
Attributes.inventory(attributes, m, AGE, false, true, "Numeric");
Attributes.inventory(attributes, m, AGE_MONTHS, false, true, "Numeric");
Attributes.inventory(attributes, m, BirthStatistics.BIRTH_SEX, false, true, "M");
Attributes.inventory(attributes, m,
LifecycleModule.QUIT_SMOKING_PROBABILITY, false, true, "1.0");
Attributes.inventory(attributes, m, Person.ADDRESS, false, true, null);
Attributes.inventory(attributes, m, Person.ALCOHOLIC, false, true, "Boolean");
Attributes.inventory(attributes, m, Person.BIRTH_CITY, false, true, "Bedford");
Attributes.inventory(attributes, m, Person.BIRTH_COUNTRY, false, true, COUNTRY_CODE);
Attributes.inventory(attributes, m, Person.BIRTH_STATE, false, true, "Massachusetts");
Attributes.inventory(attributes, m, Person.BIRTHDATE, false, true, null);
Attributes.inventory(attributes, m, Person.BIRTHPLACE, false, true, "Boston");
Attributes.inventory(attributes, m, Person.ETHNICITY, false, true, null);
Attributes.inventory(attributes, m, Person.FIRST_NAME, false, true, null);
Attributes.inventory(attributes, m, Person.GENDER, false, true, "F");
Attributes.inventory(attributes, m, Person.ID, false, true, null);
Attributes.inventory(attributes, m, Person.IDENTIFIER_DRIVERS, false, true, null);
Attributes.inventory(attributes, m, Person.IDENTIFIER_PASSPORT, false, true, null);
Attributes.inventory(attributes, m, Person.IDENTIFIER_SSN, false, true, "999-99-9999");
Attributes.inventory(attributes, m, Person.LAST_NAME, false, true, null);
Attributes.inventory(attributes, m, Person.MAIDEN_NAME, false, true, null);
Attributes.inventory(attributes, m, Person.MARITAL_STATUS, false, true, "M");
Attributes.inventory(attributes, m, Person.MULTIPLE_BIRTH_STATUS, false, true, "Boolean");
Attributes.inventory(attributes, m, Person.NAME, false, true, null);
Attributes.inventory(attributes, m, Person.NAME_FATHER, false, true, null);
Attributes.inventory(attributes, m, Person.NAME_MOTHER, false, true, null);
Attributes.inventory(attributes, m, Person.NAME_PREFIX, false, true, null);
Attributes.inventory(attributes, m, Person.NAME_SUFFIX, false, true, null);
Attributes.inventory(attributes, m, Person.RACE, false, true, null);
Attributes.inventory(attributes, m, Person.SEXUAL_ORIENTATION, false, true, null);
Attributes.inventory(attributes, m, Person.SMOKER, false, true, "Boolean");
Attributes.inventory(attributes, m, Person.TELECOM, false, true, "555-555-5555");
Attributes.inventory(attributes, m, Person.ZIP, false, true, "01730");
Attributes.inventory(attributes, m, QUIT_ALCOHOLISM_AGE, false, true, "Numeric");
Attributes.inventory(attributes, m, QUIT_ALCOHOLISM_PROBABILITY, false, true, "1.0");
Attributes.inventory(attributes, m, QUIT_SMOKING_AGE, false, true, "Numeric");
Attributes.inventory(attributes, m, QUIT_SMOKING_PROBABILITY, false, true, "1.0");
Attributes.inventory(attributes, m, DAYS_UNTIL_DEATH, false, true, "42");
}
} | synthetichealth/synthea | src/main/java/org/mitre/synthea/modules/LifecycleModule.java |
213,084 | /*
Copyright (c) 2024, MapTiler.com & OpenMapTiles contributors.
All rights reserved.
Code license: BSD 3-Clause License
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Design license: CC-BY 4.0
See https://github.com/openmaptiles/openmaptiles/blob/master/LICENSE.md for details on usage
*/
// AUTOGENERATED BY Generate.java -- DO NOT MODIFY
package org.openmaptiles.generated;
import static com.onthegomap.planetiler.expression.Expression.*;
import com.onthegomap.planetiler.config.PlanetilerConfig;
import com.onthegomap.planetiler.expression.MultiExpression;
import com.onthegomap.planetiler.stats.Stats;
import com.onthegomap.planetiler.util.Translations;
import java.util.List;
import java.util.Set;
import org.openmaptiles.Layer;
/**
* All vector tile layer definitions, attributes, and allowed values generated from the
* <a href="https://github.com/openmaptiles/openmaptiles/blob/v3.15/openmaptiles.yaml">OpenMapTiles vector tile schema
* v3.15</a>.
*/
@SuppressWarnings("unused")
public class OpenMapTilesSchema {
public static final String NAME = "OpenMapTiles";
public static final String DESCRIPTION = "A tileset showcasing all layers in OpenMapTiles. https://openmaptiles.org";
public static final String VERSION = "3.15.0";
public static final String ATTRIBUTION =
"<a href=\"https://www.openmaptiles.org/\" target=\"_blank\">© OpenMapTiles</a> <a href=\"https://www.openstreetmap.org/copyright\" target=\"_blank\">© OpenStreetMap contributors</a>";
public static final List<String> LANGUAGES = List.of("am", "ar", "az", "be", "bg", "bn", "br", "bs", "ca", "co", "cs",
"cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fa", "fi", "fr", "fy", "ga", "gd", "he", "hi", "hr", "hu",
"hy", "id", "is", "it", "ja", "ja_kana", "ja_rm", "ja-Latn", "ja-Hira", "ka", "kk", "kn", "ko", "ko-Latn", "ku",
"la", "lb", "lt", "lv", "mk", "mt", "ml", "nl", "no", "oc", "pa", "pnb", "pl", "pt", "rm", "ro", "ru", "sk", "sl",
"sq", "sr", "sr-Latn", "sv", "ta", "te", "th", "tr", "uk", "ur", "vi", "zh", "zh-Hant", "zh-Hans");
/** Returns a list of expected layer implementation instances from the {@code layers} package. */
public static List<Layer> createInstances(Translations translations, PlanetilerConfig config, Stats stats) {
return List.of(
new org.openmaptiles.layers.Water(translations, config, stats),
new org.openmaptiles.layers.Waterway(translations, config, stats),
new org.openmaptiles.layers.Landcover(translations, config, stats),
new org.openmaptiles.layers.Landuse(translations, config, stats),
new org.openmaptiles.layers.MountainPeak(translations, config, stats),
new org.openmaptiles.layers.Park(translations, config, stats),
new org.openmaptiles.layers.Boundary(translations, config, stats),
new org.openmaptiles.layers.Aeroway(translations, config, stats),
new org.openmaptiles.layers.Transportation(translations, config, stats),
new org.openmaptiles.layers.Building(translations, config, stats),
new org.openmaptiles.layers.WaterName(translations, config, stats),
new org.openmaptiles.layers.TransportationName(translations, config, stats),
new org.openmaptiles.layers.Place(translations, config, stats),
new org.openmaptiles.layers.Housenumber(translations, config, stats),
new org.openmaptiles.layers.Poi(translations, config, stats),
new org.openmaptiles.layers.AerodromeLabel(translations, config, stats)
);
}
/**
* Water polygons representing oceans and lakes. Covered watered areas are excluded (<code>covered=yes</code>). On low
* zoom levels all water originates from Natural Earth. To get a more correct display of the south pole you should
* also style the covering ice shelves over the water. On higher zoom levels water polygons from
* <a href="http://osmdata.openstreetmap.de/">OpenStreetMapData</a> are used. The polygons are split into many smaller
* polygons to improve rendering performance. This however can lead to less rendering options in clients since these
* boundaries show up. So you might not be able to use border styling for ocean water features.
*
* Generated from
* <a href="https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/water/water.yaml">water.yaml</a>
*/
public interface Water extends Layer {
double BUFFER_SIZE = 4.0;
String LAYER_NAME = "water";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the water layer. */
final class Fields {
/**
* From zoom 6 are taken OSM IDs. Up to zoom 5 there are used Natural Earth lakes, where are propagated the OSM
* IDs insted of Natural Earth IDs. For smaller area then planet, NE lakes keep their Natural Earth IDs.
*/
public static final String ID = "id";
/**
* All water polygons from <a href="http://osmdata.openstreetmap.de/">OpenStreetMapData</a> have the class
* <code>ocean</code>. The water-covered areas of flowing water bodies with the
* <a href="http://wiki.openstreetmap.org/wiki/Tag:water=river"><code>water=river</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Tag:water=canal"><code>water=canal</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Tag:water=stream"><code>water=stream</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Tag:water=ditch"><code>water=ditch</code></a>, or
* <a href="http://wiki.openstreetmap.org/wiki/Tag:water=drain"><code>water=drain</code></a> tags are classified
* as river. Wet and dry docks tagged
* <a href="http://wiki.openstreetmap.org/wiki/Tag:waterway=dock"><code>waterway=dock</code></a> are classified as
* a <code>dock</code>. Various minor waterbodies are classified as a <code>pond</code>. Swimming pools tagged
* <a href="https://wiki.openstreetmap.org/wiki/Tag:leisure=swimming_pool"><code>leisure=swimming_pool</code></a>
* are classified as a <code>swimming_pool</code> All other water bodies are classified as <code>lake</code>.
* <p>
* allowed values:
* <ul>
* <li>dock
* <li>river
* <li>pond
* <li>lake
* <li>ocean
* <li>swimming_pool
* </ul>
*/
public static final String CLASS = "class";
/**
* Mark with <code>1</code> if it is an
* <a href="http://wiki.openstreetmap.org/wiki/Key:intermittent">intermittent</a> water polygon.
* <p>
* allowed values:
* <ul>
* <li>0
* <li>1
* </ul>
*/
public static final String INTERMITTENT = "intermittent";
/**
* Identifies the type of crossing as either a bridge or a tunnel.
* <p>
* allowed values:
* <ul>
* <li>"bridge"
* <li>"tunnel"
* </ul>
*/
public static final String BRUNNEL = "brunnel";
}
/** Attribute values for map elements in the water layer. */
final class FieldValues {
public static final String CLASS_DOCK = "dock";
public static final String CLASS_RIVER = "river";
public static final String CLASS_POND = "pond";
public static final String CLASS_LAKE = "lake";
public static final String CLASS_OCEAN = "ocean";
public static final String CLASS_SWIMMING_POOL = "swimming_pool";
public static final Set<String> CLASS_VALUES = Set.of("dock", "river", "pond", "lake", "ocean", "swimming_pool");
public static final String BRUNNEL_BRIDGE = "bridge";
public static final String BRUNNEL_TUNNEL = "tunnel";
public static final Set<String> BRUNNEL_VALUES = Set.of("bridge", "tunnel");
}
/** Complex mappings to generate attribute values from OSM element tags in the water layer. */
final class FieldMappings {
public static final MultiExpression<String> Class =
MultiExpression.of(List.of(MultiExpression.entry("dock", matchAny("waterway", "dock")),
MultiExpression.entry("river", matchAny("water", "river", "stream", "canal", "ditch", "drain")),
MultiExpression.entry("pond", matchAny("water", "pond", "basin", "wastewater", "salt_pond")),
MultiExpression.entry("lake", FALSE), MultiExpression.entry("ocean", FALSE),
MultiExpression.entry("swimming_pool", matchAny("leisure", "swimming_pool"))));
}
}
/**
* OpenStreetMap <a href="https://wiki.openstreetmap.org/wiki/Waterways">waterways</a> for higher zoom levels (z9 and
* more) and Natural Earth rivers and lake centerlines for low zoom levels (z3 - z8). Linestrings without a name or
* which are too short are filtered out at low zoom levels. Till z11 there is <code>river</code> class only, in z12
* there is also <code>canal</code> generated, starting z13 there is no generalization according to <code>class</code>
* field applied. Waterways do not have a <code>subclass</code> field.
*
* Generated from
* <a href="https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/waterway/waterway.yaml">waterway.yaml</a>
*/
public interface Waterway extends Layer {
double BUFFER_SIZE = 4.0;
String LAYER_NAME = "waterway";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the waterway layer. */
final class Fields {
/**
* The OSM <a href="http://wiki.openstreetmap.org/wiki/Key:name"><code>name</code></a> value of the waterway.
* Language-specific values are in <code>name:xx</code>. The <code>name</code> field may be empty for NaturalEarth
* data or at lower zoom levels.
*/
public static final String NAME = "name";
/**
* English name <code>name:en</code> if available, otherwise <code>name</code>. This is deprecated and will be
* removed in a future release in favor of <code>name:en</code>.
*/
public static final String NAME_EN = "name_en";
/**
* German name <code>name:de</code> if available, otherwise <code>name</code> or <code>name:en</code>. This is
* deprecated and will be removed in a future release in favor of <code>name:de</code>.
*/
public static final String NAME_DE = "name_de";
/**
* The original value of the <a href="http://wiki.openstreetmap.org/wiki/Key:waterway"><code>waterway</code></a>
* tag.
* <p>
* allowed values:
* <ul>
* <li>"stream"
* <li>"river"
* <li>"canal"
* <li>"drain"
* <li>"ditch"
* </ul>
*/
public static final String CLASS = "class";
/**
* Mark whether way is a tunnel or bridge.
* <p>
* allowed values:
* <ul>
* <li>"bridge"
* <li>"tunnel"
* </ul>
*/
public static final String BRUNNEL = "brunnel";
/**
* Mark with <code>1</code> if it is an
* <a href="http://wiki.openstreetmap.org/wiki/Key:intermittent">intermittent</a> waterway.
* <p>
* allowed values:
* <ul>
* <li>0
* <li>1
* </ul>
*/
public static final String INTERMITTENT = "intermittent";
}
/** Attribute values for map elements in the waterway layer. */
final class FieldValues {
public static final String CLASS_STREAM = "stream";
public static final String CLASS_RIVER = "river";
public static final String CLASS_CANAL = "canal";
public static final String CLASS_DRAIN = "drain";
public static final String CLASS_DITCH = "ditch";
public static final Set<String> CLASS_VALUES = Set.of("stream", "river", "canal", "drain", "ditch");
public static final String BRUNNEL_BRIDGE = "bridge";
public static final String BRUNNEL_TUNNEL = "tunnel";
public static final Set<String> BRUNNEL_VALUES = Set.of("bridge", "tunnel");
}
/** Complex mappings to generate attribute values from OSM element tags in the waterway layer. */
final class FieldMappings {
}
}
/**
* Landcover is used to describe the physical material at the surface of the earth. At lower zoom levels this is from
* Natural Earth data for glaciers and ice shelves and at higher zoom levels the landcover is
* <a href="http://wiki.openstreetmap.org/wiki/Landcover">implied by OSM tags</a>. The most common use case for this
* layer is to style wood (<code>class=wood</code>) and grass (<code>class=grass</code>) areas.
*
* Generated from <a href=
* "https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/landcover/landcover.yaml">landcover.yaml</a>
*/
public interface Landcover extends Layer {
double BUFFER_SIZE = 4.0;
String LAYER_NAME = "landcover";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the landcover layer. */
final class Fields {
/**
* Use the <strong>class</strong> to assign natural colors for <strong>landcover</strong>.
* <p>
* allowed values:
* <ul>
* <li>farmland
* <li>ice
* <li>wood
* <li>rock
* <li>grass
* <li>wetland
* <li>sand
* </ul>
*/
public static final String CLASS = "class";
/**
* Use <strong>subclass</strong> to do more precise styling. Original value of either the
* <a href="http://wiki.openstreetmap.org/wiki/Key:natural"><code>natural</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:landuse"><code>landuse</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:leisure"><code>leisure</code></a>, or
* <a href="http://wiki.openstreetmap.org/wiki/Key:wetland"><code>wetland</code></a> tag.
* <p>
* allowed values:
* <ul>
* <li>"allotments"
* <li>"bare_rock"
* <li>"beach"
* <li>"bog"
* <li>"dune"
* <li>"scrub"
* <li>"shrubbery"
* <li>"farm"
* <li>"farmland"
* <li>"fell"
* <li>"forest"
* <li>"garden"
* <li>"glacier"
* <li>"grass"
* <li>"grassland"
* <li>"golf_course"
* <li>"heath"
* <li>"mangrove"
* <li>"marsh"
* <li>"meadow"
* <li>"orchard"
* <li>"park"
* <li>"plant_nursery"
* <li>"recreation_ground"
* <li>"reedbed"
* <li>"saltern"
* <li>"saltmarsh"
* <li>"sand"
* <li>"scree"
* <li>"swamp"
* <li>"tidalflat"
* <li>"tundra"
* <li>"village_green"
* <li>"vineyard"
* <li>"wet_meadow"
* <li>"wetland"
* <li>"wood"
* </ul>
*/
public static final String SUBCLASS = "subclass";
}
/** Attribute values for map elements in the landcover layer. */
final class FieldValues {
public static final String CLASS_FARMLAND = "farmland";
public static final String CLASS_ICE = "ice";
public static final String CLASS_WOOD = "wood";
public static final String CLASS_ROCK = "rock";
public static final String CLASS_GRASS = "grass";
public static final String CLASS_WETLAND = "wetland";
public static final String CLASS_SAND = "sand";
public static final Set<String> CLASS_VALUES =
Set.of("farmland", "ice", "wood", "rock", "grass", "wetland", "sand");
public static final String SUBCLASS_ALLOTMENTS = "allotments";
public static final String SUBCLASS_BARE_ROCK = "bare_rock";
public static final String SUBCLASS_BEACH = "beach";
public static final String SUBCLASS_BOG = "bog";
public static final String SUBCLASS_DUNE = "dune";
public static final String SUBCLASS_SCRUB = "scrub";
public static final String SUBCLASS_SHRUBBERY = "shrubbery";
public static final String SUBCLASS_FARM = "farm";
public static final String SUBCLASS_FARMLAND = "farmland";
public static final String SUBCLASS_FELL = "fell";
public static final String SUBCLASS_FOREST = "forest";
public static final String SUBCLASS_GARDEN = "garden";
public static final String SUBCLASS_GLACIER = "glacier";
public static final String SUBCLASS_GRASS = "grass";
public static final String SUBCLASS_GRASSLAND = "grassland";
public static final String SUBCLASS_GOLF_COURSE = "golf_course";
public static final String SUBCLASS_HEATH = "heath";
public static final String SUBCLASS_MANGROVE = "mangrove";
public static final String SUBCLASS_MARSH = "marsh";
public static final String SUBCLASS_MEADOW = "meadow";
public static final String SUBCLASS_ORCHARD = "orchard";
public static final String SUBCLASS_PARK = "park";
public static final String SUBCLASS_PLANT_NURSERY = "plant_nursery";
public static final String SUBCLASS_RECREATION_GROUND = "recreation_ground";
public static final String SUBCLASS_REEDBED = "reedbed";
public static final String SUBCLASS_SALTERN = "saltern";
public static final String SUBCLASS_SALTMARSH = "saltmarsh";
public static final String SUBCLASS_SAND = "sand";
public static final String SUBCLASS_SCREE = "scree";
public static final String SUBCLASS_SWAMP = "swamp";
public static final String SUBCLASS_TIDALFLAT = "tidalflat";
public static final String SUBCLASS_TUNDRA = "tundra";
public static final String SUBCLASS_VILLAGE_GREEN = "village_green";
public static final String SUBCLASS_VINEYARD = "vineyard";
public static final String SUBCLASS_WET_MEADOW = "wet_meadow";
public static final String SUBCLASS_WETLAND = "wetland";
public static final String SUBCLASS_WOOD = "wood";
public static final Set<String> SUBCLASS_VALUES =
Set.of("allotments", "bare_rock", "beach", "bog", "dune", "scrub", "shrubbery", "farm", "farmland", "fell",
"forest", "garden", "glacier", "grass", "grassland", "golf_course", "heath", "mangrove", "marsh", "meadow",
"orchard", "park", "plant_nursery", "recreation_ground", "reedbed", "saltern", "saltmarsh", "sand", "scree",
"swamp", "tidalflat", "tundra", "village_green", "vineyard", "wet_meadow", "wetland", "wood");
}
/** Complex mappings to generate attribute values from OSM element tags in the landcover layer. */
final class FieldMappings {
public static final MultiExpression<String> Class =
MultiExpression
.of(List.of(
MultiExpression.entry("farmland",
matchAny("subclass", "farmland", "farm", "orchard", "vineyard", "plant_nursery")),
MultiExpression.entry("ice", matchAny("subclass", "glacier", "ice_shelf")),
MultiExpression.entry("wood", matchAny("subclass", "wood", "forest")),
MultiExpression.entry("rock", matchAny("subclass", "bare_rock", "scree")),
MultiExpression.entry("grass",
matchAny("subclass", "fell", "grassland", "heath", "scrub", "shrubbery", "tundra", "grass", "meadow",
"allotments", "park", "village_green", "recreation_ground", "garden", "golf_course")),
MultiExpression.entry("wetland",
matchAny("subclass", "wetland", "bog", "swamp", "wet_meadow", "marsh", "reedbed", "saltern", "tidalflat",
"saltmarsh", "mangrove")),
MultiExpression.entry("sand", matchAny("subclass", "beach", "sand", "dune"))));
}
}
/**
* Landuse is used to describe use of land by humans. At lower zoom levels this is from Natural Earth data for
* residential (urban) areas and at higher zoom levels mostly OSM <code>landuse</code> tags.
*
* Generated from
* <a href="https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/landuse/landuse.yaml">landuse.yaml</a>
*/
public interface Landuse extends Layer {
double BUFFER_SIZE = 4.0;
String LAYER_NAME = "landuse";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the landuse layer. */
final class Fields {
/**
* Use the <strong>class</strong> to assign special colors to areas. Original value of either the
* <a href="http://wiki.openstreetmap.org/wiki/Key:landuse"><code>landuse</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:amenity"><code>amenity</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:leisure"><code>leisure</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:tourism"><code>tourism</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:place"><code>place</code></a> or
* <a href="http://wiki.openstreetmap.org/wiki/Key:waterway"><code>waterway</code></a> tag.
* <p>
* allowed values:
* <ul>
* <li>"railway"
* <li>"cemetery"
* <li>"military"
* <li>"residential"
* <li>"commercial"
* <li>"industrial"
* <li>"garages"
* <li>"retail"
* <li>"bus_station"
* <li>"school"
* <li>"university"
* <li>"kindergarten"
* <li>"college"
* <li>"library"
* <li>"hospital"
* <li>"stadium"
* <li>"pitch"
* <li>"playground"
* <li>"track"
* <li>"theme_park"
* <li>"zoo"
* <li>"suburb"
* <li>"quarter"
* <li>"neighbourhood"
* <li>"dam"
* <li>"quarry"
* </ul>
*/
public static final String CLASS = "class";
}
/** Attribute values for map elements in the landuse layer. */
final class FieldValues {
public static final String CLASS_RAILWAY = "railway";
public static final String CLASS_CEMETERY = "cemetery";
public static final String CLASS_MILITARY = "military";
public static final String CLASS_RESIDENTIAL = "residential";
public static final String CLASS_COMMERCIAL = "commercial";
public static final String CLASS_INDUSTRIAL = "industrial";
public static final String CLASS_GARAGES = "garages";
public static final String CLASS_RETAIL = "retail";
public static final String CLASS_BUS_STATION = "bus_station";
public static final String CLASS_SCHOOL = "school";
public static final String CLASS_UNIVERSITY = "university";
public static final String CLASS_KINDERGARTEN = "kindergarten";
public static final String CLASS_COLLEGE = "college";
public static final String CLASS_LIBRARY = "library";
public static final String CLASS_HOSPITAL = "hospital";
public static final String CLASS_STADIUM = "stadium";
public static final String CLASS_PITCH = "pitch";
public static final String CLASS_PLAYGROUND = "playground";
public static final String CLASS_TRACK = "track";
public static final String CLASS_THEME_PARK = "theme_park";
public static final String CLASS_ZOO = "zoo";
public static final String CLASS_SUBURB = "suburb";
public static final String CLASS_QUARTER = "quarter";
public static final String CLASS_NEIGHBOURHOOD = "neighbourhood";
public static final String CLASS_DAM = "dam";
public static final String CLASS_QUARRY = "quarry";
public static final Set<String> CLASS_VALUES =
Set.of("railway", "cemetery", "military", "residential", "commercial", "industrial", "garages", "retail",
"bus_station", "school", "university", "kindergarten", "college", "library", "hospital", "stadium", "pitch",
"playground", "track", "theme_park", "zoo", "suburb", "quarter", "neighbourhood", "dam", "quarry");
}
/** Complex mappings to generate attribute values from OSM element tags in the landuse layer. */
final class FieldMappings {
}
}
/**
* <a href="http://wiki.openstreetmap.org/wiki/Tag:natural%3Dpeak">Natural peaks</a>
*
* Generated from <a href=
* "https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/mountain_peak/mountain_peak.yaml">mountain_peak.yaml</a>
*/
public interface MountainPeak extends Layer {
double BUFFER_SIZE = 64.0;
String LAYER_NAME = "mountain_peak";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the mountain_peak layer. */
final class Fields {
/**
* The OSM <a href="http://wiki.openstreetmap.org/wiki/Key:name"><code>name</code></a> value of the peak.
* Language-specific values are in <code>name:xx</code>.
*/
public static final String NAME = "name";
/**
* English name <code>name:en</code> if available, otherwise <code>name</code>. This is deprecated and will be
* removed in a future release in favor of <code>name:en</code>.
*/
public static final String NAME_EN = "name_en";
/**
* German name <code>name:de</code> if available, otherwise <code>name</code> or <code>name:en</code>. This is
* deprecated and will be removed in a future release in favor of <code>name:de</code>.
*/
public static final String NAME_DE = "name_de";
/**
* Use the <strong>class</strong> to differentiate between natural objects.
* <p>
* allowed values:
* <ul>
* <li>"peak"
* <li>"volcano"
* <li>"saddle"
* <li>"ridge"
* <li>"cliff"
* <li>"arete"
* </ul>
*/
public static final String CLASS = "class";
/** Elevation (<code>ele</code>) in meters. */
public static final String ELE = "ele";
/** Elevation (<code>ele</code>) in feet. */
public static final String ELE_FT = "ele_ft";
/**
* Value 1 for peaks in location where feet is used as customary unit (USA).
* <p>
* allowed values:
* <ul>
* <li>1
* <li>null
* </ul>
*/
public static final String CUSTOMARY_FT = "customary_ft";
/** Rank of the peak within one tile (starting at 1 that is the most important peak). */
public static final String RANK = "rank";
}
/** Attribute values for map elements in the mountain_peak layer. */
final class FieldValues {
public static final String CLASS_PEAK = "peak";
public static final String CLASS_VOLCANO = "volcano";
public static final String CLASS_SADDLE = "saddle";
public static final String CLASS_RIDGE = "ridge";
public static final String CLASS_CLIFF = "cliff";
public static final String CLASS_ARETE = "arete";
public static final Set<String> CLASS_VALUES = Set.of("peak", "volcano", "saddle", "ridge", "cliff", "arete");
}
/** Complex mappings to generate attribute values from OSM element tags in the mountain_peak layer. */
final class FieldMappings {
}
}
/**
* The park layer in OpenMapTiles contains natural and protected areas from OpenStreetMap, such as parks tagged with
* <a href="https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dnational_park"><code>boundary=national_park</code></a>,
* <a href=
* "https://wiki.openstreetmap.org/wiki/Tag:boundary%3Dprotected_area"><code>boundary=protected_area</code></a>, or
* <a href="https://wiki.openstreetmap.org/wiki/Tag:leisure%3Dnature_reserve"><code>leisure=nature_reserve</code></a>.
*
* Generated from
* <a href="https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/park/park.yaml">park.yaml</a>
*/
public interface Park extends Layer {
double BUFFER_SIZE = 4.0;
String LAYER_NAME = "park";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the park layer. */
final class Fields {
/**
* Use the <strong>class</strong> to differentiate between different kinds of features in the <code>parks</code>
* layer. The class for <code>boundary=protected_area</code> parks is the lower-case of the
* <a href="http://wiki.openstreetmap.org/wiki/key:protection_title"><code>protection_title</code></a> value with
* blanks replaced by <code>_</code>. <code>national_park</code> is the class of
* <code>protection_title=National Park</code> and <code>boundary=national_park</code>.
* <code>nature_reserve</code> is the class of <code>protection_title=Nature Reserve</code> and
* <code>leisure=nature_reserve</code>. The class for other
* <a href="http://wiki.openstreetmap.org/wiki/key:protection_title"><code>protection_title</code></a> values is
* similarly assigned.
*/
public static final String CLASS = "class";
/**
* The OSM <a href="http://wiki.openstreetmap.org/wiki/Key:name"><code>name</code></a> value of the park (point
* features only). Language-specific values are in <code>name:xx</code>.
*/
public static final String NAME = "name";
/**
* English name <code>name:en</code> if available, otherwise <code>name</code> (point features only). This is
* deprecated and will be removed in a future release in favor of <code>name:en</code>.
*/
public static final String NAME_EN = "name_en";
/**
* German name <code>name:de</code> if available, otherwise <code>name</code> or <code>name:en</code> (point
* features only). This is deprecated and will be removed in a future release in favor of <code>name:de</code>.
*/
public static final String NAME_DE = "name_de";
/** Rank of the park within one tile, starting at 1 that is the most important park (point features only). */
public static final String RANK = "rank";
}
/** Attribute values for map elements in the park layer. */
final class FieldValues {
}
/** Complex mappings to generate attribute values from OSM element tags in the park layer. */
final class FieldMappings {
}
}
/**
* Contains administrative boundaries as linestrings and aboriginal lands as polygons. Until z4
* <a href="http://www.naturalearthdata.com/downloads/">Natural Earth data</a> is used after which OSM boundaries
* (<a href=
* "http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative"><code>boundary=administrative</code></a>) are
* present from z5 to z14 (also for maritime boundaries with <code>admin_level <= 2</code> at z4). OSM data
* contains several
* <a href="http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level"><code>admin_level</code></a>
* but for most styles it makes sense to just style <code>admin_level=2</code> and <code>admin_level=4</code>.
*
* Generated from
* <a href="https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/boundary/boundary.yaml">boundary.yaml</a>
*/
public interface Boundary extends Layer {
double BUFFER_SIZE = 4.0;
String LAYER_NAME = "boundary";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the boundary layer. */
final class Fields {
/**
* Use the <strong>class</strong> to differentiate between different kinds of boundaries. The class for
* <code>boundary=aboriginal_lands</code> is <code>aboriginal_lands</code>.
*/
public static final String CLASS = "class";
/**
* The OSM <a href="http://wiki.openstreetmap.org/wiki/Key:name"><code>name</code></a> value (area features only).
*/
public static final String NAME = "name";
/**
* OSM <a href="http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level">admin_level</a>
* indicating the level of importance of this boundary. The <code>admin_level</code> corresponds to the lowest
* <code>admin_level</code> the line participates in. At low zoom levels the Natural Earth boundaries are mapped
* to the equivalent admin levels.
*/
public static final String ADMIN_LEVEL = "admin_level";
/** State name on the left of the border. For country boundaries only (<code>admin_level = 2</code>). */
public static final String ADM0_L = "adm0_l";
/** State name on the right of the border. For country boundaries only (<code>admin_level = 2</code>). */
public static final String ADM0_R = "adm0_r";
/**
* Mark with <code>1</code> if the border is disputed.
* <p>
* allowed values:
* <ul>
* <li>0
* <li>1
* </ul>
*/
public static final String DISPUTED = "disputed";
/**
* Field containing name of the disputed area (extracted from border relation in OSM, without spaces). For country
* boundaries only (<code>admin_level = 2</code>). Value examples from Asian OSM pbf extract
* <p>
* allowed values:
* <ul>
* <li>"AbuMusaIsland"
* <li>"BaraHotiiValleys"
* <li>"ChineseClaim"
* <li>"Crimea"
* <li>"Demchok"
* <li>"Dokdo"
* <li>"IndianClaim-North"
* <li>"IndianClaimwesternKashmir"
* <li>"PakistaniClaim"
* <li>"SamduValleys"
* <li>"TirpaniValleys"
* </ul>
*/
public static final String DISPUTED_NAME = "disputed_name";
/**
* ISO2 code of country, which wants to see the boundary line. For country boundaries only
* (<code>admin_level = 2</code>).
*/
public static final String CLAIMED_BY = "claimed_by";
/**
* Mark with <code>1</code> if it is a maritime border.
* <p>
* allowed values:
* <ul>
* <li>0
* <li>1
* </ul>
*/
public static final String MARITIME = "maritime";
}
/** Attribute values for map elements in the boundary layer. */
final class FieldValues {
public static final String DISPUTED_NAME_ABUMUSAISLAND = "AbuMusaIsland";
public static final String DISPUTED_NAME_BARAHOTIIVALLEYS = "BaraHotiiValleys";
public static final String DISPUTED_NAME_CHINESECLAIM = "ChineseClaim";
public static final String DISPUTED_NAME_CRIMEA = "Crimea";
public static final String DISPUTED_NAME_DEMCHOK = "Demchok";
public static final String DISPUTED_NAME_DOKDO = "Dokdo";
public static final String DISPUTED_NAME_INDIANCLAIM_NORTH = "IndianClaim-North";
public static final String DISPUTED_NAME_INDIANCLAIMWESTERNKASHMIR = "IndianClaimwesternKashmir";
public static final String DISPUTED_NAME_PAKISTANICLAIM = "PakistaniClaim";
public static final String DISPUTED_NAME_SAMDUVALLEYS = "SamduValleys";
public static final String DISPUTED_NAME_TIRPANIVALLEYS = "TirpaniValleys";
public static final Set<String> DISPUTED_NAME_VALUES =
Set.of("AbuMusaIsland", "BaraHotiiValleys", "ChineseClaim", "Crimea", "Demchok", "Dokdo", "IndianClaim-North",
"IndianClaimwesternKashmir", "PakistaniClaim", "SamduValleys", "TirpaniValleys");
}
/** Complex mappings to generate attribute values from OSM element tags in the boundary layer. */
final class FieldMappings {
}
}
/**
* Aeroway polygons based of OpenStreetMap <a href="http://wiki.openstreetmap.org/wiki/Aeroways">aeroways</a>. Airport
* buildings are contained in the <strong>building</strong> layer but all other airport related polygons can be found
* in the <strong>aeroway</strong> layer.
*
* Generated from
* <a href="https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/aeroway/aeroway.yaml">aeroway.yaml</a>
*/
public interface Aeroway extends Layer {
double BUFFER_SIZE = 4.0;
String LAYER_NAME = "aeroway";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the aeroway layer. */
final class Fields {
/**
* The OSM <a href="http://wiki.openstreetmap.org/wiki/Key:ref"><code>ref</code></a> tag of the runway/taxiway.
*/
public static final String REF = "ref";
/**
* The original value of <a href="http://wiki.openstreetmap.org/wiki/Key:aeroway"><code>aeroway</code></a> or
* <code>area:aeroway</code> tag.
* <p>
* allowed values:
* <ul>
* <li>"aerodrome"
* <li>"heliport"
* <li>"runway"
* <li>"helipad"
* <li>"taxiway"
* <li>"apron"
* <li>"gate"
* </ul>
*/
public static final String CLASS = "class";
}
/** Attribute values for map elements in the aeroway layer. */
final class FieldValues {
public static final String CLASS_AERODROME = "aerodrome";
public static final String CLASS_HELIPORT = "heliport";
public static final String CLASS_RUNWAY = "runway";
public static final String CLASS_HELIPAD = "helipad";
public static final String CLASS_TAXIWAY = "taxiway";
public static final String CLASS_APRON = "apron";
public static final String CLASS_GATE = "gate";
public static final Set<String> CLASS_VALUES =
Set.of("aerodrome", "heliport", "runway", "helipad", "taxiway", "apron", "gate");
}
/** Complex mappings to generate attribute values from OSM element tags in the aeroway layer. */
final class FieldMappings {
}
}
/**
* <strong>transportation</strong> contains roads, railways, aerial ways, and shipping lines. This layer is directly
* derived from the OSM road hierarchy. At lower zoom levels major highways from Natural Earth are used. It contains
* all roads from motorways to primary, secondary and tertiary roads to residential roads and foot paths. Styling the
* roads is the most essential part of the map. The <code>transportation</code> layer also contains polygons for
* features like plazas.
*
* Generated from <a href=
* "https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/transportation/transportation.yaml">transportation.yaml</a>
*/
public interface Transportation extends Layer {
double BUFFER_SIZE = 4.0;
String LAYER_NAME = "transportation";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the transportation layer. */
final class Fields {
/**
* Distinguish between more and less important roads or railways and roads under construction. Class is derived
* from the value of the <a href="http://wiki.openstreetmap.org/wiki/Key:highway"><code>highway</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:construction"><code>construction</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:railway"><code>railway</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:aerialway"><code>aerialway</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:route"><code>route</code></a> tag (for shipping ways),
* <a href="https://wiki.openstreetmap.org/wiki/Key:busway"><code>busway</code></a>, or
* <a href="http://wiki.openstreetmap.org/wiki/Key:man_made"><code>man_made</code></a>.
* <p>
* allowed values:
* <ul>
* <li>motorway
* <li>trunk
* <li>primary
* <li>secondary
* <li>tertiary
* <li>minor
* <li>path
* <li>service
* <li>track
* <li>raceway
* <li>busway
* <li>bus_guideway
* <li>ferry
* <li>motorway_construction
* <li>trunk_construction
* <li>primary_construction
* <li>secondary_construction
* <li>tertiary_construction
* <li>minor_construction
* <li>path_construction
* <li>service_construction
* <li>track_construction
* <li>raceway_construction
* </ul>
*/
public static final String CLASS = "class";
/**
* Distinguish more specific classes of railway and path: Subclass is value of the
* <a href="http://wiki.openstreetmap.org/wiki/Key:railway"><code>railway</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:highway"><code>highway</code></a> (for paths), or
* <a href="http://wiki.openstreetmap.org/wiki/Key:public_transport"><code>public_transport</code></a> (for
* platforms) tag.
* <p>
* allowed values:
* <ul>
* <li>"rail"
* <li>"narrow_gauge"
* <li>"preserved"
* <li>"funicular"
* <li>"subway"
* <li>"light_rail"
* <li>"monorail"
* <li>"tram"
* <li>"pedestrian"
* <li>"path"
* <li>"footway"
* <li>"cycleway"
* <li>"steps"
* <li>"bridleway"
* <li>"corridor"
* <li>"platform"
* <li>"ferry (DEPRECATED - use class)"
* </ul>
*/
public static final String SUBCLASS = "subclass";
/**
* The network type derived mainly from
* <a href="http://wiki.openstreetmap.org/wiki/Key:network"><code>network</code></a> tag of the road. See more
* info about <a href="http://wiki.openstreetmap.org/wiki/Road_signs_in_the_United_States"><code>us- </code></a>,
* <a href="https://en.wikipedia.org/wiki/Trans-Canada_Highway"><code>ca-transcanada</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/United_Kingdom_Tagging_Guidelines#UK_roads"><code>gb- </code></a>,
* or <a href="http://wiki.openstreetmap.org/wiki/Ireland/Roads"><code>ie- </code></a>.
*/
public static final String NETWORK = "network";
/**
* Mark whether way is a tunnel or bridge.
* <p>
* allowed values:
* <ul>
* <li>"bridge"
* <li>"tunnel"
* <li>"ford"
* </ul>
*/
public static final String BRUNNEL = "brunnel";
/**
* Mark with <code>1</code> whether way is a oneway in the direction of the way, with <code>-1</code> whether way
* is a oneway in the opposite direction of the way or not a oneway with <code>0</code>.
* <p>
* allowed values:
* <ul>
* <li>1
* <li>-1
* </ul>
*/
public static final String ONEWAY = "oneway";
/**
* Mark with <code>1</code> whether way is a ramp (link or steps) or not with <code>0</code>.
* <p>
* allowed values:
* <ul>
* <li>1
* </ul>
*/
public static final String RAMP = "ramp";
/**
* Original value of the <a href="http://wiki.openstreetmap.org/wiki/Key:service"><code>service</code></a> tag.
* <p>
* allowed values:
* <ul>
* <li>"spur"
* <li>"yard"
* <li>"siding"
* <li>"crossover"
* <li>"driveway"
* <li>"alley"
* <li>"parking_aisle"
* </ul>
*/
public static final String SERVICE = "service";
/**
* Access restrictions on this road. Supported values of the
* <a href="http://wiki.openstreetmap.org/wiki/Key:access"><code>access</code></a> tag are <code>no</code> and
* <code>private</code>, which resolve to <code>no</code>.
* <p>
* allowed values:
* <ul>
* <li>false
* </ul>
*/
public static final String ACCESS = "access";
/**
* Whether this is a toll road, based on the
* <a href="http://wiki.openstreetmap.org/wiki/Key:toll"><code>toll</code></a> tag.
* <p>
* allowed values:
* <ul>
* <li>0
* <li>1
* </ul>
*/
public static final String TOLL = "toll";
/**
* Whether this is an expressway, based on the
* <a href="http://wiki.openstreetmap.org/wiki/Key:expressway"><code>expressway</code></a> tag.
* <p>
* allowed values:
* <ul>
* <li>1
* </ul>
*/
public static final String EXPRESSWAY = "expressway";
/** Original value of the <a href="http://wiki.openstreetmap.org/wiki/Key:layer"><code>layer</code></a> tag. */
public static final String LAYER = "layer";
/**
* Experimental feature! Filled only for steps and footways. Original value of the
* <a href="http://wiki.openstreetmap.org/wiki/Key:level"><code>level</code></a> tag.
*/
public static final String LEVEL = "level";
/**
* Experimental feature! Filled only for steps and footways. Original value of the
* <a href="http://wiki.openstreetmap.org/wiki/Key:indoor"><code>indoor</code></a> tag.
* <p>
* allowed values:
* <ul>
* <li>1
* </ul>
*/
public static final String INDOOR = "indoor";
/**
* Original value of the <a href="http://wiki.openstreetmap.org/wiki/Key:bicycle"><code>bicycle</code></a> tag
* (highways only).
*/
public static final String BICYCLE = "bicycle";
/**
* Original value of the <a href="http://wiki.openstreetmap.org/wiki/Key:foot"><code>foot</code></a> tag (highways
* only).
*/
public static final String FOOT = "foot";
/**
* Original value of the <a href="http://wiki.openstreetmap.org/wiki/Key:horse"><code>horse</code></a> tag
* (highways only).
*/
public static final String HORSE = "horse";
/**
* Original value of the <a href="http://wiki.openstreetmap.org/wiki/Key:mtb:scale"><code>mtb:scale</code></a> tag
* (highways only).
*/
public static final String MTB_SCALE = "mtb_scale";
/**
* Values of <a href="https://wiki.openstreetmap.org/wiki/Key:surface"><code>surface</code></a> tag devided into 2
* groups <code>paved</code> (paved, asphalt, cobblestone, concrete, concrete:lanes, concrete:plates, metal,
* paving_stones, sett, unhewn_cobblestone, wood) and <code>unpaved</code> (unpaved, compacted, dirt, earth,
* fine_gravel, grass, grass_paver, gravel, gravel_turf, ground, ice, mud, pebblestone, salt, sand, snow,
* woodchips).
* <p>
* allowed values:
* <ul>
* <li>"paved"
* <li>"unpaved"
* </ul>
*/
public static final String SURFACE = "surface";
}
/** Attribute values for map elements in the transportation layer. */
final class FieldValues {
public static final String CLASS_MOTORWAY = "motorway";
public static final String CLASS_TRUNK = "trunk";
public static final String CLASS_PRIMARY = "primary";
public static final String CLASS_SECONDARY = "secondary";
public static final String CLASS_TERTIARY = "tertiary";
public static final String CLASS_MINOR = "minor";
public static final String CLASS_PATH = "path";
public static final String CLASS_SERVICE = "service";
public static final String CLASS_TRACK = "track";
public static final String CLASS_RACEWAY = "raceway";
public static final String CLASS_BUSWAY = "busway";
public static final String CLASS_BUS_GUIDEWAY = "bus_guideway";
public static final String CLASS_FERRY = "ferry";
public static final String CLASS_MOTORWAY_CONSTRUCTION = "motorway_construction";
public static final String CLASS_TRUNK_CONSTRUCTION = "trunk_construction";
public static final String CLASS_PRIMARY_CONSTRUCTION = "primary_construction";
public static final String CLASS_SECONDARY_CONSTRUCTION = "secondary_construction";
public static final String CLASS_TERTIARY_CONSTRUCTION = "tertiary_construction";
public static final String CLASS_MINOR_CONSTRUCTION = "minor_construction";
public static final String CLASS_PATH_CONSTRUCTION = "path_construction";
public static final String CLASS_SERVICE_CONSTRUCTION = "service_construction";
public static final String CLASS_TRACK_CONSTRUCTION = "track_construction";
public static final String CLASS_RACEWAY_CONSTRUCTION = "raceway_construction";
public static final Set<String> CLASS_VALUES =
Set.of("motorway", "trunk", "primary", "secondary", "tertiary", "minor", "path", "service", "track", "raceway",
"busway", "bus_guideway", "ferry", "motorway_construction", "trunk_construction", "primary_construction",
"secondary_construction", "tertiary_construction", "minor_construction", "path_construction",
"service_construction", "track_construction", "raceway_construction");
public static final String SUBCLASS_RAIL = "rail";
public static final String SUBCLASS_NARROW_GAUGE = "narrow_gauge";
public static final String SUBCLASS_PRESERVED = "preserved";
public static final String SUBCLASS_FUNICULAR = "funicular";
public static final String SUBCLASS_SUBWAY = "subway";
public static final String SUBCLASS_LIGHT_RAIL = "light_rail";
public static final String SUBCLASS_MONORAIL = "monorail";
public static final String SUBCLASS_TRAM = "tram";
public static final String SUBCLASS_PEDESTRIAN = "pedestrian";
public static final String SUBCLASS_PATH = "path";
public static final String SUBCLASS_FOOTWAY = "footway";
public static final String SUBCLASS_CYCLEWAY = "cycleway";
public static final String SUBCLASS_STEPS = "steps";
public static final String SUBCLASS_BRIDLEWAY = "bridleway";
public static final String SUBCLASS_CORRIDOR = "corridor";
public static final String SUBCLASS_PLATFORM = "platform";
public static final String SUBCLASS_FERRY = "ferry";
public static final Set<String> SUBCLASS_VALUES =
Set.of("rail", "narrow_gauge", "preserved", "funicular", "subway", "light_rail", "monorail", "tram",
"pedestrian", "path", "footway", "cycleway", "steps", "bridleway", "corridor", "platform", "ferry");
public static final String BRUNNEL_BRIDGE = "bridge";
public static final String BRUNNEL_TUNNEL = "tunnel";
public static final String BRUNNEL_FORD = "ford";
public static final Set<String> BRUNNEL_VALUES = Set.of("bridge", "tunnel", "ford");
public static final String SERVICE_SPUR = "spur";
public static final String SERVICE_YARD = "yard";
public static final String SERVICE_SIDING = "siding";
public static final String SERVICE_CROSSOVER = "crossover";
public static final String SERVICE_DRIVEWAY = "driveway";
public static final String SERVICE_ALLEY = "alley";
public static final String SERVICE_PARKING_AISLE = "parking_aisle";
public static final Set<String> SERVICE_VALUES =
Set.of("spur", "yard", "siding", "crossover", "driveway", "alley", "parking_aisle");
public static final String SURFACE_PAVED = "paved";
public static final String SURFACE_UNPAVED = "unpaved";
public static final Set<String> SURFACE_VALUES = Set.of("paved", "unpaved");
}
/** Complex mappings to generate attribute values from OSM element tags in the transportation layer. */
final class FieldMappings {
public static final MultiExpression<String> Class = MultiExpression.of(List.of(
MultiExpression.entry("motorway", matchAny("highway", "motorway", "motorway_link")),
MultiExpression.entry("trunk", matchAny("highway", "trunk", "trunk_link")),
MultiExpression.entry("primary", matchAny("highway", "primary", "primary_link")),
MultiExpression.entry("secondary", matchAny("highway", "secondary", "secondary_link")),
MultiExpression.entry("tertiary", matchAny("highway", "tertiary", "tertiary_link")),
MultiExpression.entry("minor", matchAny("highway", "unclassified", "residential", "living_street", "road")),
MultiExpression.entry("path",
or(matchAny("highway", "pedestrian", "path", "footway", "cycleway", "steps", "bridleway", "corridor"),
matchAny("public_transport", "platform"))),
MultiExpression.entry("service", matchAny("highway", "service")),
MultiExpression.entry("track", matchAny("highway", "track")),
MultiExpression.entry("raceway", matchAny("highway", "raceway")),
MultiExpression.entry("busway", matchAny("highway", "busway")),
MultiExpression.entry("bus_guideway", matchAny("highway", "bus_guideway")),
MultiExpression.entry("ferry", matchAny("highway", "shipway")),
MultiExpression.entry("motorway_construction",
and(matchAny("highway", "construction"), matchAny("construction", "motorway", "motorway_link"))),
MultiExpression.entry("trunk_construction",
and(matchAny("highway", "construction"), matchAny("construction", "trunk", "trunk_link"))),
MultiExpression.entry("primary_construction",
and(matchAny("highway", "construction"), matchAny("construction", "primary", "primary_link"))),
MultiExpression.entry("secondary_construction",
and(matchAny("highway", "construction"), matchAny("construction", "secondary", "secondary_link"))),
MultiExpression.entry("tertiary_construction",
and(matchAny("highway", "construction"), matchAny("construction", "tertiary", "tertiary_link"))),
MultiExpression.entry("minor_construction",
and(matchAny("highway", "construction"),
matchAny("construction", "", "unclassified", "residential", "living_street", "road"))),
MultiExpression.entry("path_construction",
and(matchAny("highway", "construction"),
or(matchAny("construction", "pedestrian", "path", "footway", "cycleway", "steps", "bridleway", "corridor"),
matchAny("public_transport", "platform")))),
MultiExpression.entry("service_construction",
and(matchAny("highway", "construction"), matchAny("construction", "service"))),
MultiExpression.entry("track_construction",
and(matchAny("highway", "construction"), matchAny("construction", "track"))),
MultiExpression.entry("raceway_construction",
and(matchAny("highway", "construction"), matchAny("construction", "raceway")))));
}
}
/**
* All <a href="http://wiki.openstreetmap.org/wiki/Buildings">OSM Buildings</a>. All building tags are imported
* (<a href="http://wiki.openstreetmap.org/wiki/Key:building"><code>building= </code></a>). Only buildings with tag
* location:underground are excluded.
*
* Generated from
* <a href="https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/building/building.yaml">building.yaml</a>
*/
public interface Building extends Layer {
double BUFFER_SIZE = 4.0;
String LAYER_NAME = "building";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the building layer. */
final class Fields {
/** An approximated height from levels and height of the building or building:part. */
public static final String RENDER_HEIGHT = "render_height";
/**
* An approximated height from minimum levels or minimum height of the bottom of the building or building:part.
*/
public static final String RENDER_MIN_HEIGHT = "render_min_height";
/** Colour */
public static final String COLOUR = "colour";
/**
* If True, building (part) should not be rendered in 3D. Currently,
* <a href="https://wiki.openstreetmap.org/wiki/Simple_3D_buildings">building outlines</a> are marked as hide_3d.
*/
public static final String HIDE_3D = "hide_3d";
}
/** Attribute values for map elements in the building layer. */
final class FieldValues {
}
/** Complex mappings to generate attribute values from OSM element tags in the building layer. */
final class FieldMappings {
}
}
/**
* Lake center lines for labelling lake bodies. This is based of the
* <a href="https://github.com/openmaptiles/osm-lakelines">osm-lakelines</a> project which derives nice centerlines
* from OSM water bodies. Only the most important lakes contain labels.
*
* Generated from <a href=
* "https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/water_name/water_name.yaml">water_name.yaml</a>
*/
public interface WaterName extends Layer {
double BUFFER_SIZE = 256.0;
String LAYER_NAME = "water_name";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the water_name layer. */
final class Fields {
/**
* The OSM <a href="http://wiki.openstreetmap.org/wiki/Key:name"><code>name</code></a> value of the water body.
* Language-specific values are in <code>name:xx</code>.
*/
public static final String NAME = "name";
/**
* English name <code>name:en</code> if available, otherwise <code>name</code>. This is deprecated and will be
* removed in a future release in favor of <code>name:en</code>.
*/
public static final String NAME_EN = "name_en";
/**
* German name <code>name:de</code> if available, otherwise <code>name</code> or <code>name:en</code>. This is
* deprecated and will be removed in a future release in favor of <code>name:de</code>.
*/
public static final String NAME_DE = "name_de";
/**
* Distinguish between <code>lake</code>, <code>ocean</code>, <code>bay</code>, <code>strait</code>, and
* <code>sea</code>.
* <p>
* allowed values:
* <ul>
* <li>"lake"
* <li>"bay"
* <li>"strait"
* <li>"sea"
* <li>"ocean"
* </ul>
*/
public static final String CLASS = "class";
/**
* Mark with <code>1</code> if it is an
* <a href="http://wiki.openstreetmap.org/wiki/Key:intermittent">intermittent</a> lake.
* <p>
* allowed values:
* <ul>
* <li>0
* <li>1
* </ul>
*/
public static final String INTERMITTENT = "intermittent";
}
/** Attribute values for map elements in the water_name layer. */
final class FieldValues {
public static final String CLASS_LAKE = "lake";
public static final String CLASS_BAY = "bay";
public static final String CLASS_STRAIT = "strait";
public static final String CLASS_SEA = "sea";
public static final String CLASS_OCEAN = "ocean";
public static final Set<String> CLASS_VALUES = Set.of("lake", "bay", "strait", "sea", "ocean");
}
/** Complex mappings to generate attribute values from OSM element tags in the water_name layer. */
final class FieldMappings {
}
}
/**
* This is the layer for labelling the highways. Only highways that are named <code>name= </code> and are long enough
* to place text upon appear. The OSM roads are stitched together if they contain the same name to have better label
* placement than having many small linestrings. For motorways you should use the <code>ref</code> field to label them
* while for other roads you should use <code>name</code>.
*
* Generated from <a href=
* "https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/transportation_name/transportation_name.yaml">transportation_name.yaml</a>
*/
public interface TransportationName extends Layer {
double BUFFER_SIZE = 8.0;
String LAYER_NAME = "transportation_name";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the transportation_name layer. */
final class Fields {
/**
* The OSM <a href="http://wiki.openstreetmap.org/wiki/Highways#Names_and_references"><code>name</code></a> value
* of the highway.
*/
public static final String NAME = "name";
/**
* English name <code>name:en</code> if available, otherwise <code>name</code>. This is deprecated and will be
* removed in a future release in favor of <code>name:en</code>.
*/
public static final String NAME_EN = "name_en";
/**
* German name <code>name:de</code> if available, otherwise <code>name</code> or <code>name:en</code>. This is
* deprecated and will be removed in a future release in favor of <code>name:de</code>.
*/
public static final String NAME_DE = "name_de";
/**
* The OSM <a href="http://wiki.openstreetmap.org/wiki/Key:ref"><code>ref</code></a> tag of the motorway or its
* network.
*/
public static final String REF = "ref";
/** Length of the <code>ref</code> field. Useful for having a shield icon as background for labeling motorways. */
public static final String REF_LENGTH = "ref_length";
/**
* The network type derived mainly from
* <a href="http://wiki.openstreetmap.org/wiki/Key:network"><code>network</code></a> tag of the road. See more
* info about <a href="http://wiki.openstreetmap.org/wiki/Road_signs_in_the_United_States"><code>us- </code></a>,
* <a href="https://en.wikipedia.org/wiki/Trans-Canada_Highway"><code>ca-transcanada</code></a>, or
* <a href="http://wiki.openstreetmap.org/wiki/United_Kingdom_Tagging_Guidelines#UK_roads"><code>gb- </code></a>.
* <p>
* allowed values:
* <ul>
* <li>"us-interstate"
* <li>"us-highway"
* <li>"us-state"
* <li>"ca-transcanada"
* <li>"ca-provincial-arterial"
* <li>"ca-provincial"
* <li>"gb-motorway"
* <li>"gb-trunk"
* <li>"gb-primary"
* <li>"ie-motorway"
* <li>"ie-national"
* <li>"ie-regional"
* <li>"road (default)"
* </ul>
*/
public static final String NETWORK = "network";
/**
* Distinguish between more and less important roads and roads under construction.
* <p>
* allowed values:
* <ul>
* <li>"motorway"
* <li>"trunk"
* <li>"primary"
* <li>"secondary"
* <li>"tertiary"
* <li>"minor"
* <li>"service"
* <li>"track"
* <li>"path"
* <li>"raceway"
* <li>"motorway_construction"
* <li>"trunk_construction"
* <li>"primary_construction"
* <li>"secondary_construction"
* <li>"tertiary_construction"
* <li>"minor_construction"
* <li>"service_construction"
* <li>"track_construction"
* <li>"path_construction"
* <li>"raceway_construction"
* <li>"rail"
* <li>"transit"
* <li>"motorway_junction"
* </ul>
*/
public static final String CLASS = "class";
/**
* Distinguish more specific classes of path: Subclass is value of the
* <a href="http://wiki.openstreetmap.org/wiki/Key:highway"><code>highway</code></a> (for paths), and
* "junction" for
* <a href="http://wiki.openstreetmap.org/wiki/Tag:highway=motorway_junction"><code>motorway junctions</code></a>.
* <p>
* allowed values:
* <ul>
* <li>"pedestrian"
* <li>"path"
* <li>"footway"
* <li>"cycleway"
* <li>"steps"
* <li>"bridleway"
* <li>"corridor"
* <li>"platform"
* <li>"junction"
* </ul>
*/
public static final String SUBCLASS = "subclass";
/**
* Mark whether way is a bridge, a tunnel or a ford.
* <p>
* allowed values:
* <ul>
* <li>"bridge"
* <li>"tunnel"
* <li>"ford"
* </ul>
*/
public static final String BRUNNEL = "brunnel";
/**
* Experimental feature! Filled only for steps and footways. Original value of
* <a href="http://wiki.openstreetmap.org/wiki/Key:level"><code>level</code></a> tag.
*/
public static final String LEVEL = "level";
/**
* Experimental feature! Filled only for steps and footways. Original value of
* <a href="http://wiki.openstreetmap.org/wiki/Key:layer"><code>layer</code></a> tag.
*/
public static final String LAYER = "layer";
/**
* Experimental feature! Filled only for steps and footways. Original value of
* <a href="http://wiki.openstreetmap.org/wiki/Key:indoor"><code>indoor</code></a> tag.
* <p>
* allowed values:
* <ul>
* <li>1
* </ul>
*/
public static final String INDOOR = "indoor";
/** 1st route concurrency network. */
public static final String ROUTE_1_NETWORK = "route_1_network";
/** 1st route concurrency ref. */
public static final String ROUTE_1_REF = "route_1_ref";
/** 1st route concurrency name. */
public static final String ROUTE_1_NAME = "route_1_name";
/** 1st route concurrency colour. */
public static final String ROUTE_1_COLOUR = "route_1_colour";
/** 2nd route concurrency network. */
public static final String ROUTE_2_NETWORK = "route_2_network";
/** 2nd route concurrency ref. */
public static final String ROUTE_2_REF = "route_2_ref";
/** 2nd route concurrency name. */
public static final String ROUTE_2_NAME = "route_2_name";
/** 2nd route concurrency colour. */
public static final String ROUTE_2_COLOUR = "route_2_colour";
/** 3rd route concurrency network. */
public static final String ROUTE_3_NETWORK = "route_3_network";
/** 3rd route concurrency ref. */
public static final String ROUTE_3_REF = "route_3_ref";
/** 3rd route concurrency name. */
public static final String ROUTE_3_NAME = "route_3_name";
/** 3rd route concurrency colour. */
public static final String ROUTE_3_COLOUR = "route_3_colour";
/** 4th route concurrency network. */
public static final String ROUTE_4_NETWORK = "route_4_network";
/** 4th route concurrency ref. */
public static final String ROUTE_4_REF = "route_4_ref";
/** 4th route concurrency name. */
public static final String ROUTE_4_NAME = "route_4_name";
/** 4th route concurrency colour. */
public static final String ROUTE_4_COLOUR = "route_4_colour";
/** 5th route concurrency network. */
public static final String ROUTE_5_NETWORK = "route_5_network";
/** 5th route concurrency ref. */
public static final String ROUTE_5_REF = "route_5_ref";
/** 5th route concurrency name. */
public static final String ROUTE_5_NAME = "route_5_name";
/** 5th route concurrency colour. */
public static final String ROUTE_5_COLOUR = "route_5_colour";
/** 6th route concurrency network. */
public static final String ROUTE_6_NETWORK = "route_6_network";
/** 6th route concurrency ref. */
public static final String ROUTE_6_REF = "route_6_ref";
/** 6th route concurrency name. */
public static final String ROUTE_6_NAME = "route_6_name";
/** 6th route concurrency colour. */
public static final String ROUTE_6_COLOUR = "route_6_colour";
}
/** Attribute values for map elements in the transportation_name layer. */
final class FieldValues {
public static final String NETWORK_US_INTERSTATE = "us-interstate";
public static final String NETWORK_US_HIGHWAY = "us-highway";
public static final String NETWORK_US_STATE = "us-state";
public static final String NETWORK_CA_TRANSCANADA = "ca-transcanada";
public static final String NETWORK_CA_PROVINCIAL_ARTERIAL = "ca-provincial-arterial";
public static final String NETWORK_CA_PROVINCIAL = "ca-provincial";
public static final String NETWORK_GB_MOTORWAY = "gb-motorway";
public static final String NETWORK_GB_TRUNK = "gb-trunk";
public static final String NETWORK_GB_PRIMARY = "gb-primary";
public static final String NETWORK_IE_MOTORWAY = "ie-motorway";
public static final String NETWORK_IE_NATIONAL = "ie-national";
public static final String NETWORK_IE_REGIONAL = "ie-regional";
public static final String NETWORK_ROAD = "road";
public static final Set<String> NETWORK_VALUES =
Set.of("us-interstate", "us-highway", "us-state", "ca-transcanada", "ca-provincial-arterial", "ca-provincial",
"gb-motorway", "gb-trunk", "gb-primary", "ie-motorway", "ie-national", "ie-regional", "road");
public static final String CLASS_MOTORWAY = "motorway";
public static final String CLASS_TRUNK = "trunk";
public static final String CLASS_PRIMARY = "primary";
public static final String CLASS_SECONDARY = "secondary";
public static final String CLASS_TERTIARY = "tertiary";
public static final String CLASS_MINOR = "minor";
public static final String CLASS_SERVICE = "service";
public static final String CLASS_TRACK = "track";
public static final String CLASS_PATH = "path";
public static final String CLASS_RACEWAY = "raceway";
public static final String CLASS_MOTORWAY_CONSTRUCTION = "motorway_construction";
public static final String CLASS_TRUNK_CONSTRUCTION = "trunk_construction";
public static final String CLASS_PRIMARY_CONSTRUCTION = "primary_construction";
public static final String CLASS_SECONDARY_CONSTRUCTION = "secondary_construction";
public static final String CLASS_TERTIARY_CONSTRUCTION = "tertiary_construction";
public static final String CLASS_MINOR_CONSTRUCTION = "minor_construction";
public static final String CLASS_SERVICE_CONSTRUCTION = "service_construction";
public static final String CLASS_TRACK_CONSTRUCTION = "track_construction";
public static final String CLASS_PATH_CONSTRUCTION = "path_construction";
public static final String CLASS_RACEWAY_CONSTRUCTION = "raceway_construction";
public static final String CLASS_RAIL = "rail";
public static final String CLASS_TRANSIT = "transit";
public static final String CLASS_MOTORWAY_JUNCTION = "motorway_junction";
public static final Set<String> CLASS_VALUES =
Set.of("motorway", "trunk", "primary", "secondary", "tertiary", "minor", "service", "track", "path", "raceway",
"motorway_construction", "trunk_construction", "primary_construction", "secondary_construction",
"tertiary_construction", "minor_construction", "service_construction", "track_construction",
"path_construction", "raceway_construction", "rail", "transit", "motorway_junction");
public static final String SUBCLASS_PEDESTRIAN = "pedestrian";
public static final String SUBCLASS_PATH = "path";
public static final String SUBCLASS_FOOTWAY = "footway";
public static final String SUBCLASS_CYCLEWAY = "cycleway";
public static final String SUBCLASS_STEPS = "steps";
public static final String SUBCLASS_BRIDLEWAY = "bridleway";
public static final String SUBCLASS_CORRIDOR = "corridor";
public static final String SUBCLASS_PLATFORM = "platform";
public static final String SUBCLASS_JUNCTION = "junction";
public static final Set<String> SUBCLASS_VALUES =
Set.of("pedestrian", "path", "footway", "cycleway", "steps", "bridleway", "corridor", "platform", "junction");
public static final String BRUNNEL_BRIDGE = "bridge";
public static final String BRUNNEL_TUNNEL = "tunnel";
public static final String BRUNNEL_FORD = "ford";
public static final Set<String> BRUNNEL_VALUES = Set.of("bridge", "tunnel", "ford");
}
/** Complex mappings to generate attribute values from OSM element tags in the transportation_name layer. */
final class FieldMappings {
}
}
/**
* The place layer consists out of <a href="http://wiki.openstreetmap.org/wiki/Tag:place%3Dcountry">countries</a>,
* <a href="http://wiki.openstreetmap.org/wiki/Tag:place%3Dstate">states</a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:place">cities</a> and
* <a href="https://wiki.openstreetmap.org/wiki/Tag:place%3Disland">islands</a>. Apart from the roads this is also one
* of the more important layers to create a beautiful map. We suggest you use different font styles and sizes to
* create a text hierarchy.
*
* Generated from
* <a href="https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/place/place.yaml">place.yaml</a>
*/
public interface Place extends Layer {
double BUFFER_SIZE = 256.0;
String LAYER_NAME = "place";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the place layer. */
final class Fields {
/**
* The OSM <a href="http://wiki.openstreetmap.org/wiki/Key:name"><code>name</code></a> value of the place.
* Language-specific values are in <code>name:xx</code>.
*/
public static final String NAME = "name";
/**
* English name <code>name:en</code> if available, otherwise <code>name</code>. This is deprecated and will be
* removed in a future release in favor of <code>name:en</code>.
*/
public static final String NAME_EN = "name_en";
/**
* German name <code>name:de</code> if available, otherwise <code>name</code> or <code>name:en</code>. This is
* deprecated and will be removed in a future release in favor of <code>name:de</code>.
*/
public static final String NAME_DE = "name_de";
/**
* The <strong>capital</strong> field marks the <a href=
* "http://wiki.openstreetmap.org/wiki/Tag:boundary%3Dadministrative#admin_level"><code>admin_level</code></a> of
* the boundary the place is a capital of.
* <p>
* allowed values:
* <ul>
* <li>2
* <li>3
* <li>4
* <li>5
* <li>6
* </ul>
*/
public static final String CAPITAL = "capital";
/**
* Original value of the <a href="http://wiki.openstreetmap.org/wiki/Key:place"><code>place</code></a> tag.
* Distinguish between continents, countries, states, islands and places like settlements or smaller entities. Use
* <strong>class</strong> to separately style the different places and build a text hierarchy according to their
* importance. For places derived from boundaries, the original value of the
* <a href="http://wiki.openstreetmap.org/wiki/Key:boundary"><code>boundary</code></a> tag.
* <p>
* allowed values:
* <ul>
* <li>"continent"
* <li>"country"
* <li>"state"
* <li>"province"
* <li>"city"
* <li>"town"
* <li>"village"
* <li>"hamlet"
* <li>"borough"
* <li>"suburb"
* <li>"quarter"
* <li>"neighbourhood"
* <li>"isolated_dwelling"
* <li>"island"
* <li>"aboriginal_lands"
* </ul>
*/
public static final String CLASS = "class";
/**
* Two-letter country code <a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>.
* Available only for <code>class=country</code>. Original value of the <a href=
* "http://wiki.openstreetmap.org/wiki/Tag:place%3Dcountry"><code>country_code_iso3166_1_alpha_2</code></a> tag.
*/
public static final String ISO_A2 = "iso_a2";
/**
* Countries, states and the most important cities all have a <strong>rank</strong> to boost their importance on
* the map. The <strong>rank</strong> field for countries and states ranges from <code>1</code> to <code>6</code>
* while the <strong>rank</strong> field for cities ranges from <code>1</code> to <code>10</code> for the most
* important cities and continues from <code>10</code> serially based on the local importance of the city (derived
* from population and city class). You can use the <strong>rank</strong> to limit density of labels or improve
* the text hierarchy. The rank value is a combination of the Natural Earth <code>scalerank</code>,
* <code>labelrank</code> and <code>datarank</code> values for countries and states and for cities consists out of
* a shifted Natural Earth <code>scalerank</code> combined with a local rank within a grid for cities that do not
* have a Natural Earth <code>scalerank</code>.
*/
public static final String RANK = "rank";
}
/** Attribute values for map elements in the place layer. */
final class FieldValues {
public static final String CLASS_CONTINENT = "continent";
public static final String CLASS_COUNTRY = "country";
public static final String CLASS_STATE = "state";
public static final String CLASS_PROVINCE = "province";
public static final String CLASS_CITY = "city";
public static final String CLASS_TOWN = "town";
public static final String CLASS_VILLAGE = "village";
public static final String CLASS_HAMLET = "hamlet";
public static final String CLASS_BOROUGH = "borough";
public static final String CLASS_SUBURB = "suburb";
public static final String CLASS_QUARTER = "quarter";
public static final String CLASS_NEIGHBOURHOOD = "neighbourhood";
public static final String CLASS_ISOLATED_DWELLING = "isolated_dwelling";
public static final String CLASS_ISLAND = "island";
public static final String CLASS_ABORIGINAL_LANDS = "aboriginal_lands";
public static final Set<String> CLASS_VALUES =
Set.of("continent", "country", "state", "province", "city", "town", "village", "hamlet", "borough", "suburb",
"quarter", "neighbourhood", "isolated_dwelling", "island", "aboriginal_lands");
}
/** Complex mappings to generate attribute values from OSM element tags in the place layer. */
final class FieldMappings {
}
}
/**
* Everything in OpenStreetMap which contains a <code>addr:housenumber</code> tag useful for labelling housenumbers on
* a map. This adds significant size to <em>z14</em>. For buildings the centroid of the building is used as
* housenumber. Duplicates within a tile are dropped if they have the same street/block_number (records without name
* tag are prioritized for preservation).
*
* Generated from <a href=
* "https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/housenumber/housenumber.yaml">housenumber.yaml</a>
*/
public interface Housenumber extends Layer {
double BUFFER_SIZE = 8.0;
String LAYER_NAME = "housenumber";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the housenumber layer. */
final class Fields {
/**
* Value of the <a href="http://wiki.openstreetmap.org/wiki/Key:addr"><code>addr:housenumber</code></a> tag. If
* there are multiple values separated by semi-colons, the first and last value separated by a dash.
*/
public static final String HOUSENUMBER = "housenumber";
}
/** Attribute values for map elements in the housenumber layer. */
final class FieldValues {
}
/** Complex mappings to generate attribute values from OSM element tags in the housenumber layer. */
final class FieldMappings {
}
}
/**
* <a href="http://wiki.openstreetmap.org/wiki/Points_of_interest">Points of interests</a> containing a of a variety
* of OpenStreetMap tags. Mostly contains amenities, sport, shop and tourist POIs.
*
* Generated from <a href="https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/poi/poi.yaml">poi.yaml</a>
*/
public interface Poi extends Layer {
double BUFFER_SIZE = 64.0;
String LAYER_NAME = "poi";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the poi layer. */
final class Fields {
/**
* The OSM <a href="http://wiki.openstreetmap.org/wiki/Key:name"><code>name</code></a> value of the POI.
* Language-specific values are in <code>name:xx</code>.
*/
public static final String NAME = "name";
/**
* English name <code>name:en</code> if available, otherwise <code>name</code>. This is deprecated and will be
* removed in a future release in favor of <code>name:en</code>.
*/
public static final String NAME_EN = "name_en";
/**
* German name <code>name:de</code> if available, otherwise <code>name</code> or <code>name:en</code>. This is
* deprecated and will be removed in a future release in favor of <code>name:de</code>.
*/
public static final String NAME_DE = "name_de";
/**
* More general classes of POIs. If there is no more general <code>class</code> for the <code>subclass</code> this
* field will contain the same value as <code>subclass</code>. But for example for schools you only need to style
* the class <code>school</code> to filter the subclasses <code>school</code> and <code>kindergarten</code>. Or
* use the class <code>shop</code> to style all shops.
* <p>
* allowed values:
* <ul>
* <li>shop
* <li>office
* <li>town_hall
* <li>golf
* <li>fast_food
* <li>park
* <li>bus
* <li>railway
* <li>aerialway
* <li>entrance
* <li>campsite
* <li>laundry
* <li>grocery
* <li>library
* <li>college
* <li>lodging
* <li>ice_cream
* <li>post
* <li>cafe
* <li>school
* <li>alcohol_shop
* <li>bar
* <li>harbor
* <li>car
* <li>hospital
* <li>cemetery
* <li>attraction
* <li>beer
* <li>music
* <li>stadium
* <li>art_gallery
* <li>clothing_store
* <li>swimming
* <li>castle
* <li>atm
* <li>fuel
* </ul>
*/
public static final String CLASS = "class";
/**
* Original value of either the <a href="http://wiki.openstreetmap.org/wiki/Key:amenity"><code>amenity</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:barrier"><code>barrier</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:historic"><code>historic</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:information"><code>information</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:landuse"><code>landuse</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:leisure"><code>leisure</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:railway"><code>railway</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:shop"><code>shop</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:sport"><code>sport</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:station"><code>station</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:religion"><code>religion</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:tourism"><code>tourism</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:aerialway"><code>aerialway</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:building"><code>building</code></a>,
* <a href="http://wiki.openstreetmap.org/wiki/Key:highway"><code>highway</code></a>,
* <a href="https://wiki.openstreetmap.org/wiki/Key:office"><code>office</code></a> or
* <a href="http://wiki.openstreetmap.org/wiki/Key:waterway"><code>waterway</code></a> tag. Use this to do more
* precise styling.
*/
public static final String SUBCLASS = "subclass";
/**
* The POIs are ranked ascending according to their importance within a grid. The <code>rank</code> value shows
* the local relative importance of a POI within it's cell in the grid. This can be used to reduce label density
* at <em>z14</em>. Since all POIs already need to be contained at <em>z14</em> you can use
* <code>less than rank=10</code> epxression to limit POIs. At some point like <em>z17</em> you can show all POIs.
*/
public static final String RANK = "rank";
/**
* Experimental feature! Indicates main platform of public transport stops (buses, trams, and subways). Grouping
* of platforms is implemented using
* <a href="http://wiki.openstreetmap.org/wiki/Key:uic_ref"><code>uic_ref</code></a> tag that is not used
* worldwide.
* <p>
* allowed values:
* <ul>
* <li>1
* </ul>
*/
public static final String AGG_STOP = "agg_stop";
/** Original value of <a href="http://wiki.openstreetmap.org/wiki/Key:level"><code>level</code></a> tag. */
public static final String LEVEL = "level";
/** Original value of <a href="http://wiki.openstreetmap.org/wiki/Key:layer"><code>layer</code></a> tag. */
public static final String LAYER = "layer";
/**
* Original value of <a href="http://wiki.openstreetmap.org/wiki/Key:indoor"><code>indoor</code></a> tag.
* <p>
* allowed values:
* <ul>
* <li>1
* </ul>
*/
public static final String INDOOR = "indoor";
}
/** Attribute values for map elements in the poi layer. */
final class FieldValues {
public static final String CLASS_SHOP = "shop";
public static final String CLASS_OFFICE = "office";
public static final String CLASS_TOWN_HALL = "town_hall";
public static final String CLASS_GOLF = "golf";
public static final String CLASS_FAST_FOOD = "fast_food";
public static final String CLASS_PARK = "park";
public static final String CLASS_BUS = "bus";
public static final String CLASS_RAILWAY = "railway";
public static final String CLASS_AERIALWAY = "aerialway";
public static final String CLASS_ENTRANCE = "entrance";
public static final String CLASS_CAMPSITE = "campsite";
public static final String CLASS_LAUNDRY = "laundry";
public static final String CLASS_GROCERY = "grocery";
public static final String CLASS_LIBRARY = "library";
public static final String CLASS_COLLEGE = "college";
public static final String CLASS_LODGING = "lodging";
public static final String CLASS_ICE_CREAM = "ice_cream";
public static final String CLASS_POST = "post";
public static final String CLASS_CAFE = "cafe";
public static final String CLASS_SCHOOL = "school";
public static final String CLASS_ALCOHOL_SHOP = "alcohol_shop";
public static final String CLASS_BAR = "bar";
public static final String CLASS_HARBOR = "harbor";
public static final String CLASS_CAR = "car";
public static final String CLASS_HOSPITAL = "hospital";
public static final String CLASS_CEMETERY = "cemetery";
public static final String CLASS_ATTRACTION = "attraction";
public static final String CLASS_BEER = "beer";
public static final String CLASS_MUSIC = "music";
public static final String CLASS_STADIUM = "stadium";
public static final String CLASS_ART_GALLERY = "art_gallery";
public static final String CLASS_CLOTHING_STORE = "clothing_store";
public static final String CLASS_SWIMMING = "swimming";
public static final String CLASS_CASTLE = "castle";
public static final String CLASS_ATM = "atm";
public static final String CLASS_FUEL = "fuel";
public static final Set<String> CLASS_VALUES = Set.of("shop", "office", "town_hall", "golf", "fast_food", "park",
"bus", "railway", "aerialway", "entrance", "campsite", "laundry", "grocery", "library", "college", "lodging",
"ice_cream", "post", "cafe", "school", "alcohol_shop", "bar", "harbor", "car", "hospital", "cemetery",
"attraction", "beer", "music", "stadium", "art_gallery", "clothing_store", "swimming", "castle", "atm", "fuel");
}
/** Complex mappings to generate attribute values from OSM element tags in the poi layer. */
final class FieldMappings {
public static final MultiExpression<String> Class = MultiExpression.of(List.of(
MultiExpression.entry("shop",
matchAny("subclass", "accessories", "antiques", "beauty", "bed", "boutique", "camera", "carpet", "charity",
"chemist", "chocolate", "coffee", "computer", "convenience", "confectionery", "copyshop", "cosmetics",
"garden_centre", "doityourself", "erotic", "electronics", "fabric", "florist", "frozen_food", "furniture",
"video_games", "video", "general", "gift", "hardware", "hearing_aids", "hifi", "interior_decoration",
"jewelry", "kiosk", "locksmith", "lamps", "mall", "massage", "motorcycle", "mobile_phone", "newsagent",
"optician", "outdoor", "paint", "perfumery", "perfume", "pet", "photo", "second_hand", "shoes", "sports",
"stationery", "tailor", "tattoo", "ticket", "tobacco", "toys", "travel_agency", "watches", "weapons",
"wholesale")),
MultiExpression.entry("office",
matchAny("subclass", "accountant", "advertising_agency", "architect", "association", "bail_bond_agent",
"charity", "company", "construction_company", "consulting", "cooperative", "courier", "coworking",
"diplomatic", "educational_institution", "employment_agency", "energy_supplier", "engineer", "estate_agent",
"financial", "financial_advisor", "forestry", "foundation", "geodesist", "government", "graphic_design",
"guide", "harbour_master", "health_insurance", "insurance", "interior_design", "it", "lawyer", "logistics",
"marketing", "moving_company", "newspaper", "ngo", "notary", "physician", "political_party",
"private_investigator", "property_management", "publisher", "quango", "religion", "research", "security",
"surveyor", "tax_advisor", "taxi", "telecommunication", "therapist", "translator", "travel_agent",
"tutoring", "union", "university", "water_utility", "web_design", "wedding_planner")),
MultiExpression.entry("town_hall",
matchAny("subclass", "townhall", "public_building", "courthouse", "community_centre")),
MultiExpression.entry("golf", matchAny("subclass", "golf", "golf_course", "miniature_golf")),
MultiExpression.entry("fast_food", matchAny("subclass", "fast_food", "food_court")),
MultiExpression.entry("park", matchAny("subclass", "park", "bbq")),
MultiExpression.entry("bus", matchAny("subclass", "bus_stop", "bus_station")),
MultiExpression.entry("railway",
or(and(matchAny("subclass", "station"), matchAny("mapping_key", "railway")),
matchAny("subclass", "halt", "tram_stop", "subway"))),
MultiExpression.entry("aerialway", and(matchAny("subclass", "station"), matchAny("mapping_key", "aerialway"))),
MultiExpression.entry("entrance", matchAny("subclass", "subway_entrance", "train_station_entrance")),
MultiExpression.entry("campsite", matchAny("subclass", "camp_site", "caravan_site")),
MultiExpression.entry("laundry", matchAny("subclass", "laundry", "dry_cleaning")),
MultiExpression.entry("grocery",
matchAny("subclass", "supermarket", "deli", "delicatessen", "department_store", "greengrocer",
"marketplace")),
MultiExpression.entry("library", matchAny("subclass", "books", "library")),
MultiExpression.entry("college", matchAny("subclass", "university", "college")),
MultiExpression.entry("lodging",
matchAny("subclass", "hotel", "motel", "bed_and_breakfast", "guest_house", "hostel", "chalet", "alpine_hut",
"dormitory")),
MultiExpression.entry("ice_cream", matchAny("subclass", "ice_cream")),
MultiExpression.entry("post", matchAny("subclass", "post_box", "post_office", "parcel_locker")),
MultiExpression.entry("cafe", matchAny("subclass", "cafe")),
MultiExpression.entry("school", matchAny("subclass", "school", "kindergarten")),
MultiExpression.entry("alcohol_shop", matchAny("subclass", "alcohol", "beverages", "wine")),
MultiExpression.entry("bar", matchAny("subclass", "bar", "nightclub")),
MultiExpression.entry("harbor", matchAny("subclass", "marina", "dock")),
MultiExpression.entry("car", matchAny("subclass", "car", "car_repair", "car_parts", "taxi")),
MultiExpression.entry("hospital", matchAny("subclass", "hospital", "nursing_home", "clinic")),
MultiExpression.entry("cemetery", matchAny("subclass", "grave_yard", "cemetery")),
MultiExpression.entry("attraction", matchAny("subclass", "attraction", "viewpoint")),
MultiExpression.entry("beer", matchAny("subclass", "biergarten", "pub")),
MultiExpression.entry("music", matchAny("subclass", "music", "musical_instrument")),
MultiExpression.entry("stadium", matchAny("subclass", "american_football", "stadium", "soccer")),
MultiExpression.entry("art_gallery", matchAny("subclass", "art", "artwork", "gallery", "arts_centre")),
MultiExpression.entry("clothing_store", matchAny("subclass", "bag", "clothes")),
MultiExpression.entry("swimming", matchAny("subclass", "swimming_area", "swimming")),
MultiExpression.entry("castle", matchAny("subclass", "castle", "ruins")),
MultiExpression.entry("atm", matchAny("subclass", "atm")),
MultiExpression.entry("fuel", matchAny("subclass", "fuel", "charging_station"))));
}
}
/**
* <a href="http://wiki.openstreetmap.org/wiki/Tag:aeroway%3Daerodrome">Aerodrome labels</a>
*
* Generated from <a href=
* "https://github.com/openmaptiles/openmaptiles/blob/v3.15/layers/aerodrome_label/aerodrome_label.yaml">aerodrome_label.yaml</a>
*/
public interface AerodromeLabel extends Layer {
double BUFFER_SIZE = 64.0;
String LAYER_NAME = "aerodrome_label";
@Override
default String name() {
return LAYER_NAME;
}
/** Attribute names for map elements in the aerodrome_label layer. */
final class Fields {
/**
* The OSM <a href="http://wiki.openstreetmap.org/wiki/Key:name"><code>name</code></a> value of the aerodrome.
* Language-specific values are in <code>name:xx</code>.
*/
public static final String NAME = "name";
/**
* English name <code>name:en</code> if available, otherwise <code>name</code>. This is deprecated and will be
* removed in a future release in favor of <code>name:en</code>.
*/
public static final String NAME_EN = "name_en";
/**
* German name <code>name:de</code> if available, otherwise <code>name</code> or <code>name:en</code>. This is
* deprecated and will be removed in a future release in favor of <code>name:de</code>.
*/
public static final String NAME_DE = "name_de";
/**
* Distinguish between more and less important aerodromes. Class is derived from the value of
* <a href="http://wiki.openstreetmap.org/wiki/Proposed_features/Aerodrome"><code>aerodrome</code></a> and
* <code>aerodrome:type</code> tags.
* <p>
* allowed values:
* <ul>
* <li>international
* <li>public
* <li>regional
* <li>military
* <li>private
* <li>other
* </ul>
*/
public static final String CLASS = "class";
/** 3-character code issued by the IATA. */
public static final String IATA = "iata";
/** 4-letter code issued by the ICAO. */
public static final String ICAO = "icao";
/** Elevation (<code>ele</code>) in meters. */
public static final String ELE = "ele";
/** Elevation (<code>ele</code>) in feets. */
public static final String ELE_FT = "ele_ft";
}
/** Attribute values for map elements in the aerodrome_label layer. */
final class FieldValues {
public static final String CLASS_INTERNATIONAL = "international";
public static final String CLASS_PUBLIC = "public";
public static final String CLASS_REGIONAL = "regional";
public static final String CLASS_MILITARY = "military";
public static final String CLASS_PRIVATE = "private";
public static final String CLASS_OTHER = "other";
public static final Set<String> CLASS_VALUES =
Set.of("international", "public", "regional", "military", "private", "other");
}
/** Complex mappings to generate attribute values from OSM element tags in the aerodrome_label layer. */
final class FieldMappings {
public static final MultiExpression<String> Class = MultiExpression.of(List.of(
MultiExpression.entry("international",
or(matchAny("aerodrome", "international"), matchAny("aerodrome_type", "international"))),
MultiExpression.entry("public",
or(matchAny("aerodrome", "public"), matchAny("aerodrome_type", "%public%", "civil"))),
MultiExpression.entry("regional",
or(matchAny("aerodrome", "regional"), matchAny("aerodrome_type", "regional"))),
MultiExpression.entry("military",
or(matchAny("aerodrome", "military"), matchAny("aerodrome_type", "%military%"),
matchAny("military", "airfield"))),
MultiExpression.entry("private", or(matchAny("aerodrome", "private"), matchAny("aerodrome_type", "private"))),
MultiExpression.entry("other", FALSE)));
}
}
}
| openmaptiles/planetiler-openmaptiles | src/main/java/org/openmaptiles/generated/OpenMapTilesSchema.java |
213,085 | package growthcraft.cellar.shared.booze;
import growthcraft.cellar.shared.CellarRegistry;
import growthcraft.core.shared.CoreRegistry;
import growthcraft.core.shared.config.description.Describer;
import growthcraft.core.shared.fluids.UnitFormatter;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import javax.annotation.Nullable;
import java.util.List;
public class BoozeUtils {
private BoozeUtils() {
}
public static float alcoholToTipsy(float alcoholRate) {
return alcoholRate * 4;
}
public static boolean isFermentedBooze(Fluid booze) {
return CoreRegistry.instance().fluidDictionary().hasFluidTags(booze, BoozeTag.FERMENTED);
}
public static void addEffects(Fluid booze, ItemStack stack, World world, EntityPlayer player) {
if (booze == null) return;
final BoozeEffect effect = CellarRegistry.instance().booze().getEffect(booze);
if (effect != null) {
effect.apply(world, player, world.rand, null);
}
}
public static void addInformation(Fluid booze, ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
if (booze == null) return;
final String s = UnitFormatter.fluidModifier(booze);
if (s != null) tooltip.add(s);
Describer.getDescription(tooltip, booze);
}
public static void addEffectInformation(Fluid booze, ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
if (booze == null) return;
final BoozeEffect effect = CellarRegistry.instance().booze().getEffect(booze);
if (effect != null) {
effect.getDescription(tooltip);
}
}
public static void addBottleInformation(Fluid booze, ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn, boolean showDetailed) {
if (booze == null) return;
addInformation(booze, stack, worldIn, tooltip, flagIn);
if (showDetailed)
addEffectInformation(booze, stack, worldIn, tooltip, flagIn);
}
public static boolean hasEffect(Fluid booze) {
final BoozeEffect effect = CellarRegistry.instance().booze().getEffect(booze);
if (effect != null) return effect.isValid();
return false;
}
}
| GrowthcraftCE/Growthcraft-1.12 | src/main/java/growthcraft/cellar/shared/booze/BoozeUtils.java |
213,087 | package com.cezarykluczynski.stapi.model.food.dto;
import com.cezarykluczynski.stapi.model.common.dto.RequestSortDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode
public class FoodRequestDTO {
private String uid;
private String name;
private Boolean earthlyOrigin;
private Boolean dessert;
private Boolean fruit;
private Boolean herbOrSpice;
private Boolean sauce;
private Boolean soup;
private Boolean beverage;
private Boolean alcoholicBeverage;
private Boolean juice;
private Boolean tea;
private RequestSortDTO sort;
}
| cezarykluczynski/stapi | model/src/main/java/com/cezarykluczynski/stapi/model/food/dto/FoodRequestDTO.java |
213,088 | /*
fEMR - fast Electronic Medical Records
Copyright (C) 2014 Team fEMR
fEMR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
fEMR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with fEMR. If not, see <http://www.gnu.org/licenses/>. If
you have any questions, contact <[email protected]>.
*/
package femr.business.helpers;
import io.ebean.ExpressionList;
import io.ebean.Query;
import femr.data.daos.IRepository;
import femr.data.models.core.IPatient;
import femr.data.models.core.IPatientEncounterVital;
import femr.data.models.mysql.MissionCity;
import femr.data.models.mysql.Patient;
import femr.data.models.mysql.PatientEncounterVital;
import femr.data.models.core.IMissionCity;
import java.util.List;
public class QueryHelper {
public static Float findPatientWeight(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Float weight = null;
Query<PatientEncounterVital> query2 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "weight")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query2);
if (patientEncounterVitals.size() > 0) {
weight = patientEncounterVitals.get(0).getVitalValue();
}
return weight;
}
public static Integer findWeeksPregnant(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Integer weeks_pregnant = null;
Query<PatientEncounterVital> query2 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "weeksPregnant")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query2);
if (patientEncounterVitals.size() > 0) {
weeks_pregnant = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return weeks_pregnant;
}
public static Integer findPatientHeightFeet(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Integer heightFeet = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "heightFeet")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
heightFeet = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return heightFeet;
}
public static Integer findPatientHeightInches(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId) {
Integer heightInches = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "heightInches")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
heightInches = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return heightInches;
}
public static Integer findPatientSmoker(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId) {
Integer smoker = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "smoker")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
smoker = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return smoker;
}
public static Integer findPatientDiabetic(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Integer diabetic = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "diabetic")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
diabetic = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return diabetic;
}
public static Integer findPatientAlcohol(IRepository<IPatientEncounterVital> patientEncounterVitalRepository, int encounterId){
Integer alcohol = null;
Query<PatientEncounterVital> query1 = QueryProvider.getPatientEncounterVitalQuery()
.fetch("vital")
.where()
.eq("patient_encounter_id", encounterId)
.eq("vital.name", "alcohol")
.order().desc("date_taken");
List<? extends IPatientEncounterVital> patientEncounterVitals = patientEncounterVitalRepository.find(query1);
if (patientEncounterVitals.size() > 0) {
alcohol = Math.round(patientEncounterVitals.get(0).getVitalValue());
}
return alcohol;
}
/**
* AJ Saclayan
* Finds all cities*
*/
public static List<? extends IMissionCity> findCities(IRepository<IMissionCity> cityRepository){
return cityRepository.findAll(MissionCity.class);
}
}
| kevinzurek/femr | app/femr/business/helpers/QueryHelper.java |
213,089 | /*
* Author: Stefan Andritoiu <[email protected]>
* Copyright (c) 2015 Intel Corporation.
*
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
*/
public class MQ303A_Example {
public static void main(String[] args) throws InterruptedException {
// Instantiate an mq303a sensor on analog pin A0
// This device uses a heater powered from an analog I/O pin.
// If using A0 as the data pin, then you need to use A1, as the heater
// pin (if using a grove mq303a). For A1, we can use the D15 gpio,
// setup as an output, and drive it low to power the heater.
upm_mq303a.MQ303A mq303a = new upm_mq303a.MQ303A(1, 15);
System.out.println("Enabling heater and waiting 2 minutes for warmup.");
mq303a.heaterEnable(true);
Thread.sleep(120000);
System.out.println("This sensor may need to warm until the value drops below about 450.");
for (int i = 1; i < 10; i++) {
int val = mq303a.value();
System.out.println("Alcohol detected (higher means stronger alcohol): " + val);
Thread.sleep(1000);
}
mq303a.heaterEnable(false);
System.out.println("Exiting");
}
}
| eclipse/upm | examples/java/MQ303A_Example.java |
213,091 | /*
* Licensed under the EUPL, Version 1.2.
* You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*/
package net.dries007.tfc.common.fluids;
import java.util.*;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.material.Fluid;
import net.dries007.tfc.util.Metal;
// Merged enum
public record FluidId(String name, OptionalInt color, Supplier<? extends Fluid> fluid)
{
public static final FluidId SALT_WATER = new FluidId("salt_water", OptionalInt.empty(), TFCFluids.SALT_WATER.source());
public static final FluidId SPRING_WATER = new FluidId("spring_water", OptionalInt.empty(), TFCFluids.SPRING_WATER.source());
private static final Map<Enum<?>, FluidId> IDENTITY = new HashMap<>();
private static final List<FluidId> VALUES = Stream.of(
Stream.of(SALT_WATER, SPRING_WATER),
Arrays.stream(SimpleFluid.values()).map(fluid -> fromEnum(fluid, fluid.getColor(), fluid.getId(), TFCFluids.SIMPLE_FLUIDS.get(fluid).source())),
Arrays.stream(Alcohol.values()).map(fluid -> fromEnum(fluid, fluid.getColor(), fluid.getId(), TFCFluids.ALCOHOLS.get(fluid).source())),
Arrays.stream(DyeColor.values()).map(dye -> fromEnum(dye, TFCFluids.dyeColorToInt(dye), dye.getSerializedName() + "_dye", TFCFluids.COLORED_FLUIDS.get(dye).source())),
Arrays.stream(Metal.Default.values()).map(metal -> fromEnum(metal, metal.getColor(), "metal/" + metal.getSerializedName(), TFCFluids.METALS.get(metal).source()))
)
.flatMap(Function.identity())
.toList();
public static <R> Map<FluidId, R> mapOf(Function<? super FluidId, ? extends R> map)
{
return VALUES.stream().collect(Collectors.toMap(Function.identity(), map));
}
public static FluidId asType(Enum<?> identity)
{
return IDENTITY.get(identity);
}
private static FluidId fromEnum(Enum<?> identity, int color, String name, Supplier<? extends Fluid> fluid)
{
final FluidId type = new FluidId(name, OptionalInt.of(TFCFluids.ALPHA_MASK | color), fluid);
IDENTITY.put(identity, type);
return type;
}
}
| TerraFirmaCraft/TerraFirmaCraft | src/main/java/net/dries007/tfc/common/fluids/FluidId.java |
213,092 | /**
* Copyright (c) 2023 GregTech-6 Team
*
* This file is part of GregTech.
*
* GregTech is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GregTech is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with GregTech. If not, see <http://www.gnu.org/licenses/>.
*/
package gregapi.damage;
import gregapi.util.UT;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityDragonPart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.*;
/**
* @author Gregorius Techneticies
*/
public class DamageSources {
public static DamageSource getElectricDamage() {
try {return ic2.api.info.Info.DMG_ELECTRIC;} catch(Throwable e) {/**/}
return getHeatDamage();
}
public static DamageSource getRadioactiveDamage() {
try {return ic2.api.info.Info.DMG_RADIATION;} catch(Throwable e) {/**/}
return getHeatDamage();
}
public static DamageSource getNukeExplosionDamage() {
try {return ic2.api.info.Info.DMG_NUKE_EXPLOSION;} catch(Throwable e) {/**/}
return getHeatDamage();
}
public static DamageSource getExplodingDamage() {
return new DamageSourceExploding();
}
public static DamageSource getCombatDamage(String aType, EntityLivingBase aPlayer, IChatComponent aDeathMessage) {
return new DamageSourceCombat(aType, aPlayer, aDeathMessage);
}
public static DamageSource getSpikeDamage() {
return new DamageSourceSpike();
}
public static DamageSource getShredderDamage() {
return new DamageSourceShredder();
}
public static DamageSource getCrusherDamage() {
return new DamageSourceCrusher();
}
public static DamageSource getHeatDamage() {
return new DamageSourceHeat();
}
public static DamageSource getFrostDamage() {
return new DamageSourceFrost();
}
public static DamageSource getChemDamage() {
return new DamageSourceChem();
}
public static DamageSource getBumbleDamage() {
return new DamageSourceBumble();
}
public static DamageSource getAlcoholDamage() {
return new DamageSourceAlcohol();
}
public static DamageSource getCaffeineDamage() {
return new DamageSourceCaffeine();
}
public static DamageSource getDehydrationDamage() {
return new DamageSourceDehydration();
}
public static DamageSource getSugarDamage() {
return new DamageSourceSugar();
}
public static DamageSource getFatDamage() {
return new DamageSourceFat();
}
public static IChatComponent getDeathMessage(EntityLivingBase aPlayer, Entity aEntity, String aMessage) {
String aNamePlayer = aPlayer.getCommandSenderName(), aNameEntity = aEntity.getCommandSenderName();
if (UT.Code.stringInvalid(aNamePlayer) || UT.Code.stringInvalid(aEntity)) return new ChatComponentText("Death Message lacks names of involved Players");
aNamePlayer = aNamePlayer.trim(); aNameEntity = aNameEntity.trim();
if (aNamePlayer.equalsIgnoreCase("CrazyJ84") || aNamePlayer.equalsIgnoreCase("CrazyJ1984")) {
if (aNameEntity.equalsIgnoreCase("Bear989jr")) return new ChatComponentText("<"+ EnumChatFormatting.LIGHT_PURPLE+"Mrs. Crazy"+EnumChatFormatting.WHITE + "> Sorry "+EnumChatFormatting.RED+"Junior"+EnumChatFormatting.WHITE);
if (aNameEntity.equalsIgnoreCase("Bear989Sr")) return new ChatComponentText("<"+EnumChatFormatting.LIGHT_PURPLE+"Mrs. Crazy"+EnumChatFormatting.WHITE + "> Hush it!, "+EnumChatFormatting.RED+"Bear"+EnumChatFormatting.WHITE+"!");
}
if (aNamePlayer.equalsIgnoreCase("Bear989Sr") || aNamePlayer.equalsIgnoreCase("Bear989jr")) {
//
}
return getDeathMessage(aPlayer, aEntity, aNamePlayer, aNameEntity, aMessage);
}
public static IChatComponent getDeathMessage(EntityLivingBase aPlayer, Entity aEntity, String aNamePlayer, String aNameEntity, String aMessage) {
if (UT.Code.stringValid(aMessage)) {
return new ChatComponentText(aMessage.replace("[KILLER]", EnumChatFormatting.GREEN+aNamePlayer+EnumChatFormatting.WHITE).replace("[VICTIM]", EnumChatFormatting.RED+aNameEntity+EnumChatFormatting.WHITE));
} else if (aEntity instanceof EntityLivingBase) {
return new EntityDamageSource(aPlayer instanceof EntityPlayer ? "player" : "mob", aPlayer).func_151519_b((EntityLivingBase)aEntity);
} else if (aEntity instanceof EntityDragonPart) {
return new EntityDamageSource(aPlayer instanceof EntityPlayer ? "player" : "mob", aPlayer).func_151519_b((EntityLivingBase)((EntityDragonPart)aEntity).entityDragonObj);
}
return new ChatComponentText(EnumChatFormatting.GREEN+aNamePlayer+EnumChatFormatting.WHITE+" has killed "+EnumChatFormatting.RED+aNameEntity+EnumChatFormatting.WHITE);
}
}
| GregTech6/gregtech6 | src/main/java/gregapi/damage/DamageSources.java |
213,093 | package com.asuc.asucmobile.values;
import lombok.experimental.UtilityClass;
@UtilityClass
public class FoodTypes {
public final String MILK = "Milk";
public final String EGGS = "Eggs";
public final String SHELLFISH = "Shellfish";
public final String FISH = "Fish";
public final String TREE_NUTS = "Tree Nuts";
public final String WHEAT = "Wheat";
public final String PEANUTS = "Peanuts";
public final String SESAME = "Sesame";
public final String SOYBEANS = "Soybeans";
public final String VEGAN = "Vegan Option";
public final String VEGETARIAN = "Vegetarian Option";
public final String GLUTEN = "Contains Gluten";
public final String PORK = "Contains Pork";
public final String ALCOHOL = "Contains Alcohol";
public final String HALAL = "Halal";
public final String KOSHER = "Kosher";
}
| asuc-octo/berkeley-mobile-android | app/src/main/java/com/asuc/asucmobile/values/FoodTypes.java |
213,094 | package org.openstreetmap.atlas.tags;
import org.openstreetmap.atlas.tags.annotations.Tag;
import org.openstreetmap.atlas.tags.annotations.TagKey;
/**
* OSM shop tag
*
* @author cstaylor
*/
@Tag(taginfo = "http://taginfo.openstreetmap.org/keys/shop#values", osm = "http://wiki.openstreetmap.org/wiki/Key:shop")
public enum ShopTag
{
CONVENIENCE,
SUPERMARKET,
CLOTHES,
HAIRDRESSER,
BAKERY,
CAR_REPAIR,
CAR,
YES,
KIOSK,
DOITYOURSELF,
BUTCHER,
FLORIST,
MALL,
FURNITURE,
SHOES,
BICYCLE,
ALCOHOL,
ELECTRONICS,
HARDWARE,
BOOKS,
BEAUTY,
MOBILE_PHONE,
JEWELRY,
DEPARTMENT_STORE,
OPTICIAN,
GIFT,
GREENGROCER,
CAR_PARTS,
CHEMIST,
VARIETY_STORE,
SPORTS,
GARDEN_CENTRE,
COMPUTER,
STATIONERY,
TRAVEL_AGENCY,
LAUNDRY,
CONFECTIONERY,
BEVERAGES,
DRY_CLEANING,
TOYS,
TAILOR,
ART,
BABY_GOODS,
BATHROOM_FURNISHING,
BOUTIQUE,
CARPET,
CHEESE,
CHOCOLATE,
COPY_SHOP,
COSMETICS,
DAIRY,
DELI,
FABRIC,
FARM,
FASHION,
VACANT;
@TagKey
public static final String KEY = "shop";
public String getTagValue()
{
return name().toLowerCase().intern();
}
}
| osmlab/atlas | src/main/java/org/openstreetmap/atlas/tags/ShopTag.java |
213,095 | package com.planet_ink.coffee_mud.Abilities.Thief;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.TrackingLibrary;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2016-2024 Bo Zimmerman
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
public class Thief_LocateAlcohol extends ThiefSkill
{
@Override
public String ID()
{
return "Thief_LocateAlcohol";
}
private final static String localizedName = CMLib.lang().L("Locate Alcohol");
@Override
public String name()
{
return localizedName;
}
@Override
public int classificationCode()
{
return Ability.ACODE_THIEF_SKILL | Ability.DOMAIN_ANATOMY;
}
private final static String localizedStaticDisplay = CMLib.lang().L("(Locating Alcohol)");
private static final String[] triggerStrings = I(new String[] { "LOCATEALCOHOL" });
@Override
public String[] triggerStrings()
{
return triggerStrings;
}
@Override
public int usageType()
{
return USAGE_MOVEMENT | USAGE_MANA;
}
@Override
public String displayText()
{
return localizedStaticDisplay;
}
@Override
public int abstractQuality()
{
return Ability.QUALITY_OK_SELF;
}
@Override
public long flags()
{
return Ability.FLAG_TRACKING;
}
protected List<Room> theTrail=null;
public int nextDirection=-2;
public String alcoholCheck(final MOB mob, final Item I, final StringBuffer msg)
{
if(I==null)
return "";
if(CMLib.flags().isAlcoholic(I)
&&(CMLib.flags().canBeSeenBy(I,mob)))
{
if((I.container()!=null)&&(I.ultimateContainer(null)!=I))
msg.append(L("@x1 contains alcohol.\n\r",I.ultimateContainer(null).name()));
else
msg.append(L("@x1 contains some sort of alcohol.\n\r",I.name(mob)));
}
return msg.toString();
}
public String alcoholHere(final MOB mob, final Environmental E)
{
final StringBuffer msg=new StringBuffer("");
if(E==null)
return msg.toString();
if((E instanceof Room)
&&(CMLib.flags().canBeSeenBy(E,mob)))
{
final Room room=(Room)E;
{
for(int i=0;i<room.numItems();i++)
{
final Item I=room.getItem(i);
if(I!=null)
alcoholCheck(mob,I,msg);
}
for(int m=0;m<room.numInhabitants();m++)
{
final MOB M=room.fetchInhabitant(m);
if((M!=null)&&(M!=mob))
msg.append(alcoholHere(mob,M));
}
}
}
else
if((E instanceof Item)
&&(CMLib.flags().canBeSeenBy(E,mob)))
{
alcoholCheck(mob,(Item)E,msg);
if(E instanceof Container)
for(final Item I : ((Container)E).getContents())
alcoholCheck(mob,I,msg);
}
else
if((E instanceof MOB)
&&(CMLib.flags().canBeSeenBy(E,mob)))
{
for(int i=0;i<((MOB)E).numItems();i++)
{
final Item I=((MOB)E).getItem(i);
final StringBuffer msg2=new StringBuffer("");
alcoholCheck(mob,I,msg2);
if(msg2.length()>0)
return E.name()+" is carrying some alcohol.";
}
final ShopKeeper SK=CMLib.coffeeShops().getShopKeeper(E);
if(SK!=null)
{
final StringBuffer msg2=new StringBuffer("");
for(final Iterator<Environmental> i=SK.getShop().getStoreInventory();i.hasNext();)
{
final Environmental E2=i.next();
if(E2 instanceof Item)
alcoholCheck(mob,(Item)E2,msg2);
if(msg2.length()>0)
return E.name()+" has some alcohol in stock.";
}
}
}
return msg.toString();
}
@Override
public boolean tick(final Tickable ticking, final int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(tickID==Tickable.TICKID_MOB)
{
if(nextDirection==-999)
return true;
if((theTrail==null)
||(affected == null)
||(!(affected instanceof MOB)))
return false;
final MOB mob=(MOB)affected;
if(!CMLib.flags().canSmell(mob,affected))
{
mob.tell(L("The alcohol trail fizzles out here."));
nextDirection=-999;
unInvoke();
return false;
}
else
if(nextDirection==999)
{
mob.tell(alcoholHere(mob,mob.location()));
nextDirection=-2;
unInvoke();
return false;
}
else
if(nextDirection==-1)
{
if(alcoholHere(mob,mob.location()).length()==0)
mob.tell(L("The alcohol trail fizzles out here."));
nextDirection=-999;
unInvoke();
return false;
}
else
if(nextDirection>=0)
{
mob.tell(L("Your smell alcohol @x1.",CMLib.directions().getDirectionName(nextDirection)));
nextDirection=-2;
}
}
return true;
}
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
if((msg.amISource(mob))
&&(msg.amITarget(mob.location()))
&&(CMLib.flags().canBeSeenBy(mob.location(),mob))
&&(msg.targetMinor()==CMMsg.TYP_LOOK))
nextDirection=CMLib.tracking().trackNextDirectionFromHere(theTrail,mob.location(),false);
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.target()!=null)
&&(msg.amISource((MOB)affected))
&&((msg.sourceMinor()==CMMsg.TYP_LOOK)||(msg.sourceMinor()==CMMsg.TYP_EXAMINE)))
{
if((msg.tool()!=null)&&(msg.tool().ID().equals(ID())))
{
final String str=alcoholHere((MOB)affected,msg.target());
if(str.length()>0)
{
((MOB)affected).tell(str);
unInvoke();
}
}
else
if((msg.target()!=null)
&&(alcoholHere((MOB)affected,msg.target()).length()>0)
&&(msg.source()!=msg.target()))
{
final CMMsg msg2=CMClass.getMsg(msg.source(),msg.target(),this,CMMsg.MSG_LOOK,CMMsg.NO_EFFECT,CMMsg.NO_EFFECT,null);
msg.addTrailerMsg(msg2);
}
}
}
@Override
public void affectPhyStats(final Physical affectedEnv, final PhyStats affectableStats)
{
affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_NOT_TRACK);
super.affectPhyStats(affectedEnv, affectableStats);
}
@Override
public boolean invoke(final MOB mob, final List<String> commands, final Physical givenTarget, final boolean auto, final int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
failureTell(mob,target,auto,L("<S-NAME> <S-IS-ARE> already trying to find a stiff drink."));
return false;
}
if(!CMLib.flags().canSmell(target))
{
failureTell(mob,target,auto,L("<S-NAME> <S-IS-ARE> unable to smell alcohol."));
return false;
}
final List<Ability> V=CMLib.flags().flaggedAffects(mob,Ability.FLAG_TRACKING);
for (final Ability A : V)
A.unInvoke();
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final String here=alcoholHere(target,target.location());
if(here.length()>0)
{
target.tell(here);
return true;
}
final boolean success=proficiencyCheck(mob,0,auto);
TrackingLibrary.TrackingFlags flags;
flags = CMLib.tracking().newFlags();
flags.plus(TrackingLibrary.TrackingFlag.PASSABLE);
final ArrayList<Room> rooms=new ArrayList<Room>();
final List<Room> trashRooms = new ArrayList<Room>();
if(CMLib.tracking().getRadiantRoomsToTarget(mob.location(), trashRooms, flags, new TrackingLibrary.RFilter() {
@Override
public boolean isFilteredOut(final Room hostR, Room R, final Exit E, final int dir)
{
R=CMLib.map().getRoom(R);
if(alcoholHere(mob,R).length()>0)
return false;
return true;
}
}, 15+adjustedLevel(mob,asLevel)))
rooms.add(trashRooms.get(trashRooms.size()-1));
if(rooms.size()>0)
{
//TrackingLibrary.TrackingFlags flags;
flags = CMLib.tracking().newFlags()
.plus(TrackingLibrary.TrackingFlag.NOEMPTYGRIDS)
.plus(TrackingLibrary.TrackingFlag.NOAIR);
theTrail=CMLib.tracking().findTrailToAnyRoom(target.location(),rooms,flags,50+adjustedLevel(mob,asLevel));
}
if((success)&&(theTrail!=null))
{
final CMMsg msg=CMClass.getMsg(mob,target,this,CMMsg.MSG_DELICATE_HANDS_ACT,
auto?L("<T-NAME> begin(s) to sense alcohol!"):L("^S<S-NAME> sniff(s) around for signs of a stiff drink.^?"));
if(mob.location().okMessage(mob,msg))
{
mob.location().send(mob,msg);
final Thief_LocateAlcohol newOne=(Thief_LocateAlcohol)this.copyOf();
if(target.fetchEffect(newOne.ID())==null)
target.addEffect(newOne);
target.recoverPhyStats();
newOne.nextDirection=CMLib.tracking().trackNextDirectionFromHere(newOne.theTrail,target.location(),false);
}
}
else
beneficialVisualFizzle(mob,null,L("<S-NAME> sniff(s) around for alcohol, but fail(s)."));
return success;
}
}
| bozimmerman/CoffeeMud | com/planet_ink/coffee_mud/Abilities/Thief/Thief_LocateAlcohol.java |
213,096 | /**
* Copyright (c) 2023 GregTech-6 Team
*
* This file is part of GregTech.
*
* GregTech is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GregTech is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with GregTech. If not, see <http://www.gnu.org/licenses/>.
*/
package gregapi.player;
import gregapi.code.ArrayListNoNulls;
import gregapi.damage.DamageSources;
import gregapi.util.UT;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.world.World;
import net.minecraftforge.common.IExtendedEntityProperties;
import static gregapi.data.CS.*;
/**
* @author Gregorius Techneticies
*/
public class EntityFoodTracker implements IExtendedEntityProperties {
public static ArrayListNoNulls<EntityFoodTracker> TICK_LIST = new ArrayListNoNulls<>();
public byte mAlcohol = 0, mCaffeine = 0, mDehydration = 0, mSugar = 0, mFat = 0, mRadiation = 0;
public final EntityLivingBase mEntity;
public EntityFoodTracker(EntityLivingBase aEntity) {
mEntity = aEntity;
}
@Override
public void saveNBTData(NBTTagCompound aNBT) {
NBTTagCompound tNBT = UT.NBT.make();
if (mAlcohol != 0) tNBT.setByte("a", mAlcohol );
if (mCaffeine != 0) tNBT.setByte("c", mCaffeine );
if (mSugar != 0) tNBT.setByte("s", mSugar );
if (mDehydration != 0) tNBT.setByte("d", mDehydration);
if (mFat != 0) tNBT.setByte("f", mFat );
if (mRadiation != 0) tNBT.setByte("r", mRadiation );
if (tNBT.hasNoTags()) aNBT.removeTag("gt.props.food"); else aNBT.setTag("gt.props.food", tNBT);
}
@Override
public void loadNBTData(NBTTagCompound aNBT) {
NBTTagCompound tNBT = aNBT.getCompoundTag("gt.props.food");
if (tNBT == null) return;
mAlcohol = tNBT.getByte("a");
mCaffeine = tNBT.getByte("c");
mDehydration = tNBT.getByte("d");
mSugar = tNBT.getByte("s");
mFat = tNBT.getByte("f");
mRadiation = tNBT.getByte("r");
}
@Override public void init(Entity aEntity, World aWorld) {TICK_LIST.add(this);}
public void changeAlcohol (long aAmount) {mAlcohol = UT.Code.bind7(mAlcohol + aAmount);}
public void changeCaffeine (long aAmount) {mCaffeine = UT.Code.bind7(mCaffeine + aAmount);}
public void changeDehydration(long aAmount) {mDehydration = UT.Code.bind7(mDehydration + aAmount);}
public void changeSugar (long aAmount) {mSugar = UT.Code.bind7(mSugar + aAmount);}
public void changeFat (long aAmount) {mFat = UT.Code.bind7(mFat + aAmount);}
public void changeRadiation (long aAmount) {mRadiation = UT.Code.bind7(mRadiation + aAmount);}
public static void tick() {
if (SERVER_TIME % 50 == 0) for (int i = 0; i < TICK_LIST.size(); i++) {
EntityFoodTracker tTracker = TICK_LIST.get(i);
if (tTracker.mEntity.isDead) {TICK_LIST.remove(i--); continue;}
if (tTracker.mAlcohol >= 100) {
if (FOOD_OVERDOSE_DEATH || tTracker.mEntity.getHealth() >= 2)
tTracker.mEntity.attackEntityFrom(DamageSources.getAlcoholDamage(), FOOD_OVERDOSE_DEATH?2:1);
UT.Entities.applyPotion(tTracker.mEntity, Potion.confusion, 1200, 2, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.damageBoost, 300, 3, F);
} else if (tTracker.mAlcohol >= 75) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.confusion, 1200, 1, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.damageBoost, 300, 2, F);
} else if (tTracker.mAlcohol >= 50) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.confusion, 1200, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.damageBoost, 300, 1, F);
} else if (tTracker.mAlcohol >= 25) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.damageBoost, 300, 0, F);
}
if (tTracker.mCaffeine >= 100) {
if (FOOD_OVERDOSE_DEATH || tTracker.mEntity.getHealth() >= 2)
tTracker.mEntity.attackEntityFrom(DamageSources.getCaffeineDamage(), FOOD_OVERDOSE_DEATH?2:1);
UT.Entities.applyPotion(tTracker.mEntity, Potion.weakness, 1200, 2, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.digSpeed, 300, 3, F);
} else if (tTracker.mCaffeine >= 75) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.weakness, 1200, 1, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.digSpeed, 300, 2, F);
} else if (tTracker.mCaffeine >= 50) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.weakness, 1200, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.digSpeed, 300, 1, F);
} else if (tTracker.mCaffeine >= 25) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.digSpeed, 300, 0, F);
}
if (tTracker.mRadiation >= 100) {
UT.Entities.applyPotion(tTracker.mEntity, PotionsGT.ID_RADIATION >= 0 ? PotionsGT.ID_RADIATION : Potion.wither.id, 100, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.confusion, 100, 2, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.hunger, 100, 2, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.moveSlowdown, 100, 2, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.digSlowdown, 100, 2, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.weakness, 100, 2, F);
} else if (tTracker.mRadiation >= 75) {
UT.Entities.applyPotion(tTracker.mEntity, PotionsGT.ID_RADIATION >= 0 ? PotionsGT.ID_RADIATION : Potion.poison.id, 100, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.confusion, 100, 1, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.hunger, 100, 1, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.moveSlowdown, 100, 1, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.digSlowdown, 100, 1, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.weakness, 100, 1, F);
} else if (tTracker.mRadiation >= 50) {
UT.Entities.applyPotion(tTracker.mEntity, PotionsGT.ID_RADIATION >= 0 ? PotionsGT.ID_RADIATION : Potion.poison.id, 100, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.confusion, 100, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.hunger, 100, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.moveSlowdown, 100, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.digSlowdown, 100, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.weakness, 100, 0, F);
} else if (tTracker.mRadiation >= 25) {
UT.Entities.applyPotion(tTracker.mEntity, PotionsGT.ID_RADIATION >= 0 ? PotionsGT.ID_RADIATION : Potion.poison.id, 100, 0, F);
}
if (NUTRITION_SYSTEM) {
if (tTracker.mFat >= 100) {
if (FOOD_OVERDOSE_DEATH || tTracker.mEntity.getHealth() >= 2)
tTracker.mEntity.attackEntityFrom(DamageSources.getFatDamage(), FOOD_OVERDOSE_DEATH?2:1);
UT.Entities.applyPotion(tTracker.mEntity, Potion.moveSlowdown, 1200, 2, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.resistance, 300, 3, F);
} else if (tTracker.mFat >= 75) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.moveSlowdown, 1200, 1, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.resistance, 300, 2, F);
} else if (tTracker.mFat >= 50) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.moveSlowdown, 1200, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.resistance, 300, 1, F);
} else if (tTracker.mFat >= 25) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.resistance, 300, 0, F);
}
if (tTracker.mSugar >= 100) {
if (FOOD_OVERDOSE_DEATH || tTracker.mEntity.getHealth() >= 2)
tTracker.mEntity.attackEntityFrom(DamageSources.getSugarDamage(), FOOD_OVERDOSE_DEATH?2:1);
UT.Entities.applyPotion(tTracker.mEntity, Potion.digSlowdown, 1200, 2, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.moveSpeed, 300, 3, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.jump, 300, 3, F);
} else if (tTracker.mSugar >= 75) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.digSlowdown, 1200, 1, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.moveSpeed, 300, 2, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.jump, 300, 2, F);
} else if (tTracker.mSugar >= 50) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.digSlowdown, 1200, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.moveSpeed, 300, 1, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.jump, 300, 1, F);
} else if (tTracker.mSugar >= 25) {
UT.Entities.applyPotion(tTracker.mEntity, Potion.moveSpeed, 300, 0, F);
UT.Entities.applyPotion(tTracker.mEntity, Potion.jump, 300, 0, F);
}
if (tTracker.mDehydration >= 100) {
if (FOOD_OVERDOSE_DEATH || tTracker.mEntity.getHealth() >= 2)
tTracker.mEntity.attackEntityFrom(DamageSources.getDehydrationDamage(), FOOD_OVERDOSE_DEATH?2:1);
UT.Entities.applyPotion(tTracker.mEntity, PotionsGT.ID_DEHYDRATION >= 0 ? PotionsGT.ID_DEHYDRATION : Potion.hunger.id, 1200, 3, F);
} else if (tTracker.mDehydration >= 75) {
UT.Entities.applyPotion(tTracker.mEntity, PotionsGT.ID_DEHYDRATION >= 0 ? PotionsGT.ID_DEHYDRATION : Potion.hunger.id, 1200, 2, F);
} else if (tTracker.mDehydration >= 50) {
UT.Entities.applyPotion(tTracker.mEntity, PotionsGT.ID_DEHYDRATION >= 0 ? PotionsGT.ID_DEHYDRATION : Potion.hunger.id, 1200, 1, F);
} else if (tTracker.mDehydration >= 25) {
UT.Entities.applyPotion(tTracker.mEntity, PotionsGT.ID_DEHYDRATION >= 0 ? PotionsGT.ID_DEHYDRATION : Potion.hunger.id, 1200, 0, F);
}
}
if (SERVER_TIME % 100 == 0) {
if (tTracker.mAlcohol > 0) tTracker.mAlcohol--;
if (tTracker.mCaffeine > 0) tTracker.mCaffeine--;
if (tTracker.mDehydration > 0) tTracker.mDehydration--;
if (tTracker.mSugar > 0) tTracker.mSugar--;
if (tTracker.mFat > 0) tTracker.mFat--;
//if (tTracker.mRadiation > 0) tTracker.mRadiation--; // The only one that does not decrease, so you will have to deal with it until you either die or get a Radaway,
}
}
}
public static void add(EntityLivingBase aEntity) {
if (aEntity == null || aEntity.worldObj.isRemote) return;
aEntity.registerExtendedProperties("gt.props.food", new EntityFoodTracker(aEntity));
}
public static EntityFoodTracker get(Entity aEntity) {
if (aEntity == null || aEntity.worldObj.isRemote) return null;
Object rTracker = aEntity.getExtendedProperties("gt.props.food");
return rTracker instanceof EntityFoodTracker ? (EntityFoodTracker)rTracker : null;
}
}
| GregTech6/gregtech6 | src/main/java/gregapi/player/EntityFoodTracker.java |
213,097 | package com.biermacht.brews.utils;
import android.util.Log;
import com.biermacht.brews.ingredient.Fermentable;
import com.biermacht.brews.ingredient.Hop;
import com.biermacht.brews.ingredient.Ingredient;
import com.biermacht.brews.ingredient.Yeast;
import com.biermacht.brews.recipe.Recipe;
import java.util.ArrayList;
public class BrewCalculator {
// Fermentable and unfermentable PPGs for unfermentable - lactose,
// dextrin malt (carapils) and malto-dextrin sugar
// This is only an estimate, assuming unfermentable contributes 30ppg,
// 5 ppg will be fermented and 25ppg will remain in the beer post fermentation
private static final double UNFERMENTABLE_FERMENTABLE_PPG = 5;
private static final double UNFERMENTABLE_UNFERMENTABLE_PPG = 25;
/**
* Beer details calculations http://www.howtobrew.com/section1/chapter5-5.html
* http://homebrew.stackexchange.com/questions/1434/wiki-how-do-you-calculate-original-gravity
* <p/>
* MCU = (weight of grain in lbs)*(color of grain in lovibond) / (volume in gal) SRM = 1.4922 *
* MCU**.6859
* <p/>
* OG = (Weight of grain in lbs)*(Extract potential of grain)*(Extraction Efficiency)
* <p/>
* IBU = 7498*(Weight of hops in OZ)*(% of Alpha Acids)*(Utilization factor) / (Volume in gal)
*/
public static float Color(Recipe r) {
float SRM = 0;
float MCU = 0;
ArrayList<Ingredient> ingredientsList = r.getIngredientList();
for (Ingredient i : ingredientsList) {
if (i.getType().equals(Ingredient.FERMENTABLE)) {
Fermentable g = (Fermentable) i;
MCU += Units.kilosToPounds(g.getBeerXmlStandardAmount()) * g.getLovibondColor() / Units.litersToGallons(r.getBeerXmlStandardBatchSize());
}
}
SRM = (float) (1.4922 * Math.pow(MCU, .6859));
return SRM;
}
public static double GrainPercent(Recipe r, Ingredient i) {
if (i.getType().equals(Ingredient.FERMENTABLE)) {
double g_amt = Units.kilosToPounds(i.getBeerXmlStandardAmount());
double tot_amt = TotalFermentableWeight(r);
return (g_amt / tot_amt) * 100;
}
return 0;
}
public static double TotalFermentableWeight(Recipe r) {
double amt = 0;
for (Ingredient i : r.getIngredientList()) {
if (i.getType().equals(Ingredient.FERMENTABLE)) {
amt += Units.kilosToPounds(i.getBeerXmlStandardAmount());
}
}
return amt;
}
public static double TotalBeerXmlMashWeight(Recipe r) {
double amt = 0;
for (Ingredient i : r.getIngredientList()) {
if (i.getUse().equals(Ingredient.USE_MASH)) {
amt += i.getBeerXmlStandardAmount();
}
}
return amt;
}
// Returns original gravity, including fermentable and non fermentable sugars
public static double OriginalGravity(Recipe r) {
double pts = OriginalFermentableGravityPoints(r) + NonFermentableGravityPoints(r);
return 1 + pts / 1000;
}
// Returns the theoretical max OG for the given recipe assuming 100% efficiency.
public static double TheoreticalMaxGravity(Recipe r) {
// We can cheat here. Use the calculated original gravity, and then undo the
// efficiency part of the calculation to back-track to the theoretical max.
double og = OriginalGravity(r);
return 1 + (og - 1) / (r.getEfficiency() / 100);
}
// Returns the total number of gravity points contributed by the list of
// fermentables.
public static double GravityPoints(ArrayList<Fermentable> fs) {
double pts = 0;
for (Fermentable f : fs) {
pts += f.gravityPoints();
}
return pts;
}
// Calculates contribution of fermentable sugars to gravity
public static double OriginalFermentableGravityPoints(Recipe r) {
float gravity_points = 0;
ArrayList<Ingredient> ingredientsList = r.getIngredientList();
for (Ingredient i : ingredientsList) {
double gp = FermentableGravityPoints(r, i);
gravity_points += gp;
Log.v("BrewCalculator", "Calling fermentable GP for " + i.getName() + " returned: " + gp);
}
return gravity_points;
}
// Calculates contribution of non fermentable sugars to gravity
public static double NonFermentableGravityPoints(Recipe r) {
float gravity_points = 0;
ArrayList<Ingredient> ingredientsList = r.getIngredientList();
for (Ingredient i : ingredientsList) {
double gp = NonFermentableGravityPoints(r, i);
gravity_points += gp;
Log.v("BrewCalculator", "Calling non-fermentable GP for " + i.getName() + " returned: " + gp);
}
return gravity_points;
}
// Returns the boil gravity for the given recipe.
public static double BoilGravity(Recipe r) {
if (r.getType().equals(Recipe.EXTRACT)) {
return ExtractBoilGravity(r);
}
else {
return AllGrainBoilGravity(r);
}
}
public static double ExtractBoilGravity(Recipe r) {
// Because this is used for hop utilization calculation,
// We want to adjust this based on late extract additions
double mGPs = OriginalGravity(r) - 1; //milliGPs
double avgBoilTime = 0;
int t = 0;
// TODO: This is imprecise as it doesn't take into account
// how much extract is used as a late addition.. Its is only an approximate
for (Fermentable f : r.getFermentablesList()) {
if (! f.getFermentableType().equals(Fermentable.TYPE_GRAIN)) {
t++;
avgBoilTime += f.getTime();
}
}
if (t != 0) {
avgBoilTime = avgBoilTime / t;
}
else {
avgBoilTime = r.getBoilTime();
}
return 1 + (mGPs * Units.litersToGallons(r.getBeerXmlStandardBatchSize()) / Units.litersToGallons(r.getBeerXmlStandardBoilSize())) * (avgBoilTime / r.getBoilTime());
}
public static double AllGrainBoilGravity(Recipe r) {
double mGPs = OriginalGravity(r) - 1;
return 1 + (mGPs * Units.litersToGallons(r.getBeerXmlStandardBatchSize()) / Units.litersToGallons(r.getBeerXmlStandardBoilSize()));
}
public static double FermentableGravityPoints(Recipe r, Ingredient i) {
double pts = 0;
if (i.getType().equals(Ingredient.FERMENTABLE)) {
Fermentable f = (Fermentable) i;
if (f.getFermentableType().equals(Fermentable.TYPE_EXTRACT)) {
pts = Units.kilosToPounds(f.getBeerXmlStandardAmount()) * f.getPpg() / Units.litersToGallons(r.getBeerXmlStandardBatchSize());
}
else if (f.getFermentableType().equals(Fermentable.TYPE_SUGAR)) {
if (isUnfermentable(i.getName())) {
pts = UNFERMENTABLE_FERMENTABLE_PPG * Units.kilosToPounds(f.getBeerXmlStandardAmount()) /
Units.litersToGallons(r.getBeerXmlStandardBatchSize());
}
else {
pts = Units.kilosToPounds(f.getBeerXmlStandardAmount()) * f.getPpg() / Units.litersToGallons(r.getBeerXmlStandardBatchSize());
}
}
else if (f.getFermentableType().equals(Fermentable.TYPE_GRAIN)) {
if (r.getType().equals(Recipe.EXTRACT)) {
pts = 5 * Units.kilosToPounds(f.getBeerXmlStandardAmount()) / Units.litersToGallons(r.getBeerXmlStandardBatchSize());
if (f.getName().equalsIgnoreCase("Roasted Barley")) {
pts = 10 * f.getDisplayAmount() / r.getDisplayBatchSize();
}
if (f.getName().equalsIgnoreCase("Black Patent Malt")) {
pts = 10 * f.getDisplayAmount() / r.getDisplayBatchSize();
}
}
else {
if (isUnfermentable(i.getName())) {
pts = UNFERMENTABLE_FERMENTABLE_PPG * Units.kilosToPounds(f.getBeerXmlStandardAmount())
/ Units.litersToGallons(r.getBeerXmlStandardBatchSize());
}
else {
// Either a partial mash or all grain recipe
pts = r.getEfficiency() * Units.kilosToPounds(f.getBeerXmlStandardAmount()) * f.getPpg() / Units.litersToGallons(r.getBeerXmlStandardBatchSize()) / 100;
}
}
}
else {
pts = Units.kilosToPounds(f.getBeerXmlStandardAmount()) * f.getPpg() / Units.litersToGallons(r.getBeerXmlStandardBatchSize());
}
}
return pts;
}
private static boolean isUnfermentable(String name) {
if (name.equalsIgnoreCase("Malto-Dextrine") ||
name.equalsIgnoreCase("Dextrine Malt") ||
name.equalsIgnoreCase("Cara-pils") ||
name.equalsIgnoreCase("Milk Sugar (Lactose)")) {
return true;
}
return false;
}
// Returns the number of non fermentable gravity points for the given ingredient
public static double NonFermentableGravityPoints(Recipe r, Ingredient i) {
if (isUnfermentable(i.getName())) {
return UNFERMENTABLE_UNFERMENTABLE_PPG * Units.kilosToPounds(i.getBeerXmlStandardAmount()) /
Units.litersToGallons(r.getBeerXmlStandardBatchSize());
}
else {
return 0;
}
}
public static double Bitterness(Recipe r) {
double ibu = 0;
ArrayList<Ingredient> ingredientsList = r.getIngredientList();
// http://www.howtobrew.com/section1/chapter5-5.html
for (Ingredient i : ingredientsList) {
ibu += Bitterness(r, i);
}
return ibu;
}
// Returns the given bitterness in IBUs
public static double Bitterness(Recipe r, Ingredient i) {
double ibu = 0;
double AAU;
double utilization;
if (i.getType().equals(Ingredient.HOP)) {
Hop h = (Hop) i;
if (h.getUse().equals(Hop.USE_BOIL)) {
utilization = HopUtilization(r, h);
AAU = Units.kilosToOunces(h.getBeerXmlStandardAmount()) * h.getAlphaAcidContent();
ibu = (AAU * utilization * 75) / Units.litersToGallons(r.getBeerXmlStandardBatchSize());
}
else if (h.getUse().equals(Hop.USE_FIRST_WORT)) {
// First wort hops get an extra 10% IBU boost!
utilization = HopUtilization(r, h);
AAU = Units.kilosToOunces(h.getBeerXmlStandardAmount()) * h.getAlphaAcidContent();
ibu = (AAU * utilization * 75) / Units.litersToGallons(r.getBeerXmlStandardBatchSize());
ibu = ibu * 1.1;
}
else if (h.getUse().equals(Hop.USE_AROMA)) {
// There is no real research which indicates how many IBUs are added for flame-out
// additions. We'll approximate by assuming 25% IBU contribution.
utilization = HopUtilization(r, h);
AAU = Units.kilosToOunces(h.getBeerXmlStandardAmount()) * h.getAlphaAcidContent();
ibu = (AAU * utilization * 75) / Units.litersToGallons(r.getBeerXmlStandardBatchSize());
ibu = ibu * .25;
}
}
return ibu;
}
public static double FinalGravity(Recipe r) {
double pts = FinalFermentableGravityPoints(r) + NonFermentableGravityPoints(r);
return 1 + pts / 1000;
}
public static double FinalFermentableGravityPoints(Recipe r) {
double pts = OriginalFermentableGravityPoints(r);
double attn; // Yeast attentuation
for (Ingredient i : r.getIngredientList()) {
if (i.getType().equals(Ingredient.YEAST)) {
// First, try to determine if we have an attenuation value
Yeast y = (Yeast) i;
attn = y.getAttenuation();
if (attn > 0) {
return pts * (100 - attn) / 100 - 1;
}
}
}
// If we don't have any yeast, there's no fermentation!
return OriginalFermentableGravityPoints(r);
}
public static double AlcoholByVolume(Recipe r) {
return AlcoholByVolume(r.getOG(), r.getFG());
}
public static double AlcoholByVolume(double og, double fg) {
return (og - fg) * 131;
}
/**
* @param og
* Original gravity (SG)
* @param fg
* Final gravity (SG)
* @return Apparent attenuation as a percentage out of 100
*/
public static double Attenuation(double og, double fg) {
return 100 * ((og - fg) / (og - 1));
}
public static double HopUtilization(Recipe r, Hop i) {
float utilization;
double bignessFactor;
double boilTimeFactor;
double boilGrav = BoilGravity(r);
// Default : 1.65/4.25
bignessFactor = 1.65 * Math.pow(.00025, boilGrav - 1);
boilTimeFactor = (1 - Math.pow(Math.E, - .04 * i.getTime())) / 4.25;
utilization = (float) (bignessFactor * boilTimeFactor);
// Pellets require a little bit more hops.
if (i.getForm().equals(Hop.FORM_PELLET)) {
return .94 * utilization;
}
else {
return utilization;
}
}
public static double calculateStrikeTemp(double r,
double T1,
double T2) {
/**
* From Palmer:
* Tw = (.2/r)(T2 - T1) + T2
* Wa = (T2 - T1)(.2G + Wm)/(Tw - T2)
*
* r = The ratio of water to grain in quarts per pound.
* Wa = The amount of boiling water added (in quarts).
* Wm = The total amount of water in the mash (in quarts).
* T1 = The initial temperature (�F) of the mash.
* T2 = The target temperature (�F) of the mash.
* Tw = The actual temperature (�F) of the infusion water.
* G = The amount of grain in the mash (in pounds).
*
* NOTE: All temperatures in degrees F.
*/
return ((.2 / r) * (T2 - T1)) + T2;
}
/**
* Adjusts a gravity reading based on temperature
*
* @param mg
* - Measured gravity
* @param temp
* - Measured temperature (F)
* @param ct
* - Temperature to which to calibrate (F)
* @return - Calibrated gravity
*/
public static double adjustGravityForTemp(double mg, double temp, double ct) {
double cg; // Corrected grav
cg = mg * (1.00130346 - 0.000134722124 * temp + 0.00000204052596 * temp * temp - 0.00000000232820948 * temp * temp * temp);
cg = cg / (1.00130346 - 0.000134722124 * ct + 0.00000204052596 * ct * ct - 0.00000000232820948 * ct * ct * ct);
return cg;
}
} | caseydavenport/biermacht | src/com/biermacht/brews/utils/BrewCalculator.java |
213,098 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
class Main {
private static long gcd(long a, long b) {
if (b==0) return a;
return gcd(b,a%b);
}
public static void main(String[] args) throws Exception {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s;
int tc=1;
while (!(s=br.readLine()).equals("0 0 0 0")) {
StringTokenizer st=new StringTokenizer(s);
long v1=Long.parseLong(st.nextToken());
long d1=Long.parseLong(st.nextToken());
long v2=Long.parseLong(st.nextToken());
long d2=Long.parseLong(st.nextToken());
long lcmV=(v1*v2)/gcd(v1,v2);
d1=d1*(lcmV/v1);
d2=d2*(lcmV/v2);
long d=d1+d2;
long v=lcmV<<1;
long f=gcd(d,v);
d/=f;
v/=f;
StringBuilder sb=new StringBuilder();
sb.append("Case #");
sb.append(tc++);
if (d1<d2) sb.append(": You owe me a beer!");
else sb.append(": No beer for the captain.");
sb.append("\nAvg. arrival time: ");
sb.append(d);
if (v>1) {
sb.append('/');
sb.append(v);
}
System.out.println(sb.toString());
}
}
} | PuzzlesLab/UVA | King/12970 Alcoholic Pilots.java |
213,099 | /*
* Created on 22-Sep-2004
* Created by Paul Gardner
* Copyright (C) Azureus Software, Inc, All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
package com.biglybt.core.util;
import java.io.*;
import java.util.*;
import com.biglybt.core.Core;
import com.biglybt.core.config.COConfigurationManager;
import com.biglybt.core.config.ParameterListener;
import com.biglybt.core.internat.MessageText;
import com.biglybt.core.logging.LogAlert;
import com.biglybt.core.logging.Logger;
import com.biglybt.pif.PluginInterface;
import com.biglybt.pif.logging.LoggerChannel;
import com.biglybt.pif.ui.UIManager;
import com.biglybt.pif.ui.model.BasicPluginViewModel;
import com.biglybt.pif.ui.components.*;
import com.biglybt.platform.PlatformManager;
import com.biglybt.platform.PlatformManagerCapabilities;
import com.biglybt.platform.PlatformManagerFactory;
/**
* @author parg
*/
public class
AEDiagnostics
{
// these can not be set true and have a usable AZ!
public static final boolean ALWAYS_PASS_HASH_CHECKS = false;
public static final boolean USE_DUMMY_FILE_DATA = false;
public static final boolean CHECK_DUMMY_FILE_DATA = false;
// these can safely be set true, things will work just slower
public static final boolean DEBUG_MONITOR_SEM_USAGE = false;
public static final boolean DEBUG_THREADS = true; // Leave this on by default for the moment
public static final boolean TRACE_DIRECT_BYTE_BUFFERS = false;
public static final boolean TRACE_DBB_POOL_USAGE = false;
public static final boolean PRINT_DBB_POOL_USAGE = false;
public static final boolean TRACE_TCP_TRANSPORT_STATS = false;
public static final boolean TRACE_CONNECTION_DROPS = false;
private static final int MAX_FILE_SIZE_DEFAULT; // get two of these per logger type
private static int[] MAX_FILE_SIZE_ACTUAL = { 0 };
static{
if ( ALWAYS_PASS_HASH_CHECKS ){
System.out.println( "**** Always passing hash checks ****" );
}
if ( USE_DUMMY_FILE_DATA ){
System.out.println( "**** Using dummy file data ****" );
}
if ( CHECK_DUMMY_FILE_DATA ){
System.out.println( "**** Checking dummy file data ****" );
}
if ( DEBUG_MONITOR_SEM_USAGE ){
System.out.println( "**** AEMonitor/AESemaphore debug on ****" );
}
if ( TRACE_DIRECT_BYTE_BUFFERS ){
System.out.println( "**** DirectByteBuffer tracing on ****" );
}
if ( TRACE_DBB_POOL_USAGE ){
System.out.println( "**** DirectByteBufferPool tracing on ****" );
}
if ( PRINT_DBB_POOL_USAGE ){
System.out.println( "**** DirectByteBufferPool printing on ****" );
}
if ( TRACE_TCP_TRANSPORT_STATS ){
System.out.println( "**** TCP_TRANSPORT_STATS tracing on ****" );
}
int maxFileSize = 256 * 1024;
try {
String logSize = System.getProperty("diag.logsize", null);
if (logSize != null) {
if (logSize.toLowerCase().endsWith("m")) {
maxFileSize = Integer.parseInt(logSize.substring(0,
logSize.length() - 1)) * 1024 * 1024;
} else {
maxFileSize = Integer.parseInt(logSize);
}
}
} catch (Throwable t) {
}
MAX_FILE_SIZE_ACTUAL[0] = MAX_FILE_SIZE_DEFAULT = maxFileSize;
}
private static final String CONFIG_KEY = "diagnostics.tidy_close";
private static File debug_dir;
private static File debug_save_dir;
private static boolean started_up;
private static volatile boolean startup_complete;
private static boolean enable_pending_writes;
private static final Map<String,AEDiagnosticsLogger> loggers = new HashMap<>();
protected static boolean logging_enabled;
protected static boolean loggers_enabled;
protected static boolean loggers_disabled; // all these stupid vars.
private static final List<AEDiagnosticsEvidenceGenerator> evidence_generators = new ArrayList<>();
private static final Map<AEDiagnosticsEvidenceGenerator, Void> weak_evidence_generators = new WeakHashMap<>();
private static final AESemaphore dump_check_done_sem = new AESemaphore( "dumpcheckcomplete" );
public static synchronized void
startup(
boolean _enable_pending )
{
if ( started_up ){
return;
}
started_up = true;
enable_pending_writes = _enable_pending;
try{
// Minimize risk of loading to much when in transitory startup mode
boolean transitoryStartup = System.getProperty("transitory.startup", "0").equals("1");
if ( transitoryStartup ){
// no xxx_?.log logging for you!
loggers_enabled = false;
// skip tidy check and more!
return;
}
debug_dir = FileUtil.getUserFile( "logs" );
debug_save_dir = FileUtil.newFile( debug_dir, "save" );
COConfigurationManager.addAndFireParameterListeners(
new String[]{
"Logger.Enabled",
"Logger.DebugFiles.Enabled", // don't think used anymore, always true...
"Logger.DebugFiles.Enabled.Force",
"Logger.DebugFiles.Disable", // config to disable all debug files regardless
"Logger.DebugFiles.SizeKB",
},
new ParameterListener()
{
@Override
public void
parameterChanged(
String parameterName)
{
logging_enabled = COConfigurationManager.getBooleanParameter( "Logger.Enabled" );
loggers_enabled = logging_enabled && COConfigurationManager.getBooleanParameter( "Logger.DebugFiles.Enabled");
loggers_disabled = COConfigurationManager.getBooleanParameter( "Logger.DebugFiles.Disable");
if ( !loggers_enabled ){
boolean skipCVSCheck = System.getProperty("skip.loggers.enabled.cvscheck", "0").equals("1");
loggers_enabled = (!skipCVSCheck && Constants.IS_CVS_VERSION) || COConfigurationManager.getBooleanParameter( "Logger.DebugFiles.Enabled.Force" );
}
if ( System.getProperty("diag.logsize", null) == null ){
int kb = COConfigurationManager.getIntParameter("Logger.DebugFiles.SizeKB", 0 )*1024;
if ( kb > 0 ){
MAX_FILE_SIZE_ACTUAL[0] = kb;
}
}
}
});
boolean was_tidy = COConfigurationManager.getBooleanParameter( CONFIG_KEY );
new AEThread2( "asyncify", true )
{
@Override
public void
run()
{
SimpleTimer.addEvent("AEDiagnostics:logCleaner",SystemTime.getCurrentTime() + 60000
+ RandomUtils.nextInt(15000), new TimerEventPerformer() {
@Override
public void perform(TimerEvent event) {
cleanOldLogs();
}
});
}
}.start();
if ( debug_dir.exists()){
boolean save_logs = System.getProperty( "az.logging.save.debug", "true" ).equals( "true" );
long now = SystemTime.getCurrentTime();
File[] files = debug_dir.listFiles();
if ( files != null ){
boolean file_found = false;
for (int i=0;i<files.length;i++){
File file = files[i];
if ( file.isDirectory()){
continue;
}
if ( !was_tidy ){
file_found = true;
if ( save_logs ){
if ( !debug_save_dir.exists()){
debug_save_dir.mkdir();
}
FileUtil.copyFile( file, FileUtil.newFile( debug_save_dir, now + "_" + file.getName()));
}
}
}
if ( file_found ){
Logger.logTextResource(new LogAlert(LogAlert.UNREPEATABLE,
LogAlert.AT_WARNING, "diagnostics.log_found"),
new String[] { debug_save_dir.toString() });
}
}
}else{
debug_dir.mkdir();
}
AEJavaManagement.initialise();
}catch( Throwable e ){
// with webui we don't have the file stuff so this fails with class not found
if ( !(e instanceof NoClassDefFoundError )){
Debug.printStackTrace( e );
}
}finally{
startup_complete = true;
}
}
public static void
dumpThreads()
{
AEJavaManagement.dumpThreads();
}
public static void
dumpThreads(
IndentWriter writer )
{
AEJavaManagement.dumpThreads( writer );
}
public static String
getThreadInfo(
Thread thread )
{
return( AEJavaManagement.getThreadInfo( thread ));
}
/**
*
*/
private static synchronized void cleanOldLogs() {
try {
long now = SystemTime.getCurrentTime();
// clear out any really old files in the save-dir
File[] files = debug_save_dir.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
File file = files[i];
if (!file.isDirectory()) {
long last_modified = file.lastModified();
if (now - last_modified > 10 * 24 * 60 * 60 * 1000L) {
file.delete();
}
}
}
}
} catch (Exception e) {
}
}
public static boolean
isStartupComplete()
{
return( startup_complete );
}
public static void
postStartup(
Core core )
{
PluginInterface plugin_interface = core.getPluginManager().getDefaultPluginInterface();
LoggerChannel log = plugin_interface.getLogger().getChannel( "JVM Info" );
UIManager ui_manager = plugin_interface.getUIManager();
BasicPluginViewModel model = ui_manager.createBasicPluginViewModel( "log.jvm.info" );
model.getActivity().setVisible( false );
model.getProgress().setVisible( false );
model.attachLoggerChannel( log );
model.getLogArea().addRefreshListener(
new UIComponent.RefreshListener(){
private String last_line = null;
@Override
public void
refresh()
{
List<String> lines = AEJavaManagement.getMemoryHistory();
int line_num = lines.size();
if ( line_num == 0 ){
return;
}
int pos = lines.indexOf( last_line );
if ( pos == line_num-1 ){
return;
}
String content = "";
for ( String line: lines.subList(pos<0?0:pos+1,lines.size())){
content += line + "\n";
}
last_line = lines.get(lines.size()-1);
model.getLogArea().appendText( content );
}
});
}
public static File
getLogDir()
{
startup( false );
return( debug_dir );
}
public static synchronized void
flushPendingLogs()
{
for ( AEDiagnosticsLogger logger: loggers.values()){
logger.writePending();
}
enable_pending_writes = false;
}
public static synchronized AEDiagnosticsLogger
getLogger(
String name )
{
AEDiagnosticsLogger logger = loggers.get(name);
if ( logger == null ){
startup( false );
logger = new AEDiagnosticsLogger( debug_dir, name, MAX_FILE_SIZE_ACTUAL, !enable_pending_writes );
loggers.put( name, logger );
}
return( logger );
}
public static void
logWithStack(
String logger_name,
String str )
{
log( logger_name, str + ": " + Debug.getCompressedStackTrace(1));
}
public static void
log(
String logger_name,
String str )
{
getLogger( logger_name ).log( str );
}
public static void
markDirty()
{
try{
COConfigurationManager.setParameter( CONFIG_KEY, false );
COConfigurationManager.save();
}catch( Throwable e ){
Debug.printStackTrace( e );
}
}
public static boolean
isDirty()
{
return( !COConfigurationManager.getBooleanParameter( CONFIG_KEY ));
}
public static void
markClean()
{
try{
COConfigurationManager.setParameter( CONFIG_KEY, true );
COConfigurationManager.save();
}catch( Throwable e ){
Debug.printStackTrace( e );
}
}
private static final String[][]
bad_dlls = {
{ "niphk", "y", },
{ "nvappfilter", "y", },
{ "netdog", "y", },
{ "vlsp", "y", },
{ "imon", "y", },
{ "sarah", "y", },
{ "MxAVLsp", "y", },
{ "mclsp", "y", },
{ "radhslib", "y", },
{ "winsflt", "y", },
{ "nl_lsp", "y", },
{ "AxShlex", "y", },
{ "iFW_Xfilter", "y", },
{ "gapsp", "y", },
{ "WSOCKHK", "n", },
{ "InjHook12", "n", },
{ "FPServiceProvider","n", },
{ "SBLSP.dll", "y" },
{ "nvLsp.dll", "y" },
};
public static void
checkDumpsAndNatives()
{
try{
PlatformManager p_man = PlatformManagerFactory.getPlatformManager();
if ( p_man.getPlatformType() == PlatformManager.PT_WINDOWS &&
p_man.hasCapability( PlatformManagerCapabilities.TestNativeAvailability )){
for (int i=0;i<bad_dlls.length;i++){
String dll = bad_dlls[i][0];
String load = bad_dlls[i][1];
if ( load.equalsIgnoreCase( "n" )){
continue;
}
if ( !COConfigurationManager.getBooleanParameter( "platform.win32.dll_found." + dll, false )){
try{
if ( p_man.testNativeAvailability( dll + ".dll" )){
COConfigurationManager.setParameter( "platform.win32.dll_found." + dll, true );
String detail = MessageText.getString( "platform.win32.baddll." + dll );
Logger.logTextResource(
new LogAlert(
LogAlert.REPEATABLE,
LogAlert.AT_WARNING,
"platform.win32.baddll.info" ),
new String[]{ dll + ".dll", detail });
}
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
}
}
List<File> fdirs_to_check = new ArrayList<>();
fdirs_to_check.add( FileUtil.newFile( SystemProperties.getApplicationPath()));
try{
File temp_file = File.createTempFile( "AZU", "tmp" );
fdirs_to_check.add( temp_file.getParentFile());
temp_file.delete();
}catch( Throwable e ){
}
File most_recent_dump = null;
long most_recent_time = 0;
for ( File dir: fdirs_to_check ){
if ( dir.canRead()){
File[] files = dir.listFiles(
new FilenameFilter() {
@Override
public boolean
accept(
File dir,
String name)
{
return( name.startsWith( "hs_err_pid" ) && name.endsWith( ".log" ));
}
});
if ( files != null ){
long now = SystemTime.getCurrentTime();
long one_week_ago = now - 7*24*60*60*1000;
for (int i=0;i<files.length;i++){
File f = files[i];
long last_mod = f.lastModified();
if ( last_mod > most_recent_time && last_mod > one_week_ago){
most_recent_dump = f;
most_recent_time = last_mod;
}
}
}
}
}
if ( most_recent_dump!= null ){
long last_done =
COConfigurationManager.getLongParameter( "diagnostics.dump.lasttime", 0 );
if ( last_done < most_recent_time ){
COConfigurationManager.setParameter( "diagnostics.dump.lasttime", most_recent_time );
analyseDump( most_recent_dump );
}
}
}catch( Throwable e ){
Debug.printStackTrace(e);
}finally{
dump_check_done_sem.releaseForever();
}
}
protected static void
analyseDump(
File file )
{
System.out.println( "Analysing " + file );
try{
LineNumberReader lnr = new LineNumberReader( new InputStreamReader( FileUtil.newFileInputStream( file )));
try{
boolean float_excep = false;
boolean swt_crash = false;
boolean browser_crash = false;
String[] bad_dlls_uc = new String[bad_dlls.length];
for (int i=0;i<bad_dlls.length;i++){
String dll = bad_dlls[i][0];
bad_dlls_uc[i] = (dll + ".dll" ).toUpperCase();
}
String alcohol_dll = "AxShlex";
List<String> matches = new ArrayList<>();
while( true ){
String line = lnr.readLine();
if ( line == null ){
break;
}
line = line.toUpperCase();
if (line.contains("EXCEPTION_FLT")){
float_excep = true;
}else{
if ( line.startsWith( "# C" ) && line.contains( "[SWT-WIN32" ) ||
line.startsWith( "# C" ) && line.contains( "[LIBSWT" )){
swt_crash = true;
}else if ( line.contains( "CURRENT THREAD" ) && line.contains( "SWT THREAD" )){
swt_crash = true;
}else if ( line.startsWith( "# C" ) &&
( line.contains( "[IEFRAME" ) ||
line.contains( "[JSCRIPT" ) ||
line.contains( "[FLASH" ) ||
line.contains( "[MSHTML" ))){
swt_crash = browser_crash = true;
}else if ( ( line.startsWith( "J " ) && line.contains( "SWT.BROWSER")) ||
( line.startsWith( "C " ) && line.contains( "[IEFRAME" )) ||
( line.startsWith( "C " ) && line.contains( "[MSHTML" )) ||
( line.startsWith( "C " ) && line.contains( "[FLASH" )) ||
( line.startsWith( "C " ) && line.contains( "[JSCRIPT" ))){
browser_crash = true;
}
for (int i=0;i<bad_dlls_uc.length;i++){
String b_uc = bad_dlls_uc[i];
if (line.contains(b_uc)){
String dll = bad_dlls[i][0];
if ( dll.equals( alcohol_dll )){
if ( float_excep ){
matches.add( dll );
}
}else{
matches.add( dll );
}
}
}
}
}
for (int i=0;i<matches.size();i++){
String dll = matches.get(i);
String detail = MessageText.getString( "platform.win32.baddll." + dll );
Logger.logTextResource(
new LogAlert(
LogAlert.REPEATABLE,
LogAlert.AT_WARNING,
"platform.win32.baddll.info" ),
new String[]{ dll + ".dll", detail });
}
if ( swt_crash && browser_crash ){
if ( Constants.isWindows || Constants.isLinux ){
if ( !COConfigurationManager.getBooleanParameter( "browser.internal.disable", false )){
COConfigurationManager.setParameter( "browser.internal.disable", true );
COConfigurationManager.save();
Logger.logTextResource(
new LogAlert(
LogAlert.REPEATABLE,
LogAlert.AT_WARNING,
"browser.internal.auto.disabled" ));
}
}
}
}finally{
lnr.close();
}
}catch( Throwable e){
Debug.printStackTrace( e );
}
}
public static void
waitForDumpChecks(
long max_wait )
{
dump_check_done_sem.reserve( max_wait );
}
public static void
addWeakEvidenceGenerator(
AEDiagnosticsEvidenceGenerator gen )
{
synchronized( evidence_generators ){
weak_evidence_generators.put( gen, null );
}
}
public static void
addEvidenceGenerator(
AEDiagnosticsEvidenceGenerator gen )
{
synchronized( evidence_generators ){
evidence_generators.add( gen );
}
}
public static void
removeEvidenceGenerator(
AEDiagnosticsEvidenceGenerator gen )
{
synchronized( evidence_generators ){
evidence_generators.remove( gen );
}
}
public static void
generateEvidence(
PrintWriter _writer )
{
IndentWriter writer = new IndentWriter( _writer );
synchronized( evidence_generators ){
for (AEDiagnosticsEvidenceGenerator gen : evidence_generators) {
try {
gen.generate(writer);
} catch (Throwable e) {
e.printStackTrace(_writer);
}
}
for (AEDiagnosticsEvidenceGenerator gen : weak_evidence_generators.keySet()) {
try {
gen.generate(writer);
} catch (Throwable e) {
e.printStackTrace(_writer);
}
}
}
writer.println( "Memory" );
try{
writer.indent();
Runtime rt = Runtime.getRuntime();
writer.println( "max=" + rt.maxMemory() + ",total=" + rt.totalMemory() + ",free=" + rt.freeMemory());
}finally{
writer.exdent();
}
}
/*
public static void
main(
String[] args )
{
analyseDump( new File( "c:\\temp\\hs_err_pid1376539.log" ));
}
*/
}
| BiglySoftware/BiglyBT | core/src/com/biglybt/core/util/AEDiagnostics.java |
213,101 | 404: Not Found | Felyndiira/liliths-throne-public | src/com/lilithsthrone/utils/colours/PresetColour.java |
213,102 | package com.lilithsthrone.game.character.attributes;
import com.lilithsthrone.utils.colours.Colour;
import com.lilithsthrone.utils.colours.PresetColour;
/**
* @since 0.2.8
* @version 0.2.8
* @author Innoxia
*/
public enum AlcoholLevel {
ZERO_SOBER("sober", 0, 0, 0.01f, PresetColour.ALCOHOL_LEVEL_ZERO),
ONE_TIPSY("tipsy", 0, 0.01f, 0.2f, PresetColour.ALCOHOL_LEVEL_ONE),
TWO_MERRY("merry", 0, 0.2f, 0.4f, PresetColour.ALCOHOL_LEVEL_TWO),
THREE_DRUNK("drunk", 30, 0.4f, 0.6f, PresetColour.ALCOHOL_LEVEL_THREE),
FOUR_HAMMERED("hammered", 20, 0.6f, 0.8f, PresetColour.ALCOHOL_LEVEL_FOUR),
FIVE_WASTED("wasted", 10, 0.8f, 1, PresetColour.ALCOHOL_LEVEL_FIVE);
private String name;
private float minimumValue;
private float maximumValue;
private Colour colour;
private int slurredSpeechFrequency;
private AlcoholLevel(String name, int slurredSpeechFrequency, float minimumValue, float maximumValue, Colour colour) {
this.name = name;
this.slurredSpeechFrequency = slurredSpeechFrequency;
this.minimumValue = minimumValue;
this.maximumValue = maximumValue;
this.colour = colour;
}
public String getName() {
return name;
}
public int getSlurredSpeechFrequency() {
return slurredSpeechFrequency;
}
public float getMinimumValue() {
return minimumValue;
}
public float getMaximumValue() {
return maximumValue;
}
public Colour getColour() {
return colour;
}
public static AlcoholLevel getAlcoholLevelFromValue(float value){
for(AlcoholLevel al : AlcoholLevel.values()) {
if(value>=al.getMinimumValue() && value<al.getMaximumValue())
return al;
}
return FIVE_WASTED;
}
}
| classicvalues/liliths-throne-public | src/com/lilithsthrone/game/character/attributes/AlcoholLevel.java |
213,103 | /*
* Copyright (c) 2020, Zoinkwiz
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.questhelper.helpers.quests.eadgarsruse;
import com.questhelper.collections.ItemCollections;
import com.questhelper.questinfo.QuestDescriptor;
import com.questhelper.questinfo.QuestHelperQuest;
import com.questhelper.requirements.zone.Zone;
import com.questhelper.panel.PanelDetails;
import com.questhelper.questhelpers.BasicQuestHelper;
import com.questhelper.requirements.item.ItemRequirement;
import com.questhelper.requirements.item.ItemRequirements;
import com.questhelper.requirements.npc.DialogRequirement;
import com.questhelper.requirements.quest.QuestRequirement;
import com.questhelper.requirements.Requirement;
import com.questhelper.requirements.player.SkillRequirement;
import com.questhelper.requirements.util.LogicType;
import com.questhelper.requirements.var.VarbitRequirement;
import com.questhelper.requirements.zone.ZoneRequirement;
import com.questhelper.requirements.conditional.Conditions;
import com.questhelper.requirements.conditional.ObjectCondition;
import com.questhelper.rewards.ExperienceReward;
import com.questhelper.rewards.QuestPointReward;
import com.questhelper.rewards.UnlockReward;
import com.questhelper.steps.ConditionalStep;
import com.questhelper.steps.DetailedQuestStep;
import com.questhelper.steps.NpcStep;
import com.questhelper.steps.ObjectStep;
import com.questhelper.steps.QuestStep;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.runelite.api.ItemID;
import net.runelite.api.NpcID;
import net.runelite.api.ObjectID;
import net.runelite.api.QuestState;
import net.runelite.api.Skill;
import net.runelite.api.coords.WorldPoint;
@QuestDescriptor(
quest = QuestHelperQuest.EADGARS_RUSE
)
public class EadgarsRuse extends BasicQuestHelper
{
//Items Required
ItemRequirement climbingBoots, climbingBootsOr12Coins, vodka, vodkaHighlight, pineappleChunks, pineappleChunksHighlight, logs2, grain10, rawChicken5, tinderbox, pestleAndMortar, ranarrPotionUnf,
coins12, cellKey2, alcoChunks, parrot, parrotAfterEadgar, robe, logs1, thistle, logHighlight, tinderboxHighlight, driedThistle, groundThistle, ranarrUnfHighlight, trollPotion, trainedParrot,
fakeMan, storeroomKey, goutweed, climbingBootsEquipped;
//Items Recommended
ItemRequirement ardougneTeleport, burthorpeTeleport;
Requirement inSanfewRoom, inTenzingHut, hasClimbingBoots, hasCoins, onMountainPath, inTrollArea1, inPrison, freedEadgar, hasCellKey2, inStrongholdFloor1, inStrongholdFloor2,
inEadgarsCave, inTrollheimArea, askedAboutAlcohol, askedAboutPineapple, fireNearby, foundOutAboutKey, inStoreroom;
DetailedQuestStep goUpToSanfew, talkToSanfew, buyClimbingBoots, travelToTenzing, getCoinsOrBoots, climbOverStile, climbOverRocks, enterSecretEntrance, freeEadgar, goUpStairsPrison,
getBerryKey, goUpToTopFloorStronghold, exitStronghold, enterEadgarsCave, talkToEadgar, leaveEadgarsCave, enterStronghold, goDownSouthStairs, talkToCook, goUpToTopFloorStrongholdFromCook,
exitStrongholdFromCook, enterEadgarsCaveFromCook, talkToEadgarFromCook, talkToPete, talkToPeteAboutAlcohol, talkToPeteAboutPineapple, useVodkaOnChunks, useChunksOnParrot, enterEadgarsCaveWithParrot,
talkToEadgarWithParrot, enterPrisonWithParrot, leaveEadgarsCaveWithParrot, enterStrongholdWithParrot, goDownNorthStairsWithParrot, goDownToPrisonWithParrot, parrotOnRack, talkToTegid, enterEadgarsCaveWithItems,
talkToEadgarWithItems, leaveEadgarsCaveForThistle, pickThistle, lightFire, useThistleOnFire, useThistleOnTrollFire, grindThistle, useGroundThistleOnRanarr, enterEadgarsCaveWithTrollPotion, giveTrollPotionToEadgar,
enterPrisonForParrot, enterStrongholdForParrot, goDownNorthStairsForParrot, goDownToPrisonForParrot, getParrotFromRack, leaveEadgarsCaveForParrot, leavePrisonWithParrot, goUpToTopFloorWithParrot, leaveStrongholdWithParrot,
enterEadgarCaveWithTrainedParrot, talkToEadgarWithTrainedParrot, leaveEadgarsCaveWithScarecrow, enterStrongholdWithScarecrow, goDownSouthStairsWithScarecrow, talkToCookWithScarecrow, talkToBurntmeat, goDownToStoreroom,
enterStoreroomDoor, getGoutweed, returnUpToSanfew, returnToSanfew;
ObjectStep searchDrawers;
PanelDetails travelToEadgarPanel;
//Zones
Zone sanfewRoom, tenzingHut, mountainPath1, mountainPath2, mountainPath3, mountainPath4, mountainPath5, trollArea1, prison, strongholdFloor1, strongholdFloor2, eadgarsCave,
trollheimArea, storeroom;
@Override
public Map<Integer, QuestStep> loadSteps()
{
loadZones();
setupRequirements();
setupConditions();
setupSteps();
if (freedEadgar.check(client))
{
travelToEadgarPanel = new PanelDetails("Travel to Eadgar",
Arrays.asList(travelToTenzing, climbOverStile, climbOverRocks, enterSecretEntrance, goUpStairsPrison,
goUpToTopFloorStronghold, enterEadgarsCave, talkToEadgar), climbingBoots);
}
else
{
travelToEadgarPanel = new PanelDetails("Travel to Eadgar", Arrays.asList(travelToTenzing, climbOverStile,
climbOverRocks, enterSecretEntrance, getBerryKey, freeEadgar, goUpStairsPrison, goUpToTopFloorStronghold,
enterEadgarsCave, talkToEadgar), climbingBoots);
}
Map<Integer, QuestStep> steps = new HashMap<>();
ConditionalStep startQuest = new ConditionalStep(this, goUpToSanfew);
startQuest.addStep(inSanfewRoom, talkToSanfew);
steps.put(0, startQuest);
ConditionalStep enterTheStronghold = new ConditionalStep(this, getCoinsOrBoots);
enterTheStronghold.addStep(new Conditions(inEadgarsCave, freedEadgar), talkToEadgar);
enterTheStronghold.addStep(new Conditions(inTrollheimArea, freedEadgar), enterEadgarsCave);
enterTheStronghold.addStep(new Conditions(inStrongholdFloor2, freedEadgar), exitStronghold);
enterTheStronghold.addStep(new Conditions(inStrongholdFloor1, freedEadgar), goUpToTopFloorStronghold);
enterTheStronghold.addStep(new Conditions(inPrison, freedEadgar), goUpStairsPrison);
enterTheStronghold.addStep(new Conditions(inPrison, hasCellKey2), freeEadgar);
enterTheStronghold.addStep(inPrison, freeEadgar);
enterTheStronghold.addStep(inTrollArea1, enterSecretEntrance);
enterTheStronghold.addStep(new Conditions(hasClimbingBoots, onMountainPath), climbOverRocks);
enterTheStronghold.addStep(new Conditions(hasClimbingBoots, inTenzingHut), climbOverStile);
enterTheStronghold.addStep(hasClimbingBoots, travelToTenzing);
enterTheStronghold.addStep(hasCoins, buyClimbingBoots);
steps.put(10, enterTheStronghold);
ConditionalStep talkToCooksAboutGoutweed = new ConditionalStep(this, getCoinsOrBoots);
talkToCooksAboutGoutweed.addStep(inEadgarsCave, leaveEadgarsCave);
talkToCooksAboutGoutweed.addStep(inTrollheimArea, enterStronghold);
talkToCooksAboutGoutweed.addStep(inStrongholdFloor2, goDownSouthStairs);
talkToCooksAboutGoutweed.addStep(inStrongholdFloor1, talkToCook);
talkToCooksAboutGoutweed.addStep(inPrison, goUpStairsPrison);
talkToCooksAboutGoutweed.addStep(inTrollArea1, enterSecretEntrance);
talkToCooksAboutGoutweed.addStep(new Conditions(hasClimbingBoots, onMountainPath), climbOverRocks);
talkToCooksAboutGoutweed.addStep(new Conditions(hasClimbingBoots, inTenzingHut), climbOverStile);
talkToCooksAboutGoutweed.addStep(hasClimbingBoots, travelToTenzing);
talkToCooksAboutGoutweed.addStep(hasCoins, buyClimbingBoots);
steps.put(15, talkToCooksAboutGoutweed);
ConditionalStep returnToEadgar = new ConditionalStep(this, getCoinsOrBoots);
returnToEadgar.addStep(inEadgarsCave, talkToEadgarFromCook);
returnToEadgar.addStep(inTrollheimArea, enterEadgarsCaveFromCook);
returnToEadgar.addStep(inStrongholdFloor2, exitStrongholdFromCook);
returnToEadgar.addStep(inStrongholdFloor1, goUpToTopFloorStrongholdFromCook);
returnToEadgar.addStep(inPrison, goUpStairsPrison);
returnToEadgar.addStep(inTrollArea1, enterSecretEntrance);
returnToEadgar.addStep(new Conditions(hasClimbingBoots, onMountainPath), climbOverRocks);
returnToEadgar.addStep(new Conditions(hasClimbingBoots, inTenzingHut), climbOverStile);
returnToEadgar.addStep(hasClimbingBoots, travelToTenzing);
steps.put(25, returnToEadgar);
ConditionalStep poisonTheParrot = new ConditionalStep(this, talkToPete);
poisonTheParrot.addStep(new Conditions(parrot, inEadgarsCave), talkToEadgarWithParrot);
poisonTheParrot.addStep(parrot, enterEadgarsCaveWithParrot);
poisonTheParrot.addStep(alcoChunks, useChunksOnParrot);
poisonTheParrot.addStep(new Conditions(askedAboutAlcohol, askedAboutPineapple), useVodkaOnChunks);
poisonTheParrot.addStep(askedAboutPineapple, talkToPeteAboutAlcohol);
poisonTheParrot.addStep(askedAboutAlcohol, talkToPeteAboutPineapple);
steps.put(30, poisonTheParrot);
ConditionalStep useParrotOnRack = new ConditionalStep(this, enterPrisonWithParrot);
useParrotOnRack.addStep(inTrollheimArea, enterStrongholdWithParrot);
useParrotOnRack.addStep(inStrongholdFloor2, goDownNorthStairsWithParrot);
useParrotOnRack.addStep(inStrongholdFloor1, goDownToPrisonWithParrot);
useParrotOnRack.addStep(inPrison, parrotOnRack);
useParrotOnRack.addStep(inEadgarsCave, leaveEadgarsCaveWithParrot);
steps.put(50, useParrotOnRack);
ConditionalStep bringItemsToEadgar = new ConditionalStep(this, talkToTegid);
bringItemsToEadgar.addStep(new Conditions(robe, inEadgarsCave), talkToEadgarWithItems);
bringItemsToEadgar.addStep(robe, enterEadgarsCaveWithItems);
steps.put(60, bringItemsToEadgar);
steps.put(70, bringItemsToEadgar);
ConditionalStep makePotion = new ConditionalStep(this, pickThistle);
makePotion.addStep(new Conditions(trollPotion, inEadgarsCave), giveTrollPotionToEadgar);
makePotion.addStep(trollPotion, enterEadgarsCaveWithTrollPotion);
makePotion.addStep(groundThistle, useGroundThistleOnRanarr);
makePotion.addStep(driedThistle, grindThistle);
makePotion.addStep(new Conditions(thistle, fireNearby), useThistleOnFire);
makePotion.addStep(new Conditions(logs1, tinderbox, thistle), lightFire);
makePotion.addStep(thistle, useThistleOnTrollFire);
makePotion.addStep(inEadgarsCave, leaveEadgarsCaveForThistle);
steps.put(80, makePotion);
ConditionalStep fetchParrot = new ConditionalStep(this, enterPrisonForParrot);
fetchParrot.addStep(inTrollheimArea, enterStrongholdForParrot);
fetchParrot.addStep(inStrongholdFloor2, goDownNorthStairsForParrot);
fetchParrot.addStep(inStrongholdFloor1, goDownToPrisonForParrot);
fetchParrot.addStep(inPrison, getParrotFromRack);
fetchParrot.addStep(inEadgarsCave, leaveEadgarsCaveForParrot);
steps.put(85, fetchParrot);
ConditionalStep returnParrotToEadgar = new ConditionalStep(this, enterEadgarCaveWithTrainedParrot);
returnParrotToEadgar.addStep(inEadgarsCave, talkToEadgarWithTrainedParrot);
returnParrotToEadgar.addStep(inTrollheimArea, enterEadgarCaveWithTrainedParrot);
returnParrotToEadgar.addStep(inStrongholdFloor2, leaveStrongholdWithParrot);
returnParrotToEadgar.addStep(inStrongholdFloor1, goUpToTopFloorWithParrot);
returnParrotToEadgar.addStep(inPrison, leavePrisonWithParrot);
steps.put(86, returnParrotToEadgar);
ConditionalStep bringManToBurntmeat = new ConditionalStep(this, enterStrongholdWithScarecrow);
bringManToBurntmeat.addStep(inEadgarsCave, leaveEadgarsCaveWithScarecrow);
bringManToBurntmeat.addStep(inStrongholdFloor2, goDownSouthStairsWithScarecrow);
bringManToBurntmeat.addStep(inStrongholdFloor1, talkToCookWithScarecrow);
bringManToBurntmeat.addStep(inPrison, goUpStairsPrison);
steps.put(87, bringManToBurntmeat);
ConditionalStep getTheGoutweed = new ConditionalStep(this, talkToBurntmeat);
getTheGoutweed.addStep(new Conditions(inSanfewRoom, goutweed), returnToSanfew);
getTheGoutweed.addStep(goutweed, returnUpToSanfew);
getTheGoutweed.addStep(new Conditions(inStoreroom, storeroomKey), getGoutweed);
getTheGoutweed.addStep(storeroomKey, goDownToStoreroom);
getTheGoutweed.addStep(foundOutAboutKey, searchDrawers);
steps.put(90, getTheGoutweed);
ConditionalStep returnGoutWeed = new ConditionalStep(this, goDownToStoreroom);
returnGoutWeed.addStep(new Conditions(inSanfewRoom, goutweed), returnToSanfew);
returnGoutWeed.addStep(goutweed, returnUpToSanfew);
returnGoutWeed.addStep(inStoreroom, getGoutweed);
steps.put(100, returnGoutWeed);
return steps;
}
@Override
public void setupRequirements()
{
climbingBoots = new ItemRequirement("Climbing boots", ItemCollections.CLIMBING_BOOTS).isNotConsumed();
climbingBootsEquipped = climbingBoots.equipped();
vodka = new ItemRequirement("Vodka", ItemID.VODKA);
pineappleChunks = new ItemRequirement("Pineapple chunks", ItemID.PINEAPPLE_CHUNKS);
pineappleChunks.setTooltip("You can make these by using a knife on a pineapple");
logs2 = new ItemRequirement("Logs", ItemID.LOGS, 2);
logs1 = new ItemRequirement("Logs", ItemCollections.LOGS_FOR_FIRE);
grain10 = new ItemRequirement("Grain", ItemID.GRAIN, 10);
rawChicken5 = new ItemRequirement("Raw chicken", ItemID.RAW_CHICKEN, 5);
tinderbox = new ItemRequirement("Tinderbox", ItemID.TINDERBOX).isNotConsumed();
pestleAndMortar = new ItemRequirement("Pestle and Mortar", ItemID.PESTLE_AND_MORTAR).isNotConsumed();
ranarrPotionUnf = new ItemRequirement("Ranarr potion (unf)", ItemID.RANARR_POTION_UNF);
ardougneTeleport = new ItemRequirement("Ardougne teleport", ItemID.ARDOUGNE_TELEPORT);
burthorpeTeleport = new ItemRequirement("Burthorpe teleport", ItemCollections.GAMES_NECKLACES);
coins12 = new ItemRequirement("Coins", ItemCollections.COINS, 12);
cellKey2 = new ItemRequirement("Cell key 2", ItemID.CELL_KEY_2);
vodkaHighlight = new ItemRequirement("Vodka", ItemID.VODKA);
vodkaHighlight.setTooltip("You can buy some from the Gnome Stronghold drinks shop");
vodkaHighlight.setHighlightInInventory(true);
// TODO: Does this meet up the item aggregation?
climbingBootsOr12Coins = new ItemRequirements(LogicType.OR, "Climbing boots or 12 coins", coins12, climbingBoots).isNotConsumed();
pineappleChunksHighlight = new ItemRequirement("Pineapple chunks", ItemID.PINEAPPLE_CHUNKS);
pineappleChunksHighlight.setTooltip("You can cut a pineapple into chunks with a knife");
pineappleChunksHighlight.setHighlightInInventory(true);
alcoChunks = new ItemRequirement("Alco-chunks", ItemID.ALCOCHUNKS);
alcoChunks.setHighlightInInventory(true);
parrot = new ItemRequirement("Drunk parrot", ItemID.DRUNK_PARROT);
parrot.setTooltip("You can get another by using alco-chunks on the aviary hatch of the parrot cage in Ardougne Zoo");
parrotAfterEadgar = new ItemRequirement("Drunk parrot", ItemID.DRUNK_PARROT);
parrotAfterEadgar.setTooltip("You can get another by talking to Eadgar");
robe = new ItemRequirement("Robe", ItemID.DIRTY_ROBE);
thistle = new ItemRequirement("Troll thistle", ItemID.TROLL_THISTLE);
thistle.setHighlightInInventory(true);
logHighlight = new ItemRequirement("Logs", ItemCollections.LOGS_FOR_FIRE);
logHighlight.setHighlightInInventory(true);
tinderboxHighlight = new ItemRequirement("Tinderbox", ItemID.TINDERBOX);
tinderboxHighlight.setHighlightInInventory(true);
driedThistle = new ItemRequirement("Dried thistle", ItemID.DRIED_THISTLE);
driedThistle.setHighlightInInventory(true);
groundThistle = new ItemRequirement("Ground thistle", ItemID.GROUND_THISTLE);
groundThistle.setHighlightInInventory(true);
ranarrUnfHighlight = new ItemRequirement("Ranarr potion (unf)", ItemID.RANARR_POTION_UNF);
ranarrUnfHighlight.setHighlightInInventory(true);
trollPotion = new ItemRequirement("Troll potion", ItemID.TROLL_POTION);
trainedParrot = new ItemRequirement("Drunk parrot", ItemID.DRUNK_PARROT);
trainedParrot.setTooltip("If you lost the parrot Eadgar will have it");
fakeMan = new ItemRequirement("Fake man", ItemID.FAKE_MAN);
fakeMan.setTooltip("You can get another from Eadgar if you lose it");
storeroomKey = new ItemRequirement("Storeroom key", ItemID.STOREROOM_KEY);
goutweed = new ItemRequirement("Goutweed", ItemID.GOUTWEED);
}
public void loadZones()
{
sanfewRoom = new Zone(new WorldPoint(2893, 3423, 1), new WorldPoint(2903, 3433, 1));
tenzingHut = new Zone(new WorldPoint(2814, 3553, 0), new WorldPoint(2822, 3562, 0));
mountainPath1 = new Zone(new WorldPoint(2814, 3563, 0), new WorldPoint(2823, 3593, 0));
mountainPath2 = new Zone(new WorldPoint(2824, 3589, 0), new WorldPoint(2831, 3599, 0));
mountainPath3 = new Zone(new WorldPoint(2832, 3595, 0), new WorldPoint(2836, 3603, 0));
mountainPath4 = new Zone(new WorldPoint(2837, 3601, 0), new WorldPoint(2843, 3607, 0));
mountainPath5 = new Zone(new WorldPoint(2844, 3607, 0), new WorldPoint(2876, 3611, 0));
trollArea1 = new Zone(new WorldPoint(2822, 3613, 0), new WorldPoint(2896, 3646, 0));
prison = new Zone(new WorldPoint(2822, 10049, 0), new WorldPoint(2859, 10110, 0));
strongholdFloor1 = new Zone(new WorldPoint(2820, 10048, 1), new WorldPoint(2862, 10110, 1));
strongholdFloor2 = new Zone(new WorldPoint(2820, 10048, 2), new WorldPoint(2862, 10110, 2));
eadgarsCave = new Zone(new WorldPoint(2884, 10074, 2), new WorldPoint(2901, 10091, 2));
trollheimArea = new Zone(new WorldPoint(2836, 3651, 0), new WorldPoint(2934, 3773, 0));
storeroom = new Zone(new WorldPoint(2850, 10063, 0), new WorldPoint(2870, 10093, 0));
}
public void setupConditions()
{
inSanfewRoom = new ZoneRequirement(sanfewRoom);
hasClimbingBoots = climbingBoots;
hasCoins = coins12;
inTenzingHut = new ZoneRequirement(tenzingHut);
onMountainPath = new ZoneRequirement(mountainPath1, mountainPath2, mountainPath3, mountainPath4, mountainPath5);
inTrollArea1 = new ZoneRequirement(trollArea1);
inPrison = new ZoneRequirement(prison);
freedEadgar = new VarbitRequirement(0, 1);
hasCellKey2 = cellKey2;
inStrongholdFloor1 = new ZoneRequirement(strongholdFloor1);
inStrongholdFloor2 = new ZoneRequirement(strongholdFloor2);
inEadgarsCave = new ZoneRequirement(eadgarsCave);
inTrollheimArea = new ZoneRequirement(trollheimArea);
askedAboutAlcohol = new Conditions(true, new DialogRequirement("Just recently."));
askedAboutPineapple = new Conditions(true, new DialogRequirement("fruit and grain mostly"));
fireNearby = new ObjectCondition(ObjectID.FIRE_26185);
foundOutAboutKey = new Conditions(true, new DialogRequirement("That's some well-guarded secret alright"));
inStoreroom = new ZoneRequirement(storeroom);
}
public void setupSteps()
{
goUpToSanfew = new ObjectStep(this, ObjectID.STAIRCASE_16671, new WorldPoint(2899, 3429, 0), "Talk to Sanfew upstairs in the Taverley herblore store.");
talkToSanfew = new NpcStep(this, NpcID.SANFEW, new WorldPoint(2899, 3429, 1), "Talk to Sanfew upstairs in the Taverley herblore store.");
talkToSanfew.addDialogStep("Ask general questions.");
talkToSanfew.addDialogStep("Have you any more work for me, to help reclaim the circle?");
talkToSanfew.addDialogStep("I'll do it.");
talkToSanfew.addDialogStep("Yes.");
talkToSanfew.addSubSteps(goUpToSanfew);
getCoinsOrBoots = new DetailedQuestStep(this, "Get some climbing boots or 12 coins.", climbingBootsOr12Coins);
travelToTenzing = new DetailedQuestStep(this, new WorldPoint(2820, 3555, 0), "Follow the path west of Burthorpe, then go along the path going south.");
buyClimbingBoots = new NpcStep(this, NpcID.TENZING, new WorldPoint(2820, 3555, 0), "Follow the path west of Burthorpe, then go along the path going south. Buy some climbing boots from Tenzing in his hut here.", coins12);
buyClimbingBoots.addDialogStep("Can I buy some Climbing boots?");
buyClimbingBoots.addDialogStep("OK, sounds good.");
travelToTenzing.addSubSteps(getCoinsOrBoots, buyClimbingBoots);
climbOverStile = new ObjectStep(this, ObjectID.STILE_3730, new WorldPoint(2817, 3563, 0), "Climb over the stile north of Tenzing.");
climbOverRocks = new ObjectStep(this, ObjectID.ROCKS_3748, new WorldPoint(2856, 3612, 0), "Follow the path until you reach some rocks. Climb over them.", climbingBoots.equipped());
enterSecretEntrance = new ObjectStep(this, ObjectID.SECRET_DOOR, new WorldPoint(2828, 3647, 0), "Enter the Secret Door to the Troll Stronghold.");
if (client.getRealSkillLevel(Skill.THIEVING) >= 30)
{
getBerryKey = new NpcStep(this, NpcID.BERRY_4134, new WorldPoint(2833, 10083, 0), "Pickpocket or kill Berry for a cell key.");
}
else
{
getBerryKey = new NpcStep(this, NpcID.BERRY_4134, new WorldPoint(2833, 10083, 0), "Kill Berry for a cell key.");
}
freeEadgar = new ObjectStep(this, ObjectID.CELL_DOOR_3765, new WorldPoint(2832, 10082, 0), "Unlock Eadgar's cell.");
goUpStairsPrison = new ObjectStep(this, ObjectID.STONE_STAIRCASE, new WorldPoint(2853, 10107, 0), "Go up the stairs from the prison.");
goUpToTopFloorStronghold = new ObjectStep(this, ObjectID.STONE_STAIRCASE, new WorldPoint(2843, 10109, 1), "Go up to the next floor of the Stronghold.");
exitStronghold = new ObjectStep(this, ObjectID.EXIT_3772, new WorldPoint(2838, 10091, 2), "Leave the Stronghold.");
enterEadgarsCave = new ObjectStep(this, ObjectID.CAVE_ENTRANCE_3759, new WorldPoint(2893, 3673, 0), "Climb to the top of Trollheim and enter Eadgar's cave.");
talkToEadgar = new NpcStep(this, NpcID.EADGAR, new WorldPoint(2891, 10086, 2), "Talk to Eadgar.");
talkToEadgar.addDialogStep("I need to find some goutweed.");
leaveEadgarsCave = new ObjectStep(this, ObjectID.CAVE_EXIT_3760, new WorldPoint(2893, 10073, 2), "Leave Eadgar's cave.");
enterStronghold = new ObjectStep(this, ObjectID.STRONGHOLD, new WorldPoint(2839, 3690, 0), "Enter the Troll Stronghold.");
goDownSouthStairs = new ObjectStep(this, ObjectID.STONE_STAIRCASE_3789, new WorldPoint(2844, 10052, 2), "Go down the south staircase.");
talkToCook = new NpcStep(this, NpcID.BURNTMEAT, new WorldPoint(2845, 10057, 1), "Talk to Burntmeat.");
goUpToTopFloorStrongholdFromCook = new ObjectStep(this, ObjectID.STONE_STAIRCASE, new WorldPoint(2843, 10052, 1), "Go up to the next floor of the Stronghold.");
exitStrongholdFromCook = new ObjectStep(this, ObjectID.EXIT_3772, new WorldPoint(2838, 10091, 2), "Leave the Stronghold.");
enterEadgarsCaveFromCook = new ObjectStep(this, ObjectID.CAVE_ENTRANCE_3759, new WorldPoint(2893, 3673, 0), "Climb to the top of Trollheim and enter Eadgar's cave.");
talkToEadgarFromCook = new NpcStep(this, NpcID.EADGAR, new WorldPoint(2891, 10086, 2), "Talk to Eadgar in his cave on top of Trollheim.");
talkToEadgarFromCook.addSubSteps(goUpToTopFloorStrongholdFromCook, exitStrongholdFromCook, enterEadgarsCaveFromCook);
talkToPete = new NpcStep(this, NpcID.PARROTY_PETE, new WorldPoint(2612, 3285, 0), "Travel to Ardougne Zoo and talk to Parroty Pete. Ask him both question 2 and 3, then use the vodka on the pineapple chunks.", pineappleChunks, vodka);
talkToPete.addDialogStep("No thanks, Eadgar.");
talkToPete.addDialogStep("What do you feed them?");
talkToPete.addDialogStep("When did you add it?");
talkToPeteAboutAlcohol = new NpcStep(this, NpcID.PARROTY_PETE, new WorldPoint(2612, 3285, 0), "Travel to Ardougne Zoo and talk to Parroty Pete. Ask him question 3 then use the vodka on the pineapple chunks.", pineappleChunks, vodka);
talkToPeteAboutAlcohol.addDialogStep("When did you add it?");
talkToPeteAboutPineapple = new NpcStep(this, NpcID.PARROTY_PETE, new WorldPoint(2612, 3285, 0), "Travel to Ardougne Zoo and talk to Parroty Pete. Ask question 2 then use the vodka on the pineapple chunks.", pineappleChunks, vodka);
talkToPeteAboutPineapple.addDialogStep("What do you feed them?");
useVodkaOnChunks = new DetailedQuestStep(this, "Use vodka on your pineapple chunks", pineappleChunksHighlight, vodkaHighlight);
talkToPete.addSubSteps(talkToPeteAboutAlcohol, talkToPeteAboutPineapple, useVodkaOnChunks);
useChunksOnParrot = new ObjectStep(this, ObjectID.AVIARY_HATCH, new WorldPoint(2611, 3287, 0), "Use the alco-chunks on the aviary hatch of the parrot cage.", alcoChunks);
useChunksOnParrot.addIcon(ItemID.ALCOCHUNKS);
enterEadgarsCaveWithParrot = new ObjectStep(this, ObjectID.CAVE_ENTRANCE_3759, new WorldPoint(2893, 3673, 0), "Return the parrot to Eadgar on top of Trollheim.", parrot, climbingBoots.equipped());
talkToEadgarWithParrot = new NpcStep(this, NpcID.EADGAR, new WorldPoint(2891, 10086, 2), "Return the parrot to Eadgar on top of Trollheim.");
talkToEadgarWithParrot.addSubSteps(enterEadgarsCaveWithParrot);
leaveEadgarsCaveWithParrot = new ObjectStep(this, ObjectID.CAVE_EXIT_3760, new WorldPoint(2893, 10073, 2), "Take the parrot to the Troll Stronghold prison.", parrotAfterEadgar);
leaveEadgarsCaveWithParrot.addDialogStep("No thanks, Eadgar.");
enterStrongholdWithParrot = new ObjectStep(this, ObjectID.STRONGHOLD, new WorldPoint(2839, 3690, 0), "Take the parrot to the Troll Stronghold prison, and hide it in the rack there.", parrotAfterEadgar);
goDownNorthStairsWithParrot = new ObjectStep(this, ObjectID.STONE_STAIRCASE_3789, new WorldPoint(2844, 10109, 2), "Take the parrot to the Troll Stronghold prison, and hide it in the rack there.", parrotAfterEadgar);
goDownToPrisonWithParrot = new ObjectStep(this, ObjectID.STONE_STAIRCASE_3789, new WorldPoint(2853, 10108, 1), "Take the parrot to the Troll Stronghold prison, and hide it in the rack there.", parrotAfterEadgar);
enterPrisonWithParrot = new ObjectStep(this, ObjectID.SECRET_DOOR, new WorldPoint(2828, 3647, 0), "Take the parrot to the Troll Stronghold prison, and hide it in the rack there.", parrotAfterEadgar, climbingBoots);
parrotOnRack = new ObjectStep(this, ObjectID.RACK_3821, new WorldPoint(2829, 10097, 0), "Use the parrot on a rack in the prison.", parrotAfterEadgar.highlighted());
parrotOnRack.addIcon(ItemID.DRUNK_PARROT);
enterStrongholdWithParrot.addSubSteps(leaveEadgarsCaveWithParrot, goDownNorthStairsWithParrot, goDownToPrisonWithParrot, parrotOnRack, enterPrisonWithParrot);
talkToTegid = new NpcStep(this, NpcID.TEGID, new WorldPoint(2910, 3417, 0), "Talk to Tegid in the south of Taverley for a dirty robe. Once you have it, return to Eadgar with all the items he needs.", robe, grain10, rawChicken5, logs2, climbingBoots, ranarrPotionUnf, tinderbox, pestleAndMortar);
talkToTegid.addDialogStep("Sanfew won't be happy...");
enterEadgarsCaveWithItems = new ObjectStep(this, ObjectID.CAVE_ENTRANCE_3759, new WorldPoint(2893, 3673, 0), "Bring Eadgar all the listed items. Check the quest log if you're not sure what items you've already handed in.", robe, grain10, rawChicken5, logs2, climbingBoots.equipped(), ranarrPotionUnf, tinderbox, pestleAndMortar);
talkToEadgarWithItems = new NpcStep(this, NpcID.EADGAR, new WorldPoint(2891, 10086, 2), "Bring Eadgar all the listed items. Check the quest log if you're not sure what items you've already handed in.", robe, grain10, rawChicken5, logs2, climbingBoots, ranarrPotionUnf, tinderbox, pestleAndMortar);
talkToEadgarWithItems.addSubSteps(enterEadgarsCaveWithItems);
leaveEadgarsCaveForThistle = new ObjectStep(this, ObjectID.CAVE_EXIT_3760, new WorldPoint(2893, 10073, 2), "Go pick a troll thistle from outside Eadgar's cave.", ranarrPotionUnf);
leaveEadgarsCaveForThistle.addDialogStep("No thanks, Eadgar.");
pickThistle = new NpcStep(this, NpcID.THISTLE, new WorldPoint(2887, 3675, 0), "Go pick a troll thistle from outside Eadgar's cave.", ranarrPotionUnf, logs1, tinderbox);
pickThistle.addSubSteps(leaveEadgarsCaveForThistle);
lightFire = new DetailedQuestStep(this, "Light a fire then use the troll thistle on it.", logHighlight, tinderboxHighlight);
useThistleOnFire = new ObjectStep(this, ObjectID.FIRE_26185, "Use the troll thistle on the fire.", thistle);
useThistleOnFire.addIcon(ItemID.THISTLE);
useThistleOnTrollFire = new ObjectStep(this, ObjectID.FIRE, new WorldPoint(2849, 3678, 0), "Use the troll thistle on one of the fire outside the Troll Stronghold.", thistle);
useThistleOnTrollFire.addIcon(ItemID.THISTLE);
useThistleOnFire.addSubSteps(useThistleOnTrollFire);
grindThistle = new DetailedQuestStep(this, "Use the pestle and mortar on the dried thistle", pestleAndMortar.highlighted(), driedThistle.highlighted());
useGroundThistleOnRanarr = new DetailedQuestStep(this, "Use the ground thistle on a ranarr potion (unf)", groundThistle, ranarrUnfHighlight);
enterEadgarsCaveWithTrollPotion = new ObjectStep(this, ObjectID.CAVE_ENTRANCE_3759, new WorldPoint(2893, 3673, 0), "Bring Eadgar the troll potion.", trollPotion);
giveTrollPotionToEadgar = new NpcStep(this, NpcID.EADGAR, new WorldPoint(2891, 10086, 2), "Bring Eadgar the troll potion.", trollPotion);
giveTrollPotionToEadgar.addSubSteps(enterEadgarsCaveWithTrollPotion);
leaveEadgarsCaveForParrot = new ObjectStep(this, ObjectID.CAVE_EXIT_3760, new WorldPoint(2893, 10073, 2), "Get the parrot from the Troll Stronghold prison.");
enterStrongholdForParrot = new ObjectStep(this, ObjectID.STRONGHOLD, new WorldPoint(2839, 3690, 0), "Get the parrot from the Troll Stronghold prison.");
goDownNorthStairsForParrot = new ObjectStep(this, ObjectID.STONE_STAIRCASE_3789, new WorldPoint(2844, 10109, 2), "Get the parrot from the Troll Stronghold prison.");
goDownToPrisonForParrot = new ObjectStep(this, ObjectID.STONE_STAIRCASE_3789, new WorldPoint(2853, 10108, 1), "Get the parrot from the Troll Stronghold prison.");
enterPrisonForParrot = new ObjectStep(this, ObjectID.SECRET_DOOR, new WorldPoint(2828, 3647, 0), "Get the parrot from the Troll Stronghold prison.", climbingBoots);
getParrotFromRack = new ObjectStep(this, ObjectID.RACK_3821, new WorldPoint(2829, 10097, 0), "Get the parrot from the rack in the prison.");
enterStrongholdForParrot.addSubSteps(leaveEadgarsCaveForParrot, goDownNorthStairsForParrot, goDownToPrisonForParrot, enterPrisonForParrot, getParrotFromRack);
leavePrisonWithParrot = new ObjectStep(this, ObjectID.STONE_STAIRCASE, new WorldPoint(2853, 10107, 0), "Return to Eadgar with the parrot.", trainedParrot);
goUpToTopFloorWithParrot = new ObjectStep(this, ObjectID.STONE_STAIRCASE, new WorldPoint(2843, 10109, 1), "Return to Eadgar with the parrot.", trainedParrot);
leaveStrongholdWithParrot = new ObjectStep(this, ObjectID.EXIT_3772, new WorldPoint(2838, 10091, 2), "Return to Eadgar with the parrot.", trainedParrot);
enterEadgarCaveWithTrainedParrot = new ObjectStep(this, ObjectID.CAVE_ENTRANCE_3759, new WorldPoint(2893, 3673, 0), "Return to Eadgar with the parrot.", trainedParrot);
talkToEadgarWithTrainedParrot = new NpcStep(this, NpcID.EADGAR, new WorldPoint(2891, 10086, 2), "Return to Eadgar with the parrot.", trainedParrot);
leaveStrongholdWithParrot.addSubSteps(leavePrisonWithParrot, goUpToTopFloorWithParrot, leaveStrongholdWithParrot, enterEadgarCaveWithTrainedParrot, talkToEadgarWithTrainedParrot);
leaveEadgarsCaveWithScarecrow = new ObjectStep(this, ObjectID.CAVE_EXIT_3760, new WorldPoint(2893, 10073, 2), "Take the fake man to Burntmeat.", fakeMan);
leaveEadgarsCaveWithScarecrow.addDialogStep("No thanks, Eadgar.");
enterStrongholdWithScarecrow = new ObjectStep(this, ObjectID.STRONGHOLD, new WorldPoint(2839, 3690, 0), "Take the fake man to Burntmeat.", fakeMan);
goDownSouthStairsWithScarecrow = new ObjectStep(this, ObjectID.STONE_STAIRCASE_3789, new WorldPoint(2844, 10052, 2), "Take the fake man to Burntmeat.", fakeMan);
talkToCookWithScarecrow = new NpcStep(this, NpcID.BURNTMEAT, new WorldPoint(2845, 10057, 1), "Take the fake man to Burntmeat.", fakeMan);
talkToBurntmeat = new NpcStep(this, NpcID.BURNTMEAT, new WorldPoint(2845, 10057, 1), "Talk to Burntmeat in the Troll Stronghold kitchen.");
talkToBurntmeat.addDialogStep("So, where can I get some goutweed?");
enterStrongholdWithScarecrow.addSubSteps(leaveEadgarsCaveWithScarecrow, goDownSouthStairsWithScarecrow, talkToCookWithScarecrow, talkToBurntmeat);
searchDrawers = new ObjectStep(this, ObjectID.KITCHEN_DRAWERS, new WorldPoint(2853, 10050, 1), "Search the kitchen drawers south east of Burntmeat.");
searchDrawers.addAlternateObjects(ObjectID.KITCHEN_DRAWERS_3817);
goDownToStoreroom = new ObjectStep(this, ObjectID.STONE_STAIRCASE_3789, new WorldPoint(2852, 10061, 1), "Go down to the storeroom from the Troll Stronghold kitchen.");
enterStoreroomDoor = new ObjectStep(this, ObjectID.STOREROOM_DOOR, new WorldPoint(2869, 10085, 0), "Enter the storeroom.", storeroomKey);
getGoutweed = new ObjectStep(this, ObjectID.GOUTWEED_CRATE, new WorldPoint(2857, 10074, 0), "Search the goutweed crates for goutweed. You'll need to avoid the troll guards or you'll be kicked out and take damage.");
returnUpToSanfew = new ObjectStep(this, ObjectID.STAIRCASE_16671, new WorldPoint(2899, 3429, 0), "If you wish to do Dream Mentor or Dragon Slayer II, grab two more goutweed. Afterwards, return to Sanfew upstairs in the Taverley herblore store.", goutweed);
returnToSanfew = new NpcStep(this, NpcID.SANFEW, new WorldPoint(2899, 3429, 1), "If you wish to do Dream Mentor or Dragon Slayer II, grab two more goutweed. Afterwards, return to Sanfew upstairs in the Taverley herblore store.", goutweed);
returnToSanfew.addDialogStep("Ask general questions.");
returnToSanfew.addSubSteps(returnUpToSanfew);
}
@Override
public List<ItemRequirement> getItemRequirements()
{
ArrayList<ItemRequirement> reqs = new ArrayList<>();
reqs.add(climbingBootsOr12Coins);
reqs.add(vodka);
reqs.add(pineappleChunks);
reqs.add(logs2);
reqs.add(grain10);
reqs.add(rawChicken5);
reqs.add(tinderbox);
reqs.add(pestleAndMortar);
reqs.add(ranarrPotionUnf);
return reqs;
}
@Override
public List<ItemRequirement> getItemRecommended()
{
ArrayList<ItemRequirement> reqs = new ArrayList<>();
reqs.add(ardougneTeleport);
reqs.add(burthorpeTeleport);
return reqs;
}
@Override
public QuestPointReward getQuestPointReward()
{
return new QuestPointReward(1);
}
@Override
public List<ExperienceReward> getExperienceRewards()
{
return Collections.singletonList(new ExperienceReward(Skill.HERBLORE, 11000));
}
@Override
public List<UnlockReward> getUnlockRewards()
{
return Arrays.asList(
new UnlockReward("Ability to use the Trollheim teleport"),
new UnlockReward("Ability to use Scrolls of Redirection to Trollheim."),
new UnlockReward("Ability to trade Goutweed to Sanfew for herbs."));
}
@Override
public List<PanelDetails> getPanels()
{
List<PanelDetails> allSteps = new ArrayList<>();
allSteps.add(new PanelDetails("Start the quest", Collections.singletonList(talkToSanfew)));
allSteps.add(travelToEadgarPanel);
allSteps.add(new PanelDetails("Talk to Burntmeat", Arrays.asList(leaveEadgarsCave, enterStronghold, goDownSouthStairs,
talkToCook, talkToEadgarFromCook), climbingBoots));
allSteps.add(new PanelDetails("Get a parrot", Arrays.asList(talkToPete, useChunksOnParrot, talkToEadgarWithParrot,
enterStrongholdWithParrot), vodka, pineappleChunks, climbingBoots));
allSteps.add(new PanelDetails("Making a fake man", Arrays.asList(talkToTegid, talkToEadgarWithItems, pickThistle,
lightFire, useThistleOnFire, grindThistle, useGroundThistleOnRanarr, giveTrollPotionToEadgar, enterStrongholdForParrot,
leaveStrongholdWithParrot), climbingBoots, logs2, tinderbox, pestleAndMortar, grain10, rawChicken5, ranarrPotionUnf));
allSteps.add(new PanelDetails("Get the Goutweed", Arrays.asList(enterStrongholdWithScarecrow, searchDrawers,
goDownToStoreroom, enterStoreroomDoor, getGoutweed, returnToSanfew)));
return allSteps;
}
@Override
public List<Requirement> getGeneralRequirements()
{
ArrayList<Requirement> req = new ArrayList<>();
req.add(new QuestRequirement(QuestHelperQuest.DRUIDIC_RITUAL, QuestState.FINISHED));
req.add(new QuestRequirement(QuestHelperQuest.TROLL_STRONGHOLD, QuestState.FINISHED));
req.add(new SkillRequirement(Skill.HERBLORE, 31, true));
return req;
}
}
| Zoinkwiz/quest-helper | src/main/java/com/questhelper/helpers/quests/eadgarsruse/EadgarsRuse.java |
213,107 | package nl.topicus.cobra.hibernate.id;
import org.hibernate.cfg.Configuration;
public class AbstractConfigurableId
{
// We ondersteunen de volgende soorten database.
public enum DatabaseType
{
SQLServer,
Oracle;
}
// Het soort database, standaard Oracle.
private DatabaseType databaseType = DatabaseType.Oracle;
/**
*
* Constructor. Bepaalt in welke modus de class moet staan. Wordt bepaalt door de
* parameter hibernate.connection.type op te halen uit de properties.
*/
public AbstractConfigurableId()
{
String sType = new Configuration().getProperty("hibernate.connection.type");
if (sType != null && sType.equals("SQLServer"))
{
setDatabaseType(DatabaseType.SQLServer);
}
else
{
setDatabaseType(DatabaseType.Oracle);
}
}
/**
* Zet de database type.
*
* @param databaseType
* De type database.
*/
public void setDatabaseType(DatabaseType databaseType)
{
this.databaseType = databaseType;
}
/**
* Get het database type.
*
* @return De database type.
*/
public DatabaseType getDatabaseType()
{
return databaseType;
}
}
| topicusonderwijs/tribe-krd-opensource | cobra/hibernate/src/main/java/nl/topicus/cobra/hibernate/id/AbstractConfigurableId.java |
213,113 | /**
* Vincent Verboven
* 14/11/2022
*/
public enum Soort {
GEWOON,STEUNEND,ERELID
}
| Meastro85/OOPROG-Java1 | P2W1/P2W1/Voetbalclub/src/Soort.java |
213,114 | package com.kapti.backend.logging;
/*
* TagSyslogAppender.java
* StockPlay - Uitbreiding van de SyslogAppender om tagging te ondersteunen.
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Layout;
import org.apache.log4j.helpers.SyslogQuietWriter;
import org.apache.log4j.helpers.SyslogWriter;
import org.apache.log4j.spi.LoggingEvent;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.net.InetAddress;
import java.net.UnknownHostException;
// Contributors: Yves Bossel <[email protected]>
// Christopher Taylor <[email protected]>
/**
* Use SyslogAppender to send log messages to a remote syslog daemon.
*
* @author Ceki Gülcü
* @author Anders Kristensen
*/
public class TagSyslogAppender extends AppenderSkeleton {
// The following constants are extracted from a syslog.h file
// copyrighted by the Regents of the University of California
// I hope nobody at Berkley gets offended.
/** Kernel messages */
final static public int LOG_KERN = 0;
/** Random user-level messages */
final static public int LOG_USER = 1 << 3;
/** Mail system */
final static public int LOG_MAIL = 2 << 3;
/** System daemons */
final static public int LOG_DAEMON = 3 << 3;
/** security/authorization messages */
final static public int LOG_AUTH = 4 << 3;
/** messages generated internally by syslogd */
final static public int LOG_SYSLOG = 5 << 3;
/** line printer subsystem */
final static public int LOG_LPR = 6 << 3;
/** network news subsystem */
final static public int LOG_NEWS = 7 << 3;
/** UUCP subsystem */
final static public int LOG_UUCP = 8 << 3;
/** clock daemon */
final static public int LOG_CRON = 9 << 3;
/** security/authorization messages (private) */
final static public int LOG_AUTHPRIV = 10 << 3;
/** ftp daemon */
final static public int LOG_FTP = 11 << 3;
// other codes through 15 reserved for system use
/** reserved for local use */
final static public int LOG_LOCAL0 = 16 << 3;
/** reserved for local use */
final static public int LOG_LOCAL1 = 17 << 3;
/** reserved for local use */
final static public int LOG_LOCAL2 = 18 << 3;
/** reserved for local use */
final static public int LOG_LOCAL3 = 19 << 3;
/** reserved for local use */
final static public int LOG_LOCAL4 = 20 << 3;
/** reserved for local use */
final static public int LOG_LOCAL5 = 21 << 3;
/** reserved for local use */
final static public int LOG_LOCAL6 = 22 << 3;
/** reserved for local use*/
final static public int LOG_LOCAL7 = 23 << 3;
protected static final int SYSLOG_HOST_OI = 0;
protected static final int FACILITY_OI = 1;
static final String TAB = " ";
// Have LOG_USER as default
int syslogFacility = LOG_USER;
//SyslogTracerPrintWriter stp;
SyslogQuietWriter sqw;
String syslogHost;
boolean tagPrinting = false;
String tagLabel;
/**
* If true, the appender will generate the HEADER (timestamp and host name)
* part of the syslog packet.
* @since 1.2.15
*/
private boolean header = false;
/**
* Date format used if header = true.
* @since 1.2.15
*/
private final SimpleDateFormat dateFormat = new SimpleDateFormat("MMM dd HH:mm:ss ", Locale.ENGLISH);
/**
* Host name used to identify messages from this appender.
* @since 1.2.15
*/
private String localHostname;
/**
* Set to true after the header of the layout has been sent or if it has none.
*/
private boolean layoutHeaderChecked = false;
public TagSyslogAppender() {
}
public TagSyslogAppender(Layout layout, int syslogFacility) {
this.layout = layout;
this.syslogFacility = syslogFacility;
}
public TagSyslogAppender(Layout layout, String syslogHost, int syslogFacility) {
this(layout, syslogFacility);
setSyslogHost(syslogHost);
}
/**
Release any resources held by this SyslogAppender.
@since 0.8.4
*/
synchronized public void close() {
closed = true;
if (sqw != null) {
try {
if (layoutHeaderChecked && layout != null && layout.getFooter() != null) {
sendLayoutMessage(layout.getFooter());
}
sqw.close();
sqw = null;
} catch (java.io.IOException ex) {
sqw = null;
}
}
}
/**
Returns the specified syslog facility as a lower-case String,
e.g. "kern", "user", etc.
*/
public static String getFacilityString(int syslogFacility) {
switch (syslogFacility) {
case LOG_KERN:
return "kern";
case LOG_USER:
return "user";
case LOG_MAIL:
return "mail";
case LOG_DAEMON:
return "daemon";
case LOG_AUTH:
return "auth";
case LOG_SYSLOG:
return "syslog";
case LOG_LPR:
return "lpr";
case LOG_NEWS:
return "news";
case LOG_UUCP:
return "uucp";
case LOG_CRON:
return "cron";
case LOG_AUTHPRIV:
return "authpriv";
case LOG_FTP:
return "ftp";
case LOG_LOCAL0:
return "local0";
case LOG_LOCAL1:
return "local1";
case LOG_LOCAL2:
return "local2";
case LOG_LOCAL3:
return "local3";
case LOG_LOCAL4:
return "local4";
case LOG_LOCAL5:
return "local5";
case LOG_LOCAL6:
return "local6";
case LOG_LOCAL7:
return "local7";
default:
return null;
}
}
/**
Returns the integer value corresponding to the named syslog
facility, or -1 if it couldn't be recognized.
@param facilityName one of the strings KERN, USER, MAIL, DAEMON,
AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, LOCAL0,
LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.
The matching is case-insensitive.
@since 1.1
*/
public static int getFacility(String facilityName) {
if (facilityName != null) {
facilityName = facilityName.trim();
}
if ("KERN".equalsIgnoreCase(facilityName)) {
return LOG_KERN;
} else if ("USER".equalsIgnoreCase(facilityName)) {
return LOG_USER;
} else if ("MAIL".equalsIgnoreCase(facilityName)) {
return LOG_MAIL;
} else if ("DAEMON".equalsIgnoreCase(facilityName)) {
return LOG_DAEMON;
} else if ("AUTH".equalsIgnoreCase(facilityName)) {
return LOG_AUTH;
} else if ("SYSLOG".equalsIgnoreCase(facilityName)) {
return LOG_SYSLOG;
} else if ("LPR".equalsIgnoreCase(facilityName)) {
return LOG_LPR;
} else if ("NEWS".equalsIgnoreCase(facilityName)) {
return LOG_NEWS;
} else if ("UUCP".equalsIgnoreCase(facilityName)) {
return LOG_UUCP;
} else if ("CRON".equalsIgnoreCase(facilityName)) {
return LOG_CRON;
} else if ("AUTHPRIV".equalsIgnoreCase(facilityName)) {
return LOG_AUTHPRIV;
} else if ("FTP".equalsIgnoreCase(facilityName)) {
return LOG_FTP;
} else if ("LOCAL0".equalsIgnoreCase(facilityName)) {
return LOG_LOCAL0;
} else if ("LOCAL1".equalsIgnoreCase(facilityName)) {
return LOG_LOCAL1;
} else if ("LOCAL2".equalsIgnoreCase(facilityName)) {
return LOG_LOCAL2;
} else if ("LOCAL3".equalsIgnoreCase(facilityName)) {
return LOG_LOCAL3;
} else if ("LOCAL4".equalsIgnoreCase(facilityName)) {
return LOG_LOCAL4;
} else if ("LOCAL5".equalsIgnoreCase(facilityName)) {
return LOG_LOCAL5;
} else if ("LOCAL6".equalsIgnoreCase(facilityName)) {
return LOG_LOCAL6;
} else if ("LOCAL7".equalsIgnoreCase(facilityName)) {
return LOG_LOCAL7;
} else {
return -1;
}
}
private void splitPacket(final String header, final String packet) {
int byteCount = packet.getBytes().length;
//
// if packet is less than RFC 3164 limit
// of 1024 bytes, then write it
// (must allow for up 5to 5 characters in the PRI section
// added by SyslogQuietWriter)
if (byteCount <= 1019) {
sqw.write(packet);
} else {
int split = header.length() + (packet.length() - header.length()) / 2;
splitPacket(header, packet.substring(0, split) + "...");
splitPacket(header, header + "..." + packet.substring(split));
}
}
public void append(LoggingEvent event) {
if (!isAsSevereAsThreshold(event.getLevel())) {
return;
}
// We must not attempt to append if sqw is null.
if (sqw == null) {
errorHandler.error("No syslog host is set for SyslogAppedender named \""
+ this.name + "\".");
return;
}
if (!layoutHeaderChecked) {
if (layout != null && layout.getHeader() != null) {
sendLayoutMessage(layout.getHeader());
}
layoutHeaderChecked = true;
}
String hdr = getPacketHeader(event.timeStamp);
String packet = layout.format(event);
if (tagPrinting || hdr.length() > 0) {
StringBuffer buf = new StringBuffer(hdr);
if (tagPrinting) {
buf.append(tagLabel);
}
hdr = buf.toString();
buf.append(packet);
packet = buf.toString();
}
sqw.setLevel(event.getLevel().getSyslogEquivalent());
//
// if message has a remote likelihood of exceeding 1024 bytes
// when encoded, consider splitting message into multiple packets
if (packet.length() > 256) {
splitPacket(hdr, packet);
} else {
sqw.write(packet);
}
if (layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
for (int i = 0; i < s.length; i++) {
if (s[i].startsWith("\t")) {
sqw.write(hdr + TAB + s[i].substring(1));
} else {
sqw.write(hdr + s[i]);
}
}
}
}
}
/**
This method returns immediately as options are activated when they
are set.
*/
@Override
public void activateOptions() {
if (header) {
getLocalHostname();
}
if (layout != null && layout.getHeader() != null) {
sendLayoutMessage(layout.getHeader());
}
layoutHeaderChecked = true;
}
/**
The SyslogAppender requires a layout. Hence, this method returns
<code>true</code>.
@since 0.8.4 */
public boolean requiresLayout() {
return true;
}
/**
The <b>SyslogHost</b> option is the name of the the syslog host
where log output should go. A non-default port can be specified by
appending a colon and port number to a host name,
an IPv4 address or an IPv6 address enclosed in square brackets.
<b>WARNING</b> If the SyslogHost is not set, then this appender
will fail.
*/
public void setSyslogHost(final String syslogHost) {
this.sqw = new SyslogQuietWriter(new SyslogWriter(syslogHost),
syslogFacility, errorHandler);
//this.stp = new SyslogTracerPrintWriter(sqw);
this.syslogHost = syslogHost;
}
/**
Returns the value of the <b>SyslogHost</b> option.
*/
public String getSyslogHost() {
return syslogHost;
}
/**
Set the syslog facility. This is the <b>Facility</b> option.
<p>The <code>facilityName</code> parameter must be one of the
strings KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP,
CRON, AUTHPRIV, FTP, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4,
LOCAL5, LOCAL6, LOCAL7. Case is unimportant.
@since 0.8.1 */
public void setFacility(String facilityName) {
if (facilityName == null) {
return;
}
syslogFacility = getFacility(facilityName);
if (syslogFacility == -1) {
System.err.println("[" + facilityName
+ "] is an unknown syslog facility. Defaulting to [USER].");
syslogFacility = LOG_USER;
}
// If there is already a sqw, make it use the new facility.
if (sqw != null) {
sqw.setSyslogFacility(this.syslogFacility);
}
}
/**
Returns the value of the <b>Facility</b> option.
*/
public String getFacility() {
return getFacilityString(syslogFacility);
}
/**
If the <b>TagPrinting</b> option is set to true, the printed
message will include the facility name of the application. It is
<em>false</em> by default.
*/
public void setTagPrinting(boolean on) {
tagPrinting = on;
}
/**
Returns the value of the <b>TagPrinting</b> option.
*/
public boolean getTagPrinting() {
return tagPrinting;
}
/**
If the <b>TagLabe</b> option is the tag that will be pe appended to
Syslog message content if TagPrinting is on.
*/
public void setTagLabel(String tagLabel) {
this.tagLabel = tagLabel + ":";
}
/**
Returns the value of the <b>TagLabel</b> option.
*/
public String getTagLabel() {
return tagLabel;
}
/**
* If true, the appender will generate the HEADER part (that is, timestamp and host name)
* of the syslog packet. Default value is false for compatibility with existing behavior,
* however should be true unless there is a specific justification.
* @since 1.2.15
*/
public final boolean getHeader() {
return header;
}
/**
* Returns whether the appender produces the HEADER part (that is, timestamp and host name)
* of the syslog packet.
* @since 1.2.15
*/
public final void setHeader(final boolean val) {
header = val;
}
/**
* Get the host name used to identify this appender.
* @return local host name
* @since 1.2.15
*/
private String getLocalHostname() {
if (localHostname == null) {
try {
InetAddress addr = InetAddress.getLocalHost();
localHostname = addr.getHostName();
} catch (UnknownHostException uhe) {
localHostname = "UNKNOWN_HOST";
}
}
return localHostname;
}
/**
* Gets HEADER portion of packet.
* @param timeStamp number of milliseconds after the standard base time.
* @return HEADER portion of packet, will be zero-length string if header is false.
* @since 1.2.15
*/
private String getPacketHeader(final long timeStamp) {
if (header) {
StringBuffer buf = new StringBuffer(dateFormat.format(new Date(timeStamp)));
// RFC 3164 says leading space, not leading zero on days 1-9
if (buf.charAt(4) == '0') {
buf.setCharAt(4, ' ');
}
buf.append(getLocalHostname());
buf.append(' ');
return buf.toString();
}
return "";
}
/**
* Set header or footer of layout.
* @param msg message body, may not be null.
*/
private void sendLayoutMessage(final String msg) {
if (sqw != null) {
String packet = msg;
String hdr = getPacketHeader(new Date().getTime());
if (tagPrinting || hdr.length() > 0) {
StringBuffer buf = new StringBuffer(hdr);
if (tagPrinting) {
buf.append(tagLabel);
}
buf.append(msg);
packet = buf.toString();
}
sqw.setLevel(6);
sqw.write(packet);
}
}
}
| maleadt/stockplay | src/SPClient/src/com/kapti/backend/logging/TagSyslogAppender.java |
213,116 | package nl.topicus.onderwijs.uwlr.v2.client;
import nl.topicus.onderwijs.generated.uwlr.v2_2.LeerlinggegevensVerzoek;
public class UwlrRequestBuilder {
private String schooljaar;
private String xsdversie;
private String brincode;
private String dependancecode;
private String schoolkey;
/** De velden gegevenssetid en laatstontvangengegevens ondersteunen we verder niet. */
public UwlrRequestBuilder() {}
public UwlrRequestBuilder schooljaar(String schooljaar) {
this.schooljaar = schooljaar;
return this;
}
public UwlrRequestBuilder xsdversie(String xsdversie) {
this.xsdversie = xsdversie;
return this;
}
public UwlrRequestBuilder brincode(String brincode) {
this.brincode = brincode;
return this;
}
public UwlrRequestBuilder dependancecode(String dependancecode) {
this.dependancecode = dependancecode;
return this;
}
public LeerlinggegevensVerzoek build() {
LeerlinggegevensVerzoek request = new LeerlinggegevensVerzoek();
request.setSchooljaar(schooljaar);
request.setXsdversie(xsdversie);
request.setBrincode(brincode);
request.setDependancecode(dependancecode);
request.setSchoolkey(schoolkey);
return request;
}
}
| takirchjunger/uwlr-client-server | src/main/java/nl/topicus/onderwijs/uwlr/v2/client/UwlrRequestBuilder.java |
213,117 | import leden.Leden;
import leden.Lid;
import static leden.Soort.*;
public class TestLeden {
public static void main(String[] args) {
Leden leden = new Leden();
leden.voegLidToe(new Lid("Jos", GEWOON));
leden.voegLidToe(new Lid("Bart", ERELID));
leden.voegLidToe(new Lid("Helmut", STEUNEND));
leden.voegLidToe(new Lid("Marie", GEWOON));
leden.voegLidToe(new Lid("Emma", GEWOON));
leden.voegLidToe(new Lid("Hagar", ERELID));
System.out.println("Aantal actieve leden: " + leden.size());
for (int i = 0; i < leden.size() ; i++) {
if (leden.getLid(i).getLidnummer() != 0){
System.out.println(leden.getLid(i));
}
}
}
}
| gvdhaege/KdG | Java Programming/OOPROG/P2W2/Basis/Leden/src/TestLeden.java |
213,119 | /**
* This file is copyright 2017 State of the Netherlands (Ministry of Interior Affairs and Kingdom Relations).
* It is made available under the terms of the GNU Affero General Public License, version 3 as published by the Free Software Foundation.
* The project of which this file is part, may be found at www.github.com/MinBZK/operatieBRP.
*/
package nl.bzk.algemeenbrp.dal.domein.brp.annotatie;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotatie om repeating annotations te kunnen ondersteunen.
*/
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Bedrijfsregels {
/**
* De value van deze annotatie bestaat uit een lijst van {@link Bedrijfsregel}.
* @return lijst van {@link Bedrijfsregel}
*/
Bedrijfsregel[] value();
}
| DDDNL/OperatieBRP | Broncode/operatiebrp-code-145.3/algemeen/alg-dal-enumerations/src/main/java/nl/bzk/algemeenbrp/dal/domein/brp/annotatie/Bedrijfsregels.java |
213,122 | package com.vividsolutions.jump.workbench.imagery.geoimg;
/*
* The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
* for visualizing and manipulating spatial features with geometry and attributes.
*
* Copyright (C) 2003 Vivid Solutions
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* For more information, contact:
*
* Vivid Solutions
* Suite #1A
* 2328 Government Street
* Victoria BC V8T 5G5
* Canada
*
* (250)385-6040
* www.vividsolutions.com
*/
import com.vividsolutions.jump.I18N;
import it.geosolutions.imageio.core.CoreCommonImageMetadata;
import it.geosolutions.imageio.gdalframework.GDALImageReaderSpi;
import it.geosolutions.imageio.gdalframework.GDALUtilities;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.util.Arrays;
import java.util.List;
import javax.imageio.ImageReader;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.spi.ImageReaderSpi;
import javax.media.jai.RenderedOp;
import org.libtiff.jai.codec.XTIFF;
import org.libtiff.jai.codec.XTIFFDirectory;
import org.libtiff.jai.codec.XTIFFField;
import com.sun.media.jai.codec.SeekableStream;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import com.vividsolutions.jump.feature.Feature;
import com.vividsolutions.jump.util.FileUtil;
import com.vividsolutions.jump.workbench.JUMPWorkbench;
import com.vividsolutions.jump.workbench.Logger;
import com.vividsolutions.jump.workbench.imagery.ReferencedImageException;
import com.vividsolutions.jump.workbench.imagery.graphic.WorldFile;
public class GeoReferencedRaster extends GeoRaster {
private final String MSG_GENERAL = "This is not a valid GeoTIFF file.";
Envelope envModel_image;
Envelope envModel_image_backup;
// To be removed in 2.0
@Deprecated
Coordinate coorRasterTiff_tiepointLT;
@Deprecated
Coordinate coorModel_tiepointLT;
// AreaOrPoint=AREA (default) means that image coordinates
// refer to the upper left corner of the upper left angle.
// AreaOrPoint=POINT means that image coordinates refer to
// the center of the upper left pixel
public enum AreaOrPoint {AREA,POINT}
AreaOrPoint areaOrPoint = AreaOrPoint.AREA;
//https://trac.osgeo.org/gdal/ticket/4977
boolean honourNegativeScaleY = false;
// Rename upper left image coordinate with more expressive names
// Remarks in GeoTIFF, rasterULPixelCenter is
// 0.5, 0.5 in AREA_OR_POINT=Area (default)
// 0, 0 in AREA_OR_POINT=Point
private Coordinate rasterULPixelCenter;
private Coordinate modelULPixelCenter;
private double dblModelUnitsPerRasterUnit_X;
// [michaudm 2020-11-16] signed y-scale
// to be able to handle north-south oriented or south-north oriented images
private double dblModelUnitsPerRasterUnit_Y;
/**
* Called by Java2XML
*/
public GeoReferencedRaster(String location) throws ReferencedImageException {
this(location, null);
}
public GeoReferencedRaster(String location, Object reader)
throws ReferencedImageException {
super(location, reader);
readRasterfile();
}
private void parseGeoTIFFDirectory(URI uri) throws ReferencedImageException {
XTIFFDirectory dir = null;
InputStream input = null;
ReferencedImageException re = null;
try {
input = createInputStream(uri);
SeekableStream ss = SeekableStream.wrapInputStream(input, true);
dir = XTIFFDirectory.create(ss, 0);
} catch (IllegalArgumentException e) {
re = new ReferencedImageException("probably no tiff image: "
+ e.getMessage());
} catch (IOException e) {
re = new ReferencedImageException("problem accessing tiff image: "
+ e.getMessage());
} finally {
// clean up
disposeInput(input);
if (re != null)
throw re;
}
// Find the ModelTiePoints field
XTIFFField fieldModelTiePoints = dir.getField(XTIFF.TIFFTAG_GEO_TIEPOINTS);
if (fieldModelTiePoints == null) {
// try to read geotransform (tranformation matrix) information,
// if tiepoints are not used to georeference this image.
// These parameters are the same as those in a tfw file.
XTIFFField fieldModelGeoTransform = dir
.getField(XTIFF.TIFFTAG_GEO_TRANS_MATRIX);
if (fieldModelGeoTransform == null) {
throw new ReferencedImageException(
"Missing tiepoints-tag and tranformation matrix-tag parameters in file.\n"
+ MSG_GENERAL);
}
double[] tags = new double[6];
// pixel size in x direction (x-scale)
tags[0] = fieldModelGeoTransform.getAsDouble(0);
// rotation about y-axis
tags[1] = fieldModelGeoTransform.getAsDouble(1);
// rotation about x-axis
tags[2] = fieldModelGeoTransform.getAsDouble(4);
// pixel size in the y-direction (y-scale)
tags[3] = fieldModelGeoTransform.getAsDouble(5);
// x-ordinate of the center of the upper left pixel
tags[4] = fieldModelGeoTransform.getAsDouble(3);
// y-ordinate of the center of the upper left pixel
tags[5] = fieldModelGeoTransform.getAsDouble(7);
Logger.debug("gtiff transform: " + Arrays.toString(tags));
setEnvelope(tags);
}
// use the tiepoints as defined
else if (fieldModelTiePoints.getType() == XTIFFField.TIFF_DOUBLE) {
// Get the number of modeltiepoints
// int numModelTiePoints = fieldModelTiePoints.getCount() / 6;
// ToDo: alleen numModelTiePoints == 1 ondersteunen.
// Map the modeltiepoints from raster to model space
// Read the tiepoints
// imageCoord has not the same meaning in AREA and in POINT mode,
// but here, we don't mind, imageCoord may represent any point in
// the image, important thing is that imageCoord and modelCoord
// represent the same point in the image and in the model
// coordinate system.
Coordinate imageCoord = new Coordinate(
fieldModelTiePoints.getAsDouble(0),
fieldModelTiePoints.getAsDouble(1));
Coordinate modelCoord = new Coordinate(
fieldModelTiePoints.getAsDouble(3),
fieldModelTiePoints.getAsDouble(4));
Logger.debug("gtiff tiepoints found : " + Arrays.toString(fieldModelTiePoints.getAsDoubles()));
// Find the ModelPixelScale field
XTIFFField fieldModelPixelScale = dir
.getField(XTIFF.TIFFTAG_GEO_PIXEL_SCALE);
if (fieldModelPixelScale == null) {
// TODO: fieldModelTiePoints may contains GCP that could be exploited to
// georeference the image
throw new ReferencedImageException("Missing pixelscale-tag in file."
+ "\n" + MSG_GENERAL);
}
dblModelUnitsPerRasterUnit_X = fieldModelPixelScale.getAsDouble(0);
dblModelUnitsPerRasterUnit_Y = fieldModelPixelScale.getAsDouble(1);
//https://trac.osgeo.org/gdal/ticket/4977
if (!honourNegativeScaleY) dblModelUnitsPerRasterUnit_Y = - Math.abs(dblModelUnitsPerRasterUnit_Y);
Logger.debug("gtiff scale : scalex=" + dblModelUnitsPerRasterUnit_X + ", scaley=" + dblModelUnitsPerRasterUnit_Y);
// To compute the translation parameters of the transformation, we need
// to know how a point is converted from image to model coordinate, we
// don't mind where this point is.
double tx = modelCoord.x - dblModelUnitsPerRasterUnit_X * imageCoord.x;
double ty = modelCoord.y - dblModelUnitsPerRasterUnit_Y * imageCoord.y;
// Now, we want to know the model coordinate of the point precisely
// located at the center of the upper left pixel.
// Coordinates of this point is not the same in AREA and in POINT modes
rasterULPixelCenter = (areaOrPoint == AreaOrPoint.AREA) ?
new Coordinate(0.5,0.5) : new Coordinate(0.0,0.0);
modelULPixelCenter = new Coordinate(
getDblModelUnitsPerRasterUnit_X() * rasterULPixelCenter.x + tx,
getDblModelUnitsPerRasterUnit_Y() * rasterULPixelCenter.y + ty);
setEnvelope();
}
}
private void parseGDALMetaData(URI uri) throws ReferencedImageException {
if (!areGDALClassesAvailable || !GDALUtilities.isGDALAvailable())
throw new ReferencedImageException("no gdal metadata available because gdal is not properly loaded.");
// gdal geo info
List<ImageReaderSpi> readers;
Exception ex = null;
Object input = null;
try {
readers = listValidImageIOReaders(uri, GDALImageReaderSpi.class);
for (ImageReaderSpi readerSpi : readers) {
input = createInput(uri, readerSpi);
ImageReader reader = readerSpi.createReaderInstance();
IIOMetadata metadata = null;
// try with file or stream
try {
reader.setInput(input);
metadata = reader.getImageMetadata(0);
} catch (IllegalArgumentException e) {
Logger.debug("fail " + readerSpi + "/" + input + " -> " + e);
} catch (RuntimeException e) {
Logger.debug("fail " + readerSpi + "/" + input + " -> " + e);
} finally {
reader.dispose();
disposeInput(input);
}
if (!(metadata instanceof CoreCommonImageMetadata)) {
Logger.info("Unexpected error! Metadata should be an instance of the expected class: GDALCommonIIOImageMetadata.");
continue;
}
double[] geoTransform = ((CoreCommonImageMetadata) metadata)
.getGeoTransformation();
Logger.debug("successfully retrieved gdal geo metadata: "
+ Arrays.toString(geoTransform));
// check transform array for validity
if (geoTransform == null || (geoTransform.length != 6))
continue;
// settle for the first result
double[] tags = new double[6];
tags[0] = geoTransform[1]; // pixel size in x direction
tags[1] = geoTransform[4]; // rotation about y-axis
tags[2] = geoTransform[2]; // rotation about x-axis
tags[3] = geoTransform[5]; // pixel size in the y-direction
tags[4] = geoTransform[0]; // x-coordinate of the center of the upper left pixel
tags[5] = geoTransform[3]; // y-coordinate of the center of the upper left pixel
setEnvelope(tags);
// still with us? must have succeeded
return;
}
} catch (IOException e1) {
ex = e1;
}
throw new ReferencedImageException("no gdal metadata retrieved.", ex);
}
private void parseWorldFile() throws IOException {
// Get the name of the tiff worldfile.
// String name = worldFileName();
InputStream is = null;
try {
is = WorldFile.find(getURI().toString());
// Read the tags from the tiff worldfile.
List lines = FileUtil.getContents(is);
double[] tags = new double[6];
for (int i = 0; i < 6; i++) {
String line = (String) lines.get(i);
tags[i] = Double.parseDouble(line);
}
Logger.debug("worldfile: " + Arrays.toString(tags));
setEnvelope(tags);
} catch (IOException e) {
throw e;
} finally {
FileUtil.close(is);
}
}
/**
* initialize the img and try to parse geo infos via (in this order)
* worldfile, gdal or geotiff
*/
protected void readRasterfile() throws ReferencedImageException {
super.readRasterfile();
URI uri = getURI();
// Try to find and parse world file.
try {
parseWorldFile();
// still with us? must have succeeded
Logger.debug("Worldfile geo metadata fetched.");
return;
} catch (IOException e) {
Logger.debug("Worldfile geo metadata unavailable: " + e.getMessage());
}
try {
// Get access to the tags and geokeys.
// First, try to get the TIFF directory
// Object dir = src.getProperty("tiff.directory");
parseGDALMetaData(uri);
// still with us? must have succeeded
Logger.debug("GDAL geo metadata fetched.");
return;
} catch (ReferencedImageException e) {
Logger.debug("GDAL geo metadata unavailable: " + e.getMessage());
}
try {
// Get access to the tags and geokeys.
// First, try to get the TIFF directory
// Object dir = src.getProperty("tiff.directory");
parseGeoTIFFDirectory(uri);
if (envModel_image != null) {
// still with us? must have succeeded
Logger.debug("XTIFF geo metadata fetched.");
return;
}
} catch (ReferencedImageException e) {
Logger.debug("XTIFF geo metadata unavailable: " + e.getMessage());
}
Logger.info("No georeference found! Will use default 0,0 placement.");
JUMPWorkbench.getInstance().getFrame()
.warnUser(I18N.get(this.getClass().getName() + ".no-georeference-found"));
// set up a default envelope
double[] tags = new double[6];
tags[0] = 1; // pixel size in x direction
tags[1] = 0; // rotation about y-axis
tags[2] = 0; // rotation about x-axis
tags[3] = -1;// pixel size in the y-direction
tags[4] = 0; // x-coordinate of the center of the upper left pixel
tags[5] = 0; // y-coordinate of the center of the upper left pixel
setEnvelope(tags);
}
private void setEnvelope(double[] tags) {
AffineTransform transform = new AffineTransform(tags);
//We should honour negative scale y, but gdal created plenty of
//files where sign is not correct.
//We now have to consider that the scale y sign is not significative
//and offer an option to honour negative scales
//https://trac.osgeo.org/gdal/ticket/4977
//double scaleX = Math.abs(transform.getScaleX());
//double scaleY = Math.abs(transform.getScaleY());
dblModelUnitsPerRasterUnit_X = transform.getScaleX();
dblModelUnitsPerRasterUnit_Y = transform.getScaleY();
// To compute the envelope in AreaOrPoint.AREA mode, we need to
// know that upper left pixel center is at 0.5, 0.5, not 0, 0
double offset = (areaOrPoint == AreaOrPoint.AREA) ? 0.5 : 0.0;
Point2D rasterLT = new Point2D.Double(src.getMinX()+offset, src.getMinY()+offset);
Point2D modelLT = new Point2D.Double();
transform.transform(rasterLT, modelLT);
rasterULPixelCenter = new Coordinate(rasterLT.getX(), rasterLT.getY());
modelULPixelCenter = new Coordinate(modelLT.getX(), modelLT.getY());
setEnvelope();
}
void setEnvelope() {
// Image coordinate of the upper left corner of the envelope
double ulx = rasterULPixelCenter.x-0.5;
double uly = rasterULPixelCenter.y-0.5;
// Bottom left coordinate of the envelope
Coordinate imageEnvelopeBL = new Coordinate(ulx,uly+src.getHeight());
// Top right coordinate of the envelope
Coordinate imageEnvelopeTR = new Coordinate(ulx+src.getWidth(), uly);
// Transform envelope corners to the model coordinate system
Coordinate modelEnvelopeBL = rasterToModelSpace(imageEnvelopeBL);
Coordinate modelEnvelopeTR = rasterToModelSpace(imageEnvelopeTR);
envModel_image = new Envelope(modelEnvelopeBL, modelEnvelopeTR);
// backup original envelope
envModel_image_backup = envModel_image;
}
/**
* Convert a coordinate from rasterspace to modelspace.
*
* @param coorRaster
* coordinate in rasterspace
* @return coordinate in modelspace
*/
private Coordinate rasterToModelSpace(Coordinate coorRaster) {
Coordinate coorModel = new Coordinate();
coorModel.x = modelULPixelCenter.x
+ (coorRaster.x - rasterULPixelCenter.x)
* dblModelUnitsPerRasterUnit_X;
coorModel.y = modelULPixelCenter.y
+ (coorRaster.y - rasterULPixelCenter.y)
* dblModelUnitsPerRasterUnit_Y;
coorModel.z = 0;
return coorModel;
}
public Envelope getEnvelope() {
return envModel_image;
}
public Envelope getOriginalEnvelope() {
return envModel_image_backup;
}
///**
// * @param coordinate
// */
//@Deprecated
//private void setCoorModel_tiepointLT(Coordinate coordinate) {
// coorModel_tiepointLT = coordinate;
// // setEnvelope();
//}
///**
// * @param coordinate
// */
//private void setCoorRasterTiff_tiepointLT(Coordinate coordinate) {
// coorRasterTiff_tiepointLT = coordinate;
// // setEnvelope();
//}
///**
// * @param d
// */
//private void setDblModelUnitsPerRasterUnit_X(double d) {
// dblModelUnitsPerRasterUnit_X = d;
// // setEnvelope();
//}
///**
// * @param d
// */
//private void setDblModelUnitsPerRasterUnit_Y(double d) {
// dblModelUnitsPerRasterUnit_Y = d;
// // setEnvelope();
//}
/**
* @return coordinate of left-top corner in the model coordinate system
*/
public Coordinate getCoorModel_tiepointLT() {
//return coorModel_tiepointLT;
return modelULPixelCenter;
}
/**
* @return coordinate of left-top corner in the raster coordinate system
*/
@Deprecated
public Coordinate getCoorRasterTiff_tiepointLT() {
//return coorRasterTiff_tiepointLT;
return rasterULPixelCenter;
}
/**
* @return number of model units per raster unit along X axis
*/
public double getDblModelUnitsPerRasterUnit_X() {
return dblModelUnitsPerRasterUnit_X;
}
/**
* @return number of model units per raster unit along Y axis
*/
public double getDblModelUnitsPerRasterUnit_Y() {
return dblModelUnitsPerRasterUnit_Y;
}
public Envelope getEnvelope(Feature f) throws ReferencedImageException {
// geometry might be modified, if so let's rereference our image ;)
Geometry g;
if (f instanceof Feature && (g = f.getGeometry()) != null) {
Geometry rasterEnv = (new GeometryFactory())
.toGeometry(getOriginalEnvelope());
if (!rasterEnv.equals(g)) {
Envelope envGeom = g.getEnvelopeInternal();
// set new scale values
RenderedOp img = super.getImage();
double xUnit = Math.abs(envGeom.getWidth() / img.getWidth());
dblModelUnitsPerRasterUnit_X = xUnit;
double yUnit = Math.abs(envGeom.getHeight() / img.getHeight());
// y-scale is generally negative (won't work if model y axis is top-down)
dblModelUnitsPerRasterUnit_Y = -yUnit;
// assign&return new envelope
return envModel_image = new Envelope(envGeom);
}
}
return getOriginalEnvelope();
}
} | Xeograph/openjump | src/com/vividsolutions/jump/workbench/imagery/geoimg/GeoReferencedRaster.java |
213,125 | package nl.novi.uitleg.week2.ondersteunend;
public class Company {
private String city, adress, houseNumber;
private Address address;
public Company(Address address) {
this.address = address;
}
public String getState() {
return address.getState();
}
}
| hogeschoolnovi/SD-BE-JP-oefenopdrachten | src/nl/novi/uitleg/week2/ondersteunend/Company.java |