use terms::*;
use clause::OperationType::DERIVE;
pub struct Clause {
pub terms: Vec<Term>,
}
pub enum OperationType {
DERIVE,
JOIN,
DELETE,
BRANCH,
}
#[allow(dead_code)]
pub struct Operation<'a> {
_type: OperationType,
term: Vec<&'a Term>,
symbol: Vec<&'a Symbol>,
}
impl Clause {
pub fn insert(&mut self, term: Term) {
self.terms.push(term);
}
pub fn reduce(&mut self) -> Operation {
let single = self.search_single_terms();
match single {
Some(t) => {
}
None => {}
}
return Operation {
_type: DERIVE,
term: Vec::new(),
symbol: Vec::new(),
};
}
fn search_single_terms(&mut self) -> Option<&Term> {
for term in self.terms.iter() {
if term.symbols.len() == 1 {
return Some(term);
}
}
return None;
}
}