001package de.monochromata.anaphors.cog.activation; 002 003import static java.util.Comparator.comparing; 004 005import java.util.Comparator; 006 007/** 008 * Computes activation values for activatable entites at arbitrary points in 009 * time with an implementation-dependent precision. 010 * 011 * <p> 012 * Limitations to the computation of activation values are 013 * implementation-specific. Precision of activation might be reduced for 014 * timestamps that are hard to calculate or estimate. Such cases include time 015 * stamps that are very old or reach very far into the future. 016 * </p> 017 * <p> 018 * E.g. activation values before the current model time might be cached. Because 019 * only a limited number of activation values might be cached, a rough guess 020 * might be returned for very old timestamps. Timestamps in the remote future 021 * come with similar implications: uncertainty of the interpolations/forecasts 022 * might be very high for very remote future timestamps. 023 * </p> 024 * 025 * <p> 026 * TODO: Maybe explicitly model the limits within which activation values can be 027 * estimated. 028 * </p> 029 */ 030public interface ActivationFormula { 031 032 public EstimatedActivationValue estimateActivation(final Activatable activatable, final long timestamp); 033 034 /** 035 * @return a negative integer, zero, or a positive integer as the activation of 036 * the first activatable at the given time is less than, equal to, or 037 * greater than the activation of the second activatable at that point 038 * in time. 039 */ 040 default <T extends Activatable> Comparator<T> comparatorForActivationAt(final long timestamp) { 041 return comparing(activatable -> activatable.getEstimatedActivationValue(timestamp)); 042 } 043 044}