From: Lars H. <lh...@us...> - 2005-07-08 16:03:58
|
Update of /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/memory In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30131/src/org/tmapiutils/query/tolog/memory Modified Files: PreparedQueryImpl.java QueryEvaluatorImpl.java Log Message: Tabs -> Whitespaces Index: PreparedQueryImpl.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/memory/PreparedQueryImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PreparedQueryImpl.java 8 Mar 2005 12:33:40 -0000 1.2 --- PreparedQueryImpl.java 8 Jul 2005 16:03:19 -0000 1.3 *************** *** 1,67 **** ! /* ! * Copyright 2005 TMAPI Utils / Kal Ahmed, Lars Heuer ! * Copyright (c) 2000-2004 The TM4J Project. All rights reserved. ! * ! * Licensed under the Apache License, Version 2.0 (the "License"); ! * you may not use this file except in compliance with the License. ! * You may obtain a copy of the License at ! * ! * http://www.apache.org/licenses/LICENSE-2.0 ! * ! * Unless required by applicable law or agreed to in writing, software ! * distributed under the License is distributed on an "AS IS" BASIS, ! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ! * See the License for the specific language governing permissions and ! * limitations under the License. ! */ ! ! package org.tmapiutils.query.tolog.memory; ! ! import org.tmapiutils.query.tolog.TologResultsSet; ! import org.tmapiutils.query.tolog.PreparedQuery; ! import org.tmapiutils.query.tolog.TologProcessingException; ! import org.tmapiutils.query.tolog.parser.TologQuery; ! ! /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) ! */ ! public class PreparedQueryImpl implements PreparedQuery { ! ! private TologQuery m_query; ! ! public PreparedQueryImpl(TologQuery q) { ! m_query = q; ! rewrite(); ! } ! ! /** ! * Rewrite the query for optimisation purposes ! */ ! private void rewrite() { ! // TODO Implement query rewriting optimisation strategy. ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.PreparedQuery#getQueryString() ! */ ! public String getQueryString() { ! return m_query.toString(); ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.PreparedQuery#execute() ! */ ! public TologResultsSet execute() throws TologProcessingException { ! return m_query.execute(); ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.PreparedQuery#execute(java.lang.Object[]) ! */ ! public TologResultsSet execute(Object[] params) throws TologProcessingException { ! return m_query.execute(params); ! } ! ! } --- 1,67 ---- ! /* ! * Copyright 2005 TMAPI Utils / Kal Ahmed, Lars Heuer ! * Copyright (c) 2000-2004 The TM4J Project. All rights reserved. ! * ! * Licensed under the Apache License, Version 2.0 (the "License"); ! * you may not use this file except in compliance with the License. ! * You may obtain a copy of the License at ! * ! * http://www.apache.org/licenses/LICENSE-2.0 ! * ! * Unless required by applicable law or agreed to in writing, software ! * distributed under the License is distributed on an "AS IS" BASIS, ! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ! * See the License for the specific language governing permissions and ! * limitations under the License. ! */ ! ! package org.tmapiutils.query.tolog.memory; ! ! import org.tmapiutils.query.tolog.TologResultsSet; ! import org.tmapiutils.query.tolog.PreparedQuery; ! import org.tmapiutils.query.tolog.TologProcessingException; ! import org.tmapiutils.query.tolog.parser.TologQuery; ! ! /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) ! */ ! public class PreparedQueryImpl implements PreparedQuery { ! ! private TologQuery m_query; ! ! public PreparedQueryImpl(TologQuery q) { ! m_query = q; ! rewrite(); ! } ! ! /** ! * Rewrite the query for optimisation purposes ! */ ! private void rewrite() { ! // TODO Implement query rewriting optimisation strategy. ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.PreparedQuery#getQueryString() ! */ ! public String getQueryString() { ! return m_query.toString(); ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.PreparedQuery#execute() ! */ ! public TologResultsSet execute() throws TologProcessingException { ! return m_query.execute(); ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.PreparedQuery#execute(java.lang.Object[]) ! */ ! public TologResultsSet execute(Object[] params) throws TologProcessingException { ! return m_query.execute(params); ! } ! ! } Index: QueryEvaluatorImpl.java =================================================================== RCS file: /cvsroot/tmapi-utils/tmapi-utils/src/org/tmapiutils/query/tolog/memory/QueryEvaluatorImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QueryEvaluatorImpl.java 8 Mar 2005 12:33:40 -0000 1.2 --- QueryEvaluatorImpl.java 8 Jul 2005 16:03:19 -0000 1.3 *************** *** 1,209 **** ! /* ! * Copyright 2005 TMAPI Utils / Kal Ahmed, Lars Heuer ! * Copyright (c) 2000-2004 The TM4J Project. All rights reserved. ! * ! * Licensed under the Apache License, Version 2.0 (the "License"); ! * you may not use this file except in compliance with the License. ! * You may obtain a copy of the License at ! * ! * http://www.apache.org/licenses/LICENSE-2.0 ! * ! * Unless required by applicable law or agreed to in writing, software ! * distributed under the License is distributed on an "AS IS" BASIS, ! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ! * See the License for the specific language governing permissions and ! * limitations under the License. ! */ ! ! package org.tmapiutils.query.tolog.memory; ! ! import java.io.IOException; ! import java.io.InputStream; ! import java.io.StringReader; ! import java.util.HashMap; ! import java.util.Map; ! ! import org.tmapiutils.query.tolog.TologResultsSet; ! import org.tmapiutils.query.tolog.PreparedQuery; ! import org.tmapiutils.query.tolog.QueryEvaluator; ! import org.tmapiutils.query.tolog.TologParserException; ! import org.tmapiutils.query.tolog.TologProcessingException; ! import org.tmapiutils.query.tolog.parser.Predicate; ! import org.tmapiutils.query.tolog.parser.TologLexer; ! import org.tmapiutils.query.tolog.parser.TologParser; ! import org.tmapiutils.query.tolog.parser.TologQuery; ! import org.tmapiutils.query.tolog.parser.TologRule; ! import org.tmapiutils.query.tolog.predicates.AssociationPredicate; ! import org.tmapiutils.query.tolog.predicates.AssociationRolePredicate; ! import org.tmapiutils.query.tolog.predicates.BaseLocatorPredicate; ! import org.tmapiutils.query.tolog.predicates.DirectInstanceOfPredicate; ! import org.tmapiutils.query.tolog.predicates.InstanceOfPredicate; ! import org.tmapiutils.query.tolog.predicates.OccurrencePredicate; ! import org.tmapiutils.query.tolog.predicates.ReifiesPredicate; ! import org.tmapiutils.query.tolog.predicates.ResourcePredicate; ! import org.tmapiutils.query.tolog.predicates.RolePlayerPredicate; ! import org.tmapiutils.query.tolog.predicates.ScopePredicate; ! import org.tmapiutils.query.tolog.predicates.SourceLocatorsPredicate; ! import org.tmapiutils.query.tolog.predicates.SubjectLocatorPredicate; ! import org.tmapiutils.query.tolog.predicates.SubjectIdentifierPredicate; ! import org.tmapiutils.query.tolog.predicates.TopicMapPredicate; ! import org.tmapiutils.query.tolog.predicates.TopicPredicate; ! import org.tmapiutils.query.tolog.predicates.TopicNamePredicate; ! import org.tmapiutils.query.tolog.predicates.TypePredicate; ! import org.tmapiutils.query.tolog.predicates.ValueLikePredicate; ! import org.tmapiutils.query.tolog.predicates.ValuePredicate; ! import org.tmapiutils.query.tolog.predicates.VariantPredicate; ! import org.tmapi.core.TopicMap; ! ! import antlr.ANTLRException; ! ! /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) ! */ ! public class QueryEvaluatorImpl implements QueryEvaluator { ! ! private TopicMap m_tm; ! ! private Map m_rulesByName = null; ! private Map m_rulesByPrefix = null; ! private Map m_predicatesByName = null; ! ! public QueryEvaluatorImpl(TopicMap tm) { ! m_rulesByName = new HashMap(); ! m_rulesByPrefix = new HashMap(); ! m_predicatesByName = new HashMap(); ! initialisePredicates(); ! setTopicMap(tm); ! } ! ! /** ! * Loads the default built-in predicates ! */ ! private void initialisePredicates() { ! registerPredicateClass(AssociationPredicate.PREDICATE_NAME, AssociationPredicate.class); ! registerPredicateClass(AssociationRolePredicate.PREDICATE_NAME, AssociationRolePredicate.class); ! registerPredicateClass(BaseLocatorPredicate.PREDICATE_NAME, BaseLocatorPredicate.class); ! registerPredicateClass(DirectInstanceOfPredicate.PREDICATE_NAME, DirectInstanceOfPredicate.class); ! registerPredicateClass(InstanceOfPredicate.PREDICATE_NAME, InstanceOfPredicate.class); ! registerPredicateClass(OccurrencePredicate.PREDICATE_NAME, OccurrencePredicate.class); ! registerPredicateClass(ReifiesPredicate.PREDICATE_NAME, ReifiesPredicate.class); ! registerPredicateClass(ResourcePredicate.PREDICATE_NAME, ResourcePredicate.class); ! registerPredicateClass(RolePlayerPredicate.PREDICATE_NAME, RolePlayerPredicate.class); ! registerPredicateClass(ScopePredicate.PREDICATE_NAME, ScopePredicate.class); ! registerPredicateClass(SourceLocatorsPredicate.PREDICATE_NAME, SourceLocatorsPredicate.class); ! registerPredicateClass(SubjectLocatorPredicate.PREDICATE_NAME, SubjectLocatorPredicate.class); ! registerPredicateClass(SubjectIdentifierPredicate.PREDICATE_NAME, SubjectIdentifierPredicate.class); ! registerPredicateClass(TopicMapPredicate.PREDICATE_NAME, TopicMapPredicate.class); ! registerPredicateClass(TopicPredicate.PREDICATE_NAME, TopicPredicate.class); ! registerPredicateClass(TopicNamePredicate.PREDICATE_NAME, TopicNamePredicate.class); ! registerPredicateClass(TypePredicate.PREDICATE_NAME, TypePredicate.class); ! registerPredicateClass(ValueLikePredicate.PREDICATE_NAME, ValueLikePredicate.class); ! registerPredicateClass(ValuePredicate.PREDICATE_NAME, ValuePredicate.class); ! registerPredicateClass(VariantPredicate.PREDICATE_NAME, VariantPredicate.class); ! } ! ! public void setTopicMap(TopicMap tm) { ! m_tm = tm; ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#addRulesModule(java.io.InputStream, java.lang.String) ! */ ! public void addRulesModule(InputStream src, String prefix) ! throws IOException, TologParserException ! { ! try { ! TologParser p = new TologParser(new TologLexer(src)); ! p.setTopicMap(m_tm); ! p.setRules(m_rulesByName); ! p.setPredicates(m_predicatesByName); ! p.setPrefix(prefix); ! p.module(); ! m_rulesByName.putAll(p.getRules()); ! if (prefix != null) m_rulesByPrefix.put(prefix, p.getRules()); ! } catch (ANTLRException ex) { ! throw new TologParserException("Parser error reading module.", ex); ! } ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#addRule(java.lang.String) ! */ ! public void addRule(String rule) throws TologParserException { ! try { ! TologParser p = new TologParser(new TologLexer(new StringReader(rule))); ! p.setTopicMap(m_tm); ! p.setRules(m_rulesByName); ! p.setPredicates(m_predicatesByName); ! TologRule r = p.rule(); ! m_rulesByName.put(r.getName(), r); ! m_predicatesByName.put(r.getName(), TologRule.class); ! } catch (ANTLRException ex) { ! throw new TologParserException("Parser error in rule string.", ex); ! } ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#prepareQuery(java.lang.String) ! */ ! public PreparedQuery prepareQuery(String queryString) ! throws TologParserException, TologProcessingException ! { ! try { ! TologParser p = new TologParser(new TologLexer(new StringReader(queryString))); ! p.setTopicMap(m_tm); ! p.setPredicates(m_predicatesByName); ! p.setRules(m_rulesByName); ! p.setPrefixRules(m_rulesByPrefix); ! TologQuery q = p.query(); ! PreparedQuery pq = new PreparedQueryImpl(q); ! return pq; ! } catch (ANTLRException ex) { ! throw new TologParserException("Error parsing query string.", ex); ! } ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#execute(java.lang.String) ! */ ! public TologResultsSet execute(String queryString) ! throws TologParserException, TologProcessingException ! { ! PreparedQuery pq = prepareQuery(queryString); ! return pq.execute(); ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#execute(java.lang.String, java.lang.Object[]) ! */ ! public TologResultsSet execute(String queryString, Object[] queryParams) throws TologParserException, TologProcessingException { ! PreparedQuery pq = prepareQuery(queryString); ! return pq.execute(queryParams); ! } ! ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#registerPredicateClass(java.lang.String, java.lang.Class) ! */ ! public void registerPredicateClass( ! String predicateName, ! Class predicateClass) ! throws IllegalArgumentException ! { ! if (!Predicate.class.isAssignableFrom(predicateClass)) { ! throw new IllegalArgumentException("Class does not implement the " + Predicate.class.getName() + " interface."); ! } ! ! m_predicatesByName.put(predicateName, predicateClass); ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#getRegisteredPredicates() ! */ ! public Map getRegisteredPredicates() { ! return m_predicatesByName; ! } ! ! } --- 1,209 ---- ! /* ! * Copyright 2005 TMAPI Utils / Kal Ahmed, Lars Heuer ! * Copyright (c) 2000-2004 The TM4J Project. All rights reserved. ! * ! * Licensed under the Apache License, Version 2.0 (the "License"); ! * you may not use this file except in compliance with the License. ! * You may obtain a copy of the License at ! * ! * http://www.apache.org/licenses/LICENSE-2.0 ! * ! * Unless required by applicable law or agreed to in writing, software ! * distributed under the License is distributed on an "AS IS" BASIS, ! * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ! * See the License for the specific language governing permissions and ! * limitations under the License. ! */ ! ! package org.tmapiutils.query.tolog.memory; ! ! import java.io.IOException; ! import java.io.InputStream; ! import java.io.StringReader; ! import java.util.HashMap; ! import java.util.Map; ! ! import org.tmapiutils.query.tolog.TologResultsSet; ! import org.tmapiutils.query.tolog.PreparedQuery; ! import org.tmapiutils.query.tolog.QueryEvaluator; ! import org.tmapiutils.query.tolog.TologParserException; ! import org.tmapiutils.query.tolog.TologProcessingException; ! import org.tmapiutils.query.tolog.parser.Predicate; ! import org.tmapiutils.query.tolog.parser.TologLexer; ! import org.tmapiutils.query.tolog.parser.TologParser; ! import org.tmapiutils.query.tolog.parser.TologQuery; ! import org.tmapiutils.query.tolog.parser.TologRule; ! import org.tmapiutils.query.tolog.predicates.AssociationPredicate; ! import org.tmapiutils.query.tolog.predicates.AssociationRolePredicate; ! import org.tmapiutils.query.tolog.predicates.BaseLocatorPredicate; ! import org.tmapiutils.query.tolog.predicates.DirectInstanceOfPredicate; ! import org.tmapiutils.query.tolog.predicates.InstanceOfPredicate; ! import org.tmapiutils.query.tolog.predicates.OccurrencePredicate; ! import org.tmapiutils.query.tolog.predicates.ReifiesPredicate; ! import org.tmapiutils.query.tolog.predicates.ResourcePredicate; ! import org.tmapiutils.query.tolog.predicates.RolePlayerPredicate; ! import org.tmapiutils.query.tolog.predicates.ScopePredicate; ! import org.tmapiutils.query.tolog.predicates.SourceLocatorsPredicate; ! import org.tmapiutils.query.tolog.predicates.SubjectLocatorPredicate; ! import org.tmapiutils.query.tolog.predicates.SubjectIdentifierPredicate; ! import org.tmapiutils.query.tolog.predicates.TopicMapPredicate; ! import org.tmapiutils.query.tolog.predicates.TopicPredicate; ! import org.tmapiutils.query.tolog.predicates.TopicNamePredicate; ! import org.tmapiutils.query.tolog.predicates.TypePredicate; ! import org.tmapiutils.query.tolog.predicates.ValueLikePredicate; ! import org.tmapiutils.query.tolog.predicates.ValuePredicate; ! import org.tmapiutils.query.tolog.predicates.VariantPredicate; ! import org.tmapi.core.TopicMap; ! ! import antlr.ANTLRException; ! ! /** ! * ! * @author Kal Ahmed (kal[at]techquila.com) ! * @author Lars Heuer (heuer[at]semagia.com) ! */ ! public class QueryEvaluatorImpl implements QueryEvaluator { ! ! private TopicMap m_tm; ! ! private Map m_rulesByName = null; ! private Map m_rulesByPrefix = null; ! private Map m_predicatesByName = null; ! ! public QueryEvaluatorImpl(TopicMap tm) { ! m_rulesByName = new HashMap(); ! m_rulesByPrefix = new HashMap(); ! m_predicatesByName = new HashMap(); ! initialisePredicates(); ! setTopicMap(tm); ! } ! ! /** ! * Loads the default built-in predicates ! */ ! private void initialisePredicates() { ! registerPredicateClass(AssociationPredicate.PREDICATE_NAME, AssociationPredicate.class); ! registerPredicateClass(AssociationRolePredicate.PREDICATE_NAME, AssociationRolePredicate.class); ! registerPredicateClass(BaseLocatorPredicate.PREDICATE_NAME, BaseLocatorPredicate.class); ! registerPredicateClass(DirectInstanceOfPredicate.PREDICATE_NAME, DirectInstanceOfPredicate.class); ! registerPredicateClass(InstanceOfPredicate.PREDICATE_NAME, InstanceOfPredicate.class); ! registerPredicateClass(OccurrencePredicate.PREDICATE_NAME, OccurrencePredicate.class); ! registerPredicateClass(ReifiesPredicate.PREDICATE_NAME, ReifiesPredicate.class); ! registerPredicateClass(ResourcePredicate.PREDICATE_NAME, ResourcePredicate.class); ! registerPredicateClass(RolePlayerPredicate.PREDICATE_NAME, RolePlayerPredicate.class); ! registerPredicateClass(ScopePredicate.PREDICATE_NAME, ScopePredicate.class); ! registerPredicateClass(SourceLocatorsPredicate.PREDICATE_NAME, SourceLocatorsPredicate.class); ! registerPredicateClass(SubjectLocatorPredicate.PREDICATE_NAME, SubjectLocatorPredicate.class); ! registerPredicateClass(SubjectIdentifierPredicate.PREDICATE_NAME, SubjectIdentifierPredicate.class); ! registerPredicateClass(TopicMapPredicate.PREDICATE_NAME, TopicMapPredicate.class); ! registerPredicateClass(TopicPredicate.PREDICATE_NAME, TopicPredicate.class); ! registerPredicateClass(TopicNamePredicate.PREDICATE_NAME, TopicNamePredicate.class); ! registerPredicateClass(TypePredicate.PREDICATE_NAME, TypePredicate.class); ! registerPredicateClass(ValueLikePredicate.PREDICATE_NAME, ValueLikePredicate.class); ! registerPredicateClass(ValuePredicate.PREDICATE_NAME, ValuePredicate.class); ! registerPredicateClass(VariantPredicate.PREDICATE_NAME, VariantPredicate.class); ! } ! ! public void setTopicMap(TopicMap tm) { ! m_tm = tm; ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#addRulesModule(java.io.InputStream, java.lang.String) ! */ ! public void addRulesModule(InputStream src, String prefix) ! throws IOException, TologParserException ! { ! try { ! TologParser p = new TologParser(new TologLexer(src)); ! p.setTopicMap(m_tm); ! p.setRules(m_rulesByName); ! p.setPredicates(m_predicatesByName); ! p.setPrefix(prefix); ! p.module(); ! m_rulesByName.putAll(p.getRules()); ! if (prefix != null) m_rulesByPrefix.put(prefix, p.getRules()); ! } catch (ANTLRException ex) { ! throw new TologParserException("Parser error reading module.", ex); ! } ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#addRule(java.lang.String) ! */ ! public void addRule(String rule) throws TologParserException { ! try { ! TologParser p = new TologParser(new TologLexer(new StringReader(rule))); ! p.setTopicMap(m_tm); ! p.setRules(m_rulesByName); ! p.setPredicates(m_predicatesByName); ! TologRule r = p.rule(); ! m_rulesByName.put(r.getName(), r); ! m_predicatesByName.put(r.getName(), TologRule.class); ! } catch (ANTLRException ex) { ! throw new TologParserException("Parser error in rule string.", ex); ! } ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#prepareQuery(java.lang.String) ! */ ! public PreparedQuery prepareQuery(String queryString) ! throws TologParserException, TologProcessingException ! { ! try { ! TologParser p = new TologParser(new TologLexer(new StringReader(queryString))); ! p.setTopicMap(m_tm); ! p.setPredicates(m_predicatesByName); ! p.setRules(m_rulesByName); ! p.setPrefixRules(m_rulesByPrefix); ! TologQuery q = p.query(); ! PreparedQuery pq = new PreparedQueryImpl(q); ! return pq; ! } catch (ANTLRException ex) { ! throw new TologParserException("Error parsing query string.", ex); ! } ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#execute(java.lang.String) ! */ ! public TologResultsSet execute(String queryString) ! throws TologParserException, TologProcessingException ! { ! PreparedQuery pq = prepareQuery(queryString); ! return pq.execute(); ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#execute(java.lang.String, java.lang.Object[]) ! */ ! public TologResultsSet execute(String queryString, Object[] queryParams) throws TologParserException, TologProcessingException { ! PreparedQuery pq = prepareQuery(queryString); ! return pq.execute(queryParams); ! } ! ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#registerPredicateClass(java.lang.String, java.lang.Class) ! */ ! public void registerPredicateClass( ! String predicateName, ! Class predicateClass) ! throws IllegalArgumentException ! { ! if (!Predicate.class.isAssignableFrom(predicateClass)) { ! throw new IllegalArgumentException("Class does not implement the " + Predicate.class.getName() + " interface."); ! } ! ! m_predicatesByName.put(predicateName, predicateClass); ! } ! ! /* (non-Javadoc) ! * @see org.tmapiutils.query.tolog.QueryEvaluator#getRegisteredPredicates() ! */ ! public Map getRegisteredPredicates() { ! return m_predicatesByName; ! } ! ! } |