Skip to content

Commit

Permalink
prep for apply for normalized sdds
Browse files Browse the repository at this point in the history
  • Loading branch information
jsfpdn committed Oct 9, 2024
1 parent 4710d0b commit 6556f33
Show file tree
Hide file tree
Showing 5 changed files with 798 additions and 346 deletions.
4 changes: 2 additions & 2 deletions sdd-rs-lib/dot_writer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::Result;
use crate::{manager::SddManager, Result};

pub trait Dot {
fn draw(&self, writer: &mut DotWriter);
fn draw<'a>(&self, writer: &mut DotWriter, manager: &SddManager);
}

pub enum Edge {
Expand Down
20 changes: 10 additions & 10 deletions sdd-rs-lib/literal.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fmt::Display;

#[derive(Hash, Eq, PartialEq, Debug, Clone, PartialOrd, Ord)]
pub struct VarLabel(String);
pub(crate) struct VarLabel(String);

impl VarLabel {
#[must_use]
Expand All @@ -16,12 +16,6 @@ impl VarLabel {
}

// Either true or false
#[derive(Hash, Eq, PartialEq, Debug, Clone, PartialOrd, Ord)]
pub struct Literal {
var_label: VarLabel,
polarity: Polarity,
}

#[derive(Hash, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, Copy)]
pub enum Polarity {
Positive,
Expand All @@ -39,11 +33,17 @@ impl std::ops::Not for Polarity {
}
}

#[derive(Hash, Eq, PartialEq, Debug, Clone, PartialOrd, Ord)]
pub struct Literal {
var_label: VarLabel,
polarity: Polarity,
}

impl Literal {
#[must_use]
pub fn new(polarity: Polarity, var_label: VarLabel) -> Literal {
pub fn new(polarity: Polarity, variable: &str) -> Literal {
Literal {
var_label,
var_label: VarLabel::new(variable),
polarity,
}
}
Expand All @@ -67,7 +67,7 @@ impl Literal {
}

#[must_use]
pub fn var_label(self) -> VarLabel {
pub(crate) fn var_label(self) -> VarLabel {
self.var_label
}
}
Expand Down
Loading

0 comments on commit 6556f33

Please sign in to comment.