1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! Contains function expression comparisons via the [`FComp`] type.
use crate::types::{BinaryComp, FExp};
/// An fluent comparison used as part of a [`GoalDefinition`](crate::GoalDefinition)
/// when [`NumericFluents`](crate::Requirement::NumericFluents) is allowed.
///
/// ## Usage
/// Used by [`GoalDefinition`](crate::GoalDefinition).
#[derive(Debug, Clone, PartialEq)]
pub struct FComp(BinaryComp, FExp, FExp);
impl FComp {
pub const fn new(comp: BinaryComp, lhs: FExp, rhs: FExp) -> Self {
Self(comp, lhs, rhs)
}
/// Returns the comparison operator.
pub const fn comparison(&self) -> &BinaryComp {
&self.0
}
/// Returns the first operand.
pub const fn first(&self) -> &FExp {
&self.1
}
/// Returns the second operand.
pub const fn second(&self) -> &FExp {
&self.2
}
}
impl From<(BinaryComp, FExp, FExp)> for FComp {
fn from(value: (BinaryComp, FExp, FExp)) -> Self {
FComp::new(value.0, value.1, value.2)
}
}