Part 5b: rename also/instead to add_intersection and add_alternate.

This commit is contained in:
Richard Newman 2017-03-30 18:16:04 -07:00
parent 9e5c735460
commit 74f188df9b
4 changed files with 10 additions and 10 deletions

View file

@ -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())));
}
}
}

View file

@ -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));
}
}
}

View file

@ -78,7 +78,7 @@ impl ConjoiningClauses {
left: left,
right: right,
};
self.wheres.also(constraint);
self.wheres.add_intersection(constraint);
Ok(())
}
}

View file

@ -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);
}
}