#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Negation{
count: u32,
}
impl Negation{
pub fn new(count: u32) -> Self{
Self{count}
}
pub fn deny(&mut self){
if self.count > 0{
self.count -= 1;
}else{
self.count += 1;
}
}
pub fn double_deny(&mut self){
if self.count > 1{
self.count -= 2;
}else{
self.count += 2;
}
}
pub fn negate(&mut self){
self.count += 1;
}
pub fn double_negate(&mut self){
self.count += 2;
}
pub fn reduce(&mut self){
self.count &= 1
}
pub fn is_denied(&self) -> bool{
self.count & 1 == 1
}
pub fn tval(&self) -> bool{
self.count & 1 != 1
}
pub fn count(&self) -> u32{
self.count
}
}
impl Default for Negation{
fn default() -> Self {
Self { count: 0 }
}
}