本文整理汇总了Java中ch.rgw.tools.TimeTool.isBeforeOrEqual方法的典型用法代码示例。如果您正苦于以下问题:Java TimeTool.isBeforeOrEqual方法的具体用法?Java TimeTool.isBeforeOrEqual怎么用?Java TimeTool.isBeforeOrEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.rgw.tools.TimeTool
的用法示例。
在下文中一共展示了TimeTool.isBeforeOrEqual方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMultiplikator
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
public synchronized double getMultiplikator(TimeTool date){
// get Mutliplikator for date
fetchResultSet();
Iterator<MultiplikatorInfo> iter = list.iterator();
while (iter.hasNext()) {
MultiplikatorInfo info = iter.next();
TimeTool fromDate = new TimeTool(info.validFrom);
TimeTool toDate = new TimeTool(info.validTo);
if (date.isAfterOrEqual(fromDate) && date.isBeforeOrEqual(toDate)) {
String value = info.multiplikator;
if (value != null && !value.isEmpty()) {
try {
return Double.parseDouble(value);
} catch (NumberFormatException nfe) {
ExHandler.handle(nfe);
return 0.0;
}
}
}
}
return 1.0;
}
示例2: getFromCode
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
/**
* Load a {@link ComplementaryLeistung} from code that is valid at the date.
*
* @param code
* @param date
* @return
*/
public static IVerrechenbar getFromCode(final String code, TimeTool date){
Query<ComplementaryLeistung> query =
new Query<ComplementaryLeistung>(ComplementaryLeistung.class, FLD_CODE, code, TABLENAME,
new String[] {
FLD_VALID_FROM, FLD_VALID_TO
});
List<ComplementaryLeistung> leistungen = query.execute();
for (ComplementaryLeistung leistung : leistungen) {
TimeTool validFrom = leistung.getValidFrom();
TimeTool validTo = leistung.getValidTo();
if (date.isAfterOrEqual(validFrom) && date.isBeforeOrEqual(validTo))
return leistung;
}
return null;
}
示例3: getFromCode
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
public static Labor2009Tarif getFromCode(String code, TimeTool date){
Query<Labor2009Tarif> query = new Query<Labor2009Tarif>(Labor2009Tarif.class);
query.add(Labor2009Tarif.FLD_CODE, "=", code);
List<Labor2009Tarif> leistungen = query.execute();
for (Labor2009Tarif laborLeistung : leistungen) {
TimeTool validFrom = laborLeistung.getGueltigVon();
TimeTool validTo = laborLeistung.getGueltigBis();
if (validTo == null) {
validTo = future;
}
if (date.isAfterOrEqual(validFrom) && date.isBeforeOrEqual(validTo))
return laborLeistung;
}
return null;
}
示例4: getFromCode
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
/**
* Query for a {@link TarmedLeistung} using the code. The returned {@link TarmedLeistung} will
* be valid on date, and will be from the cataloge specified by law.
*
* @param code
* @param date
* @param law
* @return null if no matching {@link TarmedLeistung} found
* @since 3.4
*/
public static IVerrechenbar getFromCode(@NonNull
final String code, @NonNull TimeTool date, @Nullable String law){
if (availableLawsCache == null) {
availableLawsCache = getAvailableLaws();
}
Query<TarmedLeistung> query = new Query<TarmedLeistung>(TarmedLeistung.class, FLD_CODE,
code, TarmedLeistung.TABLENAME, new String[] {
TarmedLeistung.FLD_GUELTIG_VON, TarmedLeistung.FLD_GUELTIG_BIS,
TarmedLeistung.FLD_LAW, TarmedLeistung.FLD_ISCHAPTER
});
if (law != null) {
if (!isAvailableLaw(law)) {
query.startGroup();
query.add(FLD_LAW, Query.EQUALS, "");
query.or();
query.add(FLD_LAW, Query.EQUALS, null);
query.endGroup();
} else {
query.add(FLD_LAW, Query.EQUALS, law, true);
}
}
List<TarmedLeistung> leistungen = query.execute();
for (TarmedLeistung tarmedLeistung : leistungen) {
TimeTool validFrom = tarmedLeistung.getGueltigVon();
TimeTool validTo = tarmedLeistung.getGueltigBis();
if (date.isAfterOrEqual(validFrom) && date.isBeforeOrEqual(validTo))
return tarmedLeistung;
}
return null;
}
示例5: getValidValueMaps
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
/**
* Get a List of Maps containing the rows of the ResultSet with a matching valid date
* information. This is needed as we can not make constraints on a date represented as string in
* the db.
*
* @param input
* @param validFrom
* @return
* @throws SQLException
*/
public static List<Map<String, String>> getValidValueMaps(ResultSet input, TimeTool validFrom)
throws SQLException, IOException{
List<Map<String, String>> ret = new ArrayList<Map<String, String>>();
// build list of column names
ArrayList<String> headers = new ArrayList<String>();
ResultSetMetaData meta = input.getMetaData();
int metaLength = meta.getColumnCount();
for (int i = 1; i <= metaLength; i++) {
headers.add(meta.getColumnName(i));
}
TimeTool from = new TimeTool();
TimeTool to = new TimeTool();
// find rows with matching valid date information
while (input.next()) {
from.set(input.getString("GUELTIG_VON"));
to.set(input.getString("GUELTIG_BIS")); //$NON-NLS-1$
// is this the correct result
if (validFrom.isAfterOrEqual(from) && validFrom.isBeforeOrEqual(to)) {
HashMap<String, String> valuesMap = new HashMap<String, String>();
// put all the columns with values into valuesMap
for (String columnName : headers) {
String value = input.getString(columnName);
valuesMap.put(columnName, value);
}
// add map to list of matching maps
ret.add(valuesMap);
}
}
return ret;
}
示例6: isValidKumulation
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
/**
* Checks if the kumulation is still/already valid on the given date
*
* @param date
* on which it should be valid
* @return true if valid, false otherwise
*/
public boolean isValidKumulation(TimeTool date){
TimeTool from = new TimeTool(getValidFrom());
TimeTool to = new TimeTool(getValidTo());
if (date.isAfterOrEqual(from) && date.isBeforeOrEqual(to)) {
return true;
}
return false;
}
示例7: validAt
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
public boolean validAt(TimeTool validTime){
TimeTool validFrom = new TimeTool(get(FLD_VALIDFROM));
TimeTool validTo = new TimeTool(get(FLD_VALIDTO));
return validTime.isAfterOrEqual(validFrom) && validTime.isBeforeOrEqual(validTo);
}
示例8: getParentId
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
private String getParentId(String parentCode) throws SQLException{
Stm source = null;
List<TimeTool> parentValidFroms = new ArrayList<>();
try {
source = cacheDb.getStatement();
try (ResultSet res = source
.query(String.format("SELECT * FROM %sKAPITEL_TEXT WHERE SPRACHE=%s AND KNR=%s", //$NON-NLS-1$
TarmedReferenceDataImporter.ImportPrefix, lang, JdbcLink.wrap(parentCode)))) {
while (res != null && res.next()) {
String code = res.getString("KNR"); //$NON-NLS-1$
if (code.trim().equals("I")) { //$NON-NLS-1$
continue;
}
parentValidFroms.add(new TimeTool(res.getString("GUELTIG_VON")));
}
}
} finally {
if (source != null) {
cacheDb.releaseStatement(source);
}
}
if (parentValidFroms.isEmpty()) {
throw new IllegalStateException("No parent valid from found for " + parentCode);
}
// determine the latest matching parent valid from
TimeTool latestParentValidFrom = null;
for (TimeTool parentValidFrom : parentValidFroms) {
if (latestParentValidFrom == null && parentValidFrom.isBeforeOrEqual(validFrom)) {
latestParentValidFrom = parentValidFrom;
continue;
}
if (parentValidFrom.isBeforeOrEqual(validTo)
&& parentValidFrom.isAfter(latestParentValidFrom)) {
latestParentValidFrom = parentValidFrom;
}
}
if (latestParentValidFrom == null) {
throw new IllegalStateException("No parent valid from found for " + parentCode + " in "
+ parentValidFroms.size() + " values");
}
return parentCode + "-" + latestParentValidFrom.toString(TimeTool.DATE_COMPACT) //$NON-NLS-1$
+ getLawIdExtension();
}
示例9: isValid
import ch.rgw.tools.TimeTool; //导入方法依赖的package包/类
public boolean isValid(TimeTool now){
if (now.isAfter(getValidFrom()) && now.isBeforeOrEqual(getValidTo())) {
return true;
}
return false;
}