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 #ifndef PROJECTIONTREELABEL_H 00036 #define PROJECTIONTREELABEL_H 00037 00038 #include "projectiontreenode.h" 00039 #include "runtimeexception.h" 00040 00053 class ProjectionTreeLabel { 00054 00055 public: 00070 ProjectionTreeLabel(ProjectionTreeNode * _n, 00071 unsigned _position, unsigned _id, 00072 ProjectionTreeLabel * _same_level_successor, 00073 vector < ProjectionTreeLabel * >_child_successors, 00074 vector < ProjectionTreeLabel * >_self_successors); 00075 00079 virtual ~ ProjectionTreeLabel(); 00080 00088 void updateParentPredecessorInformation(ProjectionTreeLabel * _parent, 00089 ProjectionTreeLabel * _predecessor); 00090 00097 void print(OutputStream & dos); 00098 00105 inline ProjectionTreeLabel *getParent() { 00106 return parent; 00107 } inline ProjectionTreeLabel *getPredecessor() { 00115 return predecessor; 00116 } 00117 00124 ProjectionTreeLabel *getLeftmostSLPredecessor(); 00125 00131 unsigned getDependingVar(); 00132 00138 PathExpression *getPath(); 00139 00145 PathStepExpression *getPathStep(); 00146 00154 TAG getTag(); 00155 00162 AXIS_TYPE getAxisFollowingFSA(); 00163 00171 AXIS_TYPE getAxisFollowingFSA(unsigned fsa); 00172 00179 ProjectionTreeLabel *getFSALabel(); 00180 00186 inline unsigned getId() { 00187 return id; 00188 } 00189 00196 inline unsigned getPosition() { 00197 return position; 00198 } 00199 00205 inline ProjectionTreeLabel *getSameLevelSuccessor() { 00206 return same_level_successor; 00207 } 00208 00215 inline vector < ProjectionTreeLabel * >*getChildSuccessors() { 00216 return &child_successors; 00217 } 00218 00225 inline vector < ProjectionTreeLabel * >*getSelfSuccessors() { 00226 return &self_successors; 00227 } 00228 00234 inline ProjectionTreeNode *getProjectionTreeNode() { 00235 return n; 00236 } 00237 00244 bool isChildOrDescendantLabel(); 00245 00252 bool isDescendantLabel(); 00253 00260 bool isChildLabel(); 00261 00268 bool isDosLabel(); 00269 00276 bool isDosNodeLabel(); 00277 00286 bool isDosOrDescendantLabel(); 00287 00294 bool isNodeLabel(); 00295 00302 bool isStarLabel(); 00303 00311 bool hasSameLevelOrChildSuccessors(); 00312 00319 bool atEndOfPath(); 00320 00327 ProjectionTreeLabel *locateVarAncestorLabel(unsigned var); 00328 00336 bool matchesTag(TAG t); 00337 00344 bool matchesText(); 00345 00355 bool descendantAxisBetw(unsigned basing_id, bool consider_final = false); 00356 00357 private: 00362 ProjectionTreeLabel * parent; 00363 00368 ProjectionTreeLabel *predecessor; 00369 00374 ProjectionTreeNode *n; 00375 00382 unsigned position; 00383 00388 unsigned id; 00389 00396 ProjectionTreeLabel *same_level_successor; 00397 00405 vector < ProjectionTreeLabel * >child_successors; 00406 00413 vector < ProjectionTreeLabel * >self_successors; 00414 }; 00415 00416 #endif // PROJECTIONTREELABEL_H