/** * Prepares this statement with the given query. * * @param query SQL query * @return true on success or false on failure */ public override bool prepare(Env env, string query) { string queryStr = query.ToString(); _preparedMapping.clear(); // Map any unsorted or duplicated params. // Ex: INSERT INTO test VALUES($2, $1) or // INSERT INTO test VALUES($1, $1) Pattern pattern = Pattern.compile("\\$([0-9]+)"); Matcher matcher = pattern.matcher(queryStr); while (matcher.find()) { int phpParam; try { phpParam = Integer.parseInt(matcher.group(1)); } catch (Exception ex) { _preparedMapping.clear(); return(false); } _preparedMapping.add(LongValue.create(phpParam)); } // Make the PHP query a JDBC like query // replacing ($1 -> ?) with question marks. // XXX: replace this with Matcher.appendReplacement // above when StringBuilder @is supported. queryStr = queryStr.replaceAll("\\$[0-9]+", "?"); // Prepare the JDBC query return(super.prepare(env, queryStr)); }
/// <summary> /// 清除单元格 /// </summary> public void clearCells() { int cellSize = m_cells.size(); for (int i = 0; i < cellSize; i++) { m_cells.get(i).onRemove(); m_cells.get(i).delete(); } m_cells.clear(); }
/** * Opens the writer for a memory target */ public bool openMemory(Env env) { StringValue s = env.createUnicodeBuilder(); _s = new MemoryXMLWriterStream(s); _nsMap.clear(); _elementStack.clear(); _nsStack.clear(); _state = WriterState.TOP; return(true); }
public void testSuccessors() { ArrayList<String> locations = new ArrayList<String>(); // A locations.clear(); locations.add("B"); locations.add("C"); for (Action a : af.actions("A")) { Assert.assertTrue(locations.contains(((MoveToAction) a) .getToLocation())); Assert.assertTrue(locations.contains(rf.result("A", a))); } // B locations.clear(); locations.add("A"); locations.add("C"); locations.add("E"); for (Action a : af.actions("B")) { Assert.assertTrue(locations.contains(((MoveToAction) a) .getToLocation())); Assert.assertTrue(locations.contains(rf.result("B", a))); } // C locations.clear(); locations.add("A"); locations.add("B"); locations.add("D"); for (Action a : af.actions("C")) { Assert.assertTrue(locations.contains(((MoveToAction) a) .getToLocation())); Assert.assertTrue(locations.contains(rf.result("C", a))); } // D locations.clear(); locations.add("C"); for (Action a : af.actions("D")) { Assert.assertTrue(locations.contains(((MoveToAction) a) .getToLocation())); Assert.assertTrue(locations.contains(rf.result("D", a))); } // E locations.clear(); Assert.assertTrue(0 == af.actions("E").size()); }
/// <summary> /// 销毁资源 /// </summary> public override void delete() { if (!IsDeleted) { m_nodes.clear(); } base.delete(); }
/// <summary> /// 销毁方法 /// </summary> public virtual void delete() { if (!m_isDeleted) { if (m_event != null) { m_event.delete(); m_event = null; } if (m_script != null) { m_script.delete(); m_script = null; } m_controls.clear(); m_styles.clear(); m_isDeleted = true; } }
/// <summary> /// 销毁资源方法 /// </summary> public override void delete() { if (!IsDeleted) { m_columns.clear(); m_columnStyles.clear(); m_rows.clear(); m_rowStyles.clear(); m_tableControls.clear(); } base.delete(); }
/// <summary> /// 清除表格带 /// </summary> public void ClearBands() { int bandsSize = m_bands.size(); for (int i = 0; i < bandsSize; i++) { FCGridBand band = m_bands.get(i); m_grid.removeControl(band); band.delete(); } m_bands.clear(); }
//UPGRADE_TODO: Class 'java.io.DataInputStream' was converted to 'System.IO.BinaryReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioDataInputStream'" public virtual void readExternal(System.IO.BinaryReader in_Renamed, PrototypeFactory pf) { points.clear(); int len = (int)ExtUtil.readNumeric(in_Renamed); for (int i = 0; i < len; ++i) { GeoPointData t = new GeoPointData(); t.readExternal(in_Renamed, pf); points.add(t); } }
/// <summary> /// 清除列 /// </summary> public void clearColumns() { int columnsSize = m_columns.size(); for (int i = 0; i < columnsSize; i++) { FCBandedFCGridColumn column = m_columns.get(i); m_grid.removeColumn(column); column.delete(); } m_columns.clear(); }
/// <summary> /// 销毁资源 /// </summary> public void delete() { if (!m_isDeleted) { if (m_crossLineTip != null) { m_crossLineTip.delete(); m_crossLineTip = null; } m_scaleSteps.clear(); m_isDeleted = true; } }
public void testLocationsLinkedTo() { ArrayList<String> locations = new ArrayList<String>(); List<String> linkedTo; linkedTo = aMap.getLocationsLinkedTo("A"); locations.clear(); locations.add("B"); locations.add("C"); Assert.assertTrue(locations.containsAll(linkedTo) && linkedTo.size() == 2); linkedTo = aMap.getLocationsLinkedTo("B"); locations.clear(); locations.add("A"); locations.add("C"); locations.add("E"); Assert.assertTrue(locations.containsAll(linkedTo) && linkedTo.size() == 3); linkedTo = aMap.getLocationsLinkedTo("C"); locations.clear(); locations.add("A"); locations.add("B"); locations.add("D"); Assert.assertTrue(locations.containsAll(linkedTo) && linkedTo.size() == 3); linkedTo = aMap.getLocationsLinkedTo("D"); locations.clear(); locations.add("C"); Assert.assertTrue(locations.containsAll(linkedTo) && linkedTo.size() == 1); linkedTo = aMap.getLocationsLinkedTo("E"); Assert.assertTrue(linkedTo.size() == 0); }
public void renderTile(DrawContext dc, SurfaceTile tile) { if (tile == null) { String message = Logging.getMessage("nullValue.TileIsNull"); Logging.logger().severe(message); throw new IllegalStateException(message); } ArrayList <SurfaceTile> al = new ArrayList <SurfaceTile>(1); al.add(tile); this.renderTiles(dc, al); al.clear(); }
public void clear() { if (_qualifiedMap != null) { _qualifiedMap.clear(); } if (_wildcardList != null) { _wildcardList.clear(); } if (_wildcardPhpList != null) { _wildcardPhpList.clear(); } }
/// <summary> /// 清除所有的项 /// </summary> public void clearItems() { ArrayList <FCMenuItem> itemsCopy = new ArrayList <FCMenuItem>(); int itemSize = m_items.size(); for (int i = 0; i < itemSize; i++) { itemsCopy.add(m_items.get(i)); } int copySize = itemsCopy.size(); for (int i = 0; i < copySize; i++) { itemsCopy.get(i).onRemovingItem(); itemsCopy.get(i).delete(); } m_items.clear(); }
public bool begin_page(double width, double height) { if (PAGE_GROUP_SIZE <= _pageGroup.size()) { _out.writePageGroup(_pageParentId, _rootId, _pageGroup); _pageGroup.clear(); _pagesGroupList.add(_pageParentId); _pageParentId = _out.allocateId(1); } _page = new PDFPage(_out, _pageParentId, width, height); _stream = _page.getStream(); _pageCount++; _pageGroup.add(_page); return(true); }
/// <summary> /// 销毁方法 /// </summary> public virtual void delete() { m_monthButtons.clear(); m_monthButtons_am.clear(); }
public void run() { // output needs to be the size of the data, remove excess 00 00? //byte[] buffer = new byte[2000]; // create a large buffer, should be able to hold all traffic ArrayList <Byte> aBuffer = new ArrayList <Byte>(); ArrayList <Byte> aOutput = new ArrayList <Byte>(); // create a large buffer, should be able to hold all traffic // byte decompressBuffer[] = new byte[2000]; while (run) { System.Threading.Thread.Sleep(5); if (!client.isConnected()) { writeoutput("Disconnected"); packetOperator.processDisconnect(); } try { int size = myin.available(); if (size != 0) { byte[] incoming = new byte[myin.available()]; myin.read(incoming); for (int i = 0; i < incoming.length; i++) { aBuffer.add(incoming[i]); } // fills our vecotor with the packet } while (!aBuffer.isEmpty()) { if (bDecompress) { byte[] tempbuf = new byte[aBuffer.size()]; // create a buffer to hold list for (int x = 0; x < aBuffer.size(); x++) { tempbuf[x] = aBuffer.get(x); } // adds list to buffer if (aBuffer.size() > 1000) { int zx = 55 + 5; } huffmanobject myhuf = new huffmanobject(); myhuf.buffer = tempbuf; myhuf.src_size = tempbuf.length; myhuf.out_size = 0; myhuf = BinaryNode.drkDecompress(myhuf); byte[] temp = myhuf.output; if (temp.length < 1) { aBuffer.clear(); break; } // if we are getting garbage wipe the buffer. if (tempbuf.length > temp.length) { writeoutput("Packet: " + aBuffer.size() + "bytes consumed: " + myhuf.out_size); int intx = 1; for (int x = 0; x < temp.length; x++) { aOutput.add(temp[x]); } // outputs the packet for (int x = 0; x < myhuf.out_size + intx; x++) { aBuffer.remove(0); } // removes it from queue } else { for (int x = 0; x < temp.length; x++) { aOutput.add(temp[x]); } // outputs the packet if (aBuffer.isEmpty() == false) { aBuffer.clear(); } } } else { byte[] temp = new byte[aBuffer.size()]; // create a buffer to hold list for (int x = 0; x < aBuffer.size(); x++) { temp[x] = aBuffer.get(x); } // adds list to buffer if (aBuffer.isEmpty() == false) { aBuffer.clear(); } for (int x = 0; x < temp.length; x++) { aOutput.add(temp[x]); } } byte[] temp = new byte[aOutput.size()]; for (int x = 0; x < aOutput.size(); x++) { temp[x] = aOutput.get(x); } handlePacket(temp); aOutput.clear(); } } // end of newdata IF // end of try catch (SocketException e) { writeoutput("Socket Error: Most likely disconnect: " + e); try { client.close(); } catch (IOException e2) {} packetOperator.processDisconnect(); } catch (IOException e) { writeoutput("IOError: " + e); } catch (NegativeArraySizeException e) { } catch (Exception e) { writeoutput("Some other error in the thread: " + e); e.printStackTrace(); } } }
/// <summary> /// 清除控件 /// </summary> public override void clearControls() { m_tabPages.clear(); m_selectedIndex = -1; base.clearControls(); }
public int run(String[] arguments) { sourceFiles.clear(); if (!handleArguments(arguments)) { return(1); } var t0 = System.nanoTime(); try { var results = new Compiler().compileFromFiles(parameters, sourceFiles.toArray(new File[sourceFiles.size()])); var hasErrors = false; foreach (var error in results.Errors) { var filename = error.Filename; if (filename != null) { System.out.print(new File(error.Filename).getAbsolutePath()); } else { System.out.print("Unknown source"); } if (error.Line > 0) { System.out.print(" ("); System.out.print(error.Line); if (error.Column > 0) { System.out.print(", "); System.out.print(error.Column); } System.out.print(")"); } if (error.Level == 0) { hasErrors = true; System.out.print(" error "); } else { System.out.print(" warning "); } System.out.print(error.Id); System.out.print(": "); System.out.println(error.Message); } if (!hasErrors) { var outputFile = new File(outputPath); if (outputFile.isDirectory() || outputPath.endsWith("\\") || outputPath.endsWith("/")) { foreach (var e in results.ClassFiles.entrySet()) { var file = new File(outputFile, e.Key.replace('.', '/') + ".class"); var dir = file.getParentFile(); if (!dir.exists()) { dir.mkdirs(); } using (var s = new FileOutputStream(file)) { s.write(e.Value); } } } else { var destination = outputPath; if (PathHelper.getExtension(destination).length() == 0) { destination += ".jar"; } using (var zipStream = new ZipOutputStream(new FileOutputStream(destination))) { if (manifestPath != null) { var zipEntry = new ZipEntry("META-INF/MANIFEST.MF"); zipStream.putNextEntry(zipEntry); var buffer = new byte[4096]; var inputStream = new FileInputStream(manifestPath); int read; while ((read = inputStream.read(buffer)) != -1) { zipStream.write(buffer, 0, read); } inputStream.close(); } if (resourcesPath != null) { var rootDir = new File(resourcesPath); foreach (var content in rootDir.list()) { var file = new File(rootDir, content); if (file.isDirectory()) { exploreDirectory(zipStream, "", file); } else { addEntry(zipStream, "", file); } } } foreach (var e in results.ClassFiles.entrySet()) { var zipEntry = new ZipEntry(e.Key.replace('.', '/') + ".class"); zipStream.putNextEntry(zipEntry); zipStream.write(e.Value); } } } System.out.println(); System.out.println(String.format("%d class(es) successfully generated in %.2fs", results.classFiles.size(), (System.nanoTime() - t0) / 1e9)); return(0); } else { System.out.println(); System.out.println("Compilation failed"); return(1); } } catch (TypeLoadException e) { System.out.println("Cannot find type " + e.TypeName + ". The class is missing from the classpath."); System.out.println("Compilation failed"); return(1); } }
/// <summary> /// 销毁资源 /// </summary> public void delete() { if (!m_isDeleted) { try { if (m_shapes != null) { foreach (BaseShape shape in m_shapes) { shape.delete(); } m_shapes.clear(); } if (m_plots != null) { foreach (FCPlot plot in m_plots) { plot.delete(); } m_plots.clear(); } if (m_leftVScale != null) { m_leftVScale.delete(); } if (m_rightVScale != null) { m_rightVScale.delete(); } if (m_hScale != null) { m_hScale.delete(); } if (m_hGrid != null) { m_hGrid.delete(); } if (m_vGrid != null) { m_vGrid.delete(); } if (m_crossLine != null) { m_crossLine.delete(); } if (m_titleBar != null) { m_titleBar.delete(); } if (m_selectArea != null) { m_selectArea.delete(); } if (m_toolTip != null) { m_toolTip.delete(); } } finally { m_isDeleted = true; } } }
/** * 输出日志 */ public override void log(int logType, String message) { if (checkOut(logType)) { String type = null; if (logType == 1) { type = "Debug"; } else if (logType == 2) { type = "Info"; } else if (logType == 3) { type = "Warn"; } else if (logType == 4) { type = "Error"; } else if (logType == 5) { type = "Fatal"; } //yyyyMMdd String dateTime = getNowDate(m_fileAppenderConfig.m_datePattern); message = String.Format("{0} {1} {2}\r\n", dateTime, type, message); String logFile = m_fileAppenderConfig.m_logFile; if (logFile.Length == 0) { return; } String separator = LogService.FILESEPARATOR; String date = getNowDate("yyyyMMdd"); int np = logFile.LastIndexOf(date); if (np < 0) { String logDir = LogService.getAppPath() + "\\log\\" + date; FCFile.createDirectory(logDir); int pos = logFile.LastIndexOf(separator); String logFileName = logFile.Substring(pos, logFile.Length - pos + 1); String newLogFile = logDir + separator + logFileName; m_fileAppenderConfig.m_logFile = newLogFile; logFile = newLogFile; } if (FCFile.isFileExist(logFile)) { FileInfo file = new FileInfo(logFile); long len = file.Length; if (len >= m_maxFileSize) { String logDir = LogService.getAppPath() + "\\log\\" + date; ArrayList <String> files = new ArrayList <String>(); FCFile.getFiles(logDir, files); int count = files.size(); files.clear(); int pos = logFile.LastIndexOf(separator); int pos2 = logFile.LastIndexOf("."); String logFileName = logFile.Substring(pos, pos2 - 1 - pos + 1); String newFileName = String.Format("{0}\\{1}.{2}.log", logDir, logFileName, count); FileInfo oldFile = new FileInfo(logFile); FileInfo newFile = new FileInfo(newFileName); oldFile.MoveTo(newFile.FullName); } } FCFile.append(logFile, message); } }