use std::ops::Not;
use super::AigNodeRef;
#[derive(Debug, Clone, Copy)]
pub enum FaninId {
Fanin0,
Fanin1,
}
impl From<bool> for FaninId {
fn from(value: bool) -> Self {
if value {
FaninId::Fanin1
} else {
FaninId::Fanin0
}
}
}
#[derive(Clone, Debug, Eq)]
pub struct AigEdge {
pub(super) node: AigNodeRef,
pub(super) complement: bool,
}
impl Not for AigEdge {
type Output = Self;
fn not(mut self) -> Self::Output {
self.complement = !self.complement;
self
}
}
impl PartialEq for AigEdge {
fn eq(&self, other: &Self) -> bool {
self.complement == other.complement
&& self.node.borrow().get_id() == other.node.borrow().get_id()
}
}
impl AigEdge {
pub fn new(node: AigNodeRef, complement: bool) -> Self {
AigEdge { node, complement }
}
pub fn get_node(&self) -> AigNodeRef {
self.node.clone()
}
pub fn get_complement(&self) -> bool {
self.complement
}
}