use std::{cmp::Ordering, fmt::Debug};
use abomonation_derive::Abomonation;
use serde::{Deserialize, Serialize};
pub type Timestamp = IntTimestamp;
#[derive(Debug, Clone, Serialize, Deserialize, Abomonation, PartialEq, Eq, Hash)]
pub enum IntTimestamp {
Top,
Time(Vec<u64>),
Bottom,
}
impl IntTimestamp {
pub fn is_top(&self) -> bool {
*self == IntTimestamp::Top
}
pub fn is_bottom(&self) -> bool {
*self == IntTimestamp::Bottom
}
}
impl Ord for IntTimestamp {
fn cmp(&self, other: &Self) -> Ordering {
match (self, other) {
(IntTimestamp::Top, IntTimestamp::Top) => Ordering::Equal,
(IntTimestamp::Bottom, IntTimestamp::Bottom) => Ordering::Equal,
(IntTimestamp::Top, _) => Ordering::Greater,
(_, IntTimestamp::Top) => Ordering::Less,
(_, IntTimestamp::Bottom) => Ordering::Greater,
(IntTimestamp::Bottom, _) => Ordering::Less,
(IntTimestamp::Time(a), IntTimestamp::Time(b)) => a.cmp(b),
}
}
}
impl PartialOrd for IntTimestamp {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}