Coverage Report - com.sun.tools.javafx.tree.JFXVar
 
Classes in this File Line Coverage Branch Coverage Complexity
JFXVar
76%
26/34
50%
3/6
0
 
 1  
 /*
 2  
  * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
 3  
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  
  *
 5  
  * This code is free software; you can redistribute it and/or modify it
 6  
  * under the terms of the GNU General Public License version 2 only, as
 7  
  * published by the Free Software Foundation.  Sun designates this
 8  
  * particular file as subject to the "Classpath" exception as provided
 9  
  * by Sun in the LICENSE file that accompanied this code.
 10  
  *
 11  
  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  
  * version 2 for more details (a copy is included in the LICENSE file that
 15  
  * accompanied this code).
 16  
  *
 17  
  * You should have received a copy of the GNU General Public License version
 18  
  * 2 along with this work; if not, write to the Free Software Foundation,
 19  
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  
  *
 21  
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 22  
  * CA 95054 USA or visit www.sun.com if you need additional information or
 23  
  * have any questions.
 24  
  */
 25  
 
 26  
 package com.sun.tools.javafx.tree;
 27  
 
 28  
 import com.sun.javafx.api.tree.JavaFXTree.JavaFXKind;
 29  
 import com.sun.javafx.api.tree.JavaFXTreeVisitor;
 30  
 import com.sun.javafx.api.tree.OnReplaceTree;
 31  
 import com.sun.tools.javac.code.Symbol.VarSymbol;
 32  
 import com.sun.tools.javac.util.Name;
 33  
 import com.sun.tools.javac.tree.JCTree.JCModifiers;
 34  
 import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
 35  
 import com.sun.javafx.api.JavafxBindStatus;
 36  
 import com.sun.javafx.api.tree.JavaFXVariableTree;
 37  
 import com.sun.source.tree.TreeVisitor;
 38  
 import com.sun.tools.javac.tree.JCTree;
 39  
 import java.util.Map;
 40  
 
 41  
 /**
 42  
  * Variable declaration.
 43  
  *
 44  
  * @author Robert Field
 45  
  * @author Zhiqun Chen
 46  
  */
 47  7
 public class JFXVar extends JCVariableDecl implements JavaFXVariableTree {
 48  
     private JFXType jfxtype;
 49  
     private final JavafxBindStatus bindStatus;
 50  
     private final boolean local;
 51  
     
 52  
     private final JFXOnReplace onReplace;
 53  
 
 54  
     protected JFXVar(Name name,
 55  
             JFXType jfxtype,
 56  
             JCModifiers mods,
 57  
             boolean local,
 58  
             JCExpression init,
 59  
             JavafxBindStatus bindStat,
 60  
             JFXOnReplace onReplace,
 61  
             VarSymbol sym) {
 62  3282
         super(mods, name, jfxtype, init, sym);
 63  3282
         this.local = local;
 64  3282
         this.jfxtype = jfxtype;
 65  3282
         this.bindStatus = bindStat == null ? JavafxBindStatus.UNBOUND : bindStat;
 66  3282
         this.onReplace = onReplace;
 67  3282
         this.sym = sym;
 68  3282
     }
 69  
     
 70  21505
     public void accept(JavafxVisitor v) { v.visitVar(this); }
 71  
     
 72  
     @Override
 73  
     public void accept(Visitor v) {
 74  21505
         if (v instanceof JavafxVisitor) {
 75  21505
             this.accept((JavafxVisitor)v);
 76  
         } else {
 77  0
             v.visitVarDef(this);
 78  
         }
 79  21502
     }
 80  
 
 81  
     public JFXType getJFXType() {
 82  14775
         return jfxtype;
 83  
     }
 84  
 
 85  
     public void setJFXType(JFXType type) {
 86  223
         jfxtype = type;
 87  223
     }
 88  
     
 89  
     public OnReplaceTree getOnReplaceTree() {
 90  7
         return onReplace;        
 91  
     }
 92  
     
 93  
     public JFXOnReplace getOnReplace() {
 94  19971
         return onReplace;
 95  
     }
 96  
 
 97  
     public boolean isLocal() {
 98  15
         return local;
 99  
     }
 100  
 
 101  
     public JavafxBindStatus getBindStatus() {
 102  1746
         return bindStatus;
 103  
     }
 104  
 
 105  
     public boolean isBound() {
 106  3264
         return bindStatus.isBound();
 107  
     }
 108  
 
 109  
     public boolean isUnidiBind() {
 110  0
         return bindStatus.isUnidiBind();
 111  
     }
 112  
 
 113  
     public boolean isBidiBind() {
 114  0
         return bindStatus.isBidiBind();
 115  
     }
 116  
 
 117  
     public boolean isLazy() {
 118  0
         return bindStatus.isLazy();
 119  
     }
 120  
 
 121  
     @Override
 122  
     public int getTag() {
 123  50681
         return JavafxTag.VAR_DEF;
 124  
     }
 125  
     
 126  
     public JCModifiers getModifiers() {
 127  4441
         return mods;
 128  
     }
 129  
 
 130  
     
 131  
     public boolean isOverride() {
 132  0
         return false;
 133  
     }
 134  
 
 135  
     public JavaFXKind getJavaFXKind() {
 136  0
         throw new UnsupportedOperationException(getClass().getSimpleName() + " support not implemented");
 137  
     }
 138  
 
 139  
     public <R, D> R accept(JavaFXTreeVisitor<R, D> visitor, D data) {
 140  7
         return visitor.visitVariable(this, data);
 141  
      }
 142  
 
 143  
     @Override
 144  
     public final <R, D> R accept(TreeVisitor<R, D> v, D d) {
 145  7
         if (v instanceof JavaFXTreeVisitor) {
 146  7
             return (R)this.accept((JavaFXTreeVisitor)v, d);
 147  
         } else {
 148  0
             throw new UnsupportedOperationException(getClass().getSimpleName() + " support not implemented");
 149  
         }
 150  
     }
 151  
     
 152  
     @Override
 153  
     public int getStartPosition() {
 154  46412
         return JavafxTreeInfo.getStartPos(this);
 155  
     }
 156  
     
 157  
     @Override
 158  
     public int getEndPosition(Map<JCTree, Integer> endPosTable) {
 159  0
         return JavafxTreeInfo.getEndPos(this, endPosTable);
 160  
     }
 161  
 }