List of usage examples for com.google.gwt.core.client JsArrayString get
public final native String get(int index) ;
From source file:com.google.speedtracer.client.model.JavaScriptProfileModelV8Impl.java
License:Apache License
/** * Process a tick entry in the v8 log. The format of this log entry is: * //from ww w .j a va2 s .c om * command, codeOffset, stackOffset, type, <codeOffset2, <codeOffset3, <...>>> * * e.g.: t,-7364bb,+45c,0 */ private void parseV8TickEntry(JsArrayString logEntries) { assert logEntries.length() >= 4; double address = parseAddress(logEntries.get(1), ADDRESS_TAG_CODE); // stack address is currently ignored, but it must be parsed to keep the // stack address tag up to date if anyone else ever wants to use it. // double stackAddress = parseAddress(logEntries.get(2), ADDRESS_TAG_STACK); int vmState = Integer.parseInt(logEntries.get(3)); currentProfile.addStateTime(vmState, 1.0); List<V8Symbol> symbols = new ArrayList<V8Symbol>(); V8Symbol found = symbolTable.lookup(address); if (found != null) { symbols.add(found); } addressTags.put(ADDRESS_TAG_SCRATCH, address); for (int i = 4; i < logEntries.length(); ++i) { address = parseAddress(logEntries.get(i), ADDRESS_TAG_SCRATCH); found = symbolTable.lookup(address); if (found != null) { symbols.add(found); } } updateFlatProfile(symbols, vmState); updateBottomUpProfile(symbols, vmState); updateTopDownProfile(symbols, vmState); }
From source file:com.google.speedtracer.client.model.V8LogDecompressor.java
License:Apache License
public String decompressLogEntry(String logLine) { String decompressedLogEntry = logLine; if (windowSize > 0) { /**/*from w w w.j a v a 2 s . co m*/ * Compression will cause some lines to have # references in them. * * Formatting string for back references to the whole line. E.g. "#2" * means "the second line above". * * Formatting string for back references. E.g. "#2:10" means * "the second line above, start from char 10 (0-based)". */ int compressionStart = logLine.indexOf('#'); /** * logLine.indexOf('#') is too simple - it is tricked by # chars inside of * quoted strings. This follows the example of devtools, where they use * the knowledge that only RegExp entries have an embedded #, and those * lines always end with a quote character. */ if (compressionStart != -1 && !logLine.endsWith("\"")) { String compressionString = logLine.substring(compressionStart + 1); int colonStart = compressionString.indexOf(':'); int lineOffset = 0; int charOffset = 0; if (colonStart < 0) { lineOffset = Integer.parseInt(compressionString); } else { lineOffset = Integer.parseInt(compressionString.substring(0, colonStart)); charOffset = Integer.parseInt(compressionString.substring(colonStart + 1)); } assert charOffset >= 0; decompressedLogEntry = logLine.substring(0, compressionStart) + fetchLogBackref(lineOffset, charOffset); } } JsArrayString logEntry = Csv.split(decompressedLogEntry); if (logEntry.length() == 0) { } else { String command = logEntry.get(0); if (command.equals("profiler")) { // ignore } else if (command.equals("repeat") || command.equals("r")) { // skip the first 2 fields. int firstCommaOffset = decompressedLogEntry.indexOf(","); int secondCommaOffset = decompressedLogEntry.indexOf(",", firstCommaOffset + 1); appendLogEntry(decompressedLogEntry.substring(secondCommaOffset + 1)); } else { appendLogEntry(decompressedLogEntry); } } return decompressedLogEntry; }
From source file:com.gwtmobile.phonegap.client.File.java
License:Apache License
public static String[] getRootPaths() { JsArrayString jsArray = getRootPathsNative(); String[] array = new String[jsArray.length()]; for (int i = 0; i < jsArray.length(); i++) { array[i] = jsArray.get(i); }//from w ww. j a v a 2 s . c om return array; }
From source file:com.gwtmobile.phonegap.client.File.java
License:Apache License
public static String[] getFileBasePaths() { JsArrayString jsArray = getFileBasePathsNative(); String[] array = new String[jsArray.length()]; for (int i = 0; i < jsArray.length(); i++) { array[i] = jsArray.get(i); }//from ww w. j a va 2 s .com return array; }
From source file:com.invient.vaadin.charts.widgetset.client.ui.VInvientCharts.java
License:Apache License
private boolean areStringArraysEqual(JsArrayString arrOne, JsArrayString arrTwo) { if (arrOne == arrTwo) { return true; }// w w w.ja va2 s. c o m if ((arrOne != null && arrTwo == null) || (arrOne == null && arrTwo != null)) { return false; } if (arrOne.length() != arrTwo.length()) { return false; } // Compare each array element for (int arrInd = 0; arrInd < arrOne.length(); arrInd++) { String arrOneVal = arrOne.get(arrInd); String arrTwoVal = arrTwo.get(arrInd); if (arrOneVal == null) { if (arrTwoVal != null) { return false; } } else if (!arrOneVal.equals(arrTwoVal)) { return false; } } return true; }
From source file:com.invient.vaadin.charts.widgetset.client.ui.VInvientCharts.java
License:Apache License
private boolean doesArrayContainSeriesName(JsArrayString namesOfSeriesToAdd, String seriesName) { for (int ind = 0; ind < namesOfSeriesToAdd.length(); ind++) { if (seriesName.equals(namesOfSeriesToAdd.get(ind))) { return true; }/*from w w w.j a va 2 s . c o m*/ } return false; }
From source file:com.jythonui.client.js.JSOToVariables.java
License:Apache License
static DialogVariables toV(JavaScriptObject o) { DialogVariables v = new DialogVariables(); JSOModel mo = (JSOModel) o;/*from w w w . j a v a 2 s . c o m*/ JsArrayString a = mo.keys(); for (int i = 0; i < a.length(); i++) { String key = a.get(i); String val = mo.get(key); String type = mo.get(key + IUIConsts.JSADDTYPE); FieldDataType ff = null; if (IConsts.JSUNDEFINED.equals(type)) ff = FieldDataType.constructString(); else if (ICommonConsts.INTTYPE.equals(type)) ff = FieldDataType.constructInt(); else if (ICommonConsts.LONGTYPE.equals(type)) ff = FieldDataType.constructLong(); else if (ICommonConsts.BOOLTYPE.equals(type)) ff = FieldDataType.constructBoolean(); else if (ICommonConsts.DATETIMETYPE.equals(type)) ff = FieldDataType.constructDate(); else if (ICommonConsts.DATETYPE.equals(type)) ff = FieldDataType.constructDate(); else if (ICommonConsts.DECIMALTYPE.equals(type)) ff = FieldDataType.constructBigDecimal(); if (ff == null) { String mess = M.M().JavaScriptInvalideType(type, key + IUIConsts.JSADDTYPE); Utils.errAlert(mess); } IVField vv = VField.construct(key, ff.getType()); Object oVal = FUtils.getValue(vv, val); FieldValue fVal = new FieldValue(); fVal.setValue(ff.getType(), oVal, ff.getAfterdot()); v.setValue(key, fVal); } return v; }
From source file:com.kk_electronic.kkportal.core.util.JsMap.java
License:Open Source License
public final Set<String> keySet() { JsArrayString jsKeys = getKeys(); HashSet<String> javaKeys = new HashSet<String>(); for (int i = 0; i < jsKeys.length(); i++) { javaKeys.add(jsKeys.get(i)); }//from w w w .j a v a 2s . co m return javaKeys; }
From source file:com.parabay.client.gears.Utils.java
License:Apache License
/** * Converts a JavaScript array of strings to a Java array of strings. *//*w w w . j a v a 2s.com*/ public static String[] toJavaArray(JsArrayString jsArray) { String[] urls = new String[jsArray.length()]; for (int i = 0; i < jsArray.length(); i++) { urls[i] = jsArray.get(i); } return urls; }
From source file:com.risevision.ui.client.common.widgets.iframe.IFrameController.java
License:Open Source License
private static void onMessageStatic(String source, String command, JsArrayString rawValues) { IFramePanelWidget widget = widgets.get(source); if (widget != null) { List<String> values = new ArrayList<>(); if (rawValues != null) { for (int i = 0; i < rawValues.length(); i++) { values.add(rawValues.get(i)); }//from w w w . j av a2 s . co m } widget.onMessage(command, values); } }