From 74f188df9b638aff2ae02a8e434d746ba5cd5790 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Thu, 30 Mar 2017 18:16:04 -0700 Subject: [PATCH] Part 5b: rename also/instead to add_intersection and add_alternate. --- query-algebrizer/src/clauses/mod.rs | 8 ++++---- query-algebrizer/src/clauses/pattern.rs | 6 +++--- query-algebrizer/src/clauses/predicate.rs | 2 +- query-algebrizer/src/types.rs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/query-algebrizer/src/clauses/mod.rs b/query-algebrizer/src/clauses/mod.rs index 732cd70a..f9ee4edc 100644 --- a/query-algebrizer/src/clauses/mod.rs +++ b/query-algebrizer/src/clauses/mod.rs @@ -270,11 +270,11 @@ impl ConjoiningClauses { } pub fn constrain_column_to_constant(&mut self, table: TableAlias, column: DatomsColumn, constant: TypedValue) { - self.wheres.also(ColumnConstraint::Equals(QualifiedAlias(table, column), QueryValue::TypedValue(constant))) + self.wheres.add_intersection(ColumnConstraint::Equals(QualifiedAlias(table, column), QueryValue::TypedValue(constant))) } pub fn constrain_column_to_entity(&mut self, table: TableAlias, column: DatomsColumn, entity: Entid) { - self.wheres.also(ColumnConstraint::Equals(QualifiedAlias(table, column), QueryValue::Entid(entity))) + self.wheres.add_intersection(ColumnConstraint::Equals(QualifiedAlias(table, column), QueryValue::Entid(entity))) } pub fn constrain_attribute(&mut self, table: TableAlias, attribute: Entid) { @@ -282,7 +282,7 @@ impl ConjoiningClauses { } pub fn constrain_value_to_numeric(&mut self, table: TableAlias, value: i64) { - self.wheres.also(ColumnConstraint::Equals( + self.wheres.add_intersection(ColumnConstraint::Equals( QualifiedAlias(table, DatomsColumn::Value), QueryValue::PrimitiveLong(value))) } @@ -529,7 +529,7 @@ impl ConjoiningClauses { // TODO: if both primary and secondary are .v, should we make sure // the type tag columns also match? // We don't do so in the ClojureScript version. - self.wheres.also(ColumnConstraint::Equals(primary.clone(), QueryValue::Column(secondary.clone()))); + self.wheres.add_intersection(ColumnConstraint::Equals(primary.clone(), QueryValue::Column(secondary.clone()))); } } } diff --git a/query-algebrizer/src/clauses/pattern.rs b/query-algebrizer/src/clauses/pattern.rs index cc7c901d..0005e794 100644 --- a/query-algebrizer/src/clauses/pattern.rs +++ b/query-algebrizer/src/clauses/pattern.rs @@ -196,7 +196,7 @@ impl ConjoiningClauses { } else { // It must be a keyword. self.constrain_column_to_constant(col.clone(), DatomsColumn::Value, TypedValue::Keyword(kw.clone())); - self.wheres.also(ColumnConstraint::HasType(col.clone(), ValueType::Keyword)); + self.wheres.add_intersection(ColumnConstraint::HasType(col.clone(), ValueType::Keyword)); }; }, PatternValuePlace::Constant(ref c) => { @@ -232,7 +232,7 @@ impl ConjoiningClauses { // Because everything we handle here is unambiguous, we generate a single type // restriction from the value type of the typed value. if value_type.is_none() { - self.wheres.also(ColumnConstraint::HasType(col.clone(), typed_value_type)); + self.wheres.add_intersection(ColumnConstraint::HasType(col.clone(), typed_value_type)); } }, @@ -811,4 +811,4 @@ mod testing { assert_eq!(cc.empty_because.unwrap(), EmptyBecause::TypeMismatch(x.clone(), unit_type_set(ValueType::Ref), ValueType::Boolean)); } -} \ No newline at end of file +} diff --git a/query-algebrizer/src/clauses/predicate.rs b/query-algebrizer/src/clauses/predicate.rs index 87fe6e2e..c26d70f1 100644 --- a/query-algebrizer/src/clauses/predicate.rs +++ b/query-algebrizer/src/clauses/predicate.rs @@ -78,7 +78,7 @@ impl ConjoiningClauses { left: left, right: right, }; - self.wheres.also(constraint); + self.wheres.add_intersection(constraint); Ok(()) } } diff --git a/query-algebrizer/src/types.rs b/query-algebrizer/src/types.rs index 457aa2ab..121e5f85 100644 --- a/query-algebrizer/src/types.rs +++ b/query-algebrizer/src/types.rs @@ -241,7 +241,7 @@ impl ColumnIntersection { self.0.is_empty() } - pub fn also(&mut self, constraint: ColumnConstraint) { + pub fn add_intersection(&mut self, constraint: ColumnConstraint) { self.0.push(ColumnConstraintOrAlternation::Constraint(constraint)); } } @@ -267,7 +267,7 @@ impl IntoIterator for ColumnAlternation { } impl ColumnAlternation { - pub fn instead(&mut self, intersection: ColumnIntersection) { + pub fn add_alternate(&mut self, intersection: ColumnIntersection) { self.0.push(intersection); } }