< prev index next >

src/jdk.jcmd/share/classes/sun/tools/jstat/ExpressionResolver.java

Print this page




  52 
  53         if (e == null) {
  54             return null;
  55         }
  56 
  57         if (debug) {
  58             System.out.println("Resolving Expression:" + e);
  59         }
  60 
  61         if (e instanceof Identifier) {
  62             Identifier id = (Identifier)e;
  63 
  64             // check if it's already resolved
  65             if (id.isResolved()) {
  66                 return id;
  67             }
  68 
  69             // look it up
  70             Monitor m = vm.findByName(id.getName());
  71             if (m == null) {

  72                 System.err.println("Warning: Unresolved Symbol: "
  73                                    + id.getName() + " substituted NaN");

  74                 return new Literal(Double.valueOf(Double.NaN));
  75             }
  76             if (m.getVariability() == Variability.CONSTANT) {
  77                 if (debug) {
  78                     System.out.println("Converting constant " + id.getName()
  79                                        + " to literal with value "
  80                                        + m.getValue());
  81                 }
  82                 return new Literal(m.getValue());
  83             }
  84             id.setValue(m);
  85             return id;
  86         }
  87 
  88         if (e instanceof Literal) {
  89             return e;
  90         }
  91 
  92         Expression l = null;
  93         Expression r = null;




  52 
  53         if (e == null) {
  54             return null;
  55         }
  56 
  57         if (debug) {
  58             System.out.println("Resolving Expression:" + e);
  59         }
  60 
  61         if (e instanceof Identifier) {
  62             Identifier id = (Identifier)e;
  63 
  64             // check if it's already resolved
  65             if (id.isResolved()) {
  66                 return id;
  67             }
  68 
  69             // look it up
  70             Monitor m = vm.findByName(id.getName());
  71             if (m == null) {
  72                 if (debug) {
  73                     System.err.println("Warning: Unresolved Symbol: "
  74                                        + id.getName() + " substituted NaN");
  75                 }
  76                 return new Literal(Double.valueOf(Double.NaN));
  77             }
  78             if (m.getVariability() == Variability.CONSTANT) {
  79                 if (debug) {
  80                     System.out.println("Converting constant " + id.getName()
  81                                        + " to literal with value "
  82                                        + m.getValue());
  83                 }
  84                 return new Literal(m.getValue());
  85             }
  86             id.setValue(m);
  87             return id;
  88         }
  89 
  90         if (e instanceof Literal) {
  91             return e;
  92         }
  93 
  94         Expression l = null;
  95         Expression r = null;


< prev index next >