com.nedap.archie.rmobjectvalidator.APathQueryCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tools Show documentation
Show all versions of tools Show documentation
tools that operate on the archie reference models and archetype object model
package com.nedap.archie.rmobjectvalidator;
import com.nedap.archie.query.RMPathQuery;
import java.util.HashMap;
/**
* APath query cache. NOT thread-safe!
* Created by pieter.bos on 27/05/16.
*/
public class APathQueryCache {
private final boolean matchSpecialisedNodes;
private final HashMap queryCache = new HashMap<>();
public APathQueryCache() {
this(false);
}
public APathQueryCache(boolean matchSpecialisedNodes) {
this.matchSpecialisedNodes = matchSpecialisedNodes;
}
public RMPathQuery getApathQuery(String query) {
RMPathQuery result = queryCache.get(query);
if (result == null) {
result = new RMPathQuery(query, matchSpecialisedNodes);
queryCache.put(query, result);
}
return result;
}
}