本文整理汇总了Java中org.threeten.bp.Instant.isAfter方法的典型用法代码示例。如果您正苦于以下问题:Java Instant.isAfter方法的具体用法?Java Instant.isAfter怎么用?Java Instant.isAfter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.threeten.bp.Instant
的用法示例。
在下文中一共展示了Instant.isAfter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkVersionInstantsWithinRange
import org.threeten.bp.Instant; //导入方法依赖的package包/类
public static <D extends AbstractDocument> boolean checkVersionInstantsWithinRange(Instant missing, Instant from, Instant to, List<D> documents, boolean equalFrom) {
if (!documents.isEmpty()) {
SortedSet<Instant> instants = new TreeSet<Instant>();
for (D document : documents) {
Instant fromInstant = document.getVersionFromInstant();
if (fromInstant == null) {
instants.add(missing);
} else {
instants.add(document.getVersionFromInstant());
}
}
Instant minFromVersion = instants.first();
Instant maxFromVersion = instants.last();
return
((equalFrom && minFromVersion.equals(from)) || (!equalFrom && !minFromVersion.isBefore(from)))
&&
(to == null || !maxFromVersion.isAfter(to));
} else {
return true;
}
}
示例2: matches
import org.threeten.bp.Instant; //导入方法依赖的package包/类
/**
* Checks if this search matches the specified document.
*
* @param document the document to match, null or inappropriate document type returns false
* @return true if matches
*/
public boolean matches(AbstractDocument document) {
if (getVersionCorrection() == null) {
return true;
}
Instant versionFrom = Objects.firstNonNull(document.getVersionFromInstant(), Instant.MIN);
Instant versionTo = Objects.firstNonNull(document.getVersionToInstant(), Instant.MAX);
Instant correctionFrom = Objects.firstNonNull(document.getCorrectionFromInstant(), Instant.MIN);
Instant correctionTo = Objects.firstNonNull(document.getCorrectionToInstant(), Instant.MAX);
VersionCorrection locked = getVersionCorrection().withLatestFixed(OpenGammaClock.getInstance().instant());
Instant versionPoint = locked.getVersionAsOf();
Instant corrrectionPoint = locked.getCorrectedTo();
return versionPoint.isBefore(versionTo) &&
!versionFrom.isAfter(versionPoint) &&
corrrectionPoint.isBefore(correctionTo) &&
!correctionFrom.isAfter(corrrectionPoint);
}
示例3: addFunction
import org.threeten.bp.Instant; //导入方法依赖的package包/类
public void addFunction(final CompiledFunctionDefinition function) {
ArgumentChecker.notNull(function, "Function definition");
final String uid = function.getFunctionDefinition().getUniqueId();
_functionDefinitions.put(uid, function);
Instant time = function.getEarliestInvocationTime();
if (time != null) {
if (_earliestInvocationTime != null) {
if (time.isAfter(_earliestInvocationTime)) {
_earliestInvocationTime = time;
}
} else {
_earliestInvocationTime = time;
}
}
time = function.getLatestInvocationTime();
if (time != null) {
if (_latestInvocationTime != null) {
if (time.isBefore(_latestInvocationTime)) {
_latestInvocationTime = time;
}
} else {
_latestInvocationTime = time;
}
}
}
示例4: isSmsSentOneHourAgo
import org.threeten.bp.Instant; //导入方法依赖的package包/类
public static boolean isSmsSentOneHourAgo(Context context) {
Long smsSentEpoch = CRDSharedPreferences.getInstance(context).getSendingSmsEpoch();
if (smsSentEpoch == null) {
return false;
}
Instant oneHourAgo = getNowTime().toInstant().minus(Duration.ofHours(1));
Instant smsSentInstant = Instant.ofEpochMilli(smsSentEpoch);
return smsSentInstant.isAfter(oneHourAgo) && smsSentInstant.isBefore(getNowTime().toInstant());
}
示例5: isChangeRelevant
import org.threeten.bp.Instant; //导入方法依赖的package包/类
/**
* Returns true if a change event invalidates any of this view's portfolio, including trades, securities and positions it refers to.
*
* @param event The event
* @return true if the portfolio or positions, trades or securities it refers to have changed
*/
private boolean isChangeRelevant(ChangeEvent event) {
// if the correctedTo time is non-null then we're looking at corrections up to a fixed point in the past and
// new corrections can't affect our version
if (_versionCorrection.getCorrectedTo() != null) {
return false;
}
// there's no way we can know about an object if it's just been added. and if the portfolio is modified we will
// cache any newly added positions etc when traversing the new portfolio structure
if (event.getType() == ChangeType.ADDED) {
return false;
}
if (_cache.getEntity(event.getObjectId()) == null) {
return false;
}
Instant versionInstant = _versionCorrection.getVersionAsOf();
Instant eventFrom = event.getVersionFrom();
Instant eventTo = event.getVersionTo();
if (versionInstant == null) {
// if the version time is null (latest) and eventTo is null (latest) then handle the change
// if the version time is null (latest) and eventTo isn't null the event doesn't affect the latest version
return eventTo == null;
}
// check whether the range of the changed version contains our version instance
if (eventFrom.isAfter(versionInstant)) {
return false;
}
if (eventTo != null && eventTo.isBefore(versionInstant)) {
return false;
}
return true;
}
示例6: of
import org.threeten.bp.Instant; //导入方法依赖的package包/类
/**
* Constructs an instance.
*
* @param context the view compilation context, not null
* @param identifier the compilation identifier, not null
* @param graphs the dependency graphs, not null
* @param portfolio the portfolio, possibly null
* @return the new instance, not null
*/
public static CompiledViewDefinitionWithGraphsImpl of(final ViewCompilationContext context, final String identifier, final Collection<DependencyGraph> graphs, final Portfolio portfolio) {
final Collection<CompiledViewCalculationConfiguration> calcConfigs = new ArrayList<>();
Instant validFrom = null;
Instant validTo = null;
final CompiledFunctionResolver functions = context.getCompiledFunctionResolver();
for (DependencyGraph graph : graphs) {
calcConfigs.add(CompiledViewCalculationConfigurationImpl.of(graph));
final Iterator<DependencyNode> itr = graph.nodeIterator();
while (itr.hasNext()) {
final CompiledFunctionDefinition function = functions.getFunction(itr.next().getFunction().getFunctionId());
if (function != null) {
Instant time = function.getEarliestInvocationTime();
if (time != null) {
if (validFrom != null) {
if (validFrom.isBefore(time)) {
validFrom = time;
}
} else {
validFrom = time;
}
}
time = function.getLatestInvocationTime();
if (time != null) {
if (validTo != null) {
if (validTo.isAfter(time)) {
validTo = time;
}
} else {
validTo = time;
}
}
}
}
}
return new CompiledViewDefinitionWithGraphsImpl(context.getResolverVersionCorrection(), identifier, context.getViewDefinition(), graphs, context.getActiveResolutions(), portfolio, context
.getServices().getFunctionCompilationContext().getFunctionInitId(), calcConfigs, validFrom, validTo);
}
示例7: isValidFor
import org.threeten.bp.Instant; //导入方法依赖的package包/类
/**
* Checks whether the compilation results encapsulated in an instance are valid for a specific cycle. Note that this does not ensure that the view definition used for compilation is still
* up-to-date.
*
* @param viewDefinition the compiled view definition instance, not null
* @param valuationTime the valuation time, not null
* @return true if the compilation results are valid for the valuation time
*/
public static boolean isValidFor(final CompiledViewDefinition viewDefinition, final Instant valuationTime) {
final Instant validFrom = viewDefinition.getValidFrom();
if ((validFrom != null) && valuationTime.isBefore(validFrom)) {
return false;
}
final Instant validTo = viewDefinition.getValidTo();
return (validTo == null) || !valuationTime.isAfter(validTo);
}
示例8: isEpochBetweenTuesdayMorningAndEvening
import org.threeten.bp.Instant; //导入方法依赖的package包/类
public static boolean isEpochBetweenTuesdayMorningAndEvening(long epoch) {
Instant instant = Instant.ofEpochMilli(epoch);
return instant.isAfter(Instant.ofEpochMilli(getNextTuesdayMorningTimestamp(true)))
&& instant.isBefore(Instant.ofEpochMilli(getSameOrPreviousTuesdayEveningTimestamp()));
}