Coverage Report - com.sun.tools.javafx.tree.JFXObjectLiteralPart
 
Classes in this File Line Coverage Branch Coverage Complexity
JFXObjectLiteralPart
46%
12/26
50%
4/8
0
 
 1  
 /*
 2  
  * Copyright 1999-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.ObjectLiteralPartTree;
 31  
 import com.sun.tools.javac.tree.JCTree.JCExpression;
 32  
 import com.sun.tools.javac.util.Name;
 33  
 import com.sun.tools.javac.code.Symbol;
 34  
 import com.sun.javafx.api.JavafxBindStatus;
 35  
 
 36  
 /**
 37  
  * In object literal  "Identifier ':' [ 'bind' 'lazy'?] expression"
 38  
  */
 39  2
 public class JFXObjectLiteralPart extends JFXStatement implements ObjectLiteralPartTree {
 40  
     private JCExpression expr;
 41  
     public Name name; // Make this an Ident. Tools might need position information.
 42  771
     private JCExpression translationInit = null;
 43  
     public Symbol sym;
 44  
    /*
 45  
     * @param selector member name and class name of member
 46  
     * @param init type of attribute
 47  
     * @param sym attribute symbol
 48  
     */
 49  
     protected JFXObjectLiteralPart(
 50  
             Name name,
 51  
             JCExpression expr,
 52  
             JavafxBindStatus bindStatus,
 53  0
             Symbol sym) {
 54  0
         this.name = name;
 55  0
         this.expr = bindStatus == JavafxBindStatus.UNBOUND ? expr :
 56  
             new JFXBindExpression(expr, bindStatus);
 57  0
         this.sym = sym;
 58  0
     }
 59  
 
 60  
    /*
 61  
     * @param selector member name and class name of member
 62  
     * @param init type of attribute
 63  
     * @param sym attribute symbol
 64  
     */
 65  
     protected JFXObjectLiteralPart(
 66  
             Name name,
 67  
             JCExpression expr,
 68  771
             Symbol sym) {
 69  771
         this.name = name;
 70  771
         this.expr = expr;
 71  771
         this.sym = sym;
 72  771
     }
 73  2939
     public void accept(JavafxVisitor v) { v.visitObjectLiteralPart(this); }
 74  
     
 75  0
     public javax.lang.model.element.Name getName() { return name; }
 76  
     public JCExpression getExpression() {
 77  4536
         return expr instanceof JFXBindExpression ?
 78  
             ((JFXBindExpression) expr).getExpression() :
 79  
             expr; }
 80  0
     public JCExpression getMaybeBindExpression() { return expr; }
 81  0
     public void setTranslationInit(JCExpression tra) { translationInit = tra; }
 82  0
     public JCExpression getTranslationInit() { assert false : "currently not being used"; return translationInit; }
 83  
     public JavafxBindStatus getBindStatus() {
 84  1501
         return expr instanceof JFXBindExpression ?
 85  
             ((JFXBindExpression) expr).getBindStatus() :
 86  
             JavafxBindStatus.UNBOUND; }
 87  736
     public boolean isBound()     { return getBindStatus().isBound(); }
 88  0
     public boolean isUnidiBind() { return getBindStatus().isUnidiBind(); }
 89  0
     public boolean isBidiBind()  { return getBindStatus().isBidiBind(); }
 90  0
     public boolean isLazy()      { return getBindStatus().isLazy(); }
 91  
 
 92  
     @Override
 93  
     public int getTag() {
 94  4613
         return JavafxTag.OBJECT_LITERAL_PART;
 95  
     }
 96  
 
 97  
     public JavaFXKind getJavaFXKind() {
 98  0
         return JavaFXKind.OBJECT_LITERAL_PART;
 99  
     }
 100  
 
 101  
     public <R, D> R accept(JavaFXTreeVisitor<R, D> visitor, D data) {
 102  0
         return visitor.visitObjectLiteralPart(this, data);
 103  
     }
 104  
 }