All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tools.aqua.stars.logic.kcmftbl.historically.kt Maven / Gradle / Ivy

/*
 * Copyright 2023-2024 The STARS Project Authors
 * SPDX-License-Identifier: Apache-2.0
 *
 * 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.
 */

@file:Suppress("unused")

package tools.aqua.stars.logic.kcmftbl

import tools.aqua.stars.core.types.*

/**
 * CMFTBL implementation of the 'historically' operator i.e. "In all past ticks in the interval phi
 * holds".
 *
 * @param E [EntityType].
 * @param T [TickDataType].
 * @param S [SegmentType].
 * @param U [TickUnit].
 * @param D [TickDifference].
 * @param tickData Current [TickDataType].
 * @param interval Observation interval.
 * @param phi Predicate.
 */
fun <
    E : EntityType,
    T : TickDataType,
    S : SegmentType,
    U : TickUnit,
    D : TickDifference> historically(
    tickData: T,
    interval: Pair? = null,
    phi: (T) -> Boolean
): Boolean = !once(tickData, interval, phi = { td -> !phi(td) })

/**
 * CMFTBL implementation of the 'historically' operator for one entity i.e. "In all past ticks in
 * the interval phi holds".
 *
 * @param E1 [EntityType].
 * @param E [EntityType].
 * @param T [TickDataType].
 * @param S [SegmentType].
 * @param U [TickUnit].
 * @param D [TickDifference].
 * @param entity Current [EntityType] of which the tickData gets retrieved.
 * @param interval Observation interval.
 * @param phi Predicate.
 */
fun <
    E1 : E,
    E : EntityType,
    T : TickDataType,
    S : SegmentType,
    U : TickUnit,
    D : TickDifference> historically(
    entity: E1,
    interval: Pair? = null,
    phi: (E1) -> Boolean
): Boolean = !once(entity, interval, phi = { e -> !phi(e) })

/**
 * CMFTBL implementation of the 'historically' operator for two entities i.e. "In all past ticks in
 * the interval phi holds".
 *
 * @param E1 [EntityType].
 * @param E2 [EntityType].
 * @param E [EntityType].
 * @param T [TickDataType].
 * @param S [SegmentType].
 * @param U [TickUnit].
 * @param D [TickDifference].
 * @param entity1 First [EntityType].
 * @param entity2 Second [EntityType].
 * @param interval Observation interval.
 * @param phi Predicate.
 */
fun <
    E1 : E,
    E2 : E,
    E : EntityType,
    T : TickDataType,
    S : SegmentType,
    U : TickUnit,
    D : TickDifference> historically(
    entity1: E1,
    entity2: E2,
    interval: Pair? = null,
    phi: (E1, E2) -> Boolean
): Boolean = !once(entity1, entity2, interval, phi = { e1, e2 -> !phi(e1, e2) })




© 2015 - 2024 Weber Informatics LLC | Privacy Policy