//! Don't care symbol demonstration from Wikipedia //! //! https://en.wikipedia.org/wiki/Decision_table#Example use decision_table::{DecisionTable, Domain, Row}; fn print_completeness(table: &DecisionTable) { if table.is_complete() { println!("Complete!"); } else { println!("Incomplete!"); } } fn without_dont_care_symbol() { let boolean_domain = Domain::from(vec!["no", "yes"]); let mut table = DecisionTable::new(vec![&boolean_domain, &boolean_domain]); table.add(Row::new(vec!["yes", "yes"], "100")); table.add(Row::new(vec!["no", "yes"], "100")); table.add(Row::new(vec!["yes", "no"], "011")); table.add(Row::new(vec!["no", "no"], "001")); // Complete! print_completeness(&table); table.remove(&Row::new(vec!["no", "yes"], "100")); // Incomplete! print_completeness(&table); } fn main() { without_dont_care_symbol(); }