From f6f0946ebd30123b50e55ab43fe5c5675da74cc6 Mon Sep 17 00:00:00 2001 From: villberg Date: Mon, 24 Nov 2014 13:49:59 +0000 Subject: [PATCH] (refs #5495) Performance optimizations for Project Game git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@30600 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../src/org/simantics/sysdyn/adapter/IndexVariable.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/IndexVariable.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/IndexVariable.java index 6b4a6d7f..9d940f26 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/IndexVariable.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/adapter/IndexVariable.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.regex.Pattern; import org.simantics.Simantics; import org.simantics.databoard.Bindings; @@ -264,10 +265,11 @@ public abstract class IndexVariable extends AbstractPropertyVariable { Pair,List> result = null; if(regexp) { + Pattern p = Pattern.compile(test); result = new Pair,List>(new ArrayList(), new ArrayList()); for(String k : rvis.keySet()) { String value = rvis.get(k); - if(k.matches(test) || value.matches(test)) { + if(p.matcher(k).matches() || p.matcher(value).matches()) { result.first.add(transform(k)); result.second.add(transform(value)); } -- 2.47.1