< prev index next >
src/jdk.jcmd/share/classes/sun/tools/jstat/ExpressionResolver.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -46,11 +46,12 @@
/*
* evaluate the given expression. evaluation in this case means
* to resolve the counter names in the expression
*/
- public Object evaluate(Expression e) throws MonitorException {
+ @Override
+ public Object evaluate(Expression e, boolean isForcibly) throws MonitorException {
if (e == null) {
return null;
}
@@ -71,11 +72,11 @@
if (m == null) {
if (debug) {
System.err.println("Warning: Unresolved Symbol: "
+ id.getName() + " substituted NaN");
}
- return new Literal(Double.valueOf(Double.NaN));
+ return new Literal(isForcibly ? 0.0d : Double.NaN);
}
if (m.getVariability() == Variability.CONSTANT) {
if (debug) {
System.out.println("Converting constant " + id.getName()
+ " to literal with value "
@@ -93,14 +94,14 @@
Expression l = null;
Expression r = null;
if (e.getLeft() != null) {
- l = (Expression)evaluate(e.getLeft());
+ l = (Expression)evaluate(e.getLeft(), isForcibly);
}
if (e.getRight() != null) {
- r = (Expression)evaluate(e.getRight());
+ r = (Expression)evaluate(e.getRight(), isForcibly);
}
if (l != null && r != null) {
if ((l instanceof Literal) && (r instanceof Literal)) {
Literal ll = (Literal)l;
< prev index next >