00001 00002 /* 00003 | Author: Michael Schmidt; 00004 | Gunnar Jehl 00005 | 00006 | ************************* SOFTWARE LICENSE AGREEMENT *********************** 00007 | This source code is published under the BSD License. 00008 | 00009 | See file 'LICENSE.txt' that comes with this distribution or 00010 | http://dbis.informatik.uni-freiburg.de/index.php?project=GCX/license.php 00011 | for the full license agreement. 00012 | 00013 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00014 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00015 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00016 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00017 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00018 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00019 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00020 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00021 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00022 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00023 | POSSIBILITY OF SUCH DAMAGE. 00024 | **************************************************************************** 00025 */ 00026 00035 #include "passiveprojectiontreeconfiguration.h" 00036 00037 PassiveProjectionTreeConfiguration:: 00038 PassiveProjectionTreeConfiguration(PassiveProjectionTree * ppt) { 00039 active_nodes.push_back(ppt->getRootNode()); 00040 } 00041 00042 00043 PassiveProjectionTreeConfiguration::PassiveProjectionTreeConfiguration(vector < PassiveProjectionTreeNode * >_passive_nodes): 00044 passive_nodes(_passive_nodes) { 00045 } 00046 00047 00048 PassiveProjectionTreeConfiguration::~PassiveProjectionTreeConfiguration() { 00049 } 00050 00051 PassiveProjectionTreeConfiguration *PassiveProjectionTreeConfiguration:: 00052 applyTag(TAG t) { 00053 00054 PassiveProjectionTreeConfiguration *start = new PassiveProjectionTreeConfiguration(passive_nodes); // this will never change again 00055 00056 for (unsigned i = 0; i < active_nodes.size(); i++) { 00057 PassiveProjectionTreeNode *pptn = active_nodes[i]; 00058 00059 vector < PassiveProjectionTreeNode * >*children = pptn->getChildren(); 00060 bool has_descendantaxis_child = false; 00061 00062 for (unsigned j = 0; j < children->size(); j++) { 00063 PassiveProjectionTreeNode *child = (*children)[j]; 00064 PathStepExpression *ps = child->getLabel(); 00065 00066 has_descendantaxis_child |= ps->getAxisType() == at_descendant; 00067 has_descendantaxis_child |= ps->getAxisType() == at_dos; 00068 if (ps->isMatchingTag(t)) { 00069 start->addActiveNode((*children)[j]); 00070 } 00071 } 00072 if (has_descendantaxis_child) { 00073 start->addPassiveNode(pptn); 00074 } 00075 } 00076 00077 for (unsigned i = 0; i < passive_nodes.size(); i++) { 00078 PassiveProjectionTreeNode *pptn = passive_nodes[i]; 00079 00080 vector < PassiveProjectionTreeNode * >*children = pptn->getChildren(); 00081 for (unsigned j = 0; j < children->size(); j++) { 00082 PassiveProjectionTreeNode *child = (*children)[j]; 00083 PathStepExpression *ps = child->getLabel(); 00084 00085 if (ps->getAxisType() == at_descendant 00086 || ps->getAxisType() == at_dos) { 00087 if (ps->isMatchingTag(t)) { 00088 start->addActiveNode((*children)[j]); 00089 } 00090 } 00091 } 00092 } 00093 00094 return start; 00095 } 00096 00097 PassiveProjectionTreeConfiguration *PassiveProjectionTreeConfiguration:: 00098 applyText() { 00099 return NULL; // will be kept anyway 00100 }