#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum VariableType {
Genuine,
List,
Shadow(ShadowVariableKind),
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ShadowVariableKind {
Custom,
InverseRelation,
Index,
NextElement,
PreviousElement,
Cascading,
Piggyback,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ValueRangeType {
Collection,
CountableRange {
from: i64,
to: i64,
},
EntityDependent,
}
impl VariableType {
pub fn is_genuine(&self) -> bool {
matches!(self, VariableType::Genuine | VariableType::List)
}
pub fn is_shadow(&self) -> bool {
matches!(self, VariableType::Shadow(_))
}
pub fn is_list(&self) -> bool {
matches!(self, VariableType::List)
}
pub fn is_basic(&self) -> bool {
matches!(self, VariableType::Genuine)
}
}
impl ShadowVariableKind {
pub fn requires_listener(&self) -> bool {
matches!(
self,
ShadowVariableKind::Custom | ShadowVariableKind::Cascading
)
}
pub fn is_automatic(&self) -> bool {
matches!(
self,
ShadowVariableKind::InverseRelation
| ShadowVariableKind::Index
| ShadowVariableKind::NextElement
| ShadowVariableKind::PreviousElement
)
}
pub fn is_piggyback(&self) -> bool {
matches!(self, ShadowVariableKind::Piggyback)
}
}