summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-05-31 10:42:53 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-05-31 10:42:53 +0200
commit6fea30e26cf1486b9bb862c3f9a2079617c2332f (patch)
treefd50d210155a32b0ffab4135303bd7cda2c1fe88
parent5c7c23330c2884d1266c33d543f0e2e5fabf696a (diff)
downloadhastabel-6fea30e26cf1486b9bb862c3f9a2079617c2332f.zip
hastabel-6fea30e26cf1486b9bb862c3f9a2079617c2332f.tar.bz2
Adds a way to find the string matching an element.
-rw-r--r--src/hastabel/Strings.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/hastabel/Strings.java b/src/hastabel/Strings.java
index b90ccf7..f3d4892 100644
--- a/src/hastabel/Strings.java
+++ b/src/hastabel/Strings.java
@@ -17,6 +17,7 @@ public class Strings
{
private final Map<String, Element> AS_ELEMENT;
+ private final Map<String, String> FROM_ELEMENT_NAME;
private final Collection<Pattern> regexes;
private final Type string_type;
@@ -33,6 +34,7 @@ public class Strings
public Strings (final Type string_type, final LogicWorld world)
{
AS_ELEMENT = new HashMap<String, Element>();
+ FROM_ELEMENT_NAME = new HashMap<String, String>();
regexes = new ArrayList<Pattern>();
anon_string_prefix = "_string_"; /* TODO: use a program param. */
@@ -60,6 +62,7 @@ public class Strings
anon_string_count += 1;
AS_ELEMENT.put(str, elem);
+ FROM_ELEMENT_NAME.put(elem.get_name(), str);
}
return elem;
@@ -73,6 +76,11 @@ public class Strings
return get_string_as_element(str);
}
+ public String get_string_from_element_name (final String e_name)
+ {
+ return FROM_ELEMENT_NAME.get(e_name);
+ }
+
public void populate_regex_predicate (final Predicate rp)
{
final Set<Map.Entry<String, Element>> candidates;