rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
public RenderingServiceException(String message, Throwable cause) { super(message, cause); }
public RenderingServiceException() { super(); }
public RenderingServiceException(String message, Throwable cause) { super(message, cause); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/5aacd98a1cfb2219e218c87eed17b5a0f0e9738a/RenderingServiceException.java/clean/SRC/org/openmicroscopy/shoola/env/rnd/RenderingServiceException.java
{
{
public void activate() { topFrame.addToDesktop(presentation, TopFrame.PALETTE_LAYER); presentation.setVisible(true); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/e717f628b707987e5b693ea9d57b6ef34b300679/DataManager.java/buggy/SRC/org/openmicroscopy/shoola/agents/datamng/DataManager.java
public DatasetSummary createDataset(List projectSummaries,
public DatasetSummary createDataset(List projectSummaries,
public DatasetSummary createDataset(List projectSummaries, List imageSummaries, DatasetData retVal) throws DSOutOfServiceException, DSAccessException;
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a43ad78503af4e7f39a04cb20cfba13e1c78b806/DataManagementService.java/buggy/SRC/org/openmicroscopy/shoola/env/data/DataManagementService.java
DatasetData retVal)
DatasetData retVal, DatasetSummary dProto)
public DatasetSummary createDataset(List projectSummaries, List imageSummaries, DatasetData retVal) throws DSOutOfServiceException, DSAccessException;
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a43ad78503af4e7f39a04cb20cfba13e1c78b806/DataManagementService.java/buggy/SRC/org/openmicroscopy/shoola/env/data/DataManagementService.java
public ProjectSummary createProject(ProjectData retVal)
public ProjectSummary createProject(ProjectData retVal, ProjectSummary pProto)
public ProjectSummary createProject(ProjectData retVal) throws DSOutOfServiceException, DSAccessException;
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a43ad78503af4e7f39a04cb20cfba13e1c78b806/DataManagementService.java/buggy/SRC/org/openmicroscopy/shoola/env/data/DataManagementService.java
public ImageData retrieveImage(int id)
public ImageData retrieveImage(int id, ImageData retVal)
public ImageData retrieveImage(int id) throws DSOutOfServiceException, DSAccessException;
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a43ad78503af4e7f39a04cb20cfba13e1c78b806/DataManagementService.java/buggy/SRC/org/openmicroscopy/shoola/env/data/DataManagementService.java
public ProjectData retrieveProject(int projectID)
public ProjectData retrieveProject(int projectID, ProjectData retVal)
public ProjectData retrieveProject(int projectID) throws DSOutOfServiceException, DSAccessException;
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a43ad78503af4e7f39a04cb20cfba13e1c78b806/DataManagementService.java/buggy/SRC/org/openmicroscopy/shoola/env/data/DataManagementService.java
public List retrieveUserDatasets()
public List retrieveUserDatasets(DatasetSummary dProto)
public List retrieveUserDatasets() throws DSOutOfServiceException, DSAccessException;
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a43ad78503af4e7f39a04cb20cfba13e1c78b806/DataManagementService.java/buggy/SRC/org/openmicroscopy/shoola/env/data/DataManagementService.java
public List retrieveUserImages()
public List retrieveUserImages(ImageSummary iProto)
public List retrieveUserImages() throws DSOutOfServiceException, DSAccessException;
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a43ad78503af4e7f39a04cb20cfba13e1c78b806/DataManagementService.java/buggy/SRC/org/openmicroscopy/shoola/env/data/DataManagementService.java
public List retrieveUserProjects()
public List retrieveUserProjects(ProjectSummary pProto, DatasetSummary dProto)
public List retrieveUserProjects() throws DSOutOfServiceException, DSAccessException;
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a43ad78503af4e7f39a04cb20cfba13e1c78b806/DataManagementService.java/buggy/SRC/org/openmicroscopy/shoola/env/data/DataManagementService.java
kernelModule.defineMethod("nil?", DefaultCallbackMethods.getMethodFalse());
public static RubyModule createKernelModule(Ruby ruby) { RubyModule kernelModule = ruby.defineModule("Kernel"); kernelModule.defineMethod("puts", getKernelMethod("m_puts")); kernelModule.defineMethod("print", getKernelMethod("m_print")); kernelModule.defineMethod("to_s", getObjectMethod("m_to_s")); kernelModule.defineModuleFunction("singleton_method_added", getDummyMethod()); return kernelModule; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/241a0fe060c8d239aa9e5d2519e98cf44d69a201/RBKernel.java/clean/org/jruby/core/RBKernel.java
flater = new Deflater(level);
flater = new Deflater(level,true);
public ZlibDeflate(IRubyObject caller, int level, int win_bits, int memlevel, int strategy) { super(); flater = new Deflater(level); flater.setStrategy(strategy); collected = new StringBuffer(); runtime = caller.getRuntime(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/510a41b06f3103200e881725915b7cc1a5a10b39/ZlibDeflate.java/clean/src/org/jruby/util/ZlibDeflate.java
public IRubyObject deflate(String str, Long flush_x) throws IOException { int flush = flush_x.intValue();
public IRubyObject deflate(String str, int flush) throws IOException {
public IRubyObject deflate(String str, Long flush_x) throws IOException { int flush = flush_x.intValue(); if (null == str) { StringBuffer result = new StringBuffer(); byte[] outp = new byte[1024]; byte[] buf = collected.toString().getBytes("ISO8859_1"); collected = new StringBuffer(); flater.setInput(buf); flater.finish(); int resultLength = -1; while (!flater.finished() && resultLength != 0) { resultLength = flater.deflate(outp); result.append(new String(outp, 0, resultLength,"ISO-8859-1")); } return runtime.newString(result.toString()); } else { append(str); if (flush == FINISH) { StringBuffer result = new StringBuffer(); byte[] outp = new byte[1024]; byte[] buf = collected.toString().getBytes("ISO8859_1"); collected = new StringBuffer(); flater.setInput(buf); flater.finish(); int resultLength = -1; while (!flater.finished() && resultLength != 0) { resultLength = flater.deflate(outp); result.append(new String(outp, 0, resultLength,"ISO-8859-1")); } return runtime.newString(result.toString()); } return runtime.getNil(); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/510a41b06f3103200e881725915b7cc1a5a10b39/ZlibDeflate.java/clean/src/org/jruby/util/ZlibDeflate.java
return runtime.getNil();
return runtime.newString("");
public IRubyObject deflate(String str, Long flush_x) throws IOException { int flush = flush_x.intValue(); if (null == str) { StringBuffer result = new StringBuffer(); byte[] outp = new byte[1024]; byte[] buf = collected.toString().getBytes("ISO8859_1"); collected = new StringBuffer(); flater.setInput(buf); flater.finish(); int resultLength = -1; while (!flater.finished() && resultLength != 0) { resultLength = flater.deflate(outp); result.append(new String(outp, 0, resultLength,"ISO-8859-1")); } return runtime.newString(result.toString()); } else { append(str); if (flush == FINISH) { StringBuffer result = new StringBuffer(); byte[] outp = new byte[1024]; byte[] buf = collected.toString().getBytes("ISO8859_1"); collected = new StringBuffer(); flater.setInput(buf); flater.finish(); int resultLength = -1; while (!flater.finished() && resultLength != 0) { resultLength = flater.deflate(outp); result.append(new String(outp, 0, resultLength,"ISO-8859-1")); } return runtime.newString(result.toString()); } return runtime.getNil(); } }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/510a41b06f3103200e881725915b7cc1a5a10b39/ZlibDeflate.java/clean/src/org/jruby/util/ZlibDeflate.java
public void finish() {
public IRubyObject finish() throws Exception { StringBuffer result = new StringBuffer(); byte[] outp = new byte[1024]; byte[] buf = collected.toString().getBytes("ISO8859_1"); collected = new StringBuffer(); flater.setInput(buf);
public void finish() { flater.finish(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/510a41b06f3103200e881725915b7cc1a5a10b39/ZlibDeflate.java/clean/src/org/jruby/util/ZlibDeflate.java
int resultLength = -1; while (!flater.finished() && resultLength != 0) { resultLength = flater.deflate(outp); result.append(new String(outp, 0, resultLength,"ISO-8859-1")); } return runtime.newString(result.toString());
public void finish() { flater.finish(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/510a41b06f3103200e881725915b7cc1a5a10b39/ZlibDeflate.java/clean/src/org/jruby/util/ZlibDeflate.java
public IRubyObject flush(Long flush) throws IOException {
public IRubyObject flush(int flush) throws IOException {
public IRubyObject flush(Long flush) throws IOException { return deflate("", flush); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/510a41b06f3103200e881725915b7cc1a5a10b39/ZlibDeflate.java/clean/src/org/jruby/util/ZlibDeflate.java
IRubyObject result = zstream.deflate(str, new Long(FINISH));
IRubyObject result = zstream.deflate(str, FINISH);
public static IRubyObject s_deflate(IRubyObject caller, String str, int level) throws UnsupportedEncodingException, DataFormatException, IOException { ZlibDeflate zstream = new ZlibDeflate(caller, level, MAX_WBITS, DEF_MEM_LEVEL, Deflater.DEFAULT_STRATEGY); IRubyObject result = zstream.deflate(str, new Long(FINISH)); zstream.close(); return result; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/510a41b06f3103200e881725915b7cc1a5a10b39/ZlibDeflate.java/clean/src/org/jruby/util/ZlibDeflate.java
return "SemanticElement"+(semanticElementId==null ? ":Hash"+this.hashCode() : ":"+semanticElementId);
return "SemanticElement"+(semanticElementId==null ? ":Hash_"+this.hashCode() : ":Id_"+semanticElementId);
public String toString(){ return "SemanticElement"+(semanticElementId==null ? ":Hash"+this.hashCode() : ":"+semanticElementId); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/51a3c546dfc7a7a98b29771a459df19094fc5b51/SemanticElement.java/clean/components/common/src/ome/model/SemanticElement.java
sb.append("user=");sb.append(_owner.getId()); sb.append(";group=");sb.append(_group.getId()); sb.append(";perm=");sb.append(Arrays.toString(_perms.getBytes())); sb.append(";create=");sb.append(_creation.getId()); sb.append(";update=");sb.append(_update.getId());
sb.append("user=");sb.append(_owner==null?null:_owner.getId()); sb.append(";group=");sb.append(_group==null?null:_group.getId()); sb.append(";perm=");sb.append(_perms==null?null:Arrays.toString(_perms.getBytes())); sb.append(";create=");sb.append(_creation==null?null:_creation.getId()); sb.append(";update=");sb.append(_update==null?null:_update.getId());
public String toString() { StringBuffer sb = new StringBuffer(128); sb.append("Details:{"); sb.append("user=");sb.append(_owner.getId()); sb.append(";group=");sb.append(_group.getId()); sb.append(";perm=");sb.append(Arrays.toString(_perms.getBytes())); sb.append(";create=");sb.append(_creation.getId()); sb.append(";update=");sb.append(_update.getId()); sb.append("}"); return sb.toString(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/a800b43e6294ca8eb405eea6189c8e37f8f0bd3a/Details.java/buggy/components/common/src/ome/model/internal/Details.java
dlg = new JDialog(SparkManager.getMainWindow(), "Downloads", false);
dlg = new JDialog(SparkManager.getMainWindow(), Res.getString("title.downloads"), false);
private Downloads() { ChatFrame frame = SparkManager.getChatManager().getChatContainer().getChatFrame(); dlg = new JDialog(SparkManager.getMainWindow(), "Downloads", false); dlg.setContentPane(mainPanel); dlg.pack(); dlg.setSize(400, 400); dlg.setResizable(true); dlg.setLocationRelativeTo(frame); pref = SettingsManager.getLocalPreferences(); downloadedDir = new File(pref.getDownloadDir()); downloadedDir.mkdirs(); pref.setDownloadDir(downloadedDir.getAbsolutePath()); list.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 1, true, false)); list.setBackground(Color.white); mainPanel.setLayout(new GridBagLayout()); mainPanel.add(new JScrollPane(list), new GridBagConstraints(0, 0, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); JButton cleanUpButton = new JButton("Clean Up", SparkRes.getImageIcon(SparkRes.SMALL_DELETE)); JLabel locationLabel = new JLabel(); locationLabel.setText("All Files Downloaded To: "); RolloverButton userHomeButton = new RolloverButton("Downloads", null); Action openFolderAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { downloadedDir = new File(SparkManager.getUserDirectory(), "downloads"); if (!downloadedDir.exists()) { downloadedDir.mkdirs(); } openFile(downloadedDir); } }; userHomeButton.addActionListener(openFolderAction); mainPanel.add(locationLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); mainPanel.add(userHomeButton, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); mainPanel.add(cleanUpButton, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); // Remove all download panels cleanUpButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { list.removeAll(); list.validate(); list.repaint(); } }); }
52006 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/52006/ede843505c046d47bba853e049191aedc32bd2fe/Downloads.java/buggy/src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/Downloads.java
public RubyString(IRuby runtime, String value) {
private RubyString(IRuby runtime, String value) {
public RubyString(IRuby runtime, String value) { this(runtime, runtime.getClass("String"), value); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return substr(RubyNumeric.fix2int(args[0]), RubyNumeric.fix2int(args[1]));
if (args[0] instanceof RubyRegexp) { IRubyObject match = RubyRegexp.regexpValue(args[0]).match(toString(), 0); return match.isNil() ? getRuntime().getNil() : ((RubyMatchData) match).group(args[1].convertToInteger().getLongValue()); } return substr(RubyNumeric.fix2int(args[0]), RubyNumeric.fix2int(args[1]));
public IRubyObject aref(IRubyObject[] args) { if (checkArgumentCount(args, 1, 2) == 2) { return substr(RubyNumeric.fix2int(args[0]), RubyNumeric.fix2int(args[1])); } if (args[0] instanceof RubyFixnum) { int idx = RubyNumeric.fix2int(args[0]); if (idx < 0) { idx += getValue().length(); } return idx < 0 || idx >= getValue().length() ? getRuntime().getNil() : getRuntime().newFixnum(getValue().charAt(idx)); } else if (args[0] instanceof RubyRegexp) { return RubyRegexp.regexpValue(args[0]).search(this, 0) >= 0 ? RubyRegexp.last_match(getRuntime().getCurrentContext().getBackref()) : getRuntime().getNil(); } else if (args[0] instanceof RubyString) { return getValue().indexOf(stringValue(args[0]).getValue()) != -1 ? args[0] : getRuntime().getNil(); } else if (args[0] instanceof RubyRange) { long[] begLen = ((RubyRange) args[0]).getBeginLength(getValue().length(), true, false); return begLen == null ? getRuntime().getNil() : substr((int) begLen[0], (int) begLen[1]); } int idx = (int) args[0].convertToInteger().getLongValue(); if (idx < 0) { idx += getValue().length(); } return idx < 0 || idx >= getValue().length() ? getRuntime().getNil() : getRuntime().newFixnum(getValue().charAt(idx)); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
if (args[0] instanceof RubyFixnum) { int idx = RubyNumeric.fix2int(args[0]); if (idx < 0) { idx += getValue().length(); } return idx < 0 || idx >= getValue().length() ? getRuntime().getNil() : getRuntime().newFixnum(getValue().charAt(idx)); } else if (args[0] instanceof RubyRegexp) {
if (args[0] instanceof RubyRegexp) {
public IRubyObject aref(IRubyObject[] args) { if (checkArgumentCount(args, 1, 2) == 2) { return substr(RubyNumeric.fix2int(args[0]), RubyNumeric.fix2int(args[1])); } if (args[0] instanceof RubyFixnum) { int idx = RubyNumeric.fix2int(args[0]); if (idx < 0) { idx += getValue().length(); } return idx < 0 || idx >= getValue().length() ? getRuntime().getNil() : getRuntime().newFixnum(getValue().charAt(idx)); } else if (args[0] instanceof RubyRegexp) { return RubyRegexp.regexpValue(args[0]).search(this, 0) >= 0 ? RubyRegexp.last_match(getRuntime().getCurrentContext().getBackref()) : getRuntime().getNil(); } else if (args[0] instanceof RubyString) { return getValue().indexOf(stringValue(args[0]).getValue()) != -1 ? args[0] : getRuntime().getNil(); } else if (args[0] instanceof RubyRange) { long[] begLen = ((RubyRange) args[0]).getBeginLength(getValue().length(), true, false); return begLen == null ? getRuntime().getNil() : substr((int) begLen[0], (int) begLen[1]); } int idx = (int) args[0].convertToInteger().getLongValue(); if (idx < 0) { idx += getValue().length(); } return idx < 0 || idx >= getValue().length() ? getRuntime().getNil() : getRuntime().newFixnum(getValue().charAt(idx)); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return getValue().indexOf(stringValue(args[0]).getValue()) != -1 ?
return toString().indexOf(stringValue(args[0]).toString()) != -1 ?
public IRubyObject aref(IRubyObject[] args) { if (checkArgumentCount(args, 1, 2) == 2) { return substr(RubyNumeric.fix2int(args[0]), RubyNumeric.fix2int(args[1])); } if (args[0] instanceof RubyFixnum) { int idx = RubyNumeric.fix2int(args[0]); if (idx < 0) { idx += getValue().length(); } return idx < 0 || idx >= getValue().length() ? getRuntime().getNil() : getRuntime().newFixnum(getValue().charAt(idx)); } else if (args[0] instanceof RubyRegexp) { return RubyRegexp.regexpValue(args[0]).search(this, 0) >= 0 ? RubyRegexp.last_match(getRuntime().getCurrentContext().getBackref()) : getRuntime().getNil(); } else if (args[0] instanceof RubyString) { return getValue().indexOf(stringValue(args[0]).getValue()) != -1 ? args[0] : getRuntime().getNil(); } else if (args[0] instanceof RubyRange) { long[] begLen = ((RubyRange) args[0]).getBeginLength(getValue().length(), true, false); return begLen == null ? getRuntime().getNil() : substr((int) begLen[0], (int) begLen[1]); } int idx = (int) args[0].convertToInteger().getLongValue(); if (idx < 0) { idx += getValue().length(); } return idx < 0 || idx >= getValue().length() ? getRuntime().getNil() : getRuntime().newFixnum(getValue().charAt(idx)); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return getValue();
return toString();
public String asSymbol() { return getValue(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
char c = (char) RubyNumeric.fix2int(args[1]); setValue(getValue().substring(0, idx) + c + getValue().substring(idx + 1));
getValue().setCharAt(idx, (char) RubyNumeric.fix2int(args[1]));
public IRubyObject aset(IRubyObject[] args) { testFrozen("class"); int strLen = getValue().length(); if (checkArgumentCount(args, 2, 3) == 3) { RubyString repl = stringValue(args[2]); int beg = RubyNumeric.fix2int(args[0]); int len = RubyNumeric.fix2int(args[1]); if (len < 0) { throw getRuntime().newIndexError("negative length"); } if (beg < 0) { beg += strLen; } if (beg < 0 || (beg > 0 && beg >= strLen)) { throw getRuntime().newIndexError("string index out of bounds"); } if (beg + len > strLen) { len = strLen - beg; } replace(beg, len, repl); return repl; } if (args[0] instanceof RubyFixnum) { // RubyNumeric? int idx = RubyNumeric.fix2int(args[0]); // num2int? if (idx < 0) { idx += getValue().length(); } if (idx < 0 || idx >= getValue().length()) { throw getRuntime().newIndexError("string index out of bounds"); } if (args[1] instanceof RubyFixnum) { char c = (char) RubyNumeric.fix2int(args[1]); setValue(getValue().substring(0, idx) + c + getValue().substring(idx + 1)); } else { replace(idx, 1, stringValue(args[1])); } return args[1]; } if (args[0] instanceof RubyRegexp) { sub_bang(args); return args[1]; } if (args[0] instanceof RubyString) { RubyString orig = stringValue(args[0]); int beg = getValue().indexOf(orig.getValue()); if (beg != -1) { replace(beg, orig.getValue().length(), stringValue(args[1])); } return args[1]; } if (args[0] instanceof RubyRange) { long[] idxs = ((RubyRange) args[0]).getBeginLength(getValue().length(), true, true); replace((int) idxs[0], (int) idxs[1], stringValue(args[1])); return args[1]; } throw getRuntime().newTypeError("wrong argument type"); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
int beg = getValue().indexOf(orig.getValue());
int beg = toString().indexOf(orig.toString());
public IRubyObject aset(IRubyObject[] args) { testFrozen("class"); int strLen = getValue().length(); if (checkArgumentCount(args, 2, 3) == 3) { RubyString repl = stringValue(args[2]); int beg = RubyNumeric.fix2int(args[0]); int len = RubyNumeric.fix2int(args[1]); if (len < 0) { throw getRuntime().newIndexError("negative length"); } if (beg < 0) { beg += strLen; } if (beg < 0 || (beg > 0 && beg >= strLen)) { throw getRuntime().newIndexError("string index out of bounds"); } if (beg + len > strLen) { len = strLen - beg; } replace(beg, len, repl); return repl; } if (args[0] instanceof RubyFixnum) { // RubyNumeric? int idx = RubyNumeric.fix2int(args[0]); // num2int? if (idx < 0) { idx += getValue().length(); } if (idx < 0 || idx >= getValue().length()) { throw getRuntime().newIndexError("string index out of bounds"); } if (args[1] instanceof RubyFixnum) { char c = (char) RubyNumeric.fix2int(args[1]); setValue(getValue().substring(0, idx) + c + getValue().substring(idx + 1)); } else { replace(idx, 1, stringValue(args[1])); } return args[1]; } if (args[0] instanceof RubyRegexp) { sub_bang(args); return args[1]; } if (args[0] instanceof RubyString) { RubyString orig = stringValue(args[0]); int beg = getValue().indexOf(orig.getValue()); if (beg != -1) { replace(beg, orig.getValue().length(), stringValue(args[1])); } return args[1]; } if (args[0] instanceof RubyRange) { long[] idxs = ((RubyRange) args[0]).getBeginLength(getValue().length(), true, true); replace((int) idxs[0], (int) idxs[1], stringValue(args[1])); return args[1]; } throw getRuntime().newTypeError("wrong argument type"); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
StringBuffer buffer = new StringBuffer(getValue().toLowerCase());
StringBuffer buffer = new StringBuffer(toString().toLowerCase());
public IRubyObject capitalize_bang() { if (isEmpty()) { return getRuntime().getNil(); } StringBuffer buffer = new StringBuffer(getValue().toLowerCase()); char capital = buffer.charAt(0); if (Character.isLowerCase(capital)) { buffer.setCharAt(0, Character.toUpperCase(capital)); } String result = buffer.toString(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
String result = buffer.toString(); if (result.equals(getValue())) {
if (sameAs(buffer)) {
public IRubyObject capitalize_bang() { if (isEmpty()) { return getRuntime().getNil(); } StringBuffer buffer = new StringBuffer(getValue().toLowerCase()); char capital = buffer.charAt(0); if (Character.isLowerCase(capital)) { buffer.setCharAt(0, Character.toUpperCase(capital)); } String result = buffer.toString(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
setValue(result);
setValue(buffer);
public IRubyObject capitalize_bang() { if (isEmpty()) { return getRuntime().getNil(); } StringBuffer buffer = new StringBuffer(getValue().toLowerCase()); char capital = buffer.charAt(0); if (Character.isLowerCase(capital)) { buffer.setCharAt(0, Character.toUpperCase(capital)); } String result = buffer.toString(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
RubyString thisLCString = getRuntime().newString(getValue().toLowerCase()); RubyString lcString = getRuntime().newString( stringValue(other).getValue().toLowerCase());
RubyString thisLCString = getRuntime().newString(toString().toLowerCase()); RubyString lcString = getRuntime().newString(stringValue(other).toString().toLowerCase());
public IRubyObject casecmp(IRubyObject other) { RubyString thisLCString = getRuntime().newString(getValue().toLowerCase()); RubyString lcString = getRuntime().newString( stringValue(other).getValue().toLowerCase()); return ((StringMetaClass)thisLCString.getMetaClass()).op_cmp.call(getRuntime(), thisLCString, thisLCString.getMetaClass(), "<=>", new IRubyObject[] {lcString}, false); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
public RubyString cat(String str) { setValue(getValue() + str); return this; }
private RubyString cat(StringBuffer str) { getValue().append(str); return this; }
public RubyString cat(String str) { setValue(getValue() + str); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
public IRubyObject center(IRubyObject arg) { int len = RubyNumeric.fix2int(arg);
public IRubyObject center(IRubyObject[] args) { checkArgumentCount(args, 1, 2); int len = RubyNumeric.fix2int(args[0]); String pad = args.length == 2 ? args[1].convertToString().toString() : " ";
public IRubyObject center(IRubyObject arg) { int len = RubyNumeric.fix2int(arg); int strLen = getValue().length(); if (len <= strLen) { return dup(); } StringBuffer sbuf = new StringBuffer(len); int lead = (len - strLen) / 2; int pos = 0; while (pos < len) { if (pos == lead) { sbuf.append(getValue()); pos += strLen; } else { sbuf.append(' '); pos++; } } return newString(sbuf.toString()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
int lead = (len - strLen) / 2; int pos = 0; while (pos < len) { if (pos == lead) { sbuf.append(getValue()); pos += strLen; } else { sbuf.append(' '); pos++; } }
int lead = (len - strLen) / 2; for (int i = 0; i < lead; i++) { sbuf.append(pad.charAt(i % padLen)); } sbuf.append(getValue()); int remaining = len - (lead + strLen); for (int i = 0; i < remaining; i++) { sbuf.append(pad.charAt(i % padLen)); }
public IRubyObject center(IRubyObject arg) { int len = RubyNumeric.fix2int(arg); int strLen = getValue().length(); if (len <= strLen) { return dup(); } StringBuffer sbuf = new StringBuffer(len); int lead = (len - strLen) / 2; int pos = 0; while (pos < len) { if (pos == lead) { sbuf.append(getValue()); pos += strLen; } else { sbuf.append(' '); pos++; } } return newString(sbuf.toString()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
public RubyString chomp(IRubyObject[] args) { RubyString result = (RubyString) dup(); result.chomp_bang(args); return result; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
int lastCharIndex = getValue().length() - 1; char lastChar = getValue().charAt(lastCharIndex); if (lastChar=='\n') { if (lastCharIndex > 0 && getValue().charAt(lastCharIndex - 1) == '\r') { setValue(getValue().substring(0, lastCharIndex - 1)); } else { setValue(getValue().substring(0, lastCharIndex)); } } else if (lastChar=='\r') { setValue(getValue().substring(0, lastCharIndex)); } else {
int end = getValue().length() - 1; int removeCount = 0; if (end < 0) {
public IRubyObject chomp_bang(IRubyObject[] args) { if (isEmpty()) { return getRuntime().getNil(); } // Separator (a.k.a. $/) can be overriden by the -0 (zero) command line option String separator = (args.length == 0) ? getRuntime().getGlobalVariables().get("$/").asSymbol() : args[0].asSymbol(); if (separator.equals(DEFAULT_RS)) { // Optimized very common case of str.chomp! on Windows (avoid 2 setValue calls) int lastCharIndex = getValue().length() - 1; char lastChar = getValue().charAt(lastCharIndex); if (lastChar=='\n') { if (lastCharIndex > 0 && getValue().charAt(lastCharIndex - 1) == '\r') { // Remove \r\n setValue(getValue().substring(0, lastCharIndex - 1)); } else { // Remove \n setValue(getValue().substring(0, lastCharIndex)); } } else if (lastChar=='\r') { // Very common case of chomp!(noParam) on Mac => No obvious optimzation setValue(getValue().substring(0, lastCharIndex)); } else { // No modifications made return getRuntime().getNil(); } return this; } // Uncommon case of str.chomp!("") not optimized if (separator.length() == 0) { boolean modified = false; while(getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\n') { modified = true; setValue(getValue().substring(0, getValue().length() - 1)); if (getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\r') { setValue(getValue().substring(0, getValue().length() - 1)); } } return modified ? this : getRuntime().getNil(); } // Uncommon case of str.chomp!("xxx") if (getValue().endsWith(separator)) { setValue(getValue().substring(0, getValue().length() - separator.length())); return this; } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
public IRubyObject chomp_bang(IRubyObject[] args) { if (isEmpty()) { return getRuntime().getNil(); } // Separator (a.k.a. $/) can be overriden by the -0 (zero) command line option String separator = (args.length == 0) ? getRuntime().getGlobalVariables().get("$/").asSymbol() : args[0].asSymbol(); if (separator.equals(DEFAULT_RS)) { // Optimized very common case of str.chomp! on Windows (avoid 2 setValue calls) int lastCharIndex = getValue().length() - 1; char lastChar = getValue().charAt(lastCharIndex); if (lastChar=='\n') { if (lastCharIndex > 0 && getValue().charAt(lastCharIndex - 1) == '\r') { // Remove \r\n setValue(getValue().substring(0, lastCharIndex - 1)); } else { // Remove \n setValue(getValue().substring(0, lastCharIndex)); } } else if (lastChar=='\r') { // Very common case of chomp!(noParam) on Mac => No obvious optimzation setValue(getValue().substring(0, lastCharIndex)); } else { // No modifications made return getRuntime().getNil(); } return this; } // Uncommon case of str.chomp!("") not optimized if (separator.length() == 0) { boolean modified = false; while(getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\n') { modified = true; setValue(getValue().substring(0, getValue().length() - 1)); if (getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\r') { setValue(getValue().substring(0, getValue().length() - 1)); } } return modified ? this : getRuntime().getNil(); } // Uncommon case of str.chomp!("xxx") if (getValue().endsWith(separator)) { setValue(getValue().substring(0, getValue().length() - separator.length())); return this; } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
boolean modified = false; while(getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\n') { modified = true; setValue(getValue().substring(0, getValue().length() - 1)); if (getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\r') { setValue(getValue().substring(0, getValue().length() - 1));
int end = getValue().length() - 1; int removeCount = 0; while(end - removeCount >= 0 && getValue().charAt(end - removeCount) == '\n') { removeCount++; if (end - removeCount >= 0 && getValue().charAt(end - removeCount) == '\r') { removeCount++;
public IRubyObject chomp_bang(IRubyObject[] args) { if (isEmpty()) { return getRuntime().getNil(); } // Separator (a.k.a. $/) can be overriden by the -0 (zero) command line option String separator = (args.length == 0) ? getRuntime().getGlobalVariables().get("$/").asSymbol() : args[0].asSymbol(); if (separator.equals(DEFAULT_RS)) { // Optimized very common case of str.chomp! on Windows (avoid 2 setValue calls) int lastCharIndex = getValue().length() - 1; char lastChar = getValue().charAt(lastCharIndex); if (lastChar=='\n') { if (lastCharIndex > 0 && getValue().charAt(lastCharIndex - 1) == '\r') { // Remove \r\n setValue(getValue().substring(0, lastCharIndex - 1)); } else { // Remove \n setValue(getValue().substring(0, lastCharIndex)); } } else if (lastChar=='\r') { // Very common case of chomp!(noParam) on Mac => No obvious optimzation setValue(getValue().substring(0, lastCharIndex)); } else { // No modifications made return getRuntime().getNil(); } return this; } // Uncommon case of str.chomp!("") not optimized if (separator.length() == 0) { boolean modified = false; while(getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\n') { modified = true; setValue(getValue().substring(0, getValue().length() - 1)); if (getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\r') { setValue(getValue().substring(0, getValue().length() - 1)); } } return modified ? this : getRuntime().getNil(); } // Uncommon case of str.chomp!("xxx") if (getValue().endsWith(separator)) { setValue(getValue().substring(0, getValue().length() - separator.length())); return this; } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return modified ? this : getRuntime().getNil();
if (removeCount == 0) { return getRuntime().getNil(); } getValue().delete(end - removeCount + 1, getValue().length()); return this;
public IRubyObject chomp_bang(IRubyObject[] args) { if (isEmpty()) { return getRuntime().getNil(); } // Separator (a.k.a. $/) can be overriden by the -0 (zero) command line option String separator = (args.length == 0) ? getRuntime().getGlobalVariables().get("$/").asSymbol() : args[0].asSymbol(); if (separator.equals(DEFAULT_RS)) { // Optimized very common case of str.chomp! on Windows (avoid 2 setValue calls) int lastCharIndex = getValue().length() - 1; char lastChar = getValue().charAt(lastCharIndex); if (lastChar=='\n') { if (lastCharIndex > 0 && getValue().charAt(lastCharIndex - 1) == '\r') { // Remove \r\n setValue(getValue().substring(0, lastCharIndex - 1)); } else { // Remove \n setValue(getValue().substring(0, lastCharIndex)); } } else if (lastChar=='\r') { // Very common case of chomp!(noParam) on Mac => No obvious optimzation setValue(getValue().substring(0, lastCharIndex)); } else { // No modifications made return getRuntime().getNil(); } return this; } // Uncommon case of str.chomp!("") not optimized if (separator.length() == 0) { boolean modified = false; while(getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\n') { modified = true; setValue(getValue().substring(0, getValue().length() - 1)); if (getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\r') { setValue(getValue().substring(0, getValue().length() - 1)); } } return modified ? this : getRuntime().getNil(); } // Uncommon case of str.chomp!("xxx") if (getValue().endsWith(separator)) { setValue(getValue().substring(0, getValue().length() - separator.length())); return this; } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
if (getValue().endsWith(separator)) { setValue(getValue().substring(0, getValue().length() - separator.length()));
if (toString().endsWith(separator)) { getValue().delete(getValue().length() - separator.length(), getValue().length());
public IRubyObject chomp_bang(IRubyObject[] args) { if (isEmpty()) { return getRuntime().getNil(); } // Separator (a.k.a. $/) can be overriden by the -0 (zero) command line option String separator = (args.length == 0) ? getRuntime().getGlobalVariables().get("$/").asSymbol() : args[0].asSymbol(); if (separator.equals(DEFAULT_RS)) { // Optimized very common case of str.chomp! on Windows (avoid 2 setValue calls) int lastCharIndex = getValue().length() - 1; char lastChar = getValue().charAt(lastCharIndex); if (lastChar=='\n') { if (lastCharIndex > 0 && getValue().charAt(lastCharIndex - 1) == '\r') { // Remove \r\n setValue(getValue().substring(0, lastCharIndex - 1)); } else { // Remove \n setValue(getValue().substring(0, lastCharIndex)); } } else if (lastChar=='\r') { // Very common case of chomp!(noParam) on Mac => No obvious optimzation setValue(getValue().substring(0, lastCharIndex)); } else { // No modifications made return getRuntime().getNil(); } return this; } // Uncommon case of str.chomp!("") not optimized if (separator.length() == 0) { boolean modified = false; while(getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\n') { modified = true; setValue(getValue().substring(0, getValue().length() - 1)); if (getValue().length() > 0 && getValue().charAt(getValue().length() - 1) == '\r') { setValue(getValue().substring(0, getValue().length() - 1)); } } return modified ? this : getRuntime().getNil(); } // Uncommon case of str.chomp!("xxx") if (getValue().endsWith(separator)) { setValue(getValue().substring(0, getValue().length() - separator.length())); return this; } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
String newStr = getChop(); if (newStr == null) { return dup(); } return newString(newStr);
RubyString newString = (RubyString) dup(); newString.chop_bang(); return newString;
public IRubyObject chop() { String newStr = getChop(); if (newStr == null) { return dup(); } return newString(newStr); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
String newStr = getChop(); if (newStr == null) { return getRuntime().getNil(); } setValue(newStr);
int end = getValue().length() - 1; if (end < 0) { return getRuntime().getNil(); } if (getValue().charAt(end) == '\n') { if (end > 0 && getValue().charAt(end-1) == '\r') { end--; } } getValue().delete(end, getValue().length());
public IRubyObject chop_bang() { String newStr = getChop(); if (newStr == null) { return getRuntime().getNil(); } setValue(newStr); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
int cmp = getValue().compareTo(other.getValue());
int cmp = toString().compareTo(other.toString());
public int cmp(RubyString other) { int cmp = getValue().compareTo(other.getValue()); return cmp < 0 ? -1 : cmp > 0 ? 1 : 0; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
if ((other instanceof RubyFixnum) && ((RubyFixnum) other).getLongValue() < 256) {
if ((other instanceof RubyFixnum) && ((RubyFixnum) other).getLongValue() < 256) {
public RubyString concat(IRubyObject other) { if ((other instanceof RubyFixnum) && ((RubyFixnum) other).getLongValue() < 256) { return cat("" + (char) ((RubyFixnum) other).getLongValue()); } return append(other); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
specs[i] = stringValue(args[i]).getValue();
specs[i] = stringValue(args[i]).toString();
public IRubyObject count(IRubyObject[] args) { int argc = checkArgumentCount(args, 1, -1); String[] specs = new String[argc]; for (int i = 0; i < argc; i++) { specs[i] = stringValue(args[i]).getValue(); } String table = setupTable(specs); int count = 0; for (int j = 0; j < getValue().length(); j++) { if (table.indexOf(getValue().charAt(j)) != -1) { count++; } } return getRuntime().newFixnum(count); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
if (newStr.equals(getValue())) {
if (sameAs(newStr)) {
public IRubyObject delete_bang(IRubyObject[] args) { String newStr = getDelete(args); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
setValue(newStr);
setValue(new StringBuffer(newStr));
public IRubyObject delete_bang(IRubyObject[] args) { String newStr = getDelete(args); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return newString(getValue().toLowerCase());
return newString(toString().toLowerCase());
public RubyString downcase() { return newString(getValue().toLowerCase()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
String result = getValue().toLowerCase(); if (result.equals(getValue())) {
String result = toString().toLowerCase(); if (sameAs(result)) {
public IRubyObject downcase_bang() { String result = getValue().toLowerCase(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
setValue(result);
setValue(new StringBuffer(result));
public IRubyObject downcase_bang() { String result = getValue().toLowerCase(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return newString(getValue()).infectBy(this);
return newString(toString()).infectBy(this);
public IRubyObject dup() { return newString(getValue()).infectBy(this); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
sep = RubyRegexp.quote(stringValue(args[0]).getValue());
sep = RubyRegexp.quote(stringValue(args[0]).toString());
public IRubyObject each_line(IRubyObject[] args) { int strLen = getValue().length(); if (strLen == 0) { return this; } String sep; if (checkArgumentCount(args, 0, 1) == 1) { sep = RubyRegexp.quote(stringValue(args[0]).getValue()); } else { sep = RubyRegexp.quote(getRuntime().getGlobalVariables().get("$/").asSymbol()); } if (sep == null) { sep = "(?:\\n|\\r\\n?)"; } else if (sep.length() == 0) { sep = "(?:\\n|\\r\\n?){2,}"; } RubyRegexp pat = RubyRegexp.newRegexp(getRuntime(), ".*?" + sep, RubyRegexp.RE_OPTION_MULTILINE, null); int start = 0; while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getCurrentContext().getBackref(); getRuntime().getCurrentContext().yield(md.group(0)); start = md.matchEndPosition(); } if (start < strLen) { getRuntime().getCurrentContext().yield(substr(start, strLen - start)); } return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
int pos = (invertOK && spec.startsWith("^")) ? 1 : 0;
int pos = (invertOK && spec.charAt(0) == '^') ? 1 : 0;
private static String expandTemplate(String spec, boolean invertOK) { int len = spec.length(); if (len <= 1) { return spec; } StringBuffer sbuf = new StringBuffer(); int pos = (invertOK && spec.startsWith("^")) ? 1 : 0; while (pos < len) { char c1 = spec.charAt(pos), c2; if (pos + 2 < len && spec.charAt(pos + 1) == '-') { if ((c2 = spec.charAt(pos + 2)) > c1) { for (int i = c1; i <= c2; i++) { sbuf.append((char) i); } } pos += 3; continue; } sbuf.append(c1); pos++; } return sbuf.toString(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
specs[i] = stringValue(args[i]).getValue();
specs[i] = stringValue(args[i]).toString();
private String getDelete(IRubyObject[] args) { int argc = checkArgumentCount(args, 1, -1); String[] specs = new String[argc]; for (int i = 0; i < argc; i++) { specs[i] = stringValue(args[i]).getValue(); } String table = setupTable(specs); int strLen = getValue().length(); StringBuffer sbuf = new StringBuffer(strLen); char c; for (int j = 0; j < strLen; j++) { c = getValue().charAt(j); if (table.indexOf(c) == -1) { sbuf.append(c); } } return sbuf.toString(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
private String getSqueeze(IRubyObject[] args) {
private StringBuffer getSqueeze(IRubyObject[] args) {
private String getSqueeze(IRubyObject[] args) { int argc = args.length; String[] specs = null; if (argc > 0) { specs = new String[argc]; for (int i = 0; i < argc; i++) { specs[i] = stringValue(args[i]).getValue(); } } String table = specs == null ? null : setupTable(specs); int strLen = getValue().length(); if (strLen <= 1) { return getValue(); } StringBuffer sbuf = new StringBuffer(strLen); char c1 = getValue().charAt(0); sbuf.append(c1); char c2; for (int j = 1; j < strLen; j++) { c2 = getValue().charAt(j); if (c2 == c1 && (table == null || table.indexOf(c2) != -1)) { continue; } sbuf.append(c2); c1 = c2; } return sbuf.toString(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
specs[i] = stringValue(args[i]).getValue();
specs[i] = stringValue(args[i]).toString();
private String getSqueeze(IRubyObject[] args) { int argc = args.length; String[] specs = null; if (argc > 0) { specs = new String[argc]; for (int i = 0; i < argc; i++) { specs[i] = stringValue(args[i]).getValue(); } } String table = specs == null ? null : setupTable(specs); int strLen = getValue().length(); if (strLen <= 1) { return getValue(); } StringBuffer sbuf = new StringBuffer(strLen); char c1 = getValue().charAt(0); sbuf.append(c1); char c2; for (int j = 1; j < strLen; j++) { c2 = getValue().charAt(j); if (c2 == c1 && (table == null || table.indexOf(c2) != -1)) { continue; } sbuf.append(c2); c1 = c2; } return sbuf.toString(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return sbuf.toString();
return sbuf;
private String getSqueeze(IRubyObject[] args) { int argc = args.length; String[] specs = null; if (argc > 0) { specs = new String[argc]; for (int i = 0; i < argc; i++) { specs[i] = stringValue(args[i]).getValue(); } } String table = specs == null ? null : setupTable(specs); int strLen = getValue().length(); if (strLen <= 1) { return getValue(); } StringBuffer sbuf = new StringBuffer(strLen); char c1 = getValue().charAt(0); sbuf.append(c1); char c2; for (int j = 1; j < strLen; j++) { c2 = getValue().charAt(j); if (c2 == c1 && (table == null || table.indexOf(c2) != -1)) { continue; } sbuf.append(c2); c1 = c2; } return sbuf.toString(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
public String getValue() {
public StringBuffer getValue() {
public String getValue() { return value; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return getRuntime().newFixnum(getValue().hashCode());
return getRuntime().newFixnum(toString().hashCode());
public RubyFixnum hash() { return getRuntime().newFixnum(getValue().hashCode()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return getRuntime().newBoolean(getValue().indexOf(c) != -1);
return getRuntime().newBoolean(toString().indexOf(c) != -1);
public RubyBoolean include(IRubyObject obj) { if (obj instanceof RubyFixnum) { char c = (char) RubyNumeric.fix2int(obj); return getRuntime().newBoolean(getValue().indexOf(c) != -1); } String str = stringValue(obj).getValue(); return getRuntime().newBoolean(getValue().indexOf(str) != -1); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
String str = stringValue(obj).getValue();
String str = stringValue(obj).toString();
public RubyBoolean include(IRubyObject obj) { if (obj instanceof RubyFixnum) { char c = (char) RubyNumeric.fix2int(obj); return getRuntime().newBoolean(getValue().indexOf(c) != -1); } String str = stringValue(obj).getValue(); return getRuntime().newBoolean(getValue().indexOf(str) != -1); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return RubySymbol.newSymbol(getRuntime(), getValue());
return RubySymbol.newSymbol(getRuntime(), toString());
public RubySymbol intern() { return RubySymbol.newSymbol(getRuntime(), getValue()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
if (newValue.getValue().equals(getValue())) {
if (sameAs(newValue)) {
public IRubyObject lstrip_bang() { RubyString newValue = (RubyString) lstrip(); if (newValue.getValue().equals(getValue())) { return getRuntime().getNil(); } setValue(newValue.getValue()); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
output.dumpString(getValue());
output.dumpString(toString());
public void marshalTo(MarshalStream output) throws java.io.IOException { output.write('"'); output.dumpString(getValue()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return ((RubyRegexp)pattern).search2(getValue());
return ((RubyRegexp)pattern).search2(toString());
public IRubyObject match3(IRubyObject pattern) { if (pattern instanceof RubyRegexp) { return ((RubyRegexp)pattern).search2(getValue()); } else if (pattern instanceof RubyString) { RubyRegexp regexp = RubyRegexp.newRegexp((RubyString) pattern, 0, null); return regexp.search2(getValue()); } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
RubyRegexp regexp = RubyRegexp.newRegexp((RubyString) pattern, 0, null); return regexp.search2(getValue());
RubyRegexp regexp = RubyRegexp.newRegexp((RubyString) pattern, 0, null); return regexp.search2(toString());
public IRubyObject match3(IRubyObject pattern) { if (pattern instanceof RubyRegexp) { return ((RubyRegexp)pattern).search2(getValue()); } else if (pattern instanceof RubyString) { RubyRegexp regexp = RubyRegexp.newRegexp((RubyString) pattern, 0, null); return regexp.search2(getValue()); } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
String str = getValue().trim();
String str = toString().trim();
public IRubyObject oct() { if (isEmpty()) { return getRuntime().newFixnum(0); } int base = 8; String str = getValue().trim(); int pos = (str.charAt(0) == '-' || str.charAt(0) == '+') ? 1 : 0; if (str.indexOf("0x") == pos || str.indexOf("0X") == pos) { base = 16; } else if (str.indexOf("0b") == pos || str.indexOf("0B") == pos) { base = 2; } return RubyNumeric.str2inum(getRuntime(), this, base); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
RubyString str = stringValue(other); if (this == other || getValue().equals(str.getValue())) {
RubyString newValue = stringValue(other); if (this == other || sameAs(newValue)) {
public RubyString replace(IRubyObject other) { RubyString str = stringValue(other); if (this == other || getValue().equals(str.getValue())) { return this; } setValue(str.getValue()); return (RubyString) infectBy(str); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
setValue(str.getValue()); return (RubyString) infectBy(str);
setValue(new StringBuffer(newValue.getValue().toString())); return (RubyString) infectBy(newValue);
public RubyString replace(IRubyObject other) { RubyString str = stringValue(other); if (this == other || getValue().equals(str.getValue())) { return this; } setValue(str.getValue()); return (RubyString) infectBy(str); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
StringBuffer sb = new StringBuffer(getValue()); sb.reverse(); return newString(sb.toString());
return newString(toString()).reverse_bang();
public RubyString reverse() { StringBuffer sb = new StringBuffer(getValue()); sb.reverse(); return newString(sb.toString()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
StringBuffer sb = new StringBuffer(getValue()); sb.reverse(); setValue(sb.toString());
getValue().reverse();
public RubyString reverse_bang() { StringBuffer sb = new StringBuffer(getValue()); sb.reverse(); setValue(sb.toString()); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
if (newValue.getValue().equals(getValue())) {
if (sameAs(newValue)) {
public IRubyObject rstrip_bang() { RubyString newValue = (RubyString) rstrip(); if (newValue.getValue().equals(getValue())) { return getRuntime().getNil(); } setValue(newValue.getValue()); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
RubyRegexp pat = RubyRegexp.regexpValue(arg);
RubyRegexp pattern = RubyRegexp.regexpValue(arg);
public IRubyObject scan(IRubyObject arg) { RubyRegexp pat = RubyRegexp.regexpValue(arg); int start = 0; if (!getRuntime().getCurrentContext().isBlockGiven()) { RubyArray ary = getRuntime().newArray(); while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getCurrentContext().getBackref(); if (md.getSize() == 1) { ary.append(md.group(0)); } else { ary.append(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) { start++; } else { start = md.matchEndPosition(); } } return ary; } while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getCurrentContext().getBackref(); if (md.getSize() == 1) { getRuntime().getCurrentContext().yield(md.group(0)); } else { getRuntime().getCurrentContext().yield(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) { start++; } else { start = md.matchEndPosition(); } } return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
while (pat.search(this, start) != -1) {
while (pattern.search(this, start) != -1) {
public IRubyObject scan(IRubyObject arg) { RubyRegexp pat = RubyRegexp.regexpValue(arg); int start = 0; if (!getRuntime().getCurrentContext().isBlockGiven()) { RubyArray ary = getRuntime().newArray(); while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getCurrentContext().getBackref(); if (md.getSize() == 1) { ary.append(md.group(0)); } else { ary.append(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) { start++; } else { start = md.matchEndPosition(); } } return ary; } while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getCurrentContext().getBackref(); if (md.getSize() == 1) { getRuntime().getCurrentContext().yield(md.group(0)); } else { getRuntime().getCurrentContext().yield(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) { start++; } else { start = md.matchEndPosition(); } } return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
if (md.getSize() == 1) { ary.append(md.group(0)); } else { ary.append(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) {
ary.append(md.getSize() == 1 ? md.group(0) : md.subseq(1, md.getSize())); if (md.matchEndPosition() == md.matchStartPosition()) {
public IRubyObject scan(IRubyObject arg) { RubyRegexp pat = RubyRegexp.regexpValue(arg); int start = 0; if (!getRuntime().getCurrentContext().isBlockGiven()) { RubyArray ary = getRuntime().newArray(); while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getCurrentContext().getBackref(); if (md.getSize() == 1) { ary.append(md.group(0)); } else { ary.append(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) { start++; } else { start = md.matchEndPosition(); } } return ary; } while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getCurrentContext().getBackref(); if (md.getSize() == 1) { getRuntime().getCurrentContext().yield(md.group(0)); } else { getRuntime().getCurrentContext().yield(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) { start++; } else { start = md.matchEndPosition(); } } return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
while (pat.search(this, start) != -1) {
while (pattern.search(this, start) != -1) {
public IRubyObject scan(IRubyObject arg) { RubyRegexp pat = RubyRegexp.regexpValue(arg); int start = 0; if (!getRuntime().getCurrentContext().isBlockGiven()) { RubyArray ary = getRuntime().newArray(); while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getCurrentContext().getBackref(); if (md.getSize() == 1) { ary.append(md.group(0)); } else { ary.append(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) { start++; } else { start = md.matchEndPosition(); } } return ary; } while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getCurrentContext().getBackref(); if (md.getSize() == 1) { getRuntime().getCurrentContext().yield(md.group(0)); } else { getRuntime().getCurrentContext().yield(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) { start++; } else { start = md.matchEndPosition(); } } return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
if (md.getSize() == 1) { getRuntime().getCurrentContext().yield(md.group(0)); } else { getRuntime().getCurrentContext().yield(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) {
getRuntime().getCurrentContext().yield(md.getSize() == 1 ? md.group(0) : md.subseq(1, md.getSize())); if (md.matchEndPosition() == md.matchStartPosition()) {
public IRubyObject scan(IRubyObject arg) { RubyRegexp pat = RubyRegexp.regexpValue(arg); int start = 0; if (!getRuntime().getCurrentContext().isBlockGiven()) { RubyArray ary = getRuntime().newArray(); while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getCurrentContext().getBackref(); if (md.getSize() == 1) { ary.append(md.group(0)); } else { ary.append(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) { start++; } else { start = md.matchEndPosition(); } } return ary; } while (pat.search(this, start) != -1) { RubyMatchData md = (RubyMatchData) getRuntime().getCurrentContext().getBackref(); if (md.getSize() == 1) { getRuntime().getCurrentContext().yield(md.group(0)); } else { getRuntime().getCurrentContext().yield(md.subseq(1, md.getSize())); } if (md.matchEndPosition() == md.matchStartPosition()) { start++; } else { start = md.matchEndPosition(); } } return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
public void setValue(String value) {
public void setValue(StringBuffer value) {
public void setValue(String value) { this.value = value; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
boolean invert = specs[i].length() > 1 && specs[i].startsWith("^");
boolean invert = specs[i].length() > 1 && specs[i].charAt(0) == '^';
private String setupTable(String[] specs) { int[] table = new int[256]; int numSets = 0; for (int i = 0; i < specs.length; i++) { String template = expandTemplate(specs[i], true); boolean invert = specs[i].length() > 1 && specs[i].startsWith("^"); for (int j = 0; j < 256; j++) { if (template.indexOf(j) != -1) { table[j] += invert ? -1 : 1; } } numSets += invert ? 0 : 1; } StringBuffer sbuf = new StringBuffer(); for (int k = 0; k < 256; k++) { if (table[k] == numSets) { sbuf.append((char) k); } } return sbuf.toString(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return new Split(getRuntime(), this.getValue(), args).results();
return new Split(getRuntime(), this.toString(), args).results();
public RubyArray split(IRubyObject[] args) { return new Split(getRuntime(), this.getValue(), args).results(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return newString(getSqueeze(args)).infectBy(this);
return newString(getSqueeze(args).toString()).infectBy(this);
public IRubyObject squeeze(IRubyObject[] args) { return newString(getSqueeze(args)).infectBy(this); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
String newStr = getSqueeze(args); if (newStr.equals(getValue())) {
StringBuffer newStr = getSqueeze(args); if (sameAs(newStr)) {
public IRubyObject squeeze_bang(IRubyObject[] args) { String newStr = getSqueeze(args); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return newString(getValue().trim());
return newString(toString().trim());
public IRubyObject strip() { if (isEmpty()) { return dup(); } return newString(getValue().trim()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
String newStr = getValue().trim(); if (newStr.equals(getValue())) {
String newStr = toString().trim(); if (sameAs(newStr)) {
public IRubyObject strip_bang() { if (isEmpty()) { return getRuntime().getNil(); } String newStr = getValue().trim(); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
setValue(newStr);
setValue(new StringBuffer(newStr));
public IRubyObject strip_bang() { if (isEmpty()) { return getRuntime().getNil(); } String newStr = getValue().trim(); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
int strLen = getValue().length(); if (len < 0 || beg > strLen) {
int length = getValue().length(); if (len < 0 || beg > length) {
private IRubyObject substr(int beg, int len) { int strLen = getValue().length(); if (len < 0 || beg > strLen) { return getRuntime().getNil(); } if (beg < 0) { beg += strLen; if (beg < 0) { return getRuntime().getNil(); } } int end = Math.min(strLen, beg + len); return newString(getValue().substring(beg, end)).infectBy(this); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
beg += strLen;
beg += length;
private IRubyObject substr(int beg, int len) { int strLen = getValue().length(); if (len < 0 || beg > strLen) { return getRuntime().getNil(); } if (beg < 0) { beg += strLen; if (beg < 0) { return getRuntime().getNil(); } } int end = Math.min(strLen, beg + len); return newString(getValue().substring(beg, end)).infectBy(this); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
int end = Math.min(strLen, beg + len);
int end = Math.min(length, beg + len);
private IRubyObject substr(int beg, int len) { int strLen = getValue().length(); if (len < 0 || beg > strLen) { return getRuntime().getNil(); } if (beg < 0) { beg += strLen; if (beg < 0) { return getRuntime().getNil(); } } int end = Math.min(strLen, beg + len); return newString(getValue().substring(beg, end)).infectBy(this); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return succ(false);
return ((RubyString) dup()).succ_bang();
public IRubyObject succ() { return succ(false); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return succ(true);
if (getValue().length() == 0) { return this; } StringBuffer sbuf = getValue(); boolean alnumSeen = false; int pos = -1; char c = 0; char n = 0; for (int i = sbuf.length() - 1; i >= 0; i--) { c = sbuf.charAt(i); if (isAlnum(c)) { alnumSeen = true; if ((isDigit(c) && c < '9') || (isLower(c) && c < 'z') || (isUpper(c) && c < 'Z')) { sbuf.setCharAt(i, (char) (c + 1)); pos = -1; break; } pos = i; n = isDigit(c) ? '0' : (isLower(c) ? 'a' : 'A'); sbuf.setCharAt(i, n); } } if (!alnumSeen) { for (int i = sbuf.length() - 1; i >= 0; i--) { c = sbuf.charAt(i); if (c < 0xff) { sbuf.setCharAt(i, (char) (c + 1)); pos = -1; break; } pos = i; n = '\u0001'; sbuf.setCharAt(i, '\u0000'); } } if (pos > -1) { sbuf.insert(pos, isDigit(c) ? '1' : (isLower(c) ? 'a' : 'A')); } return this;
public IRubyObject succ_bang() { return succ(true); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
char[] characters = getValue().toCharArray();
char[] characters = toString().toCharArray();
public RubyInteger sum(IRubyObject[] args) { long bitSize = 16; if (args.length > 0) { bitSize = ((RubyInteger) args[0].convertType(RubyInteger.class, "Integer", "to_i")).getLongValue(); } int result = 0; char[] characters = getValue().toCharArray(); for (int i = 0; i < characters.length; i++) { result += characters[i]; } return getRuntime().newFixnum(result % (2 * bitSize - 1)); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
RubyString newString = newString(getValue());
RubyString newString = newString(toString());
public RubyString swapcase() { RubyString newString = newString(getValue()); IRubyObject swappedString = newString.swapcase_bang(); return (RubyString) (swappedString.isNil() ? newString : swappedString); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
char[] chars = getValue().toCharArray(); StringBuffer sb = new StringBuffer(chars.length);
StringBuffer string = getValue(); int length = string.length();
public IRubyObject swapcase_bang() { char[] chars = getValue().toCharArray(); StringBuffer sb = new StringBuffer(chars.length); boolean changesMade = false; for (int i = 0; i < chars.length; i++) { if (!Character.isLetter(chars[i])) { sb.append(chars[i]); } else if (Character.isLowerCase(chars[i])) { changesMade = true; sb.append(Character.toUpperCase(chars[i])); } else { changesMade = true; sb.append(Character.toLowerCase(chars[i])); } } if (changesMade) { setValue(sb.toString()); return this; } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
for (int i = 0; i < chars.length; i++) { if (!Character.isLetter(chars[i])) { sb.append(chars[i]); } else if (Character.isLowerCase(chars[i])) { changesMade = true; sb.append(Character.toUpperCase(chars[i])); } else { changesMade = true; sb.append(Character.toLowerCase(chars[i])); } } if (changesMade) { setValue(sb.toString()); return this; }
for (int i = 0; i < length; i++) { char c = string.charAt(i); if (!Character.isLetter(c)) { continue; } else if (Character.isLowerCase(c)) { changesMade = true; string.setCharAt(i, Character.toUpperCase(c)); } else { changesMade = true; string.setCharAt(i, Character.toLowerCase(c)); } }
public IRubyObject swapcase_bang() { char[] chars = getValue().toCharArray(); StringBuffer sb = new StringBuffer(chars.length); boolean changesMade = false; for (int i = 0; i < chars.length; i++) { if (!Character.isLetter(chars[i])) { sb.append(chars[i]); } else if (Character.isLowerCase(chars[i])) { changesMade = true; sb.append(Character.toUpperCase(chars[i])); } else { changesMade = true; sb.append(Character.toLowerCase(chars[i])); } } if (changesMade) { setValue(sb.toString()); return this; } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return getRuntime().getNil();
return changesMade ? this : getRuntime().getNil();
public IRubyObject swapcase_bang() { char[] chars = getValue().toCharArray(); StringBuffer sb = new StringBuffer(chars.length); boolean changesMade = false; for (int i = 0; i < chars.length; i++) { if (!Character.isLetter(chars[i])) { sb.append(chars[i]); } else if (Character.isLowerCase(chars[i])) { changesMade = true; sb.append(Character.toUpperCase(chars[i])); } else { changesMade = true; sb.append(Character.toLowerCase(chars[i])); } } if (changesMade) { setValue(sb.toString()); return this; } return getRuntime().getNil(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return stringToBytes(getValue());
return stringToBytes(toString());
public byte[] toByteArray() { return stringToBytes(getValue()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return getValue();
return value.toString();
public String toString() { return getValue(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
return RubySymbol.newSymbol(getRuntime(), getValue());
return RubySymbol.newSymbol(getRuntime(), toString());
public RubySymbol to_sym() { return RubySymbol.newSymbol(getRuntime(), getValue()); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java
String srchSpec = search.convertToString().getValue();
String srchSpec = search.convertToString().toString();
private String tr(IRubyObject search, IRubyObject replace, boolean squeeze) { String srchSpec = search.convertToString().getValue(); String srch = expandTemplate(srchSpec, true); if (srchSpec.startsWith("^")) { StringBuffer sbuf = new StringBuffer(256); for (int i = 0; i < 256; i++) { char c = (char) i; if (srch.indexOf(c) == -1) { sbuf.append(c); } } srch = sbuf.toString(); } String repl = expandTemplate(replace.convertToString().getValue(), false); int strLen = getValue().length(); if (strLen == 0 || srch.length() == 0) { return getValue(); } int repLen = repl.length(); StringBuffer sbuf = new StringBuffer(strLen); int last = -1; for (int i = 0; i < strLen; i++) { char cs = getValue().charAt(i); int pos = srch.indexOf(cs); if (pos == -1) { sbuf.append(cs); last = -1; } else if (repLen > 0) { char cr = repl.charAt(Math.min(pos, repLen - 1)); if (squeeze && cr == last) { continue; } sbuf.append(cr); last = cr; } } return sbuf.toString(); }
50661 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50661/9f2efc63a858fa0507245b207025eab027840a04/RubyString.java/clean/src/org/jruby/RubyString.java