MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / getHexConstant

Method getHexConstant

ij/src/main/java/ij/macro/Tokenizer.java:192–215  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

190 }
191
192 double getHexConstant() {
193 try {
194 token = st.nextToken();
195 } catch (Exception e) {
196 return 0.0;
197 }
198 if (st.ttype != StreamTokenizer.TT_WORD) {
199 st.pushBack();
200 return 0.0;
201 }
202 if (!st.sval.startsWith("x")) {
203 st.pushBack();
204 return 0.0;
205 }
206 String s = st.sval.substring(1, st.sval.length());
207 double n = 0.0;
208 try {
209 n = Long.parseLong(s, 16);
210 } catch (NumberFormatException e) {
211 st.pushBack();
212 n = 0.0;
213 }
214 return n;
215 }
216
217 boolean tryScientificNotation() {
218 String sval = "" + tokenValue;

Callers 1

getTokenMethod · 0.95

Calls 5

startsWithMethod · 0.80
substringMethod · 0.80
parseLongMethod · 0.80
lengthMethod · 0.65
nextTokenMethod · 0.45

Tested by

no test coverage detected