From 8565b47b9e8a59ac06e4f739d63218b0f1e5cb05 Mon Sep 17 00:00:00 2001 From: olpc user Date: Fri, 22 Nov 2019 13:35:48 -0800 Subject: basic habit state change meaning boilerplate --- starts/meaning-vm/concept.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'starts/meaning-vm/concept.cpp') diff --git a/starts/meaning-vm/concept.cpp b/starts/meaning-vm/concept.cpp index dc9ecca..58d1a7c 100644 --- a/starts/meaning-vm/concept.cpp +++ b/starts/meaning-vm/concept.cpp @@ -5,6 +5,21 @@ ref concept::id() return this; } +bool concept::linked(ref type) +{ + return links.count(type) > 0; +} + +bool concept::linked(ref type, ref target) +{ + for (ref t : getAll(type)) { + if (t == target) { + return true; + } + } + return false; +} + ref concept::get(ref type) { auto result = links.equal_range(type); -- cgit v1.2.3