8000 remove 1 postfix on some function names · Z80coder/datalog-cpp@2d290b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2d290b7

Browse files
committed
remove 1 postfix on some function names
1 parent 7bd922a commit 2d290b7

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/Datalog.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,26 @@ struct Variable : optional<T>
4040
};
4141

4242
template <typename T>
43-
static void unbind1(Variable<T>* t) {
43+
static void unbind(Variable<T>* t) {
4444
t->unbind();
4545
}
4646

4747
template <typename T>
48-
static void unbind1(const T& t) {}
48+
static void unbind(const T& t) {}
4949

5050
template <typename... Ts>
51-
static void unbind1(const tuple<Ts...> &tuple)
51+
static void unbind(const tuple<Ts...> &tuple)
5252
{
53-
apply([](auto &&... args) { ((unbind1(args), ...)); }, tuple);
53+
apply([](auto &&... args) { ((unbind(args), ...)); }, tuple);
5454
}
5555

5656
template <typename T>
57-
static bool bind1(const T& a, const T& b) {
57+
static bool bind(const T& a, const T& b) {
5858
return a == b;
5959
}
6060

6161
template <typename T>
62-
static bool bind1(const T& a, Variable<T>* b) {
62+
static bool bind(const T& a, Variable<T>* b) {
6363
if (b->isBound()) {
6464
return b->value() == a;
6565
}
@@ -68,41 +68,41 @@ static bool bind1(const T& a, Variable<T>* b) {
6868
}
6969

7070
template <typename GROUND_TYPE, typename ... Ts, size_t... Is>
71-
static bool bind1(const GROUND_TYPE &fact, tuple<Ts...> &atom, index_sequence<Is...>)
71+
static bool bind(const GROUND_TYPE &fact, tuple<Ts...> &atom, index_sequence<Is...>)
7272
{
73-
return ((bind1(get<Is>(fact), get<Is>(atom))) and ...);
73+
return ((bind(get<Is>(fact), get<Is>(atom))) and ...);
7474
}
7575

7676
template <typename GROUND_TYPE, typename ... Ts>
77-
static bool bind1(const GROUND_TYPE &fact, tuple<Ts...> &atom)
77+
static bool bind(const GROUND_TYPE &fact, tuple<Ts...> &atom)
7878
{
79-
return bind1(fact, atom, make_index_sequence<tuple_size<GROUND_TYPE>::value>{});
79+
return bind(fact, atom, make_index_sequence<tuple_size<GROUND_TYPE>::value>{});
8080
}
8181

8282
template <typename T>
83-
static void ground1(const Variable<T>* s, T &v)
83+
static void ground(const Variable<T>* s, T &v)
8484
{
8585
assert(s->isBound());
8686
v = s->value();
8787
}
8888

8989
template <typename T>
90-
static void ground1(const T &s, T &v)
90+
static void ground(const T &s, T &v)
9191
{
9292
v = s;
9393
}
9494

9595
template <typename RELATION_TYPE, typename ... Ts, size_t... Is>
96-
static void ground1(const tuple<Ts...> &atom, typename RELATION_TYPE::Ground &groundAtom, index_sequence<Is...>)
96+
static void ground(const tuple<Ts...> &atom, typename RELATION_TYPE::Ground &groundAtom, index_sequence<Is...>)
9797
{
98-
((ground1(get<Is>(atom), get<Is>(groundAtom))), ...);
98+
((ground(get<Is>(atom), get<Is>(groundAtom))), ...);
9999
}
100100

101101
template <typename RELATION_TYPE, typename ... Ts>
102-
static typename RELATION_TYPE::Ground ground1(const tuple<Ts...> &atom)
102+
static typename RELATION_TYPE::Ground ground(const tuple<Ts...> &atom)
103103
{
104104
typename RELATION_TYPE::Ground groundAtom;
105-
ground1<RELATION_TYPE>(atom, groundAtom, make_index_sequence<tuple_size<typename RELATION_TYPE::Ground>::value>{});
105+
ground<RELATION_TYPE>(atom, groundAtom, make_index_sequence<tuple_size<typename RELATION_TYPE::Ground>::value>{});
106106
return groundAtom;
107107
}
108108

@@ -436,7 +436,7 @@ ostream & operator<<(ostream &out, const State<RELATIONs...>& state) {
436436
template <typename RULE_INSTANCE_TYPE>
437437
static void unbind(const typename RULE_INSTANCE_TYPE::BodyType &atoms)
438438
{
439-
apply([](auto &&... args) { ((unbind1(args)), ...); }, atoms);
439+
apply([](auto &&... args) { ((unbind(args)), ...); }, atoms);
440440
}
441441

442442
template <size_t I, typename RULE_INSTANCE_TYPE, typename RULE_TYPE>
@@ -451,7 +451,7 @@ static bool bindBodyAtomsToSlice(typename RULE_INSTANCE_TYPE::BodyType &atoms,
451451
// get the atom
452452
auto &atom = get<I>(atoms);
453453
// try to bind the atom with the fact
454-
success = bind1(fact.second, atom);
454+
success = bind(fact.second, atom);
455455
}
456456
return success;
457457
}
@@ -548,7 +548,7 @@ static RelationSet<typename RULE_TYPE::RuleType::HeadRelationType> applyRule(
548548
if (bindBodyAtomsToSlice<RULE_TYPE, typename RULE_TYPE::RuleType>(rule.body, slice))
549549
{
550550
// successful bind, therefore add (grounded) head atom to new state
551-
derivedFacts.set.insert({iteration + 1, ground1<HeadRelationType>(rule.head)});
551+
derivedFacts.set.insert({iteration + 1, ground<HeadRelationType>(rule.head)});
552552
}
553553
}
554554
}

0 commit comments

Comments
 (0)
0