rem stringlengths 1 226k | add stringlengths 0 227k | context stringlengths 6 326k | meta stringlengths 143 403 | input_ids listlengths 256 256 | attention_mask listlengths 256 256 | labels listlengths 128 128 |
|---|---|---|---|---|---|---|
photoInterp = "CMYK"; break; | photoInterp = "CMYK"; MetaDataPhotoInterp = "CMYK"; break; | protected void initStandardMetadata() { Hashtable ifd = ifds[0]; if (metadata == null) metadata = new Hashtable(); put("ImageWidth", ifd, TiffTools.IMAGE_WIDTH); put("ImageLength", ifd, TiffTools.IMAGE_LENGTH); put("BitsPerSample", ifd, TiffTools.BITS_PER_SAMPLE); int comp = TiffTools.getIFDIntValue(ifd, TiffTools.COMPRESSION); String compression = null; switch (comp) { case TiffTools.UNCOMPRESSED: compression = "None"; break; case TiffTools.CCITT_1D: compression = "CCITT Group 3 1-Dimensional Modified Huffman"; break; case TiffTools.GROUP_3_FAX: compression = "CCITT T.4 bilevel encoding"; break; case TiffTools.GROUP_4_FAX: compression = "CCITT T.6 bilevel encoding"; break; case TiffTools.LZW: compression = "LZW"; break; case TiffTools.JPEG: compression = "JPEG"; break; case TiffTools.PACK_BITS: compression = "PackBits"; break; } put("Compression", compression); int photo = TiffTools.getIFDIntValue(ifd, TiffTools.PHOTOMETRIC_INTERPRETATION); String photoInterp = null; switch (photo) { case TiffTools.WHITE_IS_ZERO: photoInterp = "WhiteIsZero"; break; case TiffTools.BLACK_IS_ZERO: photoInterp = "BlackIsZero"; break; case TiffTools.RGB: photoInterp = "RGB"; break; case TiffTools.RGB_PALETTE: photoInterp = "Palette"; break; case TiffTools.TRANSPARENCY_MASK: photoInterp = "Transparency Mask"; break; case TiffTools.CMYK: photoInterp = "CMYK"; break; case TiffTools.Y_CB_CR: photoInterp = "YCbCr"; break; case TiffTools.CIE_LAB: photoInterp = "CIELAB"; break; } put("PhotometricInterpretation", photoInterp); putInt("CellWidth", ifd, TiffTools.CELL_WIDTH); putInt("CellLength", ifd, TiffTools.CELL_LENGTH); int or = TiffTools.getIFDIntValue(ifd, TiffTools.ORIENTATION); String orientation = null; // there is no case 0 switch (or) { case 1: orientation = "1st row -> top; 1st column -> left"; break; case 2: orientation = "1st row -> top; 1st column -> right"; break; case 3: orientation = "1st row -> bottom; 1st column -> right"; break; case 4: orientation = "1st row -> bottom; 1st column -> left"; break; case 5: orientation = "1st row -> left; 1st column -> top"; break; case 6: orientation = "1st row -> right; 1st column -> top"; break; case 7: orientation = "1st row -> right; 1st column -> bottom"; break; case 8: orientation = "1st row -> left; 1st column -> bottom"; break; } put("Orientation", orientation); putInt("SamplesPerPixel", ifd, TiffTools.SAMPLES_PER_PIXEL); put("Software", ifd, TiffTools.SOFTWARE); put("DateTime", ifd, TiffTools.DATE_TIME); put("Artist", ifd, TiffTools.ARTIST); put("HostComputer", ifd, TiffTools.HOST_COMPUTER); put("Copyright", ifd, TiffTools.COPYRIGHT); put("NewSubfileType", ifd, TiffTools.NEW_SUBFILE_TYPE); int thresh = TiffTools.getIFDIntValue(ifd, TiffTools.THRESHHOLDING); String threshholding = null; switch (thresh) { case 1: threshholding = "No dithering or halftoning"; break; case 2: threshholding = "Ordered dithering or halftoning"; break; case 3: threshholding = "Randomized error diffusion"; break; } put("Threshholding", threshholding); int fill = TiffTools.getIFDIntValue(ifd, TiffTools.FILL_ORDER); String fillOrder = null; switch (fill) { case 1: fillOrder = "Pixels with lower column values are stored " + "in the higher order bits of a byte"; break; case 2: fillOrder = "Pixels with lower column values are stored " + "in the lower order bits of a byte"; break; } put("FillOrder", fillOrder); putInt("Make", ifd, TiffTools.MAKE); putInt("Model", ifd, TiffTools.MODEL); putInt("MinSampleValue", ifd, TiffTools.MIN_SAMPLE_VALUE); putInt("MaxSampleValue", ifd, TiffTools.MAX_SAMPLE_VALUE); putInt("XResolution", ifd, TiffTools.X_RESOLUTION); putInt("YResolution", ifd, TiffTools.Y_RESOLUTION); int planar = TiffTools.getIFDIntValue(ifd, TiffTools.PLANAR_CONFIGURATION); String planarConfig = null; switch (planar) { case 1: planarConfig = "Chunky"; break; case 2: planarConfig = "Planar"; break; } put("PlanarConfiguration", planarConfig); putInt("XPosition", ifd, TiffTools.X_POSITION); putInt("YPosition", ifd, TiffTools.Y_POSITION); putInt("FreeOffsets", ifd, TiffTools.FREE_OFFSETS); putInt("FreeByteCounts", ifd, TiffTools.FREE_BYTE_COUNTS); putInt("GrayResponseUnit", ifd, TiffTools.GRAY_RESPONSE_UNIT); putInt("GrayResponseCurve", ifd, TiffTools.GRAY_RESPONSE_CURVE); putInt("T4Options", ifd, TiffTools.T4_OPTIONS); putInt("T6Options", ifd, TiffTools.T6_OPTIONS); int res = TiffTools.getIFDIntValue(ifd, TiffTools.RESOLUTION_UNIT); String resUnit = null; switch (res) { case 1: resUnit = "None"; break; case 2: resUnit = "Inch"; break; case 3: resUnit = "Centimeter"; break; } put("ResolutionUnit", resUnit); putInt("PageNumber", ifd, TiffTools.PAGE_NUMBER); putInt("TransferFunction", ifd, TiffTools.TRANSFER_FUNCTION); int predict = TiffTools.getIFDIntValue(ifd, TiffTools.PREDICTOR); String predictor = null; switch (predict) { case 1: predictor = "No prediction scheme"; break; case 2: predictor = "Horizontal differencing"; break; } put("Predictor", predictor); putInt("WhitePoint", ifd, TiffTools.WHITE_POINT); putInt("PrimaryChromacities", ifd, TiffTools.PRIMARY_CHROMATICITIES); putInt("HalftoneHints", ifd, TiffTools.HALFTONE_HINTS); putInt("TileWidth", ifd, TiffTools.TILE_WIDTH); putInt("TileLength", ifd, TiffTools.TILE_LENGTH); putInt("TileOffsets", ifd, TiffTools.TILE_OFFSETS); putInt("TileByteCounts", ifd, TiffTools.TILE_BYTE_COUNTS); int ink = TiffTools.getIFDIntValue(ifd, TiffTools.INK_SET); String inkSet = null; switch (ink) { case 1: inkSet = "CMYK"; break; case 2: inkSet = "Other"; break; } put("InkSet", inkSet); putInt("InkNames", ifd, TiffTools.INK_NAMES); putInt("NumberOfInks", ifd, TiffTools.NUMBER_OF_INKS); putInt("DotRange", ifd, TiffTools.DOT_RANGE); put("TargetPrinter", ifd, TiffTools.TARGET_PRINTER); putInt("ExtraSamples", ifd, TiffTools.EXTRA_SAMPLES); int fmt = TiffTools.getIFDIntValue(ifd, TiffTools.SAMPLE_FORMAT); String sampleFormat = null; switch (fmt) { case 1: sampleFormat = "unsigned integer"; break; case 2: sampleFormat = "two's complement signed integer"; break; case 3: sampleFormat = "IEEE floating point"; break; case 4: sampleFormat = "undefined"; break; } put("SampleFormat", sampleFormat); putInt("SMinSampleValue", ifd, TiffTools.S_MIN_SAMPLE_VALUE); putInt("SMaxSampleValue", ifd, TiffTools.S_MAX_SAMPLE_VALUE); putInt("TransferRange", ifd, TiffTools.TRANSFER_RANGE); int jpeg = TiffTools.getIFDIntValue(ifd, TiffTools.JPEG_PROC); String jpegProc = null; switch (jpeg) { case 1: jpegProc = "baseline sequential process"; break; case 14: jpegProc = "lossless process with Huffman coding"; break; } put("JPEGProc", jpegProc); putInt("JPEGInterchangeFormat", ifd, TiffTools.JPEG_INTERCHANGE_FORMAT); putInt("JPEGRestartInterval", ifd, TiffTools.JPEG_RESTART_INTERVAL); putInt("JPEGLosslessPredictors", ifd, TiffTools.JPEG_LOSSLESS_PREDICTORS); putInt("JPEGPointTransforms", ifd, TiffTools.JPEG_POINT_TRANSFORMS); putInt("JPEGQTables", ifd, TiffTools.JPEG_Q_TABLES); putInt("JPEGDCTables", ifd, TiffTools.JPEG_DC_TABLES); putInt("JPEGACTables", ifd, TiffTools.JPEG_AC_TABLES); putInt("YCbCrCoefficients", ifd, TiffTools.Y_CB_CR_COEFFICIENTS); int ycbcr = TiffTools.getIFDIntValue(ifd, TiffTools.Y_CB_CR_SUB_SAMPLING); String subSampling = null; switch (ycbcr) { case 1: subSampling = "chroma image dimensions = luma image dimensions"; break; case 2: subSampling = "chroma image dimensions are " + "half the luma image dimensions"; break; case 4: subSampling = "chroma image dimensions are " + "1/4 the luma image dimensions"; break; } put("YCbCrSubSampling", subSampling); putInt("YCbCrPositioning", ifd, TiffTools.Y_CB_CR_POSITIONING); putInt("ReferenceBlackWhite", ifd, TiffTools.REFERENCE_BLACK_WHITE); // bits per sample and number of channels Object bpsObj = TiffTools.getIFDValue(ifd, TiffTools.BITS_PER_SAMPLE); int bps = -1, numC = 3; if (bpsObj instanceof int[]) { int[] q = (int[]) bpsObj; bps = q[0]; numC = q.length; } else if (bpsObj instanceof Number) { bps = ((Number) bpsObj).intValue(); numC = 1; } // numC isn't set properly if we have an indexed color image, so we need // to reset it here int p = TiffTools.getIFDIntValue(ifd, TiffTools.PHOTOMETRIC_INTERPRETATION); if (p == TiffTools.RGB_PALETTE) { numC = 3; bps *= 3; } put("BitsPerSample", bps); put("NumberOfChannels", numC); // TIFF comment String comment = null; Object o = TiffTools.getIFDValue(ifd, TiffTools.IMAGE_DESCRIPTION); if (o instanceof String) comment = (String) o; else if (o instanceof String[]) { String[] s = (String[]) o; if (s.length > 0) comment = s[0]; } else if (o != null) comment = o.toString(); if (comment != null) { // sanitize comment comment = comment.replaceAll("\r\n", "\n"); // CR-LF to LF comment = comment.replaceAll("\r", "\n"); // CR to LF put("Comment", comment); } } | 49800 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/49800/7751987bd5872c08d06ca82553bf097f32fd0f51/BaseTiffReader.java/clean/loci/formats/in/BaseTiffReader.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
4750,
918,
1208,
8336,
2277,
1435,
288,
565,
18559,
309,
72,
273,
309,
2377,
63,
20,
15533,
565,
309,
261,
4165,
422,
446,
13,
1982,
273,
394,
18559,
5621,
565,
1378,
2932,
2040,
2384,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
4750,
918,
1208,
8336,
2277,
1435,
288,
565,
18559,
309,
72,
273,
309,
2377,
63,
20,
15533,
565,
309,
261,
4165,
422,
446,
13,
1982,
273,
394,
18559,
5621,
565,
1378,
2932,
2040,
2384,
... |
if (msgs != null) msgs.dispatch(); | if (msgs != null) msgs.dispatch(); | public void setFont(FontDefinition newFont) { if (newFont != font) { NotificationChain msgs = null; if (font != null) msgs = ((InternalEObject)font).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AttributePackage.TEXT__FONT, null, msgs); if (newFont != null) msgs = ((InternalEObject)newFont).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AttributePackage.TEXT__FONT, null, msgs); msgs = basicSetFont(newFont, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AttributePackage.TEXT__FONT, newFont, newFont)); } | 46013 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46013/e5c78f0e8317166d02fa384e14c3dd7aa1796f2c/TextImpl.java/buggy/chart/org.eclipse.birt.chart.engine/src/org/eclipse/birt/chart/model/attribute/impl/TextImpl.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
20454,
12,
5711,
1852,
394,
5711,
13,
565,
288,
3639,
309,
261,
2704,
5711,
480,
3512,
13,
3639,
288,
5411,
27050,
8733,
273,
446,
31,
5411,
309,
261,
5776,
480,
446,
13,
773... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
20454,
12,
5711,
1852,
394,
5711,
13,
565,
288,
3639,
309,
261,
2704,
5711,
480,
3512,
13,
3639,
288,
5411,
27050,
8733,
273,
446,
31,
5411,
309,
261,
5776,
480,
446,
13,
773... |
if (!map.containsKey(id) && !deselectedPlugins.contains(id)) { | if (id != null && !map.containsKey(id) && !deselectedPlugins.contains(id)) { | public static Map retrieveWorkspaceMap(ILaunchConfiguration configuration) throws CoreException { Map map = retrieveMap(configuration, IPDELauncherConstants.WORKSPACE_BUNDLES); if (configuration.getAttribute(IPDELauncherConstants.AUTOMATIC_ADD, true)) { TreeSet deselectedPlugins = LaunchPluginValidator.parsePlugins(configuration, IPDELauncherConstants.DESELECTED_WORKSPACE_PLUGINS); IPluginModelBase[] models = PDECore.getDefault().getModelManager().getWorkspaceModels(); for (int i = 0; i < models.length; i++) { String id = models[i].getPluginBase().getId(); if (!map.containsKey(id) && !deselectedPlugins.contains(id)) { map.put(id, "default:default"); //$NON-NLS-1$ } } } return map; } | 8783 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/8783/201598085c948dcdd90332e8ade145eebdc286ce/EquinoxPluginBlock.java/clean/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/EquinoxPluginBlock.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
760,
1635,
4614,
8241,
863,
12,
2627,
4760,
1750,
1664,
13,
1216,
30015,
288,
202,
202,
863,
852,
273,
4614,
863,
12,
7025,
16,
2971,
1639,
28820,
2918,
18,
10566,
6616,
67,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
760,
1635,
4614,
8241,
863,
12,
2627,
4760,
1750,
1664,
13,
1216,
30015,
288,
202,
202,
863,
852,
273,
4614,
863,
12,
7025,
16,
2971,
1639,
28820,
2918,
18,
10566,
6616,
67,
3... |
protected final void end(boolean success) throws AsynchronousCloseException { // FIXME: be accomodate before VM actually provides // setInterruptAction method if (setInterruptAction != null) { try { setInterruptAction.invoke(Thread.currentThread(), new Object[] { null }); } catch (Exception e) { throw new RuntimeException(e); } if (interrupted) { interrupted = false; throw new ClosedByInterruptException(); } } if (!success && closed) { throw new AsynchronousCloseException(); } } | 54769 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54769/e4e54873eeaa05d1cfcb9305418b06db3b95f585/AbstractInterruptibleChannel.java/buggy/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
727,
918,
679,
12,
6494,
2216,
13,
1216,
2970,
7121,
4605,
503,
288,
202,
202,
759,
9852,
30,
506,
28217,
31756,
1865,
8251,
6013,
8121,
202,
202,
759,
444,
14126,
1803,
707,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
727,
918,
679,
12,
6494,
2216,
13,
1216,
2970,
7121,
4605,
503,
288,
202,
202,
759,
9852,
30,
506,
28217,
31756,
1865,
8251,
6013,
8121,
202,
202,
759,
444,
14126,
1803,
707,
... | ||
assertEquals(3, stmt.executeUpdate("DELETE FROM " + TSWTZ_TABLE)); | assertEquals(4, stmt.executeUpdate("DELETE FROM " + TSWTZ_TABLE)); | public void testSetTimestampWTZ() { try { Statement stmt = con.createStatement(); PreparedStatement pstmt = con.prepareStatement(TestUtil.insertSQL(TSWTZ_TABLE, "?")); pstmt.setTimestamp(1, TS1WTZ); assertEquals(1, pstmt.executeUpdate()); pstmt.setTimestamp(1, TS2WTZ); assertEquals(1, pstmt.executeUpdate()); pstmt.setTimestamp(1, TS3WTZ); assertEquals(1, pstmt.executeUpdate()); // Fall through helper timestampTestWTZ(); assertEquals(3, stmt.executeUpdate("DELETE FROM " + TSWTZ_TABLE)); pstmt.close(); stmt.close(); } catch (Exception ex) { fail(ex.getMessage()); } } | 52628 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52628/feefc329bd64ee552d12c8e40bed76e3573c3fa4/TimestampTest.java/buggy/src/interfaces/jdbc/org/postgresql/test/jdbc2/TimestampTest.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1842,
694,
4921,
8588,
62,
1435,
202,
95,
202,
202,
698,
202,
202,
95,
1082,
202,
3406,
3480,
273,
356,
18,
2640,
3406,
5621,
1082,
202,
29325,
293,
10589,
273,
356,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1842,
694,
4921,
8588,
62,
1435,
202,
95,
202,
202,
698,
202,
202,
95,
1082,
202,
3406,
3480,
273,
356,
18,
2640,
3406,
5621,
1082,
202,
29325,
293,
10589,
273,
356,
18,
... |
return new BookmarkableListenerInterfaceRequestTarget(requestParameters.getPageMapName(), pageClass, params, requestParameters.getComponentPath(), requestParameters.getInterfaceName()); } | return new BookmarkableListenerInterfaceRequestTarget(requestParameters .getPageMapName(), pageClass, params, requestParameters.getComponentPath(), requestParameters.getInterfaceName()); } | protected IRequestTarget resolveBookmarkablePage(final RequestCycle requestCycle, final RequestParameters requestParameters) { String bookmarkablePageClass = requestParameters.getBookmarkablePageClass(); Session session = requestCycle.getSession(); Class<? extends Page> pageClass; try { pageClass = session.getClassResolver().resolveClass(bookmarkablePageClass); } catch (RuntimeException e) { return new WebErrorCodeResponseTarget(HttpServletResponse.SC_NOT_FOUND, "Unable to load Bookmarkable Page"); } try { PageParameters params = new PageParameters(requestParameters.getParameters()); if (requestParameters.getComponentPath() != null && requestParameters.getInterfaceName() != null) { return new BookmarkableListenerInterfaceRequestTarget(requestParameters.getPageMapName(), pageClass, params, requestParameters.getComponentPath(), requestParameters.getInterfaceName()); } else if (requestParameters.getBookmarkableFormName() != null) { return new BookmarkableFormPageRequestTarget(requestParameters.getPageMapName(), pageClass, params, requestParameters.getBookmarkableFormName()); } else { return new BookmarkablePageRequestTarget(requestParameters.getPageMapName(), pageClass, params); } } catch (RuntimeException e) { throw new WicketRuntimeException("Unable to instantiate Page class: " + bookmarkablePageClass + ". See below for details.", e); } } | 46434 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46434/7586285941bbc1589400e1b0cdff5122172ce04f/DefaultRequestTargetResolverStrategy.java/buggy/wicket/src/java/wicket/request/compound/DefaultRequestTargetResolverStrategy.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
467,
691,
2326,
2245,
22966,
429,
1964,
12,
6385,
1567,
13279,
590,
13279,
16,
1082,
202,
6385,
1567,
2402,
590,
2402,
13,
202,
95,
202,
202,
780,
13696,
429,
1964,
797,
273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
467,
691,
2326,
2245,
22966,
429,
1964,
12,
6385,
1567,
13279,
590,
13279,
16,
1082,
202,
6385,
1567,
2402,
590,
2402,
13,
202,
95,
202,
202,
780,
13696,
429,
1964,
797,
273,
... |
Default.setUCD(); | static public void special() { Default.setUCD(); for (int i = 0xE000; i < 0x10000; ++i) { if (!Default.ucd.isRepresented(i)) continue; if (!Default.nfkc.isNormalized(i)) continue; System.out.println(Default.ucd.getCodeAndName(i)); } } | 5620 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5620/d1ef79fafdbbeaaf4dcbaa9d3c534754c217d955/WriteCharts.java/buggy/tools/unicodetools/com/ibm/text/UCA/WriteCharts.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
760,
1071,
918,
4582,
1435,
288,
377,
202,
377,
202,
1884,
261,
474,
277,
273,
374,
17432,
3784,
31,
277,
411,
374,
92,
23899,
31,
965,
77,
13,
288,
377,
202,
202,
430,
16051,
1868,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
760,
1071,
918,
4582,
1435,
288,
377,
202,
377,
202,
1884,
261,
474,
277,
273,
374,
17432,
3784,
31,
277,
411,
374,
92,
23899,
31,
965,
77,
13,
288,
377,
202,
202,
430,
16051,
1868,
1... | |
if (packet != null) { checkFilters(packet); | if(packet != null) { Peer peer = new Peer(packet.getAddress(), packet.getPort()); if(lowLevelFilter != null) lowLevelFilter.process(packet.getData(), packet.getOffset(), packet.getLength(), peer); else { Message m = null; try { m = Message.decodeFromPacket(packet.getData(), packet.getOffset(), packet.getLength(), peer); } catch (Throwable t) { Logger.error(this, "Could not decode packet: "+t, t); } if(m != null) checkFilters(m); } | public void run() { // Listen for packets while (_active) { DatagramPacket packet = getPacket(); // Check for timedout _filters removeTimedOutFilters(); // Check for matched _filters if (packet != null) { checkFilters(packet); } } synchronized (this) { _isDone = true; notifyAll(); } } | 48807 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/48807/03d1c3dfc05a19bebb9ca5ebd9b78a6299dcf977/UdpSocketManager.java/clean/src/freenet/io/comm/UdpSocketManager.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1086,
1435,
288,
368,
13426,
364,
12640,
202,
202,
17523,
261,
67,
3535,
13,
288,
1082,
202,
5139,
17049,
6667,
4414,
273,
30401,
278,
5621,
1082,
202,
759,
2073,
364,
7491... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1086,
1435,
288,
368,
13426,
364,
12640,
202,
202,
17523,
261,
67,
3535,
13,
288,
1082,
202,
5139,
17049,
6667,
4414,
273,
30401,
278,
5621,
1082,
202,
759,
2073,
364,
7491... |
.exec("" +protocol.getSelectedItem() + " " + listVMs.getSelectedItem() + | .exec("" + protocol.getSelectedItem() + " " + listVMs.getSelectedItem() + | public void actionPerformed(ActionEvent evt) { try { Runtime.getRuntime() .exec("" +protocol.getSelectedItem() + " " + listVMs.getSelectedItem() + " killall -KILL java"); } catch (IOException e1) { e1.printStackTrace(); } } | 23362 /local/tlutelli/issta_data/temp/all_java2context/java/2006_temp/2006/23362/13db258427009d16eac91cf1a5d4eccc3c0f5f8e/NBody3DFrame.java/buggy/src/org/objectweb/proactive/examples/nbody/common/NBody3DFrame.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
5397,
1071,
918,
26100,
12,
1803,
1133,
6324,
13,
288,
13491,
775,
288,
18701,
2509,
18,
588,
5576,
1435,
4766,
282,
263,
4177,
2932,
6,
397,
8373,
18,
588,
7416,
1180,
1435,
397,
27573,
315,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
5397,
1071,
918,
26100,
12,
1803,
1133,
6324,
13,
288,
13491,
775,
288,
18701,
2509,
18,
588,
5576,
1435,
4766,
282,
263,
4177,
2932,
6,
397,
8373,
18,
588,
7416,
1180,
1435,
397,
27573,
315,
... |
super(runtime, runtime.getClasses().getUnboundMethodClass()); | super(runtime, runtime.getClass("UnboundMethod")); | protected RubyUnboundMethod(Ruby runtime) { super(runtime, runtime.getClasses().getUnboundMethodClass()); } | 50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/ca6b16e996ea9af83ce593594b9c69b9364a9924/RubyUnboundMethod.java/buggy/src/org/jruby/RubyUnboundMethod.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
4750,
19817,
984,
3653,
1305,
12,
54,
10340,
3099,
13,
288,
3639,
2240,
12,
9448,
16,
3099,
18,
588,
797,
2932,
984,
3653,
1305,
7923,
1769,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
4750,
19817,
984,
3653,
1305,
12,
54,
10340,
3099,
13,
288,
3639,
2240,
12,
9448,
16,
3099,
18,
588,
797,
2932,
984,
3653,
1305,
7923,
1769,
565,
289,
2,
-100,
-100,
-100,
-100,
-100,
-... |
DebugLog.log("openConnection(): " + (System.currentTimeMillis() - start)); start = System.currentTimeMillis(); | public long getDir(String path, long revision, Map properties, ISVNDirEntryHandler handler) throws SVNException { Long rev = getRevisionObject(revision); // convert path to path relative to repos root. try { long start = System.currentTimeMillis(); openConnection(); DebugLog.log("openConnection(): " + (System.currentTimeMillis() - start)); start = System.currentTimeMillis(); path = getRepositoryPath(path); Object[] buffer = new Object[] { "get-dir", path, rev, Boolean.valueOf(properties != null), Boolean.valueOf(handler != null) }; write("(w(s(n)ww))", buffer); authenticate(); buffer[1] = properties; buffer = read("[(N(*P)", buffer); revision = buffer[0] != null ? SVNReader.getLong(buffer, 0) : revision; if (handler != null) { buffer[0] = handler; read("(*D)))", buffer); } DebugLog.log("getDir() finished: " + (System.currentTimeMillis() - start)); } finally { long start = System.currentTimeMillis(); closeConnection(); DebugLog.log("closeConnection(): " + (System.currentTimeMillis() - start)); } return revision; } | 5695 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5695/1614e8ab0d714337c14065c06d2c673d20988fcd/SVNRepositoryImpl.java/clean/javasvn/src/org/tmatesoft/svn/core/internal/io/svn/SVNRepositoryImpl.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
1525,
26505,
12,
780,
589,
16,
1525,
6350,
16,
1635,
1790,
16,
4437,
58,
50,
1621,
1622,
1503,
1838,
13,
1216,
29537,
50,
503,
288,
3639,
3407,
5588,
273,
26911,
921,
12,
13057,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
1525,
26505,
12,
780,
589,
16,
1525,
6350,
16,
1635,
1790,
16,
4437,
58,
50,
1621,
1622,
1503,
1838,
13,
1216,
29537,
50,
503,
288,
3639,
3407,
5588,
273,
26911,
921,
12,
13057,
1... | |
return 0; | dot = textComp.getCaretPosition(); return dot; | public int getCaretPosition() { return 0; // TODO } | 1056 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1056/e661cf1a3762c80fbf5e790baa87062e03571f13/JTextComponent.java/buggy/core/src/classpath/javax/javax/swing/text/JTextComponent.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
509,
1927,
20731,
2555,
1435,
565,
288,
1377,
3928,
273,
977,
2945,
18,
588,
39,
20731,
2555,
5621,
327,
3928,
31,
368,
2660,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
509,
1927,
20731,
2555,
1435,
565,
288,
1377,
3928,
273,
977,
2945,
18,
588,
39,
20731,
2555,
5621,
327,
3928,
31,
368,
2660,
565,
289,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
CoolBarManager mgr = window.getCoolBarManager(); | ICoolBarManager mgr = window.getCoolBarManager2(); | public void resetPerspective() { // Run op in busy cursor. // Use set redraw to eliminate the "flash" that can occur in the // coolbar as the perspective is reset. CoolBarManager mgr = window.getCoolBarManager(); try { mgr.getControl().setRedraw(false); BusyIndicator.showWhile(null, new Runnable() { public void run() { busyResetPerspective(); } }); } finally { mgr.getControl().setRedraw(true); } } | 58148 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58148/54532dbf350a8597a32c3325d699ca741a40ef83/WorkbenchPage.java/buggy/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
2715,
14781,
16772,
1435,
288,
3639,
368,
1939,
1061,
316,
21697,
3347,
18,
3639,
368,
2672,
444,
16540,
358,
29529,
326,
315,
13440,
6,
716,
848,
3334,
316,
326,
3639,
368,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
2715,
14781,
16772,
1435,
288,
3639,
368,
1939,
1061,
316,
21697,
3347,
18,
3639,
368,
2672,
444,
16540,
358,
29529,
326,
315,
13440,
6,
716,
848,
3334,
316,
326,
3639,
368,
27... |
if (actionErrors.size() > 0) { | if (seenProblem) { | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); ServletContext servletContext = session.getServletContext(); Profile profile = (Profile) session.getAttribute(Constants.PROFILE); ObjectStore os = (ObjectStore) servletContext.getAttribute(Constants.OBJECTSTORE); PathQuery query = (PathQuery) session.getAttribute(Constants.QUERY); ActionErrors actionErrors = new ActionErrors(); // Check whether query has at least one constraint and at least one output if (query.getView().size() == 0) { actionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.createtemplate.nooutputs")); saveErrors(request, actionErrors); } Iterator iter = query.getNodes().values().iterator(); boolean foundConstraint = false; while (iter.hasNext()) { PathNode node = (PathNode) iter.next(); if (node.isAttribute()) { if (node.getConstraints().size() > 0) { foundConstraint = true; break; } } } if (!foundConstraint) { actionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.createtemplate.noconstraints")); saveErrors(request, actionErrors); } // Ensure that we can actually execute the query try { if (query.getInfo() == null) { query.setInfo(os.estimate(MainHelper.makeQuery(query, profile.getSavedBags()))); } } catch (ObjectStoreException e) { actionErrors.add(ActionErrors.GLOBAL_ERROR, new ActionError("errors.query.objectstoreerror")); saveErrors(request, actionErrors); } if (actionErrors.size() > 0) { return mapping.findForward("query"); } PathQuery queryClone = (PathQuery) query.clone(); session.setAttribute(Constants.TEMPLATE_PATHQUERY, queryClone); return mapping.findForward("templateBuilder"); } | 7196 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/7196/51d6c55876b2dab867b26e35de85c0ba981a5ca6/CreateTemplateAction.java/clean/intermine/src/java/org/intermine/web/CreateTemplateAction.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
4382,
8514,
1836,
12,
1803,
3233,
2874,
16,
4766,
4382,
1204,
646,
16,
4766,
9984,
590,
16,
4766,
12446,
766,
13,
3639,
1216,
1185,
288,
3639,
26166,
1339,
273,
590,
18,
588,
2157,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
4382,
8514,
1836,
12,
1803,
3233,
2874,
16,
4766,
4382,
1204,
646,
16,
4766,
9984,
590,
16,
4766,
12446,
766,
13,
3639,
1216,
1185,
288,
3639,
26166,
1339,
273,
590,
18,
588,
2157,
... |
public void chmod( Resource res, String mode ) throws XMLDBException { String path = ( (CollectionImpl) res.getParentCollection() ).getPath() + '/' + res.getId(); try { Vector params = new Vector(); params.addElement( path ); params.addElement( mode ); parent.getClient().execute( "setPermissions", params ); } catch ( XmlRpcException e ) { throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage() ); } catch ( IOException e ) { throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage() ); } } | public void chmod(Resource res, String mode) throws XMLDBException { String path = ((CollectionImpl) res.getParentCollection()).getPath() + '/' + res.getId(); try { Vector params = new Vector(); params.addElement(path); params.addElement(mode); parent.getClient().execute("setPermissions", params); } catch (XmlRpcException e) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage()); } catch (IOException e) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage()); } } | public void chmod( Resource res, String mode ) throws XMLDBException { String path = ( (CollectionImpl) res.getParentCollection() ).getPath() + '/' + res.getId(); try { Vector params = new Vector(); params.addElement( path ); params.addElement( mode ); parent.getClient().execute( "setPermissions", params ); } catch ( XmlRpcException e ) { throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage() ); } catch ( IOException e ) { throw new XMLDBException( ErrorCodes.VENDOR_ERROR, e.getMessage() ); } } | 2909 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/2909/c34254de1faabdd0f6f473167701cea55db8dbb2/UserManagementServiceImpl.java/buggy/src/org/exist/xmldb/UserManagementServiceImpl.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
13413,
12,
2591,
400,
16,
514,
1965,
262,
1216,
26014,
503,
288,
3639,
514,
589,
273,
261,
261,
2532,
2828,
13,
400,
18,
588,
3054,
2532,
1435,
262,
18,
588,
743,
1435,
397,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
13413,
12,
2591,
400,
16,
514,
1965,
262,
1216,
26014,
503,
288,
3639,
514,
589,
273,
261,
261,
2532,
2828,
13,
400,
18,
588,
3054,
2532,
1435,
262,
18,
588,
743,
1435,
397,
... |
return (String)u1; } | return (String) u1; } | public String getClassNameId() { return (String)u1; } | 45827 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/45827/d31a76ee29d5978a9bec41e3ac9134cee024bcab/Node.java/buggy/org/jruby/nodes/Node.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
514,
11819,
548,
1435,
288,
202,
202,
2463,
261,
780,
13,
89,
21,
31,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
514,
11819,
548,
1435,
288,
202,
202,
2463,
261,
780,
13,
89,
21,
31,
202,
97,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
super(title); if (!Main.getOptions().getBoolean("muffin.noWindow")) { setFont(Main.getOptions().getFont("muffin.font")); setIcon(); configColors(this); } frames.addElement(this); | this(title,250,150); | public MuffinFrame(String title) { super(title); if (!Main.getOptions().getBoolean("muffin.noWindow")) { setFont(Main.getOptions().getFont("muffin.font")); setIcon(); configColors(this); } frames.addElement(this); } | 1353 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1353/7c85d80244be0e9a802f29826ae46056a18ed942/MuffinFrame.java/buggy/src/org/doit/muffin/MuffinFrame.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
490,
696,
926,
3219,
12,
780,
2077,
13,
565,
288,
202,
9565,
12,
2649,
1769,
202,
430,
16051,
6376,
18,
588,
1320,
7675,
588,
5507,
2932,
81,
696,
926,
18,
2135,
3829,
6,
3719,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
490,
696,
926,
3219,
12,
780,
2077,
13,
565,
288,
202,
9565,
12,
2649,
1769,
202,
430,
16051,
6376,
18,
588,
1320,
7675,
588,
5507,
2932,
81,
696,
926,
18,
2135,
3829,
6,
3719,
... |
private final int jjStartNfa_1(int pos, long active0, long active1) { return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0, active1), pos + 1); } | private final int jjStartNfa_1(int pos, long active0, long active1) { return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0, active1), pos + 1); } | private final int jjStartNfa_1(int pos, long active0, long active1) { return jjMoveNfa_1(jjStopStringLiteralDfa_1(pos, active0, active1), pos + 1); } | 41673 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/41673/bad9201cffeb6c6da295101be65bfa4924caa39e/JspParserTokenManager.java/clean/pmd/src/net/sourceforge/pmd/jsp/ast/JspParserTokenManager.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
727,
509,
10684,
1685,
50,
507,
67,
21,
12,
474,
949,
16,
1525,
2695,
20,
16,
1525,
2695,
21,
13,
288,
3639,
327,
10684,
7607,
50,
507,
67,
21,
12,
78,
78,
4947,
28565,
40,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
727,
509,
10684,
1685,
50,
507,
67,
21,
12,
474,
949,
16,
1525,
2695,
20,
16,
1525,
2695,
21,
13,
288,
3639,
327,
10684,
7607,
50,
507,
67,
21,
12,
78,
78,
4947,
28565,
40,
50... |
Model model = ((DisplayModel) session.getServletContext() .getAttribute(Constants.MODEL)).getModel(); | ServletContext servletContext = session.getServletContext(); Model model = ((DisplayModel) servletContext.getAttribute(Constants.MODEL)).getModel(); | public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); Set openClasses = (Set) session.getAttribute("openClasses"); if (openClasses == null) { openClasses = new HashSet(); openClasses.add("org.flymine.model.FlyMineBusinessObject"); session.setAttribute("openClasses", openClasses); } String rootClass = (String) request.getAttribute("rootClass"); if (rootClass == null) { rootClass = "org.flymine.model.FlyMineBusinessObject"; } Model model = ((DisplayModel) session.getServletContext() .getAttribute(Constants.MODEL)).getModel(); ClassDescriptor root = model.getClassDescriptorByName(rootClass); request.setAttribute("nodes", makeNodes(root, openClasses, 0)); return null; } | 29158 /local/tlutelli/issta_data/temp/all_java2context/java/2006_temp/2006/29158/ebc575c3f4fe5aa00c4e566add06e0defc4cc555/TreeController.java/buggy/intermine/src/java/org/intermine/web/TreeController.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
4382,
8514,
1836,
12,
1803,
3233,
2874,
16,
4766,
4382,
1204,
646,
16,
4766,
9984,
590,
16,
4766,
12446,
766,
13,
3639,
1216,
1185,
288,
3639,
26166,
1339,
273,
590,
18,
588,
2157,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
4382,
8514,
1836,
12,
1803,
3233,
2874,
16,
4766,
4382,
1204,
646,
16,
4766,
9984,
590,
16,
4766,
12446,
766,
13,
3639,
1216,
1185,
288,
3639,
26166,
1339,
273,
590,
18,
588,
2157,
... |
repositoryQuery.setCurrentlySynchronizing(false); return resultingStatus; | return Status.OK_STATUS; | protected IStatus run(IProgressMonitor monitor) { monitor.beginTask(JOB_LABEL, queries.size()); for (AbstractRepositoryQuery repositoryQuery : queries) { // if (repositoryQuery.isSynchronizing()) // continue; monitor.setTaskName("Synchronizing: " + repositoryQuery.getDescription()); setProperty(IProgressConstants.ICON_PROPERTY, TaskListImages.REPOSITORY_SYNCHRONIZE); // repositoryQuery.setCurrentlySynchronizing(true); TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository( repositoryQuery.getRepositoryKind(), repositoryQuery.getRepositoryUrl()); if (repository == null) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { MessageDialog .openInformation(Display.getDefault().getActiveShell(), TasksUiPlugin.TITLE_DIALOG, "No task repository associated with this query. Open the query to associate it with a repository."); } }); } // MultiStatus queryStatus = new // MultiStatus(TasksUiPlugin.PLUGIN_ID, IStatus.OK, "Query result", // null); newHits.clear(); AbstractQueryHitCollector collector = new AbstractQueryHitCollector() { @Override public void addMatch(AbstractQueryHit hit) { // TODO: do hit -> task matching here rather than in // abstract? newHits.add(hit); } }; IStatus resultingStatus = connector.performQuery(repositoryQuery, monitor, collector); // connector.performQuery(repositoryQuery, new // NullProgressMonitor(), queryStatus); if (resultingStatus.getException() == null) { repositoryQuery.updateHits(newHits, taskList); if (synchTasks) { // TODO: Should sync changed per repository not per query TasksUiPlugin.getSynchronizationManager().synchronizeChanged(connector, repository); } } else { // TODO: log the error? repositoryQuery.setCurrentlySynchronizing(false); return resultingStatus; } // if (queryStatus.getChildren() != null && // queryStatus.getChildren().length > 0) { // if (queryStatus.getChildren()[0].getException() == null) { // repositoryQuery.updateHits(newHits, taskList); // if (synchTasks) { // // TODO: Should sync changed per repository not per query // TasksUiPlugin.getSynchronizationManager().synchronizeChanged(connector, // repository); // } // // } else { // repositoryQuery.setCurrentlySynchronizing(false); // return queryStatus.getChildren()[0]; // } // } repositoryQuery.setCurrentlySynchronizing(false); repositoryQuery.setLastRefreshTimeStamp(DateUtil.getFormattedDate(new Date(), "MMM d, H:mm:ss")); TasksUiPlugin.getTaskListManager().getTaskList().notifyContainerUpdated(repositoryQuery); monitor.worked(1); } return Status.OK_STATUS; } | 51151 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51151/f925561ea2898d91e3bd79b1e6afd741205d470a/SynchronizeQueryJob.java/buggy/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/SynchronizeQueryJob.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
467,
1482,
1086,
12,
45,
5491,
7187,
6438,
13,
288,
202,
202,
10259,
18,
10086,
2174,
12,
18321,
67,
13545,
16,
6218,
18,
1467,
10663,
202,
202,
1884,
261,
7469,
3305,
1138,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
467,
1482,
1086,
12,
45,
5491,
7187,
6438,
13,
288,
202,
202,
10259,
18,
10086,
2174,
12,
18321,
67,
13545,
16,
6218,
18,
1467,
10663,
202,
202,
1884,
261,
7469,
3305,
1138,
... |
if (curChar == 46) | if ((0x400800000000L & l) != 0L) | private final int jjMoveNfa_0(int startState, int curPos){ int[] nextStates; int startsAt = 0; jjnewStateCnt = 71; int i = 1; jjstateSet[0] = startState; int j, kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; MatchLoop: do { switch(jjstateSet[--i]) { case 0: if ((0x3ff000000000000L & l) != 0L) { if (kind > 4) kind = 4; jjCheckNAddStates(0, 8); } else if ((0x100003600L & l) != 0L) { if (kind > 1) kind = 1; } else if ((0x8000281000000000L & l) != 0L) { if (kind > 10) kind = 10; jjCheckNAdd(21); } else if (curChar == 37) jjCheckNAddStates(9, 12); else if (curChar == 47) jjstateSet[jjnewStateCnt++] = 26; else if (curChar == 40) jjCheckNAddStates(13, 15); else if (curChar == 46) jjCheckNAdd(6); if (curChar == 45) jjCheckNAddStates(16, 21); else if (curChar == 47) jjCheckNAddTwoStates(23, 24); else if (curChar == 48) jjstateSet[jjnewStateCnt++] = 2; break; case 1: if (curChar == 48) jjstateSet[jjnewStateCnt++] = 2; break; case 3: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 4) kind = 4; jjCheckNAddTwoStates(3, 4); break; case 5: if (curChar == 46) jjCheckNAdd(6); break; case 6: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAddStates(22, 24); break; case 8: if ((0x280000000000L & l) != 0L) jjCheckNAdd(9); break; case 9: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAddTwoStates(9, 10); break; case 11: if (curChar == 40) jjCheckNAddStates(13, 15); break; case 12: if ((0xfffffdffffffffffL & l) != 0L) jjCheckNAddStates(13, 15); break; case 14: if ((0x28000000400L & l) != 0L) jjCheckNAddStates(13, 15); break; case 15: if (curChar == 41 && kind > 9) kind = 9; break; case 16: if ((0xff000000000000L & l) != 0L) jjCheckNAddStates(25, 28); break; case 17: if ((0xff000000000000L & l) != 0L) jjCheckNAddStates(13, 15); break; case 18: if ((0xf000000000000L & l) != 0L) jjstateSet[jjnewStateCnt++] = 19; break; case 19: if ((0xff000000000000L & l) != 0L) jjCheckNAdd(17); break; case 20: if ((0x8000281000000000L & l) == 0L) break; if (kind > 10) kind = 10; jjCheckNAdd(21); break; case 21: if ((0x83ff681000000000L & l) == 0L) break; if (kind > 10) kind = 10; jjCheckNAdd(21); break; case 22: if (curChar == 47) jjCheckNAddTwoStates(23, 24); break; case 23: if (curChar == 46) jjCheckNAdd(24); break; case 24: if ((0x8000281000000000L & l) == 0L) break; if (kind > 11) kind = 11; jjCheckNAdd(25); break; case 25: if ((0x83ff681000000000L & l) == 0L) break; if (kind > 11) kind = 11; jjCheckNAdd(25); break; case 26: if (curChar == 47) jjstateSet[jjnewStateCnt++] = 27; break; case 27: if ((0x8000281000000000L & l) == 0L) break; if (kind > 12) kind = 12; jjCheckNAdd(28); break; case 28: if ((0x83ff681000000000L & l) == 0L) break; if (kind > 12) kind = 12; jjCheckNAdd(28); break; case 29: if (curChar == 47) jjstateSet[jjnewStateCnt++] = 26; break; case 30: if (curChar == 37) jjCheckNAddStates(9, 12); break; case 31: if ((0xfffffffffffffbffL & l) != 0L) jjCheckNAddTwoStates(31, 32); break; case 32: if (curChar == 10 && kind > 2) kind = 2; break; case 33: if ((0xffffffffffffdfffL & l) != 0L) jjCheckNAddTwoStates(33, 34); break; case 34: if (curChar == 13 && kind > 3) kind = 3; break; case 35: if (curChar == 45) jjCheckNAddStates(16, 21); break; case 36: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 4) kind = 4; jjCheckNAddTwoStates(36, 4); break; case 37: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(37, 38); break; case 38: if (curChar != 46) break; if (kind > 7) kind = 7; jjCheckNAddStates(29, 31); break; case 39: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAddStates(29, 31); break; case 41: if ((0x280000000000L & l) != 0L) jjCheckNAdd(42); break; case 42: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAddTwoStates(42, 10); break; case 43: if (curChar == 46) jjCheckNAdd(44); break; case 44: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAddStates(32, 34); break; case 46: if ((0x280000000000L & l) != 0L) jjCheckNAdd(47); break; case 47: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAddTwoStates(47, 10); break; case 48: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(48, 49); break; case 50: if ((0x280000000000L & l) != 0L) jjCheckNAdd(51); break; case 51: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAddTwoStates(51, 10); break; case 52: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(35, 37); break; case 54: if ((0x280000000000L & l) != 0L) jjCheckNAdd(55); break; case 55: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(55, 10); break; case 56: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 4) kind = 4; jjCheckNAddStates(0, 8); break; case 57: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(57, 58); break; case 58: if (curChar != 46) break; if (kind > 7) kind = 7; jjCheckNAddStates(38, 40); break; case 59: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAddStates(38, 40); break; case 61: if ((0x280000000000L & l) != 0L) jjCheckNAdd(62); break; case 62: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAddTwoStates(62, 10); break; case 63: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(63, 64); break; case 65: if ((0x280000000000L & l) != 0L) jjCheckNAdd(66); break; case 66: if ((0x3ff000000000000L & l) == 0L) break; if (kind > 7) kind = 7; jjCheckNAddTwoStates(66, 10); break; case 67: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddStates(41, 43); break; case 69: if ((0x280000000000L & l) != 0L) jjCheckNAdd(70); break; case 70: if ((0x3ff000000000000L & l) != 0L) jjCheckNAddTwoStates(70, 10); break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); MatchLoop: do { switch(jjstateSet[--i]) { case 0: case 21: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 10) kind = 10; jjCheckNAdd(21); break; case 2: if ((0x100000001000000L & l) != 0L) jjCheckNAdd(3); break; case 3: if ((0x7e0000007eL & l) == 0L) break; if (kind > 4) kind = 4; jjCheckNAddTwoStates(3, 4); break; case 4: if ((0x100000001000L & l) != 0L && kind > 4) kind = 4; break; case 7: if ((0x2000000020L & l) != 0L) jjAddStates(44, 45); break; case 10: if ((0x5000000050L & l) != 0L && kind > 7) kind = 7; break; case 12: if ((0xffffffffefffffffL & l) != 0L) jjCheckNAddStates(13, 15); break; case 13: if (curChar == 92) jjAddStates(46, 48); break; case 14: if ((0x14404410000000L & l) != 0L) jjCheckNAddStates(13, 15); break; case 24: case 25: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 11) kind = 11; jjCheckNAdd(25); break; case 27: case 28: if ((0x7fffffe87fffffeL & l) == 0L) break; if (kind > 12) kind = 12; jjCheckNAdd(28); break; case 31: jjAddStates(49, 50); break; case 33: jjAddStates(51, 52); break; case 40: if ((0x2000000020L & l) != 0L) jjAddStates(53, 54); break; case 45: if ((0x2000000020L & l) != 0L) jjAddStates(55, 56); break; case 49: if ((0x2000000020L & l) != 0L) jjAddStates(57, 58); break; case 53: if ((0x2000000020L & l) != 0L) jjAddStates(59, 60); break; case 60: if ((0x2000000020L & l) != 0L) jjAddStates(61, 62); break; case 64: if ((0x2000000020L & l) != 0L) jjAddStates(63, 64); break; case 68: if ((0x2000000020L & l) != 0L) jjAddStates(65, 66); break; default : break; } } while(i != startsAt); } else { int hiByte = (int)(curChar >> 8); int i1 = hiByte >> 6; long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); MatchLoop: do { switch(jjstateSet[--i]) { case 0: case 21: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 10) kind = 10; jjCheckNAdd(21); break; case 12: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjAddStates(13, 15); break; case 24: case 25: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 11) kind = 11; jjCheckNAdd(25); break; case 27: case 28: if (!jjCanMove_1(hiByte, i1, i2, l1, l2)) break; if (kind > 12) kind = 12; jjCheckNAdd(28); break; case 31: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjAddStates(49, 50); break; case 33: if (jjCanMove_0(hiByte, i1, i2, l1, l2)) jjAddStates(51, 52); break; default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 71 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } }} | 4174 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/4174/e5ece9e232e89c196251741f6c4d8dd7986bff20/PAParserTokenManager.java/buggy/src/com/lowagie/text/pdf/codec/postscript/PAParserTokenManager.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
3238,
727,
509,
10684,
7607,
50,
507,
67,
20,
12,
474,
787,
1119,
16,
509,
662,
1616,
15329,
282,
509,
8526,
1024,
7629,
31,
282,
509,
2542,
861,
273,
374,
31,
282,
10684,
2704,
1119,
11750,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
3238,
727,
509,
10684,
7607,
50,
507,
67,
20,
12,
474,
787,
1119,
16,
509,
662,
1616,
15329,
282,
509,
8526,
1024,
7629,
31,
282,
509,
2542,
861,
273,
374,
31,
282,
10684,
2704,
1119,
11750,... |
JButton okMessage = new JButton(new ImageIcon("images/news_ok.png")); | JToolBarButton okMessage = new JToolBarButton(new ImageIcon("images/news_ok.png")); | private JToolBar createMessageToolBar() { JToolBar toolBar = new JToolBar(); JButton newMessage = new JButton(new ImageIcon("images/news_new.png")); newMessage.addActionListener(new ActionListener() { /** * @see ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { newMessage(); } }); JButton okMessage = new JButton(new ImageIcon("images/news_ok.png")); okMessage.addActionListener(new ActionListener() { /** * @see ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { if (checkIfFilled() == true) { saveOrUpdateMessage(); } newsOverview.getNewsTree().updateUI(); } }); JButton deleteMessage = new JButton(new ImageIcon("images/news_delete.png")); deleteMessage.addActionListener(new ActionListener() { /** * @see ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { deleteMessage(); newsOverview.getNewsTree().updateUI(); } }); JButton refreshMessage = new JButton(new ImageIcon("images/refresh.png")); refreshMessage.addActionListener(new ActionListener() { /** * @see ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { refreshTree(); } }); toolBar.add(newMessage); toolBar.add(okMessage); toolBar.add(deleteMessage); toolBar.add(new JToolBar.Separator()); toolBar.add(refreshMessage); return toolBar; } | 10375 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/10375/012d0b057dc3a7d071af5e44142f6f18d7ef9825/MessageUI.java/buggy/EcoBill/src/ecobill/module/base/ui/message/MessageUI.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
804,
6364,
5190,
23836,
6364,
5190,
1435,
288,
3639,
804,
6364,
5190,
5226,
5190,
273,
394,
804,
6364,
5190,
5621,
3639,
28804,
394,
1079,
273,
394,
28804,
12,
2704,
3421,
5554,
2932,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
804,
6364,
5190,
23836,
6364,
5190,
1435,
288,
3639,
804,
6364,
5190,
5226,
5190,
273,
394,
804,
6364,
5190,
5621,
3639,
28804,
394,
1079,
273,
394,
28804,
12,
2704,
3421,
5554,
2932,... |
if (matcher != null) { | if (matcher != null && clientAddressType == matcher.getAddressType()) { | public void run() { while (!closed) { boolean logMINOR = Logger.shouldLog(Logger.MINOR, this); try { Socket clientSocket = serverSocket.accept(); InetAddress clientAddress = clientSocket.getInetAddress(); if(logMINOR) Logger.minor(Acceptor.class, "Connection from " + clientAddress); /* check if the ip address is allowed */ boolean addressMatched = false; synchronized (syncObject) { Iterator hosts = allowedHosts.iterator(); while (!addressMatched && hosts.hasNext()) { String host = (String) hosts.next(); AddressMatcher matcher = (AddressMatcher) addressMatchers.get(host); if (matcher != null) { addressMatched = matcher.matches(clientAddress); } else { addressMatched = "*".equals(host); } } } if (addressMatched) { synchronized (syncObject) { acceptedSockets.add(clientSocket); syncObject.notify(); } } else { try { clientSocket.close(); } catch (IOException ioe1) { } Logger.normal(Acceptor.class, "Denied connection to " + clientAddress); } } catch (SocketTimeoutException ste1) { if(logMINOR) Logger.minor(this, "Timeout"); } catch (IOException ioe1) { if(logMINOR) Logger.minor(this, "Caught " + ioe1); } } NetworkInterface.this.acceptorStopped(); } | 52909 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52909/2fbc8b0b66f58c20d3b1c51df69488b2d26b7b14/NetworkInterface.java/buggy/src/freenet/io/NetworkInterface.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
3196,
202,
482,
918,
1086,
1435,
288,
1082,
202,
17523,
16051,
12204,
13,
288,
9506,
202,
6494,
613,
6236,
916,
273,
4242,
18,
13139,
1343,
12,
3328,
18,
6236,
916,
16,
333,
1769,
9506,
202,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
3196,
202,
482,
918,
1086,
1435,
288,
1082,
202,
17523,
16051,
12204,
13,
288,
9506,
202,
6494,
613,
6236,
916,
273,
4242,
18,
13139,
1343,
12,
3328,
18,
6236,
916,
16,
333,
1769,
9506,
202,
... |
n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); | n.putIntProp(Node.ISNUMBER_PROP, Node.BOTH); | int rewriteForNumberVariables(Node n) { switch (n.getType()) { case TokenStream.POP : { Node child = n.getFirstChild(); int type = rewriteForNumberVariables(child); if (type == TypeEvent.NumberType) n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); return TypeEvent.NoType; } case TokenStream.NUMBER : n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); return TypeEvent.NumberType; case TokenStream.GETVAR : { OptLocalVariable theVar = (OptLocalVariable)(n.getProp(Node.VARIABLE_PROP)); if (theVar != null) { if (inDirectCallFunction && theVar.isParameter()) { n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); return TypeEvent.NumberType; } else if (theVar.isNumber()) { n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); return TypeEvent.NumberType; } } return TypeEvent.NoType; } case TokenStream.INC : case TokenStream.DEC : { Node child = n.getFirstChild(); // will be a GETVAR or GETPROP if (child.getType() == TokenStream.GETVAR) { OptLocalVariable theVar = (OptLocalVariable)(child.getProp(Node.VARIABLE_PROP)); if ((theVar != null) && theVar.isNumber()) { n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); markDCPNumberContext(child); return TypeEvent.NumberType; } else return TypeEvent.NoType; } else return TypeEvent.NoType; } case TokenStream.SETVAR : { Node lChild = n.getFirstChild(); Node rChild = lChild.getNextSibling(); int rType = rewriteForNumberVariables(rChild); OptLocalVariable theVar = (OptLocalVariable)(n.getProp(Node.VARIABLE_PROP)); if (inDirectCallFunction && theVar.isParameter()) { if (rType == TypeEvent.NumberType) { if (!convertParameter(rChild)) { n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); return TypeEvent.NumberType; } markDCPNumberContext(rChild); return TypeEvent.NoType; } else return rType; } else { if ((theVar != null) && theVar.isNumber()) { if (rType != TypeEvent.NumberType) { n.removeChild(rChild); Node newRChild = new Node(TokenStream.CONVERT, rChild); newRChild.putProp(Node.TYPE_PROP, Double.class); n.addChildToBack(newRChild); } n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); markDCPNumberContext(rChild); return TypeEvent.NumberType; } else { if (rType == TypeEvent.NumberType) { if (!convertParameter(rChild)) { n.removeChild(rChild); Node newRChild = new Node(TokenStream.CONVERT, rChild); newRChild.putProp(Node.TYPE_PROP, Object.class); n.addChildToBack(newRChild); } } return TypeEvent.NoType; } } } case TokenStream.RELOP : { Node lChild = n.getFirstChild(); Node rChild = lChild.getNextSibling(); int lType = rewriteForNumberVariables(lChild); int rType = rewriteForNumberVariables(rChild); markDCPNumberContext(lChild); markDCPNumberContext(rChild); if ((n.getInt() == TokenStream.INSTANCEOF) || (n.getInt() == TokenStream.IN)) { if (lType == TypeEvent.NumberType) { if (!convertParameter(lChild)) { n.removeChild(lChild); Node nuChild = new Node(TokenStream.CONVERT, lChild); nuChild.putProp(Node.TYPE_PROP, Object.class); n.addChildToFront(nuChild); } } if (rType == TypeEvent.NumberType) { if (!convertParameter(rChild)) { n.removeChild(rChild); Node nuChild = new Node(TokenStream.CONVERT, rChild); nuChild.putProp(Node.TYPE_PROP, Object.class); n.addChildToBack(nuChild); } } } else { if (convertParameter(lChild)) { if (convertParameter(rChild)) { return TypeEvent.NoType; } else { if (rType == TypeEvent.NumberType) { n.putProp(Node.ISNUMBER_PROP, new Integer(Node.RIGHT)); } } } else { if (convertParameter(rChild)) { if (lType == TypeEvent.NumberType) { n.putProp(Node.ISNUMBER_PROP, new Integer(Node.LEFT)); } } else { if (lType == TypeEvent.NumberType) { if (rType == TypeEvent.NumberType) { n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); } else { n.putProp(Node.ISNUMBER_PROP, new Integer(Node.LEFT)); } } else { if (rType == TypeEvent.NumberType) { n.putProp(Node.ISNUMBER_PROP, new Integer(Node.RIGHT)); } } } } } // we actually build a boolean value return TypeEvent.NoType; } case TokenStream.ADD : { Node lChild = n.getFirstChild(); Node rChild = lChild.getNextSibling(); int lType = rewriteForNumberVariables(lChild); int rType = rewriteForNumberVariables(rChild); if (convertParameter(lChild)) { if (convertParameter(rChild)) { return TypeEvent.NoType; } else { if (rType == TypeEvent.NumberType) { n.putProp(Node.ISNUMBER_PROP,new Integer(Node.RIGHT)); } } } else { if (convertParameter(rChild)) { if (lType == TypeEvent.NumberType) { n.putProp(Node.ISNUMBER_PROP,new Integer(Node.LEFT)); } } else { if (lType == TypeEvent.NumberType) { if (rType == TypeEvent.NumberType) { n.putProp(Node.ISNUMBER_PROP,new Integer(Node.BOTH)); return TypeEvent.NumberType; } else { n.putProp(Node.ISNUMBER_PROP,new Integer(Node.LEFT)); } } else { if (rType == TypeEvent.NumberType) { n.putProp(Node.ISNUMBER_PROP,new Integer(Node.RIGHT)); } } } } return TypeEvent.NoType; } case TokenStream.BITXOR : case TokenStream.BITOR : case TokenStream.BITAND : case TokenStream.RSH : case TokenStream.LSH : case TokenStream.SUB : case TokenStream.MUL : case TokenStream.DIV : case TokenStream.MOD : { Node lChild = n.getFirstChild(); Node rChild = lChild.getNextSibling(); int lType = rewriteForNumberVariables(lChild); int rType = rewriteForNumberVariables(rChild); markDCPNumberContext(lChild); markDCPNumberContext(rChild); if (lType == TypeEvent.NumberType) { if (rType == TypeEvent.NumberType) { n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); return TypeEvent.NumberType; } else { if (!convertParameter(rChild)) { n.removeChild(rChild); Node newRChild = new Node(TokenStream.CONVERT, rChild); newRChild.putProp(Node.TYPE_PROP, Double.class); n.addChildToBack(newRChild); n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); } return TypeEvent.NumberType; } } else { if (rType == TypeEvent.NumberType) { if (!convertParameter(lChild)) { n.removeChild(lChild); Node newLChild = new Node(TokenStream.CONVERT, lChild); newLChild.putProp(Node.TYPE_PROP, Double.class); n.addChildToFront(newLChild); n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); } return TypeEvent.NumberType; } else { if (!convertParameter(lChild)) { n.removeChild(lChild); Node newLChild = new Node(TokenStream.CONVERT, lChild); newLChild.putProp(Node.TYPE_PROP, Double.class); n.addChildToFront(newLChild); } if (!convertParameter(rChild)) { n.removeChild(rChild); Node newRChild = new Node(TokenStream.CONVERT, rChild); newRChild.putProp(Node.TYPE_PROP, Double.class); n.addChildToBack(newRChild); } n.putProp(Node.ISNUMBER_PROP, new Integer(Node.BOTH)); return TypeEvent.NumberType; } } } case TokenStream.SETELEM : { Node arrayBase = n.getFirstChild(); Node arrayIndex = arrayBase.getNextSibling(); Node rValue = arrayIndex.getNextSibling(); int baseType = rewriteForNumberVariables(arrayBase); if (baseType == TypeEvent.NumberType) {// can never happen ??? if (!convertParameter(arrayBase)) { n.removeChild(arrayBase); Node nuChild = new Node(TokenStream.CONVERT, arrayBase); nuChild.putProp(Node.TYPE_PROP, Object.class); n.addChildToFront(nuChild); } } int indexType = rewriteForNumberVariables(arrayIndex); if (indexType == TypeEvent.NumberType) { // setting the ISNUMBER_PROP signals the codegen // to use the scriptRuntime.setElem that takes // a double index n.putProp(Node.ISNUMBER_PROP, new Integer(Node.LEFT)); markDCPNumberContext(arrayIndex); } int rValueType = rewriteForNumberVariables(rValue); if (rValueType == TypeEvent.NumberType) { if (!convertParameter(rValue)) { n.removeChild(rValue); Node nuChild = new Node(TokenStream.CONVERT, rValue); nuChild.putProp(Node.TYPE_PROP, Object.class); n.addChildToBack(nuChild); } } return TypeEvent.NoType; } case TokenStream.GETELEM : { Node arrayBase = n.getFirstChild(); Node arrayIndex = arrayBase.getNextSibling(); int baseType = rewriteForNumberVariables(arrayBase); if (baseType == TypeEvent.NumberType) {// can never happen ??? if (!convertParameter(arrayBase)) { n.removeChild(arrayBase); Node nuChild = new Node(TokenStream.CONVERT, arrayBase); nuChild.putProp(Node.TYPE_PROP, Object.class); n.addChildToFront(nuChild); } } int indexType = rewriteForNumberVariables(arrayIndex); if (indexType == TypeEvent.NumberType) { // setting the ISNUMBER_PROP signals the codegen // to use the scriptRuntime.getElem that takes // a double index n.putProp(Node.ISNUMBER_PROP, new Integer(Node.RIGHT)); markDCPNumberContext(arrayIndex); } return TypeEvent.NoType; } case TokenStream.CALL : { FunctionNode target = (FunctionNode)n.getProp(Node.DIRECTCALL_PROP); if (target != null) {/* we leave each child as a Number if it can be. The codegen will handle moving the pairs of parameters.*/ Node child = n.getFirstChild(); // the function rewriteForNumberVariables(child); child = child.getNextSibling(); // the 'this' object rewriteForNumberVariables(child); child = child.getNextSibling(); // the first arg while (child != null) { int type = rewriteForNumberVariables(child); if (type == TypeEvent.NumberType) { markDCPNumberContext(child); } child = child.getNextSibling(); } return TypeEvent.NoType; } // else fall thru... } default : { Node child = n.getFirstChild(); while (child != null) { Node nextChild = child.getNextSibling(); int type = rewriteForNumberVariables(child); if (type == TypeEvent.NumberType) { if (!convertParameter(child)) { n.removeChild(child); Node nuChild = new Node(TokenStream.CONVERT, child); nuChild.putProp(Node.TYPE_PROP, Object.class); if (nextChild == null) n.addChildToBack(nuChild); else n.addChildBefore(nuChild, nextChild); } } child = nextChild; } return TypeEvent.NoType; } } } | 7555 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/7555/f6c346cc7699c007b0b9b27d9c3cdb5446052c64/Optimizer.java/clean/js/rhino/src/org/mozilla/javascript/optimizer/Optimizer.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
509,
10738,
1290,
1854,
6158,
12,
907,
290,
13,
565,
288,
3639,
1620,
261,
82,
18,
588,
559,
10756,
288,
5411,
648,
3155,
1228,
18,
30374,
294,
288,
10792,
2029,
1151,
273,
290,
18,
588... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
509,
10738,
1290,
1854,
6158,
12,
907,
290,
13,
565,
288,
3639,
1620,
261,
82,
18,
588,
559,
10756,
288,
5411,
648,
3155,
1228,
18,
30374,
294,
288,
10792,
2029,
1151,
273,
290,
18,
588... |
/* Hack so we can see where error occurred, for debugging: try { throw new Exception(); } catch(Exception e) { System.out.println("Stack trace:"); e.printStackTrace(); } */ | private static void report(String type, String msg) { if (! gag) System.out.println(type + ": " + msg); /* Hack so we can see where error occurred, for debugging: try { throw new Exception(); } catch(Exception e) { System.out.println("Stack trace:"); e.printStackTrace(); } */ } | 46634 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46634/01bb84f7a849ac80d02260ac2881fc4b8f2d65e4/ErrorSet.java/buggy/src/escjava/trunk/ESCTools/Javafe/java/javafe/util/ErrorSet.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
760,
918,
2605,
12,
780,
618,
16,
514,
1234,
13,
288,
202,
430,
16051,
314,
346,
13,
202,
565,
2332,
18,
659,
18,
8222,
12,
723,
397,
6398,
315,
397,
1234,
1769,
1377,
1748,
670... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
760,
918,
2605,
12,
780,
618,
16,
514,
1234,
13,
288,
202,
430,
16051,
314,
346,
13,
202,
565,
2332,
18,
659,
18,
8222,
12,
723,
397,
6398,
315,
397,
1234,
1769,
1377,
1748,
670... | |
bResult = false; | result = false; | public void waitForStart(long timeout) throws Win32Exception { long lStatus; boolean bResult = true; long lStart = System.currentTimeMillis(); while((lStatus = this.status()) != SERVICE_RUNNING) { if(lStatus == SERVICE_START_PENDING) { // The start hasn't completed yet. Keep trying up to // the timeout. if((System.currentTimeMillis() - lStart) < timeout || timeout <= 0) { try { Thread.sleep(100); } catch(InterruptedException e) { } } else bResult = false; } else if(lStatus == SERVICE_STOPPED) { // Start failed bResult = false; break; } else { // Hrm. bResult = false; break; } } if(bResult == false) Service.throwLastErrorException(); } | 46567 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46567/084300bce2472c57310fe2c37a742ed3759aafd5/Service.java/buggy/bindings/java/src/net/hyperic/sigar/win32/Service.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
10712,
1685,
12,
5748,
2021,
13,
1216,
21628,
1578,
503,
565,
288,
3639,
1525,
565,
328,
1482,
31,
3639,
1250,
324,
1253,
273,
638,
31,
3639,
1525,
565,
328,
1685,
225,
273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
10712,
1685,
12,
5748,
2021,
13,
1216,
21628,
1578,
503,
565,
288,
3639,
1525,
565,
328,
1482,
31,
3639,
1250,
324,
1253,
273,
638,
31,
3639,
1525,
565,
328,
1685,
225,
273,
... |
QName[] newStackOfQueue = new QName[newElementDepth * 2]; System.arraycopy(this.fElementQNamePartsStack, 0, newStackOfQueue, 0, newElementDepth ); fElementQNamePartsStack = newStackOfQueue; | QName[] newStackOfQueue = new QName[newElementDepth * 2]; System.arraycopy(this.fElementQNamePartsStack, 0, newStackOfQueue, 0, newElementDepth ); fElementQNamePartsStack = newStackOfQueue; | private void ensureStackCapacity ( int newElementDepth) { if (newElementDepth == fElementQNamePartsStack.length ) { int[] newStack = new int[newElementDepth * 2]; System.arraycopy(fScopeStack, 0, newStack, 0, newElementDepth); fScopeStack = newStack; newStack = new int[newElementDepth * 2]; System.arraycopy(fGrammarNameSpaceIndexStack, 0, newStack, 0, newElementDepth); fGrammarNameSpaceIndexStack = newStack; QName[] newStackOfQueue = new QName[newElementDepth * 2]; System.arraycopy(this.fElementQNamePartsStack, 0, newStackOfQueue, 0, newElementDepth ); fElementQNamePartsStack = newStackOfQueue; QName qname = fElementQNamePartsStack[newElementDepth]; if (qname == null) { for (int i = newElementDepth; i < fElementQNamePartsStack.length; i++) { fElementQNamePartsStack[i] = new QName(); } } newStack = new int[newElementDepth * 2]; System.arraycopy(fElementEntityStack, 0, newStack, 0, newElementDepth); fElementEntityStack = newStack; newStack = new int[newElementDepth * 2]; System.arraycopy(fElementIndexStack, 0, newStack, 0, newElementDepth); fElementIndexStack = newStack; newStack = new int[newElementDepth * 2]; System.arraycopy(fContentSpecTypeStack, 0, newStack, 0, newElementDepth); fContentSpecTypeStack = newStack; newStack = new int[newElementDepth * 2]; System.arraycopy(fValidationFlagStack, 0, newStack, 0, newElementDepth); fValidationFlagStack = newStack; ContentLeafNameTypeVector[] newStackV = new ContentLeafNameTypeVector[newElementDepth * 2]; System.arraycopy(fContentLeafStack, 0, newStackV, 0, newElementDepth); fContentLeafStack = newStackV; } } | 1831 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1831/b36768aae85d6d13bc8c8289ca78efb212c8fb8f/XMLValidator.java/buggy/src/org/apache/xerces/validators/common/XMLValidator.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
918,
3387,
2624,
7437,
261,
509,
31308,
6148,
13,
288,
3639,
309,
261,
2704,
1046,
6148,
422,
284,
1046,
13688,
4305,
2624,
18,
2469,
262,
288,
5411,
509,
8526,
394,
2624,
273,
394,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
918,
3387,
2624,
7437,
261,
509,
31308,
6148,
13,
288,
3639,
309,
261,
2704,
1046,
6148,
422,
284,
1046,
13688,
4305,
2624,
18,
2469,
262,
288,
5411,
509,
8526,
394,
2624,
273,
394,... |
CopySourceInfo info= getRewriteStore().markAsRangeCopySource(parent, childProperty, first, last, isMove); | CopySourceInfo info= getRewriteStore().markAsRangeCopySource(this.parent, this.childProperty, first, last, isMove); | private ASTNode createTargetNode(ASTNode first, ASTNode last, boolean isMove) { if (first == null || last == null) { throw new IllegalArgumentException(); } //validateIsInsideAST(node); CopySourceInfo info= getRewriteStore().markAsRangeCopySource(parent, childProperty, first, last, isMove); NodeInfoStore nodeStore= this.rewriter.getNodeStore(); ASTNode placeholder= nodeStore.newPlaceholderNode(first.getNodeType()); // revisit: could use list type if (placeholder == null) { throw new IllegalArgumentException("Creating a target node is not supported for nodes of type" + first.getClass().getName()); //$NON-NLS-1$ } nodeStore.markAsCopyTarget(placeholder, info); return placeholder; } | 10698 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/10698/40ace06b6f9aaa2f71ebf049ffa37ed745fa6ef3/ListRewrite.java/buggy/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1152,
9183,
907,
752,
2326,
907,
12,
9053,
907,
1122,
16,
9183,
907,
1142,
16,
1250,
353,
7607,
13,
288,
202,
202,
430,
261,
3645,
422,
446,
747,
1142,
422,
446,
13,
288,
1082,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1152,
9183,
907,
752,
2326,
907,
12,
9053,
907,
1122,
16,
9183,
907,
1142,
16,
1250,
353,
7607,
13,
288,
202,
202,
430,
261,
3645,
422,
446,
747,
1142,
422,
446,
13,
288,
1082,
2... |
documentPanel.add(viewHilightCheckBox, BorderLayout.SOUTH); | documentPanel.add(hilightInputWordCheckBox, BorderLayout.SOUTH); | public DisambiguationPanel(ConstructClassPanel tp, ConstructPropertyPanel pp, DODDLEProject p) { project = p; constructClassPanel = tp; constructPropertyPanel = pp; inputModule = new InputModule(project); wordCorrespondConceptSetMap = new HashMap<String, Set<Concept>>(); complexConstructTreeOptionMap = new HashMap<InputWordModel, ConstructTreeOption>(); conceptDescriptionFrame = new ConceptDescriptionFrame(); conceptSetJList = new JList(); conceptSetJList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); conceptSetJList.addListSelectionListener(this); JScrollPane conceptJListScroll = new JScrollPane(conceptSetJList); conceptJListScroll.setBorder(BorderFactory.createTitledBorder(Translator .getString("DisambiguationPanel.ConceptList"))); jpWordList = new JList(); JScrollPane jpWordsAreaScroll = new JScrollPane(jpWordList); jpWordsAreaScroll.setBorder(BorderFactory.createTitledBorder(Translator .getString("DisambiguationPanel.JapaneseWords"))); enWordList = new JList(); JScrollPane enWordsAreaScroll = new JScrollPane(enWordList); enWordsAreaScroll.setBorder(BorderFactory.createTitledBorder(Translator .getString("DisambiguationPanel.EnglishWords"))); jpExplanationArea = new JTextArea(); jpExplanationArea.setLineWrap(true); JScrollPane jpExplanationAreaScroll = new JScrollPane(jpExplanationArea); jpExplanationAreaScroll.setBorder(BorderFactory.createTitledBorder(Translator .getString("DisambiguationPanel.JapaneseConceptExplanation"))); enExplanationArea = new JTextArea(); enExplanationArea.setLineWrap(true); JScrollPane enExplanationAreaScroll = new JScrollPane(enExplanationArea); enExplanationAreaScroll.setBorder(BorderFactory.createTitledBorder(Translator .getString("DisambiguationPanel.EnglishConceptExplanation"))); addAsSameConceptRadioButton = new JRadioButton(Translator.getString("DisambiguationPanel.SameConcept"), true); addAsSameConceptRadioButton.addActionListener(this); addAsSubConceptRadioButton = new JRadioButton(Translator.getString("DisambiguationPanel.SubConcept")); addAsSubConceptRadioButton.addActionListener(this); ButtonGroup group = new ButtonGroup(); group.add(addAsSameConceptRadioButton); group.add(addAsSubConceptRadioButton); constructTreeOptionPanel = new JPanel(); constructTreeOptionPanel.setLayout(new BorderLayout()); constructTreeOptionPanel.setBorder(BorderFactory.createTitledBorder(Translator .getString("DisambiguationPanel.ConstructTreeOption"))); partialMatchedConstructTreeOptionPanel = new JPanel(); partialMatchedConstructTreeOptionPanel.setLayout(new GridLayout(1, 2)); partialMatchedConstructTreeOptionPanel.add(addAsSameConceptRadioButton); partialMatchedConstructTreeOptionPanel.add(addAsSubConceptRadioButton); perfectMatchedConstructTreeOptionPanel = new JPanel(); systemAddedPerfectMatchedConstructTreeOptionPanel = new JPanel(); systemAddedPerfectMatchedConstructTreeOptionPanel.setLayout(new BorderLayout()); replaceSubClassesCheckBox = new JCheckBox("下位概念に置換"); replaceSubClassesCheckBox.addActionListener(this); systemAddedPerfectMatchedConstructTreeOptionPanel.add(replaceSubClassesCheckBox, BorderLayout.CENTER); constructTreeOptionPanel.add(partialMatchedConstructTreeOptionPanel, BorderLayout.CENTER); JPanel explanationPanel = new JPanel(); explanationPanel.setLayout(new GridLayout(5, 1, 5, 5)); explanationPanel.add(jpWordsAreaScroll); explanationPanel.add(enWordsAreaScroll); explanationPanel.add(jpExplanationAreaScroll); explanationPanel.add(enExplanationAreaScroll); explanationPanel.add(constructTreeOptionPanel); undefinedWordListPanel = new UndefinedWordListPanel(); JPanel listPanel = new JPanel(); listPanel.setLayout(new GridLayout(1, 3, 5, 5)); listPanel.add(conceptJListScroll); listPanel.add(explanationPanel); listPanel.add(undefinedWordListPanel); hilightPartJList = new JList(); hilightPartJList.addListSelectionListener(this); JScrollPane hilightPartJListScroll = new JScrollPane(hilightPartJList); hilightPartJListScroll.setBorder(BorderFactory.createTitledBorder("行番号")); hilightPartJListScroll.setPreferredSize(new Dimension(100, 100)); // documentArea = new JEditorPane("text/html", ""); documentArea = new JTextArea(); documentArea.setEditable(false); documentArea.setLineWrap(true); JScrollPane documentAreaScroll = new JScrollPane(documentArea); documentAreaScroll.setBorder(BorderFactory.createTitledBorder(Translator .getString("DisambiguationPanel.InputDocument"))); viewHilightCheckBox = new JCheckBox(Translator.getString("DisambiguationPanel.HighlightInputWords"), false); showAroundConceptTreeCheckBox = new JCheckBox(Translator.getString("DisambiguationPanel.ShowConceptTree"), false); aroundConceptTreeModel = new DefaultTreeModel(null); aroundConceptTree = new JTree(aroundConceptTreeModel); aroundConceptTree.addTreeSelectionListener(this); aroundConceptTree.setEditable(false); aroundConceptTree.setCellRenderer(new AroundTreeCellRenderer()); JScrollPane aroundConceptTreeScroll = new JScrollPane(aroundConceptTree); aroundConceptTreeScroll.setBorder(BorderFactory.createTitledBorder(Translator .getString("DisambiguationPanel.ConceptTree"))); JPanel treePanel = new JPanel(); treePanel.setLayout(new BorderLayout()); treePanel.add(aroundConceptTreeScroll, BorderLayout.CENTER); treePanel.add(showAroundConceptTreeCheckBox, BorderLayout.SOUTH); JPanel documentPanel = new JPanel(); documentPanel.setLayout(new BorderLayout()); documentPanel.add(documentAreaScroll, BorderLayout.CENTER); documentPanel.add(viewHilightCheckBox, BorderLayout.SOUTH); // documentPanel.add(hilightPartJListScroll, BorderLayout.WEST); JPanel referencePanel = new JPanel(); referencePanel.setLayout(new GridLayout(1, 2)); referencePanel.add(documentPanel); referencePanel.add(treePanel); automaticDisAmbiguationAction = new AutomaticDisAmbiguationAction(Translator .getString("DisambiguationPanel.AutomaticDisambiguation")); automaticDisAmbiguationButton = new JButton(automaticDisAmbiguationAction); // showConceptDescriptionButton = new JButton(new // ShowConceptDescriptionAction("概念記述を表示")); // JPanel p1 = new JPanel(); // p1.add(automaticDisAmbiguationButton); // p1.add(showConceptDescriptionButton); constructionTypePanel = new ConstructionTypePanel(); perfectMatchedOptionPanel = new PerfectMatchedOptionPanel(); partialMatchedOptionPanel = new PartialMatchedOptionPanel(); constructNounTreeButton = new JButton(new ConstructNounTreeAction()); constructNounAndVerbTreeButton = new JButton(new ConstructNounAndVerbTreeAction()); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(2, 1)); buttonPanel.add(constructNounTreeButton); buttonPanel.add(constructNounAndVerbTreeButton); JPanel optionPanel = new JPanel(); optionPanel.add(constructionTypePanel); optionPanel.add(perfectMatchedOptionPanel); optionPanel.add(partialMatchedOptionPanel); optionPanel.add(buttonPanel); JPanel southPanel = new JPanel(); southPanel.setLayout(new BorderLayout()); // buttonPanel.add(p1, BorderLayout.WEST); // buttonPanel.add(p2, BorderLayout.EAST); southPanel.add(optionPanel, BorderLayout.EAST); setLayout(new BorderLayout()); JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, listPanel, referencePanel); verticalSplitPane.setOneTouchExpandable(true); verticalSplitPane.setDividerSize(DODDLE.DIVIDER_SIZE); JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, getWordListPanel(), verticalSplitPane); horizontalSplitPane.setOneTouchExpandable(true); horizontalSplitPane.setDividerSize(DODDLE.DIVIDER_SIZE); add(horizontalSplitPane, BorderLayout.CENTER); add(southPanel, BorderLayout.SOUTH); } | 52646 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52646/1f250a83dce7046d45fbc159180f3ea44effc0a5/DisambiguationPanel.java/clean/src/jp/ac/keio/ae/comp/yamaguti/doddle/ui/DisambiguationPanel.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
3035,
26011,
367,
5537,
12,
7249,
797,
5537,
8071,
16,
14291,
1396,
5537,
8228,
16,
463,
1212,
40,
900,
4109,
293,
13,
288,
3639,
1984,
273,
293,
31,
3639,
4872,
797,
5537,
273,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
3035,
26011,
367,
5537,
12,
7249,
797,
5537,
8071,
16,
14291,
1396,
5537,
8228,
16,
463,
1212,
40,
900,
4109,
293,
13,
288,
3639,
1984,
273,
293,
31,
3639,
4872,
797,
5537,
273,
8... |
int identity = nodeHandle & m_mask; | int identity = makeNodeIdentity(nodeHandle); | public int getFirstChild(int nodeHandle) { int identity = nodeHandle & m_mask; int firstChild = _firstch(identity); return firstChild | m_dtmIdent; } | 2723 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/2723/2d102c245a54c9167bd2255d2b93ba5f3b7667e8/DTMDefaultBase.java/buggy/src/org/apache/xml/dtm/ref/DTMDefaultBase.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
1071,
509,
17315,
12,
474,
756,
3259,
13,
225,
288,
565,
509,
4215,
273,
1221,
907,
4334,
12,
2159,
3259,
1769,
565,
509,
15070,
273,
389,
3645,
343,
12,
10781,
1769,
565,
327,
15070,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
1071,
509,
17315,
12,
474,
756,
3259,
13,
225,
288,
565,
509,
4215,
273,
1221,
907,
4334,
12,
2159,
3259,
1769,
565,
509,
15070,
273,
389,
3645,
343,
12,
10781,
1769,
565,
327,
15070,
5... |
public IRubyObject convertToString() { return convertToType("String", "to_str", true); | public RubyString convertToString() { return (RubyString) convertToType("String", "to_str", true); | public IRubyObject convertToString() { return convertToType("String", "to_str", true); } | 52337 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52337/803c66ee682936beecc8a43fe2cfc90fe5645b22/RubyObject.java/clean/src/org/jruby/RubyObject.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
15908,
10340,
921,
1765,
5808,
1435,
288,
3639,
327,
8137,
559,
2932,
780,
3113,
315,
869,
67,
701,
3113,
638,
1769,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
15908,
10340,
921,
1765,
5808,
1435,
288,
3639,
327,
8137,
559,
2932,
780,
3113,
315,
869,
67,
701,
3113,
638,
1769,
565,
289,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
Object[] getObjectIds(Object object) { | public Object[] getObjectIds(Object object) { | Object[] getObjectIds(Object object) { DimIProxy action = new DimIProxy(this, IPROXY_OBJECT_IDS); action.object = object; action.withContext(); return action.objectArrayResult; } | 11366 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/11366/2d4fc75b74d717c754829dde488ff0a7456682cc/Dim.java/buggy/js/rhino/toolsrc/org/mozilla/javascript/tools/debugger/Dim.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1033,
8526,
6455,
2673,
12,
921,
733,
13,
565,
288,
3639,
463,
381,
45,
3886,
1301,
273,
394,
463,
381,
45,
3886,
12,
2211,
16,
2971,
1457,
8546,
67,
9422,
67,
19516,
1769,
3639,
1301,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1033,
8526,
6455,
2673,
12,
921,
733,
13,
565,
288,
3639,
463,
381,
45,
3886,
1301,
273,
394,
463,
381,
45,
3886,
12,
2211,
16,
2971,
1457,
8546,
67,
9422,
67,
19516,
1769,
3639,
1301,
... |
return dimensions[n - 1]; | return dimensions[n]; | protected void defineFunctions() { defineReserved("NULL"); // first char: p=Property, m=Method, i=Infix, P=Prefix // 2nd: // ARRAY FUNCTIONS if (false) define(new FunDefBase( "SetToArray", "SetToArray(<Set>[, <Set>]...[, <Numeric Expression>])", "Converts one or more sets to an array for use in a user-defined function.", "fa*") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); // // DIMENSION FUNCTIONS define(new HierarchyDimensionFunDef()); define(new FunDefBase( "Dimension", "<Dimension>.Dimension", "Returns the dimension that contains a specified hierarchy.", "pdd") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { Dimension dimension = ((DimensionExpr) call.getArg(0)).getDimension(); return new ConstantCalc( DimensionType.forDimension(dimension), dimension); } }); define(new FunDefBase( "Dimension", "<Level>.Dimension", "Returns the dimension that contains a specified level.", "pdl") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final LevelCalc levelCalc = compiler.compileLevel(call.getArg(0)); return new AbstractDimensionCalc(call, new Calc[] {levelCalc}) { public Dimension evaluateDimension(Evaluator evaluator) { Level level = levelCalc.evaluateLevel(evaluator); return level.getDimension(); } }; } }); define(new FunDefBase( "Dimension", "<Member>.Dimension", "Returns the dimension that contains a specified member.", "pdm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractDimensionCalc(call, new Calc[] {memberCalc}) { public Dimension evaluateDimension(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); return member.getDimension(); } }; } }); define(new FunDefBase( "Dimensions", "Dimensions(<Numeric Expression>)", "Returns the dimension whose zero-based position within the cube is specified by a numeric expression.", "fdn") { public Type getResultType(Validator validator, Exp[] args) { return DimensionType.Unknown; } public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final IntegerCalc integerCalc = compiler.compileInteger(call.getArg(0)); return new AbstractDimensionCalc(call, new Calc[] {integerCalc}) { public Dimension evaluateDimension(Evaluator evaluator) { int n = integerCalc.evaluateInteger(evaluator); return nthDimension(evaluator, n); } }; } Dimension nthDimension(Evaluator evaluator, int n) { Cube cube = evaluator.getCube(); Dimension[] dimensions = cube.getDimensions(); if ((n > dimensions.length) || (n < 1)) { throw newEvalException( this, "Index '" + n + "' out of bounds"); } return dimensions[n - 1]; } }); define(new FunDefBase( "Dimensions", "Dimensions(<String Expression>)", "Returns the dimension whose name is specified by a string.", "fdS") { public Type getResultType(Validator validator, Exp[] args) { return DimensionType.Unknown; } public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final StringCalc stringCalc = compiler.compileString(call.getArg(0)); return new AbstractDimensionCalc(call, new Calc[] {stringCalc}) { public Dimension evaluateDimension(Evaluator evaluator) { String dimensionName = stringCalc.evaluateString(evaluator); return findDimension(dimensionName, evaluator); } }; } Dimension findDimension(String s, Evaluator evaluator) { if (s.indexOf("[") == -1) { s = Util.quoteMdxIdentifier(s); } OlapElement o = evaluator.getSchemaReader().lookupCompound( evaluator.getCube(), explode(s), false, Category.Dimension); if (o instanceof Dimension) { return (Dimension) o; } else if (o == null) { throw newEvalException(this, "Dimension '" + s + "' not found"); } else { throw newEvalException(this, "Dimensions(" + s + ") found " + o); } } }); // // HIERARCHY FUNCTIONS define(new LevelHierarchyFunDef()); define(new MemberHierarchyFunDef()); // // LEVEL FUNCTIONS define(new MemberLevelFunDef()); define(new FunDefBase( "Levels", "<Hierarchy>.Levels(<Numeric Expression>)", "Returns the level whose position in a hierarchy is specified by a numeric expression.", "mlhn") { public Type getResultType(Validator validator, Exp[] args) { final Type argType = args[0].getType(); return LevelType.forType(argType); } public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final HierarchyCalc hierarchyCalc = compiler.compileHierarchy(call.getArg(0)); final IntegerCalc ordinalCalc = compiler.compileInteger(call.getArg(1)); return new AbstractLevelCalc(call, new Calc[] {hierarchyCalc, ordinalCalc}) { public Level evaluateLevel(Evaluator evaluator) { Hierarchy hierarchy = hierarchyCalc.evaluateHierarchy(evaluator); int ordinal = ordinalCalc.evaluateInteger(evaluator); return nthLevel(hierarchy, ordinal); } }; } Level nthLevel(Hierarchy hierarchy, int n) { Level[] levels = hierarchy.getLevels(); if ((n >= levels.length) || (n < 0)) { throw newEvalException( this, "Index '" + n + "' out of bounds"); } return levels[n]; } }); define(new FunDefBase( "Levels", "Levels(<String Expression>)", "Returns the level whose name is specified by a string expression.", "flS") { public Type getResultType(Validator validator, Exp[] args) { final Type argType = args[0].getType(); return LevelType.forType(argType); } public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final StringCalc stringCalc = compiler.compileString(call.getArg(0)); return new AbstractLevelCalc(call, new Calc[] {stringCalc}) { public Level evaluateLevel(Evaluator evaluator) { String levelName = stringCalc.evaluateString(evaluator); return findLevel(evaluator, levelName); } }; } Level findLevel(Evaluator evaluator, String s) { Cube cube = evaluator.getCube(); OlapElement o = (s.startsWith("[")) ? evaluator.getSchemaReader().lookupCompound( cube, explode(s), false, Category.Level) : // lookupCompound barfs if "s" doesn't have matching // brackets, so don't even try null; if (o instanceof Level) { return (Level) o; } else if (o == null) { throw newEvalException(this, "Level '" + s + "' not found"); } else { throw newEvalException(this, "Levels('" + s + "') found " + o); } } }); // // LOGICAL FUNCTIONS define(new MultiResolver( "IsEmpty", "IsEmpty(<Value Expression>)", "Determines if an expression evaluates to the empty cell value.", new String[] {"fbS", "fbn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final Calc calc = compiler.compileScalar(call.getArg(0), true); return new AbstractBooleanCalc(call, new Calc[] {calc}) { public boolean evaluateBoolean(Evaluator evaluator) { Object o = calc.evaluate(evaluator); return o == null; } }; } }; } }); define(new FunDefBase( "IS NULL", "<Member> IS NULL", "Returns whether a member is null.", "pbm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractBooleanCalc(call, new Calc[] {memberCalc}) { public boolean evaluateBoolean(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); return member.isNull(); } }; } }); define(new MultiResolver( "IS", "<Expression> IS <Expression>", "Returns whether two objects are the same (idempotent)", new String[] {"ibmm", "ibll", "ibhh", "ibdd"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final Calc calc0 = compiler.compile(call.getArg(0)); final Calc calc1 = compiler.compile(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { Object o0 = calc0.evaluate(evaluator); Object o1 = calc1.evaluate(evaluator); return o0 == o1; } }; } }; } }); // // MEMBER FUNCTIONS define(new MultiResolver( "Ancestor", "Ancestor(<Member>, {<Level>|<Numeric Expression>})", "Returns the ancestor of a member at a specified level.", new String[] {"fmml", "fmmn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); final Type type1 = call.getArg(1).getType(); if (type1 instanceof mondrian.olap.type.LevelType) { final LevelCalc levelCalc = compiler.compileLevel(call.getArg(1)); return new AbstractMemberCalc(call, new Calc[] {levelCalc}) { public Member evaluateMember(Evaluator evaluator) { Level level = levelCalc.evaluateLevel(evaluator); Member member = memberCalc.evaluateMember(evaluator); int distance = member.getLevel().getDepth() - level.getDepth(); return ancestor(evaluator, member, distance, level); } }; } else { final IntegerCalc distanceCalc = compiler.compileInteger(call.getArg(1)); return new AbstractMemberCalc(call, new Calc[] {distanceCalc}) { public Member evaluateMember(Evaluator evaluator) { int distance = distanceCalc.evaluateInteger(evaluator); Member member = memberCalc.evaluateMember(evaluator); return ancestor(evaluator, member, distance, null); } }; } } }; } }); define(new FunDefBase( "Cousin", "Cousin(<member>, <ancestor member>)", "Returns the member with the same relative position under <ancestor member> as the member specified.", "fmmm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); final MemberCalc ancestorMemberCalc = compiler.compileMember(call.getArg(1)); return new AbstractMemberCalc(call, new Calc[] {memberCalc, ancestorMemberCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); Member ancestorMember = ancestorMemberCalc.evaluateMember(evaluator); return cousin( evaluator.getSchemaReader(), member, ancestorMember); } }; } }); define(new DimensionCurrentMemberFunDef()); define(new HierarchyCurrentMemberFunDef()); define(new FunDefBase( "DataMember", "<Member>.DataMember", "Returns the system-generated data member that is associated with a nonleaf member of a dimension.", "pmm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractMemberCalc(call, new Calc[] {memberCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); return member.getDataMember(); } }; } }); define(new FunDefBase( "DefaultMember", "<Dimension>.DefaultMember", "Returns the default member of a dimension.", "pmd") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DimensionCalc dimensionCalc = compiler.compileDimension(call.getArg(0)); return new AbstractMemberCalc(call, new Calc[] {dimensionCalc}) { public Member evaluateMember(Evaluator evaluator) { Dimension dimension = dimensionCalc.evaluateDimension(evaluator); return evaluator.getSchemaReader() .getHierarchyDefaultMember( dimension.getHierarchies()[0]); } }; } }); define(new FunDefBase( "DefaultMember", "<Hierarchy>.DefaultMember", "Returns the default member of a hierarchy.", "pmh") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final HierarchyCalc hierarchyCalc = compiler.compileHierarchy(call.getArg(0)); return new AbstractMemberCalc(call, new Calc[] {hierarchyCalc}) { public Member evaluateMember(Evaluator evaluator) { Hierarchy hierarchy = hierarchyCalc.evaluateHierarchy(evaluator); return evaluator.getSchemaReader() .getHierarchyDefaultMember(hierarchy); } }; } }); define(new FunDefBase( "FirstChild", "<Member>.FirstChild", "Returns the first child of a member.", "pmm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractMemberCalc(call, new Calc[] {memberCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); return firstChild(evaluator, member); } }; } Member firstChild(Evaluator evaluator, Member member) { Member[] children = evaluator.getSchemaReader() .getMemberChildren(member); return (children.length == 0) ? member.getHierarchy().getNullMember() : children[0]; } }); define(new FunDefBase( "FirstSibling", "<Member>.FirstSibling", "Returns the first child of the parent of a member.", "pmm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractMemberCalc(call, new Calc[] {memberCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); return firstSibling(member, evaluator); } }; } Member firstSibling(Member member, Evaluator evaluator) { Member parent = member.getParentMember(); Member[] children; if (parent == null) { if (member.isNull()) { return member; } children = evaluator.getSchemaReader().getHierarchyRootMembers(member.getHierarchy()); } else { children = evaluator.getSchemaReader().getMemberChildren(parent); } return children[0]; } }); define(new MultiResolver( "Lag", "<Member>.Lag(<Numeric Expression>)", "Returns a member further along the specified member's dimension.", new String[]{"mmmn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); final IntegerCalc integerCalc = compiler.compileInteger(call.getArg(1)); return new AbstractMemberCalc(call, new Calc[] {memberCalc, integerCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); int n = integerCalc.evaluateInteger(evaluator); return evaluator.getSchemaReader().getLeadMember(member, -n); } }; } }; } }); define(new FunDefBase( "LastChild", "<Member>.LastChild", "Returns the last child of a member.", "pmm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractMemberCalc(call, new Calc[] {memberCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); return lastChild(evaluator, member); } }; } Member lastChild(Evaluator evaluator, Member member) { Member[] children = evaluator.getSchemaReader().getMemberChildren(member); return (children.length == 0) ? member.getHierarchy().getNullMember() : children[children.length - 1]; } }); define(new FunDefBase( "LastSibling", "<Member>.LastSibling", "Returns the last child of the parent of a member.", "pmm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractMemberCalc(call, new Calc[] {memberCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); return firstSibling(member, evaluator); } }; } Member firstSibling(Member member, Evaluator evaluator) { Member parent = member.getParentMember(); Member[] children; final SchemaReader schemaReader = evaluator.getSchemaReader(); if (parent == null) { if (member.isNull()) { return member; } children = schemaReader.getHierarchyRootMembers( member.getHierarchy()); } else { children = schemaReader.getMemberChildren(parent); } return children[children.length - 1]; } }); define(new MultiResolver( "Lead", "<Member>.Lead(<Numeric Expression>)", "Returns a member further along the specified member's dimension.", new String[]{"mmmn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); final IntegerCalc integerCalc = compiler.compileInteger(call.getArg(1)); return new AbstractMemberCalc(call, new Calc[] {memberCalc, integerCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); int n = integerCalc.evaluateInteger(evaluator); return evaluator.getSchemaReader().getLeadMember(member, n); } }; } }; }}); define(new FunDefBase( "Members", "Members(<String Expression>)", "Returns the member whose name is specified by a string expression.", "fmS") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); define(new FunDefBase( "NextMember", "<Member>.NextMember", "Returns the next member in the level that contains a specified member.", "pmm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractMemberCalc(call, new Calc[] {memberCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); return evaluator.getSchemaReader().getLeadMember(member, +1); } }; } }); define(OpeningClosingPeriodFunDef.createResolver(true)); define(OpeningClosingPeriodFunDef.createResolver(false)); define(new MultiResolver( "ParallelPeriod", "ParallelPeriod([<Level>[, <Numeric Expression>[, <Member>]]])", "Returns a member from a prior period in the same relative position as a specified member.", new String[] {"fm", "fml", "fmln", "fmlnm"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Type getResultType(Validator validator, Exp[] args) { if (args.length == 0) { // With no args, the default implementation cannot // guess the hierarchy, so we supply the Time // dimension. Hierarchy hierarchy = validator.getQuery() .getCube().getTimeDimension() .getHierarchy(); return MemberType.forHierarchy(hierarchy); } return super.getResultType(validator, args); } public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { // Member defaults to [Time].currentmember Exp[] args = call.getArgs(); final MemberCalc memberCalc; switch (args.length) { case 3: memberCalc = compiler.compileMember(args[2]); break; case 1: final Dimension dimension = args[0].getType().getHierarchy().getDimension(); memberCalc = new DimensionCurrentMemberCalc(dimension); break; default: final Dimension timeDimension = compiler.getEvaluator().getCube() .getTimeDimension(); memberCalc = new DimensionCurrentMemberCalc( timeDimension); break; } // Numeric Expression defaults to 1. final IntegerCalc lagValueCalc = (args.length >= 2) ? compiler.compileInteger(args[1]) : ConstantCalc.constantInteger(1); // If level is not specified, we compute it from // member at runtime. final LevelCalc ancestorLevelCalc = args.length >= 1 ? compiler.compileLevel(args[0]) : null; return new AbstractMemberCalc(call, new Calc[] {memberCalc, lagValueCalc, ancestorLevelCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember( evaluator); int lagValue = lagValueCalc.evaluateInteger( evaluator); Level ancestorLevel; if (ancestorLevelCalc != null) { ancestorLevel = ancestorLevelCalc .evaluateLevel(evaluator); } else { Member parent = member.getParentMember(); if (parent == null) { // This is a root member, // so there is no parallelperiod. return member.getHierarchy() .getNullMember(); } ancestorLevel = parent.getLevel(); } return parallelPeriod(member, ancestorLevel, evaluator, lagValue); } }; } Member parallelPeriod( Member member, Level ancestorLevel, Evaluator evaluator, int lagValue) { // Now do some error checking. // The ancestorLevel and the member must be from the // same hierarchy. if (member.getHierarchy() != ancestorLevel.getHierarchy()) { MondrianResource.instance().FunctionMbrAndLevelHierarchyMismatch.ex( "ParallelPeriod", ancestorLevel.getHierarchy().getUniqueName(), member.getHierarchy().getUniqueName() ); } int distance = member.getLevel().getDepth() - ancestorLevel.getDepth(); Member ancestor = FunUtil.ancestor( evaluator, member, distance, ancestorLevel); Member inLaw = evaluator.getSchemaReader() .getLeadMember(ancestor, -lagValue); return FunUtil.cousin( evaluator.getSchemaReader(), member, inLaw); } }; } }); define(new FunDefBase( "Parent", "<Member>.Parent", "Returns the parent of a member.", "pmm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractMemberCalc(call, new Calc[] {memberCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); return memberParent(evaluator, member); } }; } Member memberParent(Evaluator evaluator, Member member) { Member parent = evaluator.getSchemaReader().getMemberParent(member); if (parent == null) { parent = member.getHierarchy().getNullMember(); } return parent; } }); define(new FunDefBase( "PrevMember", "<Member>.PrevMember", "Returns the previous member in the level that contains a specified member.", "pmm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractMemberCalc(call, new Calc[] {memberCalc}) { public Member evaluateMember(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); return evaluator.getSchemaReader().getLeadMember(member, -1); } }; } }); define(new FunDefBase( "StrToMember", "StrToMember(<String Expression>)", "Returns a member from a unique name String in MDX format.", "fmS") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final StringCalc memberNameCalc = compiler.compileString(call.getArg(0)); return new AbstractMemberCalc(call, new Calc[] {memberNameCalc}) { public Member evaluateMember(Evaluator evaluator) { String memberName = memberNameCalc.evaluateString(evaluator); return strToMember(evaluator, memberName); } }; } Member strToMember(Evaluator evaluator, String memberName) { Cube cube = evaluator.getCube(); SchemaReader schemaReader = evaluator.getSchemaReader(); String[] uniqueNameParts = Util.explode(memberName); Member member = (Member) schemaReader.lookupCompound(cube, uniqueNameParts, true, Category.Member); // Member member = schemaReader.getMemberByUniqueName(uniqueNameParts, false); return member; } }); if (false) define(new FunDefBase( "ValidMeasure", "ValidMeasure(<Tuple>)", "Returns a valid measure in a virtual cube by forcing inapplicable dimensions to their top level.", "fm*") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); // // NUMERIC FUNCTIONS define(new AggregateFunDef.Resolver()); define(new MultiResolver( "$AggregateChildren", "$AggregateChildren(<Hierarchy>)", "Equivalent to 'Aggregate(<Hierarchy>.CurrentMember.Children); for internal use.", new String[] {"Inh"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public void unparse(Exp[] args, PrintWriter pw) { pw.print(getName()); pw.print("("); args[0].unparse(pw); pw.print(")"); } public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final HierarchyCalc hierarchyCalc = compiler.compileHierarchy(call.getArg(0)); final Calc valueCalc = new ValueCalc(call); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { Hierarchy hierarchy = hierarchyCalc.evaluateHierarchy(evaluator); return aggregateChildren(evaluator, hierarchy, valueCalc); } public Calc[] getCalcs() { return new Calc[] {hierarchyCalc, valueCalc}; } }; } Object aggregateChildren( Evaluator evaluator, Hierarchy hierarchy, final Calc valueFunCall) { Member member = evaluator.getParent().getContext(hierarchy.getDimension()); List members = (List) member.getPropertyValue( Property.CONTRIBUTING_CHILDREN.name); Aggregator aggregator = (Aggregator) evaluator.getProperty( Property.AGGREGATION_TYPE.name, null); if (aggregator == null) { throw FunUtil.newEvalException(null, "Could not find an aggregator in the current evaluation context"); } Aggregator rollup = aggregator.getRollup(); if (rollup == null) { throw FunUtil.newEvalException(null, "Don't know how to rollup aggregator '" + aggregator + "'"); } return rollup.aggregate(evaluator.push(), members, valueFunCall); } }; } }); define(new MultiResolver( "Avg", "Avg(<Set>[, <Numeric Expression>])", "Returns the average value of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc = call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1), true) : new ValueCalc(call); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return avg(evaluator.push(), memberList, calc); } public Calc[] getCalcs() { return new Calc[] {listCalc, calc}; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }); define(new MultiResolver( "Correlation", "Correlation(<Set>, <Numeric Expression>[, <Numeric Expression>])", "Returns the correlation of two series evaluated over a set.", new String[]{"fnxn","fnxnn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc1 = compiler.compileScalar(call.getArg(1), true); final Calc calc2 = call.getArgCount() > 2 ? compiler.compileScalar(call.getArg(2), true) : new ValueCalc(call); return new AbstractDoubleCalc(call, new Calc[] {listCalc, calc1, calc2}) { public double evaluateDouble(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return correlation(evaluator.push(), memberList, calc1, calc2); } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }); final String[] resWords = {"INCLUDEEMPTY", "EXCLUDEEMPTY"}; define(new MultiResolver( "Count", "Count(<Set>[, EXCLUDEEMPTY | INCLUDEEMPTY])", "Returns the number of tuples in a set, empty cells included unless the optional EXCLUDEEMPTY flag is used.", new String[]{"fnx", "fnxy"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc memberListCalc = compiler.compileList(call.getArg(0)); final boolean includeEmpty = call.getArgCount() < 2 || ((Literal) call.getArg(1)).getValue().equals( "INCLUDEEMPTY"); return new AbstractIntegerCalc( call, new Calc[] {memberListCalc}) { public int evaluateInteger(Evaluator evaluator) { List memberList = memberListCalc.evaluateList(evaluator); return count(evaluator, memberList, includeEmpty); } public boolean dependsOn(Dimension dimension) { // COUNT(<set>, INCLUDEEMPTY) is straightforward -- it // depends only on the dimensions that <Set> depends // on. if (super.dependsOn(dimension)) { return true; } if (includeEmpty) { return false; } // COUNT(<set>, EXCLUDEEMPTY) depends only on the // dimensions that <Set> depends on, plus all // dimensions not masked by the set. if (memberListCalc.getType().usesDimension(dimension, true) ) { return false; } return true; } }; } }; } public String[] getReservedWords() { return resWords; } }); define(new FunDefBase( "Count", "<Set>.Count", "Returns the number of tuples in a set including empty cells.", "pnx") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc memberListCalc = compiler.compileList(call.getArg(0)); return new AbstractIntegerCalc(call, new Calc[] {memberListCalc}) { public int evaluateInteger(Evaluator evaluator) { List memberList = memberListCalc.evaluateList(evaluator); return count(evaluator, memberList, true); } }; } }); define(new MultiResolver( "Covariance", "Covariance(<Set>, <Numeric Expression>[, <Numeric Expression>])", "Returns the covariance of two series evaluated over a set (biased).", new String[]{"fnxn","fnxnn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc1 = compiler.compileScalar(call.getArg(1), true); final Calc calc2 = call.getArgCount() > 2 ? compiler.compileScalar(call.getArg(2), true) : new ValueCalc(call); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return covariance(evaluator.push(), memberList, calc1, calc2, true); } public Calc[] getCalcs() { return new Calc[] {listCalc, calc1, calc2}; } }; } }; } }); define(new MultiResolver( "CovarianceN", "CovarianceN(<Set>, <Numeric Expression>[, <Numeric Expression>])", "Returns the covariance of two series evaluated over a set (unbiased).", new String[]{"fnxn","fnxnn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc1 = compiler.compileScalar(call.getArg(1), true); final Calc calc2 = call.getArgCount() > 2 ? compiler.compileScalar(call.getArg(2), true) : new ValueCalc(call); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return covariance(evaluator.push(), memberList, calc1, calc2, false); } public Calc[] getCalcs() { return new Calc[] {listCalc, calc1, calc2}; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }); define(new FunDefBase( "IIf", "IIf(<Logical Expression>, <String Expression1>, <String Expression2>)", "Returns one of two string values determined by a logical test.", "fSbSS") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final BooleanCalc booleanCalc = compiler.compileBoolean(call.getArg(0)); final StringCalc calc1 = compiler.compileString(call.getArg(1)); final StringCalc calc2 = compiler.compileString(call.getArg(2)); return new AbstractStringCalc(call, new Calc[] {booleanCalc, calc1, calc2}) { public String evaluateString(Evaluator evaluator) { final boolean b = booleanCalc.evaluateBoolean(evaluator); StringCalc calc = b ? calc1 : calc2; return calc.evaluateString(evaluator); } }; } }); define(new FunDefBase( "IIf", "IIf(<Logical Expression>, <Numeric Expression1>, <Numeric Expression2>)", "Returns one of two numeric values determined by a logical test.", "fnbnn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final BooleanCalc booleanCalc = compiler.compileBoolean(call.getArg(0)); final Calc calc1 = compiler.compileScalar(call.getArg(1), true); final Calc calc2 = compiler.compileScalar(call.getArg(2), true); return new GenericCalc(call) { public Object evaluate(Evaluator evaluator) { final boolean b = booleanCalc.evaluateBoolean(evaluator); Calc calc = b ? calc1 : calc2; return calc.evaluate(evaluator); } public Calc[] getCalcs() { return new Calc[] {booleanCalc, calc1, calc2}; } }; } }); define(new LinReg.InterceptFunDef.Resolver()); define(new LinReg.PointFunDef.Resolver()); define(new LinReg.R2FunDef.Resolver()); define(new LinReg.SlopeFunDef.Resolver()); define(new LinReg.VarianceFunDef.Resolver()); define(new MultiResolver( "Max", "Max(<Set>[, <Numeric Expression>])", "Returns the maximum value of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc = call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1), true) : new ValueCalc(call); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return max(evaluator.push(), memberList, calc); } public Calc[] getCalcs() { return new Calc[] {listCalc, calc}; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }); define(new MultiResolver( "Median", "Median(<Set>[, <Numeric Expression>])", "Returns the median value of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc = call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1), true) : new ValueCalc(call); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return median(evaluator.push(), memberList, calc); } public Calc[] getCalcs() { return new Calc[] {listCalc, calc}; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }); define(new MultiResolver( "Min", "Min(<Set>[, <Numeric Expression>])", "Returns the minimum value of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc = call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1), true) : new ValueCalc(call); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return min(evaluator.push(), memberList, calc); } public Calc[] getCalcs() { return new Calc[] {listCalc, calc}; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }); define(new FunDefBase( "Ordinal", "<Level>.Ordinal", "Returns the zero-based ordinal value associated with a level.", "pnl") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final LevelCalc levelCalc = compiler.compileLevel(call.getArg(0)); return new AbstractIntegerCalc(call, new Calc[] {levelCalc}) { public int evaluateInteger(Evaluator evaluator) { final Level level = levelCalc.evaluateLevel(evaluator); return level.getDepth(); } }; } }); define(RankFunDef.createResolver()); define(new CacheFunDef.CacheFunResolver()); final MultiResolver stdevResolver = new MultiResolver( "Stdev", "Stdev(<Set>[, <Numeric Expression>])", "Returns the standard deviation of a numeric expression evaluated over a set (unbiased).", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc = call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1), true) : new ValueCalc(call); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return stdev(evaluator.push(), memberList, calc, false); } public Calc[] getCalcs() { return new Calc[] {listCalc, calc}; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }; define(stdevResolver); define(new MultiResolver( "Stddev", "Stddev(<Set>[, <Numeric Expression>])", "Alias for Stdev.", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return stdevResolver.createFunDef(args, dummyFunDef); } }); final MultiResolver stdevpResolver = new MultiResolver( "StdevP", "StdevP(<Set>[, <Numeric Expression>])", "Returns the standard deviation of a numeric expression evaluated over a set (biased).", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc = call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1), true) : new ValueCalc(call); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return stdev(evaluator.push(), memberList, calc, true); } public Calc[] getCalcs() { return new Calc[] {listCalc, calc}; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }; define(stdevpResolver); define(new MultiResolver( "StddevP", "StddevP(<Set>[, <Numeric Expression>])", "Alias for StdevP.", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return stdevpResolver.createFunDef(args, dummyFunDef); } }); define(new MultiResolver( "Sum", "Sum(<Set>[, <Numeric Expression>])", "Returns the sum of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc = call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1), true) : new ValueCalc(call); return new AbstractDoubleCalc(call, new Calc[] {listCalc, calc}) { public double evaluateDouble(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return sumDouble(evaluator.push(), memberList, calc); } public Calc[] getCalcs() { return new Calc[] {listCalc, calc}; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }); define(new FunDefBase( "Value", "<Measure>.Value", "Returns the value of a measure.", "pnm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); Member old = evaluator.setContext(member); Object value = evaluator.evaluateCurrent(); evaluator.setContext(old); return value; } public boolean dependsOn(Dimension dimension) { if (super.dependsOn(dimension)) { return true; } if (memberCalc.getType().usesDimension(dimension, true) ) { return false; } return true; } public Calc[] getCalcs() { return new Calc[] {memberCalc}; } }; } }); final MultiResolver varResolver = new MultiResolver( "Var", "Var(<Set>[, <Numeric Expression>])", "Returns the variance of a numeric expression evaluated over a set (unbiased).", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc = call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1), true) : new ValueCalc(call); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return var(evaluator.push(), memberList, calc, false); } public Calc[] getCalcs() { return new Calc[] {listCalc, calc}; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }; define(varResolver); define(new MultiResolver( "Variance", "Variance(<Set>[, <Numeric Expression>])", "Alias for Var.", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return varResolver.createFunDef(args, dummyFunDef); } }); final MultiResolver variancepResolver = new MultiResolver( "VarianceP", "VarianceP(<Set>[, <Numeric Expression>])", "Alias for VarP.", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final Calc calc = call.getArgCount() > 1 ? compiler.compileScalar(call.getArg(1), true) : new ValueCalc(call); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { List memberList = listCalc.evaluateList(evaluator); return var(evaluator.push(), memberList, calc, true); } public Calc[] getCalcs() { return new Calc[] {listCalc, calc}; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }; define(variancepResolver); define(new MultiResolver( "VarP", "VarP(<Set>[, <Numeric Expression>])", "Returns the variance of a numeric expression evaluated over a set (biased).", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return variancepResolver.createFunDef(args, dummyFunDef); } }); // // SET FUNCTIONS /* * AddCalculatedMembers adds calculated members that are siblings * of the members in the set. The set is limited to one dimension. */ define(new FunDefBase( "AddCalculatedMembers", "AddCalculatedMembers(<Set>)", "Adds calculated members to a set.", "fxx") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {listCalc}) { public List evaluateList(Evaluator evaluator) { final List list = listCalc.evaluateList(evaluator); return addCalculatedMembers(list, evaluator); } }; } private List addCalculatedMembers(List memberList, Evaluator evaluator) { // Determine unique levels in the set Map levelMap = new HashMap(); Dimension dim = null; Iterator it = memberList.iterator(); while (it.hasNext()) { Object obj = it.next(); if (!(obj instanceof Member)) { throw newEvalException(this, "Only single dimension members allowed in set for AddCalculatedMembers"); } Member member = (Member) obj; if (dim == null) { dim = member.getDimension(); } else if (dim != member.getDimension()) { throw newEvalException(this, "Only members from the same dimension are allowed in the AddCalculatedMembers set: " + dim.toString() + " vs " + member.getDimension().toString()); } if (!levelMap.containsKey(member.getLevel())) { levelMap.put(member.getLevel(), null); } } /* * For each level, add the calculated members from both * the schema and the query */ List workingList = new ArrayList(memberList); final SchemaReader schemaReader = evaluator.getQuery().getSchemaReader(true); it = levelMap.keySet().iterator(); while (it.hasNext()) { Level level = (Level) it.next(); List calcMemberList = schemaReader.getCalculatedMembers(level); workingList.addAll(calcMemberList); } memberList = workingList; return memberList; } }); define(new FunDefBase( "Ascendants", "Ascendants(<Member>)", "Returns the set of the ascendants of a specified member.", "fxm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {memberCalc}) { public List evaluateList(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); return ascendants(member); } }; } List ascendants(Member member) { if (member.isNull()) { return Collections.EMPTY_LIST; } Member[] members = member.getAncestorMembers(); final List result = new ArrayList(members.length + 1); result.add(member); XOMUtil.addAll(result, members); return result; } }); define(new MultiResolver( "BottomCount", "BottomCount(<Set>, <Count>[, <Numeric Expression>])", "Returns a specified number of items from the bottom of a set, optionally ordering the set first.", new String[]{"fxxnn", "fxxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(final ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final IntegerCalc integerCalc = compiler.compileInteger(call.getArg(1)); final Calc orderCalc = call.getArgCount() > 2 ? compiler.compileScalar(call.getArg(2), true) : null; return new AbstractListCalc(call, new Calc[] {listCalc, integerCalc, orderCalc}) { public List evaluateList(Evaluator evaluator) { // Use a native evaluator, if more efficient. // TODO: Figure this out at compile time. SchemaReader schemaReader = evaluator.getSchemaReader(); NativeEvaluator nativeEvaluator = schemaReader.getNativeSetEvaluator(call.getFunDef(), evaluator, call.getArgs()); if (nativeEvaluator != null) { return (List) nativeEvaluator.execute(); } List list = listCalc.evaluateList(evaluator); int n = integerCalc.evaluateInteger(evaluator); if (orderCalc != null) { boolean desc = false, brk = true; sort(evaluator.push(), list, orderCalc, desc, brk); } if (n < list.size()) { list = list.subList(0, n); } return list; } }; } }; } }); define(new MultiResolver( "BottomPercent", "BottomPercent(<Set>, <Percentage>, <Numeric Expression>)", "Sorts a set and returns the bottom N elements whose cumulative total is at least a specified percentage.", new String[]{"fxxnn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final DoubleCalc doubleCalc = compiler.compileDouble(call.getArg(1)); final Calc calc = compiler.compileScalar(call.getArg(2), true); return new AbstractListCalc(call, new Calc[] {listCalc, doubleCalc, calc}) { public List evaluateList(Evaluator evaluator) { List list = listCalc.evaluateList(evaluator); double n = doubleCalc.evaluateDouble(evaluator); return topOrBottom(evaluator.push(), list, calc, false, true, n); } }; } }; } }); define(new MultiResolver( "BottomSum", "BottomSum(<Set>, <Value>, <Numeric Expression>)", "Sorts a set and returns the bottom N elements whose cumulative total is at least a specified value.", new String[]{"fxxnn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final DoubleCalc doubleCalc = compiler.compileDouble(call.getArg(1)); final Calc calc = compiler.compileScalar(call.getArg(2), true); return new AbstractListCalc(call, new Calc[] {listCalc, doubleCalc, calc}) { public List evaluateList(Evaluator evaluator) { List list = listCalc.evaluateList(evaluator); double n = doubleCalc.evaluateDouble(evaluator); return topOrBottom(evaluator.push(), list, calc, false, false, n); } }; } }; } }); define(new FunDefBase( "Children", "<Member>.Children", "Returns the children of a member.", "pxm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {memberCalc}) { public List evaluateList(Evaluator evaluator) { Member member = memberCalc.evaluateMember(evaluator); Member[] children = getNonEmptyMemberChildren(evaluator, member); return Arrays.asList(children); } }; } }); define(new MultiResolver( "Crossjoin", "Crossjoin(<Set1>, <Set2>)", "Returns the cross product of two sets.", new String[]{"fxxx"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new CrossJoinFunDef(dummyFunDef); } }); define(new MultiResolver( "NonEmptyCrossJoin", "NonEmptyCrossJoin(<Set1>, <Set2>)", "Returns the cross product of two sets, excluding empty tuples and tuples without associated fact table data.", new String[]{"fxxx"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new NonEmptyCrossJoinFunDef(dummyFunDef); } }); define(new MultiResolver( "*", "<Set1> * <Set2>", "Returns the cross product of two sets.", new String[]{"ixxx", "ixmx", "ixxm", "ixmm"}) { public FunDef resolve( Exp[] args, Validator validator, int[] conversionCount) { // This function only applies in contexts which require a set. // Elsewhere, "*" is the multiplication operator. // This means that [Measures].[Unit Sales] * [Gender].[M] is // well-defined. if (validator.requiresExpression()) { return null; } return super.resolve(args, validator, conversionCount); } protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new CrossJoinFunDef(dummyFunDef); } }); define(new DescendantsFunDef.Resolver()); define(new FunDefBase( "Distinct", "Distinct(<Set>)", "Eliminates duplicate tuples from a set.", "fxx") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {listCalc}) { public List evaluateList(Evaluator evaluator) { List list = listCalc.evaluateList(evaluator); return distinct(list); } }; } List distinct(List list) { HashSet hashSet = new HashSet(list.size()); Iterator iter = list.iterator(); List result = new ArrayList(); while (iter.hasNext()) { Object element = iter.next(); MemberHelper lookupObj = new MemberHelper(element); if (hashSet.add(lookupObj)) { result.add(element); } } return result; } }); define(new MultiResolver( "DrilldownLevel", "DrilldownLevel(<Set>[, <Level>]) or DrilldownLevel(<Set>, , <Index>)", "Drills down the members of a set, at a specified level, to one level below. Alternatively, drills down on a specified dimension in the set.", new String[]{"fxx", "fxxl"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final LevelCalc levelCalc = call.getArgCount() > 1 ? compiler.compileLevel(call.getArg(1)) : null; return new AbstractListCalc(call, new Calc[] {listCalc, levelCalc}) { public List evaluateList(Evaluator evaluator) { List list = listCalc.evaluateList(evaluator); if (list.size() == 0) { return list; } int searchDepth = -1; if (levelCalc != null) { Level level = levelCalc.evaluateLevel(evaluator); searchDepth = level.getDepth(); } return drill(searchDepth, list, evaluator); } }; } List drill(int searchDepth, List list, Evaluator evaluator) { if (searchDepth == -1) { searchDepth = ((Member)list.get(0)).getLevel().getDepth(); for (int i = 1, m = list.size(); i < m; i++) { Member member = (Member) list.get(i); int memberDepth = member.getLevel().getDepth(); if (memberDepth > searchDepth) { searchDepth = memberDepth; } } } List drilledSet = new ArrayList(); for (int i = 0, m = list.size(); i < m; i++) { Member member = (Member) list.get(i); drilledSet.add(member); Member nextMember = i == (m - 1) ? null : (Member) list.get(i + 1); // // This member is drilled if it's at the correct depth // and if it isn't drilled yet. A member is considered // to be "drilled" if it is immediately followed by // at least one descendant // if (member.getLevel().getDepth() == searchDepth && !FunUtil.isAncestorOf(member, nextMember, true)) { Member[] childMembers = evaluator.getSchemaReader().getMemberChildren(member); for (int j = 0; j < childMembers.length; j++) { drilledSet.add(childMembers[j]); } } } return drilledSet; } }; } }); if (false) define(new FunDefBase( "DrilldownLevelBottom", "DrilldownLevelBottom(<Set>, <Count>[, [<Level>][, <Numeric Expression>]])", "Drills down the bottom N members of a set, at a specified level, to one level below.", "fx*") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); if (false) define(new FunDefBase( "DrilldownLevelTop", "DrilldownLevelTop(<Set>, <Count>[, [<Level>][, <Numeric Expression>]])", "Drills down the top N members of a set, at a specified level, to one level below.", "fx*") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); define(new DrilldownMemberFunDef.Resolver()); if (false) define(new FunDefBase( "DrilldownMemberBottom", "DrilldownMemberBottom(<Set1>, <Set2>, <Count>[, [<Numeric Expression>][, RECURSIVE]])", "Like DrilldownMember except that it includes only the bottom N children.", "fx*") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); if (false) define(new FunDefBase( "DrilldownMemberTop", "DrilldownMemberTop(<Set1>, <Set2>, <Count>[, [<Numeric Expression>][, RECURSIVE]])", "Like DrilldownMember except that it includes only the top N children.", "fx*") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); if (false) define(new FunDefBase( "DrillupLevel", "DrillupLevel(<Set>[, <Level>])", "Drills up the members of a set that are below a specified level.", "fx*") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); if (false) define(new FunDefBase( "DrillupMember", "DrillupMember(<Set1>, <Set2>)", "Drills up the members in a set that are present in a second specified set.", "fx*") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); define(new MultiResolver( "Except", "Except(<Set1>, <Set2>[, ALL])", "Finds the difference between two sets, optionally retaining duplicates.", new String[]{"fxxx", "fxxxy"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { // todo: implement ALL final ListCalc listCalc1 = compiler.compileList(call.getArg(0)); final ListCalc listCalc2 = compiler.compileList(call.getArg(1)); return new AbstractListCalc(call, new Calc[] {listCalc1, listCalc2}) { public List evaluateList(Evaluator evaluator) { List list1 = listCalc1.evaluateList(evaluator); List list2 = listCalc2.evaluateList(evaluator); return except(list1, list2); } }; } List except(final List list0, final List list1) { HashSet set = new HashSet(list1); List result = new ArrayList(); for (int i = 0, count = list0.size(); i < count; i++) { Object o = list0.get(i); if (!set.contains(o)) { result.add(o); } } return result; } }; } }); if (false) define(new FunDefBase( "Extract", "Extract(<Set>, <Dimension>[, <Dimension>...])", "Returns a set of tuples from extracted dimension elements. The opposite of Crossjoin.", "fx*") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); define(new FunDefBase( "Filter", "Filter(<Set>, <Search Condition>)", "Returns the set resulting from filtering a set based on a search condition.", "fxxb") { public Calc compileCall(final ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final BooleanCalc calc = compiler.compileBoolean(call.getArg(1)); if (((SetType) listCalc.getType()).getElementType() instanceof MemberType) { return new AbstractListCalc(call, new Calc[] {listCalc, calc}) { public List evaluateList(Evaluator evaluator) { // Use a native evaluator, if more efficient. // TODO: Figure this out at compile time. SchemaReader schemaReader = evaluator.getSchemaReader(); NativeEvaluator nativeEvaluator = schemaReader.getNativeSetEvaluator(call.getFunDef(), evaluator, call.getArgs()); if (nativeEvaluator != null) { return (List) nativeEvaluator.execute(); } List members = listCalc.evaluateList(evaluator); List result = new ArrayList(); Evaluator evaluator2 = evaluator.push(); for (int i = 0, count = members.size(); i < count; i++) { Member member = (Member) members.get(i); evaluator2.setContext(member); if (calc.evaluateBoolean(evaluator2)) { result.add(member); } } return result; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } else { return new AbstractListCalc(call, new Calc[] {listCalc, calc}) { public List evaluateList(Evaluator evaluator) { // Use a native evaluator, if more efficient. // TODO: Figure this out at compile time. SchemaReader schemaReader = evaluator.getSchemaReader(); NativeEvaluator nativeEvaluator = schemaReader.getNativeSetEvaluator(call.getFunDef(), evaluator, call.getArgs()); if (nativeEvaluator != null) { return (List) nativeEvaluator.execute(); } List tupleList = listCalc.evaluateList(evaluator); List result = new ArrayList(); Evaluator evaluator2 = evaluator.push(); for (int i = 0, count = tupleList.size(); i < count; i++) { Member[] members = (Member []) tupleList.get(i); evaluator2.setContext(members); if (calc.evaluateBoolean(evaluator2)) { result.add(members); } } return result; } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } } }); define(new MultiResolver( "Generate", "Generate(<Set1>, <Set2>[, ALL])", "Applies a set to each member of another set and joins the resulting sets by union.", new String[] {"fxxx", "fxxxy"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { final boolean all = getLiteralArg(args, 2, "", new String[] {"ALL"}, dummyFunDef).equalsIgnoreCase("ALL"); return new FunDefBase(dummyFunDef) { public Type getResultType(Validator validator, Exp[] args) { final Type type = args[1].getType(); final Type memberType = TypeUtil.toMemberOrTupleType(type); return new SetType(memberType); } public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc1 = compiler.compileList(call.getArg(0)); final ListCalc listCalc2 = compiler.compileList(call.getArg(1)); return new AbstractListCalc(call, new Calc[] {listCalc1, listCalc2}) { public List evaluateList(Evaluator evaluator) { final List list1 = listCalc1.evaluateList(evaluator); return generate(evaluator, list1, listCalc2, all); } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } List generate( Evaluator evaluator, List members, final ListCalc listCalc, final boolean all) { final Evaluator evaluator2 = evaluator.push(); List result = new ArrayList(); HashSet emitted = all ? null : new HashSet(); for (int i = 0; i < members.size(); i++) { Object o = members.get(i); if (o instanceof Member) { evaluator2.setContext((Member) o); } else { evaluator2.setContext((Member[]) o); } final List result2 = listCalc.evaluateList(evaluator2); if (all) { result.addAll(result2); } else { for (int j = 0; j < result2.size(); j++) { Object row = result2.get(j); if (emitted.add(row)) { result.add(row); } } } } return result; } }; } }); define(new MultiResolver( "Head", "Head(<Set>[, < Numeric Expression >])", "Returns the first specified number of elements in a set.", new String[] {"fxx", "fxxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final IntegerCalc integerCalc = call.getArgCount() > 1 ? compiler.compileInteger(call.getArg(1)) : ConstantCalc.constantInteger(1); return new AbstractListCalc(call, new Calc[] {listCalc, integerCalc}) { public List evaluateList(Evaluator evaluator) { List list = listCalc.evaluateList(evaluator); int count = integerCalc.evaluateInteger(evaluator); return head(count, list); } }; } List head(final int count, List members) { assert members != null; if (count >= members.size()) { return members; } if (count <= 0) { return Collections.EMPTY_LIST; } return members.subList(0, count); } }; } }); final String[] prePost = {"PRE","POST"}; define(new MultiResolver( "Hierarchize", "Hierarchize(<Set>[, POST])", "Orders the members of a set in a hierarchy.", new String[] {"fxx", "fxxy"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { String order = getLiteralArg(args, 1, "PRE", prePost, dummyFunDef); final boolean post = order.equals("POST"); return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {listCalc}) { public List evaluateList(Evaluator evaluator) { List list = listCalc.evaluateList(evaluator); hierarchize(list, post); return list; } }; } }; } public String[] getReservedWords() { return prePost; } }); define(new MultiResolver( "Intersect", "Intersect(<Set1>, <Set2>[, ALL])", "Returns the intersection of two input sets, optionally retaining duplicates.", new String[] {"fxxxy", "fxxx"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { final boolean all = getLiteralArg(args, 2, "", new String[] {"ALL"}, dummyFunDef).equalsIgnoreCase("ALL"); return new IntersectFunDef(dummyFunDef, all); } }); define(new MultiResolver( "LastPeriods", "LastPeriods(<Index> [, <Member>])", "Returns a set of members prior to and including a specified member.", new String[] {"fxn", "fxnm"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Type getResultType(Validator validator, Exp[] args) { if (args.length == 1) { // If Member is not specified, // it is Time.CurrentMember. Hierarchy hierarchy = validator.getQuery() .getCube().getTimeDimension() .getHierarchy(); return new SetType(MemberType.forHierarchy(hierarchy)); } else { Type type = args[1].getType(); Type memberType = TypeUtil.toMemberOrTupleType(type); return new SetType(memberType); } } public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { // Member defaults to [Time].currentmember Exp[] args = call.getArgs(); final MemberCalc memberCalc; if (args.length == 1) { Dimension timeDimension = compiler.getEvaluator().getCube() .getTimeDimension(); memberCalc = new DimensionCurrentMemberCalc( timeDimension); } else { memberCalc = compiler.compileMember(args[1]); } // Numeric Expression. final IntegerCalc indexValueCalc = compiler.compileInteger(args[0]); return new AbstractListCalc(call, new Calc[] {memberCalc, indexValueCalc}) { public List evaluateList(Evaluator evaluator) { Member member = memberCalc.evaluateMember( evaluator); int indexValue = indexValueCalc.evaluateInteger( evaluator); return lastPeriods(member, evaluator, indexValue); } }; } /* If Index is positive, returns the set of Index members ending with Member and starting with the member lagging Index - 1 from Member. If Index is negative, returns the set of (- Index) members starting with Member and ending with the member leading (- Index - 1) from Member. If Index is zero, the empty set is returned. */ List lastPeriods( Member member, Evaluator evaluator, int indexValue) { // empty set if ((indexValue == 0) || member.isNull()) { return Collections.EMPTY_LIST; } List list = new ArrayList(); // set with just member if ((indexValue == 1) || (indexValue == -1)) { list.add(member); return list; } // When null is found, getting the first/last // member at a given level is not particularly // fast. Member startMember; Member endMember; if (indexValue > 0) { startMember = evaluator.getSchemaReader() .getLeadMember(member, -(indexValue-1)); endMember = member; if (startMember.isNull()) { Member[] members = evaluator.getSchemaReader() .getLevelMembers(member.getLevel(), false); startMember = members[0]; } } else { startMember = member; endMember = evaluator.getSchemaReader() .getLeadMember(member, -(indexValue+1)); if (endMember.isNull()) { Member[] members = evaluator.getSchemaReader() .getLevelMembers(member.getLevel(), false); endMember = members[members.length - 1]; } } evaluator.getSchemaReader(). getMemberRange(member.getLevel(), startMember, endMember, list); return list; } }; } }); define(new FunDefBase( "Members", "<Dimension>.Members", "Returns the set of members in a dimension.", "pxd") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DimensionCalc dimensionCalc = compiler.compileDimension(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {dimensionCalc}) { public List evaluateList(Evaluator evaluator) { Dimension dimension = dimensionCalc.evaluateDimension(evaluator); return dimensionMembers(dimension, evaluator, false); } }; } }); define(new FunDefBase( "AllMembers", "<Dimension>.AllMembers", "Returns a set that contains all members, including calculated members, of the specified dimension.", "pxd") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DimensionCalc dimensionCalc = compiler.compileDimension(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {dimensionCalc}) { public List evaluateList(Evaluator evaluator) { Dimension dimension = dimensionCalc.evaluateDimension(evaluator); return dimensionMembers(dimension, evaluator, true); } }; } }); define(new FunDefBase( "Members", "<Hierarchy>.Members", "Returns the set of members in a hierarchy.", "pxh") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final HierarchyCalc hierarchyCalc = compiler.compileHierarchy(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {hierarchyCalc}) { public List evaluateList(Evaluator evaluator) { Hierarchy hierarchy = hierarchyCalc.evaluateHierarchy(evaluator); return hierarchyMembers(hierarchy, evaluator, false); } }; } }); define(new FunDefBase( "AllMembers", "<Hierarchy>.AllMembers", "Returns a set that contains all members, including calculated members, of the specified hierarchy.", "pxh") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final HierarchyCalc hierarchyCalc = compiler.compileHierarchy(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {hierarchyCalc}) { public List evaluateList(Evaluator evaluator) { Hierarchy hierarchy = hierarchyCalc.evaluateHierarchy(evaluator); return hierarchyMembers(hierarchy, evaluator, true); } }; } }); define(new FunDefBase( "Members", "<Level>.Members", "Returns the set of members in a level.", "pxl") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final LevelCalc levelCalc = compiler.compileLevel(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {levelCalc}) { public List evaluateList(Evaluator evaluator) { Level level = levelCalc.evaluateLevel(evaluator); return levelMembers(level, evaluator, false); } }; } }); define(new FunDefBase( "AllMembers", "<Level>.AllMembers", "Returns a set that contains all members, including calculated members, of the specified level.", "pxl") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final LevelCalc levelCalc = compiler.compileLevel(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {levelCalc}) { public List evaluateList(Evaluator evaluator) { Level level = levelCalc.evaluateLevel(evaluator); return levelMembers(level, evaluator, true); } }; } }); define(new XtdFunDef.Resolver( "Mtd", "Mtd([<Member>])", "A shortcut function for the PeriodsToDate function that specifies the level to be Month.", new String[]{"fx", "fxm"}, mondrian.olap.LevelType.TimeMonths)); define(new OrderFunDef.OrderResolver()); define(new MultiResolver( "PeriodsToDate", "PeriodsToDate([<Level>[, <Member>]])", "Returns a set of periods (members) from a specified level starting with the first period and ending with a specified member.", new String[]{"fx", "fxl", "fxlm"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Type getResultType(Validator validator, Exp[] args) { if (args.length == 0) { // With no args, the default implementation cannot // guess the hierarchy. Hierarchy hierarchy = validator.getQuery() .getCube().getTimeDimension() .getHierarchy(); return new SetType( MemberType.forHierarchy(hierarchy)); } final Type type = args[0].getType(); if (type.getHierarchy().getDimension() .getDimensionType() != mondrian.olap.DimensionType.TimeDimension) { throw MondrianResource.instance().TimeArgNeeded.ex(getName()); } return super.getResultType(validator, args); } public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final LevelCalc levelCalc = call.getArgCount() > 0 ? compiler.compileLevel(call.getArg(0)) : null; final MemberCalc memberCalc = call.getArgCount() > 1 ? compiler.compileMember(call.getArg(1)) : null; final Dimension timeDimension = compiler .getEvaluator().getCube().getTimeDimension(); return new AbstractListCalc(call, new Calc[] {levelCalc, memberCalc}) { public List evaluateList(Evaluator evaluator) { final Member member; final Level level; if (levelCalc == null) { member = evaluator.getContext(timeDimension); level = member.getLevel().getParentLevel(); } else { level = levelCalc.evaluateLevel(evaluator); if (memberCalc == null) { member = evaluator.getContext( level.getHierarchy().getDimension()); } else { member = memberCalc.evaluateMember(evaluator); } } return periodsToDate(evaluator, level, member); } public boolean dependsOn(Dimension dimension) { if (super.dependsOn(dimension)) { return true; } if (memberCalc != null) { return false; } else if (levelCalc != null) { return levelCalc.getType().usesDimension(dimension, true) ; } else { return dimension == timeDimension; } } }; } }; } }); define(new XtdFunDef.Resolver( "Qtd", "Qtd([<Member>])", "A shortcut function for the PeriodsToDate function that specifies the level to be Quarter.", new String[]{"fx", "fxm"}, mondrian.olap.LevelType.TimeQuarters)); define(new FunDefBase( "StripCalculatedMembers", "StripCalculatedMembers(<Set>)", "Removes calculated members from a set.", "fxx") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {listCalc}) { public List evaluateList(Evaluator evaluator) { final List list = listCalc.evaluateList(evaluator); if (list != null) { removeCalculatedMembers(list); } return list; } }; } }); define(new FunDefBase( "Siblings", "<Member>.Siblings", "Returns the siblings of a specified member, including the member itself.", "pxm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractListCalc(call, new Calc[] {memberCalc}) { public List evaluateList(Evaluator evaluator) { final Member member = memberCalc.evaluateMember(evaluator); return memberSiblings(member, evaluator); } }; } List memberSiblings(Member member, Evaluator evaluator) { if (member.isNull()) { // the null member has no siblings -- not even itself return Collections.EMPTY_LIST; } Member parent = member.getParentMember(); final SchemaReader schemaReader = evaluator.getSchemaReader(); Member[] siblings = (parent == null) ? schemaReader.getHierarchyRootMembers(member.getHierarchy()) : schemaReader.getMemberChildren(parent); return Arrays.asList(siblings); } }); define(new StrToSetFunDef.Resolver()); define(new MultiResolver( "Subset", "Subset(<Set>, <Start>[, <Count>])", "Returns a subset of elements from a set.", new String[] {"fxxn", "fxxnn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final IntegerCalc startCalc = compiler.compileInteger(call.getArg(1)); final IntegerCalc countCalc = call.getArgCount() > 2 ? compiler.compileInteger(call.getArg(2)) : null; return new AbstractListCalc(call, new Calc[] {listCalc, startCalc, countCalc}) { public List evaluateList(Evaluator evaluator) { final List list = listCalc.evaluateList(evaluator); final int start = startCalc.evaluateInteger(evaluator); int end; if (countCalc != null) { final int count = countCalc.evaluateInteger(evaluator); end = start + count; } else { end = list.size(); } if (end > list.size()) { end = list.size(); } if (start >= end || start < 0) { return Collections.EMPTY_LIST; } assert 0 <= start; assert start < end; assert end <= list.size(); if (start == 0 && end == list.size()) { return list; } else { return list.subList(start, end); } } }; } }; } }); define(new MultiResolver( "Tail", "Tail(<Set>[, <Count>])", "Returns a subset from the end of a set.", new String[] {"fxx", "fxxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final IntegerCalc integerCalc = call.getArgCount() > 1 ? compiler.compileInteger(call.getArg(1)) : ConstantCalc.constantInteger(1); return new AbstractListCalc(call, new Calc[] {listCalc, integerCalc}) { public List evaluateList(Evaluator evaluator) { List list = listCalc.evaluateList(evaluator); int count = integerCalc.evaluateInteger(evaluator); return tail(count, list); } }; } List tail(final int count, List members) { assert members != null; if (count >= members.size()) { return members; } if (count <= 0) { return Collections.EMPTY_LIST; } return members.subList(members.size() - count, members.size()); } }; } }); define(new MultiResolver( "ToggleDrillState", "ToggleDrillState(<Set1>, <Set2>[, RECURSIVE])", "Toggles the drill state of members. This function is a combination of DrillupMember and DrilldownMember.", new String[]{"fxxx", "fxxxy"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { if (call.getArgCount() > 2) { throw MondrianResource.instance().ToggleDrillStateRecursiveNotSupported.ex(); } final ListCalc listCalc0 = compiler.compileList(call.getArg(0)); final ListCalc listCalc1 = compiler.compileList(call.getArg(1)); return new AbstractListCalc(call, new Calc[] {listCalc0, listCalc1}) { public List evaluateList(Evaluator evaluator) { final List list0 = listCalc0.evaluateList(evaluator); final List list1 = listCalc1.evaluateList(evaluator); return toggleDrillState(evaluator, list0, list1); } }; } List toggleDrillState(Evaluator evaluator, List v0, List list1) { if (list1.isEmpty()) { return v0; } if (v0.isEmpty()) { return v0; } HashSet set = new HashSet(); set.addAll(list1); HashSet set1 = set; List result = new ArrayList(); int i = 0, n = v0.size(); while (i < n) { Object o = v0.get(i++); result.add(o); Member m = null; int k = -1; if (o instanceof Member) { if (!set1.contains(o)) { continue; } m = (Member) o; k = -1; } else { Util.assertTrue(o instanceof Member[]); Member[] members = (Member[]) o; for (int j = 0; j < members.length; j++) { Member member = members[j]; if (set1.contains(member)) { k = j; m = member; break; } } if (k == -1) { continue; } } boolean isDrilledDown = false; if (i < n) { Object next = v0.get(i); Member nextMember = (k < 0) ? (Member) next : ((Member[]) next)[k]; boolean strict = true; if (FunUtil.isAncestorOf(m, nextMember, strict)) { isDrilledDown = true; } } if (isDrilledDown) { // skip descendants of this member do { Object next = v0.get(i); Member nextMember = (k < 0) ? (Member) next : ((Member[]) next)[k]; boolean strict = true; if (FunUtil.isAncestorOf(m, nextMember, strict)) { i++; } else { break; } } while (i < n); } else { Member[] children = evaluator.getSchemaReader().getMemberChildren(m); for (int j = 0; j < children.length; j++) { if (k < 0) { result.add(children[j]); } else { Member[] members = (Member[]) ((Member[]) o).clone(); members[k] = children[j]; result.add(members); } } } } return result; } }; } public String[] getReservedWords() { return new String[] {"RECURSIVE"}; } }); define(new MultiResolver( "TopCount", "TopCount(<Set>, <Count>[, <Numeric Expression>])", "Returns a specified number of items from the top of a set, optionally ordering the set first.", new String[]{"fxxnn", "fxxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(final ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final IntegerCalc integerCalc = compiler.compileInteger(call.getArg(1)); final Calc orderCalc = call.getArgCount() > 2 ? compiler.compileScalar(call.getArg(2), true) : null; return new AbstractListCalc(call, new Calc[] {listCalc, integerCalc, orderCalc}) { public List evaluateList(Evaluator evaluator) { // Use a native evaluator, if more efficient. // TODO: Figure this out at compile time. SchemaReader schemaReader = evaluator.getSchemaReader(); NativeEvaluator nativeEvaluator = schemaReader.getNativeSetEvaluator(call.getFunDef(), evaluator, call.getArgs()); if (nativeEvaluator != null) { return (List) nativeEvaluator.execute(); } List list = listCalc.evaluateList(evaluator); int n = integerCalc.evaluateInteger(evaluator); if (orderCalc != null) { boolean desc = true, brk = true; sort(evaluator.push(), list, orderCalc, desc, brk); } if (n < list.size()) { list = list.subList(0, n); } return list; } }; } }; } }); define(new MultiResolver( "TopPercent", "TopPercent(<Set>, <Percentage>, <Numeric Expression>)", "Sorts a set and returns the top N elements whose cumulative total is at least a specified percentage.", new String[]{"fxxnn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final DoubleCalc doubleCalc = compiler.compileDouble(call.getArg(1)); final Calc calc = compiler.compileScalar(call.getArg(2), true); return new AbstractListCalc(call, new Calc[] {listCalc, doubleCalc, calc}) { public List evaluateList(Evaluator evaluator) { List list = listCalc.evaluateList(evaluator); double n = doubleCalc.evaluateDouble(evaluator); return topOrBottom(evaluator.push(), list, calc, true, true, n); } }; } }; } }); define(new MultiResolver( "TopSum", "TopSum(<Set>, <Value>, <Numeric Expression>)", "Sorts a set and returns the top N elements whose cumulative total is at least a specified value.", new String[]{"fxxnn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final DoubleCalc doubleCalc = compiler.compileDouble(call.getArg(1)); final Calc calc = compiler.compileScalar(call.getArg(2), true); return new AbstractListCalc(call, new Calc[] {listCalc, doubleCalc, calc}) { public List evaluateList(Evaluator evaluator) { List list = listCalc.evaluateList(evaluator); double n = doubleCalc.evaluateDouble(evaluator); return topOrBottom(evaluator.push(), list, calc, true, false, n); } }; } }; } }); final String[] allDistinct = new String[] {"ALL", "DISTINCT"}; define(new MultiResolver( "Union", "Union(<Set1>, <Set2>[, ALL])", "Returns the union of two sets, optionally retaining duplicates.", new String[] {"fxxx", "fxxxy"}) { public String[] getReservedWords() { return allDistinct; } protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { String allString = getLiteralArg(args, 2, "DISTINCT", allDistinct, dummyFunDef); final boolean all = allString.equalsIgnoreCase("ALL"); checkCompatible(args[0], args[1], dummyFunDef); return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc0 = compiler.compileList(call.getArg(0)); final ListCalc listCalc1 = compiler.compileList(call.getArg(1)); return new AbstractListCalc(call, new Calc[] {listCalc0, listCalc1}) { public List evaluateList(Evaluator evaluator) { List list0 = listCalc0.evaluateList(evaluator); List list1 = listCalc1.evaluateList(evaluator); return union(list0, list1, all); } }; } List union(List list0, List list1, final boolean all) { assert list0 != null; assert list1 != null; if (all) { if (list0.isEmpty()) { return list1; } list0.addAll(list1); return list0; } else { Set added = new HashSet(); List result = new ArrayList(); FunUtil.addUnique(result, list0, added); FunUtil.addUnique(result, list1, added); return result; } } }; } }); define(new VisualTotalsFunDef.Resolver()); define(new XtdFunDef.Resolver( "Wtd", "Wtd([<Member>])", "A shortcut function for the PeriodsToDate function that specifies the level to be Week.", new String[]{"fx", "fxm"}, mondrian.olap.LevelType.TimeWeeks)); define(new XtdFunDef.Resolver( "Ytd", "Ytd([<Member>])", "A shortcut function for the PeriodsToDate function that specifies the level to be Year.", new String[]{"fx", "fxm"}, mondrian.olap.LevelType.TimeYears)); define(new FunDefBase( ":", "<Member>:<Member>", "Infix colon operator returns the set of members between a given pair of members.", "ixmm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc0 = compiler.compileMember(call.getArg(0)); final MemberCalc memberCalc1 = compiler.compileMember(call.getArg(1)); return new AbstractListCalc(call, new Calc[] {memberCalc0, memberCalc1}) { public List evaluateList(Evaluator evaluator) { final Member member0 = memberCalc0.evaluateMember(evaluator); final Member member1 = memberCalc1.evaluateMember(evaluator); return colon(member0, member1, evaluator); } }; } List colon( final Member member0, final Member member1, Evaluator evaluator) { if (member0.isNull() || member1.isNull()) { return Collections.EMPTY_LIST; } if (member0.getLevel() != member1.getLevel()) { throw newEvalException(this, "Members must belong to the same level"); } return FunUtil.memberRange(evaluator, member0, member1); } }); // special resolver for the "{...}" operator define(new ResolverBase( "{}", "{<Member> [, <Member>...]}", "Brace operator constructs a set.", Syntax.Braces) { public FunDef resolve( Exp[] args, Validator validator, int[] conversionCount) { int[] parameterTypes = new int[args.length]; for (int i = 0; i < args.length; i++) { if (validator.canConvert( args[i], Category.Member, conversionCount)) { parameterTypes[i] = Category.Member; continue; } if (validator.canConvert( args[i], Category.Set, conversionCount)) { parameterTypes[i] = Category.Set; continue; } if (validator.canConvert( args[i], Category.Tuple, conversionCount)) { parameterTypes[i] = Category.Tuple; continue; } return null; } return new SetFunDef(this, parameterTypes); } }); // // STRING FUNCTIONS define(new MultiResolver( "Format", "Format(<Numeric Expression>, <String Expression>)", "Formats a number to string.", new String[] { "fSmS", "fSnS" }) { protected FunDef createFunDef(final Exp[] args, final FunDef dummyFunDef) { final Locale locale = Locale.getDefault(); // todo: use connection's locale if (args[1] instanceof Literal) { // Constant string expression: optimize by compiling // format string. String formatString = (String) ((Literal) args[1]).getValue(); final Format format = new Format(formatString, locale); return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final Calc calc = compiler.compileScalar(call.getArg(0), true); return new AbstractStringCalc(call, new Calc[] {calc}) { public String evaluateString(Evaluator evaluator) { final Object o = calc.evaluate(evaluator); return format.format(o); } }; } }; } else { // Variable string expression return new FunDefBase(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final Calc calc = compiler.compileScalar(call.getArg(0), true); final StringCalc stringCalc = compiler.compileString(call.getArg(1)); return new AbstractStringCalc(call, new Calc[] {calc, stringCalc}) { public String evaluateString(Evaluator evaluator) { final Object o = calc.evaluate(evaluator); final String formatString = stringCalc.evaluateString(evaluator); final Format format = new Format(formatString, locale); return format.format(o); } }; } }; } } }); define(new FunDefBase( "Caption", "<Dimension>.Caption", "Returns the caption of a dimension.", "pSd") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DimensionCalc dimensionCalc = compiler.compileDimension(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {dimensionCalc}) { public String evaluateString(Evaluator evaluator) { final Dimension dimension = dimensionCalc.evaluateDimension(evaluator); return dimension.getCaption(); } }; } }); define(new FunDefBase( "Caption", "<Hierarchy>.Caption", "Returns the caption of a hierarchy.", "pSh") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final HierarchyCalc hierarchyCalc = compiler.compileHierarchy(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {hierarchyCalc}) { public String evaluateString(Evaluator evaluator) { final Hierarchy hierarchy = hierarchyCalc.evaluateHierarchy(evaluator); return hierarchy.getCaption(); } }; } }); define(new FunDefBase( "Caption", "<Level>.Caption", "Returns the caption of a level.", "pSl") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final LevelCalc levelCalc = compiler.compileLevel(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {levelCalc}) { public String evaluateString(Evaluator evaluator) { final Level level = levelCalc.evaluateLevel(evaluator); return level.getCaption(); } }; } }); define(new FunDefBase( "Caption", "<Member>.Caption", "Returns the caption of a member.", "pSm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {memberCalc}) { public String evaluateString(Evaluator evaluator) { final Member member = memberCalc.evaluateMember(evaluator); return member.getCaption(); } }; } }); define(new FunDefBase( "Name", "<Dimension>.Name", "Returns the name of a dimension.", "pSd") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DimensionCalc dimensionCalc = compiler.compileDimension(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {dimensionCalc}) { public String evaluateString(Evaluator evaluator) { final Dimension dimension = dimensionCalc.evaluateDimension(evaluator); return dimension.getName(); } }; } }); define(new FunDefBase( "Name", "<Hierarchy>.Name", "Returns the name of a hierarchy.", "pSh") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final HierarchyCalc hierarchyCalc = compiler.compileHierarchy(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {hierarchyCalc}) { public String evaluateString(Evaluator evaluator) { final Hierarchy hierarchy = hierarchyCalc.evaluateHierarchy(evaluator); return hierarchy.getName(); } }; } }); define(new FunDefBase( "Name", "<Level>.Name", "Returns the name of a level.", "pSl") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final LevelCalc levelCalc = compiler.compileLevel(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {levelCalc}) { public String evaluateString(Evaluator evaluator) { final Level level = levelCalc.evaluateLevel(evaluator); return level.getName(); } }; } }); define(new FunDefBase( "Name", "<Member>.Name", "Returns the name of a member.", "pSm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {memberCalc}) { public String evaluateString(Evaluator evaluator) { final Member member = memberCalc.evaluateMember(evaluator); return member.getName(); } }; } }); define(new FunDefBase( "SetToStr", "SetToStr(<Set>)", "Constructs a string from a set.", "fSx") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {listCalc}) { public String evaluateString(Evaluator evaluator) { final List list = listCalc.evaluateList(evaluator); return strToSet(list); } }; } String strToSet(List list) { StringBuffer buf = new StringBuffer(); buf.append("{"); for (int i = 0; i < list.size(); i++) { if (i > 0) { buf.append(", "); } final Object o = list.get(i); appendMemberOrTuple(buf, o); } buf.append("}"); return buf.toString(); } }); define(new FunDefBase( "TupleToStr", "TupleToStr(<Tuple>)", "Constructs a string from a tuple.", "fSt") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { if (TypeUtil.couldBeMember(call.getArg(0).getType())) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {memberCalc}) { public String evaluateString(Evaluator evaluator) { final Member member = memberCalc.evaluateMember(evaluator); if (member.isNull()) { return ""; } StringBuffer buf = new StringBuffer(); appendMember(buf, member); return buf.toString(); } }; } else { final TupleCalc tupleCalc = compiler.compileTuple(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {tupleCalc}) { public String evaluateString(Evaluator evaluator) { final Member[] members = tupleCalc.evaluateTuple(evaluator); if (members == null) { return ""; } StringBuffer buf = new StringBuffer(); appendTuple(buf, members); return buf.toString(); } }; } } }); define(new FunDefBase( "UniqueName", "<Dimension>.UniqueName", "Returns the unique name of a dimension.", "pSd") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DimensionCalc dimensionCalc = compiler.compileDimension(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {dimensionCalc}) { public String evaluateString(Evaluator evaluator) { final Dimension dimension = dimensionCalc.evaluateDimension(evaluator); return dimension.getUniqueName(); } }; } }); define(new FunDefBase( "UniqueName", "<Hierarchy>.UniqueName", "Returns the unique name of a hierarchy.", "pSh") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final HierarchyCalc hierarchyCalc = compiler.compileHierarchy(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {hierarchyCalc}) { public String evaluateString(Evaluator evaluator) { final Hierarchy hierarchy = hierarchyCalc.evaluateHierarchy(evaluator); return hierarchy.getUniqueName(); } }; } }); define(new FunDefBase( "UniqueName", "<Level>.UniqueName", "Returns the unique name of a level.", "pSl") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final LevelCalc levelCalc = compiler.compileLevel(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {levelCalc}) { public String evaluateString(Evaluator evaluator) { final Level level = levelCalc.evaluateLevel(evaluator); return level.getUniqueName(); } }; } }); define(new FunDefBase( "UniqueName", "<Member>.UniqueName", "Returns the unique name of a member.", "pSm") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); return new AbstractStringCalc(call, new Calc[] {memberCalc}) { public String evaluateString(Evaluator evaluator) { final Member member = memberCalc.evaluateMember(evaluator); return member.getUniqueName(); } }; } }); // // TUPLE FUNCTIONS if (false) define(new FunDefBase( "Current", "<Set>.Current", "Returns the current tuple from a set during an iteration.", "ptx") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); // we do not support the <String expression> arguments if (false) define(new FunDefBase( "Item", "<Set>.Item(<String Expression>[, <String Expression>...] | <Index>)", "Returns a tuple from a set.", "mx*") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw new UnsupportedOperationException(); } }); define(new FunDefBase( "Item", "<Set>.Item(<Index>)", "Returns a tuple from the set specified in <Set>. The tuple to be returned is specified by the zero-based position of the tuple in the set in <Index>.", "mmxn") { public Type getResultType(Validator validator, Exp[] args) { SetType setType = (SetType) args[0].getType(); return setType.getElementType(); } public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final IntegerCalc indexCalc = compiler.compileInteger(call.getArg(1)); final Type elementType = ((SetType) listCalc.getType()).getElementType(); if (elementType instanceof TupleType) { final TupleType tupleType = (TupleType) elementType; final Member[] nullTuple = makeNullTuple(tupleType); return new AbstractTupleCalc(call, new Calc[] {listCalc, indexCalc}) { public Member[] evaluateTuple(Evaluator evaluator) { final List list = listCalc.evaluateList(evaluator); assert list != null; final int index = indexCalc.evaluateInteger(evaluator); int listSize = list.size(); if (index >= listSize || index < 0) { return nullTuple; } else { return (Member[]) list.get(index); } } }; } else { final MemberType memberType = (MemberType) elementType; final Member nullMember = makeNullMember(memberType); return new AbstractMemberCalc(call, new Calc[] {listCalc, indexCalc}) { public Member evaluateMember(Evaluator evaluator) { final List list = listCalc.evaluateList(evaluator); assert list != null; final int index = indexCalc.evaluateInteger(evaluator); int listSize = list.size(); if (index >= listSize || index < 0) { return nullMember; } else { return (Member) list.get(index); } } }; } } Object makeNullMember(Evaluator evaluator, Exp[] args) { final Type elementType = ((SetType) args[0].getType()).getElementType(); return makeNullMemberOrTuple(elementType); } Object makeNullMemberOrTuple(final Type elementType) { if (elementType instanceof MemberType) { MemberType memberType = (MemberType) elementType; return makeNullMember(memberType); } else if (elementType instanceof TupleType) { return makeNullTuple((TupleType) elementType); } else { throw Util.newInternal("bad type " + elementType); } } }); define(new FunDefBase( "Item", "<Tuple>.Item(<Index>)", "Returns a member from the tuple specified in <Tuple>. The member to be returned is specified by the zero-based position of the member in the set in <Index>.", "mmtn") { public Type getResultType(Validator validator, Exp[] args) { // Suppose we are called as follows: // ([Gender].CurrentMember, [Store].CurrentMember).Item(n) // // We know that our result is a member type, but we don't // know which dimension. return MemberType.Unknown; } public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final Type type = call.getArg(0).getType(); if (type instanceof MemberType) { final MemberCalc memberCalc = compiler.compileMember(call.getArg(0)); final IntegerCalc indexCalc = compiler.compileInteger(call.getArg(1)); return new AbstractMemberCalc(call, new Calc[] {memberCalc, indexCalc}) { public Member evaluateMember(Evaluator evaluator) { final Member member = memberCalc.evaluateMember(evaluator); final int index = indexCalc.evaluateInteger(evaluator); if (index != 0) { return null; } return member; } }; } else { final TupleCalc tupleCalc = compiler.compileTuple(call.getArg(0)); final IntegerCalc indexCalc = compiler.compileInteger(call.getArg(1)); return new AbstractMemberCalc(call, new Calc[] {tupleCalc, indexCalc}) { final Member[] nullTupleMembers = makeNullTuple((TupleType) tupleCalc.getType()); public Member evaluateMember(Evaluator evaluator) { final Member[] members = tupleCalc.evaluateTuple(evaluator); assert members == null || members.length == nullTupleMembers.length; final int index = indexCalc.evaluateInteger(evaluator); if (members == null) { return nullTupleMembers[index]; } if (index >= members.length || index < 0) { return null; } return members[index]; } }; } } }); define(new FunDefBase( "StrToTuple", "StrToTuple(<String Expression>)", "Constructs a tuple from a string.", "ftS") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { throw Util.needToImplement(this); } public Exp createCall(Validator validator, Exp[] args) { final int argCount = args.length; if (argCount <= 1) { throw MondrianResource.instance().MdxFuncArgumentsNum.ex(getName()); } for (int i = 1; i < argCount; i++) { final Exp arg = args[i]; if (arg instanceof DimensionExpr) { // if arg is a dimension, switch to dimension's default // hierarchy DimensionExpr dimensionExpr = (DimensionExpr) arg; Dimension dimension = dimensionExpr.getDimension(); args[i] = new HierarchyExpr(dimension.getHierarchy()); } else if (arg instanceof Hierarchy) { // nothing } else { throw MondrianResource.instance().MdxFuncNotHier.ex( new Integer(i + 1), getName()); } } return super.createCall(validator, args); } public Type getResultType(Validator validator, Exp[] args) { if (args.length == 1) { // This is a call to the standard version of StrToTuple, // which doesn't give us any hints about type. return new TupleType(null); } else { // This is a call to Mondrian's extended version of // StrToTuple, of the form // StrToTuple(s, <Hier1>, ... , <HierN>) // // The result is a tuple // (<Hier1>, ... , <HierN>) final ArrayList list = new ArrayList(); for (int i = 1; i < args.length; i++) { Exp arg = args[i]; final Type type = arg.getType(); list.add(type); } final Type[] types = (Type[]) list.toArray(new Type[list.size()]); return new TupleType(types); } } }); // special resolver for "()" define(new ResolverBase( "()", null, null, Syntax.Parentheses) { public FunDef resolve( Exp[] args, Validator validator, int[] conversionCount) { // Compare with TupleFunDef.getReturnCategory(). For example, // ([Gender].members) is a set, // ([Gender].[M]) is a member, // (1 + 2) is a numeric, // but // ([Gender].[M], [Marital Status].[S]) is a tuple. if (args.length == 1) { return new ParenthesesFunDef(args[0].getCategory()); } else { final int[] argTypes = new int[args.length]; Arrays.fill(argTypes, Category.Member); return (FunDef) new TupleFunDef(argTypes); } } }); // // GENERIC VALUE FUNCTIONS define(new ResolverBase( "CoalesceEmpty", "CoalesceEmpty(<Value Expression>[, <Value Expression>...])", "Coalesces an empty cell value to a different value. All of the expressions must be of the same type (number or string).", Syntax.Function) { public FunDef resolve( Exp[] args, Validator validator, int[] conversionCount) { if (args.length < 1) { return null; } final int[] types = {Category.Numeric, Category.String}; final int[] argTypes = new int[args.length]; for (int j = 0; j < types.length; j++) { int type = types[j]; int matchingArgs = 0; conversionCount[0] = 0; for (int i = 0; i < args.length; i++) { if (validator.canConvert(args[i], type, conversionCount)) { matchingArgs++; } argTypes[i] = type; } if (matchingArgs == args.length) { return new CoalesceEmptyFunDef(this, type, argTypes); } } return null; } public boolean requiresExpression(int k) { return true; } }); define(new ResolverBase( "_CaseTest", "Case When <Logical Expression> Then <Expression> [...] [Else <Expression>] End", "Evaluates various conditions, and returns the corresponding expression for the first which evaluates to true.", Syntax.Case) { public FunDef resolve( Exp[] args, Validator validator, int[] conversionCount) { if (args.length < 1) { return null; } int j = 0; int clauseCount = args.length / 2; int mismatchingArgs = 0; int returnType = args[1].getCategory(); for (int i = 0; i < clauseCount; i++) { if (!validator.canConvert(args[j++], Category.Logical, conversionCount)) { mismatchingArgs++; } if (!validator.canConvert(args[j++], returnType, conversionCount)) { mismatchingArgs++; } } if (j < args.length) { if (!validator.canConvert(args[j++], returnType, conversionCount)) { mismatchingArgs++; } } Util.assertTrue(j == args.length); if (mismatchingArgs != 0) { return null; } return new FunDefBase(this, returnType, ExpBase.getTypes(args)) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final Exp[] args = call.getArgs(); final BooleanCalc[] conditionCalcs = new BooleanCalc[args.length / 2]; final Calc[] exprCalcs = new Calc[args.length / 2]; final List calcList = new ArrayList(); for (int i = 0, j = 0; i < exprCalcs.length; i++) { conditionCalcs[i] = compiler.compileBoolean(args[j++]); calcList.add(conditionCalcs[i]); exprCalcs[i] = compiler.compileScalar(args[j++], true); calcList.add(exprCalcs[i]); } final Calc defaultCalc = args.length % 2 == 1 ? compiler.compileScalar(args[args.length - 1], true) : ConstantCalc.constantNull(call.getType()); calcList.add(defaultCalc); final Calc[] calcs = (Calc[]) calcList.toArray(new Calc[calcList.size()]); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { for (int i = 0; i < conditionCalcs.length; i++) { if (conditionCalcs[i].evaluateBoolean(evaluator)) { return exprCalcs[i].evaluate(evaluator); } } return defaultCalc.evaluate(evaluator); } public Calc[] getCalcs() { return calcs; } }; } }; } public boolean requiresExpression(int k) { return true; } }); define(new ResolverBase( "_CaseMatch", "Case <Expression> When <Expression> Then <Expression> [...] [Else <Expression>] End", "Evaluates various expressions, and returns the corresponding expression for the first which matches a particular value.", Syntax.Case) { public FunDef resolve( Exp[] args, Validator validator, int[] conversionCount) { if (args.length < 3) { return null; } int valueType = args[0].getCategory(); int returnType = args[2].getCategory(); int j = 0; int clauseCount = (args.length - 1) / 2; int mismatchingArgs = 0; if (!validator.canConvert(args[j++], valueType, conversionCount)) { mismatchingArgs++; } for (int i = 0; i < clauseCount; i++) { if (!validator.canConvert(args[j++], valueType, conversionCount)) { mismatchingArgs++; } if (!validator.canConvert(args[j++], returnType, conversionCount)) { mismatchingArgs++; } } if (j < args.length) { if (!validator.canConvert(args[j++], returnType, conversionCount)) { mismatchingArgs++; } } Util.assertTrue(j == args.length); if (mismatchingArgs != 0) { return null; } return new FunDefBase(this, returnType, ExpBase.getTypes(args)) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final Exp[] args = call.getArgs(); final List calcList = new ArrayList(); final Calc valueCalc = compiler.compileScalar(args[0], true); calcList.add(valueCalc); final int matchCount = (args.length - 1) / 2; final Calc[] matchCalcs = new Calc[matchCount]; final Calc[] exprCalcs = new Calc[matchCount]; for (int i = 0, j = 1; i < exprCalcs.length; i++) { matchCalcs[i] = compiler.compileScalar(args[j++], true); calcList.add(matchCalcs[i]); exprCalcs[i] = compiler.compileScalar(args[j++], true); calcList.add(exprCalcs[i]); } final Calc defaultCalc = args.length % 2 == 0 ? compiler.compileScalar(args[args.length - 1], true) : ConstantCalc.constantNull(call.getType()); calcList.add(defaultCalc); final Calc[] calcs = (Calc[]) calcList.toArray(new Calc[calcList.size()]); return new AbstractCalc(call) { public Object evaluate(Evaluator evaluator) { Object value = valueCalc.evaluate(evaluator); for (int i = 0; i < matchCalcs.length; i++) { Object match = matchCalcs[i].evaluate(evaluator); if (match.equals(value)) { return exprCalcs[i].evaluate(evaluator); } } return defaultCalc.evaluate(evaluator); } public Calc[] getCalcs() { return calcs; } }; } }; } public boolean requiresExpression(int k) { return true; } }); define(new PropertiesFunDef.Resolver()); // // PARAMETER FUNCTIONS define(new ParameterFunDef.ParameterResolver()); define(new ParameterFunDef.ParamRefResolver()); // // OPERATORS define(new FunDefBase( "+", "<Numeric Expression> + <Numeric Expression>", "Adds two numbers.", "innn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DoubleCalc calc0 = compiler.compileDouble(call.getArg(0)); final DoubleCalc calc1 = compiler.compileDouble(call.getArg(1)); return new AbstractDoubleCalc(call, new Calc[] {calc0, calc1}) { public double evaluateDouble(Evaluator evaluator) { final double v0 = calc0.evaluateDouble(evaluator); final double v1 = calc1.evaluateDouble(evaluator); if (v0 == DoubleNull) { if (v1 == DoubleNull) { return DoubleNull; } else { return v1; } } else { if (v1 == DoubleNull) { return v0; } else { return v0 + v1; } } } }; } }); define(new FunDefBase( "-", "<Numeric Expression> - <Numeric Expression>", "Subtracts two numbers.", "innn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DoubleCalc calc0 = compiler.compileDouble(call.getArg(0)); final DoubleCalc calc1 = compiler.compileDouble(call.getArg(1)); return new AbstractDoubleCalc(call, new Calc[] {calc0, calc1}) { public double evaluateDouble(Evaluator evaluator) { final double v0 = calc0.evaluateDouble(evaluator); final double v1 = calc1.evaluateDouble(evaluator); if (v0 == DoubleNull) { if (v1 == DoubleNull) { return DoubleNull; } else { return - v1; } } else { if (v1 == DoubleNull) { return v0; } else { return v0 - v1; } } } }; } }); define(new FunDefBase( "*", "<Numeric Expression> * <Numeric Expression>", "Multiplies two numbers.", "innn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DoubleCalc calc0 = compiler.compileDouble(call.getArg(0)); final DoubleCalc calc1 = compiler.compileDouble(call.getArg(1)); return new AbstractDoubleCalc(call, new Calc[] {calc0, calc1}) { public double evaluateDouble(Evaluator evaluator) { final double v0 = calc0.evaluateDouble(evaluator); final double v1 = calc1.evaluateDouble(evaluator); // Multiply and divide return null if EITHER arg is null. if (v0 == DoubleNull || v1 == DoubleNull) { return DoubleNull; } else { return v0 * v1; } } }; } }); define(new FunDefBase( "/", "<Numeric Expression> / <Numeric Expression>", "Divides two numbers.", "innn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DoubleCalc calc0 = compiler.compileDouble(call.getArg(0)); final DoubleCalc calc1 = compiler.compileDouble(call.getArg(1)); return new AbstractDoubleCalc(call, new Calc[] {calc0, calc1}) { public double evaluateDouble(Evaluator evaluator) { final double v0 = calc0.evaluateDouble(evaluator); final double v1 = calc1.evaluateDouble(evaluator); // Multiply and divide return null if EITHER arg is null. if (v0 == DoubleNull || v1 == DoubleNull) { return DoubleNull; } else { return v0 / v1; } } }; } // todo: use this, via reflection public double evaluate(double d1, double d2) { return d1 / d2; } }); define(new FunDefBase( "-", "- <Numeric Expression>", "Returns the negative of a number.", "Pnn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DoubleCalc calc = compiler.compileDouble(call.getArg(0)); return new AbstractDoubleCalc(call, new Calc[] {calc}) { public double evaluateDouble(Evaluator evaluator) { final double v = calc.evaluateDouble(evaluator); if (v == DoubleNull) { return DoubleNull; } else { return - v; } } }; } }); define(new FunDefBase( "||", "<String Expression> || <String Expression>", "Concatenates two strings.", "iSSS") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final StringCalc calc0 = compiler.compileString(call.getArg(0)); final StringCalc calc1 = compiler.compileString(call.getArg(1)); return new AbstractStringCalc(call, new Calc[] {calc0, calc1}) { public String evaluateString(Evaluator evaluator) { final String s0 = calc0.evaluateString(evaluator); final String s1 = calc1.evaluateString(evaluator); return s0 + s1; } }; } }); define(new FunDefBase( "AND", "<Logical Expression> AND <Logical Expression>", "Returns the conjunction of two conditions.", "ibbb") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final BooleanCalc calc0 = compiler.compileBoolean(call.getArg(0)); final BooleanCalc calc1 = compiler.compileBoolean(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { if (!calc0.evaluateBoolean(evaluator)) { return false; } return calc1.evaluateBoolean(evaluator); } }; } }); define(new FunDefBase( "OR", "<Logical Expression> OR <Logical Expression>", "Returns the disjunction of two conditions.", "ibbb") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final BooleanCalc calc0 = compiler.compileBoolean(call.getArg(0)); final BooleanCalc calc1 = compiler.compileBoolean(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { if (calc0.evaluateBoolean(evaluator)) { return true; } return calc1.evaluateBoolean(evaluator); } }; } }); define(new FunDefBase( "XOR", "<Logical Expression> XOR <Logical Expression>", "Returns whether two conditions are mutually exclusive.", "ibbb") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final BooleanCalc calc0 = compiler.compileBoolean(call.getArg(0)); final BooleanCalc calc1 = compiler.compileBoolean(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final boolean b0 = calc0.evaluateBoolean(evaluator); final boolean b1 = calc1.evaluateBoolean(evaluator); return b0 != b1; } }; } }); define(new FunDefBase( "NOT", "NOT <Logical Expression>", "Returns the negation of a condition.", "Pbb") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final BooleanCalc calc = compiler.compileBoolean(call.getArg(0)); return new AbstractBooleanCalc(call, new Calc[] {calc}) { public boolean evaluateBoolean(Evaluator evaluator) { return !calc.evaluateBoolean(evaluator); } }; } }); define(new FunDefBase( "=", "<String Expression> = <String Expression>", "Returns whether two expressions are equal.", "ibSS") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final StringCalc calc0 = compiler.compileString(call.getArg(0)); final StringCalc calc1 = compiler.compileString(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final String b0 = calc0.evaluateString(evaluator); final String b1 = calc1.evaluateString(evaluator); if (b0 == null || b1 == null) { return BooleanNull; } return b0.equals(b1); } }; } }); define(new FunDefBase( "=", "<Numeric Expression> = <Numeric Expression>", "Returns whether two expressions are equal.", "ibnn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DoubleCalc calc0 = compiler.compileDouble(call.getArg(0)); final DoubleCalc calc1 = compiler.compileDouble(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final double v0 = calc0.evaluateDouble(evaluator); final double v1 = calc1.evaluateDouble(evaluator); if (v0 == Double.NaN || v1 == Double.NaN || v0 == DoubleNull || v1 == DoubleNull) { return BooleanNull; } return v0 == v1; } }; } }); define(new FunDefBase( "<>", "<String Expression> <> <String Expression>", "Returns whether two expressions are not equal.", "ibSS") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final StringCalc calc0 = compiler.compileString(call.getArg(0)); final StringCalc calc1 = compiler.compileString(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final String b0 = calc0.evaluateString(evaluator); final String b1 = calc1.evaluateString(evaluator); if (b0 == null || b1 == null) { return BooleanNull; } return !b0.equals(b1); } }; } }); define(new FunDefBase( "<>", "<Numeric Expression> <> <Numeric Expression>", "Returns whether two expressions are not equal.", "ibnn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DoubleCalc calc0 = compiler.compileDouble(call.getArg(0)); final DoubleCalc calc1 = compiler.compileDouble(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final double v0 = calc0.evaluateDouble(evaluator); final double v1 = calc1.evaluateDouble(evaluator); if (v0 == Double.NaN || v1 == Double.NaN || v0 == DoubleNull || v1 == DoubleNull) { return BooleanNull; } return v0 != v1; } }; } }); define(new FunDefBase( "<", "<Numeric Expression> < <Numeric Expression>", "Returns whether an expression is less than another.", "ibnn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DoubleCalc calc0 = compiler.compileDouble(call.getArg(0)); final DoubleCalc calc1 = compiler.compileDouble(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final double v0 = calc0.evaluateDouble(evaluator); final double v1 = calc1.evaluateDouble(evaluator); if (v0 == Double.NaN || v1 == Double.NaN || v0 == DoubleNull || v1 == DoubleNull) { return BooleanNull; } return v0 < v1; } }; } }); define(new FunDefBase( "<", "<String Expression> < <String Expression>", "Returns whether an expression is less than another.", "ibSS") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final StringCalc calc0 = compiler.compileString(call.getArg(0)); final StringCalc calc1 = compiler.compileString(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final String b0 = calc0.evaluateString(evaluator); final String b1 = calc1.evaluateString(evaluator); if (b0 == null || b1 == null) { return BooleanNull; } return b0.compareTo(b1) < 0; } }; } }); define(new FunDefBase( "<=", "<Numeric Expression> <= <Numeric Expression>", "Returns whether an expression is less than or equal to another.", "ibnn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DoubleCalc calc0 = compiler.compileDouble(call.getArg(0)); final DoubleCalc calc1 = compiler.compileDouble(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final double v0 = calc0.evaluateDouble(evaluator); final double v1 = calc1.evaluateDouble(evaluator); if (v0 == Double.NaN || v1 == Double.NaN || v0 == DoubleNull || v1 == DoubleNull) { return BooleanNull; } return v0 <= v1; } }; } }); define(new FunDefBase( "<=", "<String Expression> <= <String Expression>", "Returns whether an expression is less than or equal to another.", "ibSS") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final StringCalc calc0 = compiler.compileString(call.getArg(0)); final StringCalc calc1 = compiler.compileString(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final String b0 = calc0.evaluateString(evaluator); final String b1 = calc1.evaluateString(evaluator); if (b0 == null || b1 == null) { return BooleanNull; } return b0.compareTo(b1) <= 0; } }; } }); define(new FunDefBase( ">", "<Numeric Expression> > <Numeric Expression>", "Returns whether an expression is greater than another.", "ibnn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DoubleCalc calc0 = compiler.compileDouble(call.getArg(0)); final DoubleCalc calc1 = compiler.compileDouble(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final double v0 = calc0.evaluateDouble(evaluator); final double v1 = calc1.evaluateDouble(evaluator); if (v0 == Double.NaN || v1 == Double.NaN || v0 == DoubleNull || v1 == DoubleNull) { return BooleanNull; } return v0 > v1; } }; } }); define(new FunDefBase( ">", "<String Expression> > <String Expression>", "Returns whether an expression is greater than another.", "ibSS") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final StringCalc calc0 = compiler.compileString(call.getArg(0)); final StringCalc calc1 = compiler.compileString(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final String b0 = calc0.evaluateString(evaluator); final String b1 = calc1.evaluateString(evaluator); if (b0 == null || b1 == null) { return BooleanNull; } return b0.compareTo(b1) > 0; } }; } }); define(new FunDefBase( ">=", "<Numeric Expression> >= <Numeric Expression>", "Returns whether an expression is greater than or equal to another.", "ibnn") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final DoubleCalc calc0 = compiler.compileDouble(call.getArg(0)); final DoubleCalc calc1 = compiler.compileDouble(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final double v0 = calc0.evaluateDouble(evaluator); final double v1 = calc1.evaluateDouble(evaluator); if (v0 == Double.NaN || v1 == Double.NaN || v0 == DoubleNull || v1 == DoubleNull) { return BooleanNull; } return v0 >= v1; } }; } }); define(new FunDefBase( ">=", "<String Expression> >= <String Expression>", "Returns whether an expression is greater than or equal to another.", "ibSS") { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final StringCalc calc0 = compiler.compileString(call.getArg(0)); final StringCalc calc1 = compiler.compileString(call.getArg(1)); return new AbstractBooleanCalc(call, new Calc[] {calc0, calc1}) { public boolean evaluateBoolean(Evaluator evaluator) { final String b0 = calc0.evaluateString(evaluator); final String b1 = calc1.evaluateString(evaluator); if (b0 == null || b1 == null) { return BooleanNull; } return b0.compareTo(b1) >= 0; } }; } }); // NON-STANDARD FUNCTIONS define(new MultiResolver( "FirstQ", "FirstQ(<Set>[, <Numeric Expression>])", "Returns the 1st quartile value of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final DoubleCalc doubleCalc = call.getArgCount() > 1 ? compiler.compileDouble(call.getArg(1)) : new ValueCalc(call); return new AbstractDoubleCalc(call, new Calc[] {listCalc, doubleCalc}) { public double evaluateDouble(Evaluator evaluator) { List members = listCalc.evaluateList(evaluator); return quartile(evaluator.push(), members, doubleCalc, 1); } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }); define(new MultiResolver( "ThirdQ", "ThirdQ(<Set>[, <Numeric Expression>])", "Returns the 3rd quartile value of a numeric expression evaluated over a set.", new String[]{"fnx", "fnxn"}) { protected FunDef createFunDef(Exp[] args, FunDef dummyFunDef) { return new AbstractAggregateFunDef(dummyFunDef) { public Calc compileCall(ResolvedFunCall call, ExpCompiler compiler) { final ListCalc listCalc = compiler.compileList(call.getArg(0)); final DoubleCalc doubleCalc = call.getArgCount() > 1 ? compiler.compileDouble(call.getArg(1)) : new ValueCalc(call); return new AbstractDoubleCalc(call, new Calc[] {listCalc, doubleCalc}) { public double evaluateDouble(Evaluator evaluator) { List members = listCalc.evaluateList(evaluator); return quartile(evaluator.push(), members, doubleCalc, 3); } public boolean dependsOn(Dimension dimension) { return anyDependsButFirst(getCalcs(), dimension); } }; } }; } }); } | 37907 /local/tlutelli/issta_data/temp/all_java3context/java/2006_temp/2006/37907/45576de01011a793756871b3fb4e8fe3d0e231bb/BuiltinFunTable.java/clean/src/main/mondrian/olap/fun/BuiltinFunTable.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
4750,
918,
4426,
7503,
1435,
288,
3639,
4426,
10435,
2932,
8560,
8863,
3639,
368,
1122,
1149,
30,
293,
33,
1396,
16,
312,
33,
1305,
16,
277,
33,
382,
904,
16,
453,
33,
2244,
3639,
368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
4750,
918,
4426,
7503,
1435,
288,
3639,
4426,
10435,
2932,
8560,
8863,
3639,
368,
1122,
1149,
30,
293,
33,
1396,
16,
312,
33,
1305,
16,
277,
33,
382,
904,
16,
453,
33,
2244,
3639,
368,
... |
break; | continue Loop; | static Object interpret(Context cx, Scriptable scope, Scriptable thisObj, Object[] args, double[] argsDbl, int argShift, int argCount, NativeFunction fnOrScript, InterpreterData idata) throws JavaScriptException { if (cx.interpreterSecurityDomain != idata.securityDomain) { if (argsDbl != null) { args = getArgsArray(args, argsDbl, argShift, argCount); } SecurityController sc = idata.securityController; Object savedDomain = cx.interpreterSecurityDomain; cx.interpreterSecurityDomain = idata.securityDomain; try { return sc.callWithDomain(idata.securityDomain, cx, fnOrScript, scope, thisObj, args); } finally { cx.interpreterSecurityDomain = savedDomain; } } final Object DBL_MRK = Interpreter.DBL_MRK; final Scriptable undefined = Undefined.instance; final int VAR_SHFT = 0; final int maxVars = idata.itsMaxVars; final int LOCAL_SHFT = VAR_SHFT + maxVars; final int STACK_SHFT = LOCAL_SHFT + idata.itsMaxLocals;// stack[VAR_SHFT <= i < LOCAL_SHFT]: variables// stack[LOCAL_SHFT <= i < TRY_STACK_SHFT]: used for newtemp/usetemp// stack[STACK_SHFT <= i < STACK_SHFT + idata.itsMaxStack]: stack data// sDbl[i]: if stack[i] is DBL_MRK, sDbl[i] holds the number value int maxFrameArray = idata.itsMaxFrameArray; if (maxFrameArray != STACK_SHFT + idata.itsMaxStack) Kit.codeBug(); Object[] stack = new Object[maxFrameArray]; double[] sDbl = new double[maxFrameArray]; int stackTop = STACK_SHFT - 1; int withDepth = 0; int definedArgs = fnOrScript.argCount; if (definedArgs > argCount) { definedArgs = argCount; } for (int i = 0; i != definedArgs; ++i) { Object arg = args[argShift + i]; stack[VAR_SHFT + i] = arg; if (arg == DBL_MRK) { sDbl[VAR_SHFT + i] = argsDbl[argShift + i]; } } for (int i = definedArgs; i != maxVars; ++i) { stack[VAR_SHFT + i] = undefined; } DebugFrame debuggerFrame = null; if (cx.debugger != null) { debuggerFrame = cx.debugger.getFrame(cx, idata); } if (idata.itsFunctionType != 0) { InterpretedFunction f = (InterpretedFunction)fnOrScript; if (!idata.useDynamicScope) { scope = fnOrScript.getParentScope(); } if (idata.itsCheckThis) { thisObj = ScriptRuntime.getThis(thisObj); } if (idata.itsNeedsActivation) { if (argsDbl != null) { args = getArgsArray(args, argsDbl, argShift, argCount); argShift = 0; argsDbl = null; } scope = ScriptRuntime.initVarObj(cx, scope, fnOrScript, thisObj, args); } } else { ScriptRuntime.initScript(cx, scope, fnOrScript, thisObj, idata.itsFromEvalCode); } if (idata.itsNestedFunctions != null) { if (idata.itsFunctionType != 0 && !idata.itsNeedsActivation) Kit.codeBug(); for (int i = 0; i < idata.itsNestedFunctions.length; i++) { InterpreterData fdata = idata.itsNestedFunctions[i]; if (fdata.itsFunctionType == FunctionNode.FUNCTION_STATEMENT) { createFunction(cx, scope, fdata, idata.itsFromEvalCode); } } } // Wrapped regexps for functions are stored in InterpretedFunction // but for script which should not contain references to scope // the regexps re-wrapped during each script execution Scriptable[] scriptRegExps = null; boolean useActivationVars = false; if (debuggerFrame != null) { if (argsDbl != null) { args = getArgsArray(args, argsDbl, argShift, argCount); argShift = 0; argsDbl = null; } if (idata.itsFunctionType != 0 && !idata.itsNeedsActivation) { useActivationVars = true; scope = ScriptRuntime.initVarObj(cx, scope, fnOrScript, thisObj, args); } debuggerFrame.onEnter(cx, scope, thisObj, args); } InterpreterData savedData = cx.interpreterData; cx.interpreterData = idata; Object result = undefined; // If javaException != null on exit, it will be throw instead of // normal return Throwable javaException = null; int exceptionPC = -1; byte[] iCode = idata.itsICode; String[] strings = idata.itsStringTable; int pc = 0; int pcPrevBranch = pc; final int instructionThreshold = cx.instructionThreshold; // During function call this will be set to -1 so catch can properly // adjust it int instructionCount = cx.instructionCount; // arbitrary number to add to instructionCount when calling // other functions final int INVOCATION_COST = 100; Loop: for (;;) { try { int op = 0xFF & iCode[pc++]; switch (op) { // Back indent to ease imlementation reading case Icode_CATCH: { // The following code should be executed inside try/catch inside main // loop, not in the loop catch block itself to deal with exceptions // from observeInstructionCount. A special bytecode is used only to // simplify logic. if (javaException == null) Kit.codeBug(); int pcNew = -1; boolean doCatch = false; int handlerOffset = getExceptionHandler(idata.itsExceptionTable, exceptionPC); if (handlerOffset >= 0) { final int SCRIPT_CAN_CATCH = 0, ONLY_FINALLY = 1, OTHER = 2; int exType; if (javaException instanceof JavaScriptException) { exType = SCRIPT_CAN_CATCH; } else if (javaException instanceof EcmaError) { // an offical ECMA error object, exType = SCRIPT_CAN_CATCH; } else if (javaException instanceof EvaluatorException) { exType = SCRIPT_CAN_CATCH; } else if (javaException instanceof RuntimeException) { exType = ONLY_FINALLY; } else { // Error instance exType = OTHER; } if (exType != OTHER) { // Do not allow for JS to interfere with Error instances // (exType == OTHER), as they can be used to terminate // long running script if (exType == SCRIPT_CAN_CATCH) { // Allow JS to catch only JavaScriptException and // EcmaError pcNew = idata.itsExceptionTable[handlerOffset + EXCEPTION_CATCH_SLOT]; if (pcNew >= 0) { // Has catch block doCatch = true; } } if (pcNew < 0) { pcNew = idata.itsExceptionTable[handlerOffset + EXCEPTION_FINALLY_SLOT]; } } } if (debuggerFrame != null && !(javaException instanceof Error)) { debuggerFrame.onExceptionThrown(cx, javaException); } if (pcNew < 0) { break Loop; } // We caught an exception // restore scope at try point int tryWithDepth = idata.itsExceptionTable[ handlerOffset + EXCEPTION_WITH_DEPTH_SLOT]; while (tryWithDepth != withDepth) { if (scope == null) Kit.codeBug(); scope = ScriptRuntime.leaveWith(scope); --withDepth; } if (doCatch) { stackTop = STACK_SHFT - 1; int exLocal = idata.itsExceptionTable[ handlerOffset + EXCEPTION_LOCAL_SLOT]; stack[LOCAL_SHFT + exLocal] = ScriptRuntime.getCatchObject( cx, scope, javaException); } else { stackTop = STACK_SHFT; // Call finally handler with javaException on stack top to // distinguish from normal invocation through GOSUB // which would contain DBL_MRK on the stack stack[stackTop] = javaException; } // clear exception javaException = null; // Notify instruction observer if necessary // and point pc and pcPrevBranch to start of catch/finally block if (instructionThreshold != 0) { if (instructionCount > instructionThreshold) { // Note: this can throw Error cx.observeInstructionCount(instructionCount); instructionCount = 0; } } pcPrevBranch = pc = pcNew; continue Loop; } case Token.THROW: { Object value = stack[stackTop]; if (value == DBL_MRK) value = doubleWrap(sDbl[stackTop]); --stackTop; int sourceLine = getShort(iCode, pc); javaException = new JavaScriptException(value, idata.itsSourceFile, sourceLine); exceptionPC = pc - 1; if (instructionThreshold != 0) { instructionCount += pc - pcPrevBranch; if (instructionCount > instructionThreshold) { cx.observeInstructionCount(instructionCount); instructionCount = 0; } } pcPrevBranch = pc = getJavaCatchPC(iCode); continue Loop; } case Token.GE : { --stackTop; Object rhs = stack[stackTop + 1]; Object lhs = stack[stackTop]; boolean valBln; if (rhs == DBL_MRK || lhs == DBL_MRK) { double rDbl = stack_double(stack, sDbl, stackTop + 1); double lDbl = stack_double(stack, sDbl, stackTop); valBln = (rDbl <= lDbl); } else { valBln = ScriptRuntime.cmp_LE(rhs, lhs); } stack[stackTop] = valBln ? Boolean.TRUE : Boolean.FALSE; break; } case Token.LE : { --stackTop; Object rhs = stack[stackTop + 1]; Object lhs = stack[stackTop]; boolean valBln; if (rhs == DBL_MRK || lhs == DBL_MRK) { double rDbl = stack_double(stack, sDbl, stackTop + 1); double lDbl = stack_double(stack, sDbl, stackTop); valBln = (lDbl <= rDbl); } else { valBln = ScriptRuntime.cmp_LE(lhs, rhs); } stack[stackTop] = valBln ? Boolean.TRUE : Boolean.FALSE; break; } case Token.GT : { --stackTop; Object rhs = stack[stackTop + 1]; Object lhs = stack[stackTop]; boolean valBln; if (rhs == DBL_MRK || lhs == DBL_MRK) { double rDbl = stack_double(stack, sDbl, stackTop + 1); double lDbl = stack_double(stack, sDbl, stackTop); valBln = (rDbl < lDbl); } else { valBln = ScriptRuntime.cmp_LT(rhs, lhs); } stack[stackTop] = valBln ? Boolean.TRUE : Boolean.FALSE; break; } case Token.LT : { --stackTop; Object rhs = stack[stackTop + 1]; Object lhs = stack[stackTop]; boolean valBln; if (rhs == DBL_MRK || lhs == DBL_MRK) { double rDbl = stack_double(stack, sDbl, stackTop + 1); double lDbl = stack_double(stack, sDbl, stackTop); valBln = (lDbl < rDbl); } else { valBln = ScriptRuntime.cmp_LT(lhs, rhs); } stack[stackTop] = valBln ? Boolean.TRUE : Boolean.FALSE; break; } case Token.IN : { Object rhs = stack[stackTop]; if (rhs == DBL_MRK) rhs = doubleWrap(sDbl[stackTop]); --stackTop; Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); boolean valBln = ScriptRuntime.in(lhs, rhs, scope); stack[stackTop] = valBln ? Boolean.TRUE : Boolean.FALSE; break; } case Token.INSTANCEOF : { Object rhs = stack[stackTop]; if (rhs == DBL_MRK) rhs = doubleWrap(sDbl[stackTop]); --stackTop; Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); boolean valBln = ScriptRuntime.instanceOf(lhs, rhs, scope); stack[stackTop] = valBln ? Boolean.TRUE : Boolean.FALSE; break; } case Token.EQ : { --stackTop; boolean valBln = do_eq(stack, sDbl, stackTop); stack[stackTop] = valBln ? Boolean.TRUE : Boolean.FALSE; break; } case Token.NE : { --stackTop; boolean valBln = !do_eq(stack, sDbl, stackTop); stack[stackTop] = valBln ? Boolean.TRUE : Boolean.FALSE; break; } case Token.SHEQ : { --stackTop; boolean valBln = do_sheq(stack, sDbl, stackTop); stack[stackTop] = valBln ? Boolean.TRUE : Boolean.FALSE; break; } case Token.SHNE : { --stackTop; boolean valBln = !do_sheq(stack, sDbl, stackTop); stack[stackTop] = valBln ? Boolean.TRUE : Boolean.FALSE; break; } case Token.IFNE : { boolean valBln = stack_boolean(stack, sDbl, stackTop); --stackTop; if (!valBln) { if (instructionThreshold != 0) { instructionCount += pc + 2 - pcPrevBranch; if (instructionCount > instructionThreshold) { cx.observeInstructionCount(instructionCount); instructionCount = 0; } } pcPrevBranch = pc = getTarget(iCode, pc); continue Loop; } pc += 2; break; } case Token.IFEQ : { boolean valBln = stack_boolean(stack, sDbl, stackTop); --stackTop; if (valBln) { if (instructionThreshold != 0) { instructionCount += pc + 2 - pcPrevBranch; if (instructionCount > instructionThreshold) { cx.observeInstructionCount(instructionCount); instructionCount = 0; } } pcPrevBranch = pc = getTarget(iCode, pc); continue Loop; } pc += 2; break; } case Icode_IFEQ_POP : { boolean valBln = stack_boolean(stack, sDbl, stackTop); --stackTop; if (valBln) { if (instructionThreshold != 0) { instructionCount += pc + 2 - pcPrevBranch; if (instructionCount > instructionThreshold) { cx.observeInstructionCount(instructionCount); instructionCount = 0; } } pcPrevBranch = pc = getTarget(iCode, pc); stack[stackTop--] = null; continue Loop; } pc += 2; break; } case Token.GOTO : if (instructionThreshold != 0) { instructionCount += pc + 2 - pcPrevBranch; if (instructionCount > instructionThreshold) { cx.observeInstructionCount(instructionCount); instructionCount = 0; } } pcPrevBranch = pc = getTarget(iCode, pc); continue Loop; case Icode_GOSUB : ++stackTop; stack[stackTop] = DBL_MRK; sDbl[stackTop] = pc + 2; if (instructionThreshold != 0) { instructionCount += pc + 2 - pcPrevBranch; if (instructionCount > instructionThreshold) { cx.observeInstructionCount(instructionCount); instructionCount = 0; } } pcPrevBranch = pc = getTarget(iCode, pc); continue Loop; case Icode_RETSUB : { int slot = (iCode[pc] & 0xFF); if (instructionThreshold != 0) { instructionCount += pc + 1 - pcPrevBranch; if (instructionCount > instructionThreshold) { cx.observeInstructionCount(instructionCount); instructionCount = 0; } } int newPC; Object value = stack[LOCAL_SHFT + slot]; if (value != DBL_MRK) { // Invocation from exception handler, restore object to rethrow javaException = (Throwable)value; exceptionPC = pc - 1; newPC = getJavaCatchPC(iCode); } else { // Normal return from GOSUB newPC = (int)sDbl[LOCAL_SHFT + slot]; } pcPrevBranch = pc = newPC; continue Loop; } case Token.POP : stack[stackTop] = null; stackTop--; break; case Icode_DUP : stack[stackTop + 1] = stack[stackTop]; sDbl[stackTop + 1] = sDbl[stackTop]; stackTop++; break; case Icode_DUPSECOND : { stack[stackTop + 1] = stack[stackTop - 1]; sDbl[stackTop + 1] = sDbl[stackTop - 1]; stackTop++; break; } case Icode_SWAP : { Object o = stack[stackTop]; stack[stackTop] = stack[stackTop - 1]; stack[stackTop - 1] = o; double d = sDbl[stackTop]; sDbl[stackTop] = sDbl[stackTop - 1]; sDbl[stackTop - 1] = d; break; } case Token.POPV : result = stack[stackTop]; if (result == DBL_MRK) result = doubleWrap(sDbl[stackTop]); stack[stackTop] = null; --stackTop; break; case Token.RETURN : result = stack[stackTop]; if (result == DBL_MRK) result = doubleWrap(sDbl[stackTop]); --stackTop; break Loop; case Token.RETURN_POPV : break Loop; case Icode_RETUNDEF : result = undefined; break Loop; case Token.BITNOT : { int rIntValue = stack_int32(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = ~rIntValue; break; } case Token.BITAND : { int rIntValue = stack_int32(stack, sDbl, stackTop); --stackTop; int lIntValue = stack_int32(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = lIntValue & rIntValue; break; } case Token.BITOR : { int rIntValue = stack_int32(stack, sDbl, stackTop); --stackTop; int lIntValue = stack_int32(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = lIntValue | rIntValue; break; } case Token.BITXOR : { int rIntValue = stack_int32(stack, sDbl, stackTop); --stackTop; int lIntValue = stack_int32(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = lIntValue ^ rIntValue; break; } case Token.LSH : { int rIntValue = stack_int32(stack, sDbl, stackTop); --stackTop; int lIntValue = stack_int32(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = lIntValue << rIntValue; break; } case Token.RSH : { int rIntValue = stack_int32(stack, sDbl, stackTop); --stackTop; int lIntValue = stack_int32(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = lIntValue >> rIntValue; break; } case Token.URSH : { int rIntValue = stack_int32(stack, sDbl, stackTop) & 0x1F; --stackTop; double lDbl = stack_double(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = ScriptRuntime.toUint32(lDbl) >>> rIntValue; break; } case Token.ADD : --stackTop; do_add(stack, sDbl, stackTop); break; case Token.SUB : { double rDbl = stack_double(stack, sDbl, stackTop); --stackTop; double lDbl = stack_double(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = lDbl - rDbl; break; } case Token.NEG : { double rDbl = stack_double(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = -rDbl; break; } case Token.POS : { double rDbl = stack_double(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = rDbl; break; } case Token.MUL : { double rDbl = stack_double(stack, sDbl, stackTop); --stackTop; double lDbl = stack_double(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = lDbl * rDbl; break; } case Token.DIV : { double rDbl = stack_double(stack, sDbl, stackTop); --stackTop; double lDbl = stack_double(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; // Detect the divide by zero or let Java do it ? sDbl[stackTop] = lDbl / rDbl; break; } case Token.MOD : { double rDbl = stack_double(stack, sDbl, stackTop); --stackTop; double lDbl = stack_double(stack, sDbl, stackTop); stack[stackTop] = DBL_MRK; sDbl[stackTop] = lDbl % rDbl; break; } case Token.NOT : { stack[stackTop] = stack_boolean(stack, sDbl, stackTop) ? Boolean.FALSE : Boolean.TRUE; break; } case Token.BINDNAME : { String name = strings[getIndex(iCode, pc)]; stack[++stackTop] = ScriptRuntime.bind(scope, name); pc += 2; break; } case Token.SETNAME : { String name = strings[getIndex(iCode, pc)]; Object rhs = stack[stackTop]; if (rhs == DBL_MRK) rhs = doubleWrap(sDbl[stackTop]); --stackTop; Scriptable lhs = (Scriptable)stack[stackTop]; stack[stackTop] = ScriptRuntime.setName(lhs, rhs, scope, name); pc += 2; break; } case Token.DELPROP : { Object rhs = stack[stackTop]; if (rhs == DBL_MRK) rhs = doubleWrap(sDbl[stackTop]); --stackTop; Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); stack[stackTop] = ScriptRuntime.delete(cx, scope, lhs, rhs); break; } case Token.GETPROP : { String name = (String)stack[stackTop]; --stackTop; Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); stack[stackTop] = ScriptRuntime.getProp(lhs, name, scope); break; } case Token.SETPROP : { Object rhs = stack[stackTop]; if (rhs == DBL_MRK) rhs = doubleWrap(sDbl[stackTop]); --stackTop; String name = (String)stack[stackTop]; --stackTop; Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); stack[stackTop] = ScriptRuntime.setProp(lhs, name, rhs, scope); break; } case Token.GETELEM : do_getElem(cx, stack, sDbl, stackTop, scope); --stackTop; break; case Token.SETELEM : do_setElem(cx, stack, sDbl, stackTop, scope); stackTop -= 2; break; case Icode_PROPINC : case Icode_PROPDEC : { String name = (String)stack[stackTop]; --stackTop; Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); stack[stackTop] = ScriptRuntime.postIncrDecr(lhs, name, scope, op == Icode_PROPINC); break; } case Icode_ELEMINC : case Icode_ELEMDEC : { Object rhs = stack[stackTop]; if (rhs == DBL_MRK) rhs = doubleWrap(sDbl[stackTop]); --stackTop; Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); stack[stackTop] = ScriptRuntime.postIncrDecrElem(lhs, rhs, scope, op == Icode_ELEMINC); break; } case Token.LOCAL_SAVE : { int slot = (iCode[pc] & 0xFF); stack[LOCAL_SHFT + slot] = stack[stackTop]; sDbl[LOCAL_SHFT + slot] = sDbl[stackTop]; --stackTop; ++pc; break; } case Token.LOCAL_LOAD : { int slot = (iCode[pc] & 0xFF); ++stackTop; stack[stackTop] = stack[LOCAL_SHFT + slot]; sDbl[stackTop] = sDbl[LOCAL_SHFT + slot]; ++pc; break; } case Icode_CALLSPECIAL : { if (instructionThreshold != 0) { instructionCount += INVOCATION_COST; cx.instructionCount = instructionCount; instructionCount = -1; } int callType = iCode[pc] & 0xFF; boolean isNew = (iCode[pc + 1] != 0); int sourceLine = getShort(iCode, pc + 2); int count = getIndex(iCode, pc + 4); stackTop -= count; Object[] outArgs = getArgsArray(stack, sDbl, stackTop + 1, count); Object functionThis; if (isNew) { functionThis = null; } else { functionThis = stack[stackTop]; if (functionThis == DBL_MRK) { functionThis = doubleWrap(sDbl[stackTop]); } --stackTop; } Object function = stack[stackTop]; if (function == DBL_MRK) function = doubleWrap(sDbl[stackTop]); stack[stackTop] = ScriptRuntime.callSpecial( cx, function, isNew, functionThis, outArgs, scope, thisObj, callType, idata.itsSourceFile, sourceLine); instructionCount = cx.instructionCount; pc += 6; break; } case Token.CALL : { if (instructionThreshold != 0) { instructionCount += INVOCATION_COST; cx.instructionCount = instructionCount; instructionCount = -1; } int count = getIndex(iCode, pc + 2); stackTop -= count; int calleeArgShft = stackTop + 1; Object rhs = stack[stackTop]; if (rhs == DBL_MRK) rhs = doubleWrap(sDbl[stackTop]); --stackTop; Object lhs = stack[stackTop]; Scriptable calleeScope = scope; if (idata.itsNeedsActivation) { calleeScope = ScriptableObject.getTopLevelScope(scope); } Scriptable calleeThis; if (rhs instanceof Scriptable || rhs == null) { calleeThis = (Scriptable)rhs; } else { calleeThis = ScriptRuntime.toObject(cx, calleeScope, rhs); } if (lhs instanceof InterpretedFunction) { // Inlining of InterpretedFunction.call not to create // argument array InterpretedFunction f = (InterpretedFunction)lhs; stack[stackTop] = interpret(cx, calleeScope, calleeThis, stack, sDbl, calleeArgShft, count, f, f.itsData); } else if (lhs instanceof Function) { Function f = (Function)lhs; Object[] outArgs = getArgsArray(stack, sDbl, calleeArgShft, count); stack[stackTop] = f.call(cx, calleeScope, calleeThis, outArgs); } else { if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); else if (lhs == undefined) { // special code for better error message for call // to undefined lhs = strings[getIndex(iCode, pc)]; if (lhs == null) lhs = undefined; } throw ScriptRuntime.typeError1("msg.isnt.function", ScriptRuntime.toString(lhs)); } instructionCount = cx.instructionCount; pc += 4; break; } case Token.NEW : { if (instructionThreshold != 0) { instructionCount += INVOCATION_COST; cx.instructionCount = instructionCount; instructionCount = -1; } int count = getIndex(iCode, pc + 2); stackTop -= count; int calleeArgShft = stackTop + 1; Object lhs = stack[stackTop]; if (lhs instanceof InterpretedFunction) { // Inlining of InterpretedFunction.construct not to create // argument array InterpretedFunction f = (InterpretedFunction)lhs; Scriptable newInstance = f.createObject(cx, scope); Object callResult = interpret(cx, scope, newInstance, stack, sDbl, calleeArgShft, count, f, f.itsData); if (callResult instanceof Scriptable && callResult != undefined) { stack[stackTop] = callResult; } else { stack[stackTop] = newInstance; } } else if (lhs instanceof Function) { Function f = (Function)lhs; Object[] outArgs = getArgsArray(stack, sDbl, calleeArgShft, count); stack[stackTop] = f.construct(cx, scope, outArgs); } else { if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); else if (lhs == undefined) { // special code for better error message for call // to undefined lhs = strings[getIndex(iCode, pc)]; if (lhs == null) lhs = undefined; } throw ScriptRuntime.typeError1("msg.isnt.function", ScriptRuntime.toString(lhs)); } instructionCount = cx.instructionCount; pc += 4; break; } case Token.TYPEOF : { Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); stack[stackTop] = ScriptRuntime.typeof(lhs); break; } case Icode_TYPEOFNAME : { String name = strings[getIndex(iCode, pc)]; stack[++stackTop] = ScriptRuntime.typeofName(scope, name); pc += 2; break; } case Icode_NAME_AND_THIS : { String name = strings[getIndex(iCode, pc)]; boolean skipGetThis = (0 != iCode[pc + 2]); stackTop = do_nameAndThis(stack, stackTop, scope, name, skipGetThis); pc += 3; break; } case Token.STRING : stack[++stackTop] = strings[getIndex(iCode, pc)]; pc += 2; break; case Icode_SHORTNUMBER : ++stackTop; stack[stackTop] = DBL_MRK; sDbl[stackTop] = getShort(iCode, pc); pc += 2; break; case Icode_INTNUMBER : ++stackTop; stack[stackTop] = DBL_MRK; sDbl[stackTop] = getInt(iCode, pc); pc += 4; break; case Token.NUMBER : ++stackTop; stack[stackTop] = DBL_MRK; sDbl[stackTop] = idata.itsDoubleTable[getIndex(iCode, pc)]; pc += 2; break; case Token.NAME : { String name = strings[getIndex(iCode, pc)]; stack[++stackTop] = ScriptRuntime.name(scope, name); pc += 2; break; } case Icode_NAMEINC : case Icode_NAMEDEC : { String name = strings[getIndex(iCode, pc)]; stack[++stackTop] = ScriptRuntime.postIncrDecr(scope, name, op == Icode_NAMEINC); pc += 2; break; } case Token.SETVAR : { int slot = (iCode[pc] & 0xFF); if (!useActivationVars) { stack[VAR_SHFT + slot] = stack[stackTop]; sDbl[VAR_SHFT + slot] = sDbl[stackTop]; } else { Object val = stack[stackTop]; if (val == DBL_MRK) val = doubleWrap(sDbl[stackTop]); activationPut(fnOrScript, scope, slot, val); } ++pc; break; } case Token.GETVAR : { int slot = (iCode[pc] & 0xFF); ++stackTop; if (!useActivationVars) { stack[stackTop] = stack[VAR_SHFT + slot]; sDbl[stackTop] = sDbl[VAR_SHFT + slot]; } else { stack[stackTop] = activationGet(fnOrScript, scope, slot); } ++pc; break; } case Icode_VARINC : case Icode_VARDEC : { int slot = (iCode[pc] & 0xFF); ++stackTop; if (!useActivationVars) { Object val = stack[VAR_SHFT + slot]; stack[stackTop] = val; double d; if (val == DBL_MRK) { d = sDbl[VAR_SHFT + slot]; sDbl[stackTop] = d; } else { d = ScriptRuntime.toNumber(val); } stack[VAR_SHFT + slot] = DBL_MRK; sDbl[VAR_SHFT + slot] = (op == Icode_VARINC) ? d + 1.0 : d - 1.0; } else { Object val = activationGet(fnOrScript, scope, slot); stack[stackTop] = val; double d = ScriptRuntime.toNumber(val); val = doubleWrap((op == Icode_VARINC) ? d + 1.0 : d - 1.0); activationPut(fnOrScript, scope, slot, val); } ++pc; break; } case Token.ZERO : ++stackTop; stack[stackTop] = DBL_MRK; sDbl[stackTop] = 0; break; case Token.ONE : ++stackTop; stack[stackTop] = DBL_MRK; sDbl[stackTop] = 1; break; case Token.NULL : stack[++stackTop] = null; break; case Token.THIS : stack[++stackTop] = thisObj; break; case Token.THISFN : stack[++stackTop] = fnOrScript; break; case Token.FALSE : stack[++stackTop] = Boolean.FALSE; break; case Token.TRUE : stack[++stackTop] = Boolean.TRUE; break; case Token.UNDEFINED : stack[++stackTop] = Undefined.instance; break; case Token.ENTERWITH : { Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); --stackTop; scope = ScriptRuntime.enterWith(lhs, scope); ++withDepth; break; } case Token.LEAVEWITH : scope = ScriptRuntime.leaveWith(scope); --withDepth; break; case Token.CATCH_SCOPE : { String name = strings[getIndex(iCode, pc)]; stack[stackTop] = ScriptRuntime.newCatchScope(name, stack[stackTop]); pc += 2; break; } case Token.ENUM_INIT : { int slot = (iCode[pc] & 0xFF); Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); --stackTop; stack[LOCAL_SHFT + slot] = ScriptRuntime.enumInit(lhs, scope); ++pc; break; } case Token.ENUM_NEXT : case Token.ENUM_ID : { int slot = (iCode[pc] & 0xFF); Object val = stack[LOCAL_SHFT + slot]; ++stackTop; stack[stackTop] = (op == Token.ENUM_NEXT) ? (Object)ScriptRuntime.enumNext(val) : (Object)ScriptRuntime.enumId(val); ++pc; break; } case Icode_PUSH_PARENT : { Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); stack[++stackTop] = ScriptRuntime.getParent(lhs); break; } case Icode_GETPROTO : case Icode_GETSCOPEPARENT : { Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); Object val; if (op == Icode_GETPROTO) { val = ScriptRuntime.getProto(lhs, scope); } else { val = ScriptRuntime.getParent(lhs, scope); } stack[stackTop] = val; break; } case Icode_SETPROTO : case Icode_SETPARENT : { Object rhs = stack[stackTop]; if (rhs == DBL_MRK) rhs = doubleWrap(sDbl[stackTop]); --stackTop; Object lhs = stack[stackTop]; if (lhs == DBL_MRK) lhs = doubleWrap(sDbl[stackTop]); Object val; if (op == Icode_SETPROTO) { val = ScriptRuntime.setProto(lhs, rhs, scope); } else { val = ScriptRuntime.setParent(lhs, rhs, scope); } stack[stackTop] = val; break; } case Icode_SCOPE : stack[++stackTop] = scope; break; case Icode_CLOSURE : { int i = getIndex(iCode, pc); InterpreterData closureData = idata.itsNestedFunctions[i]; stack[++stackTop] = createFunction(cx, scope, closureData, idata.itsFromEvalCode); pc += 2; break; } case Token.REGEXP : { int i = getIndex(iCode, pc); Scriptable regexp; if (idata.itsFunctionType != 0) { regexp = ((InterpretedFunction)fnOrScript).itsRegExps[i]; } else { if (scriptRegExps == null) { scriptRegExps = wrapRegExps(cx, scope, idata); } regexp = scriptRegExps[i]; } stack[++stackTop] = regexp; pc += 2; break; } case Icode_LITERAL_NEW : { int i = getInt(iCode, pc); ++stackTop; stack[stackTop] = new Object[i]; sDbl[stackTop] = 0; pc += 4; break; } case Icode_LITERAL_SET : { Object value = stack[stackTop]; if (value == DBL_MRK) value = doubleWrap(sDbl[stackTop]); --stackTop; int i = (int)sDbl[stackTop]; ((Object[])stack[stackTop])[i] = value; sDbl[stackTop] = i + 1; break; } case Token.ARRAYLIT : case Token.OBJECTLIT : { int offset = getInt(iCode, pc); Object[] data = (Object[])stack[stackTop]; Object val; if (op == Token.ARRAYLIT) { int[] skipIndexces = null; if (offset >= 0) { skipIndexces = (int[])idata.literalIds[offset]; } val = ScriptRuntime.newArrayLiteral(data, skipIndexces, cx, scope); } else { Object[] ids = (Object[])idata.literalIds[offset]; val = ScriptRuntime.newObjectLiteral(ids, data, cx, scope); } stack[stackTop] = val; pc += 4; break; } case Icode_LINE : { cx.interpreterLineIndex = pc; if (debuggerFrame != null) { int line = getShort(iCode, pc); debuggerFrame.onLineChange(cx, line); } pc += 2; break; } default : { dumpICode(idata); throw new RuntimeException("Unknown icode : "+op+" @ pc : "+(pc-1)); } // end of interpreter switch } } catch (Throwable ex) { if (instructionThreshold != 0) { if (instructionCount < 0) { // throw during function call instructionCount = cx.instructionCount; } else { // throw during any other operation instructionCount += pc - pcPrevBranch; cx.instructionCount = instructionCount; } } javaException = ex; exceptionPC = pc; pc = getJavaCatchPC(iCode); continue Loop; } } cx.interpreterData = savedData; if (debuggerFrame != null) { if (javaException != null) { debuggerFrame.onExit(cx, true, javaException); } else { debuggerFrame.onExit(cx, false, result); } } if (idata.itsNeedsActivation || debuggerFrame != null) { ScriptRuntime.popActivation(cx); } if (instructionThreshold != 0) { if (instructionCount > instructionThreshold) { cx.observeInstructionCount(instructionCount); instructionCount = 0; } cx.instructionCount = instructionCount; } if (javaException != null) { if (javaException instanceof JavaScriptException) { throw (JavaScriptException)javaException; } else if (javaException instanceof RuntimeException) { throw (RuntimeException)javaException; } else { // Must be instance of Error or code bug throw (Error)javaException; } } return result; } | 12904 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/12904/43cae3f59850b2e1bf3e15bda6d9eac95ae4284c/Interpreter.java/buggy/js/rhino/src/org/mozilla/javascript/Interpreter.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
760,
1033,
10634,
12,
1042,
9494,
16,
22780,
2146,
16,
22780,
15261,
16,
18701,
1033,
8526,
833,
16,
1645,
8526,
833,
40,
3083,
16,
18701,
509,
1501,
10544,
16,
509,
1501,
1380,
16,
18701... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
760,
1033,
10634,
12,
1042,
9494,
16,
22780,
2146,
16,
22780,
15261,
16,
18701,
1033,
8526,
833,
16,
1645,
8526,
833,
40,
3083,
16,
18701,
509,
1501,
10544,
16,
509,
1501,
1380,
16,
18701... |
descBuf.append("\n<br>"); } DCValue[] editors = dspaceItem.getDC("contributor", "editor", Item.ANY); if (editors.length > 0) { descBuf.append("editors: "); for (int i = 0; i < editors.length; i++) | DCValue[] values = dspaceItem.getMetadata(field); if(values != null && values.length>0) | private com.sun.syndication.feed.rss.Item itemFromDSpaceItem(Context context, Item dspaceItem) throws SQLException { com.sun.syndication.feed.rss.Item rssItem = new com.sun.syndication.feed.rss.Item(); String itHandle = ConfigurationManager.getBooleanProperty("webui.feed.localresolve") ? HandleManager.resolveToURL(context, dspaceItem.getHandle()) : HandleManager.getCanonicalForm(dspaceItem.getHandle()); rssItem.setLink(itHandle); String title = getDC(dspaceItem, "title", null, Item.ANY); if (title == null) { title = "no_title"; } rssItem.setTitle(title); // We put some metadata in the description field. This field is // displayed by most RSS viewers StringBuffer descBuf = new StringBuffer(); if ( ! "no_title".equals(title) ) { descBuf.append("title: "); descBuf.append(title); descBuf.append(" "); } DCValue[] authors = dspaceItem.getDC("contributor", "author", Item.ANY); if (authors.length > 0) { descBuf.append("authors: "); for (int i = 0; i < authors.length; i++) { descBuf.append(authors[i].value); if (i < authors.length - 1) { descBuf.append("; "); } } descBuf.append("\n<br>"); } DCValue[] editors = dspaceItem.getDC("contributor", "editor", Item.ANY); if (editors.length > 0) { descBuf.append("editors: "); for (int i = 0; i < editors.length; i++) { descBuf.append(editors[i].value); if (i < editors.length - 1) { descBuf.append("; "); } } descBuf.append("\n<br>"); } String abstr = getDC(dspaceItem, "description", "abstract", Item.ANY); if (abstr != null) { descBuf.append("abstract: "); descBuf.append(abstr); descBuf.append("\n<br>"); } String desc = getDC(dspaceItem, "description", null, Item.ANY); if (desc != null) { descBuf.append("description: "); descBuf.append(desc); descBuf.append("\n<br>"); } Description descrip = new Description(); descrip.setValue(descBuf.toString()); rssItem.setDescription(descrip); String dcDate = getDC(dspaceItem, "date", "issued", Item.ANY); if (dcDate == null) { dcDate = getDC(dspaceItem, "date", Item.ANY, Item.ANY); } if (dcDate != null) { rssItem.setPubDate((new DCDate(dcDate)).toDate()); } return rssItem; } | 52457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52457/fcc0d2476856aa25d82fa8b5caaf95b53b167b17/FeedServlet.java/buggy/dspace/src/org/dspace/app/webui/servlet/FeedServlet.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
532,
18,
16924,
18,
11982,
72,
829,
18,
7848,
18,
25151,
18,
1180,
761,
1265,
40,
3819,
1180,
12,
1042,
819,
16,
377,
1082,
4766,
5397,
4342,
302,
2981,
1180,
13,
377,
202,
15069,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
532,
18,
16924,
18,
11982,
72,
829,
18,
7848,
18,
25151,
18,
1180,
761,
1265,
40,
3819,
1180,
12,
1042,
819,
16,
377,
1082,
4766,
5397,
4342,
302,
2981,
1180,
13,
377,
202,
15069,... |
&& (lastNavigatedText != null)) lastNavigatedText.setSelection(lastNavigatedText | && (lastNavigatedText != null)) { lastNavigatedText.setSelection(lastNavigatedText | public void focusGained(FocusEvent e) { currentText = (StyledText) e.widget; // Remove highlighted selection if text widget has changed if ((currentText != lastNavigatedText) && (lastNavigatedText != null)) lastNavigatedText.setSelection(lastNavigatedText .getSelection().x); // enable/disable copy action copyAction.setEnabled(currentText.getSelectionCount() > 0); } | 57470 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57470/e38d295ea613cf9f08aadb93a84a33d2e91abc5f/WelcomeEditor.java/clean/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/WelcomeEditor.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
2398,
1071,
918,
7155,
43,
8707,
12,
9233,
1133,
425,
13,
288,
7734,
783,
1528,
273,
261,
24273,
1259,
1528,
13,
425,
18,
6587,
31,
7734,
368,
3581,
24375,
4421,
309,
977,
3604,
711,
3550,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
2398,
1071,
918,
7155,
43,
8707,
12,
9233,
1133,
425,
13,
288,
7734,
783,
1528,
273,
261,
24273,
1259,
1528,
13,
425,
18,
6587,
31,
7734,
368,
3581,
24375,
4421,
309,
977,
3604,
711,
3550,
7... |
catch (EvaluateException e) { descriptor[0] = null; | catch (EvaluateException ignored) { | private static MethodDescriptor getMethodDescriptor(final Project project, final PsiJavaFile psiJavaFile, final int line) { final Document document = PsiDocumentManager.getInstance(project).getDocument(psiJavaFile); if(document == null) return null; final int endOffset = document.getLineEndOffset(line); final MethodDescriptor[] descriptor = new MethodDescriptor[]{null}; PsiDocumentManager.getInstance(project).commitAndRunReadAction(new Runnable() { public void run() { try { PsiMethod method = DebuggerUtilsEx.findPsiMethod(psiJavaFile, endOffset); if(method == null || document.getLineNumber(method.getTextOffset()) < line) return; int methodNameOffset = method.getNameIdentifier().getTextOffset(); descriptor[0] = new MethodDescriptor(); //noinspection HardCodedStringLiteral descriptor[0].methodName = method.isConstructor() ? "<init>" : method.getName(); descriptor[0].methodSignature = JVMNameUtil.getJVMSignature(method); descriptor[0].isStatic = method.hasModifierProperty(PsiModifier.STATIC); descriptor[0].methodLine = document.getLineNumber(methodNameOffset); } catch (EvaluateException e) { descriptor[0] = null; } } }); if (descriptor[0] == null) { return null; } if (descriptor[0].methodName == null || descriptor[0].methodSignature == null) { return null; } return descriptor[0]; } | 56627 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/56627/c185097763506f95b21376899c010b6b17464d2d/MethodBreakpoint.java/clean/debugger/impl/com/intellij/debugger/ui/breakpoints/MethodBreakpoint.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
3238,
760,
2985,
3187,
6272,
3187,
12,
6385,
5420,
1984,
16,
727,
453,
7722,
5852,
812,
23921,
5852,
812,
16,
727,
509,
980,
13,
288,
565,
727,
4319,
1668,
273,
453,
7722,
2519,
1318,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
3238,
760,
2985,
3187,
6272,
3187,
12,
6385,
5420,
1984,
16,
727,
453,
7722,
5852,
812,
23921,
5852,
812,
16,
727,
509,
980,
13,
288,
565,
727,
4319,
1668,
273,
453,
7722,
2519,
1318,
1... |
protected String findDefaultEncoding() { if (resource instanceof IWorkspaceRoot) return super.findDefaultEncoding(); String defaultCharset = getCharsetFromDescription(); defaultCharset = getCharsetFromDescription(); if (defaultCharset != null && defaultCharset.length() > 0) return defaultCharset; try { //Query up the whole hierarchy defaultCharset = resource.getParent().getDefaultCharset(true); } catch (CoreException exception) { //If there is an exception try again } if (defaultCharset != null && defaultCharset.length() > 0) return defaultCharset; return super.findDefaultEncoding(); } | 58148 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58148/3d3b6350e58f7038bc33f0a8af57d3a0cb8aab78/ResourceEncodingFieldEditor.java/clean/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/ide/dialogs/ResourceEncodingFieldEditor.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
514,
1104,
1868,
4705,
1435,
288,
202,
202,
430,
261,
3146,
1276,
467,
8241,
2375,
13,
1082,
202,
2463,
2240,
18,
4720,
1868,
4705,
5621,
202,
202,
780,
805,
9652,
273,
30428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
514,
1104,
1868,
4705,
1435,
288,
202,
202,
430,
261,
3146,
1276,
467,
8241,
2375,
13,
1082,
202,
2463,
2240,
18,
4720,
1868,
4705,
5621,
202,
202,
780,
805,
9652,
273,
30428,
... | ||
vec.add( templateMapper.createHtmlOptionListOfTemplates( templateMapper.createHtmlOptionListOfAllTemplatesExceptOne( template ), null ) ); | vec.add( templateMapper.createHtmlOptionListOfTemplates( templateMapper.getArrayOfAllTemplatesExceptOne( template ), null ) ); | static String createDeleteTemplateInUseWarningDialog( String lang, ImcmsServices imcref, TemplateDomainObject template, UserDomainObject user, TemplateMapper templateMapper ) { String htmlStr; List vec = new ArrayList(); vec.add( "#language#" ); vec.add( lang ); vec.add( "#template#" ); vec.add( String.valueOf( template.getId() ) ); vec.add( "#docs#" ); vec.add( createHtmlOptionListOfDocumentsUsingTemplate( imcref, template, user ) ); vec.add( "#templates#" ); vec.add( templateMapper.createHtmlOptionListOfTemplates( templateMapper.createHtmlOptionListOfAllTemplatesExceptOne( template ), null ) ); htmlStr = imcref.getAdminTemplate( TEMPLATE_DELETE_WARNING, user, vec ); return htmlStr; } | 8781 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/8781/e5c56826e052da882fd637db26e8d74de6ceef44/TemplateAdmin.java/buggy/server/src/com/imcode/imcms/servlet/superadmin/TemplateAdmin.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
760,
514,
752,
2613,
2283,
15435,
6210,
6353,
12,
514,
3303,
16,
2221,
6851,
5676,
709,
71,
1734,
16,
4766,
8227,
5035,
3748,
921,
1542,
16,
2177,
3748,
921,
729,
16,
4766,
8227,
5035,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
760,
514,
752,
2613,
2283,
15435,
6210,
6353,
12,
514,
3303,
16,
2221,
6851,
5676,
709,
71,
1734,
16,
4766,
8227,
5035,
3748,
921,
1542,
16,
2177,
3748,
921,
729,
16,
4766,
8227,
5035,
... |
lineSeparatorEditor = new LineDelimiterEditor(composite); | Composite lineComposite = new Composite(lower,SWT.NONE); lineComposite.setLayout(new GridLayout()); lineComposite.setLayoutData(new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); lineSeparatorEditor = new LineDelimiterEditor(lineComposite); | protected Control createContents(Composite parent) { Composite composite = createComposite(parent); PreferenceLinkArea fileEditorsArea = new PreferenceLinkArea(composite, SWT.NONE, "org.eclipse.ui.preferencePages.FileEditors", IDEWorkbenchMessages.IDEEditorsPreferencePage_WorkbenchPreference_FileEditorsRelatedLink,//$NON-NLS-1$ (IWorkbenchPreferenceContainer) getContainer(),null); GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); fileEditorsArea.getControl().setLayoutData(data); PreferenceLinkArea contentTypeArea = new PreferenceLinkArea(composite, SWT.NONE, "org.eclipse.ui.preferencePages.ContentTypes", IDEWorkbenchMessages.IDEEditorsPreferencePage_WorkbenchPreference_contentTypesRelatedLink,//$NON-NLS-1$ (IWorkbenchPreferenceContainer) getContainer(),null); data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); contentTypeArea.getControl().setLayoutData(data); PreferenceLinkArea appearanceArea = new PreferenceLinkArea(composite, SWT.NONE, "org.eclipse.ui.preferencePages.Views", IDEWorkbenchMessages.IDEEditorsPreferencePage_WorkbenchPreference_viewsRelatedLink,//$NON-NLS-1$ (IWorkbenchPreferenceContainer) getContainer(),null); data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); appearanceArea.getControl().setLayoutData(data); Label space = new Label(composite,SWT.NONE); space.setLayoutData(new GridData()); createEditorHistoryGroup(composite); createSpace(composite); createShowMultipleEditorTabsPref(composite); createEditorReuseGroup(composite); createSpace(composite); encodingEditor = new ResourceEncodingFieldEditor(IDEWorkbenchMessages.WorkbenchPreference_encoding, composite, ResourcesPlugin .getWorkspace().getRoot()); encodingEditor.setPage(this); encodingEditor.load(); encodingEditor.setPropertyChangeListener(new IPropertyChangeListener() { /* (non-Javadoc) * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.IS_VALID)) updateValidState(); } }); lineSeparatorEditor = new LineDelimiterEditor(composite); lineSeparatorEditor.doLoad(); // @issue need IDE-level help for this page // WorkbenchHelp.setHelp(parent, // IHelpContextIds.WORKBENCH_EDITOR_PREFERENCE_PAGE); return composite; } | 58148 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/58148/288f0dec8f8e21f3a2d4ed8105e5c6a0b7e8f30b/IDEEditorsPreferencePage.java/buggy/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/IDEEditorsPreferencePage.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
8888,
752,
6323,
12,
9400,
982,
13,
288,
202,
202,
9400,
9635,
273,
752,
9400,
12,
2938,
1769,
540,
202,
202,
9624,
2098,
5484,
585,
4666,
1383,
5484,
273,
394,
29125,
2098,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
8888,
752,
6323,
12,
9400,
982,
13,
288,
202,
202,
9400,
9635,
273,
752,
9400,
12,
2938,
1769,
540,
202,
202,
9624,
2098,
5484,
585,
4666,
1383,
5484,
273,
394,
29125,
2098,
... |
validateExpression( resultObject, resultOp1 ); | public static Object evalConditionalExpr( Object resultObject, int operator, Object resultOp1, Object resultOp2 ) throws DataException { if ( logger.isLoggable( Level.FINER ) ) logger.entering( ScriptEvalUtil.class.getName( ), "evalConditionalExpr", "evalConditionalExpr() resultObject=" + LogUtil.toString( resultObject ) + ", operator=" + operator + ( resultOp1 == null? null: ( ", resultOp1=" + LogUtil.toString( resultOp1 ) ) ) + ( resultOp2 == null? null: ( ", resultOp2=" + LogUtil.toString( resultOp2 ) ) ) ); boolean result = false; switch ( operator ) { case IConditionalExpression.OP_EQ : validateExpression( resultObject, resultOp1 ); result = compare( resultObject, resultOp1 ) == 0; break; case IConditionalExpression.OP_NE : validateExpression( resultObject, resultOp1 ); result = compare( resultObject, resultOp1 ) != 0; break; case IConditionalExpression.OP_LT : validateExpression( resultObject, resultOp1 ); result = compare( resultObject, resultOp1 ) < 0; break; case IConditionalExpression.OP_LE : validateExpression( resultObject, resultOp1 ); result = compare( resultObject, resultOp1 ) <= 0; break; case IConditionalExpression.OP_GE : validateExpression( resultObject, resultOp1 ); result = compare( resultObject, resultOp1 ) >= 0; break; case IConditionalExpression.OP_GT : validateExpression( resultObject, resultOp1 ); result = compare( resultObject, resultOp1 ) > 0; break; case IConditionalExpression.OP_BETWEEN : validateExpression( resultObject, resultOp1, resultOp2 ); result = between( resultObject, resultOp1, resultOp2 ); break; case IConditionalExpression.OP_NOT_BETWEEN : validateExpression( resultObject, resultOp1, resultOp2 ); result = !( between( resultObject, resultOp1, resultOp2 ) ); break; case IConditionalExpression.OP_NULL : result = resultObject == null; break; case IConditionalExpression.OP_NOT_NULL : result = resultObject != null; break; case IConditionalExpression.OP_TRUE : validateExpression( resultObject ); result = isTrue( resultObject ); break; case IConditionalExpression.OP_FALSE : validateExpression( resultObject ); result = !isTrue( resultObject ); break; case IConditionalExpression.OP_LIKE : validateExpression( resultObject, resultOp1 ); result = like( resultObject, resultOp1 ); break; case IConditionalExpression.OP_TOP_N : //TODO throw new DataException( ResourceConstants.UNSUPPORTTED_COND_OPERATOR, "TopN" ); case IConditionalExpression.OP_BOTTOM_N : //TODO throw new DataException( ResourceConstants.UNSUPPORTTED_COND_OPERATOR, "BottomN" ); case IConditionalExpression.OP_TOP_PERCENT : throw new DataException( ResourceConstants.UNSUPPORTTED_COND_OPERATOR, "TopNPercent" ); case IConditionalExpression.OP_BOTTOM_PERCENT : throw new DataException( ResourceConstants.UNSUPPORTTED_COND_OPERATOR, "BottomNPercent" ); case IConditionalExpression.OP_ANY : throw new DataException( ResourceConstants.UNSUPPORTTED_COND_OPERATOR, "ANY" ); default : throw new DataException( ResourceConstants.UNSUPPORTTED_COND_OPERATOR, new Integer(operator) ); } logger.exiting( ScriptEvalUtil.class.getName( ), "evalConditionalExpr", new Boolean( result ) ); return new Boolean( result ); } | 46013 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46013/866f4f23bd4f7b70478c7081adbe6c72e210634a/ScriptEvalUtil.java/clean/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/script/ScriptEvalUtil.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
760,
1033,
5302,
14132,
4742,
12,
1033,
563,
921,
16,
1082,
202,
474,
3726,
16,
1033,
563,
3817,
21,
16,
1033,
563,
3817,
22,
262,
1082,
202,
15069,
1910,
503,
202,
95,
202,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
760,
1033,
5302,
14132,
4742,
12,
1033,
563,
921,
16,
1082,
202,
474,
3726,
16,
1033,
563,
3817,
21,
16,
1033,
563,
3817,
22,
262,
1082,
202,
15069,
1910,
503,
202,
95,
202,
... | |
context.operands.push( ( (Font) data[0]).deriveFont( ( (Number) data[1]). floatValue())); | java.awt.Font fn=( (java.awt.Font) data[0]).deriveFont( ( (Number) data[1]). floatValue()); System.out.println("Fonthoehe:"+fn.getSize2D()); context.operands.push(fn ); | public void execute(PAContext context) throws PainterException { Object data[]; data = context.popOperands(2); if (! (data[0] instanceof Font)) { throw new PainterException("scalefont: wrong arguments"); } if (! (data[1] instanceof Number)) { throw new PainterException("scalefont: wrong arguments"); } context.operands.push( ( (Font) data[0]).deriveFont( ( (Number) data[1]). floatValue())); } | 4174 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/4174/f1bf50c651cb7c4f69dfb32ac954ac18bacdb38c/PAContext.java/clean/src/com/lowagie/text/pdf/codec/postscript/PAContext.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
4202,
1071,
918,
1836,
12,
4066,
1042,
819,
13,
1216,
453,
11606,
503,
288,
3639,
1033,
501,
8526,
31,
3639,
501,
273,
819,
18,
5120,
3542,
5708,
12,
22,
1769,
3639,
309,
16051,
261,
892,
63... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
4202,
1071,
918,
1836,
12,
4066,
1042,
819,
13,
1216,
453,
11606,
503,
288,
3639,
1033,
501,
8526,
31,
3639,
501,
273,
819,
18,
5120,
3542,
5708,
12,
22,
1769,
3639,
309,
16051,
261,
892,
63... |
_contentLength = BufferUtil.toInt(value); | _contentLength=BufferUtil.toInt(value); | public boolean parseNext() throws IOException { if (_buffer==null) { _header = _buffers.getBuffer(_headerBufferSize); _buffer = _header; _tok0 = new View(_header); _tok1 = new View(_header); _tok0.setPutIndex(_tok0.getIndex()); _tok1.setPutIndex(_tok1.getIndex()); } if (_state == STATE_END) throw new IllegalStateException("STATE_END"); if (_state == STATE_CONTENT && _contentPosition == _contentLength) { _state = STATE_END; _handler.messageComplete(_contentPosition); return false; } int length=_buffer.length(); boolean fill_called=false; // Fill buffer if we can if (length == 0) { int filled = -1; if (_content!=null && _buffer!=_content) { _buffer=_content; filled=_buffer.length(); } if (_buffer.markIndex() == 0 && _buffer.putIndex() == _buffer.capacity()) throw new IOException("FULL"); if (_endp != null && filled<=0) { // Compress buffer if handling _content buffer // TODO check this is not moving data too much if (_buffer == _content) _buffer.compact(); if (_buffer.space() == 0) { throw new IOException("FULL"); } try { filled = _endp.fill(_buffer); fill_called=true; } catch(IOException ioe) { Log.debug(ioe); reset(true); throw new IOException("EOF"); } } if (filled < 0 && _state == STATE_EOF_CONTENT) { _state = STATE_END; _handler.messageComplete(_contentPosition); return fill_called; } if (filled < 0) { reset(true); throw new IOException("EOF"); } length=_buffer.length(); } // EventHandler header byte ch; byte[] array = _buffer.array(); Buffer cached = null; while (_state < STATE_END && length-->0) { ch = _buffer.get(); if (_eol == CARRIAGE_RETURN && ch == LINE_FEED) { _eol = LINE_FEED; continue; } _eol = 0; switch (_state) { case STATE_START: _contentLength = UNKNOWN_CONTENT; if (ch > SPACE) { _buffer.mark(); _state = STATE_FIELD0; } break; case STATE_FIELD0: if (ch == SPACE) { _tok0.update(_buffer.markIndex(), _buffer.getIndex() - 1); _state = STATE_SPACE1; continue; } else if (ch < SPACE) { throw new IOException("BAD"); } break; case STATE_SPACE1: if (ch > SPACE) { _buffer.mark(); _state = STATE_FIELD1; _response = ch >= '1' && ch <= '5'; } else if (ch < SPACE) { throw new IOException("BAD"); } break; case STATE_FIELD1: if (ch == SPACE) { _tok1.update(_buffer.markIndex(), _buffer.getIndex() - 1); _state = STATE_SPACE2; continue; } else if (ch < SPACE) { // HTTP/0.9 _handler.startRequest(HttpMethods.CACHE.lookup(_tok0), _buffer .sliceFromMark(), null); _state = STATE_END; _handler.headerComplete(); _handler.messageComplete(_contentPosition); return fill_called; } break; case STATE_SPACE2: if (ch > SPACE) { _buffer.mark(); _state = STATE_FIELD2; } else if (ch < SPACE) { // HTTP/0.9 _handler.startRequest(HttpMethods.CACHE.lookup(_tok0), _tok1, null); _state = STATE_END; _handler.headerComplete(); _handler.messageComplete(_contentPosition); return fill_called; } break; case STATE_FIELD2: if (ch == CARRIAGE_RETURN || ch == LINE_FEED) { if (_response) _handler.startResponse(HttpVersions.CACHE.lookup(_tok0), BufferUtil .toInt(_tok1), _buffer.sliceFromMark()); else _handler.startRequest(HttpMethods.CACHE.lookup(_tok0), _tok1, HttpVersions.CACHE.lookup(_buffer.sliceFromMark())); _eol = ch; _state = STATE_HEADER; _tok0.setPutIndex(_tok0.getIndex()); _tok1.setPutIndex(_tok1.getIndex()); _multiLineValue = null; return fill_called; } break; case STATE_HEADER: if (ch == COLON || ch == SPACE || ch == TAB) { // header value without name - continuation? _length = -1; _state = STATE_HEADER_VALUE; } else { // handler last header if any if (cached!=null || _tok0.length() > 0 || _tok1.length() > 0 || _multiLineValue != null) { Buffer header = cached!=null?cached:HttpHeaders.CACHE.lookup(_tok0); cached=null; Buffer value = _multiLineValue == null ? (Buffer) _tok1 : (Buffer) new ByteArrayBuffer(_multiLineValue); int ho = HttpHeaders.CACHE.getOrdinal(header); if (ho >= 0) { int vo = -1; switch (ho) { case HttpHeaders.CONTENT_LENGTH_ORDINAL: if (_contentLength != CHUNKED_CONTENT) { _contentLength = BufferUtil.toInt(value); if (_contentLength <= 0) _contentLength = HttpParser.NO_CONTENT; } break; case HttpHeaders.CONNECTION_ORDINAL: // TODO comma list of connections !!! value = HttpHeaderValues.CACHE.lookup(value); break; case HttpHeaders.TRANSFER_ENCODING_ORDINAL: value = HttpHeaderValues.CACHE.lookup(value); vo=HttpHeaderValues.CACHE.getOrdinal(value); if (HttpHeaderValues.CHUNKED_ORDINAL == vo) _contentLength = CHUNKED_CONTENT; else { // TODO avoid string conversion here String c = value.toString(); if (c.endsWith(HttpHeaderValues.CHUNKED)) _contentLength = CHUNKED_CONTENT; else if (c.indexOf(HttpHeaderValues.CHUNKED) >= 0) throw new HttpException(400,null); } break; case HttpHeaders.CONTENT_TYPE_ORDINAL: _hasContent = true; break; } } _handler.parsedHeader(header, value); _tok0.setPutIndex(_tok0.getIndex()); _tok1.setPutIndex(_tok1.getIndex()); _multiLineValue = null; } // now handle ch if (ch == CARRIAGE_RETURN || ch == LINE_FEED) { // End of header // work out the _content demarcation if (_contentLength == UNKNOWN_CONTENT) { if (_hasContent || _response) _contentLength = EOF_CONTENT; else _contentLength = NO_CONTENT; } _contentPosition = 0; _eol = ch; switch (_contentLength) { case HttpParser.EOF_CONTENT: _state = STATE_EOF_CONTENT; if(_content==null && _buffers!=null) _content=_buffers.getBuffer(_contentBufferSize); _handler.headerComplete(); // May recurse here ! break; case HttpParser.CHUNKED_CONTENT: _state = STATE_CHUNKED_CONTENT; if (_content==null && _buffers!=null) _content=_buffers.getBuffer(_contentBufferSize); _handler.headerComplete(); // May recurse here ! break; case HttpParser.NO_CONTENT: _state = STATE_END; _handler.headerComplete(); // May recurse here ! _handler.messageComplete(_contentPosition); break; default: _state = STATE_CONTENT; if(_buffers!=null && _content==null && _buffer==_header && _contentLength>(_header.capacity()-_header.getIndex())) _content=_buffers.getBuffer(_contentBufferSize); _handler.headerComplete(); // May recurse here ! break; } return fill_called; } else { // New header _length = 1; _buffer.mark(); _state = STATE_HEADER_NAME; // try cached name! cached = HttpHeaders.CACHE.getBest(array, _buffer.markIndex(), length+1); if (cached!=null) { _length=cached.length(); _buffer.setGetIndex(_buffer.markIndex()+_length); length=_buffer.length(); } } } break; case STATE_HEADER_NAME: if (ch == CARRIAGE_RETURN || ch == LINE_FEED) { if (_length > 0) _tok0.update(_buffer.markIndex(), _buffer.markIndex() + _length); _eol = ch; _state = STATE_HEADER; } else if (ch == COLON) { if (_length > 0 && cached==null) _tok0.update(_buffer.markIndex(), _buffer.markIndex() + _length); _length = -1; _state = STATE_HEADER_VALUE; } else if (ch != SPACE && ch != TAB) { // Drag the mark if (_length == -1) _buffer.mark(); _length = _buffer.getIndex() - _buffer.markIndex(); } break; case STATE_HEADER_VALUE: if (ch == CARRIAGE_RETURN || ch == LINE_FEED) { if (_length > 0) { if (_tok1.length() == 0) _tok1.update(_buffer.markIndex(), _buffer.markIndex() + _length); else { // Continuation line! // TODO - deal with CR LF and COLON? if (_multiLineValue == null) _multiLineValue = _tok1.toString(); _tok1.update(_buffer.markIndex(), _buffer.markIndex() + _length); _multiLineValue += " " + _tok1.toString(); } } _eol = ch; _state = STATE_HEADER; } else if (ch != SPACE && ch != TAB) { if (_length == -1) _buffer.mark(); _length = _buffer.getIndex() - _buffer.markIndex(); } break; } } // end of HEADER states loop // Handle _content Buffer chunk; length = _buffer.length(); while (_state > STATE_END && length > 0) { if (_eol == CARRIAGE_RETURN && _buffer.peek() == LINE_FEED) { _eol = _buffer.get(); length = _buffer.length(); continue; } _eol = 0; switch (_state) { case STATE_EOF_CONTENT: chunk = _buffer.get(_buffer.length()); _contentPosition += chunk.length(); _handler.content(chunk); return fill_called; case STATE_CONTENT: { int remaining = _contentLength - _contentPosition; if (remaining == 0) { _state = STATE_END; _handler.messageComplete(_contentPosition); return fill_called; } else if (length > remaining) length = remaining; chunk = _buffer.get(length); _contentPosition += chunk.length(); _handler.content(chunk); return fill_called; } case STATE_CHUNKED_CONTENT: { ch = _buffer.peek(); if (ch == CARRIAGE_RETURN || ch == LINE_FEED) _eol = _buffer.get(); else if (ch <= SPACE) _buffer.get(); else { _chunkLength = 0; _chunkPosition = 0; _state = STATE_CHUNK_SIZE; } break; } case STATE_CHUNK_SIZE: { ch = _buffer.get(); if (ch == CARRIAGE_RETURN || ch == LINE_FEED) { _eol = ch; if (_chunkLength == 0) { _state = STATE_END; _handler.messageComplete(_contentPosition); return fill_called; } else _state = STATE_CHUNK; } else if (ch <= SPACE || ch == SEMI_COLON) _state = STATE_CHUNK_PARAMS; else if (ch >= '0' && ch <= '9') _chunkLength = _chunkLength * 16 + (ch - '0'); else if (ch >= 'a' && ch <= 'f') _chunkLength = _chunkLength * 16 + (10 + ch - 'a'); else if (ch >= 'A' && ch <= 'F') _chunkLength = _chunkLength * 16 + (10 + ch - 'A'); else throw new IOException("bad chunk char: " + ch); break; } case STATE_CHUNK_PARAMS: { ch = _buffer.get(); if (ch == CARRIAGE_RETURN || ch == LINE_FEED) { _eol = ch; if (_chunkLength == 0) { _state = STATE_END; _handler.messageComplete(_contentPosition); return fill_called; } else _state = STATE_CHUNK; } break; } case STATE_CHUNK: { int remaining = _chunkLength - _chunkPosition; if (remaining == 0) { _state = STATE_CHUNKED_CONTENT; break; } else if (length > remaining) length = remaining; chunk = _buffer.get(length); _contentPosition += chunk.length(); _chunkPosition += chunk.length(); _handler.content(chunk); return fill_called; } } length = _buffer.length(); } return fill_called; } | 13242 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/13242/ca67d639c4b4cf51ddb7b16c09566ea524f43a6f/HttpParser.java/buggy/trunk/modules/jetty/src/main/java/org/mortbay/jetty/HttpParser.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
1250,
1109,
2134,
1435,
1216,
1860,
565,
288,
3639,
309,
261,
67,
4106,
631,
2011,
13,
3639,
288,
5411,
389,
3374,
273,
389,
28101,
18,
588,
1892,
24899,
3374,
15384,
1769,
5411,
38... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
1250,
1109,
2134,
1435,
1216,
1860,
565,
288,
3639,
309,
261,
67,
4106,
631,
2011,
13,
3639,
288,
5411,
389,
3374,
273,
389,
28101,
18,
588,
1892,
24899,
3374,
15384,
1769,
5411,
38... |
InetAddress addr = this.getAddress(); if (addr == null) throw new UnknownHostException(); dos.write(addr.getAddress()); | addr.writeToDataOutputStream(dos); | public void writeToDataOutputStream(DataOutputStream dos) throws IOException { InetAddress addr = this.getAddress(); if (addr == null) throw new UnknownHostException(); dos.write(addr.getAddress()); dos.writeInt(_port); } | 56348 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/56348/474d190c633c367c5c3ff7fbe0f75a1ea669294b/Peer.java/buggy/src/freenet/io/comm/Peer.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
12870,
751,
4632,
12,
751,
4632,
16153,
13,
1216,
1860,
288,
202,
202,
382,
278,
1887,
3091,
273,
333,
18,
588,
1887,
5621,
202,
202,
430,
261,
4793,
422,
446,
13,
604,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
12870,
751,
4632,
12,
751,
4632,
16153,
13,
1216,
1860,
288,
202,
202,
382,
278,
1887,
3091,
273,
333,
18,
588,
1887,
5621,
202,
202,
430,
261,
4793,
422,
446,
13,
604,
... |
throw new NoSuchFieldException( name ); | private static Field getField0(Class C, String name, int which) throws NoSuchFieldException { if (!java.lang.JikesRVMSupport.getTypeForClass(C).isClassType()) throw new NoSuchFieldException(); VM_Field vm_instance_fields[] = null; VM_Field vm_other_fields[] = null; if ( which == Member.PUBLIC ) { vm_instance_fields = java.lang.JikesRVMSupport.getTypeForClass(C).getInstanceFields(); vm_other_fields = java.lang.JikesRVMSupport.getTypeForClass(C).getStaticFields(); } else { vm_instance_fields = new VM_Field[0]; vm_other_fields = java.lang.JikesRVMSupport.getTypeForClass(C).asClass().getDeclaredFields(); } // TODO: Problem here with User flooding the atom dictionary if // getMethod used too many times with different not existing names // Solution: create a VM_Atom.findUnicodeAtom method.. to be done later. // - Eugene VM_Atom aName = VM_Atom.findOrCreateUnicodeAtom( name ); for (int j = 0; j < vm_other_fields.length; j++) { if ( ! ( which == Member.PUBLIC && !vm_other_fields[j].isPublic() ) && ( vm_other_fields[j].getName() == aName ) ) return java.lang.reflect.JikesRVMSupport.createField( vm_other_fields[j] ); } for (int j = 0; j < vm_instance_fields.length; j++) { if ( ! ( which == Member.PUBLIC && !vm_instance_fields[j].isPublic() ) && ( vm_instance_fields[j].getName() == aName ) ) return java.lang.reflect.JikesRVMSupport.createField(vm_instance_fields[j]); } throw new NoSuchFieldException( name ); } | 49871 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/49871/705cb85b3c7e05696189446f5268011580d80945/ReflectionSupport.java/buggy/rvm/src/vm/libSupport/ReflectionSupport.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
3238,
760,
2286,
5031,
20,
12,
797,
385,
16,
514,
508,
16,
509,
1492,
13,
565,
1216,
5823,
28846,
288,
1377,
309,
16051,
6290,
18,
4936,
18,
46,
25235,
54,
7397,
6289,
18,
588,
559,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
3238,
760,
2286,
5031,
20,
12,
797,
385,
16,
514,
508,
16,
509,
1492,
13,
565,
1216,
5823,
28846,
288,
1377,
309,
16051,
6290,
18,
4936,
18,
46,
25235,
54,
7397,
6289,
18,
588,
559,
2... | |
output = compare.replaceAll("\r",""); output = compare.replaceAll("\n",""); | output = StringUtils.replace(compare,"\r",""); output = StringUtils.replace(output,"\n",""); | public void endRequestScopeNameIterateMap (WebResponse response){ String output = response.getText(); String compare = ""; for (int i = 0; i < iterations; i++) { compare += "test" + i; } //fix for introduced carriage return / line feeds output = compare.replaceAll("\r",""); output = compare.replaceAll("\n",""); assertEquals(compare, output); } | 48068 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/48068/d35243d93417203419685737c1434918c5e62bae/TestIterateTag.java/clean/src/test/org/apache/struts/taglib/logic/TestIterateTag.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
679,
691,
3876,
461,
14916,
863,
261,
4079,
1064,
766,
15329,
202,
565,
514,
876,
273,
766,
18,
588,
1528,
5621,
202,
565,
514,
3400,
273,
1408,
31,
202,
565,
364,
261,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
679,
691,
3876,
461,
14916,
863,
261,
4079,
1064,
766,
15329,
202,
565,
514,
876,
273,
766,
18,
588,
1528,
5621,
202,
565,
514,
3400,
273,
1408,
31,
202,
565,
364,
261,
... |
System.out.println("removed 2" + p.getName()); | public void delete(int index) { List currentTasks = pipelineModel.getTasks(); // check if other tasks inherit from this task or subsequent tasks for (int i = index; i < currentTasks.size(); i++) { JobSubmission js = (JobSubmission) currentTasks.get(i); List parameterInfo = js.getParameters(); for (int j = 0; j < parameterInfo.size(); j++) { ParameterInfo p = (ParameterInfo) parameterInfo.get(j); Map parameterAttributes = p.getAttributes(); if (parameterAttributes != null) { String taskNumberString = (String) parameterAttributes .get(PipelineModel.INHERIT_TASKNAME); System.out.println("taskNumberString " + taskNumberString + "index " + index); if (taskNumberString != null) { int taskNumber = Integer.parseInt(taskNumberString); if (taskNumber == index) { // lost inheritance parameterAttributes .remove(PipelineModel.INHERIT_TASKNAME); parameterAttributes .remove(PipelineModel.INHERIT_FILENAME); System.out .println("lost inheritance " + taskNumber); } else if (taskNumber > index) { // inherits from a task that comes after deleted task parameterAttributes.put( PipelineModel.INHERIT_TASKNAME, String .valueOf(taskNumber)); // decrease task number by one } } } } } JobSubmission removedJob = (JobSubmission) currentTasks.remove(index); String removedJobName = removedJob.getName(); // remove parameters that start with removed task name + removed task number + . TreeMap currentInputParameters = pipelineModel.getInputParameters(); String removeParameter = removedJobName + (index+1) + "."; for (Iterator it = currentInputParameters.keySet().iterator(); it .hasNext();) { String key = (String) it.next(); if (key.startsWith(removeParameter)) { System.out.println("removed " + key); currentInputParameters.remove(key); } } if (pipelineTaskInfo.getParameterInfoArray() != null) { List parameters = new ArrayList(Arrays.asList(pipelineTaskInfo .getParameterInfoArray())); for (int i = 0; i < parameters.size(); i++) { ParameterInfo p = (ParameterInfo) parameters.get(i); if (p.getName().startsWith(removeParameter)) { parameters.remove(i); System.out.println("removed 2" + p.getName()); i--; } } pipelineTaskInfo.setParameterInfoArray((ParameterInfo[]) parameters .toArray(new ParameterInfo[0])); } System.out.println(currentInputParameters); setPipeline(pipelineTaskInfo, pipelineModel); } | 57344 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57344/e0d9394deeeb6d82dc7baeb98f4438ce1704e5ca/PipelineComponent.java/buggy/clients/JavaGE/src/org/genepattern/gpge/ui/tasks/PipelineComponent.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1430,
12,
474,
770,
13,
288,
202,
202,
682,
783,
6685,
273,
5873,
1488,
18,
588,
6685,
5621,
202,
202,
759,
866,
309,
1308,
4592,
6811,
628,
333,
1562,
578,
10815,
4592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1430,
12,
474,
770,
13,
288,
202,
202,
682,
783,
6685,
273,
5873,
1488,
18,
588,
6685,
5621,
202,
202,
759,
866,
309,
1308,
4592,
6811,
628,
333,
1562,
578,
10815,
4592,
... | |
clearChildren(); | children = new ArrayList<EntryWrapper>( 0 ); | public Object[] getChildren() { if ( children == null ) { children = new ArrayList<EntryWrapper>(); // Getting the Browser View BrowserView browserView = ( BrowserView ) PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().findView( BrowserView.ID ); try { if ( engine == null ) { // Initialization of the DSML Engine and the DSML Response Parser if ( connection.isAppendBaseDNtoUserDNWithBaseDN() ) { engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(), new LdapDN( connection .getUserDN().getNormName() + "," + connection.getBaseDN().getNormName() ).getNormName(), connection.getPassword() ); } else { engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(), connection .getUserDN().getNormName(), connection.getPassword() ); } } Dsmlv2ResponseParser parser = new Dsmlv2ResponseParser(); String request = "<batchRequest>" + " <searchRequest dn=\"" + connection.getBaseDN().getNormName() + "\"" + " scope=\"baseObject\" derefAliases=\"neverDerefAliases\">" + " <filter><present name=\"objectclass\"></present></filter>" + " <attributes>" + " <attribute name=\"*\"/>" + " <attribute name=\"namingContexts\"/>" + " <attribute name=\"subSchemaSubEntry\"/>" + " <attribute name=\"altServer\"/>" + " <attribute name=\"supportedExtension\"/>" + " <attribute name=\"supportedControl\"/>" + " <attribute name=\"supportedSaslMechanism\"/>" + " <attribute name=\"supportedLdapVersion\"/>" + " </attributes>" + " </searchRequest>" + "</batchRequest>"; // Executing the request and sending the result to the Response Parser parser.setInput( engine.processDSML( request ) ); parser.parse(); LdapResponse ldapResponse = parser.getBatchResponse().getCurrentResponse(); if ( ldapResponse instanceof SearchResponse ) { SearchResponse searchResponse = ( SearchResponse ) ldapResponse; LdapResult ldapResult = searchResponse.getSearchResultDone().getLdapResult(); if ( ldapResult.getResultCode() == 0 ) { // Getting the Base DN SearchResultEntry baseDN = ( ( SearchResponse ) ldapResponse ).getCurrentSearchResultEntry(); EntryWrapper baseDNWrapper = new EntryWrapper( baseDN ); baseDNWrapper.setParent( this ); baseDNWrapper.setIsBaseDN( true ); children.add( baseDNWrapper ); setState( ConnectionWrapperState.RUNNING ); browserView.getViewer().update( this, null ); } else { setState( ConnectionWrapperState.ERROR ); clearChildren(); browserView.getViewer().update( this, null ); // Displaying an error MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error !", "An error has ocurred.\n" + ldapResult.getErrorMessage() ); return null; } } else if ( ldapResponse instanceof ErrorResponse ) { setState( ConnectionWrapperState.ERROR ); clearChildren(); browserView.getViewer().update( this, null ); ErrorResponse errorResponse = ( ErrorResponse ) ldapResponse; // Displaying an error MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error !", "An error has ocurred.\n" + errorResponse.getMessage() ); return null; } } catch ( Exception e ) { // Displaying an error MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error !", "An error has ocurred.\n" + e.getMessage() ); return null; } } return children.toArray( new Object[0] ); } | 53916 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/53916/eb30590ec01c3690fed388a54ec35c5139b35d6b/ConnectionWrapper.java/clean/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/wrappers/ConnectionWrapper.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
1033,
8526,
10268,
1435,
565,
288,
3639,
309,
261,
2325,
422,
446,
262,
3639,
288,
5411,
2325,
273,
394,
2407,
32,
1622,
3611,
34,
5621,
5411,
368,
26602,
326,
15408,
4441,
5411,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
1033,
8526,
10268,
1435,
565,
288,
3639,
309,
261,
2325,
422,
446,
262,
3639,
288,
5411,
2325,
273,
394,
2407,
32,
1622,
3611,
34,
5621,
5411,
368,
26602,
326,
15408,
4441,
5411,
15... |
"Agent "+agentId+" state, incarnation "+incarnation+ ", moveId "+moveId+", identity "+identity+ | "Agent "+agentId+" state, identity "+identity+ | public String toString() { return "Agent "+agentId+" state, incarnation "+incarnation+ ", moveId "+moveId+", identity "+identity+ ", tuples["+tuples.size()+ "], mtsState "+(mtsState != null)+ ", unsentMessages["+unsentMessages.size()+ "]"; } | 7981 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/7981/8729b3a6f3d460efa8689b553a1c50c319f619b6/SimpleAgent.java/buggy/core/src/org/cougaar/core/agent/SimpleAgent.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
514,
1762,
1435,
288,
1377,
327,
540,
315,
3630,
13773,
5629,
548,
9078,
919,
16,
7290,
1303,
367,
13773,
9523,
1303,
367,
15,
3639,
3104,
3635,
548,
13773,
8501,
548,
15,
3113,
421... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
514,
1762,
1435,
288,
1377,
327,
540,
315,
3630,
13773,
5629,
548,
9078,
919,
16,
7290,
1303,
367,
13773,
9523,
1303,
367,
15,
3639,
3104,
3635,
548,
13773,
8501,
548,
15,
3113,
421... |
if (dirName.equals("")) | if (dirName.length() == 0) | private void handleLocationBrowseButtonPressed() { DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell()); dialog.setMessage( DataTransferMessages.getString( "WizardExternalProjectImportPage.directoryLabel")); //$NON-NLS-1$ String dirName = getProjectLocationFieldValue(); if (dirName.equals("")) dirName = previouslyBrowsedDirectory; if (!dirName.equals("")) { //$NON-NLS-1$ File path = new File(dirName); if (path.exists()) dialog.setFilterPath(new Path(dirName).toOSString()); } String selectedDirectory = dialog.open(); if (selectedDirectory != null) { previouslyBrowsedDirectory = selectedDirectory; locationPathField.setText(previouslyBrowsedDirectory); setProjectName(projectFile(previouslyBrowsedDirectory)); } } | 56152 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/56152/3c1e96ce9572d18bc41dac65eef419d21d6c76e4/WizardExternalProjectImportPage.java/clean/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardExternalProjectImportPage.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1152,
918,
1640,
2735,
27304,
3616,
24624,
1435,
288,
202,
202,
2853,
6353,
6176,
273,
394,
8930,
6353,
12,
3562,
743,
974,
18,
588,
13220,
10663,
202,
202,
12730,
18,
542,
1079,
12,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1152,
918,
1640,
2735,
27304,
3616,
24624,
1435,
288,
202,
202,
2853,
6353,
6176,
273,
394,
8930,
6353,
12,
3562,
743,
974,
18,
588,
13220,
10663,
202,
202,
12730,
18,
542,
1079,
12,... |
Socket s = new Socket(); implAccept (s); return s; | Socket socket = new Socket(); implAccept (socket); return socket; | public Socket accept () throws IOException { SecurityManager sm = System.getSecurityManager (); if (sm != null) sm.checkListen (impl.getLocalPort ()); Socket s = new Socket(); implAccept (s); return s; } | 25337 /local/tlutelli/issta_data/temp/all_java2context/java/2006_temp/2006/25337/dcbb69e84e9c71073608efebeefaa86de4bd97d3/ServerSocket.java/buggy/libjava/java/net/ServerSocket.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
1071,
8758,
2791,
1832,
1216,
1860,
225,
288,
565,
6036,
1318,
3029,
273,
2332,
18,
588,
4368,
1318,
261,
1769,
565,
309,
261,
4808,
480,
446,
13,
1377,
3029,
18,
1893,
14750,
261,
11299,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
1071,
8758,
2791,
1832,
1216,
1860,
225,
288,
565,
6036,
1318,
3029,
273,
2332,
18,
588,
4368,
1318,
261,
1769,
565,
309,
261,
4808,
480,
446,
13,
1377,
3029,
18,
1893,
14750,
261,
11299,... |
} else { throw new JMSException("Source was not a supported type, data must be Serializable, String, byte[], Map or InputStream"); | } else { throw new JMSException( "Source was not a supported type, data must be Serializable, String, byte[], Map or InputStream"); | public static Message getMessageForObject(Object object, Session session) throws JMSException { if (object instanceof Message) { return (Message) object; } else if (object instanceof String) { TextMessage text = session.createTextMessage((String) object); return text; } else if (object instanceof Map) { MapMessage map = session.createMapMessage(); Map.Entry entry = null; Map temp = (Map) object; for (Iterator i = temp.entrySet().iterator(); i.hasNext();) { entry = (Map.Entry) i.next(); map.setObject(entry.getKey().toString(), entry.getValue()); } return map; } else if (object instanceof InputStream) { StreamMessage stream = session.createStreamMessage(); InputStream temp = (InputStream) object; byte[] buffer = new byte[1024 * 4]; int len = 0; try { while ((len = temp.read(buffer)) != -1) { stream.writeBytes(buffer, 0, len); } } catch (IOException e) { throw new JMSException("Failed to read input stream to create a stream message: " + e); } return stream; } else if (object instanceof byte[]) { BytesMessage bytes = session.createBytesMessage(); byte[] buf = (byte[]) object; for (int i = 0; i < buf.length; i++) { bytes.writeByte(buf[i]); } return bytes; } else if (object instanceof Serializable) { ObjectMessage oMsg = session.createObjectMessage(); oMsg.setObject((Serializable) object); return oMsg; } else { throw new JMSException("Source was not a supported type, data must be Serializable, String, byte[], Map or InputStream"); } } | 28323 /local/tlutelli/issta_data/temp/all_java2context/java/2006_temp/2006/28323/427fca19341d145b416afaf6147c87dcbebe937a/JmsMessageUtils.java/buggy/providers/jms/src/java/org/mule/providers/jms/JmsMessageUtils.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
760,
2350,
2381,
1290,
921,
12,
921,
733,
16,
3877,
1339,
13,
1216,
20343,
565,
288,
3639,
309,
261,
1612,
1276,
2350,
13,
288,
5411,
327,
261,
1079,
13,
733,
31,
3639,
289,
469,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
760,
2350,
2381,
1290,
921,
12,
921,
733,
16,
3877,
1339,
13,
1216,
20343,
565,
288,
3639,
309,
261,
1612,
1276,
2350,
13,
288,
5411,
327,
261,
1079,
13,
733,
31,
3639,
289,
469,
... |
buf.append(getExtentionsXML()); | buf.append(getExtensionsXML()); | public String toXML() { StringBuffer buf = new StringBuffer(); buf.append("<message"); buf.append(" id=\"").append(getPacketID()).append("\""); if (getTo() != null) { buf.append(" to=\"").append(getTo()).append("\""); } if (getFrom() != null) { buf.append(" from=\"").append(getFrom()).append("\""); } if (type != Type.NORMAL) { buf.append(" type=\"").append(type).append("\""); } buf.append(">"); if (subject != null) { buf.append("<subject>").append(StringUtils.escapeForXML(subject)).append("</subject>"); } if (body != null) { buf.append("<body>").append(StringUtils.escapeForXML(body)).append("</body>"); } if (thread != null) { buf.append("<thread>").append(thread).append("</thread>"); } // Append the error subpacket if the message type is an error. if (type == Type.ERROR) { XMPPError error = getError(); if (error != null) { buf.append(error.toXML()); } } // Add packet extensions, if any are defined. buf.append(getExtentionsXML()); buf.append("</message>"); return buf.toString(); } | 4336 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/4336/92d8dc21fcdf52273103587c52944f203caf2597/Message.java/buggy/source/org/jivesoftware/smack/packet/Message.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
514,
30028,
1435,
288,
3639,
6674,
1681,
273,
394,
6674,
5621,
3639,
1681,
18,
6923,
2932,
32,
2150,
8863,
3639,
1681,
18,
6923,
2932,
612,
13186,
2934,
6923,
12,
588,
6667,
734,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
514,
30028,
1435,
288,
3639,
6674,
1681,
273,
394,
6674,
5621,
3639,
1681,
18,
6923,
2932,
32,
2150,
8863,
3639,
1681,
18,
6923,
2932,
612,
13186,
2934,
6923,
12,
588,
6667,
734,
14... |
((Node) elementAt(ps[i].pos)).paint(g); | try { ((Node) elementAt(ps[i].pos)).paint(g); } catch (Exception ex) { } | synchronized public void paint(Graphics g) { //orders the vertexes in increasing order of Z (world coordinate)and // paints //which ensures that the vertex in the backside doesnot obscures the // one above Enumeration e = elements(); int min = 0; Pos ps[] = new Pos[this.size()]; int count = size(); int i = 0; //object ps contains the value of Z for each vertex and the position // of the vertex in the collection. while (e.hasMoreElements()) { ps[i] = new Pos(((Node) e.nextElement()).Z, i); i++; } //System.out.println("size"+count); i = 0; //sorting here while (i < count - 1) { min = i; for (int j = i + 1; j < count; j++) { if (ps[j].z < ps[min].z) { min = j; } } Pos zm = ps[i]; ps[i] = ps[min]; ps[min] = zm; i++; } // for (i = 0; i < count; i++) { ((Node) elementAt(ps[i].pos)).paint(g); //System.out.print(" "+ps[i].pos); } //System.out.println("\n "+z[0]+ " "+ z[1]+" "+z[2]); } | 1796 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1796/de9e2c4a8f697872a5f47e00d06399692e38e1fb/Graph.java/buggy/tiki/lib/wiki3d/Graph.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
22043,
1071,
918,
12574,
12,
17558,
314,
13,
288,
202,
202,
759,
9972,
326,
5253,
281,
316,
21006,
1353,
434,
2285,
261,
18179,
7799,
13,
464,
202,
202,
759,
12574,
87,
202,
202,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
22043,
1071,
918,
12574,
12,
17558,
314,
13,
288,
202,
202,
759,
9972,
326,
5253,
281,
316,
21006,
1353,
434,
2285,
261,
18179,
7799,
13,
464,
202,
202,
759,
12574,
87,
202,
202,
7... |
case SingleType(ThisType(_), Symbol symbol): | case SingleType(NoPrefix, Symbol symbol): | public Type apply(Type type) { switch (type) { case TypeRef(ThisType(_), Symbol symbol, Type[] args): Object value = types.get(symbol); if (value != null) return (Type)value; value = symbols.get(symbol); if (value == null) return super.map(type); Type prefix = ((Type.TypeRef)type).pre; return Type.typeRef(apply(prefix), (Symbol)value, map(args)); case SingleType(ThisType(_), Symbol symbol): Object value = types.get(symbol); if (value != null) return (Type)value; value = symbols.get(symbol); if (value == null) return super.map(type); Type prefix = ((Type.SingleType)type).pre; return Type.singleType(apply(prefix), (Symbol)value); case ThisType(Symbol symbol): Object value = symbols.get(symbol); if (value == null) return super.map(type); return Type.ThisType((Symbol)value); default: return super.map(type); } } | 5590 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5590/f84e79de9a2df26defc8720f007494bfcfee28ed/SymbolSubstTypeMap.java/clean/sources/scalac/symtab/SymbolSubstTypeMap.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
1412,
2230,
12,
559,
618,
13,
288,
3639,
1620,
261,
723,
13,
288,
3639,
648,
1412,
1957,
12,
2503,
559,
24899,
3631,
8565,
3273,
16,
1412,
8526,
833,
4672,
5411,
1033,
460,
273,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
1412,
2230,
12,
559,
618,
13,
288,
3639,
1620,
261,
723,
13,
288,
3639,
648,
1412,
1957,
12,
2503,
559,
24899,
3631,
8565,
3273,
16,
1412,
8526,
833,
4672,
5411,
1033,
460,
273,
1... |
Date time = new Date(); SimpleDateFormat df = new SimpleDateFormat( "HH:mm:ss.S" ); try { time = df.parse( oldValue ); } catch (ParseException e) { logger.error("Parse time failed. "+ e); setError(ERROR_PARSE_DATE); setException(e); return; | Date time = null; if (oldValue != null) { time = new Date(); SimpleDateFormat df = new SimpleDateFormat( "HH:mm:ss.S" ); try { time = df.parse( oldValue ); } catch (ParseException e) { logger.error("Parse time failed. "+ e); setError(ERROR_PARSE_DATE); setException(e); return; } | public void undoOccurrence() { occurrenceId = historyChange.getRecordId(); Occurrence occ = null; int placings = 0; boolean contain = false; for (int i=0; i < editObjectList.size(); i++) { if (editObjectList.get(i) instanceof Occurrence) { int listOccId = ((Occurrence)(editObjectList.get(i))).getId(); if (occurrenceId.equals(listOccId)) { contain = true; placings = i; occ = (Occurrence)(editObjectList.get(i)); break; } } } if (!contain) { // Select record Occurrence where id = occurrenceId Object[] objectOcc = searchObject(PlantloreConstants.ENTITY_OCCURRENCE,occurrenceId); if (isError()) return; //tOccurrence doesn`t contain required data occ = (Occurrence)objectOcc[0]; } //Get number of columnName from occurrence mapping. int columnConstant; if (occurrenceHash.containsKey(columnName)) { columnConstant = (Integer)occurrenceHash.get(columnName); } else { columnConstant = 0; } //init Calendar Calendar isoDateTime = new GregorianCalendar(); switch (columnConstant) { case 1: //Taxon if (oldRecordId > 0 ) { //Select record Plant where id = oldRocordId Object[] object = searchObject(PlantloreConstants.ENTITY_PLANT,oldRecordId); if (isError()) return; //tPlant doesn`t contain required data Plant plant = (Plant)object[0]; //Set old value to attribute plantID occ.setPlant(plant); logger.debug("Set selected value for update of attribute Taxon."); } else { logger.error("UNDO - Incorrect oldRecordId for Phytochoria."); } break; case 2: //Year //Set old value to attribute Year occ.setYearCollected(Integer.parseInt(oldValue)); logger.debug("Set selected value for update of attribute Year."); //Update attribute isoDateTimeBegin (Year + Mont + Day + Time) isoDateTime.setTime(occ.getTimeCollected()); isoDateTime.set(Integer.parseInt(oldValue),occ.getMonthCollected(),occ.getDayCollected()); occ.setIsoDateTimeBegin(isoDateTime.getTime()); break; case 3: //Month // Set old value to attribute Month occ.setMonthCollected(Integer.parseInt(oldValue)); logger.debug("Set selected value for update of attribute Month."); // Update attribute isoDateTimeBegin (Year + Mont + Day + Time) isoDateTime.setTime(occ.getTimeCollected()); isoDateTime.set(occ.getYearCollected(), Integer.parseInt(oldValue), occ.getDayCollected()); occ.setIsoDateTimeBegin(isoDateTime.getTime()); break; case 4: //Day // Set old value to attribute Day occ.setDayCollected(Integer.parseInt(oldValue)); logger.debug("Set selected value for update of attribute Day."); // Update attribute isoDateTimeBegin (Year + Mont + Day + Time) isoDateTime.setTime(occ.getTimeCollected()); isoDateTime.set(occ.getYearCollected(), occ.getMonthCollected(), Integer.parseInt(oldValue)); occ.setIsoDateTimeBegin(isoDateTime.getTime()); break; case 5: //Time // Set old value to attribute Time Date time = new Date(); SimpleDateFormat df = new SimpleDateFormat( "HH:mm:ss.S" ); try { time = df.parse( oldValue ); } catch (ParseException e) { logger.error("Parse time failed. "+ e); setError(ERROR_PARSE_DATE); setException(e); return; } occ.setTimeCollected(time); logger.debug("Set selected value for update of attribute Time."); // Update attribute isoDateTimeBegin (Year + Mont + Day + Time) isoDateTime.setTime(time); isoDateTime.set(occ.getYearCollected(), occ.getMonthCollected(), occ.getDayCollected()); occ.setIsoDateTimeBegin(isoDateTime.getTime()); break; case 6: //Source // Set old value to attribute Source occ.setDataSource(oldValue); logger.debug("Set selected value for update of attribute DataSource."); break; case 7: //Herbarium // Set old value to attribute Herbarium occ.setHerbarium(oldValue); logger.debug("Set selected value for update of attribute Herbarium."); break; case 8: //Note occurrence // Set old value to attribute Note occurence occ.setNote(oldValue); logger.debug("Set selected value for update of attribute NoteOccurrence."); break; case 9: //Publication //Select record Publication where id = oldRocordId if (oldRecordId > 0){ Object[] objectPubl = searchObject(PlantloreConstants.ENTITY_PUBLICATION,oldRecordId); if (isError()) return; //tPublication doesn`t contain required data Publication publication = (Publication)objectPubl[0]; //Set old value to attribute publicationID occ.setPublication(publication); logger.debug("Set selected value for update of attribute Publication."); }else { logger.error("UNDO - Incorrect oldRecordId for Phytochoria."); } break; case 10: //metadata //Select record Publication where id = oldRocordId if (oldRecordId > 0){ Object[] objectMetadata = searchObject(PlantloreConstants.ENTITY_METADATA,oldRecordId); if (isError()) return; //tMetadata doesn`t contain required data Metadata metadata = (Metadata)objectMetadata[0]; //Set old value to attribute metadataID occ.setMetadata(metadata); logger.debug("Set selected value for update of attribute Metadata."); }else { logger.error("UNDO - Incorrect oldRecordId for Metadata."); } break; case 11: //habitat //Select record Publication where id = oldRocordId if (oldRecordId > 0){ Object[] objectHabitat = searchObject(PlantloreConstants.ENTITY_HABITAT,oldRecordId); if (isError()) return; //tHabitat doesn`t contain required data Habitat habitat = (Habitat)objectHabitat[0]; //Set old value to attribute habitatID occ.setHabitat(habitat); logger.debug("Set selected value for update of attribute Habitat."); }else { logger.error("UNDO - Incorrect oldRecordId for Habitat."); } break; default: logger.error("No column defined for name "+ columnName); } if (contain) { editObjectList.set(placings, (Record)occ); } else { // add object to list of editing object logger.debug("ObjectList - add occurrences"); editObjectList.add(occ); } } | 57211 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/57211/59d609d47fcaa32beab07953ce1c3a237d8e6892/History.java/buggy/trunk/src/net/sf/plantlore/client/history/History.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
15436,
24267,
1435,
288,
10792,
202,
31177,
548,
273,
4927,
3043,
18,
588,
2115,
548,
5621,
377,
202,
24267,
9145,
273,
446,
31,
377,
202,
474,
886,
1077,
899,
273,
374,
31,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
15436,
24267,
1435,
288,
10792,
202,
31177,
548,
273,
4927,
3043,
18,
588,
2115,
548,
5621,
377,
202,
24267,
9145,
273,
446,
31,
377,
202,
474,
886,
1077,
899,
273,
374,
31,
... |
failParse(); throw backtrack; | protected void baseSpecifier( IASTClassSpecifier astClassSpec) throws Backtrack { consume(IToken.tCOLON); boolean isVirtual = false; ASTAccessVisibility visibility = ASTAccessVisibility.PUBLIC; ITokenDuple nameDuple = null; baseSpecifierLoop : for (;;) { switch (LT(1)) { case IToken.t_virtual : consume(IToken.t_virtual); isVirtual = true; break; case IToken.t_public : consume(); break; case IToken.t_protected : consume(); visibility = ASTAccessVisibility.PROTECTED; break; case IToken.t_private : visibility = ASTAccessVisibility.PRIVATE; consume(); break; case IToken.tCOLONCOLON : case IToken.tIDENTIFIER : nameDuple = name(); break; case IToken.tCOMMA : try { astFactory.addBaseSpecifier( astClassSpec, isVirtual, visibility, nameDuple ); } catch (ASTSemanticException e) { // TODO Auto-generated catch block } isVirtual = false; visibility = ASTAccessVisibility.PUBLIC; nameDuple = null; consume(); continue baseSpecifierLoop; default : break baseSpecifierLoop; } } try { astFactory.addBaseSpecifier( astClassSpec, isVirtual, visibility, nameDuple ); } catch (ASTSemanticException e) { // TODO Auto-generated catch block } } | 54911 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54911/a94839573b25744b81bcdcbff5014614a92fdd8c/Parser.java/clean/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
2321,
3201,
5621,
604,
1473,
4101,
31,
2321,
3201,
5621,
604,
1473,
4101,
31,
2321,
3201,
5621,
604,
1473,
4101,
31,
2321,
3201,
5621,
604,
1473,
4101,
31,
4750,
6870,
3201,
5621,
604,
1473,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
2321,
3201,
5621,
604,
1473,
4101,
31,
2321,
3201,
5621,
604,
1473,
4101,
31,
2321,
3201,
5621,
604,
1473,
4101,
31,
2321,
3201,
5621,
604,
1473,
4101,
31,
4750,
6870,
3201,
5621,
604,
1473,
4... | |
} */ fail("Testcase corrupts workspace, so it's commented."); | } | public void testCloneNodesOrderingSupportedByParent() throws RepositoryException { // test assumes that repositry supports Orderable Child Node Support (optional) /*String[] orderList = {nodeName1, nodeName2, nodeName3}; // copy node three times below a node and check the order for (int i = 0; i < orderList.length; i++) { workspaceW2.clone(workspace.getName(), node1.getPath(), node2.getPath() + "/" + orderList[i], true); } // check regarding orderList with the counter if nodes are added at the end int cnt = 0; NodeIterator iter = node2.getNodes(); while (iter.hasNext()) { Node n = (Node) iter.nextNode(); assertTrue(n.getName().equals(orderList[cnt])); cnt++; } */ //@TODO: Testcase corrupts workspace, so it's commented. fail("Testcase corrupts workspace, so it's commented."); } | 49304 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/49304/96d7a3740a9a2da9271fe65b80be37eeed6001f0/WorkspaceCloneSameNameSibsTest.java/clean/src/test/org/apache/jackrabbit/test/api/WorkspaceCloneSameNameSibsTest.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
1842,
10930,
3205,
20493,
7223,
858,
3054,
1435,
1216,
13367,
288,
3639,
368,
1842,
13041,
716,
283,
1724,
1176,
6146,
4347,
429,
7451,
2029,
13619,
261,
10444,
13,
3639,
1748,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
1842,
10930,
3205,
20493,
7223,
858,
3054,
1435,
1216,
13367,
288,
3639,
368,
1842,
13041,
716,
283,
1724,
1176,
6146,
4347,
429,
7451,
2029,
13619,
261,
10444,
13,
3639,
1748,
7... |
String[] filterIdsToActivate = new String[0]; | String[] filterIdsToActivate = new String[0]; | protected void okPressed() { String[] contentExtensionIdsToActivate = new String[0]; if (contentExtensionsTab != null) { List checkedExtensions = new ArrayList(); TableItem[] tableItems = contentExtensionsTab.getTable().getItems(); INavigatorContentDescriptor descriptor; for (int i = 0; i < tableItems.length; i++) { descriptor = (INavigatorContentDescriptor) tableItems[i] .getData(); if (tableItems[i].getChecked()) { checkedExtensions.add(descriptor.getId()); } } if (checkedExtensions.size() != 0) { contentExtensionIdsToActivate = (String[]) checkedExtensions .toArray(new String[checkedExtensions.size()]); } } String[] filterIdsToActivate = new String[0]; if (commonFiltersTab != null) { List checkedFilters = new ArrayList(); TableItem[] tableItems = commonFiltersTab.getTable().getItems(); ICommonFilterDescriptor descriptor; for (int i = 0; i < tableItems.length; i++) { descriptor = (ICommonFilterDescriptor) tableItems[i].getData(); if (tableItems[i].getChecked()) { checkedFilters.add(descriptor.getId()); } } if (checkedFilters.size() != 0) { filterIdsToActivate = (String[]) checkedFilters .toArray(new String[checkedFilters.size()]); } } UpdateActiveExtensionsOperation updateExtensions = new UpdateActiveExtensionsOperation( commonViewer, contentExtensionIdsToActivate); UpdateActiveFiltersOperation updateFilters = new UpdateActiveFiltersOperation( commonViewer, filterIdsToActivate, true); updateExtensions.execute(null, null); updateFilters.execute(null, null); super.okPressed(); } | 55805 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/55805/1b0f37bc4a054e18b1a977d97d5a410a1f6896d6/CommonFilterSelectionDialog.java/buggy/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/filters/CommonFilterSelectionDialog.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
918,
1529,
24624,
1435,
288,
202,
202,
780,
8526,
913,
3625,
2673,
774,
21370,
273,
394,
514,
63,
20,
15533,
3196,
202,
430,
261,
1745,
7513,
5661,
480,
446,
13,
288,
1082,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
918,
1529,
24624,
1435,
288,
202,
202,
780,
8526,
913,
3625,
2673,
774,
21370,
273,
394,
514,
63,
20,
15533,
3196,
202,
430,
261,
1745,
7513,
5661,
480,
446,
13,
288,
1082,
2... |
.getImage(IWorkbenchGraphicConstants.IMG_LCL_CLOSE_VIEW_HOVER)); | .getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU)); | private void updateCloseButton() { // remove the close button if needed if (current == null || !getSite().isCloseable(current)) { if (closeButton != null) { closeButton.dispose(); closeButton = null; paneFolder.flush(); } return; } // a close button is needed, so if its already there, we're done if (closeButton != null) return; // otherwise create it closeButton = new ToolItem(viewToolBar, SWT.PUSH); closeButton.setDisabledImage(null); closeButton.setImage(WorkbenchImages .getImage(IWorkbenchGraphicConstants.IMG_LCL_CLOSE_VIEW_HOVER)); closeButton.setToolTipText(R21PresentationMessages .getString("BasicStackPresentation.close")); //$NON-NLS-1$ closeButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { close(getCurrent()); } }); paneFolder.flush(); } | 55805 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/55805/2681a6ecadd52dd841e83586a7574d0fc5192344/R21BasicStackPresentation.java/buggy/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21BasicStackPresentation.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
918,
1089,
4605,
3616,
1435,
288,
3639,
368,
1206,
326,
1746,
3568,
309,
3577,
3639,
309,
261,
2972,
422,
446,
747,
401,
588,
4956,
7675,
291,
4605,
429,
12,
2972,
3719,
288,
5411,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
918,
1089,
4605,
3616,
1435,
288,
3639,
368,
1206,
326,
1746,
3568,
309,
3577,
3639,
309,
261,
2972,
422,
446,
747,
401,
588,
4956,
7675,
291,
4605,
429,
12,
2972,
3719,
288,
5411,
... |
push(bcInfo.getConstantOperand(code)); | push(bcInfo.getConstantOperand(true)); | private void generateFrom(int fromIndex) { if (DBG_BB || DBG_SELECTED) { db("generating code into " + currentBBLE + " with runoff " + runoff); } currentBBLE.setGenerated(); endOfBasicBlock = fallThrough = false; lastInstr = null; bcInfo.setInstruction(fromIndex); while (true) { // Must keep currentBBLE.high up-to-date in case we try to jump into // the middle of the block we're currently generating. Simply updating // high once endsBasicBlock is true doesn't enable us to catch this case. currentBBLE.high = instrIndex = bcInfo.bcIndex; int code = bcInfo.getNextInstruction(); if (DBG_BCPARSE) { db("parsing " + instrIndex + " : 0x" + Integer.toHexString(code)); } OPT_Instruction s = null; switch (code) { case JBC_nop: break; case JBC_aconst_null: push(new OPT_NullConstantOperand()); break; case JBC_iconst_m1:case JBC_iconst_0:case JBC_iconst_1: case JBC_iconst_2:case JBC_iconst_3:case JBC_iconst_4: case JBC_iconst_5: push(new OPT_IntConstantOperand(code - JBC_iconst_0)); break; case JBC_lconst_0:case JBC_lconst_1: pushDual(new OPT_LongConstantOperand(code - JBC_lconst_0)); break; case JBC_fconst_0: push(new OPT_FloatConstantOperand(0.f)); break; case JBC_fconst_1: push(new OPT_FloatConstantOperand(1.f)); break; case JBC_fconst_2: push(new OPT_FloatConstantOperand(2.f)); break; case JBC_dconst_0: pushDual(new OPT_DoubleConstantOperand(0.)); break; case JBC_dconst_1: pushDual(new OPT_DoubleConstantOperand(1.)); break; case JBC_bipush: push(new OPT_IntConstantOperand(bcInfo.getByteValue())); break; case JBC_sipush: push(new OPT_IntConstantOperand(bcInfo.getShortValue())); break; case JBC_ldc: push(bcInfo.getConstantOperand(code)); break; case JBC_ldc_w: push(bcInfo.getConstantOperand(code)); break; case JBC_ldc2_w: pushDual(bcInfo.getConstantOperand(code)); break; case JBC_iload: s = do_iload(bcInfo.getLocalNumber()); break; case JBC_lload: s = do_lload(bcInfo.getLocalNumber()); break; case JBC_fload: s = do_fload(bcInfo.getLocalNumber()); break; case JBC_dload: s = do_dload(bcInfo.getLocalNumber()); break; case JBC_aload: s = do_aload(bcInfo.getLocalNumber()); break; case JBC_iload_0:case JBC_iload_1:case JBC_iload_2:case JBC_iload_3: s = do_iload(code - JBC_iload_0); break; case JBC_lload_0:case JBC_lload_1:case JBC_lload_2:case JBC_lload_3: s = do_lload(code - JBC_lload_0); break; case JBC_fload_0:case JBC_fload_1:case JBC_fload_2:case JBC_fload_3: s = do_fload(code - JBC_fload_0); break; case JBC_dload_0:case JBC_dload_1:case JBC_dload_2:case JBC_dload_3: s = do_dload(code - JBC_dload_0); break; case JBC_aload_0:case JBC_aload_1:case JBC_aload_2:case JBC_aload_3: s = do_aload(code - JBC_aload_0); break; case JBC_iaload: { OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.IntArrayType); s = _aloadHelper(INT_ALOAD, ref, index, VM_Type.IntType); } break; case JBC_laload: { OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.LongArrayType); s = _aloadHelper(LONG_ALOAD, ref, index, VM_Type.LongType); } break; case JBC_faload: { OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.FloatArrayType); s = _aloadHelper(FLOAT_ALOAD, ref, index, VM_Type.FloatType); } break; case JBC_daload: { OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.DoubleArrayType); s = _aloadHelper(DOUBLE_ALOAD, ref, index, VM_Type.DoubleType); } break; case JBC_aaload: { OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; VM_Type type = getRefTypeOf(ref).asArray().getElementType(); if (VM.VerifyAssertions) VM.assert(type.isReferenceType()); s = _aloadHelper(REF_ALOAD, ref, index, type); } break; case JBC_baload: { OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; VM_Type type = getArrayTypeOf(ref); if (VM.VerifyAssertions) { VM.assert(type == OPT_ClassLoaderProxy.ByteArrayType || type == OPT_ClassLoaderProxy.BooleanArrayType); } if (type == OPT_ClassLoaderProxy.ByteArrayType) s = _aloadHelper(BYTE_ALOAD, ref, index, VM_Type.ByteType); else s = _aloadHelper(UBYTE_ALOAD, ref, index, VM_Type.BooleanType); } break; case JBC_caload: { OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.CharArrayType); s = _aloadHelper(USHORT_ALOAD, ref, index, VM_Type.CharType); } break; case JBC_saload: { OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.ShortArrayType); s = _aloadHelper(SHORT_ALOAD, ref, index, VM_Type.ShortType); } break; case JBC_istore: s = do_store(bcInfo.getLocalNumber(), popInt()); break; case JBC_lstore: s = do_store(bcInfo.getLocalNumber(), popLong()); break; case JBC_fstore: s = do_store(bcInfo.getLocalNumber(), popFloat()); break; case JBC_dstore: s = do_store(bcInfo.getLocalNumber(), popDouble()); break; case JBC_astore: s = do_astore(bcInfo.getLocalNumber()); break; case JBC_istore_0:case JBC_istore_1:case JBC_istore_2:case JBC_istore_3: s = do_store(code - JBC_istore_0, popInt()); break; case JBC_lstore_0:case JBC_lstore_1:case JBC_lstore_2:case JBC_lstore_3: s = do_store(code - JBC_lstore_0, popLong()); break; case JBC_fstore_0:case JBC_fstore_1:case JBC_fstore_2:case JBC_fstore_3: s = do_store(code - JBC_fstore_0, popFloat()); break; case JBC_dstore_0:case JBC_dstore_1:case JBC_dstore_2:case JBC_dstore_3: s = do_store(code - JBC_dstore_0, popDouble()); break; case JBC_astore_0:case JBC_astore_1:case JBC_astore_2:case JBC_astore_3: s = do_astore(code - JBC_astore_0); break; case JBC_iastore: { OPT_Operand val = popInt(); OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.IntArrayType); s = AStore.create(INT_ASTORE, val, ref, index, new OPT_LocationOperand(VM_Type.IntType), getCurrentGuard()); } break; case JBC_lastore: { OPT_Operand val = popLong(); OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.LongArrayType); s = AStore.create(LONG_ASTORE, val, ref, index, new OPT_LocationOperand(VM_Type.LongType), getCurrentGuard()); } break; case JBC_fastore: { OPT_Operand val = popFloat(); OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.FloatArrayType); s = AStore.create(FLOAT_ASTORE, val, ref, index, new OPT_LocationOperand(VM_Type.FloatType), getCurrentGuard()); } break; case JBC_dastore: { OPT_Operand val = popDouble(); OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.DoubleArrayType); s = AStore.create(DOUBLE_ASTORE, val, ref, index, new OPT_LocationOperand(VM_Type.DoubleType), getCurrentGuard()); } break; case JBC_aastore: { OPT_Operand val = pop(); OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; VM_Type type = getRefTypeOf(ref).asArray().getElementType(); if (VM.VerifyAssertions) VM.assert(type.isReferenceType()); if (do_CheckStore(ref, val, type)) break; s = AStore.create(REF_ASTORE, val, ref, index, new OPT_LocationOperand(type), getCurrentGuard()); } break; case JBC_bastore: { OPT_Operand val = popInt(); OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; VM_Type type = getArrayTypeOf(ref); if (VM.VerifyAssertions) { VM.assert(type == OPT_ClassLoaderProxy.ByteArrayType || type == OPT_ClassLoaderProxy.BooleanArrayType); } if (type == OPT_ClassLoaderProxy.ByteArrayType) type = VM_Type.ByteType; else type = VM_Type.BooleanType; s = AStore.create(BYTE_ASTORE, val, ref, index, new OPT_LocationOperand(type), getCurrentGuard()); } break; case JBC_castore: { OPT_Operand val = popInt(); OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.CharArrayType); s = AStore.create(SHORT_ASTORE, val, ref, index, new OPT_LocationOperand(VM_Type.CharType), getCurrentGuard()); } break; case JBC_sastore: { OPT_Operand val = popInt(); OPT_Operand index = popInt(); OPT_Operand ref = pop(); clearCurrentGuard(); if (do_NullCheck(ref) || do_BoundsCheck(ref, index)) break; if (VM.VerifyAssertions) assertIsType(ref, OPT_ClassLoaderProxy.ShortArrayType); s = AStore.create(SHORT_ASTORE, val, ref, index, new OPT_LocationOperand(VM_Type.ShortType), getCurrentGuard()); } break; case JBC_pop: stack.pop(); break; case JBC_pop2: stack.pop2(); break; case JBC_dup: { OPT_Operand op1 = stack.pop(); stack.push(op1); s = pushCopy(op1); } break; case JBC_dup_x1: { OPT_Operand op1 = stack.pop(); OPT_Operand op2 = stack.pop(); stack.push(op1); stack.push(op2); s = pushCopy(op1); } break; case JBC_dup_x2: { OPT_Operand op1 = stack.pop(); OPT_Operand op2 = stack.pop(); OPT_Operand op3 = stack.pop(); stack.push(op1); stack.push(op3); stack.push(op2); s = pushCopy(op1); } break; case JBC_dup2: { OPT_Operand op1 = stack.pop(); OPT_Operand op2 = stack.pop(); stack.push(op2); stack.push(op1); s = pushCopy(op2); if (s != null) { appendInstruction(s); s = null; } s = pushCopy(op1); } break; case JBC_dup2_x1: { OPT_Operand op1 = stack.pop(); OPT_Operand op2 = stack.pop(); OPT_Operand op3 = stack.pop(); stack.push(op2); stack.push(op1); stack.push(op3); s = pushCopy(op2); if (s != null) { appendInstruction(s); s = null; } s = pushCopy(op1); } break; case JBC_dup2_x2: { OPT_Operand op1 = stack.pop(); OPT_Operand op2 = stack.pop(); OPT_Operand op3 = stack.pop(); OPT_Operand op4 = stack.pop(); stack.push(op2); stack.push(op1); stack.push(op4); stack.push(op3); s = pushCopy(op2); if (s != null) { appendInstruction(s); s = null; } s = pushCopy(op1); } break; case JBC_swap: { OPT_Operand op1 = stack.pop(); OPT_Operand op2 = stack.pop(); stack.push(op1); stack.push(op2); } break; case JBC_iadd: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popInt(); s = _binaryHelper(INT_ADD, op1, op2, VM_Type.IntType); } break; case JBC_ladd: { OPT_Operand op2 = popLong(); OPT_Operand op1 = popLong(); s = _binaryDualHelper(LONG_ADD, op1, op2, VM_Type.LongType); } break; case JBC_fadd: { OPT_Operand op2 = popFloat(); OPT_Operand op1 = popFloat(); s = _binaryHelper(FLOAT_ADD, op1, op2, VM_Type.FloatType); } break; case JBC_dadd: { OPT_Operand op2 = popDouble(); OPT_Operand op1 = popDouble(); s = _binaryDualHelper(DOUBLE_ADD, op1, op2, VM_Type.DoubleType); } break; case JBC_isub: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popInt(); s = _binaryHelper(INT_SUB, op1, op2, VM_Type.IntType); } break; case JBC_lsub: { OPT_Operand op2 = popLong(); OPT_Operand op1 = popLong(); s = _binaryDualHelper(LONG_SUB, op1, op2, VM_Type.LongType); } break; case JBC_fsub: { OPT_Operand op2 = popFloat(); OPT_Operand op1 = popFloat(); s = _binaryHelper(FLOAT_SUB, op1, op2, VM_Type.FloatType); } break; case JBC_dsub: { OPT_Operand op2 = popDouble(); OPT_Operand op1 = popDouble(); s = _binaryDualHelper(DOUBLE_SUB, op1, op2, VM_Type.DoubleType); } break; case JBC_imul: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popInt(); s = _binaryHelper(INT_MUL, op1, op2, VM_Type.IntType); } break; case JBC_lmul: { OPT_Operand op2 = popLong(); OPT_Operand op1 = popLong(); s = _binaryDualHelper(LONG_MUL, op1, op2, VM_Type.LongType); } break; case JBC_fmul: { OPT_Operand op2 = popFloat(); OPT_Operand op1 = popFloat(); s = _binaryHelper(FLOAT_MUL, op1, op2, VM_Type.FloatType); } break; case JBC_dmul: { OPT_Operand op2 = popDouble(); OPT_Operand op1 = popDouble(); s = _binaryDualHelper(DOUBLE_MUL, op1, op2, VM_Type.DoubleType); } break; case JBC_idiv: { clearCurrentGuard(); OPT_Operand op2 = popInt(); OPT_Operand op1 = popInt(); if (do_IntZeroCheck(op2)) break; s = _guardedBinaryHelper(INT_DIV, op1, op2, getCurrentGuard(), VM_Type.IntType); } break; case JBC_ldiv: { clearCurrentGuard(); OPT_Operand op2 = popLong(); OPT_Operand op1 = popLong(); if (do_LongZeroCheck(op2)) break; s = _guardedBinaryDualHelper(LONG_DIV, op1, op2, getCurrentGuard(), VM_Type.LongType); } break; case JBC_fdiv: { OPT_Operand op2 = popFloat(); OPT_Operand op1 = popFloat(); s = _binaryHelper(FLOAT_DIV, op1, op2, VM_Type.FloatType); } break; case JBC_ddiv: { OPT_Operand op2 = popDouble(); OPT_Operand op1 = popDouble(); s = _binaryDualHelper(DOUBLE_DIV, op1, op2, VM_Type.DoubleType); } break; case JBC_irem: { clearCurrentGuard(); OPT_Operand op2 = popInt(); OPT_Operand op1 = popInt(); if (do_IntZeroCheck(op2)) break; s = _guardedBinaryHelper(INT_REM, op1, op2, getCurrentGuard(), VM_Type.IntType); } break; case JBC_lrem: { clearCurrentGuard(); OPT_Operand op2 = popLong(); OPT_Operand op1 = popLong(); if (do_LongZeroCheck(op2)) break; s = _guardedBinaryDualHelper(LONG_REM, op1, op2, getCurrentGuard(), VM_Type.LongType); } break; case JBC_frem: { OPT_Operand op2 = popFloat(); OPT_Operand op1 = popFloat(); s = _binaryHelper(FLOAT_REM, op1, op2, VM_Type.FloatType); } break; case JBC_drem: { OPT_Operand op2 = popDouble(); OPT_Operand op1 = popDouble(); s = _binaryDualHelper(DOUBLE_REM, op1, op2, VM_Type.DoubleType); } break; case JBC_ineg: s = _unaryHelper(INT_NEG, popInt(), VM_Type.IntType); break; case JBC_lneg: s = _unaryDualHelper(LONG_NEG, popLong(), VM_Type.LongType); break; case JBC_fneg: s = _unaryHelper(FLOAT_NEG, popFloat(), VM_Type.FloatType); break; case JBC_dneg: s = _unaryDualHelper(DOUBLE_NEG, popDouble(), VM_Type.DoubleType); break; case JBC_ishl: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popInt(); s = _binaryHelper(INT_SHL, op1, op2, VM_Type.IntType); } break; case JBC_lshl: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popLong(); s = _binaryDualHelper(LONG_SHL, op1, op2, VM_Type.LongType); } break; case JBC_ishr: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popInt(); s = _binaryHelper(INT_SHR, op1, op2, VM_Type.IntType); } break; case JBC_lshr: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popLong(); s = _binaryDualHelper(LONG_SHR, op1, op2, VM_Type.LongType); } break; case JBC_iushr: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popInt(); s = _binaryHelper(INT_USHR, op1, op2, VM_Type.IntType); } break; case JBC_lushr: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popLong(); s = _binaryDualHelper(LONG_USHR, op1, op2, VM_Type.LongType); } break; case JBC_iand: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popInt(); s = _binaryHelper(INT_AND, op1, op2, VM_Type.IntType); } break; case JBC_land: { OPT_Operand op2 = popLong(); OPT_Operand op1 = popLong(); s = _binaryDualHelper(LONG_AND, op1, op2, VM_Type.LongType); } break; case JBC_ior: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popInt(); s = _binaryHelper(INT_OR, op1, op2, VM_Type.IntType); } break; case JBC_lor: { OPT_Operand op2 = popLong(); OPT_Operand op1 = popLong(); s = _binaryDualHelper(LONG_OR, op1, op2, VM_Type.LongType); } break; case JBC_ixor: { OPT_Operand op2 = popInt(); OPT_Operand op1 = popInt(); s = _binaryHelper(INT_XOR, op1, op2, VM_Type.IntType); } break; case JBC_lxor: { OPT_Operand op2 = popLong(); OPT_Operand op1 = popLong(); s = _binaryDualHelper(LONG_XOR, op1, op2, VM_Type.LongType); } break; case JBC_iinc: { int index = bcInfo.getLocalNumber(); s = do_iinc(index, bcInfo.getByteValue()); } break; case JBC_i2l: s = _unaryDualHelper(INT_2LONG, popInt(), VM_Type.LongType); break; case JBC_i2f: s = _unaryHelper(INT_2FLOAT, popInt(), VM_Type.FloatType); break; case JBC_i2d: s = _unaryDualHelper(INT_2DOUBLE, popInt(), VM_Type.DoubleType); break; case JBC_l2i: s = _unaryHelper(LONG_2INT, popLong(), VM_Type.IntType); break; case JBC_l2f: s = _unaryHelper(LONG_2FLOAT, popLong(), VM_Type.FloatType); break; case JBC_l2d: s = _unaryDualHelper(LONG_2DOUBLE, popLong(), VM_Type.DoubleType); break; case JBC_f2i: s = _unaryHelper(FLOAT_2INT, popFloat(), VM_Type.IntType); break; case JBC_f2l: s = _unaryDualHelper(FLOAT_2LONG, popFloat(), VM_Type.LongType); break; case JBC_f2d: s = _unaryDualHelper(FLOAT_2DOUBLE, popFloat(), VM_Type.DoubleType); break; case JBC_d2i: s = _unaryHelper(DOUBLE_2INT, popDouble(), VM_Type.IntType); break; case JBC_d2l: s = _unaryDualHelper(DOUBLE_2LONG, popDouble(), VM_Type.LongType); break; case JBC_d2f: s = _unaryHelper(DOUBLE_2FLOAT, popDouble(), VM_Type.FloatType); break; case JBC_int2byte: s = _unaryHelper(INT_2BYTE, popInt(), VM_Type.ByteType); break; case JBC_int2char: s = _unaryHelper(INT_2USHORT, popInt(), VM_Type.CharType); break; case JBC_int2short: s = _unaryHelper(INT_2SHORT, popInt(), VM_Type.ShortType); break; case JBC_lcmp: { OPT_Operand op2 = popLong(); OPT_Operand op1 = popLong(); s = _binaryHelper(LONG_CMP, op1, op2, VM_Type.IntType); } break; case JBC_fcmpl: { OPT_Operand op2 = popFloat(); OPT_Operand op1 = popFloat(); s = _binaryHelper(FLOAT_CMPL, op1, op2, VM_Type.IntType); } break; case JBC_fcmpg: { OPT_Operand op2 = popFloat(); OPT_Operand op1 = popFloat(); s = _binaryHelper(FLOAT_CMPG, op1, op2, VM_Type.IntType); } break; case JBC_dcmpl: { OPT_Operand op2 = popDouble(); OPT_Operand op1 = popDouble(); s = _binaryHelper(DOUBLE_CMPL, op1, op2, VM_Type.IntType); } break; case JBC_dcmpg: { OPT_Operand op2 = popDouble(); OPT_Operand op1 = popDouble(); s = _binaryHelper(DOUBLE_CMPG, op1, op2, VM_Type.IntType); } break; case JBC_ifeq: s = _intIfHelper(OPT_ConditionOperand.EQUAL()); break; case JBC_ifne: s = _intIfHelper(OPT_ConditionOperand.NOT_EQUAL()); break; case JBC_iflt: s = _intIfHelper(OPT_ConditionOperand.LESS()); break; case JBC_ifge: s = _intIfHelper(OPT_ConditionOperand.GREATER_EQUAL()); break; case JBC_ifgt: s = _intIfHelper(OPT_ConditionOperand.GREATER()); break; case JBC_ifle: s = _intIfHelper(OPT_ConditionOperand.LESS_EQUAL()); break; case JBC_if_icmpeq: s = _intIfCmpHelper(OPT_ConditionOperand.EQUAL()); break; case JBC_if_icmpne: s = _intIfCmpHelper(OPT_ConditionOperand.NOT_EQUAL()); break; case JBC_if_icmplt: s = _intIfCmpHelper(OPT_ConditionOperand.LESS()); break; case JBC_if_icmpge: s = _intIfCmpHelper(OPT_ConditionOperand.GREATER_EQUAL()); break; case JBC_if_icmpgt: s = _intIfCmpHelper(OPT_ConditionOperand.GREATER()); break; case JBC_if_icmple: s = _intIfCmpHelper(OPT_ConditionOperand.LESS_EQUAL()); break; case JBC_if_acmpeq: s = _refIfCmpHelper(OPT_ConditionOperand.EQUAL()); break; case JBC_if_acmpne: s = _refIfCmpHelper(OPT_ConditionOperand.NOT_EQUAL()); break; case JBC_goto: { int offset = bcInfo.getBranchTarget(); if (offset != 3) // skip generating frivolous goto's s = _gotoHelper(offset); } break; case JBC_jsr: s = _jsrHelper(bcInfo.getBranchTarget()); break; case JBC_ret: s = _retHelper(bcInfo.getLocalNumber()); break; case JBC_tableswitch: { OPT_Operand op0 = popInt(); bcInfo.alignSwitch(); int defaultoff = bcInfo.getSwitchDefaultTarget(); int low = bcInfo.getSwitchLowValue(); int high = bcInfo.getSwitchHighValue(); int number = high - low + 1; if (CF_TABLESWITCH && op0 instanceof OPT_IntConstantOperand) { int v1 = ((OPT_IntConstantOperand)op0).value; int offset; if ((v1 < low) || (v1 > high)) offset = defaultoff; else offset = bcInfo.getTableSwitchOffsetForConstant(v1, low, high); bcInfo.skipTableSwitchTargets(number); if (DBG_CF) { db("changed tableswitch to goto because index (" + v1 + ") is constant"); } s = _gotoHelper(offset); break; } s = TableSwitch.create(TABLESWITCH, op0, null, null, new OPT_IntConstantOperand(low), new OPT_IntConstantOperand(high), generateTarget(defaultoff), new OPT_BranchProfileOperand(), number*2); double approxProb = 1/(number+1); // num targets + default for (int i = 0; i < number; ++i) { TableSwitch.setTarget(s, i, generateTarget(bcInfo.getSwitchTarget(i))); TableSwitch. setBranchProfile(s, i, new OPT_BranchProfileOperand(approxProb)); } } break; case JBC_lookupswitch: { OPT_Operand op0 = popInt(); bcInfo.alignSwitch(); int defaultoff = bcInfo.getSwitchDefaultTarget(); int numpairs = bcInfo.getLookupSwitchNumberOfPairs(); if (numpairs == 0) { s = _gotoHelper(defaultoff); break; } if (CF_LOOKUPSWITCH && op0 instanceof OPT_IntConstantOperand) { int v1 = ((OPT_IntConstantOperand)op0).value; int offset = defaultoff; for (int i = 0; i < numpairs; ++i) { int match = bcInfo.getSwitchValue(i); if (match == v1) { offset = bcInfo.getSwitchTarget(i); bcInfo.skipLookupSwitchPairs(numpairs, i + 1); break; // for } else { bcInfo.skipSwitchValue(i); } } if (DBG_CF) { db("changed lookupswitch to goto because index (" + v1 + ") is constant"); } s = _gotoHelper(offset); break; } s = LookupSwitch.create(LOOKUPSWITCH, op0, null, null, generateTarget(defaultoff), new OPT_BranchProfileOperand(),numpairs*3); double approxProb = 1/(numpairs+1); // num targets + default for (int i = 0; i < numpairs; ++i) { LookupSwitch.setMatch(s, i, new OPT_IntConstantOperand (bcInfo.getSwitchValue(i))); LookupSwitch.setTarget(s, i, generateTarget(bcInfo.getSwitchTarget(i))); LookupSwitch. setBranchProfile(s, i, new OPT_BranchProfileOperand(approxProb)); } } break; case JBC_ireturn: _returnHelper(INT_MOVE, popInt()); break; case JBC_lreturn: _returnHelper(LONG_MOVE, popLong()); break; case JBC_freturn: _returnHelper(FLOAT_MOVE, popFloat()); break; case JBC_dreturn: _returnHelper(DOUBLE_MOVE, popDouble()); break; case JBC_areturn: { OPT_Operand op0 = popRef(); if (VM.VerifyAssertions && !op0.isDefinitelyNull()) { VM_Type retType = getRefTypeOf(op0); // fudge to deal with conservative approximation // in OPT_ClassLoaderProxy.proxy.findCommonSuperclass if (retType != VM_Type.JavaLangObjectType) assertIsAssignable(gc.method.getReturnType(), getRefTypeOf(op0)); } _returnHelper(REF_MOVE, op0); } break; case JBC_return: _returnHelper(null, null); break; case JBC_getstatic: { int constantPoolIndex = bcInfo.getFieldReferenceIndex(); VM_Field field = bcInfo.getFieldReference(constantPoolIndex); // use results of field analysis to refine type. VM_Type fieldType = field.getType(); OPT_RegisterOperand t = gc.temps.makeTemp(fieldType); if (field.getType().isClassType() && field.getType().asClass().isLoaded()) { VM_Type concreteType = OPT_FieldAnalysis.getConcreteType(field); if (concreteType != null) { t.setPreciseType(); if (concreteType == fieldType) { t.setDeclaredType(); } else { fieldType = concreteType; t.type = concreteType; } } } boolean unresolved = field.needsDynamicLink(gc.method); if (!unresolved) field = field.resolve(); OPT_Operator operator = unresolved?GETSTATIC_UNRESOLVED:GETSTATIC; s = GetStatic.create(operator, t, makeStaticFieldRef(field)); // optimization: // if the field is final and either initialized or // in the bootimage, then get the value at compile time. // TODO: applying this optimization to Floats or Doubles // causes problems. Figure out why and fix it! if (!fieldType.isDoubleType() && !fieldType.isFloatType()) { if (!unresolved && field.isFinal()) { VM_Class declaringClass = field.getDeclaringClass(); if (declaringClass.isInitialized() || (VM.writingBootImage && declaringClass.isInBootImage())) { try { if (fieldType.isPrimitiveType()) { operator = OPT_IRTools.getMoveOp(field.getType()); OPT_ConstantOperand rhs = OPT_StaticFieldReader.getStaticFieldValue(field); // VM.sysWrite("Replaced getstatic of "+field+" with "+rhs+"\n"); push (rhs, fieldType); s = null; break; } else { if (OPT_StaticFieldReader.isStaticFieldNull(field)) { // VM.sysWrite("Replaced getstatic of "+field+" with <null>\n"); push(new OPT_NullConstantOperand(), fieldType); s = null; break; } else { VM_Type rtType = OPT_StaticFieldReader.getTypeFromStaticField(field); if (rtType == VM_Type.JavaLangStringType) { OPT_ConstantOperand rhs = OPT_StaticFieldReader.getStaticFieldValue(field); // VM.sysWrite("Replaced getstatic of "+field+" with "+rhs+"\n"); push (rhs, fieldType); s = null; break; } else { t.type = rtType; if (rtType != fieldType) t.clearDeclaredType(); t.setPreciseType(); markGuardlessNonNull(t); // VM.sysWrite("Tightened type info for getstatic of "+field+" to "+t+"\n"); } } } } catch (NoSuchFieldException e) { // Sigh, host JDK java.* class didn't have this RVM field. // VM.sysWrite("Field "+field+" does not exist on host JDK\n"); } } } } push(t.copyD2U(), fieldType); if (unresolved) rectifyStateWithErrorHandler(); } break; case JBC_putstatic: { int constantPoolIndex = bcInfo.getFieldReferenceIndex(); VM_Field field = bcInfo.getFieldReference(constantPoolIndex); VM_Type fieldType = field.getType(); OPT_Operand r = pop(fieldType); boolean unresolved = field.needsDynamicLink(gc.method); if (!unresolved) field = field.resolve(); OPT_Operator operator = unresolved?PUTSTATIC_UNRESOLVED:PUTSTATIC; s = PutStatic.create(operator, r, makeStaticFieldRef(field)); if (unresolved) rectifyStateWithErrorHandler(); } break; case JBC_getfield: { OPT_Operand op1 = pop(); clearCurrentGuard(); if (do_NullCheck(op1)) break; int constantPoolIndex = bcInfo.getFieldReferenceIndex(); VM_Field field = bcInfo.getFieldReference(constantPoolIndex); VM_Type fieldType = field.getType(); OPT_RegisterOperand t = gc.temps.makeTemp(fieldType); // use results of field analysis to refine type. if (field.getType().isClassType() && field.getType().asClass().isLoaded()) { VM_Type concreteType = OPT_FieldAnalysis.getConcreteType(field); if (concreteType != null) { t.setPreciseType(); if (concreteType == fieldType) { t.setDeclaredType(); } else { fieldType = concreteType; t.type = concreteType; } } } boolean unresolved = field.needsDynamicLink(gc.method); if (!unresolved) field = field.resolve(); OPT_Operator operator = unresolved?GETFIELD_UNRESOLVED:GETFIELD; s = GetField.create(operator, t, op1, makeInstanceFieldRef(field), getCurrentGuard()); push(t.copyD2U(), fieldType); if (unresolved) rectifyStateWithErrorHandler(); } break; case JBC_putfield: { int constantPoolIndex = bcInfo.getFieldReferenceIndex(); VM_Field field = bcInfo.getFieldReference(constantPoolIndex); VM_Type fieldType = field.getType(); OPT_Operand val = pop(fieldType); OPT_Operand obj = popRef(); clearCurrentGuard(); if (do_NullCheck(obj)) break; boolean unresolved = field.needsDynamicLink(gc.method); if (!unresolved) field = field.resolve(); OPT_Operator operator = unresolved?PUTFIELD_UNRESOLVED:PUTFIELD; s = PutField.create(operator, val, obj, makeInstanceFieldRef(field), getCurrentGuard()); if (unresolved) rectifyStateWithErrorHandler(); } break; case JBC_invokevirtual: { if (gc.options.PRINT_DETAILED_INLINE_REPORT) { OPT_InlineReport.beginNewDecision(); OPT_InlineReport.setCallType(OPT_InlineReport.INVOKE_VIRTUAL); } int constantPoolIndex = bcInfo.getMethodReferenceIndex(); VM_Method meth = bcInfo.getMethodReference(constantPoolIndex); if (meth.getDeclaringClass().isAddressType()) { try { OPT_GenerateMagic.generateMagic(this, gc, meth); if (gc.options.PRINT_DETAILED_INLINE_REPORT) { OPT_InlineReport.isMagic(meth); } break; } catch (OPT_MagicNotImplementedException e) { if (gc.options.PRINT_DETAILED_INLINE_REPORT) { OPT_InlineReport.unimplementedMagic(Call.getMethod(s).method); } if (gc.options.SKIP_UNKNOWN_MAGIC) { s = _callHelper(OPT_MethodOperand.STATIC(meth, false)); // CALL must be treated as potential throw of anything rectifyStateWithExceptionHandlers(); break; } else { throw (e); } } } boolean unresolved = meth.needsDynamicLink(gc.method); if (!unresolved) meth = meth.resolve(); OPT_MethodOperand methOp = OPT_MethodOperand.VIRTUAL(meth, unresolved); s = _callHelper(methOp); if (s == null) { if (gc.options.PRINT_DETAILED_INLINE_REPORT) { OPT_InlineReport.instructionNull(); } break; } // try to reduce the number of targets. // If we succeed, we'll update meth, unresolved, // and s's method operand. OPT_Operand ref = Call.getParam(s, 0); boolean receiverClassResolved = false; boolean isExtant = false; VM_Type type = null; if (ref.isRegister()) { isExtant = ref.asRegister().isExtant(); type = ref.asRegister().type; } else if (ref.isStringConstant()) { isExtant = true; type = VM_Type.JavaLangStringType; } else if (VM.VerifyAssertions) VM.assert(false, "unexpected receiver"); receiverClassResolved = type.isResolved(); if ((meth.getDeclaringClass() != type) && type.isClassType()) { VM_Method vmeth = lookupMethod(meth, type.asClass()); if (vmeth != null && vmeth != meth) { // Update meth to be the refined vmeth meth = vmeth; unresolved = meth.needsDynamicLink(gc.method); if (!unresolved) meth = meth.resolve(); Call.setMethod(s, OPT_MethodOperand.VIRTUAL(meth, unresolved, true)); } } if (gc.options.PRINT_DETAILED_INLINE_REPORT) OPT_InlineReport.classUnresolved(unresolved, meth); // If we don't need dynamic linking code, think about inlining if (!unresolved) { // if the type is precise and receiverClassResolved is true // then we know FOR CERTAIN that this call will resolve to meth. // By ensuring that recieverClassResolved, we make sure that // lookupMethod was able to actually search the class hierarchy // and set meth appropriately. VM_Method computedTarget = null; if (receiverClassResolved && ((ref.isStringConstant()) || ref.asRegister().isPreciseType())) { computedTarget = meth; if (gc.options.PRINT_DETAILED_INLINE_REPORT) OPT_InlineReport.isPreciseType(); } OPT_InlineDecision id = shouldInline(s, computedTarget, isExtant); if (maybeInlineMethod(id, s)) { return; } } // CALL must be treated as potential throw of anything rectifyStateWithExceptionHandlers(); } break; case JBC_invokespecial: { if (gc.options.PRINT_DETAILED_INLINE_REPORT) { OPT_InlineReport.beginNewDecision(); OPT_InlineReport.setCallType(OPT_InlineReport.INVOKE_SPECIAL); } int constantPoolIndex = bcInfo.getMethodReferenceIndex(); VM_Method meth = bcInfo.getMethodReference(constantPoolIndex); // Note: this is not the usual needsDynamicLink // due to semantics of invokespecial // See comments in VM_OptLinker, OPT_Convert2Low, VM_Linker. boolean unresolved = !meth.getDeclaringClass().isResolved() || (VM_Class.findSpecialMethod(meth) == null); if (!unresolved) meth = meth.resolve(); s = _callHelper(OPT_MethodOperand.SPECIAL(meth, unresolved)); if (s == null) { if (gc.options.PRINT_DETAILED_INLINE_REPORT) { OPT_InlineReport.instructionNull(); } break; } if (gc.options.PRINT_DETAILED_INLINE_REPORT) OPT_InlineReport.classUnresolved(unresolved, meth); // If we don't need dynamic linking code, think about inlining if (!unresolved) { if (maybeInlineMethod(shouldInline(s, null, false), s)) { return; } } // CALL must be treated as potential throw of anything rectifyStateWithExceptionHandlers(); } break; case JBC_invokestatic: { if (gc.options.PRINT_DETAILED_INLINE_REPORT) { OPT_InlineReport.beginNewDecision(); OPT_InlineReport.setCallType(OPT_InlineReport.INVOKE_STATIC); } int constantPoolIndex = bcInfo.getMethodReferenceIndex(); VM_Method meth = bcInfo.getMethodReference(constantPoolIndex); if (meth.getDeclaringClass().isMagicType() || meth.getDeclaringClass().isAddressType()) { try { OPT_GenerateMagic.generateMagic(this, gc, meth); if (gc.options.PRINT_DETAILED_INLINE_REPORT) { OPT_InlineReport.isMagic(meth); } break; } catch (OPT_MagicNotImplementedException e) { if (gc.options.PRINT_DETAILED_INLINE_REPORT) { OPT_InlineReport.unimplementedMagic(Call.getMethod(s).method); } if (gc.options.SKIP_UNKNOWN_MAGIC) { s = _callHelper(OPT_MethodOperand.STATIC(meth, false)); // CALL must be treated as potential throw of anything rectifyStateWithExceptionHandlers(); break; } else { throw (e); } } } boolean unresolved = meth.needsDynamicLink(gc.method); if (!unresolved) meth = meth.resolve(); s = _callHelper(OPT_MethodOperand.STATIC(meth, unresolved)); if (gc.options.PRINT_DETAILED_INLINE_REPORT) OPT_InlineReport.classUnresolved(unresolved, meth); // If we don't need dynamic linking code, think about inlining if (!unresolved) { if (maybeInlineMethod(shouldInline(s, null, false), s)) { return; } } // CALL must be treated as potential throw of anything rectifyStateWithExceptionHandlers(); } break; case JBC_invokeinterface: { if (gc.options.PRINT_DETAILED_INLINE_REPORT) { OPT_InlineReport.beginNewDecision(); OPT_InlineReport.setCallType(OPT_InlineReport.INVOKE_INTERFACE); } int constantPoolIndex = bcInfo.getMethodReferenceIndex(); VM_Method meth = bcInfo.getMethodReference(constantPoolIndex); bcInfo.eatInvokeInterfaceGarbage(); OPT_MethodOperand methOp = OPT_MethodOperand.INTERFACE(meth, false); s = _callHelper(methOp); if (s == null) { if (gc.options.PRINT_DETAILED_INLINE_REPORT) { OPT_InlineReport.instructionNull(); } break; } OPT_RegisterOperand ref = Call.getParam(s, 0).asRegister(); VM_Class refType = ref.type.asClass(); VM_Type interfaceType = meth.getDeclaringClass(); boolean requiresImplementsTest = VM.BuildForIMTInterfaceInvocation || (VM.BuildForITableInterfaceInvocation && VM.DirectlyIndexedITables); // Step 1: handle the possibility of ghost references try { VM_Method resolvedMethodRef = meth.resolveInterfaceMethod(false); if (resolvedMethodRef == null) { if (requiresImplementsTest) { // might be a ghost reference. // Must do the more involved typechecking sequence OPT_RegisterOperand tibPtr = gc.temps.makeTemp(OPT_ClassLoaderProxy.JavaLangObjectArrayType); OPT_Instruction getTib = GuardedUnary.create(GET_OBJ_TIB, tibPtr, ref.copyU2U(), getCurrentGuard()); appendInstruction(getTib); getTib.bcIndex = RUNTIME_SERVICES_BCI; OPT_MethodOperand dtcRoutine = OPT_MethodOperand.STATIC(VM_Entrypoints.unresolvedInvokeinterfaceImplementsTestMethod); OPT_Instruction callCheck = Call.create2(CALL, null, null, dtcRoutine, new OPT_IntConstantOperand(meth.getDictionaryId()), tibPtr.copyD2U()); if (gc.options.NO_CALLEE_EXCEPTIONS) { callCheck.markAsNonPEI(); } appendInstruction(callCheck); callCheck.bcIndex = RUNTIME_SERVICES_BCI; requiresImplementsTest = false; // the above call subsumes the test } } else { meth = resolvedMethodRef; } } catch (VM_ResolutionException e) { // actually can't be thrown when we pass false for canLoad. } // Step 2: Invokeinterface requires a dynamic type check // to ensure that the receiver object actually // implements the interface. This is necessary // because the verifier does not detect incompatible class changes. // If we're building for FastInterfaceInvocation then // this test must be made explicit in the calling sequence. // In the slow interface invocation path, it is handled // deep in the guts of the dispatching code. // NOTE: We don't insert the test here if we are doing to // do a guarded inline of an interface call. That case // is handled within OPT_Inliner.java. However, if // we virtualize the call, we do need to handle the DTC // here, since OPT_Inliner won't have enough information // to determine what the right thing to do is. if (requiresImplementsTest) { // Attempt to avoid inserting the check by seeing if the // known static type of the receiver implements the interface. if (refType.isResolved() && !refType.isInterface()) { byte doesImplement = OPT_ClassLoaderProxy.proxy.includesType(interfaceType, refType); requiresImplementsTest = doesImplement != YES; } } // Step 3: Attempt to resolve the interface call to // a particular virtual method. // Note: step 2 and step 3 are independent // and it is not that case that being able // to do 2 implies 3 or that doing 3 implies 2. VM_Method vmeth; if (refType.isResolved() && !refType.isInterface() && (vmeth = lookupMethod(meth, refType)) != null) { // We're going to virtualize it. Must deal with the DTC here. if (requiresImplementsTest) { appendInstruction(TypeCheck.create(MUST_IMPLEMENT_INTERFACE, ref.copyU2U(), makeTypeOperand(interfaceType), getCurrentGuard())); } boolean unresolved = vmeth.needsDynamicLink(gc.method); if (!unresolved) vmeth = vmeth.resolve(); Call.setMethod(s, OPT_MethodOperand.VIRTUAL(vmeth, unresolved, true)); if (gc.options.PRINT_DETAILED_INLINE_REPORT) OPT_InlineReport.classUnresolved(unresolved, meth); // Think about trying to inline it if (!unresolved) { // if the type is precise, then we know FOR CERTAIN that // this call will resolve to meth VM_Method computedTarget = ref.isPreciseType() ? vmeth : null; if (computedTarget != null && gc.options.PRINT_DETAILED_INLINE_REPORT) OPT_InlineReport.isPreciseType(); OPT_InlineDecision id = shouldInline(s, computedTarget, ref.isExtant()); if (maybeInlineMethod(id, s)) { return; } } } else { // try to inline a predicted target for the interface invocation OPT_InlineDecision id = shouldInline(s, null, false); if (maybeInlineMethod(id, s)) { return; } else { if (requiresImplementsTest) { appendInstruction(TypeCheck.create(MUST_IMPLEMENT_INTERFACE, ref.copyU2U(), makeTypeOperand(interfaceType), getCurrentGuard())); } } } // CALL must be treated as potential throw of anything rectifyStateWithExceptionHandlers(); } break; case JBC_xxxunusedxxx: OPT_OptimizingCompilerException.UNREACHABLE(); break; case JBC_new: { int constantPoolIndex = bcInfo.getTypeReferenceIndex(); VM_Type klass = bcInfo.getTypeReference(constantPoolIndex); OPT_TypeOperand klassOp = makeTypeOperand(klass); OPT_RegisterOperand t = gc.temps.makeTemp(klass); t.setPreciseType(); markGuardlessNonNull(t); OPT_Operator operator; if (klass.isInitialized() || klass.asClass().isInBootImage()) { operator = NEW; } else { operator = NEW_UNRESOLVED; } s = New.create(operator, t, klassOp); push(t.copyD2U()); rectifyStateWithErrorHandler(); } break; case JBC_newarray: { byte atype = (byte)bcInfo.getByteValue(); VM_Array array = VM_Array.getPrimitiveArrayType(atype); OPT_TypeOperand arrayOp = makeTypeOperand(array); OPT_RegisterOperand t = gc.temps.makeTemp(array); t.setPreciseType(); markGuardlessNonNull(t); s = NewArray.create(NEWARRAY, t, arrayOp, popInt()); push(t.copyD2U()); VM_Class et = OPT_ClassLoaderProxy.JavaLangNegativeArraySizeExceptionType; rectifyStateWithExceptionHandler(et); } break; case JBC_anewarray: { int constantPoolIndex = bcInfo.getTypeReferenceIndex(); VM_Type elementTypeRef = bcInfo.getTypeReference(constantPoolIndex); VM_Array array = elementTypeRef.getArrayTypeForElementType(); OPT_TypeOperand arrayOp = makeTypeOperand(array); OPT_RegisterOperand t = gc.temps.makeTemp(array); t.setPreciseType(); markGuardlessNonNull(t); s = NewArray.create(NEWARRAY, t, arrayOp, popInt()); push(t.copyD2U()); rectifyStateWithErrorHandler(); VM_Class et = OPT_ClassLoaderProxy.JavaLangNegativeArraySizeExceptionType; rectifyStateWithExceptionHandler(et); } break; case JBC_arraylength: { OPT_Operand op1 = pop(); clearCurrentGuard(); if (do_NullCheck(op1)) break; if (VM.VerifyAssertions) VM.assert(getArrayTypeOf(op1).isArrayType()); OPT_RegisterOperand t = gc.temps.makeTempInt(); s = GuardedUnary.create(ARRAYLENGTH, t, op1, getCurrentGuard()); push(t.copyD2U()); } break; case JBC_athrow: { OPT_Operand op0 = pop(); clearCurrentGuard(); if (do_NullCheck(op0)) break; VM_Type type = getRefTypeOf(op0); if (VM.VerifyAssertions) { // fudge to handle conservative approximation of // OPT_ClassLoaderProxy.proxy.findCommonSuperclass if (type != VM_Type.JavaLangObjectType) assertIsAssignable(VM_Type.JavaLangThrowableType, type); } if (!gc.method.getDeclaringClass().isInterruptible()) { // prevent code motion in or out of uninterruptible code sequence appendInstruction(Empty.create(UNINT_END)); } endOfBasicBlock = true; OPT_BasicBlock definiteTarget = rectifyStateWithExceptionHandler(type, true); if (definiteTarget != null) { appendInstruction(CacheOp.create(SET_CAUGHT_EXCEPTION, op0)); s = Goto.create(GOTO, definiteTarget.makeJumpTarget()); } else { s = Athrow.create(ATHROW, (OPT_RegisterOperand)op0); } } break; case JBC_checkcast: { int constantPoolIndex = bcInfo.getTypeReferenceIndex(); VM_Type typeRef = bcInfo.getTypeReference(constantPoolIndex); boolean classLoading = couldCauseClassLoading(typeRef); OPT_TypeOperand typeOp = makeTypeOperand(typeRef); OPT_Operand op2 = pop(); if (VM.VerifyAssertions) VM.assert(op2.isRef()); if (CF_CHECKCAST && !classLoading) { if (op2.isDefinitelyNull()) { push(op2); if (DBG_CF) db("skipped gen of null checkcast"); break; } VM_Type type = getRefTypeOf(op2); // non-null, null case above if (OPT_ClassLoaderProxy.proxy.includesType(typeRef,type)==YES){ push(op2); if (DBG_CF) db("skipped gen of checkcast of " + op2 + " from " + typeRef + " to " + type); break; } } OPT_RegisterOperand reg = (OPT_RegisterOperand)op2; if (gc.options.NO_CHECKCAST) { // Unsafely eliminate all checkcasts } else { if (classLoading) { s = TypeCheck.create(CHECKCAST_UNRESOLVED, reg, typeOp); } else { if (isNonNull(reg)) { s = TypeCheck.create(CHECKCAST_NOTNULL, reg, typeOp, getGuard(reg)); } else { s = TypeCheck.create(CHECKCAST, reg, typeOp); } } } reg = reg.copyU2U(); reg.type = typeRef; push(reg); VM_Class et = OPT_ClassLoaderProxy.JavaLangClassCastExceptionType; rectifyStateWithExceptionHandler(et); if (classLoading) rectifyStateWithErrorHandler(); } break; case JBC_instanceof: { int constantPoolIndex = bcInfo.getTypeReferenceIndex(); VM_Type typeRef = bcInfo.getTypeReference(constantPoolIndex); boolean classLoading = couldCauseClassLoading(typeRef); OPT_TypeOperand typeOp = makeTypeOperand(typeRef); OPT_Operand op2 = pop(); if (VM.VerifyAssertions) VM.assert(op2.isRef()); if (CF_INSTANCEOF && !classLoading) { if (op2.isDefinitelyNull()) { push(new OPT_IntConstantOperand(0)); if (DBG_CF) db("skipped gen of null instanceof"); break; } VM_Type type = getRefTypeOf(op2); // non-null int answer = OPT_ClassLoaderProxy.proxy.includesType(typeRef, type); if (answer == YES) { if (isNonNull(op2)) { push(new OPT_IntConstantOperand(1)); if (DBG_CF) db("skipped gen of instanceof of " + op2 + " from " + typeRef + " to " + type); break; } else { // !!TODO: For boolean variables, is any non-zero integer // equivalent to true? If so, in this case, we can replace // t <- o2 instanceof type with t <- o2. (SJF) } } else if (answer == NO) { push(new OPT_IntConstantOperand(0)); break; } } OPT_RegisterOperand t = gc.temps.makeTempInt(); if (classLoading) { s = InstanceOf.create(INSTANCEOF_UNRESOLVED, t, typeOp, op2); } else { if (isNonNull(op2)) { s = InstanceOf.create(INSTANCEOF_NOTNULL, t, typeOp, op2, getGuard(op2)); } else { s = InstanceOf.create(INSTANCEOF, t, typeOp, op2); } } push(t.copyD2U()); if (classLoading) rectifyStateWithErrorHandler(); } | 5245 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5245/b50ef93406b2ef984f8285babf993d262ec89fae/OPT_BC2IR.java/clean/rvm/src/vm/compilers/optimizing/ir/conversions/bc2hir/OPT_BC2IR.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
3238,
918,
2103,
1265,
12,
474,
15065,
13,
288,
565,
309,
261,
2290,
43,
67,
9676,
747,
2383,
43,
67,
4803,
2056,
13,
288,
1377,
1319,
2932,
3441,
1776,
981,
1368,
315,
397,
783,
9676,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
3238,
918,
2103,
1265,
12,
474,
15065,
13,
288,
565,
309,
261,
2290,
43,
67,
9676,
747,
2383,
43,
67,
4803,
2056,
13,
288,
1377,
1319,
2932,
3441,
1776,
981,
1368,
315,
397,
783,
9676,
... |
String priority = priorityCombo.getItem(priorityCombo .getSelectionIndex()); | String priority = priorityCombo.getItem(priorityCombo.getSelectionIndex()); | public void saveDataToModel() { // get the model that we are using AbstractBugWizard wizard = (AbstractBugWizard) getWizard(); NewBugModel nbm = wizard.model; nbm.setDescription(descriptionText.getText()); nbm.setSummary(summaryText.getText()); // go through each of the attributes and sync their values with the // combo boxes for (Iterator<Attribute> it = nbm.getAttributes().iterator(); it.hasNext();) { Attribute attribute = it.next(); String key = attribute.getName(); Map<String, String> values = attribute.getOptionValues(); if (values == null) values = new HashMap<String, String>(); if (key.equals("OS")) { String os = oSCombo.getItem(oSCombo.getSelectionIndex()); attribute.setValue(os); } else if (key.equals("Version")) { String version = versionCombo.getItem(versionCombo .getSelectionIndex()); attribute.setValue(version); } else if (key.equals("Severity")) { String severity = severityCombo.getItem(severityCombo .getSelectionIndex()); attribute.setValue(severity); } else if (key.equals("Platform")) { String platform = platformCombo.getItem(platformCombo .getSelectionIndex()); attribute.setValue(platform); } else if (key.equals("Component")) { String component = componentCombo.getItem(componentCombo .getSelectionIndex()); attribute.setValue(component); } else if (key.equals("Priority")) { String priority = priorityCombo.getItem(priorityCombo .getSelectionIndex()); attribute.setValue(priority); } else if (key.equals("URL")) { String url = urlText.getText(); if (url.equalsIgnoreCase("http://")) url = ""; attribute.setValue(url); } else if (key.equals("Assign To")) { String assignTo = assignedToText.getText(); attribute.setValue(assignTo); }else { // do nothing } } wizard.attributeCompleted = true; } | 51151 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51151/c7e8842aaf630b312c422f4e2f0ef3bd5ed6453d/AbstractWizardDataPage.java/clean/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/wizard/AbstractWizardDataPage.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1923,
751,
774,
1488,
1435,
288,
202,
202,
759,
336,
326,
938,
716,
732,
854,
1450,
202,
202,
7469,
19865,
27130,
24204,
273,
261,
7469,
19865,
27130,
13,
13876,
13412,
562... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1923,
751,
774,
1488,
1435,
288,
202,
202,
759,
336,
326,
938,
716,
732,
854,
1450,
202,
202,
7469,
19865,
27130,
24204,
273,
261,
7469,
19865,
27130,
13,
13876,
13412,
562... |
protected void tearDown() throws Exception { super.tearDown(); configuration.setConfiguration(contents); } | 55334 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/55334/3817641c106d627da311bf98468444114474ec5a/ConfigurationTest.java/buggy/webtest/net/sourceforge/cruisecontrol/ConfigurationTest.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
4750,
918,
268,
2091,
4164,
1435,
1216,
1185,
288,
3639,
2240,
18,
736,
297,
4164,
5621,
7734,
1664,
18,
542,
1750,
12,
3980,
1769,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
4750,
918,
268,
2091,
4164,
1435,
1216,
1185,
288,
3639,
2240,
18,
736,
297,
4164,
5621,
7734,
1664,
18,
542,
1750,
12,
3980,
1769,
565,
289,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... | ||
Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; | Object v[] = getProperty(event, property); Object[] args = new Object[] { v[0] }; Class[] argTypes = new Class[] { initClass((Class) v[1]) }; while(argTypes[0] != null) { try { actionMethod = targetClass.getMethod("set" + capitalize(action), argTypes); | public Object invoke(Object proxy, Method method, Object[] arguments) throws Exception { // Do we actually need the proxy? if (method == null) throw new RuntimeException("Invoking null method"); // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; // Extract the first arg from arguments and do getProperty on arg if (arguments == null || arguments.length == 0) return null; Object event = arguments[0]; // We hope :-) // Obtain the property XXX propertyType keeps showing up null - why? // because the object inside getProperty changes, but the ref variable // can't change this way, dolt! need a better way to get both values out // - need method and object to do the invoke and get return type Object v[] = getProperty(event, property); Object val = v[0]; Class propertyType = (Class) v[1]; // Find the actual method of target to invoke. We can't do this in the // constructor since we don't know the type of the property we extracted // from the event then. // // action can be either a property or a method. Sun's docs seem to imply // that action should be treated as a property first, and then a method, // but don't specifically say it. // // XXX check what happens with native type wrappers. The better thing to // do is look at the return type of the method Method actionMethod; try { // Look for a property setter for action. actionMethod = target.getClass().getMethod("set" + capitalize(action), new Class[] {propertyType}); } catch (NoSuchMethodException e) { // If action as property didn't work, try as method. try { actionMethod = target.getClass().getMethod(action, new Class[] {propertyType}); } catch (NoSuchMethodException e1) { // When event property is null, we may call action with no args if (property == null) { actionMethod = target.getClass().getMethod(action, null); return actionMethod.invoke(target, null); } else throw e1; } } // Invoke target.action(property) return actionMethod.invoke(target, new Object[] {val}); } | 1043 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1043/4560ec84d1941b7d1dc387ca2fa2087617053271/EventHandler.java/buggy/libjava/java/beans/EventHandler.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
1071,
1033,
4356,
12,
921,
2889,
16,
2985,
707,
16,
1033,
8526,
1775,
13,
565,
1216,
1185,
225,
288,
565,
368,
2256,
732,
6013,
1608,
326,
2889,
35,
565,
309,
261,
2039,
422,
446,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
1071,
1033,
4356,
12,
921,
2889,
16,
2985,
707,
16,
1033,
8526,
1775,
13,
565,
1216,
1185,
225,
288,
565,
368,
2256,
732,
6013,
1608,
326,
2889,
35,
565,
309,
261,
2039,
422,
446,
13,
... |
IViewState viewState = getViewStateWithId(getFor()); | ErrorMessage message = getMessage(); | public int doStartTag() throws JspException { IViewState viewState = getViewStateWithId(getFor()); if (viewState == null) { return SKIP_BODY; } List<ViewStateMessage> messages = viewState.getMessages(); if (! messages.isEmpty()) { writeMessage(messages.get(0)); } return SKIP_BODY; } | 2645 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/2645/a70473e891972a66f0567ddeefbe73da0625629c/MessageTag.java/clean/src/net/sourceforge/fenixedu/renderers/taglib/MessageTag.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
509,
741,
30512,
1435,
1216,
27485,
288,
3639,
30298,
883,
273,
2381,
5621,
7734,
309,
261,
1945,
1119,
422,
446,
13,
288,
5411,
327,
18420,
67,
16691,
31,
3639,
289,
3639,
987,
32,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
509,
741,
30512,
1435,
1216,
27485,
288,
3639,
30298,
883,
273,
2381,
5621,
7734,
309,
261,
1945,
1119,
422,
446,
13,
288,
5411,
327,
18420,
67,
16691,
31,
3639,
289,
3639,
987,
32,... |
"1. ERROR in X3c.java (at line 2)\r\n" + " A() { void random() {} };\r\n" + | "1. ERROR in X3c.java (at line 2)\n" + " A() { void random() {} };\n" + | public void test073() { this.runNegativeTest( // implement inherited method but as abstract new String[] { "X3.java", "public enum X3 implements I {\n" + " ;\n" + " public abstract void test();\n" + "}\n" + "interface I { void test(); }\n" }, "----------\n" + "1. ERROR in X3.java (at line 3)\r\n" + " public abstract void test();\r\n" + " ^^^^^^\n" + "The enum X3 can only define the abstract method test() if it also defines enum constants with corresponding implementations\n" + "----------\n" // X3 is not abstract and does not override abstract method test() in X3 ); this.runNegativeTest( // implement inherited method as abstract with constant new String[] { "X3a.java", "public enum X3a implements I {\n" + " A;\n" + " public abstract void test();\n" + "}\n" + "interface I { void test(); }\n" }, "----------\n" + "1. ERROR in X3a.java (at line 3)\r\n" + " public abstract void test();\r\n" + " ^^^^^^\n" + "The enum X3a can only define the abstract method test() if it also defines enum constants with corresponding implementations\n" + "----------\n" // X3a is not abstract and does not override abstract method test() in X3a ); this.runConformTest( // implement inherited method as abstract with constant body new String[] { "X3b.java", "public enum X3b implements I {\n" + " A() { public void test() {} };\n" + " public abstract void test();\n" + "}\n" + "interface I { void test(); }\n" }, "" ); this.runNegativeTest( // implement inherited method as abstract with random constant body new String[] { "X3c.java", "public enum X3c implements I {\n" + " A() { void random() {} };\n" + " public abstract void test();\n" + "}\n" + "interface I { void test(); }\n" }, "----------\n" + "1. ERROR in X3c.java (at line 2)\r\n" + " A() { void random() {} };\r\n" + " ^\n" + "The type new X3c(){} must implement the inherited abstract method X3c.test()\n" + "----------\n" // <anonymous X3c$1> is not abstract and does not override abstract method test() in X3c ); } | 10698 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/10698/417ab6333031a259fd217d0086fde6427dace471/EnumTest.java/clean/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1842,
8642,
23,
1435,
288,
202,
202,
2211,
18,
2681,
14959,
4709,
12,
368,
2348,
12078,
707,
1496,
487,
8770,
1082,
202,
2704,
514,
8526,
288,
9506,
202,
6,
60,
23,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1842,
8642,
23,
1435,
288,
202,
202,
2211,
18,
2681,
14959,
4709,
12,
368,
2348,
12078,
707,
1496,
487,
8770,
1082,
202,
2704,
514,
8526,
288,
9506,
202,
6,
60,
23,
18,
... |
protected IRubyObject allocateObject() { return new RubyBasicSocket(getRuntime(), this); | public IRubyObject allocateObject() { return new RubyBasicSocket(getRuntime(), this); | protected IRubyObject allocateObject() { return new RubyBasicSocket(getRuntime(), this); } | 52337 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52337/955df6c6347fe40e2cb6502680208323eef890e2/BasicSocketMetaClass.java/clean/src/org/jruby/runtime/builtin/meta/BasicSocketMetaClass.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
4750,
15908,
10340,
921,
10101,
921,
1435,
288,
202,
202,
2463,
394,
19817,
8252,
4534,
12,
588,
5576,
9334,
333,
1769,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
4750,
15908,
10340,
921,
10101,
921,
1435,
288,
202,
202,
2463,
394,
19817,
8252,
4534,
12,
588,
5576,
9334,
333,
1769,
565,
289,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
logger.info("\n" + getStartSplash()); | logger.info(getStartSplash()); | public synchronized void start() throws UMOException { initialise(); if (!started.get()) { starting.set(true); fireSystemEvent(new ManagerEvent(this, ManagerEvent.MANAGER_STARTING)); registerAdminAgent(); queueManager.start(); startConnectors(); startAgents(); if(model!=null) model.start(); started.set(true); starting.set(false); if(!config.isEmbedded()) { if (logger.isInfoEnabled()) { logger.info("\n" + getStartSplash()); } else { System.out.println(getStartSplash()); } } fireSystemEvent(new ManagerEvent(this, ManagerEvent.MANAGER_STARTED)); } } | 2370 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/2370/25a857385466f794439b21f97e14aef866b870d5/MuleManager.java/buggy/mule/src/java/org/mule/MuleManager.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
3852,
918,
787,
1435,
1216,
587,
5980,
503,
565,
288,
3639,
21301,
5621,
3639,
309,
16051,
14561,
18,
588,
10756,
288,
5411,
5023,
18,
542,
12,
3767,
1769,
5411,
4452,
3163,
1133,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
3852,
918,
787,
1435,
1216,
587,
5980,
503,
565,
288,
3639,
21301,
5621,
3639,
309,
16051,
14561,
18,
588,
10756,
288,
5411,
5023,
18,
542,
12,
3767,
1769,
5411,
4452,
3163,
1133,
1... |
return 0; } | return 0; } | int getSolveOrder() { return 0; } | 51263 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51263/b5b5168edc3af09cb74945a80b0c36e6630ed502/RolapCalculatedMember.java/buggy/src/main/mondrian/rolap/RolapCalculatedMember.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
474,
1322,
5390,
2448,
1435,
288,
202,
202,
2463,
374,
31,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
474,
1322,
5390,
2448,
1435,
288,
202,
202,
2463,
374,
31,
202,
97,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
if (sign == 0) { if (integer) canonical = "0"; | if (sign == 0) { if (integer) canonical = "0"; else canonical = "0.0"; return; } if (integer && sign > 0) { canonical = ivalue; return; } StringBuffer buffer = new StringBuffer(totalDigits+2); if (sign == -1) buffer.append('-'); if (intDigits != 0) buffer.append(ivalue); | private void makeCanonical() { if (sign == 0) { if (integer) canonical = "0"; else canonical = "0.0"; return; } if (integer && sign > 0) { canonical = ivalue; return; } StringBuffer buffer = new StringBuffer(totalDigits+2); if (sign == -1) buffer.append('-'); if (intDigits != 0) buffer.append(ivalue); else buffer.append('0'); if (!integer) { buffer.append('.'); if (fracDigits != 0) { buffer.append(fvalue); } else { buffer.append('0'); } } canonical = buffer.toString(); } | 6373 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/6373/ca2aeab59f3fc18d766b3141f9dc8b74b78f92ce/DecimalDV.java/clean/src/org/apache/xerces/impl/dv/xs/DecimalDV.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
918,
1221,
15512,
1435,
288,
3639,
309,
261,
2977,
422,
374,
13,
288,
5411,
309,
261,
7745,
13,
7734,
7378,
273,
315,
20,
14432,
5411,
469,
7734,
7378,
273,
315,
20,
18,
20,
14432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
918,
1221,
15512,
1435,
288,
3639,
309,
261,
2977,
422,
374,
13,
288,
5411,
309,
261,
7745,
13,
7734,
7378,
273,
315,
20,
14432,
5411,
469,
7734,
7378,
273,
315,
20,
18,
20,
14432... |
this.charStream = charStream; | this.charStream = new CharStream() { private final char[] buf = new char[5]; private final int[] charWidth = new int[buf.length]; private int cur = 0; private int charsInBuffer = 0; private boolean eosRead = false; private boolean escapeLookahead = false; private char escapeLookaheadChar; public String getDescription() { return charStream.getDescription(); } public char la() throws IOException { return la(1); } public char la(int k) throws IOException { if (k > this.charsInBuffer) { if (k > this.buf.length) throw new LookAheadExhaustionException(k); for (int i = 0; i != this.charsInBuffer; i++, this.cur++) { this.buf[i] = this.buf[this.cur]; this.charWidth[i] = this.charWidth[this.cur]; } fillBuffer(); } return this.buf[this.cur + k - 1]; } public char consume() throws IOException { if (this.charsInBuffer == 0) fillBuffer(); this.charsInBuffer--; Lexer.this.column += this.charWidth[this.cur]; this.charWidth[this.cur] = 1; return this.buf[this.cur++]; } public void close() throws IOException { charStream.close(); } private void fillBuffer() throws IOException { this.cur = 0; do { if (this.eosRead) { this.buf[this.charsInBuffer] = CharStream.EOS; } else { char c = this.escapeLookahead ? this.escapeLookaheadChar : charStream.consume(); this.escapeLookahead = false; if (c == CharStream.EOS) this.eosRead = true; if (c == '\\') { c = charStream.consume(); if (c == 'u') { do { c = charStream.consume(); } while (c == 'u'); try { c = (char)Integer.parseInt(new String(new char[] {c, charStream.consume(), charStream.consume(), charStream.consume()}), 16); } catch (NumberFormatException e) { throw new IOException("Bad Unicode escape sequence"); } } else { this.escapeLookahead = true; this.escapeLookaheadChar = c; c = '\\'; } } this.buf[this.charsInBuffer] = c; } } while (++this.charsInBuffer != this.buf.length); } }; | public Lexer(CharStream charStream) { this.charStream = charStream; this.line = 1; this.column = 1; } | 6462 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/6462/6738f45ab2ebb1c5ba089749b0ff984a3313dfe7/Lexer.java/clean/src/main/org/codehaus/groovy/syntax/lexer/Lexer.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
14234,
12,
2156,
1228,
1149,
1228,
13,
565,
288,
3639,
333,
18,
3001,
1228,
273,
394,
3703,
1228,
1435,
288,
225,
3238,
727,
1149,
8526,
1681,
273,
394,
1149,
63,
25,
15533,
3238,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
14234,
12,
2156,
1228,
1149,
1228,
13,
565,
288,
3639,
333,
18,
3001,
1228,
273,
394,
3703,
1228,
1435,
288,
225,
3238,
727,
1149,
8526,
1681,
273,
394,
1149,
63,
25,
15533,
3238,
... |
writeBlock(header, data, t, routingkeyDBE); | private synchronized void innerPut(KeyBlock block) throws IOException { if(closed) return; byte[] routingkey = block.getKey().getRoutingKey(); byte[] data = block.getRawData(); byte[] header = block.getRawHeaders(); if(data.length!=dataBlockSize) { Logger.error(this, "This data is "+data.length+" bytes. Should be "+dataBlockSize); return; } if(header.length!=headerBlockSize) { Logger.error(this, "This header is "+data.length+" bytes. Should be "+headerBlockSize); return; } Transaction t = null; try{ t = environment.beginTransaction(null,null); DatabaseEntry routingkeyDBE = new DatabaseEntry(routingkey); // FIXME use the free blocks list! long blockNum; if((blockNum = grabFreeBlock()) >= 0) { writeNewBlock(blockNum, header, data, t, routingkeyDBE); } else if(chkBlocksInStore<maxChkBlocks) { // Expand the store file synchronized(chkBlocksInStoreLock) { blockNum = chkBlocksInStore; chkBlocksInStore++; } writeNewBlock(blockNum, header, data, t, routingkeyDBE); }else{ overwriteLRUBlock(header, data, t, routingkeyDBE); } t.commit(); t = null; if(logMINOR) { Logger.minor(this, "Put key: "+block.getKey()); Logger.minor(this, "Headers: "+header.length+" bytes, hash "+Fields.hashCode(header)); Logger.minor(this, "Data: "+data.length+" bytes, hash "+Fields.hashCode(data)); } }catch(Throwable ex) { // FIXME: ugly if(t!=null){ try{t.abort();}catch(DatabaseException ex2){}; } checkSecondaryDatabaseError(ex); Logger.error(this, "Caught "+ex, ex); ex.printStackTrace(); if(ex instanceof IOException) throw (IOException) ex; else throw new IOException(ex.getMessage()); } } | 51738 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51738/4ed04b1f7b22d690ed47c61df8316bd0af66f70c/BerkeleyDBFreenetStore.java/clean/src/freenet/store/BerkeleyDBFreenetStore.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1045,
1768,
12,
3374,
16,
501,
16,
268,
16,
7502,
856,
2290,
41,
1769,
1045,
1768,
12,
3374,
16,
501,
16,
268,
16,
7502,
856,
2290,
41,
1769,
1045,
1768,
12,
3374,
16,
501,
16,
268,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1045,
1768,
12,
3374,
16,
501,
16,
268,
16,
7502,
856,
2290,
41,
1769,
1045,
1768,
12,
3374,
16,
501,
16,
268,
16,
7502,
856,
2290,
41,
1769,
1045,
1768,
12,
3374,
16,
501,
16,
268,
16,
... | |
AST tmp2076_AST_in = (AST)_t; | AST tmp2075_AST_in = (AST)_t; | public final void comboboxphrase(AST _t) throws RecognitionException { AST comboboxphrase_AST_in = (_t == ASTNULL) ? null : (AST)_t; AST __t591 = _t; AST tmp2070_AST_in = (AST)_t; match(_t,COMBOBOX); _t = _t.getFirstChild(); { _loop603: do { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case LISTITEMS: { AST __t593 = _t; AST tmp2071_AST_in = (AST)_t; match(_t,LISTITEMS); _t = _t.getFirstChild(); constant(_t); _t = _retTree; { _loop595: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==COMMA)) { AST tmp2072_AST_in = (AST)_t; match(_t,COMMA); _t = _t.getNextSibling(); constant(_t); _t = _retTree; } else { break _loop595; } } while (true); } _t = __t593; _t = _t.getNextSibling(); break; } case LISTITEMPAIRS: { AST __t596 = _t; AST tmp2073_AST_in = (AST)_t; match(_t,LISTITEMPAIRS); _t = _t.getFirstChild(); constant(_t); _t = _retTree; { _loop598: do { if (_t==null) _t=ASTNULL; if ((_t.getType()==COMMA)) { AST tmp2074_AST_in = (AST)_t; match(_t,COMMA); _t = _t.getNextSibling(); constant(_t); _t = _retTree; } else { break _loop598; } } while (true); } _t = __t596; _t = _t.getNextSibling(); break; } case INNERLINES: { AST __t599 = _t; AST tmp2075_AST_in = (AST)_t; match(_t,INNERLINES); _t = _t.getFirstChild(); expression(_t); _t = _retTree; _t = __t599; _t = _t.getNextSibling(); break; } case SORT: { AST tmp2076_AST_in = (AST)_t; match(_t,SORT); _t = _t.getNextSibling(); break; } case TOOLTIP: { tooltip_expr(_t); _t = _retTree; break; } case SIMPLE: { AST tmp2077_AST_in = (AST)_t; match(_t,SIMPLE); _t = _t.getNextSibling(); break; } case DROPDOWN: { AST tmp2078_AST_in = (AST)_t; match(_t,DROPDOWN); _t = _t.getNextSibling(); break; } case DROPDOWNLIST: { AST tmp2079_AST_in = (AST)_t; match(_t,DROPDOWNLIST); _t = _t.getNextSibling(); break; } case MAXCHARS: { AST __t600 = _t; AST tmp2080_AST_in = (AST)_t; match(_t,MAXCHARS); _t = _t.getFirstChild(); AST tmp2081_AST_in = (AST)_t; match(_t,NUMBER); _t = _t.getNextSibling(); _t = __t600; _t = _t.getNextSibling(); break; } case AUTOCOMPLETION: { AST __t601 = _t; AST tmp2082_AST_in = (AST)_t; match(_t,AUTOCOMPLETION); _t = _t.getFirstChild(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case UNIQUEMATCH: { AST tmp2083_AST_in = (AST)_t; match(_t,UNIQUEMATCH); _t = _t.getNextSibling(); break; } case 3: { break; } default: { throw new NoViableAltException(_t); } } } _t = __t601; _t = _t.getNextSibling(); break; } case SIZE: case SIZECHARS: case SIZEPIXELS: { sizephrase(_t); _t = _retTree; break; } default: { break _loop603; } } } while (true); } _t = __t591; _t = _t.getNextSibling(); _retTree = _t; } | 13952 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/13952/041a16c78289f1c3ae5e575d3edc5e893a658e50/JPTreeParser.java/buggy/trunk/org.prorefactor.core/src/org/prorefactor/treeparserbase/JPTreeParser.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
727,
918,
3894,
27570,
9429,
12,
9053,
389,
88,
13,
1216,
9539,
288,
9506,
202,
9053,
3894,
27570,
9429,
67,
9053,
67,
267,
273,
261,
67,
88,
422,
9183,
8560,
13,
692,
446,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
727,
918,
3894,
27570,
9429,
12,
9053,
389,
88,
13,
1216,
9539,
288,
9506,
202,
9053,
3894,
27570,
9429,
67,
9053,
67,
267,
273,
261,
67,
88,
422,
9183,
8560,
13,
692,
446,
... |
protected boolean startsLine(DetailAST aAst) | protected boolean startsLine(DetailAST aAst) | protected boolean startsLine(DetailAST aAst) { return getLineStart(aAst) == expandedTabsColumnNo(aAst); } | 50482 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50482/3b4c5f5b9f6c9e1d500b320963e15436dc497f2f/ExpressionHandler.java/buggy/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/indentation/ExpressionHandler.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
4750,
1250,
2542,
1670,
12,
6109,
9053,
279,
21385,
13,
377,
288,
3639,
327,
9851,
1685,
12,
69,
21385,
13,
422,
8406,
17348,
1494,
2279,
12,
69,
21385,
1769,
565,
289,
2,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
4750,
1250,
2542,
1670,
12,
6109,
9053,
279,
21385,
13,
377,
288,
3639,
327,
9851,
1685,
12,
69,
21385,
13,
422,
8406,
17348,
1494,
2279,
12,
69,
21385,
1769,
565,
289,
2,
-100,
-100,
-... |
public TA_RetCode CDLSHORTLINE( int startIdx, int endIdx, double inOpen[], double inHigh[], double inLow[], double inClose[], MInteger outBegIdx, MInteger outNbElement, int outInteger[] ){ double BodyPeriodTotal, ShadowPeriodTotal; int i, outIdx, BodyTrailingIdx, ShadowTrailingIdx, lookbackTotal; if( startIdx < 0 ) return TA_RetCode. TA_OUT_OF_RANGE_START_INDEX; if( (endIdx < 0) || (endIdx < startIdx)) return TA_RetCode. TA_OUT_OF_RANGE_END_INDEX; lookbackTotal = CDLSHORTLINE_Lookback (); if( startIdx < lookbackTotal ) startIdx = lookbackTotal; if( startIdx > endIdx ) { outBegIdx.value = 0 ; outNbElement.value = 0 ; return TA_RetCode. TA_SUCCESS; } BodyPeriodTotal = 0; BodyTrailingIdx = startIdx - (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].avgPeriod) ; ShadowPeriodTotal = 0; ShadowTrailingIdx = startIdx - (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].avgPeriod) ; i = BodyTrailingIdx; while( i < startIdx ) { BodyPeriodTotal += ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_RealBody ? ( Math.abs ( inClose[i] - inOpen[i] ) ) : ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_HighLow ? ( inHigh[i] - inLow[i] ) : ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? ( inHigh[i] - ( inClose[i] >= inOpen[i] ? inClose[i] : inOpen[i] ) ) + ( ( inClose[i] >= inOpen[i] ? inOpen[i] : inClose[i] ) - inLow[i] ) : 0 ) ) ) ; i++; } i = ShadowTrailingIdx; while( i < startIdx ) { ShadowPeriodTotal += ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_RealBody ? ( Math.abs ( inClose[i] - inOpen[i] ) ) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_HighLow ? ( inHigh[i] - inLow[i] ) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? ( inHigh[i] - ( inClose[i] >= inOpen[i] ? inClose[i] : inOpen[i] ) ) + ( ( inClose[i] >= inOpen[i] ? inOpen[i] : inClose[i] ) - inLow[i] ) : 0 ) ) ) ; i++; } outIdx = 0; do { if( ( Math.abs ( inClose[i] - inOpen[i] ) ) < ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].factor) * ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].avgPeriod) != 0.0? BodyPeriodTotal / (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].avgPeriod) : ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_RealBody ? ( Math.abs ( inClose[i] - inOpen[i] ) ) : ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_HighLow ? ( inHigh[i] - inLow[i] ) : ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? ( inHigh[i] - ( inClose[i] >= inOpen[i] ? inClose[i] : inOpen[i] ) ) + ( ( inClose[i] >= inOpen[i] ? inOpen[i] : inClose[i] ) - inLow[i] ) : 0 ) ) ) ) / ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? 2.0 : 1.0 ) ) && ( inHigh[i] - ( inClose[i] >= inOpen[i] ? inClose[i] : inOpen[i] ) ) < ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].factor) * ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].avgPeriod) != 0.0? ShadowPeriodTotal / (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].avgPeriod) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_RealBody ? ( Math.abs ( inClose[i] - inOpen[i] ) ) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_HighLow ? ( inHigh[i] - inLow[i] ) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? ( inHigh[i] - ( inClose[i] >= inOpen[i] ? inClose[i] : inOpen[i] ) ) + ( ( inClose[i] >= inOpen[i] ? inOpen[i] : inClose[i] ) - inLow[i] ) : 0 ) ) ) ) / ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? 2.0 : 1.0 ) ) && ( ( inClose[i] >= inOpen[i] ? inOpen[i] : inClose[i] ) - inLow[i] ) < ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].factor) * ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].avgPeriod) != 0.0? ShadowPeriodTotal / (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].avgPeriod) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_RealBody ? ( Math.abs ( inClose[i] - inOpen[i] ) ) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_HighLow ? ( inHigh[i] - inLow[i] ) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? ( inHigh[i] - ( inClose[i] >= inOpen[i] ? inClose[i] : inOpen[i] ) ) + ( ( inClose[i] >= inOpen[i] ? inOpen[i] : inClose[i] ) - inLow[i] ) : 0 ) ) ) ) / ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? 2.0 : 1.0 ) ) ) outInteger[outIdx++] = ( inClose[i] >= inOpen[i] ? 1 : -1 ) * 100; else outInteger[outIdx++] = 0; BodyPeriodTotal += ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_RealBody ? ( Math.abs ( inClose[i] - inOpen[i] ) ) : ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_HighLow ? ( inHigh[i] - inLow[i] ) : ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? ( inHigh[i] - ( inClose[i] >= inOpen[i] ? inClose[i] : inOpen[i] ) ) + ( ( inClose[i] >= inOpen[i] ? inOpen[i] : inClose[i] ) - inLow[i] ) : 0 ) ) ) - ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_RealBody ? ( Math.abs ( inClose[BodyTrailingIdx] - inOpen[BodyTrailingIdx] ) ) : ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_HighLow ? ( inHigh[BodyTrailingIdx] - inLow[BodyTrailingIdx] ) : ( (this.candleSettings[TA_CandleSettingType.TA_BodyShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? ( inHigh[BodyTrailingIdx] - ( inClose[BodyTrailingIdx] >= inOpen[BodyTrailingIdx] ? inClose[BodyTrailingIdx] : inOpen[BodyTrailingIdx] ) ) + ( ( inClose[BodyTrailingIdx] >= inOpen[BodyTrailingIdx] ? inOpen[BodyTrailingIdx] : inClose[BodyTrailingIdx] ) - inLow[BodyTrailingIdx] ) : 0 ) ) ) ; ShadowPeriodTotal += ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_RealBody ? ( Math.abs ( inClose[i] - inOpen[i] ) ) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_HighLow ? ( inHigh[i] - inLow[i] ) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? ( inHigh[i] - ( inClose[i] >= inOpen[i] ? inClose[i] : inOpen[i] ) ) + ( ( inClose[i] >= inOpen[i] ? inOpen[i] : inClose[i] ) - inLow[i] ) : 0 ) ) ) - ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_RealBody ? ( Math.abs ( inClose[ShadowTrailingIdx] - inOpen[ShadowTrailingIdx] ) ) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_HighLow ? ( inHigh[ShadowTrailingIdx] - inLow[ShadowTrailingIdx] ) : ( (this.candleSettings[TA_CandleSettingType.TA_ShadowShort.ordinal()].rangeType) == TA_RangeType. TA_RangeType_Shadows ? ( inHigh[ShadowTrailingIdx] - ( inClose[ShadowTrailingIdx] >= inOpen[ShadowTrailingIdx] ? inClose[ShadowTrailingIdx] : inOpen[ShadowTrailingIdx] ) ) + ( ( inClose[ShadowTrailingIdx] >= inOpen[ShadowTrailingIdx] ? inOpen[ShadowTrailingIdx] : inClose[ShadowTrailingIdx] ) - inLow[ShadowTrailingIdx] ) : 0 ) ) ) ; i++; BodyTrailingIdx++; ShadowTrailingIdx++; } while( i <= endIdx ); outNbElement.value = outIdx; outBegIdx.value = startIdx; return TA_RetCode. TA_SUCCESS;} | 51465 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/51465/1a230e9b7099cbd2b7e9eb1294130ca009bfedf4/Core.java/buggy/trunk/ta-lib/java/src/TA/Lib/Core.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
1071,
399,
37,
67,
7055,
1085,
385,
8914,
15993,
5997,
12,
509,
27108,
16,
509,
679,
4223,
16,
1645,
316,
3678,
63,
6487,
1645,
316,
8573,
63,
6487,
1645,
316,
10520,
63,
6487,
1645,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
1071,
399,
37,
67,
7055,
1085,
385,
8914,
15993,
5997,
12,
509,
27108,
16,
509,
679,
4223,
16,
1645,
316,
3678,
63,
6487,
1645,
316,
8573,
63,
6487,
1645,
316,
10520,
63,
6487,
1645,
31... | ||
} else { return (new Long((now - idle) / 60000)).toString(); | private String idleToString(long now, long idle) { if (idle == -1) { return " "; } else { return (new Long((now - idle) / 60000)).toString(); } } | 48807 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/48807/4a86b750bd39874092f469fc9247fe7b8316663e/DarknetConnectionsToadlet.java/clean/src/freenet/clients/http/DarknetConnectionsToadlet.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1152,
514,
12088,
5808,
12,
5748,
2037,
16,
1525,
12088,
13,
288,
202,
202,
430,
261,
20390,
422,
300,
21,
13,
288,
1082,
202,
2463,
315,
13636,
202,
202,
97,
469,
288,
1082,
202,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1152,
514,
12088,
5808,
12,
5748,
2037,
16,
1525,
12088,
13,
288,
202,
202,
430,
261,
20390,
422,
300,
21,
13,
288,
1082,
202,
2463,
315,
13636,
202,
202,
97,
469,
288,
1082,
202,
... | |
} | } | public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) { } | 31053 /local/tlutelli/issta_data/temp/all_java3context/java/2006_temp/2006/31053/c9f1bda78047dd504d2974b99e22c626477ffaae/URLFetcher.java/buggy/src/org/owasp/webscarab/httpclient/URLFetcher.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1171,
1071,
918,
866,
1227,
16950,
12,
6290,
18,
7462,
18,
7593,
18,
60,
5995,
4719,
8526,
13870,
16,
514,
28514,
13,
288,
7734,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1171,
1071,
918,
866,
1227,
16950,
12,
6290,
18,
7462,
18,
7593,
18,
60,
5995,
4719,
8526,
13870,
16,
514,
28514,
13,
288,
7734,
289,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
} else { | } else { | public boolean isSelected(File basedir, String filename, File file) { // throw BuildException on error validate(); // Directory size never selected for if (file.isDirectory()) { return true; } if (cmp == 0) { return (file.length() < sizelimit); } else if (cmp == 1) { return (file.length() > sizelimit); } else { return (file.length() == sizelimit); } } | 17033 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/17033/4ee8397a70d3f74319f2de8b65c35ec4128bacf6/SizeSelector.java/buggy/src/main/org/apache/tools/ant/types/selectors/SizeSelector.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
1250,
20956,
12,
812,
15573,
16,
514,
1544,
16,
1387,
585,
13,
288,
3639,
368,
604,
18463,
603,
555,
3639,
1954,
5621,
3639,
368,
8930,
963,
5903,
3170,
364,
3639,
309,
261,
768,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
1250,
20956,
12,
812,
15573,
16,
514,
1544,
16,
1387,
585,
13,
288,
3639,
368,
604,
18463,
603,
555,
3639,
1954,
5621,
3639,
368,
8930,
963,
5903,
3170,
364,
3639,
309,
261,
768,
... |
new ConflictsDialog(myProject); | new ConflictsDialog(myProject, conflicts); | protected boolean preprocessUsages(Ref<UsageInfo[]> refUsages) { UsageInfo[] usagesIn = refUsages.get(); ArrayList<UsageInfo> oldUsages = new ArrayList<UsageInfo>(); addAll(oldUsages, usagesIn); final ObjectUpcastedUsageInfo[] objectUpcastedUsageInfos = objectUpcastedUsages(usagesIn); if (myPrepareSuccessfulSwingThreadCallback != null) { ArrayList<String> conflicts = new ArrayList<String>(); if (objectUpcastedUsageInfos.length > 0) { final String message = RefactoringBundle.message("instances.of.0.upcasted.to.1.were.found", ConflictsUtil.getDescription(myClass, true), CommonRefactoringUtil.htmlEmphasize("java.lang.Object")); conflicts.add(message); } analyzeConflicts(usagesIn, conflicts); if (!conflicts.isEmpty()) { ConflictsDialog conflictsDialog = new ConflictsDialog(myProject); conflictsDialog.show(); if (!conflictsDialog.isOK()) return false; } if (objectUpcastedUsageInfos.length > 0) { showObjectUpcastedUsageView(objectUpcastedUsageInfos); setPreviewUsages(true); } } ArrayList<UsageInfo> filteredUsages = filterUsages(oldUsages); refUsages.set(filteredUsages.toArray(new UsageInfo[filteredUsages.size()])); prepareSuccessful(); return true; } | 12814 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/12814/413999cb6b9d69b19798528a6066ceba40f68c3c/InheritanceToDelegationProcessor.java/buggy/refactoring/impl/com/intellij/refactoring/inheritanceToDelegation/InheritanceToDelegationProcessor.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
4750,
1250,
17942,
3477,
1023,
12,
1957,
32,
5357,
966,
8526,
34,
1278,
3477,
1023,
13,
288,
565,
10858,
966,
8526,
584,
1023,
382,
273,
1278,
3477,
1023,
18,
588,
5621,
565,
2407,
32,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
4750,
1250,
17942,
3477,
1023,
12,
1957,
32,
5357,
966,
8526,
34,
1278,
3477,
1023,
13,
288,
565,
10858,
966,
8526,
584,
1023,
382,
273,
1278,
3477,
1023,
18,
588,
5621,
565,
2407,
32,
... |
left.reset(); | public static boolean compare(NodeIterator left, NodeIterator right, int op, int node, DOM dom) { int lnode; left.reset(); while ((lnode = left.next()) != NodeIterator.END) { final String lvalue = dom.getNodeValue(lnode); int rnode; right.reset(); while ((rnode = right.next()) != NodeIterator.END) { if (compareStrings(lvalue, dom.getNodeValue(rnode), op, dom)) { return true; } } } return false; } | 2723 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/2723/218fffef1d42c9f6200540932aecffa365538529/BasisLibrary.java/buggy/src/org/apache/xalan/xsltc/runtime/BasisLibrary.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
760,
1250,
3400,
12,
907,
3198,
2002,
16,
2029,
3198,
2145,
16,
6862,
225,
509,
1061,
16,
509,
756,
16,
4703,
4092,
13,
288,
202,
474,
328,
2159,
31,
202,
4482,
18,
6208,
5621,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
760,
1250,
3400,
12,
907,
3198,
2002,
16,
2029,
3198,
2145,
16,
6862,
225,
509,
1061,
16,
509,
756,
16,
4703,
4092,
13,
288,
202,
474,
328,
2159,
31,
202,
4482,
18,
6208,
5621,
... | |
assertNull( session.getDefaultValue( Style.FONT_SIZE_PROP ) ); | assertNull( session.getDefaultValue( IStyleModel.FONT_SIZE_PROP ) ); | public void testSetValue( ) throws PropertyValueException { DesignSession session = new DesignSession( null ); // get the default RGBvalue assertEquals( 3, session.getColorFormat( ) ); // set the new RGB value session.setColorFormat( 2 ); assertEquals( 2, session.getColorFormat( ) ); try { session.setColorFormat( 999999 ); fail( ); } catch ( PropertyValueException e ) { assertEquals( PropertyValueException.DESIGN_EXCEPTION_INVALID_VALUE, e .getErrorCode( ) ); } assertEquals( 2, session.getColorFormat( ) ); // the default units value assertEquals( "in", session.getUnits( ) ); //$NON-NLS-1$ // set the new unit value session.setUnits( "cm" ); //$NON-NLS-1$ assertEquals( "cm", session.getUnits( ) ); //$NON-NLS-1$ // set the invalid units value try { session.setUnits( "wrong units" ); //$NON-NLS-1$ fail( ); } catch ( PropertyValueException e ) { assertEquals( PropertyValueException.DESIGN_EXCEPTION_INVALID_VALUE, e .getErrorCode( ) ); } assertEquals( "cm", session.getUnits( ) ); //$NON-NLS-1$ // get the default value of font-size. The default value is not set. assertNull( session.getDefaultValue( Style.FONT_SIZE_PROP ) ); // set a default value for it session.setDefaultValue( Style.FONT_SIZE_PROP, "3cm" ); //$NON-NLS-1$ assertEquals( "3cm", ( (DimensionValue) session.getDefaultValue( Style.FONT_SIZE_PROP ) ).toString( ) ); //$NON-NLS-1$ // set the wrong value for font-size. try { session.setDefaultValue( Style.FONT_SIZE_PROP, "wrong value" ); //$NON-NLS-1$ fail( ); } catch ( PropertyValueException pve ) { assertEquals( PropertyValueException.DESIGN_EXCEPTION_INVALID_VALUE, pve .getErrorCode( ) ); } // set the default value of font-size as null session.setDefaultValue( Style.FONT_SIZE_PROP, null ); } | 46013 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46013/ce1ec9b351bb8634a37466e2c6670795aba650ce/DesignSessionTest.java/buggy/model/org.eclipse.birt.report.model.tests/test/org/eclipse/birt/report/model/core/DesignSessionTest.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1842,
694,
620,
12,
262,
1216,
4276,
9738,
202,
95,
202,
202,
15478,
2157,
1339,
273,
394,
29703,
2157,
12,
446,
11272,
202,
202,
759,
336,
326,
805,
11510,
1132,
202,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1842,
694,
620,
12,
262,
1216,
4276,
9738,
202,
95,
202,
202,
15478,
2157,
1339,
273,
394,
29703,
2157,
12,
446,
11272,
202,
202,
759,
336,
326,
805,
11510,
1132,
202,
20... |
getFirstAttrbuteByTagName(new String[]{"mainform", "serverlist", "col0caption"})); | getFirstAttrbuteByTagName(new String[] {"mainform", "serverlist", "col0caption"})); | public void fireLanguageChanged() { try{ LanguageSelector languageSelector = LanguageSelector.getInstance();/* sucheServer.setText("<html><font><u>" + ZeichenErsetzer.korrigiereUmlaute(languageSelector. getFirstAttrbuteByTagName(new String[]{"mainform", "Label11", "caption"})) + "</u></font></html>");*/ String[] columns = new String[4]; columns[0] = ZeichenErsetzer.korrigiereUmlaute(languageSelector. getFirstAttrbuteByTagName(new String[]{"mainform", "serverlist", "col0caption"})); columns[1] = ZeichenErsetzer.korrigiereUmlaute(languageSelector. getFirstAttrbuteByTagName(new String[]{"mainform", "serverlist", "col1caption"})); columns[2] = ZeichenErsetzer.korrigiereUmlaute(languageSelector. getFirstAttrbuteByTagName(new String[]{"mainform", "serverlist", "col3caption"})); columns[3] = ZeichenErsetzer.korrigiereUmlaute(languageSelector. getFirstAttrbuteByTagName(new String[]{"mainform", "serverlist", "col5caption"})); item1.setText(ZeichenErsetzer.korrigiereUmlaute(languageSelector. getFirstAttrbuteByTagName(new String[]{"mainform", "connserv", "caption"}))); item2.setText(ZeichenErsetzer.korrigiereUmlaute(languageSelector. getFirstAttrbuteByTagName(new String[]{"mainform", "delserv", "caption"}))); item3.setText(ZeichenErsetzer.korrigiereUmlaute(languageSelector. getFirstAttrbuteByTagName(new String[]{"mainform", "addserv", "caption"}))); item4.setText(ZeichenErsetzer.korrigiereUmlaute(languageSelector. getFirstAttrbuteByTagName(new String[]{"mainform", "addserv", "caption"}))); item5.setText(ZeichenErsetzer.korrigiereUmlaute(languageSelector. getFirstAttrbuteByTagName(new String[]{"mainform", "addserv", "caption"}))); item6.setText(ZeichenErsetzer.korrigiereUmlaute(languageSelector. getFirstAttrbuteByTagName(new String[]{"mainform", "delserv", "caption"}))); TableColumnModel tcm = serverTable.getColumnModel(); for (int i = 0; i < tcm.getColumnCount(); i++) { tcm.getColumn(i).setHeaderValue(columns[i]); } } catch (Exception e) { if (logger.isEnabledFor(Level.ERROR)) logger.error("Unbehandelte Exception", e); } } | 13641 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/13641/1f4dabb850a3fc6f1837479d71ad430eadb1c84b/ServerPanel.java/clean/AJClientGUI/src/de/applejuicenet/client/gui/ServerPanel.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
4452,
3779,
5033,
1435,
288,
3639,
775,
95,
5411,
9889,
4320,
2653,
4320,
273,
9889,
4320,
18,
588,
1442,
5621,
20308,
5411,
4123,
73,
2081,
18,
542,
1528,
2932,
32,
2620,
4438... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
4452,
3779,
5033,
1435,
288,
3639,
775,
95,
5411,
9889,
4320,
2653,
4320,
273,
9889,
4320,
18,
588,
1442,
5621,
20308,
5411,
4123,
73,
2081,
18,
542,
1528,
2932,
32,
2620,
4438... |
if(i.compareTo(list.head()) < 0) { | if(i.compareTo(list.head()) <= 0) { | public synchronized void add(UpdatableSortedLinkedListItem i) { Logger.minor(this, "Add("+i+") on "+this); if(list.isEmpty()) { list.push(i); return; } if(i.compareTo(list.tail()) == 0) return; if(i.compareTo(list.tail()) > 0) { list.push(i); return; } if(i.compareTo(list.head()) < 0) { list.unshift(i); return; } // Search the list for a good place to put it Enumeration e = list.elements(); UpdatableSortedLinkedListItem prev = null; while(e.hasMoreElements()) { UpdatableSortedLinkedListItem cur = (UpdatableSortedLinkedListItem) e.nextElement(); if(prev != null && cur.compareTo(i) > 0 && prev.compareTo(i) < 0) { list.insertNext(prev, i); return; } Logger.minor(this, "Not matching "+cur+" "+prev); prev = cur; } throw new IllegalStateException("impossible"); } | 49933 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/49933/8707969864a8fc5c76b305d6a9b5438889fcb044/UpdatableSortedLinkedList.java/clean/src/freenet/support/UpdatableSortedLinkedList.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
3852,
918,
527,
12,
1211,
3404,
429,
11739,
13174,
13575,
277,
13,
288,
3639,
4242,
18,
17364,
12,
2211,
16,
315,
986,
2932,
15,
77,
15,
7923,
603,
13773,
2211,
1769,
3639,
309,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
3852,
918,
527,
12,
1211,
3404,
429,
11739,
13174,
13575,
277,
13,
288,
3639,
4242,
18,
17364,
12,
2211,
16,
315,
986,
2932,
15,
77,
15,
7923,
603,
13773,
2211,
1769,
3639,
309,
1... |
if (entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_GYRO,Mech.LOC_CT) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_HIP, Mech.LOC_RLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_UPPER_LEG, Mech.LOC_RLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_LOWER_LEG, Mech.LOC_RLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_FOOT, Mech.LOC_RLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_HIP, Mech.LOC_LLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_UPPER_LEG, Mech.LOC_LLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_LOWER_LEG, Mech.LOC_LLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_FOOT, Mech.LOC_LLEG) > 0) { doSkillCheckInPlace(entity, new PilotingRollData(entity.getId(), 0, "landing with damaged leg actuator or gyro")); | if (entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_GYRO,Mech.LOC_CT) > 0 || entity.hasLegActuatorCrit()) { doSkillCheckInPlace(entity, new PilotingRollData(entity.getId(), 0, "landing with damaged leg actuator or gyro"), false); | private void doEntityMovement(Packet c, int cn) { final MovementData md = (MovementData)c.getObject(1); // walk thru data, stopping when the mech is out of movement final Entity entity = game.getEntity(c.getIntValue(0)); if (entity == null) { // what causes this? --Ben return; } // check for fleeing if (md.contains(MovementData.STEP_FLEE)) { phaseReport.append("\n" + entity.getDisplayName() + " flees the battlefield.\n"); game.moveToGraveyard(entity.getId()); send(createRemoveEntityPacket(entity.getId())); return; } // okay, proceed with movement calculations Coords lastPos = entity.getPosition(); Coords curPos = entity.getPosition(); int curFacing = entity.getFacing(); int distance = 0; int moveType = Entity.MOVE_NONE; int overallMoveType = Entity.MOVE_NONE; boolean firstStep; boolean wasProne; Compute.compile(game, entity.getId(), md); // get last step's movement type for (final Enumeration i = md.getSteps(); i.hasMoreElements();) { final MovementData.Step step = (MovementData.Step)i.nextElement(); if (step.getMovementType() == Entity.MOVE_ILLEGAL) { break; } else { overallMoveType = step.getMovementType(); } } // iterate through steps firstStep = true; for (final Enumeration i = md.getSteps(); i.hasMoreElements();) { final MovementData.Step step = (MovementData.Step)i.nextElement(); wasProne = entity.isProne(); // stop for illegal movement if (step.getMovementType() == Entity.MOVE_ILLEGAL) { break; } // check piloting skill for getting up if (step.getType() == MovementData.STEP_GET_UP) { entity.heatBuildup += 1; entity.setProne(false); wasProne = false; doSkillCheckInPlace(entity, new PilotingRollData(entity.getId(), 0, "getting up")); } else if (firstStep) { // running with destroyed hip or gyro needs a check if (overallMoveType == Entity.MOVE_RUN && (entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_GYRO,Mech.LOC_CT) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_HIP, Mech.LOC_RLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_HIP, Mech.LOC_LLEG) > 0)) { doSkillCheckInPlace(entity, new PilotingRollData(entity.getId(), 0, "running with damaged hip actuator or gyro")); } firstStep = false; } // did the entity just fall? if (!wasProne && entity.isProne()) { curFacing = entity.getFacing(); curPos = entity.getPosition(); break; } // check for charge if (step.getType() == MovementData.STEP_CHARGE) { Entity target = game.getEntity(step.getPosition()); distance = step.getDistance(); entity.setCharging(true); pendingCharges.addElement(new ChargeAttackAction(entity.getId(), target.getId(), target.getPosition())); break; } // check for dfa if (step.getType() == MovementData.STEP_DFA) { Entity target = game.getEntity(step.getPosition()); distance = step.getDistance(); entity.setMakingDfa(true); pendingCharges.addElement(new DfaAttackAction(entity.getId(), target.getId(), target.getPosition())); break; } // step... moveType = step.getMovementType(); curPos = step.getPosition(); curFacing = step.getFacing(); distance = step.getDistance(); final Hex curHex = game.board.getHex(curPos); // check if we've moved into rubble if (!lastPos.equals(curPos) && step.getMovementType() != Entity.MOVE_JUMP && (curHex.getTerrainType() == Terrain.RUBBLE)) { doSkillCheckWhileMoving(entity, lastPos, curPos, new PilotingRollData(entity.getId(), 0, "entering Rubble")); } // check if we've moved into water if (!lastPos.equals(curPos) && step.getMovementType() != Entity.MOVE_JUMP && curHex.getTerrainType() == Terrain.WATER && curHex.getElevation() < 0) { if (curHex.getElevation() == -1) { doSkillCheckWhileMoving(entity, lastPos, curPos, new PilotingRollData(entity.getId(), -1, "entering Depth 1 Water")); } else if (curHex.getElevation() == -2) { doSkillCheckWhileMoving(entity, lastPos, curPos, new PilotingRollData(entity.getId(), 0, "entering Depth 2 Water")); } else { doSkillCheckWhileMoving(entity, lastPos, curPos, new PilotingRollData(entity.getId(), 1, "entering Depth 3+ Water")); } } // did the entity just fall? if (!wasProne && entity.isProne()) { curFacing = entity.getFacing(); curPos = entity.getPosition(); break; } // update lastPos lastPos = new Coords(curPos); } // set entity parameters entity.setPosition(curPos); entity.setFacing(curFacing); entity.setSecondaryFacing(curFacing); entity.delta_distance = distance; entity.moved = moveType; // but the danger isn't over yet! landing from a jump can be risky! if (overallMoveType == Entity.MOVE_JUMP && !entity.isMakingDfa()) { // check for damaged criticals if (entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_GYRO,Mech.LOC_CT) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_HIP, Mech.LOC_RLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_UPPER_LEG, Mech.LOC_RLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_LOWER_LEG, Mech.LOC_RLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_FOOT, Mech.LOC_RLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_HIP, Mech.LOC_LLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_UPPER_LEG, Mech.LOC_LLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_LOWER_LEG, Mech.LOC_LLEG) > 0 || entity.getDestroyedCriticals(CriticalSlot.TYPE_SYSTEM, Mech.ACTUATOR_FOOT, Mech.LOC_LLEG) > 0) { doSkillCheckInPlace(entity, new PilotingRollData(entity.getId(), 0, "landing with damaged leg actuator or gyro")); } } // build up heat from movement if (moveType == Entity.MOVE_WALK) { entity.heatBuildup += 1; } else if (moveType == Entity.MOVE_RUN) { entity.heatBuildup += 2; } else if (moveType == Entity.MOVE_JUMP) { entity.heatBuildup += Math.max(3, distance); } entity.ready = false; // duhh.. send an outgoing packet to everybody send(createEntityPacket(entity.getId())); } | 4135 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/4135/97bb8cf194a764a4dafa3ce46e9e4b2d313c032e/Server.java/clean/megamek/src/megamek/server/Server.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
918,
741,
1943,
49,
26140,
12,
6667,
276,
16,
509,
6227,
13,
288,
3639,
727,
490,
26140,
751,
3481,
273,
261,
49,
26140,
751,
13,
71,
18,
588,
921,
12,
21,
1769,
3639,
368,
5442... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
918,
741,
1943,
49,
26140,
12,
6667,
276,
16,
509,
6227,
13,
288,
3639,
727,
490,
26140,
751,
3481,
273,
261,
49,
26140,
751,
13,
71,
18,
588,
921,
12,
21,
1769,
3639,
368,
5442... |
if (schemaList != null && schemaList.size() > 0) | if (schemaName != null && schemaName.trim().length() > 0) | protected void populateTableList() { // Remove all the existing children of the root Node if ( rootNode != null ) { availableDbObjectsTree.removeAll( ); setRootElement( ); } String namePattern = null; String[] tableType = null; cachedSearchTxt = searchTxt.getText(); namePattern = getTailoredSearchText( searchTxt.getText() ); String dbtype = getSelectedDbType( ); cachedDbType = dbtype; if ( dbtype != null ) { if ( DbType.TABLE_STRING.equalsIgnoreCase( dbtype ) || DbType.VIEW_STRING.equalsIgnoreCase( dbtype ) ) { tableType = new String[]{ dbtype }; } } String catalogName = metaDataProvider.getCatalog(); ArrayList tableList = new ArrayList(); ArrayList targetSchemaList = new ArrayList(); ResultSet tablesRs = null; ArrayList procedureRs = null; if (schemaList != null && schemaList.size() > 0) { int numberOfSchema = 0; Preferences preferences = ReportPlugin.getDefault( ) .getPluginPreferences( ); if ( preferences.contains( DateSetPreferencePage.USER_MAX_NUM_OF_SCHEMA ) ) { numberOfSchema = preferences.getInt( DateSetPreferencePage.USER_MAX_NUM_OF_SCHEMA ); } else { numberOfSchema = DateSetPreferencePage.DEFAULT_MAX_NUM_OF_SCHEMA; preferences.setValue( DateSetPreferencePage.USER_MAX_NUM_OF_SCHEMA, numberOfSchema ); } cachedSchemaComboIndex = schemaCombo.getSelectionIndex(); if ( schemaCombo.getSelectionIndex() == 0) { targetSchemaList = schemaList; } else { targetSchemaList.add( schemaCombo.getItem( schemaCombo.getSelectionIndex() )); numberOfSchema = 1; } // For each schema Get the List of Tables int numTables = 0; for( int i=0; i< targetSchemaList.size() && i < numberOfSchema; i++) { int count = 0; String schemaName = (String)targetSchemaList.get(i); if( metaDataProvider.isProcedureSupported() ) procedureRs = metaDataProvider.getAllProcedure( catalogName, schemaName, namePattern ); if( !DbType.PROCEDURE_STRING.equalsIgnoreCase(dbtype)) tablesRs = metaDataProvider.getAlltables(catalogName,schemaName,namePattern,tableType); tableList = new ArrayList(); if( tablesRs == null && procedureRs == null ) { continue; } try { // Create the schema Node ArrayList schema = new ArrayList(); TreeItem schemaTreeItem[] = null; Image image = tableImage; if( count == 0 ) { schema.add(schemaName); schemaTreeItem = Utility.createTreeItems(rootNode, schema, SWT.NONE, schemaImage); //expand schema TreeItem if( schemaTreeItem != null && schemaTreeItem.length > 0) availableDbObjectsTree.showItem(schemaTreeItem[0]); } if ( tablesRs != null ) { while ( tablesRs.next( ) ) { // tablesRs.getString("TABLE_NAME") must be called // before // tablesRs.getString("TABLE_TYPE"). This is because // once using JDBC-ODBC-SQLSERVER // the index of "TABLE_NAME" is higher than that of // "TABLE_TYPE".And when connection // is built using JDBC-ODBC-SQLSERVER the // ResultSet.getString() method, if being called // use a low index, then called using a high index, // will result in an exception. String tableName = tablesRs.getString( "TABLE_NAME" ); String type = tablesRs.getString( "TABLE_TYPE" ); if ( type.equalsIgnoreCase( "SYSTEM TABLE" ) ) continue; count++; int dbType = DbObject.TABLE_TYPE; if ( type.equalsIgnoreCase( "TABLE" ) ) { image = tableImage; dbType = DbObject.TABLE_TYPE; } else if ( type.equalsIgnoreCase( "VIEW" ) ) { image = viewImage; dbType = DbObject.VIEW_TYPE; } String fullyQualifiedTableName = tableName; if ( schemaName != null && schemaName.trim( ).length( ) > 0 ) { fullyQualifiedTableName = schemaName + "." + tableName; } DbObject dbObject = new DbObject( fullyQualifiedTableName, tableName, dbType, image ); tableList.add( dbObject ); numTables++; } } if ( needToCreateProcedureNode( dbtype, procedureRs )) { String fullyQualifiedTableName = "STORED PROCEDURES"; if ( schemaName != null && schemaName.trim( ).length( ) > 0 ) { fullyQualifiedTableName = schemaName + "." + "STORED PROCEDURES"; } DbObject dbObject = new DbObject( fullyQualifiedTableName,"STORED PROCEDURES", DbObject.PROCEDURE_TYPE, tableImage); tableList.add( dbObject ); } if ( schemaTreeItem != null && schemaTreeItem.length > 0 ) { TreeItem item[] = Utility.createTreeItems( schemaTreeItem[0], tableList, SWT.NONE, null ); //expand table TreeItem if ( expandDbObjectsTree && item != null && item.length > 0 ) { availableDbObjectsTree.showItem( item[0] ); } } } catch(SQLException e) { e.printStackTrace(); } } } else { if( metaDataProvider.isProcedureSupported() ) procedureRs = metaDataProvider.getAllProcedure( catalogName, null, namePattern ); if( !DbType.PROCEDURE_STRING.equalsIgnoreCase(dbtype)) tablesRs = metaDataProvider.getAlltables(catalogName,null,namePattern,tableType); if( tablesRs == null && procedureRs == null ) { return; } try { Image image = tableImage; if ( tablesRs != null ) { while ( tablesRs.next( ) ) { String tableName = tablesRs.getString( "TABLE_NAME" ); String type = tablesRs.getString( "TABLE_TYPE" );//$NON-NLS-1$ if ( type.equalsIgnoreCase( "SYSTEM TABLE" ) ) continue; // String SchemaName = // tablesRs.getString("TABLE_SCHEM");//$NON-NLS-1$ int dbType = DbObject.TABLE_TYPE; if ( type.equalsIgnoreCase( "TABLE" ) ) { image = tableImage; dbType = DbObject.TABLE_TYPE; } else if ( type.equalsIgnoreCase( "VIEW" ) ) { image = viewImage; dbType = DbObject.VIEW_TYPE; } DbObject dbObject = new DbObject( tableName, tableName, dbType, image ); tableList.add( dbObject ); } } if ( needToCreateProcedureNode( dbtype, procedureRs )) { String fullyQualifiedTableName = "STORED PROCEDURES"; DbObject dbObject = new DbObject( fullyQualifiedTableName,"STORED PROCEDURES", DbObject.PROCEDURE_TYPE, tableImage); tableList.add( dbObject ); } TreeItem item[] = Utility.createTreeItems(rootNode, tableList, SWT.NONE, null); //expand table TreeItem if( item != null && item.length > 0) availableDbObjectsTree.showItem(item[0]); // Add listener to display the column names when expanded } catch(Exception e) { e.printStackTrace(); } } // Add a listener for fetching columns addFetchColumnListener(); } | 15160 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/15160/50ccb69cdfcd826c2ba287250f1839aa444eaf75/SQLDataSetEditorPage.java/clean/data/org.eclipse.birt.report.data.oda.jdbc.ui/src/org/eclipse/birt/report/data/oda/jdbc/ui/editors/SQLDataSetEditorPage.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
918,
6490,
1388,
682,
1435,
202,
95,
1082,
368,
3581,
777,
326,
2062,
2325,
434,
326,
1365,
2029,
202,
202,
430,
261,
10181,
480,
446,
262,
202,
202,
95,
1082,
202,
5699,
433... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
918,
6490,
1388,
682,
1435,
202,
95,
1082,
368,
3581,
777,
326,
2062,
2325,
434,
326,
1365,
2029,
202,
202,
430,
261,
10181,
480,
446,
262,
202,
202,
95,
1082,
202,
5699,
433... |
public org.quickfix.field.NoPartyIDs getNoPartyIDs() throws FieldNotFound { org.quickfix.field.NoPartyIDs value = new org.quickfix.field.NoPartyIDs(); | public quickfix.field.NoPartyIDs getNoPartyIDs() throws FieldNotFound { quickfix.field.NoPartyIDs value = new quickfix.field.NoPartyIDs(); | public org.quickfix.field.NoPartyIDs getNoPartyIDs() throws FieldNotFound { org.quickfix.field.NoPartyIDs value = new org.quickfix.field.NoPartyIDs(); getField(value); return value; } | 5926 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5926/fecc27f98261270772ff182a1d4dfd94b5daa73d/QuoteStatusReport.java/clean/src/java/src/quickfix/fix44/QuoteStatusReport.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
1071,
2358,
18,
19525,
904,
18,
1518,
18,
2279,
17619,
5103,
336,
2279,
17619,
5103,
1435,
1216,
2286,
2768,
225,
288,
2358,
18,
19525,
904,
18,
1518,
18,
2279,
17619,
5103,
460,
273,
394... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
1071,
2358,
18,
19525,
904,
18,
1518,
18,
2279,
17619,
5103,
336,
2279,
17619,
5103,
1435,
1216,
2286,
2768,
225,
288,
2358,
18,
19525,
904,
18,
1518,
18,
2279,
17619,
5103,
460,
273,
394... |
Object data = item.getData(); if (data != null) { unmapElement(data, item); } | Object data = item.getData(); if (data != null) { unmapElement(data, item); } | protected void doUpdateItem(Widget widget, Object element, boolean fullMap) { if (widget instanceof TableItem) { final TableItem item = (TableItem) widget; // remember element we are showing if (fullMap) { associate(element, item); } else { Object data = item.getData(); if (data != null) { unmapElement(data, item); } item.setData(element); mapElement(element, item); } IBaseLabelProvider prov = getLabelProvider(); ITableLabelProvider tprov = null; ILabelProvider lprov = null; IViewerLabelProvider vprov = null; if(prov instanceof ILabelProvider) { lprov = (ILabelProvider) prov; } if (prov instanceof IViewerLabelProvider) { vprov = (IViewerLabelProvider) prov; } if (prov instanceof ITableLabelProvider) { tprov = (ITableLabelProvider) prov; } int columnCount = table.getColumnCount(); TableItem ti = item; getColorAndFontCollector().setFontsAndColors(element); // Also enter loop if no columns added. See 1G9WWGZ: JFUIF:WINNT - // TableViewer with 0 columns does not work for (int column = 0; column < columnCount || column == 0; column++) { // Similar code in TreeViewer.doUpdateItem() String text = "";//$NON-NLS-1$ Image image = null; tableColorAndFont.setFontsAndColors(ti,element,column); if (tprov == null) { if (column == 0) { ViewerLabel updateLabel = new ViewerLabel(item .getText(), item.getImage()); if(vprov != null) { buildLabel(updateLabel,element,vprov); } else{ if(lprov != null) { buildLabel(updateLabel,element,lprov); } } // As it is possible for user code to run the event //loop check here. if (item.isDisposed()) { unmapElement(element, item); return; } text = updateLabel.getText(); image = updateLabel.getImage(); } } else { text = tprov.getColumnText(element, column); image = tprov.getColumnImage(element, column); } //Avoid setting text to null if (text == null) { text = ""; //$NON-NLS-1$ } ti.setText(column, text); if (ti.getImage(column) != image) { ti.setImage(column, image); } } getColorAndFontCollector().applyFontsAndColors(ti); } } | 55805 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/55805/72b02dfa9a75652d45af68d329d447e0e8bbe40d/TableViewer.java/buggy/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewer.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
918,
741,
1891,
1180,
12,
4609,
3604,
16,
1033,
930,
16,
1250,
1983,
863,
13,
288,
202,
202,
430,
261,
6587,
1276,
3555,
1180,
13,
288,
1082,
202,
6385,
3555,
1180,
761,
273,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
918,
741,
1891,
1180,
12,
4609,
3604,
16,
1033,
930,
16,
1250,
1983,
863,
13,
288,
202,
202,
430,
261,
6587,
1276,
3555,
1180,
13,
288,
1082,
202,
6385,
3555,
1180,
761,
273,... |
if (inFunction && ((OptFunctionNode)scriptOrFn).containsCalls(-1)) { if (((OptFunctionNode)scriptOrFn).containsCalls(0)) { | if (inFunction) { if (fnCurrent.itsContainsCalls0) { | generatePrologue(Context cx, boolean inFunction, int directParameterCount) { funObjLocal = reserveWordLocal(0); contextLocal = reserveWordLocal(1); variableObjectLocal = reserveWordLocal(2); thisObjLocal = reserveWordLocal(3); if (inFunction && !itsUseDynamicScope && directParameterCount == -1) { // Unless we're either using dynamic scope or we're in a // direct call, use the enclosing scope of the function as our // variable object. aload(funObjLocal); classFile.add(ByteCode.INVOKEINTERFACE, "org/mozilla/javascript/Scriptable", "getParentScope", "()", "Lorg/mozilla/javascript/Scriptable;"); astore(variableObjectLocal); } if (directParameterCount > 0) { for (int i = 0; i < (3 * directParameterCount); i++) reserveWordLocal(i + 4); // reserve 'args' } // reserve 'args[]' argsLocal = reserveWordLocal(directParameterCount <= 0 ? 4 : (3 * directParameterCount) + 4); // These locals are to be pre-allocated since they need function scope. // They are primarily used by the exception handling mechanism int localCount = scriptOrFn.getLocalCount(); if (localCount != 0) { itsLocalAllocationBase = (short)(argsLocal + 1); for (int i = 0; i < localCount; i++) { reserveWordLocal(itsLocalAllocationBase + i); } } if (inFunction && ((OptFunctionNode)scriptOrFn).getCheckThis()) { // Nested functions must check their 'this' value to // insure it is not an activation object: // see 10.1.6 Activation Object aload(thisObjLocal); addScriptRuntimeInvoke("getThis", "(Lorg/mozilla/javascript/Scriptable;)", "Lorg/mozilla/javascript/Scriptable;"); astore(thisObjLocal); } hasVarsInRegs = inFunction && !((OptFunctionNode)scriptOrFn).requiresActivation(); if (hasVarsInRegs) { // No need to create activation. Pad arguments if need be. int parmCount = scriptOrFn.getParamCount(); if (inFunction && parmCount > 0 && directParameterCount < 0) { // Set up args array // check length of arguments, pad if need be aload(argsLocal); addByteCode(ByteCode.ARRAYLENGTH); push(parmCount); int label = acquireLabel(); addByteCode(ByteCode.IF_ICMPGE, label); aload(argsLocal); push(parmCount); addScriptRuntimeInvoke("padArguments", "([Ljava/lang/Object;I)", "[Ljava/lang/Object;"); astore(argsLocal); markLabel(label); } // REMIND - only need to initialize the vars that don't get a value // before the next call and are used in the function short firstUndefVar = -1; for (int i = 0; i < fnCurrent.getVarCount(); i++) { OptLocalVariable lVar = fnCurrent.getVar(i); if (lVar.isNumber()) { lVar.assignJRegister(getNewWordPairLocal()); push(0.0); dstore(lVar.getJRegister()); } else if (lVar.isParameter()) { if (directParameterCount < 0) { lVar.assignJRegister(getNewWordLocal()); aload(argsLocal); push(i); addByteCode(ByteCode.AALOAD); astore(lVar.getJRegister()); } } else { lVar.assignJRegister(getNewWordLocal()); if (firstUndefVar == -1) { pushUndefined(); firstUndefVar = lVar.getJRegister(); } else { aload(firstUndefVar); } astore(lVar.getJRegister()); } lVar.setStartPC(classFile.getCurrentCodeOffset()); } // Indicate that we should generate debug information for // the variable table. (If we're generating debug info at // all.) debugVars = fnCurrent.getVarsArray(); // Skip creating activation object. return; } if (directParameterCount > 0) { // We're going to create an activation object, so we // need to get an args array with all the arguments in it. aload(argsLocal); push(directParameterCount); addOptRuntimeInvoke("padStart", "([Ljava/lang/Object;I)", "[Ljava/lang/Object;"); astore(argsLocal); for (int i=0; i < directParameterCount; i++) { aload(argsLocal); push(i); // "3" is 1 for Object parm and 2 for double parm, and // "4" is to account for the context, etc. parms aload((short) (3*i+4)); addByteCode(ByteCode.AASTORE); } } String debugVariableName; if (inFunction) { aload(contextLocal); aload(variableObjectLocal); aload(funObjLocal); aload(thisObjLocal); aload(argsLocal); addScriptRuntimeInvoke("initVarObj", "(Lorg/mozilla/javascript/Context;" + "Lorg/mozilla/javascript/Scriptable;" + "Lorg/mozilla/javascript/NativeFunction;" + "Lorg/mozilla/javascript/Scriptable;" + "[Ljava/lang/Object;)", "Lorg/mozilla/javascript/Scriptable;"); debugVariableName = "activation"; } else { aload(contextLocal); aload(variableObjectLocal); aload(funObjLocal); aload(thisObjLocal); push(0); addScriptRuntimeInvoke("initScript", "(Lorg/mozilla/javascript/Context;" + "Lorg/mozilla/javascript/Scriptable;" + "Lorg/mozilla/javascript/NativeFunction;" + "Lorg/mozilla/javascript/Scriptable;Z)", "Lorg/mozilla/javascript/Scriptable;"); debugVariableName = "global"; } astore(variableObjectLocal); int functionCount = scriptOrFn.getFunctionCount(); for (int i = 0; i != functionCount; i++) { OptFunctionNode fn = (OptFunctionNode)scriptOrFn.getFunctionNode(i); if (fn.getFunctionType() == FunctionNode.FUNCTION_STATEMENT) { visitFunction(fn, FunctionNode.FUNCTION_STATEMENT); addByteCode(ByteCode.POP); } } // default is to generate debug info if (!cx.isGeneratingDebugChanged() || cx.isGeneratingDebug()) { OptLocalVariable lv = new OptLocalVariable(debugVariableName, false); lv.assignJRegister(variableObjectLocal); lv.setStartPC(classFile.getCurrentCodeOffset()); debugVars = new OptLocalVariable[1]; debugVars[0] = lv; } if (!inFunction) { // OPT: use dataflow to prove that this assignment is dead scriptResultLocal = getNewWordLocal(); pushUndefined(); astore(scriptResultLocal); } if (inFunction && ((OptFunctionNode)scriptOrFn).containsCalls(-1)) { if (((OptFunctionNode)scriptOrFn).containsCalls(0)) { itsZeroArgArray = getNewWordLocal(); classFile.add(ByteCode.GETSTATIC, "org/mozilla/javascript/ScriptRuntime", "emptyArgs", "[Ljava/lang/Object;"); astore(itsZeroArgArray); } if (((OptFunctionNode)scriptOrFn).containsCalls(1)) { itsOneArgArray = getNewWordLocal(); push(1); addByteCode(ByteCode.ANEWARRAY, "java/lang/Object"); astore(itsOneArgArray); } } } | 47345 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/47345/e741d0cb339d08bcfa9cb588bcb30951ac0436be/Codegen.java/buggy/src/org/mozilla/javascript/optimizer/Codegen.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
2103,
626,
1330,
344,
12,
1042,
9494,
16,
1250,
316,
2083,
16,
509,
2657,
1662,
1380,
13,
565,
288,
3639,
9831,
2675,
2042,
273,
20501,
3944,
2042,
12,
20,
1769,
3639,
819,
2042,
273,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
2103,
626,
1330,
344,
12,
1042,
9494,
16,
1250,
316,
2083,
16,
509,
2657,
1662,
1380,
13,
565,
288,
3639,
9831,
2675,
2042,
273,
20501,
3944,
2042,
12,
20,
1769,
3639,
819,
2042,
273,
2... |
public PatternDescr lhs_and() throws RecognitionException { PatternDescr d; PatternDescr left = null; PatternDescr right = null; d = null; try { // /Users/bob/Documents/workspace/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:607:17: (left= lhs_unary ( ('and'|'&&')right= lhs_unary )* ) // /Users/bob/Documents/workspace/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:607:17: left= lhs_unary ( ('and'|'&&')right= lhs_unary )* { AndDescr and = null; following.push(FOLLOW_lhs_unary_in_lhs_and2009); left=lhs_unary(); following.pop(); d = left; // /Users/bob/Documents/workspace/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:609:17: ( ('and'|'&&')right= lhs_unary )* loop48: do { int alt48=2; int LA48_0 = input.LA(1); if ( (LA48_0>=48 && LA48_0<=49) ) { alt48=1; } switch (alt48) { case 1 : // /Users/bob/Documents/workspace/jbossrules/drools-compiler/src/main/resources/org/drools/lang/drl.g:609:25: ('and'|'&&')right= lhs_unary { if ( (input.LA(1)>=48 && input.LA(1)<=49) ) { input.consume(); errorRecovery=false; } else { MismatchedSetException mse = new MismatchedSetException(null,input); recoverFromMismatchedSet(input,mse,FOLLOW_set_in_lhs_and2018); throw mse; } following.push(FOLLOW_lhs_unary_in_lhs_and2029); right=lhs_unary(); following.pop(); if ( and == null ) { and = new AndDescr(); and.addDescr( left ); d = and; } and.addDescr( right ); } break; default : break loop48; } } while (true); } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { } return d; } | 5490 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/5490/138d9a6805db25e18a7f8c70bebca33cce7b95e5/RuleParser.java/buggy/drools-compiler/src/main/java/org/drools/lang/RuleParser.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
6830,
16198,
8499,
67,
464,
1435,
1216,
9539,
288,
6647,
6830,
16198,
302,
31,
3639,
6830,
16198,
2002,
273,
446,
31,
3639,
6830,
16198,
2145,
273,
446,
31,
540,
202,
202,
72,
273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
6830,
16198,
8499,
67,
464,
1435,
1216,
9539,
288,
6647,
6830,
16198,
302,
31,
3639,
6830,
16198,
2002,
273,
446,
31,
3639,
6830,
16198,
2145,
273,
446,
31,
540,
202,
202,
72,
273,
... | ||
public Collection getSpecifications(MClassifier cls) { Collection result = new Vector(); Collection deps = cls.getClientDependencies(); Iterator depIterator = deps.iterator(); while (depIterator.hasNext()) { MDependency dep = (MDependency)depIterator.next(); if ((dep instanceof MAbstraction) && dep.getStereotype() != null && dep.getStereotype().getName() != null && dep.getStereotype().getName().equals("realize")) { MInterface i = (MInterface)dep.getSuppliers().toArray()[0]; result.add(i); } } return result; } | 7166 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/7166/614bc93888ad6a704ccb2d939583ae8f32330075/CoreHelper.java/buggy/src_new/org/argouml/model/uml/foundation/core/CoreHelper.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1071,
2532,
588,
27044,
12,
49,
13860,
6429,
15329,
2532,
2088,
33,
2704,
5018,
5621,
2532,
14877,
33,
6429,
18,
588,
1227,
8053,
5621,
3198,
15037,
3198,
33,
14877,
18,
9838,
5621,
17523,
12,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1071,
2532,
588,
27044,
12,
49,
13860,
6429,
15329,
2532,
2088,
33,
2704,
5018,
5621,
2532,
14877,
33,
6429,
18,
588,
1227,
8053,
5621,
3198,
15037,
3198,
33,
14877,
18,
9838,
5621,
17523,
12,
... | ||
this.targetStatsRecorder.recordChannelDefinitionPublished(person, channelDef); | this.targetStatsRecorder.recordChannelDefinitionModified(person, channelDef); | public void recordChannelDefinitionModified(IPerson person, ChannelDefinition channelDef) { if (this.flags.isRecordChannelDefinitionModified()) { if (this.targetStatsRecorder == null) { log.error("targetStatsRecorder of ConditionalStatsRecorder illegally null"); } else { this.targetStatsRecorder.recordChannelDefinitionPublished(person, channelDef); } } } | 1895 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/1895/22a25ffd6bfb369764b2cc3709e9a431fe65692f/ConditionalStatsRecorder.java/buggy/source/org/jasig/portal/services/stats/ConditionalStatsRecorder.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
1409,
2909,
1852,
4575,
12,
2579,
3565,
6175,
16,
5307,
1852,
1904,
3262,
13,
288,
3639,
309,
261,
2211,
18,
7133,
18,
291,
2115,
2909,
1852,
4575,
10756,
288,
5411,
309,
261,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
1409,
2909,
1852,
4575,
12,
2579,
3565,
6175,
16,
5307,
1852,
1904,
3262,
13,
288,
3639,
309,
261,
2211,
18,
7133,
18,
291,
2115,
2909,
1852,
4575,
10756,
288,
5411,
309,
261,
... |
((EARComponentCreationDataModel)getModel()).setProperty(EARComponentCreationDataModel.J2EE_COMPONENT_LIST, getCheckedElementsAsList()); | getDataModel().setProperty(J2EE_COMPONENT_LIST, getCheckedElementsAsList()); | private void handleSelectAllButtonPressed() { ignoreCheckedState = true; try { moduleProjectsViewer.setAllChecked(true); ((EARComponentCreationDataModel)getModel()).setProperty(EARComponentCreationDataModel.J2EE_COMPONENT_LIST, getCheckedElementsAsList()); } finally { ignoreCheckedState = false; } } | 8196 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/8196/59b6004d2898a63ab8beb09f095b3e971307dd92/EARComponentCreationSecondPage.java/clean/plugins/org.eclipse.jst.j2ee.ui/j2ee_ui/org/eclipse/jst/j2ee/internal/wizard/EARComponentCreationSecondPage.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1152,
918,
1640,
3391,
1595,
3616,
24624,
1435,
288,
202,
202,
6185,
11454,
1119,
273,
638,
31,
202,
202,
698,
288,
1082,
202,
2978,
15298,
18415,
18,
542,
1595,
11454,
12,
3767,
176... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1152,
918,
1640,
3391,
1595,
3616,
24624,
1435,
288,
202,
202,
6185,
11454,
1119,
273,
638,
31,
202,
202,
698,
288,
1082,
202,
2978,
15298,
18415,
18,
542,
1595,
11454,
12,
3767,
176... |
MetadataStore store = getMetadataStore(currentId); | MetadataStore store = getMetadataStore(currentId); | private void initMetadata() throws FormatException, IOException { in.seek(8); in.order(false); // start by reading the file header metadata.put("Byte Order", new Boolean(little)); long version = in.readInt(); metadata.put("Version", new Long(version)); short count = in.readShort(); metadata.put("Count", new Short(count)); in.readShort(); int offset = in.readInt(); // skip to first tag in.seek(offset); // read in each tag and its data for (int i=0; i<count; i++) { short tag = in.readShort(); in.readShort(); offset = in.readInt(); long fmt = in.readInt(); metadata.put("Format", new Long(fmt)); long numBytes = in.readInt(); metadata.put("NumBytes", new Long(numBytes)); if (tag == 67 || tag == 68) { boolean isOpenlab2 = in.read() == 0; metadata.put("isOpenlab2", new Boolean(isOpenlab2)); in.readShort(); short layerId = in.readShort(); metadata.put("LayerID", new Short(layerId)); short layerType = in.readShort(); metadata.put("LayerType", new Short(layerType)); short bitDepth = in.readShort(); metadata.put("BitDepth", new Short(bitDepth)); short opacity = in.readShort(); metadata.put("Opacity", new Short(opacity)); // not sure how many bytes to skip here in.skipBytes(10); long type = in.readInt(); metadata.put("ImageType", new Long(type)); // not sure how many bytes to skip in.skipBytes(10); long timestamp = in.readInt(); metadata.put("Timestamp", new Long(timestamp)); in.skipBytes(2); if (isOpenlab2) { byte[] layerName = new byte[127]; in.read(layerName); metadata.put("LayerName", new String(layerName)); long timestampMS = in.readInt(); metadata.put("Timestamp-MS", new Long(timestampMS)); in.read(); byte[] notes = new byte[118]; in.read(notes); metadata.put("Notes", new String(notes)); } else in.skipBytes(123); } else if (tag == 69) { long platform = in.readInt(); metadata.put("Platform", new Long(platform)); short units = in.readShort(); metadata.put("Units", new Short(units)); short imageId = in.readShort(); metadata.put("ID", new Short(imageId)); in.read(); double xOrigin = in.readDouble(); metadata.put("XOrigin", new Double(xOrigin)); double yOrigin = in.readDouble(); metadata.put("YOrigin", new Double(yOrigin)); double xScale = in.readDouble(); metadata.put("XScale", new Double(xScale)); double yScale = in.readDouble(); metadata.put("YScale", new Double(yScale)); in.read(); byte[] other = new byte[31]; in.read(other); metadata.put("Other", new String(other)); } // Populate metadata store // The metadata store we're working with. MetadataStore store = getMetadataStore(currentId); String type = "int8"; if (metadata.get("BitDepth") != null) { int bitDepth = ((Short) metadata.get("BitDepth")).intValue(); if (bitDepth <= 8) type = "int8"; else if (bitDepth <= 16) type = "int16"; else type = "int32"; } store.setImage(null, metadata.get("Timestamp").toString(), null, null); // FIXME: There is a loss of precision here as we are down-casting from // double to float. store.setStageLabel(null, (Float) metadata.get("XOrigin"), (Float) metadata.get("YOrigin"), null, null); // FIXME: There is a loss of precision here as we are down-casting from // double to float. store.setDimensions((Float) metadata.get("XScale"), (Float) metadata.get("YScale"), null, null, null, null); in.seek(offset); // We need to poke at least one plane so that we can get "sizeX" and // "sizeY" set. to populate the pixels set. try { firstPlane = openImage(currentId, 0); } catch (FormatException e) { e.printStackTrace(); } store.setPixels(sizeX, sizeY, new Integer(numBlocks), new Integer(getSizeC(currentId)), new Integer(1), type, new Boolean(!little), "XYCZT", null); } } | 11426 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/11426/c86a7e44b81ae903184383e3c29a293a7b5253ed/OpenlabReader.java/buggy/loci/formats/in/OpenlabReader.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
3238,
918,
1208,
2277,
1435,
1216,
4077,
503,
16,
1860,
288,
565,
316,
18,
16508,
12,
28,
1769,
565,
316,
18,
1019,
12,
5743,
1769,
565,
368,
787,
635,
6453,
326,
585,
1446,
565,
1982,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
282,
3238,
918,
1208,
2277,
1435,
1216,
4077,
503,
16,
1860,
288,
565,
316,
18,
16508,
12,
28,
1769,
565,
316,
18,
1019,
12,
5743,
1769,
565,
368,
787,
635,
6453,
326,
585,
1446,
565,
1982,
... |
if (logger.isDebugEnabled()) { logger.debug("Heart-beat sent"); } | logger.debug("Heart-beat sent"); | public void runActivity(Body body) { Service service = new Service(body); while (body.isActive()) { try { if (this.groupOfAcquaintances.size() > 0) { // Register the local P2P service in all exportAcquaintances if (logger.isDebugEnabled()) { logger.debug("Sending heart-beat"); } this.acquaintances.heartBeat(); if (logger.isDebugEnabled()) { logger.debug("Heart-beat sent"); } // How many peers ? if (this.groupOfAcquaintances.size() < NOA) { // Looking for new peers if (logger.isDebugEnabled()) { logger.debug("NOA is " + NOA + " - Size of P2PAcquaintanceManager is " + this.groupOfAcquaintances.size()); } // Sending exploring message this.acquaintances.exploring(TTL, null, this.localService); if (logger.isDebugEnabled()) { logger.debug("Explorating message sent"); } } } // Waiting TTU & serving requests if (logger.isDebugEnabled()) { logger.debug("Waiting for " + TTU + "ms"); } long endTime = System.currentTimeMillis() + TTU; service.blockingServeOldest(TTU); while (System.currentTimeMillis() < endTime) { service.blockingServeOldest(endTime - System.currentTimeMillis()); } if (logger.isDebugEnabled()) { logger.debug("End waiting"); } } catch (ExceptionList e) { // Removing bad peers if (logger.isDebugEnabled()) { logger.debug("Some peers to remove from group"); } Iterator it = e.iterator(); while (it.hasNext()) { // Remove bad peers ExceptionInGroup ex = (ExceptionInGroup) it.next(); Object peer = ex.getObject(); this.groupOfAcquaintances.remove(peer); if (logger.isInfoEnabled()) { logger.info("Peer removed"); } } } } } | 50951 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50951/1279458d52679339839158611daec34b4baf800a/P2PAcquaintanceManager.java/buggy/src/org/objectweb/proactive/p2p/service/P2PAcquaintanceManager.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
1086,
6193,
12,
2250,
1417,
13,
288,
3639,
1956,
1156,
273,
394,
1956,
12,
3432,
1769,
3639,
1323,
261,
3432,
18,
291,
3896,
10756,
288,
5411,
775,
288,
7734,
309,
261,
2211,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
1071,
918,
1086,
6193,
12,
2250,
1417,
13,
288,
3639,
1956,
1156,
273,
394,
1956,
12,
3432,
1769,
3639,
1323,
261,
3432,
18,
291,
3896,
10756,
288,
5411,
775,
288,
7734,
309,
261,
2211,
... |
_database.length()) ); | _database.length())); | private void send70Login(String _database) throws java.io.IOException, TdsException { String libName = this.progName; byte pad = (byte) 0; byte[] empty = new byte[0]; String appName = this.appName; String clientName = getClientName(); //mdb boolean ntlmAuth = (domain.length() > 0); //mdb:begin-change short packSize = (short)( 86 + 2 * (clientName.length() + appName.length() + serverName.length() + libName.length() + _database.length()) ); short authLen = 0; //NOTE(mdb): ntlm includes auth block; sql auth includes uname and pwd. if( ntlmAuth ) { authLen = (short)(32 + domain.length()); packSize += authLen; } else { authLen = 0; packSize += (2*(user.length()+password.length())); } //mdb:end-change comm.startPacket(TdsComm.LOGON70); comm.appendTdsInt(packSize); // TDS version comm.appendTdsInt(0x70000000); // Magic! comm.appendBytes(empty, 16, pad); comm.appendByte((byte)0xE0); //mdb: this byte controls what kind of auth we do. if( ntlmAuth ) comm.appendByte((byte)0x83); else comm.appendByte((byte)0x03); comm.appendBytes(empty, 10, pad); // Pack up value lengths, positions. short curPos = 86; // Hostname comm.appendTdsShort(curPos); comm.appendTdsShort((short) clientName.length()); curPos += clientName.length() * 2; //mdb: NTLM doesn't send username and password... if( ! ntlmAuth ) { // Username comm.appendTdsShort(curPos); comm.appendTdsShort((short) user.length()); curPos += user.length() * 2; // Password comm.appendTdsShort(curPos); comm.appendTdsShort((short) password.length()); curPos += password.length() * 2; } else { comm.appendTdsShort(curPos); comm.appendTdsShort((short) 0); comm.appendTdsShort(curPos); comm.appendTdsShort((short) 0); } // App name comm.appendTdsShort(curPos); comm.appendTdsShort((short) appName.length()); curPos += appName.length() * 2; // Server name comm.appendTdsShort(curPos); comm.appendTdsShort((short) serverName.length()); curPos += serverName.length() * 2; // Unknown comm.appendTdsShort((short) 0); comm.appendTdsShort((short) 0); // Library name comm.appendTdsShort(curPos); comm.appendTdsShort((short) libName.length()); curPos += libName.length() * 2; // Another unknown value // mdb: this is the "language" comm.appendTdsShort(curPos); comm.appendTdsShort((short) 0); // Database comm.appendTdsShort(curPos); comm.appendTdsShort((short) _database.length()); curPos += _database.length() * 2; // MAC address comm.appendBytes(empty, 6, pad); //mdb: location of ntlm auth block. note that for sql auth, authLen==0. comm.appendTdsShort(curPos); comm.appendTdsShort(authLen); //"next position" (same as total packet size) comm.appendTdsInt(packSize); comm.appendChars(clientName); // Pack up the login values. //mdb: for ntlm auth, uname and pwd aren't sent up... if( ! ntlmAuth ) { String scrambledPw = tds7CryptPass(password); comm.appendChars(user); comm.appendChars(scrambledPw); } comm.appendChars(appName); comm.appendChars(serverName); comm.appendChars(libName); comm.appendChars(_database); //mdb: add the ntlm auth info... if( ntlmAuth ) { // host and domain name are _narrow_ strings. byte[] domainBytes = domain.getBytes("UTF8"); //byte[] hostBytes = localhostname.getBytes("UTF8"); byte[] header = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00 }; comm.appendBytes( header ); //header is ascii "NTLMSSP\0" comm.appendTdsInt(1); //sequence number = 1 comm.appendTdsInt(0xb201); //flags (???) //domain info comm.appendTdsShort( (short)domainBytes.length ); comm.appendTdsShort( (short)domainBytes.length ); comm.appendTdsInt(32); //offset, relative to start of auth block. //host info //NOTE(mdb): not sending host info; hope this is ok! comm.appendTdsShort( (short)0 ); comm.appendTdsShort( (short)0 ); comm.appendTdsInt(32); //offset, relative to start of auth block. // add the variable length data at the end... comm.appendBytes( domainBytes ); } } | 439 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/439/082f6b97f424e9550bf490d66efbe1c288b8df9b/Tds.java/clean/trunk/jtds/src/main/net/sourceforge/jtds/jdbc/Tds.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
918,
1366,
7301,
5358,
12,
780,
389,
6231,
13,
3639,
1216,
2252,
18,
1594,
18,
14106,
16,
399,
2377,
503,
565,
288,
3639,
514,
2561,
461,
273,
333,
18,
14654,
461,
31,
3639,
1160,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
377,
3238,
918,
1366,
7301,
5358,
12,
780,
389,
6231,
13,
3639,
1216,
2252,
18,
1594,
18,
14106,
16,
399,
2377,
503,
565,
288,
3639,
514,
2561,
461,
273,
333,
18,
14654,
461,
31,
3639,
1160,... |
encoding = FORMAT_UTF_16LE; } | encoding = FORMAT_UTF_16LE; } | public void parse(boolean NS) throws EncodingException, EOFException, EntityException, ParseException { // define internal variables ns = NS; int temp_offset = 0, length1 = 0, length2 = 0, increment = 1; int depth = -1, attr_count = 0, ch = 0, ch_temp = 0; int prev_ch = 0, prev2_ch = 0, parser_state = STATE_DOC_START; //boolean has_amp = false; boolean is_ns = false; encoding = FORMAT_UTF8; boolean main_loop = true, hasDTD = false, hasDecl = false, docEnd = false, firstLT = true; //char char_temp; //holds the ' or " indicating start of attr val boolean must_utf_8 = false; boolean BOM_detected = false; //long[] tag_stack = new long[256]; //long[] attr_name_array = new long[512]; // 512 attributes limit //ASCII UTF-8 UTF-16 UTF-16BE UTF-16LE ISO-8859-1 // //int[] scratch_buffer = new int[10]; // first check first several bytes to figure out the encoding if (XMLDoc[offset] == -2) { increment = 2; if (XMLDoc[offset + 1] == -1) { offset += 2; encoding = FORMAT_UTF_16BE; BOM_detected = true; //r = new UTF16BEReader(); } else throw new EncodingException("Unknown Character encoding: should be 0xff 0xfe"); } else if (XMLDoc[offset] == -1) { increment = 2; if (XMLDoc[offset + 1] == -2) { offset += 2; encoding = FORMAT_UTF_16LE; BOM_detected = true; //r = new UTF16LEReader(); } else throw new EncodingException("Unknown Character encoding: should be 0xfe 0xff"); } else if (XMLDoc[offset] == -17){ if (XMLDoc[offset+1] == -69 && XMLDoc[offset+2]==-65){ offset +=3; must_utf_8= true; } else throw new EncodingException("Unknown Character encoding: not UTF-8"); } else if (XMLDoc[offset]==0){ if (XMLDoc[offset+1] == 0x3c && XMLDoc[offset+2] == 0 && XMLDoc[offset+3] == 0x3f){ encoding = FORMAT_UTF_16BE; increment = 2; //r = new UTF16BEReader(); } else throw new EncodingException("Unknown Character encoding: not UTF-16BE"); } else if (XMLDoc[offset]==0x3c){ if (XMLDoc[offset+1] == 0 && XMLDoc[offset+2] == 0x3f && XMLDoc[offset+3] == 0){ increment = 2; encoding = FORMAT_UTF_16LE; //r = new UTF16LEReader(); } //else // throw new EncodingException("Unknown Character encoding: not UTF-16LE"); } // now check the size of the byte array if (encoding < FORMAT_UTF_16BE) { if ((long)(offset + docLen) >= 1L << 30) throw new ParseException("Other error: file size too large "); } else { if ((long)(offset - 2 + docLen) >= 1L << 31) throw new ParseException("Other error: file size too large "); } // enter the main finite state machine try { while (main_loop) { switch (parser_state) { case STATE_DOC_START : if (getChar() == '<') { temp_offset = offset; // xml decl has to be right after the start of the document if (skipChar('?') && (skipChar('x') || skipChar('X')) && (skipChar('m') || skipChar('M')) && (skipChar('l') || skipChar('L'))) { if (skipChar(' ') || skipChar('\t') || skipChar('\n') || skipChar('\r')) { ch = getCharAfterS(); temp_offset = offset; parser_state = STATE_DEC_ATTR_NAME; break; } else if (skipChar('?')) throw new ParseException( "Error in XML decl: premature ending" + formatLineNumber()); } offset = temp_offset; parser_state = STATE_LT_SEEN; break; } throw new ParseException( "Other Error: XML not starting properly" + formatLineNumber()); case STATE_DOC_END : docEnd = true; ch = getCharAfterS(); // eof exception should be thrown here for premature ending if (ch == '<') { if (skipChar('?')) { // processing instruction after end tag of root element temp_offset = offset; parser_state = STATE_END_PI; break; } else if ( skipChar('!') && skipChar('-') && skipChar('-')) { // comments allowed after the end tag of the root element temp_offset = offset; parser_state = STATE_END_COMMENT; break; } } throw new ParseException( "Other Error: XML not terminated properly" + formatLineNumber()); case STATE_LT_SEEN : //if (depth < -1) // throw new ParseException("Other Errors: Invalid depth"); temp_offset = offset; ch = getChar(); if (XMLChar.isNameStartChar(ch)) { //temp_offset = offset; //length1++; depth++; //if (ch == ':') // length2 = 0; parser_state = STATE_START_TAG; } else { switch (ch) { case '/' : parser_state = STATE_END_TAG; break; case '?' : temp_offset = offset; ch = getChar(); if (XMLChar.isNameStartChar(ch)) { //temp_offset = offset; if ((ch == 'x' || ch == 'X') && (skipChar('m') || skipChar('M')) && (skipChar('l') || skipChar('L'))) { ch = getChar(); if (ch == '?' || XMLChar.isSpaceChar(ch)) throw new ParseException( "Error in PI: [xX][mM][lL] not a valid PI targetname" + formatLineNumber()); offset = getPrevOffset(); } parser_state = STATE_PI_TAG; break; } throw new ParseException( "Other Error: First char after <? invalid" + formatLineNumber()); case '!' : // three possibility (comment, CDATA, DOCTYPE) ch = getChar(); switch (ch) { case '-' : if (skipChar('-')) { temp_offset = offset; parser_state = STATE_COMMENT; break; } else throw new ParseException( "Error in comment: Invalid char sequence to start a comment" + formatLineNumber()); case '[' : if (skipChar('C') && skipChar('D') && skipChar('A') && skipChar('T') && skipChar('A') && skipChar('[') && (depth != -1)) { temp_offset = offset; parser_state = STATE_CDATA; break; } else { if (depth == -1) throw new ParseException( "Error in CDATA: Wrong place for CDATA" + formatLineNumber()); throw new ParseException( "Error in CDATA: Invalid char sequence for CDATA" + formatLineNumber()); } case 'D' : if (skipChar('O') && skipChar('C') && skipChar('T') && skipChar('Y') && skipChar('P') && skipChar('E') && (depth == -1) && !hasDTD) { hasDTD = true; temp_offset = offset; parser_state = STATE_DOCTYPE; break; } else { if (hasDTD == true) throw new ParseException( "Error for DOCTYPE: Only DOCTYPE allowed" + formatLineNumber()); if (depth != -1) throw new ParseException( "Error for DOCTYPE: DTD at wrong place" + formatLineNumber()); throw new ParseException( "Error for DOCTYPE: Invalid char sequence for DOCTYPE" + formatLineNumber()); } default : throw new ParseException( "Other Error: Unrecognized char after <!" + formatLineNumber()); } break; default : throw new ParseException( "Other Error: Invalid char after <" + formatLineNumber()); } } break; case STATE_START_TAG : //name space is handled by while (true) { ch = getChar(); //System.out.println(""+(char)ch); if (XMLChar.isNameChar(ch)) { if (ch == ':') { length2 = offset - temp_offset - increment; } } else break; } length1 = offset - temp_offset - increment; //writeVTD(offset, TOKEN_STARTING_TAG, length2:length1, depth) long x = ((long) length1 << 32) + temp_offset; tag_stack[depth] = x; if (depth > MAX_DEPTH) { throw new ParseException( "Other Error: Depth exceeds MAX_DEPTH" + formatLineNumber()); } // System.out.println( // " " + (temp_offset) + " " + length2 + ":" + length1 + " startingTag " + depth); if (depth > VTDDepth) VTDDepth = depth; if (encoding < FORMAT_UTF_16BE){ if (length2>MAX_PREFIX_LENGTH || length1 > MAX_QNAME_LENGTH) throw new ParseException( "Token Length Error: Starting tag prefix or qname length too long" +formatLineNumber()); writeVTD( (temp_offset), (length2 << 11) | length1, TOKEN_STARTING_TAG, depth); } else{ if (length2>(MAX_PREFIX_LENGTH <<1) || length1 > (MAX_QNAME_LENGTH<<1)) throw new ParseException( "Token Length Error: Starting tag prefix or qname length too long" +formatLineNumber()); writeVTD( (temp_offset) >> 1, (length2 << 10) | (length1 >> 1), TOKEN_STARTING_TAG, depth); } //offset += length1; length2 = 0; if (XMLChar.isSpaceChar(ch)) { ch = getCharAfterS(); if (XMLChar.isNameStartChar(ch)) { // seen an attribute here temp_offset = getPrevOffset(); parser_state = STATE_ATTR_NAME; break; } } if (ch == '/') { depth--; ch = getChar(); } if (ch == '>') { if (depth != -1) { temp_offset = offset; ch = getCharAfterSe(); // consume WSs if (ch == '<') { parser_state = STATE_LT_SEEN; if (skipChar('/')) { length1 = offset - temp_offset - 2 * increment; if (length1 > 0) { if (encoding < FORMAT_UTF_16BE) writeVTD( (temp_offset), length1, TOKEN_CHARACTER_DATA, depth); else writeVTD( (temp_offset) >> 1, (length1 >> 1), TOKEN_CHARACTER_DATA, depth); } //offset += length1; parser_state = STATE_END_TAG; break; } } else if (XMLChar.isContentChar(ch)) { //temp_offset = offset; parser_state = STATE_TEXT; } else if (ch == '&') { //has_amp = true; //temp_offset = offset; entityIdentifier(); parser_state = STATE_TEXT; } else throw new ParseException( "Error in text content: Invalid char" + formatLineNumber()); } else { parser_state = STATE_DOC_END; } break; } throw new ParseException( "Starting tag Error: Invalid char in starting tag" + formatLineNumber()); case STATE_END_TAG : temp_offset = offset; while (true) { ch = getChar(); //System.out.println(""+(char)ch); if (!XMLChar.isNameChar(ch)) { break; } } length1 = offset - temp_offset - increment; int sos = (int) tag_stack[depth]; int sl = (int) (tag_stack[depth] >> 32); if (sl == length1) { for (int i = 0; i < length1; i++) { if (XMLDoc[sos + i] != XMLDoc[temp_offset + i]) throw new ParseException( "Ending tag error: Start/ending tag mismatch" + formatLineNumber());// System.out.println(// " " + (char) XMLDoc[sos + i] + "<==> " + (char) XMLDoc[temp_offset + i]); } } else throw new ParseException( "Ending tag error: Start/ending tag mismatch, length different" + formatLineNumber()); //System.out.println(" " + temp_offset + " " + length1 + " ending tag " + depth); //writeVTD(temp_offset, length1, TOKEN_ENDING_TAG, depth); depth--; if (XMLChar.isSpaceChar(ch)) { ch = getCharAfterS(); } if (ch == '>') { if (depth != -1) { temp_offset = offset; ch = getCharAfterS(); if (ch == '<') parser_state = STATE_LT_SEEN; else if (XMLChar.isContentChar(ch)) { parser_state = STATE_TEXT; } else if (ch == '&') { //has_amp = true; entityIdentifier(); parser_state = STATE_TEXT; } else throw new ParseException( "Other Error: Invalid char in xml" + formatLineNumber()); } else parser_state = STATE_DOC_END; break; } else throw new ParseException( "Other Error: Invalid char in ending tag" + formatLineNumber()); case STATE_UNRECORDED_TEXT : break; case STATE_PI_TAG : while (true) { ch = getChar(); if (!XMLChar.isNameChar(ch)) break; } length1 = offset - temp_offset - increment; /*System.out.println( ((char) XMLDoc[temp_offset]) + " " + (temp_offset) + " " + length1 + " PI Target " + depth); */ if (encoding < FORMAT_UTF_16BE){ if (length1 > MAX_TOKEN_LENGTH) throw new ParseException("Token Length Error:" +"PI name too long (>0xfffff)" + formatLineNumber()); writeVTD( (temp_offset), length1, TOKEN_PI_NAME, depth); } else{ if(length1 > (MAX_TOKEN_LENGTH<<1)) throw new ParseException("Token Length Error:"+ "PI name too long (>0xfffff)"+ formatLineNumber()); writeVTD( (temp_offset) >> 1, (length1 >> 1), TOKEN_PI_NAME, depth); } //length1 = 0; temp_offset = offset; if (XMLChar.isSpaceChar(ch)) { ch = getChar(); } if (ch == '?') { if (skipChar('>')) { temp_offset = offset; ch = getCharAfterSe(); if (ch == '<') { parser_state = STATE_LT_SEEN; } else if (XMLChar.isContentChar(ch)) { parser_state = STATE_TEXT; } else if (ch == '&') { //has_amp = true; entityIdentifier(); parser_state = STATE_TEXT; } else throw new ParseException( "Error in text content: Invalid char" + formatLineNumber()); break; } else throw new ParseException( "Error in PI: invalid termination sequence" + formatLineNumber()); } parser_state = STATE_PI_VAL; break; //throw new ParseException("Error in PI: Invalid char"); case STATE_PI_VAL : //temp_offset = offset; while (true) { if (XMLChar.isValidChar(ch)) { //System.out.println(""+(char)ch); if (ch == '?') if (skipChar('>')) { break; } else throw new ParseException( "Error in PI: invalid termination sequence for PI" + formatLineNumber()); } else throw new ParseException( "Errors in PI: Invalid char in PI val" + formatLineNumber()); ch = getChar(); } length1 = offset - temp_offset - 2 * increment; /*System.out.println( ((char) XMLDoc[temp_offset]) + " " + (temp_offset) + " " + length1 + " PI val " + depth);*/ if (encoding < FORMAT_UTF_16BE){ if (length1 > MAX_TOKEN_LENGTH) throw new ParseException("Token Length Error:" +"PI VAL too long (>0xfffff)" + formatLineNumber()); writeVTD(temp_offset, length1, TOKEN_PI_VAL, depth); } else{ if (length1 > (MAX_TOKEN_LENGTH<<1)) throw new ParseException("Token Length Error:" +"PI VAL too long (>0xfffff)" + formatLineNumber()); writeVTD( temp_offset >> 1, length1 >> 1, TOKEN_PI_VAL, depth); } //length1 = 0; temp_offset = offset; ch = getCharAfterSe(); if (ch == '<') { parser_state = STATE_LT_SEEN; } else if (XMLChar.isContentChar(ch)) { //temp_offset = offset; parser_state = STATE_TEXT; } else if (ch == '&') { //has_amp = true; //temp_offset = offset; entityIdentifier(); parser_state = STATE_TEXT; } else throw new ParseException( "Error in text content: Invalid char" + formatLineNumber()); break; case STATE_DEC_ATTR_NAME : if (ch == 'v' && skipChar('e') && skipChar('r') && skipChar('s') && skipChar('i') && skipChar('o') && skipChar('n')) { ch = getCharAfterS(); if (ch == '=') { /*System.out.println( " " + (temp_offset - 1) + " " + 7 + " dec attr name version " + depth);*/ if (encoding < FORMAT_UTF_16BE){ writeVTD( temp_offset - 1, 7, TOKEN_DEC_ATTR_NAME, depth); } else{ writeVTD( (temp_offset -2) >> 1, 7, TOKEN_DEC_ATTR_NAME, depth); } } else throw new ParseException( "XML decl error: Invalid char" + formatLineNumber()); } else throw new ParseException( "XML decl error: should be version" + formatLineNumber()); ch_temp = getCharAfterS(); if (ch_temp != '\'' && ch_temp != '"') throw new ParseException( "XML decl error: Invalid char to start attr name" + formatLineNumber()); temp_offset = offset; // support 1.0 or 1.1 if (skipChar('1') && skipChar('.') && (skipChar('0') || skipChar('1'))) { /*System.out.println( " " + temp_offset + " " + 3 + " dec attr val (version)" + depth);*/ if (encoding < FORMAT_UTF_16BE){ writeVTD( temp_offset, 3, TOKEN_DEC_ATTR_VAL, depth); } else{ writeVTD( temp_offset >> 1, 3, TOKEN_DEC_ATTR_VAL, depth); } } else throw new ParseException( "XML decl error: Invalid version(other than 1.0 or 1.1) detected" + formatLineNumber()); if (!skipChar(ch_temp)) throw new ParseException( "XML decl error: version not terminated properly" + formatLineNumber()); ch = getChar(); //? space or e if (XMLChar.isSpaceChar(ch)) { ch = getCharAfterS(); temp_offset = offset - increment; if (ch == 'e') { if (skipChar('n') && skipChar('c') && skipChar('o') && skipChar('d') && skipChar('i') && skipChar('n') && skipChar('g')) { ch = getChar(); if (XMLChar.isSpaceChar(ch)) ch = getCharAfterS(); if (ch == '=') { /*System.out.println( " " + (temp_offset) + " " + 8 + " dec attr name (encoding) " + depth);*/ if (encoding < FORMAT_UTF_16BE){ writeVTD( temp_offset, 8, TOKEN_DEC_ATTR_NAME, depth); } else { writeVTD( temp_offset >> 1, 8, TOKEN_DEC_ATTR_NAME, depth); } } else throw new ParseException( "XML decl error: Invalid char" + formatLineNumber()); ch_temp = getCharAfterS(); if (ch_temp != '"' && ch_temp != '\'') throw new ParseException( "XML decl error: Invalid char to start attr name" + formatLineNumber()); temp_offset = offset; ch = getChar(); switch (ch) { case 'a' : case 'A' : if ((skipChar('s') || skipChar('S')) && (skipChar('c') || skipChar('C')) && (skipChar('i') || skipChar('I')) && (skipChar('i') || skipChar('I')) && skipChar(ch_temp)) { if (encoding != FORMAT_UTF_16LE && encoding != FORMAT_UTF_16BE) { if (must_utf_8) throw new EncodingException("Can't switch from UTF-8" + formatLineNumber()); encoding = FORMAT_ASCII; /*System.out.println( " " + (temp_offset) + " " + 5 + " dec attr val (encoding) " + depth);*/ if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, 5, TOKEN_DEC_ATTR_VAL, depth); else writeVTD( temp_offset >> 1, 5, TOKEN_DEC_ATTR_VAL, depth); break; } else throw new ParseException( "XML decl error: Can't switch encoding to ASCII" + formatLineNumber()); } throw new ParseException( "XML decl error: Invalid Encoding" + formatLineNumber()); case 'i' : case 'I' : if ((skipChar('s') || skipChar('S')) && (skipChar('o') || skipChar('O')) && skipChar('-') && skipChar('8') && skipChar('8') && skipChar('5') && skipChar('9') && skipChar('-') && skipChar('1') && skipChar(ch_temp)) { if (encoding != FORMAT_UTF_16LE && encoding != FORMAT_UTF_16BE) { if (must_utf_8) throw new EncodingException("Can't switch from UTF-8" + formatLineNumber()); encoding = FORMAT_ISO_8859; /*System.out.println( " " + (temp_offset) + " " + 10 + " dec attr val (encoding) " + depth);*/ if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, 10, TOKEN_DEC_ATTR_VAL, depth); else writeVTD( temp_offset >> 1, 10, TOKEN_DEC_ATTR_VAL, depth); break; } else throw new ParseException( "XML decl error: Can't switch encoding to ISO-8859" + formatLineNumber()); } throw new ParseException( "XML decl error: Invalid Encoding" + formatLineNumber()); case 'u' : case 'U' : if ((skipChar('s') || skipChar('S'))) if (skipChar('-') && (skipChar('a') || skipChar('A')) && (skipChar('s') || skipChar('S')) && (skipChar('c') || skipChar('C')) && (skipChar('i') || skipChar('I')) && (skipChar('i') || skipChar('I')) && skipChar(ch_temp)) { if (encoding != FORMAT_UTF_16LE && encoding != FORMAT_UTF_16BE) { if (must_utf_8) throw new EncodingException("Can't switch from UTF-8" + formatLineNumber()); encoding = FORMAT_ASCII; //System.out.println( // " " + (temp_offset) + " " + 5 + " dec attr val (encoding) " + depth); if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, 5, TOKEN_DEC_ATTR_VAL, depth); else writeVTD( temp_offset >> 1, 5, TOKEN_DEC_ATTR_VAL, depth); break; } else throw new ParseException( "XML decl error: Can't switch encoding to US-ASCII" + formatLineNumber()); } else throw new ParseException( "XML decl error: Invalid Encoding" + formatLineNumber()); if ((skipChar('t') || skipChar('T')) && (skipChar('f') || skipChar('F')) && skipChar('-')) { if (skipChar('8') && skipChar(ch_temp)) { if (encoding != FORMAT_UTF_16LE && encoding != FORMAT_UTF_16BE) { //encoding = FORMAT_UTF8; /*System.out.println( " " + (temp_offset) + " " + 5 + " dec attr val (encoding) " + depth);*/ if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, 5, TOKEN_DEC_ATTR_VAL, depth); else writeVTD( temp_offset >> 1, 5, TOKEN_DEC_ATTR_VAL, depth); break; } else throw new ParseException( "XML decl error: Can't switch encoding to UTF-8" + formatLineNumber()); } if (skipChar('1') && skipChar('6')) { if (skipChar(ch_temp)) { if (encoding == FORMAT_UTF_16LE || encoding == FORMAT_UTF_16BE) { /*System.out.println( " " + (temp_offset) + " " + 6 + " dec attr val (encoding) " + depth);*/ if (!BOM_detected) throw new EncodingException("BOM not detected for UTF-16" + formatLineNumber()); if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, 6, TOKEN_DEC_ATTR_VAL, depth); else writeVTD( temp_offset >> 1, 6, TOKEN_DEC_ATTR_VAL, depth); break; } throw new ParseException( "XML decl error: Can't switch encoding to UTF-16" + formatLineNumber()); } else if ( (skipChar('l') || skipChar('L')) && (skipChar('e') || skipChar('E')) && skipChar(ch_temp)) { if (encoding == FORMAT_UTF_16LE) { /*System.out.println( " " + (temp_offset) + " " + 7 + " dec attr val (encoding) " + depth);*/ if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, 7, TOKEN_DEC_ATTR_VAL, depth); else writeVTD( temp_offset >> 1, 7, TOKEN_DEC_ATTR_VAL, depth); break; } throw new ParseException( "XML del error: Can't switch encoding to UTF-16LE" + formatLineNumber()); } else if ( (skipChar('b') || skipChar('B')) && (skipChar('e') || skipChar('E')) && skipChar(ch_temp)) { if (encoding == FORMAT_UTF_16BE) { /*System.out.println( " " + (temp_offset) + " " + 7 + " dec attr val (encoding) " + depth);*/ if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, 7, TOKEN_DEC_ATTR_VAL, depth); else writeVTD( temp_offset >> 1, 7, TOKEN_DEC_ATTR_VAL, depth); break; } throw new ParseException( "XML del error: Can't swtich encoding to UTF-16BE" + formatLineNumber()); } throw new ParseException( "XML decl error: Invalid encoding" + formatLineNumber()); } } default : throw new ParseException( "XML decl Error: invalid encoding" + formatLineNumber()); } ch = getChar(); if (XMLChar.isSpaceChar(ch)) ch = getCharAfterS(); temp_offset = offset - increment; } else throw new ParseException( "XML decl Error: Invalid char" + formatLineNumber()); } if (ch == 's') { if (skipChar('t') && skipChar('a') && skipChar('n') && skipChar('d') && skipChar('a') && skipChar('l') && skipChar('o') && skipChar('n') && skipChar('e')) { ch = getCharAfterS(); if (ch != '=') throw new ParseException( "XML decl error: Invalid char" + formatLineNumber()); /*System.out.println( " " + temp_offset + " " + 3 + " dec attr name (standalone) " + depth);*/ if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, 10, TOKEN_DEC_ATTR_NAME, depth); else writeVTD( temp_offset >> 1, 10, TOKEN_DEC_ATTR_NAME, depth); ch_temp = getCharAfterS(); temp_offset = offset; if (ch_temp != '"' && ch_temp != '\'') throw new ParseException( "XML decl error: Invalid char to start attr name" + formatLineNumber()); ch = getChar(); if (ch == 'y') { if (skipChar('e') && skipChar('s') && skipChar(ch_temp)) { /*System.out.println( " " + (temp_offset) + " " + 3 + " dec attr val (standalone) " + depth);*/ if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, 3, TOKEN_DEC_ATTR_VAL, depth); else writeVTD( temp_offset >> 1, 3, TOKEN_DEC_ATTR_VAL, depth); } else throw new ParseException( "XML decl error: invalid val for standalone" + formatLineNumber()); } else if (ch == 'n') { if (skipChar('o') && skipChar(ch_temp)) { /*System.out.println( " " + (temp_offset) + " " + 2 + " dec attr val (standalone)" + depth);*/ if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, 2, TOKEN_DEC_ATTR_VAL, depth); else writeVTD( temp_offset >> 1, 2, TOKEN_DEC_ATTR_VAL, depth); } else throw new ParseException( "XML decl error: invalid val for standalone" + formatLineNumber()); } else throw new ParseException( "XML decl error: invalid val for standalone" + formatLineNumber()); } else throw new ParseException( "XML decl error" + formatLineNumber()); ch = getChar(); if (XMLChar.isSpaceChar(ch)) ch = getCharAfterS(); } } if (ch == '?' && skipChar('>')) { temp_offset = offset; ch = getCharAfterS(); if (ch == '<') { parser_state = STATE_LT_SEEN; } else throw new ParseException( "Other Error: Invalid Char in XML" + formatLineNumber()); } else throw new ParseException( "XML decl Error: Invalid termination sequence" + formatLineNumber()); break; case STATE_COMMENT : while (true) { ch = getChar(); if (XMLChar.isValidChar(ch)) { if (ch == '-' && skipChar('-')) { length1 = offset - temp_offset - 2 * increment; break; } } else throw new ParseException( "Error in comment: Invalid Char" + formatLineNumber()); } if (getChar() == '>') { //System.out.println(" " + (temp_offset) + " " + length1 + " comment " + depth); if (encoding < FORMAT_UTF_16BE){ writeVTD( temp_offset, length1, TOKEN_COMMENT, depth); } else{ writeVTD( temp_offset >> 1, length1 >> 1, TOKEN_COMMENT, depth); } //length1 = 0; temp_offset = offset; ch = getCharAfterSe(); if (ch == '<') { parser_state = STATE_LT_SEEN; } else if (XMLChar.isContentChar(ch)) { //temp_offset = offset; parser_state = STATE_TEXT; } else if (ch == '&') { //has_amp = true; //temp_offset = offset; entityIdentifier(); parser_state = STATE_TEXT; } else throw new ParseException( "Error in text content: Invalid char" + formatLineNumber()); break; } else throw new ParseException( "Error in comment: Invalid terminating sequence" + formatLineNumber()); case STATE_CDATA : while (true) { ch = getChar(); if (XMLChar.isValidChar(ch)) { if (ch == ']' && skipChar(']')) { while (skipChar(']')); if (skipChar('>')) { break; } else throw new ParseException( "Error in CDATA: Invalid termination sequence" + formatLineNumber()); } } else throw new ParseException( "Error in CDATA: Invalid Char" + formatLineNumber()); } length1 = offset - temp_offset - 3 * increment; if (encoding < FORMAT_UTF_16BE){ writeVTD( temp_offset, length1, TOKEN_CDATA_VAL, depth); } else{ writeVTD( temp_offset >> 1, length1 >> 1, TOKEN_CDATA_VAL, depth); } //System.out.println(" " + (temp_offset) + " " + length1 + " CDATA " + depth); ch = getCharAfterSe(); if (ch == '<') { parser_state = STATE_LT_SEEN; } else if (XMLChar.isContentChar(ch)) { temp_offset = offset; parser_state = STATE_TEXT; } else if (ch == '&') { //has_amp = true; temp_offset = offset; entityIdentifier(); parser_state = STATE_TEXT; //temp_offset = offset; } else throw new ParseException( "Other Error: Invalid char in xml" + formatLineNumber()); break; case STATE_DOCTYPE : int z = 1; while (true) { ch = getChar(); if (XMLChar.isValidChar(ch)) { if (ch == '>') z--; else if (ch == '<') z++; if (z == 0) break; } else throw new ParseException( "Error in DOCTYPE: Invalid char" + formatLineNumber()); } length1 = offset - temp_offset - increment; /*System.out.println( " " + (temp_offset) + " " + length1 + " DOCTYPE val " + depth);*/ if (encoding < FORMAT_UTF_16BE){ if (length1 > MAX_TOKEN_LENGTH) throw new ParseException("Token Length Error:" +" DTD val too long (>0xfffff)" + formatLineNumber()); writeVTD( temp_offset, length1, TOKEN_DTD_VAL, depth); } else{ if (length1 > (MAX_TOKEN_LENGTH<<1)) throw new ParseException("Token Length Error:" +" DTD val too long (>0xfffff)" + formatLineNumber()); writeVTD( temp_offset >> 1, length1 >> 1, TOKEN_DTD_VAL, depth); } ch = getCharAfterS(); if (ch == '<') { parser_state = STATE_LT_SEEN; } else throw new ParseException( "Other Error: Invalid char in xml" + formatLineNumber()); break; case STATE_TEXT : if (depth == -1) throw new ParseException( "Error in text: Char data at the wrong place" + formatLineNumber()); while (true) { ch = getChar(); if (XMLChar.isContentChar(ch)) { } else if (ch == '&') { //has_amp = true; if (!XMLChar.isValidChar(entityIdentifier())) throw new ParseException( "Error in text content: Invalid char in text content " + formatLineNumber()); //parser_state = STATE_TEXT; } else if (ch == '<') { break; } else if (ch == ']') { if (skipChar(']')) { while (skipChar(']')) { } if (skipChar('>')) throw new ParseException( "Error in text content: ]]> in text content" + formatLineNumber()); } } else throw new ParseException( "Error in text content: Invalid char in text content" + formatLineNumber()); } length1 = offset - increment - temp_offset; //if (has_amp) { /*System.out.println( " " + temp_offset + " " + length1 + " text with amp " + depth);*/ if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, length1, TOKEN_CHARACTER_DATA, depth); else writeVTD( temp_offset >> 1, length1 >> 1, TOKEN_CHARACTER_DATA, depth); //} else { //System.out.println(" " + temp_offset + " " + length1 + " text " + depth); // if (encoding < 3) // writeVTD(temp_offset, length1, TOKEN_CHARACTER_DATA_NO_ENTITY, depth); //else //writeVTD(temp_offset >> 1, length1 >> 1, TOKEN_CHARACTER_DATA_NO_ENTITY, depth); //} //has_amp = true; parser_state = STATE_LT_SEEN; break; case STATE_ATTR_NAME : if (ch == 'x') { if (skipChar('m') && skipChar('l') && skipChar('n') && skipChar('s')) { ch = getChar(); if (ch == '=' || XMLChar.isSpaceChar(ch) || ch == ':') { is_ns = true; //break; } } } while (true) { if (XMLChar.isNameChar(ch)) { if (ch == ':') { length2 = offset - temp_offset - increment; } ch = getChar(); } else break; } length1 = getPrevOffset() - temp_offset; // check for uniqueness here /* boolean unique = true; boolean unequal; for (int i = 0; i < attr_count; i++) { unequal = false; int prevLen = (int) attr_name_array[i]; if (length1 == prevLen) { int prevOffset = (int) (attr_name_array[i] >> 32); for (int j = 0; j < prevLen; j++) { if (XMLDoc[prevOffset + j] != XMLDoc[temp_offset + j]) { unequal = true; break; } } } else unequal = true; unique = unique && unequal; }*/ boolean unique = true; boolean unequal; for (int i = 0; i < attr_count; i++) { unequal = false; int prevLen = (int) attr_name_array[i]; if (length1 == prevLen) { int prevOffset = (int) (attr_name_array[i] >> 32); for (int j = 0; j < prevLen; j++) { if (XMLDoc[prevOffset + j] != XMLDoc[temp_offset + j]) { unequal = true; break; } } } else unequal = true; unique = unique && unequal; } if (!unique && attr_count != 0) throw new ParseException( "Error in attr: Attr name not unique" + formatLineNumber()); unique = true; if (attr_count < attr_name_array.length) { attr_name_array[attr_count] = ((long) (temp_offset) << 32) + length1; attr_count++; } else // grow the attr_name_array by 16 { long[] temp_array = attr_name_array; /*System.out.println( "size increase from " + temp_array.length + " to " + (attr_count + 16));*/ attr_name_array = new long[attr_count + ATTR_NAME_ARRAY_SIZE]; for (int i = 0; i < attr_count; i++) { attr_name_array[i] = temp_array[i]; } attr_name_array[attr_count] = ((long) (temp_offset) << 32) + length1; attr_count++; } // after checking, write VTD if (is_ns) { if (encoding < FORMAT_UTF_16BE){ if (length2>MAX_PREFIX_LENGTH || length1 > MAX_QNAME_LENGTH) throw new ParseException( "Token length overflow exception: Attr ns tag prefix or qname length too long" +formatLineNumber()); writeVTD( temp_offset, (length2 << 11) | length1, TOKEN_ATTR_NS, depth); } else{ if (length2>(MAX_PREFIX_LENGTH <<1) || length1 > (MAX_QNAME_LENGTH<<1)) throw new ParseException( "Token length overflow exception: Attr ns prefix or qname length too long" +formatLineNumber()); writeVTD( temp_offset >> 1, (length2 << 10) | (length1 >> 1), TOKEN_ATTR_NS, depth); } is_ns = false; } else { if (encoding < FORMAT_UTF_16BE){ if (length2>MAX_PREFIX_LENGTH || length1 > MAX_QNAME_LENGTH) throw new ParseException( "Token length overflow exception: Attr name prefix or qname length too long" +formatLineNumber()); writeVTD( temp_offset, (length2 << 11) | length1, TOKEN_ATTR_NAME, depth); } else{ if (length2>(MAX_PREFIX_LENGTH <<1) || length1 > (MAX_QNAME_LENGTH<<1)) throw new ParseException( "Token length overflow exception: Attr name prefix or qname length too long" +formatLineNumber()); writeVTD( temp_offset >> 1, (length2 << 10) | (length1 >> 1), TOKEN_ATTR_NAME, depth); } } /*System.out.println( " " + temp_offset + " " + length2 + ":" + length1 + " attr name " + depth);*/ length2 = 0; if (XMLChar.isSpaceChar(ch)) { ch = getCharAfterS(); } if (ch != '=') throw new ParseException( "Error in attr: invalid char" + formatLineNumber()); ch_temp = getCharAfterS(); if (ch_temp != '"' && ch_temp != '\'') throw new ParseException( "Error in attr: invalid char (should be ' or \" )" + formatLineNumber()); temp_offset = offset; parser_state = STATE_ATTR_VAL; break; case STATE_ATTR_VAL : while (true) { ch = getChar(); if (XMLChar.isValidChar(ch) && ch != '<') { if (ch == ch_temp) break; if (ch == '&') { //has_amp = true; // as in vtd spec, we mark attr val with entities if (!XMLChar .isValidChar(entityIdentifier())) { throw new ParseException( "Error in attr: Invalid XML char" + formatLineNumber()); } } } else throw new ParseException( "Error in attr: Invalid XML char" + formatLineNumber()); } length1 = offset - temp_offset - increment; if (encoding < FORMAT_UTF_16BE){ if (length1 > MAX_TOKEN_LENGTH) throw new ParseException("Token Length Error:" +" Attr val too long (>0xfffff)" + formatLineNumber()); writeVTD( temp_offset, length1, TOKEN_ATTR_VAL, depth); } else{ if (length1 > (MAX_TOKEN_LENGTH <<1)) throw new ParseException("Token Length Error:" +" Attr val too long (>0xfffff)" + formatLineNumber()); writeVTD( temp_offset >> 1, length1 >> 1, TOKEN_ATTR_VAL, depth); } ch = getChar(); if (XMLChar.isSpaceChar(ch)) { ch = getCharAfterS(); if (XMLChar.isNameStartChar(ch)) { temp_offset = offset - increment; parser_state = STATE_ATTR_NAME; break; } } if (ch == '/') { depth--; ch = getChar(); } if (ch == '>') { attr_count = 0; if (depth != -1) { temp_offset = offset; ch = getCharAfterSe(); if (ch == '<') { parser_state = STATE_LT_SEEN; } else if (XMLChar.isContentChar(ch)) { //temp_offset = offset; parser_state = STATE_TEXT; } else if (ch == '&') { //has_amp = true; //temp_offset = offset; entityIdentifier(); parser_state = STATE_TEXT; } else throw new ParseException( "Error in text content: Invalid char" + formatLineNumber()); } else { parser_state = STATE_DOC_END; } break; } throw new ParseException( "Starting tag Error: Invalid char in starting tag" + formatLineNumber()); case STATE_END_PI : ch = getChar(); if (XMLChar.isNameStartChar(ch)) { if ((ch == 'x' || ch == 'X') && (skipChar('m') || skipChar('M')) && (skipChar('l') && skipChar('L'))) { //temp_offset = offset; ch = getChar(); if (XMLChar.isSpaceChar(ch) || ch == '?') throw new ParseException( "Error in PI: [xX][mM][lL] not a valid PI target" + formatLineNumber()); //offset = temp_offset; } while (true) { //ch = getChar(); if (!XMLChar.isNameChar(ch)) { break; } ch = getChar(); } length1 = offset - temp_offset - increment; /*System.out.println( "" + (char) XMLDoc[temp_offset] + " " + (temp_offset) + " " + length1 + " PI Target " + depth);*/ if (encoding < FORMAT_UTF_16BE){ if (length1 > MAX_TOKEN_LENGTH) throw new ParseException("Token Length Error:" +"PI name too long (>0xfffff)" + formatLineNumber()); writeVTD( temp_offset, length1, TOKEN_PI_NAME, depth); } else{ if (length1 > (MAX_TOKEN_LENGTH<<1)) throw new ParseException("Token Length Error:" +"PI name too long (>0xfffff)" + formatLineNumber()); writeVTD( temp_offset >> 1, length1 >> 1, TOKEN_PI_NAME, depth); } //length1 = 0; temp_offset = offset; if (XMLChar.isSpaceChar(ch)) { ch = getCharAfterS(); while (true) { if (XMLChar.isValidChar(ch)) { if (ch == '?') if (skipChar('>')) { parser_state = STATE_DOC_END; break; } else throw new ParseException( "Error in PI: invalid termination sequence" + formatLineNumber()); } else throw new ParseException( "Error in PI: Invalid char in PI val" + formatLineNumber()); ch = getChar(); } length1 = offset - temp_offset - 2 * increment; if (encoding < FORMAT_UTF_16BE){ if (length1 > MAX_TOKEN_LENGTH) throw new ParseException("Token Length Error:" +"PI val too long (>0xfffff)" + formatLineNumber()); writeVTD( temp_offset, length1, TOKEN_PI_VAL, depth); } else{ if (length1 > (MAX_TOKEN_LENGTH<<1)) throw new ParseException("Token Length Error:" +"PI val too long (>0xfffff)" + formatLineNumber()); writeVTD( temp_offset >> 1, length1 >> 1, TOKEN_PI_VAL, depth); } //System.out.println(" " + temp_offset + " " + length1 + " PI val " + depth); } else { if ((ch == '?') && skipChar('>')) { parser_state = STATE_DOC_END; } else throw new ParseException( "Error in PI: invalid termination sequence" + formatLineNumber()); } //parser_state = STATE_DOC_END; } else throw new ParseException("Error in PI: invalid char in PI target" +formatLineNumber()); break; case STATE_END_COMMENT : while (true) { ch = getChar(); if (XMLChar.isValidChar(ch)) { if (ch == '-' && skipChar('-')) { length1 = offset - temp_offset - 2 * increment; break; } } else throw new ParseException( "Error in comment: Invalid Char" + formatLineNumber()); } if (getChar() == '>') { //System.out.println(" " + temp_offset + " " + length1 + " comment " + depth); if (encoding < FORMAT_UTF_16BE) writeVTD( temp_offset, length1, TOKEN_COMMENT, depth); else writeVTD( temp_offset >> 1, length1 >> 1, TOKEN_COMMENT, depth); //length1 = 0; parser_state = STATE_DOC_END; break; } throw new ParseException( "Error in comment: '-->' expected" + formatLineNumber()); default : throw new ParseException( "Other error: invalid parser state" +formatLineNumber()); } } } catch (EOFException e) { if (parser_state != STATE_DOC_END) throw e; } } | 3680 /local/tlutelli/issta_data/temp/all_java0context/java/2006_temp/2006/3680/b398d55c30402df8a8de6650255b1399d4c8067b/VTDGen.java/clean/com/ximpleware/VTDGen.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1109,
12,
6494,
11472,
13,
202,
202,
15069,
13400,
503,
16,
30051,
16,
3887,
503,
16,
10616,
288,
202,
202,
759,
4426,
2713,
3152,
1082,
565,
3153,
273,
11472,
31,
202,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1109,
12,
6494,
11472,
13,
202,
202,
15069,
13400,
503,
16,
30051,
16,
3887,
503,
16,
10616,
288,
202,
202,
759,
4426,
2713,
3152,
1082,
565,
3153,
273,
11472,
31,
202,
2... |
return retVal; } | return retVal; } | protected Document createDocument(String filename) { Document retVal = null; synchronized (this.historyDocuments) { if (this.historyDocuments.containsKey(filename)) { retVal = getDocumentForFile(filename); } else { retVal = this.historyServiceImpl.getDocumentBuilder() .newDocument(); retVal.appendChild(retVal.createElement("history")); this.historyDocuments.put(filename, retVal); } } return retVal; } | 43455 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/43455/dd511f0f97892bf31dc2a7a1989480bf6b6b5308/HistoryImpl.java/clean/src/net/java/sip/communicator/impl/history/HistoryImpl.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
4319,
27569,
12,
780,
1544,
13,
288,
202,
202,
2519,
12197,
273,
446,
31,
202,
202,
22043,
261,
2211,
18,
8189,
12922,
13,
288,
1082,
202,
430,
261,
2211,
18,
8189,
12922,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1117,
4319,
27569,
12,
780,
1544,
13,
288,
202,
202,
2519,
12197,
273,
446,
31,
202,
202,
22043,
261,
2211,
18,
8189,
12922,
13,
288,
1082,
202,
430,
261,
2211,
18,
8189,
12922,
18... |
tableViewerDescription.addColumn("State", "state"); getDbc().bind2(tableViewerDescription, new PropertyDescription(catalog,"accounts"), null); | tableViewerDescription.addColumn("State", "state"); getDbc().bind2(tableViewerDescription, new PropertyDescription(catalog, "accounts"), null); | public void testScenario01() throws BindingException { // Show that a TableViewer with three columns renders the accounts List accounts = catalog.getAccounts(); TableViewerDescription tableViewerDescription = new TableViewerDescription(tableViewer); tableViewerDescription.addColumn("FirstName", "firstName"); tableViewerDescription.addColumn("LastName", "lastName"); tableViewerDescription.addColumn("State", "state"); getDbc().bind2(tableViewerDescription, new PropertyDescription(catalog,"accounts"), null); // Verify the data in the table columns matches the accounts for (int i = 0; i < accounts.size(); i++) { Account account = (Account) catalog.getAccounts().get(i); String col_0 = ((ITableLabelProvider)tableViewer.getLabelProvider()).getColumnText(account,0); assertEquals(account.getFirstName(),col_0); String col_1 = ((ITableLabelProvider)tableViewer.getLabelProvider()).getColumnText(account,1); assertEquals(account.getLastName(),col_1); String col_2 = ((ITableLabelProvider)tableViewer.getLabelProvider()).getColumnText(account,2); assertEquals(account.getState(),col_2); } } | 55805 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/55805/1530c33800c89b3fbc6a32b79c9729ecf7967272/TableScenarios.java/clean/tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/binding/scenarios/TableScenarios.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1842,
21390,
1611,
1435,
1216,
15689,
503,
288,
202,
202,
759,
9674,
716,
279,
3555,
18415,
598,
8925,
2168,
19567,
326,
9484,
202,
202,
682,
9484,
273,
6222,
18,
588,
1397... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
918,
1842,
21390,
1611,
1435,
1216,
15689,
503,
288,
202,
202,
759,
9674,
716,
279,
3555,
18415,
598,
8925,
2168,
19567,
326,
9484,
202,
202,
682,
9484,
273,
6222,
18,
588,
1397... |
AST tmp2160_AST_in = (AST)_t; | AST tmp2162_AST_in = (AST)_t; | public final void savecachestate(AST _t) throws RecognitionException { AST savecachestate_AST_in = (_t == ASTNULL) ? null : (AST)_t; AST __t2251 = _t; AST tmp2156_AST_in = (AST)_t; match(_t,SAVE); _t = _t.getFirstChild(); AST tmp2157_AST_in = (AST)_t; match(_t,CACHE); _t = _t.getNextSibling(); { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case CURRENT: { AST tmp2158_AST_in = (AST)_t; match(_t,CURRENT); _t = _t.getNextSibling(); break; } case COMPLETE: { AST tmp2159_AST_in = (AST)_t; match(_t,COMPLETE); _t = _t.getNextSibling(); break; } default: { throw new NoViableAltException(_t); } } } anyorvalue(_t); _t = _retTree; AST tmp2160_AST_in = (AST)_t; match(_t,TO); _t = _t.getNextSibling(); filenameorvalue(_t); _t = _retTree; { if (_t==null) _t=ASTNULL; switch ( _t.getType()) { case NOERROR_KW: { AST tmp2161_AST_in = (AST)_t; match(_t,NOERROR_KW); _t = _t.getNextSibling(); break; } case EOF: case PERIOD: { break; } default: { throw new NoViableAltException(_t); } } } state_end(_t); _t = _retTree; _t = __t2251; _t = _t.getNextSibling(); _retTree = _t; } | 13952 /local/tlutelli/issta_data/temp/all_java1context/java/2006_temp/2006/13952/f492fd11e745beb562b4e209643ba003aa8a6271/TreeParser01.java/clean/trunk/org.prorefactor.core/src/org/prorefactor/treeparser01/TreeParser01.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
727,
918,
1923,
17703,
395,
340,
12,
9053,
389,
88,
13,
1216,
9539,
288,
9506,
202,
9053,
1923,
17703,
395,
340,
67,
9053,
67,
267,
273,
261,
67,
88,
422,
9183,
8560,
13,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
482,
727,
918,
1923,
17703,
395,
340,
12,
9053,
389,
88,
13,
1216,
9539,
288,
9506,
202,
9053,
1923,
17703,
395,
340,
67,
9053,
67,
267,
273,
261,
67,
88,
422,
9183,
8560,
13,
69... |
Locale lc = SessionHandleAdapter.getInstance( ) | ULocale lc = SessionHandleAdapter.getInstance( ) | private void loadMessage( ) { if ( folderName == null || baseName == null ) { return; } Locale lc = SessionHandleAdapter.getInstance( ) .getSessionHandle( ) .getLocale( ); String fullBaseName = folderName + File.separator + baseName + "_" //$NON-NLS-1$ + lc.getLanguage( ) + "_" + lc.getCountry( ) + ".properties"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ File f = new File( fullBaseName ); if ( f.exists( ) && f.isFile( ) ) { try { FileInputStream fis = new FileInputStream( f ); content.load( fis ); fis.close( ); propFileName = f.getName( ); return; } catch ( FileNotFoundException e ) { // ignore. } catch ( IOException e ) { // ignore. } } fullBaseName = folderName + File.separator + baseName + "_" //$NON-NLS-1$ + lc.getLanguage( ) + ".properties"; //$NON-NLS-1$ //$NON-NLS-2$ f = new File( fullBaseName ); if ( f.exists( ) && f.isFile( ) ) { try { FileInputStream fis = new FileInputStream( f ); content.load( fis ); fis.close( ); propFileName = f.getName( ); return; } catch ( FileNotFoundException e ) { // ignore. } catch ( IOException e ) { // ignore. } } fullBaseName = folderName + File.separator + baseName + ".properties"; //$NON-NLS-1$ f = new File( fullBaseName ); if ( f.exists( ) && f.isFile( ) ) { try { FileInputStream fis = new FileInputStream( f ); content.load( fis ); fis.close( ); propFileName = f.getName( ); return; } catch ( FileNotFoundException e ) { // ignore. } catch ( IOException e ) { // ignore. } } propFileName = baseName + "_" + lc.getLanguage( ) + "_" //$NON-NLS-1$ //$NON-NLS-2$ + lc.getCountry( ) + ".properties"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } | 46013 /local/tlutelli/issta_data/temp/all_java4context/java/2006_temp/2006/46013/47cbec2b01062e3996055f55636efe867df44d61/ResourceEditDialog.java/clean/UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/dialogs/ResourceEditDialog.java | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1152,
918,
1262,
1079,
12,
262,
202,
95,
202,
202,
430,
261,
31814,
422,
446,
747,
16162,
422,
446,
262,
202,
202,
95,
1082,
202,
2463,
31,
202,
202,
97,
202,
202,
3916,
9109,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
225,
202,
1152,
918,
1262,
1079,
12,
262,
202,
95,
202,
202,
430,
261,
31814,
422,
446,
747,
16162,
422,
446,
262,
202,
202,
95,
1082,
202,
2463,
31,
202,
202,
97,
202,
202,
3916,
9109,
27... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.