bugged
stringlengths
6
599k
fixed
stringlengths
6
40.8M
__index_level_0__
int64
0
3.24M
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; }
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; }
3,230,429
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; }
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(buffer); return this; }
3,230,430
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); }
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); }
3,230,431
public RubyString cat(String str) { setValue(getValue() + str); return this; }
public RubyString cat(String str) { setValue(getValue() + str); return this; }
3,230,432
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()); }
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()); }
3,230,433
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()); }
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()); }
3,230,434
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(); }
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(); }
3,230,436
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(); }
publicIRubyObjectchomp_bang(IRubyObject[]args){if(isEmpty()){returngetRuntime().getNil();}//Separator(a.k.a.$/)canbeoverridenbythe-0(zero)commandlineoptionStringseparator=(args.length==0)?getRuntime().getGlobalVariables().get("$/").asSymbol():args[0].asSymbol();if(separator.equals(DEFAULT_RS)){//Optimizedverycommoncaseofstr.chomp!onWindows(avoid2setValuecalls)intlastCharIndex=getValue().length()-1;charlastChar=getValue().charAt(lastCharIndex);if(lastChar=='\n'){if(lastCharIndex>0&&getValue().charAt(lastCharIndex-1)=='\r'){//Remove\r\nsetValue(getValue().substring(0,lastCharIndex-1));}else{//Remove\nsetValue(getValue().substring(0,lastCharIndex));}}elseif(lastChar=='\r'){//Verycommoncaseofchomp!(noParam)onMac=>NoobviousoptimzationsetValue(getValue().substring(0,lastCharIndex));}else{//NomodificationsmadereturngetRuntime().getNil();}returnthis;}//Uncommoncaseofstr.chomp!("")notoptimizedif(separator.length()==0){booleanmodified=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));}}returnmodified?this:getRuntime().getNil();}//Uncommoncaseofstr.chomp!("xxx")if(getValue().endsWith(separator)){setValue(getValue().substring(0,getValue().length()-separator.length()));returnthis;} returngetRuntime().getNil(); }
3,230,437
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(); }
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(); }
3,230,438
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(); }
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)); } } if (removeCount == 0) { return getRuntime().getNil(); } getValue().delete(end - removeCount + 1, getValue().length()); return this; } // Uncommon case of str.chomp!("xxx") if (getValue().endsWith(separator)) { setValue(getValue().substring(0, getValue().length() - separator.length())); return this; } return getRuntime().getNil(); }
3,230,439
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(); }
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(); }
3,230,440
public IRubyObject chop() { String newStr = getChop(); if (newStr == null) { return dup(); } return newString(newStr); }
public IRubyObject chop() { String newStr = getChop(); if (newStr == null) { return dup(); } return newString(newStr); }
3,230,441
public IRubyObject chop_bang() { String newStr = getChop(); if (newStr == null) { return getRuntime().getNil(); } setValue(newStr); return this; }
public IRubyObject chop_bang() { String newStr = getChop(); if (newStr == null) { return getRuntime().getNil(); } setValue(newStr); return this; }
3,230,442
public int cmp(RubyString other) { int cmp = getValue().compareTo(other.getValue()); return cmp < 0 ? -1 : cmp > 0 ? 1 : 0; }
public int cmp(RubyString other) { int cmp = getValue().compareTo(other.getValue()); return cmp < 0 ? -1 : cmp > 0 ? 1 : 0; }
3,230,443
public RubyString concat(IRubyObject other) { if ((other instanceof RubyFixnum) && ((RubyFixnum) other).getLongValue() < 256) { return cat("" + (char) ((RubyFixnum) other).getLongValue()); } return append(other); }
public RubyString concat(IRubyObject other) { if ((other instanceof RubyFixnum) && ((RubyFixnum) other).getLongValue() < 256) { return cat("" + (char) ((RubyFixnum) other).getLongValue()); } return append(other); }
3,230,444
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); }
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); }
3,230,445
public IRubyObject delete_bang(IRubyObject[] args) { String newStr = getDelete(args); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
public IRubyObject delete_bang(IRubyObject[] args) { String newStr = getDelete(args); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
3,230,446
public IRubyObject delete_bang(IRubyObject[] args) { String newStr = getDelete(args); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
public IRubyObject delete_bang(IRubyObject[] args) { String newStr = getDelete(args); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
3,230,447
public RubyString downcase() { return newString(getValue().toLowerCase()); }
public RubyString downcase() { return newString(getValue().toLowerCase()); }
3,230,448
public IRubyObject downcase_bang() { String result = getValue().toLowerCase(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
public IRubyObject downcase_bang() { String result = getValue().toLowerCase(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
3,230,449
public IRubyObject downcase_bang() { String result = getValue().toLowerCase(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
public IRubyObject downcase_bang() { String result = getValue().toLowerCase(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
3,230,450
public IRubyObject dup() { return newString(getValue()).infectBy(this); }
public IRubyObject dup() { return newString(getValue()).infectBy(this); }
3,230,451
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; }
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; }
3,230,452
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(); }
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(); }
3,230,453
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(); }
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(); }
3,230,454
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(); }
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(); }
3,230,455
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(); }
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(); }
3,230,456
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(); }
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(); }
3,230,457
public String getValue() { return value; }
public String getValue() { return value; }
3,230,458
public RubyFixnum hash() { return getRuntime().newFixnum(getValue().hashCode()); }
public RubyFixnum hash() { return getRuntime().newFixnum(toString().hashCode()); }
3,230,459
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); }
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); }
3,230,460
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); }
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); }
3,230,461
public RubySymbol intern() { return RubySymbol.newSymbol(getRuntime(), getValue()); }
public RubySymbol intern() { return RubySymbol.newSymbol(getRuntime(), getValue()); }
3,230,462
public IRubyObject lstrip_bang() { RubyString newValue = (RubyString) lstrip(); if (newValue.getValue().equals(getValue())) { return getRuntime().getNil(); } setValue(newValue.getValue()); return this; }
public IRubyObject lstrip_bang() { RubyString newValue = (RubyString) lstrip(); if (newValue.getValue().equals(getValue())) { return getRuntime().getNil(); } setValue(newValue.getValue()); return this; }
3,230,463
public void marshalTo(MarshalStream output) throws java.io.IOException { output.write('"'); output.dumpString(getValue()); }
public void marshalTo(MarshalStream output) throws java.io.IOException { output.write('"'); output.dumpString(getValue()); }
3,230,464
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(); }
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(); }
3,230,465
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(); }
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(); }
3,230,466
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); }
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); }
3,230,467
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); }
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); }
3,230,468
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); }
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); }
3,230,469
public RubyString reverse() { StringBuffer sb = new StringBuffer(getValue()); sb.reverse(); return newString(sb.toString()); }
public RubyString reverse() { StringBuffer sb = new StringBuffer(getValue()); sb.reverse(); return newString(sb.toString()); }
3,230,470
public RubyString reverse_bang() { StringBuffer sb = new StringBuffer(getValue()); sb.reverse(); setValue(sb.toString()); return this; }
public RubyString reverse_bang() { StringBuffer sb = new StringBuffer(getValue()); sb.reverse(); setValue(sb.toString()); return this; }
3,230,471
public IRubyObject rstrip_bang() { RubyString newValue = (RubyString) rstrip(); if (newValue.getValue().equals(getValue())) { return getRuntime().getNil(); } setValue(newValue.getValue()); return this; }
public IRubyObject rstrip_bang() { RubyString newValue = (RubyString) rstrip(); if (newValue.getValue().equals(getValue())) { return getRuntime().getNil(); } setValue(newValue.getValue()); return this; }
3,230,472
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; }
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; }
3,230,473
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; }
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; }
3,230,474
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; }
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; }
3,230,475
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; }
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; }
3,230,476
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; }
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; }
3,230,477
public void setValue(String value) { this.value = value; }
public void setValue(String value) { this.value = value; }
3,230,478
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(); }
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(); }
3,230,479
public RubyArray split(IRubyObject[] args) { return new Split(getRuntime(), this.getValue(), args).results(); }
public RubyArray split(IRubyObject[] args) { return new Split(getRuntime(), this.getValue(), args).results(); }
3,230,480
public IRubyObject squeeze(IRubyObject[] args) { return newString(getSqueeze(args)).infectBy(this); }
public IRubyObject squeeze(IRubyObject[] args) { return newString(getSqueeze(args)).infectBy(this); }
3,230,481
public IRubyObject squeeze_bang(IRubyObject[] args) { String newStr = getSqueeze(args); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
public IRubyObject squeeze_bang(IRubyObject[] args) { String newStr = getSqueeze(args); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
3,230,482
public IRubyObject strip() { if (isEmpty()) { return dup(); } return newString(getValue().trim()); }
public IRubyObject strip() { if (isEmpty()) { return dup(); } return newString(getValue().trim()); }
3,230,483
public IRubyObject strip_bang() { if (isEmpty()) { return getRuntime().getNil(); } String newStr = getValue().trim(); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
public IRubyObject strip_bang() { if (isEmpty()) { return getRuntime().getNil(); } String newStr = getValue().trim(); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
3,230,484
public IRubyObject strip_bang() { if (isEmpty()) { return getRuntime().getNil(); } String newStr = getValue().trim(); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
public IRubyObject strip_bang() { if (isEmpty()) { return getRuntime().getNil(); } String newStr = getValue().trim(); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
3,230,485
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); }
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); }
3,230,486
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); }
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); }
3,230,487
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); }
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); }
3,230,488
public IRubyObject succ() { return succ(false); }
public IRubyObject succ() { return succ(false); }
3,230,489
public IRubyObject succ_bang() { return succ(true); }
public IRubyObject succ_bang() { return succ(true); }
3,230,490
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)); }
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 = toString().toCharArray(); for (int i = 0; i < characters.length; i++) { result += characters[i]; } return getRuntime().newFixnum(result % (2 * bitSize - 1)); }
3,230,491
public RubyString swapcase() { RubyString newString = newString(getValue()); IRubyObject swappedString = newString.swapcase_bang(); return (RubyString) (swappedString.isNil() ? newString : swappedString); }
public RubyString swapcase() { RubyString newString = newString(getValue()); IRubyObject swappedString = newString.swapcase_bang(); return (RubyString) (swappedString.isNil() ? newString : swappedString); }
3,230,492
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(); }
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(); }
3,230,493
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(); }
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(); }
3,230,494
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(); }
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(); }
3,230,495
public byte[] toByteArray() { return stringToBytes(getValue()); }
public byte[] toByteArray() { return stringToBytes(getValue()); }
3,230,496
public String toString() { return getValue(); }
public String toString() { return getValue(); }
3,230,497
public RubySymbol to_sym() { return RubySymbol.newSymbol(getRuntime(), getValue()); }
public RubySymbol to_sym() { return RubySymbol.newSymbol(getRuntime(), getValue()); }
3,230,498
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(); }
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(); }
3,230,499
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(); }
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(); }
3,230,500
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(); }
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(); }
3,230,501
public IRubyObject tr_bang(IRubyObject search, IRubyObject replace) { String newStr = tr(search, replace, false); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
public IRubyObject tr_bang(IRubyObject search, IRubyObject replace) { String newStr = tr(search, replace, false); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
3,230,502
public IRubyObject tr_bang(IRubyObject search, IRubyObject replace) { String newStr = tr(search, replace, false); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
public IRubyObject tr_bang(IRubyObject search, IRubyObject replace) { String newStr = tr(search, replace, false); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
3,230,503
public IRubyObject tr_s_bang(IRubyObject search, IRubyObject replace) { String newStr = tr(search, replace, true); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
public IRubyObject tr_s_bang(IRubyObject search, IRubyObject replace) { String newStr = tr(search, replace, true); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
3,230,504
public IRubyObject tr_s_bang(IRubyObject search, IRubyObject replace) { String newStr = tr(search, replace, true); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
public IRubyObject tr_s_bang(IRubyObject search, IRubyObject replace) { String newStr = tr(search, replace, true); if (newStr.equals(getValue())) { return getRuntime().getNil(); } setValue(newStr); return this; }
3,230,505
public RubyArray unpack(IRubyObject obj) { return Pack.unpack(this.getValue(), stringValue(obj)); }
public RubyArray unpack(IRubyObject obj) { return Pack.unpack(this.toString(), stringValue(obj)); }
3,230,506
public RubyString upcase() { return newString(getValue().toUpperCase()); }
public RubyString upcase() { return newString(getValue().toUpperCase()); }
3,230,507
public IRubyObject upcase_bang() { String result = getValue().toUpperCase(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
public IRubyObject upcase_bang() { String result = getValue().toUpperCase(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
3,230,508
public IRubyObject upcase_bang() { String result = getValue().toUpperCase(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
public IRubyObject upcase_bang() { String result = getValue().toUpperCase(); if (result.equals(getValue())) { return getRuntime().getNil(); } setValue(result); return this; }
3,230,509
public static void initOperatorTable(Ruby ruby) { ruby.setOperatorTable(new RubyOperatorEntry[] { new RubyOperatorEntry(ruby, Token.tDOT2, ".."), new RubyOperatorEntry(ruby, Token.tDOT3, "..."), new RubyOperatorEntry(ruby, '+', "+"), new RubyOperatorEntry(ruby, '-', "-"), new RubyOperatorEntry(ruby, '+', "+(binary)"), new RubyOperatorEntry(ruby, '-', "-(binary)"), new RubyOperatorEntry(ruby, '*', "*"), new RubyOperatorEntry(ruby, '/', "/"), new RubyOperatorEntry(ruby, '%', "%"), new RubyOperatorEntry(ruby, Token.tPOW, "**"), new RubyOperatorEntry(ruby, Token.tUPLUS, "+@"), new RubyOperatorEntry(ruby, Token.tUMINUS, "-@"), new RubyOperatorEntry(ruby, Token.tUPLUS, "+(unary)"), new RubyOperatorEntry(ruby, Token.tUMINUS, "-(unary)"), new RubyOperatorEntry(ruby, '|', "|"), new RubyOperatorEntry(ruby, '^', "^"), new RubyOperatorEntry(ruby, '&', "&"), new RubyOperatorEntry(ruby, Token.tCMP, "<=>"), new RubyOperatorEntry(ruby, '>', ">"), new RubyOperatorEntry(ruby, Token.tGEQ, ">="), new RubyOperatorEntry(ruby, '<', "<"), new RubyOperatorEntry(ruby, Token.tLEQ, "<="), new RubyOperatorEntry(ruby, Token.tEQ, "=="), new RubyOperatorEntry(ruby, Token.tEQQ, "==="), new RubyOperatorEntry(ruby, Token.tNEQ, "!="), new RubyOperatorEntry(ruby, Token.tMATCH, "=~"), new RubyOperatorEntry(ruby, Token.tNMATCH, "!~"), new RubyOperatorEntry(ruby, '!', "!"), new RubyOperatorEntry(ruby, '~', "~"), new RubyOperatorEntry(ruby, '!', "!(unary)"), new RubyOperatorEntry(ruby, '~', "~(unary)"), new RubyOperatorEntry(ruby, '!', "!@"), new RubyOperatorEntry(ruby, '~', "~@"), new RubyOperatorEntry(ruby, Token.tAREF, "[]"), new RubyOperatorEntry(ruby, Token.tASET, "[]="), new RubyOperatorEntry(ruby, Token.tLSHFT, "<<"), new RubyOperatorEntry(ruby, Token.tRSHFT, ">>"), new RubyOperatorEntry(ruby, Token.tCOLON2, "::"), new RubyOperatorEntry(ruby, '`', "`"), // new RubyOperatorEntry(this, 0, null), }); }
public static void initOperatorTable(Ruby ruby) { ruby.setOperatorTable(new RubyOperatorEntry[] { new RubyOperatorEntry(ruby, Token.tDOT2, ".."), new RubyOperatorEntry(ruby, Token.tDOT3, "..."), new RubyOperatorEntry(ruby, '+', "+"), new RubyOperatorEntry(ruby, '-', "-"), new RubyOperatorEntry(ruby, '+', "+(binary)"), new RubyOperatorEntry(ruby, '-', "-(binary)"), new RubyOperatorEntry(ruby, '*', "*"), new RubyOperatorEntry(ruby, '/', "/"), new RubyOperatorEntry(ruby, '%', "%"), new RubyOperatorEntry(ruby, Token.tPOW, "**"), new RubyOperatorEntry(ruby, Token.tUPLUS, "+@"), new RubyOperatorEntry(ruby, Token.tUMINUS, "-@"), new RubyOperatorEntry(ruby, Token.tUPLUS, "+(unary)"), new RubyOperatorEntry(ruby, Token.tUMINUS, "-(unary)"), new RubyOperatorEntry(ruby, '|', "|"), new RubyOperatorEntry(ruby, '^', "^"), new RubyOperatorEntry(ruby, '&', "&"), new RubyOperatorEntry(ruby, Token.tCMP, "<=>"), new RubyOperatorEntry(ruby, '>', ">"), new RubyOperatorEntry(ruby, Token.tGEQ, ">="), new RubyOperatorEntry(ruby, '<', "<"), new RubyOperatorEntry(ruby, Token.tLEQ, "<="), new RubyOperatorEntry(ruby, Token.tEQ, "=="), new RubyOperatorEntry(ruby, Token.tEQQ, "==="), new RubyOperatorEntry(ruby, Token.tNEQ, "!="), new RubyOperatorEntry(ruby, Token.tMATCH, "=~"), new RubyOperatorEntry(ruby, Token.tNMATCH, "!~"), new RubyOperatorEntry(ruby, '!', "!"), new RubyOperatorEntry(ruby, '~', "~"), new RubyOperatorEntry(ruby, '!', "!(unary)"), new RubyOperatorEntry(ruby, '~', "~(unary)"), new RubyOperatorEntry(ruby, '!', "!@"), new RubyOperatorEntry(ruby, '~', "~@"), new RubyOperatorEntry(ruby, Token.tAREF, "[]"), new RubyOperatorEntry(ruby, Token.tASET, "[]="), new RubyOperatorEntry(ruby, Token.tLSHFT, "<<"), new RubyOperatorEntry(ruby, Token.tRSHFT, ">>"), new RubyOperatorEntry(ruby, Token.tCOLON2, "::"), new RubyOperatorEntry(ruby, '`', "`"), // new RubyOperatorEntry(this, 0, null), }); }
3,230,510
public void testThreeDigitOctal() { verifyTranslation("\\0177", "\\177",false); verifyTranslation("\\0277", "\\277",false); verifyTranslation("\\0377", "\\377",false); verifyTranslation("\\477", "\\477",false); }
public void testThreeDigitOctal() { verifyTranslation("\\0177", "\\177",false); verifyTranslation("\\0277", "\\277",false); verifyTranslation("\\0377", "\\377",false); verifyTranslation("\\477", "\\477",false); }
3,230,511
String translatePattern(String regex, boolean commentsAllowed) { regex = COMMENT_PATTERN.matcher(regex).replaceAll(""); regex = HEX_SINGLE_DIGIT_PATTERN.matcher(regex).replaceAll("\\\\"+"x0$1"); regex = OCTAL_THREE_DIGIT_PATTERN.matcher(regex).replaceAll("\\\\"+"0$1"); regex = OCTAL_MISSING_ZERO_PATTERN.matcher(regex).replaceAll("\\\\"+"0$1"); if (commentsAllowed) { regex = SPACE_IN_CHARACTER_CLASS_PATTERN.matcher(regex).replaceAll("$1\\\\x20$2"); regex = SHARP_IN_CHARACTER_CLASS_PATTERN.matcher(regex).replaceAll("$1\\\\x23$2"); } return regex; }
String translatePattern(String regex, boolean commentsAllowed) { regex = COMMENT_PATTERN.matcher(regex).replaceAll(""); regex = HEX_SINGLE_DIGIT_PATTERN.matcher(regex).replaceAll("\\\\"+"x0$1"); regex = OCTAL_THREE_DIGIT_PATTERN.matcher(regex).replaceAll("\\\\"+"0$1"); regex = OCTAL_MISSING_ZERO_PATTERN.matcher(regex).replaceAll("\\\\"+"0$1"); if (commentsAllowed) { regex = SPACE_IN_CHARACTER_CLASS_PATTERN.matcher(regex).replaceAll("$1\\\\x20$2"); regex = SHARP_IN_CHARACTER_CLASS_PATTERN.matcher(regex).replaceAll("$1\\\\x23$2"); } return regex; }
3,230,512
public final Object getProperty(final Object[] names) throws PropertyException, ContextException { if (_bean == null) { Object ret = getLocal(names); if (ret == null) { ret = getTool(names); } return ret; } else { return PropertyOperator.getProperty(this,_bean,names); } }
public final Object getProperty(final Object[] names) throws PropertyException, ContextException { if (_bean == null) { Object ret = getLocal(names); if (ret == null) { ret = getTool(names); } return ret; } else { return PropertyOperator.getProperty(this,_bean,names); } }
3,230,513
public final Object getProperty(final Object[] names) throws PropertyException, ContextException { if (_bean == null) { Object ret = getLocal(names); if (ret == null) { ret = getTool(names); } return ret; } else { return PropertyOperator.getProperty(this,_bean,names); } }
public final Object getProperty(final Object[] names) throws PropertyException, ContextException { if (_bean == null) { Object ret = getLocal(names); if (ret == null) { ret = getTool(names); } return ret; } else { ret = PropertyOperator.getProperty(this,_bean,names); } }
3,230,514
public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof JTabbedPane) { JTabbedPane tab = (JTabbedPane) e.getSource(); Component c = tab.getSelectedComponent(); int index = tab.getSelectedIndex(); if (c instanceof DOInfo) { DOInfo info = (DOInfo) c; if (info.getInfoType() == DOInfo.INFO_TYPE) model.retrieveChannelsData(); } view.setEditorSelectedPane(index); if (index == EditorUI.PROPERTIES_INDEX) { int subIndex = model.getSelectedSubPane(); if (subIndex == EditorUI.ANNOTATION_SUB_INDEX) retrieveAnnotations(); else if (subIndex == EditorUI.CLASSIFICATION_SUB_INDEX) { if (!(model.isClassificationLoaded())) loadClassifications(); } } } else { view.onStateChanged(model.getState() == Editor.READY); } }
public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof JTabbedPane) { JTabbedPane tab = (JTabbedPane) e.getSource(); Component c = tab.getSelectedComponent(); int index = tab.getSelectedIndex(); if (c instanceof DOInfo) { DOInfo info = (DOInfo) c; if (info.getInfoType() == DOInfo.INFO_TYPE) model.retrieveChannelsData(); } view.setEditorSelectedPane(index); if (index == EditorUI.PROPERTIES_INDEX) { int subIndex = model.getSelectedSubPane(); if (subIndex == EditorUI.ANNOTATION_SUB_INDEX) retrieveAnnotations(); else if (subIndex == EditorUI.CLASSIFICATION_SUB_INDEX) { if (!(model.isClassificationLoaded())) loadClassifications(); } } } else { view.onStateChanged(model.getState() == Editor.READY); } }
3,230,516
public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof JTabbedPane) { JTabbedPane tab = (JTabbedPane) e.getSource(); Component c = tab.getSelectedComponent(); int index = tab.getSelectedIndex(); if (c instanceof DOInfo) { DOInfo info = (DOInfo) c; if (info.getInfoType() == DOInfo.INFO_TYPE) model.retrieveChannelsData(); } view.setEditorSelectedPane(index); if (index == EditorUI.PROPERTIES_INDEX) { int subIndex = model.getSelectedSubPane(); if (subIndex == EditorUI.ANNOTATION_SUB_INDEX) retrieveAnnotations(); else if (subIndex == EditorUI.CLASSIFICATION_SUB_INDEX) { if (!(model.isClassificationLoaded())) loadClassifications(); } } } else { view.onStateChanged(model.getState() == Editor.READY); } }
public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof JTabbedPane) { JTabbedPane tab = (JTabbedPane) e.getSource(); Component c = tab.getSelectedComponent(); int index = tab.getSelectedIndex(); if (c instanceof DOInfo) { DOInfo info = (DOInfo) c; if (info.getInfoType() == DOInfo.INFO_TYPE) model.retrieveChannelsData(); } view.setEditorSelectedPane(index); if (index == EditorUI.PROPERTIES_INDEX) { int subIndex = model.getSelectedSubPane(); if (subIndex == EditorUI.ANNOTATION_SUB_INDEX) retrieveAnnotations(); else if (subIndex == EditorUI.CLASSIFICATION_SUB_INDEX) { if (!(model.isClassificationLoaded())) loadClassifications(); } } } else { view.onStateChanged(model.getState() == Editor.READY); } }
3,230,517
public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof JTabbedPane) { JTabbedPane tab = (JTabbedPane) e.getSource(); Component c = tab.getSelectedComponent(); int index = tab.getSelectedIndex(); if (c instanceof DOInfo) { DOInfo info = (DOInfo) c; if (info.getInfoType() == DOInfo.INFO_TYPE) model.retrieveChannelsData(); } view.setEditorSelectedPane(index); if (index == EditorUI.PROPERTIES_INDEX) { int subIndex = model.getSelectedSubPane(); if (subIndex == EditorUI.ANNOTATION_SUB_INDEX) retrieveAnnotations(); else if (subIndex == EditorUI.CLASSIFICATION_SUB_INDEX) { if (!(model.isClassificationLoaded())) loadClassifications(); } } } else { view.onStateChanged(model.getState() == Editor.READY); } }
public void stateChanged(ChangeEvent e) { if (e.getSource() instanceof JTabbedPane) { JTabbedPane tab = (JTabbedPane) e.getSource(); Component c = tab.getSelectedComponent(); int index = tab.getSelectedIndex(); if (c instanceof DOInfo) { DOInfo info = (DOInfo) c; if (info.getInfoType() == DOInfo.INFO_TYPE) model.retrieveChannelsData(); } view.setEditorSelectedPane(index); if (index == EditorUI.PROPERTIES_INDEX) { int subIndex = model.getSelectedSubPane(); if (subIndex == EditorUI.ANNOTATION_SUB_INDEX) retrieveAnnotations(); else if (subIndex == EditorUI.CLASSIFICATION_SUB_INDEX) { if (!(model.isClassificationLoaded())) loadClassifications(); } } } else { view.onStateChanged(model.getState() == Editor.READY); } }
3,230,518
public String toString(){ return "AnalysisChain"+(analysisChainId==null ? ":Hash"+this.hashCode() : ":"+analysisChainId); }
public String toString(){ return "AnalysisChain"+(analysisChainId==null ? ":Hash_"+this.hashCode() : ":Id_"+analysisChainId); }
3,230,519
public RubyObject funcall(RubyId mid, RubyObject[] args) { return getRubyClass().call(this, mid, args, 1); }
public RubyObject funcall(RubyId mid, RubyObject[] args) { return funcall(mid, new RubyPointer(args)); }
3,230,520
public RubyObject funcall3(RubyId mid, RubyObject[] args) { return getRubyClass().call(this, mid, args, 0); }
public RubyObject funcall3(RubyId mid, RubyPointer args) { return getRubyClass().call(this, mid, args, 0); }
3,230,521
private void makeProperLink(GraphLayoutNode node,LayoutLink link,int i, HashSet newLinks) { // we know node is at i. GraphLayoutNode to = (GraphLayoutNode) link.getToNode(); //System.err.println("..link to "+to.getName()); int toLayer = to.getLayer(); if (toLayer == (i-1)) { // layer is correct newLinks.add(link); } else { // create new dummy node DummyNode dummy = new DummyNode(); //System.err.println("node is "+dummy); LayoutLinkData semantiLayoutLinkData = link.getSemanticLink(); // make this node point to "to" LayoutLink dummyOutLink = new LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); // make node point to new node LayoutLink newOutLink = new LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); // add new link to links. newLinks.add(newOutLink); // remove successor from node // don't need to do this, as we set the successors of this node // en masse // adjust predecessors for to to.removePredLink(link); to.addPredLink(dummyOutLink); // add dummy to next layer. //System.err.println("adding a dummy node at layer"+(i-1)); //System.err.println("node is "+dummy); layering.addToLayer(i-1,dummy); // adjust the semantic link to put dummy in between "from" and "to". // invariant is that "from" is directly before "to", so just put it //after "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
privateSystem.err.println("..link to "+to.getName()); voidSystem.err.println("..link to "+to.getName()); makeProperLink(GraphLayoutNodeSystem.err.println("..link to "+to.getName()); node,LayoutLinkSystem.err.println("..link to "+to.getName()); link,intSystem.err.println("..link to "+to.getName()); i, HashSetSystem.err.println("..link to "+to.getName()); newLinks)System.err.println("..link to "+to.getName()); { //System.err.println("..link to "+to.getName()); weSystem.err.println("..link to "+to.getName()); knowSystem.err.println("..link to "+to.getName()); nodeSystem.err.println("..link to "+to.getName()); isSystem.err.println("..link to "+to.getName()); atSystem.err.println("..link to "+to.getName()); i. GraphLayoutNodeSystem.err.println("..link to "+to.getName()); toSystem.err.println("..link to "+to.getName()); =System.err.println("..link to "+to.getName()); (GraphLayoutNode)System.err.println("..link to "+to.getName()); link.getToNode(); //System.err.println("..linkSystem.err.println("..link to "+to.getName()); toSystem.err.println("..link to "+to.getName()); "+to.getName()); intSystem.err.println("..link to "+to.getName()); toLayerSystem.err.println("..link to "+to.getName()); =System.err.println("..link to "+to.getName()); to.getLayer(); ifSystem.err.println("..link to "+to.getName()); (toLayerSystem.err.println("..link to "+to.getName()); ==System.err.println("..link to "+to.getName()); (i-1))System.err.println("..link to "+to.getName()); { //System.err.println("..link to "+to.getName()); layerSystem.err.println("..link to "+to.getName()); isSystem.err.println("..link to "+to.getName()); correct newLinks.add(link); } elseSystem.err.println("..link to "+to.getName()); { //System.err.println("..link to "+to.getName()); createSystem.err.println("..link to "+to.getName()); newSystem.err.println("..link to "+to.getName()); dummySystem.err.println("..link to "+to.getName()); node DummyNodeSystem.err.println("..link to "+to.getName()); dummySystem.err.println("..link to "+to.getName()); =System.err.println("..link to "+to.getName()); newSystem.err.println("..link to "+to.getName()); DummyNode(); //System.err.println("nodeSystem.err.println("..link to "+to.getName()); isSystem.err.println("..link to "+to.getName()); "+dummy); LayoutLinkDataSystem.err.println("..link to "+to.getName()); semantiLayoutLinkDataSystem.err.println("..link to "+to.getName()); =System.err.println("..link to "+to.getName()); link.getSemanticLink(); //System.err.println("..link to "+to.getName()); makeSystem.err.println("..link to "+to.getName()); thisSystem.err.println("..link to "+to.getName()); nodeSystem.err.println("..link to "+to.getName()); pointSystem.err.println("..link to "+to.getName()); toSystem.err.println("..link to "+to.getName()); "to" LayoutLinkSystem.err.println("..link to "+to.getName()); dummyOutLinkSystem.err.println("..link to "+to.getName()); =System.err.println("..link to "+to.getName()); newSystem.err.println("..link to "+to.getName()); LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); //System.err.println("..link to "+to.getName()); makeSystem.err.println("..link to "+to.getName()); nodeSystem.err.println("..link to "+to.getName()); pointSystem.err.println("..link to "+to.getName()); toSystem.err.println("..link to "+to.getName()); newSystem.err.println("..link to "+to.getName()); node LayoutLinkSystem.err.println("..link to "+to.getName()); newOutLinkSystem.err.println("..link to "+to.getName()); =System.err.println("..link to "+to.getName()); newSystem.err.println("..link to "+to.getName()); LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); //System.err.println("..link to "+to.getName()); addSystem.err.println("..link to "+to.getName()); newSystem.err.println("..link to "+to.getName()); linkSystem.err.println("..link to "+to.getName()); toSystem.err.println("..link to "+to.getName()); links. newLinks.add(newOutLink); //System.err.println("..link to "+to.getName()); removeSystem.err.println("..link to "+to.getName()); successorSystem.err.println("..link to "+to.getName()); fromSystem.err.println("..link to "+to.getName()); node //System.err.println("..link to "+to.getName()); don'tSystem.err.println("..link to "+to.getName()); needSystem.err.println("..link to "+to.getName()); toSystem.err.println("..link to "+to.getName()); doSystem.err.println("..link to "+to.getName()); this,System.err.println("..link to "+to.getName()); asSystem.err.println("..link to "+to.getName()); weSystem.err.println("..link to "+to.getName()); setSystem.err.println("..link to "+to.getName()); theSystem.err.println("..link to "+to.getName()); successorsSystem.err.println("..link to "+to.getName()); ofSystem.err.println("..link to "+to.getName()); thisSystem.err.println("..link to "+to.getName()); node //System.err.println("..link to "+to.getName()); enSystem.err.println("..link to "+to.getName()); masseSystem.err.println("..link to "+to.getName()); //System.err.println("..link to "+to.getName()); adjustSystem.err.println("..link to "+to.getName()); predecessorsSystem.err.println("..link to "+to.getName()); forSystem.err.println("..link to "+to.getName()); to to.removePredLink(link); to.addPredLink(dummyOutLink); //System.err.println("..link to "+to.getName()); addSystem.err.println("..link to "+to.getName()); dummySystem.err.println("..link to "+to.getName()); toSystem.err.println("..link to "+to.getName()); nextSystem.err.println("..link to "+to.getName()); layer. //System.err.println("addingSystem.err.println("..link to "+to.getName()); aSystem.err.println("..link to "+to.getName()); dummySystem.err.println("..link to "+to.getName()); nodeSystem.err.println("..link to "+to.getName()); atSystem.err.println("..link to "+to.getName()); layer"+(i-1)); //System.err.println("nodeSystem.err.println("..link to "+to.getName()); isSystem.err.println("..link to "+to.getName()); "+dummy); layering.addToLayer(i-1,dummy); //System.err.println("..link to "+to.getName()); adjustSystem.err.println("..link to "+to.getName()); theSystem.err.println("..link to "+to.getName()); semanticSystem.err.println("..link to "+to.getName()); linkSystem.err.println("..link to "+to.getName()); toSystem.err.println("..link to "+to.getName()); putSystem.err.println("..link to "+to.getName()); dummySystem.err.println("..link to "+to.getName()); inSystem.err.println("..link to "+to.getName()); betweenSystem.err.println("..link to "+to.getName()); "from"System.err.println("..link to "+to.getName()); andSystem.err.println("..link to "+to.getName()); "to". //System.err.println("..link to "+to.getName()); invariantSystem.err.println("..link to "+to.getName()); isSystem.err.println("..link to "+to.getName()); thatSystem.err.println("..link to "+to.getName()); "from"System.err.println("..link to "+to.getName()); isSystem.err.println("..link to "+to.getName()); directlySystem.err.println("..link to "+to.getName()); beforeSystem.err.println("..link to "+to.getName()); "to",System.err.println("..link to "+to.getName()); soSystem.err.println("..link to "+to.getName()); justSystem.err.println("..link to "+to.getName()); putSystem.err.println("..link to "+to.getName()); it //afterSystem.err.println("..link to "+to.getName()); "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
3,230,522
private void makeProperLink(GraphLayoutNode node,LayoutLink link,int i, HashSet newLinks) { // we know node is at i. GraphLayoutNode to = (GraphLayoutNode) link.getToNode(); //System.err.println("..link to "+to.getName()); int toLayer = to.getLayer(); if (toLayer == (i-1)) { // layer is correct newLinks.add(link); } else { // create new dummy node DummyNode dummy = new DummyNode(); //System.err.println("node is "+dummy); LayoutLinkData semantiLayoutLinkData = link.getSemanticLink(); // make this node point to "to" LayoutLink dummyOutLink = new LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); // make node point to new node LayoutLink newOutLink = new LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); // add new link to links. newLinks.add(newOutLink); // remove successor from node // don't need to do this, as we set the successors of this node // en masse // adjust predecessors for to to.removePredLink(link); to.addPredLink(dummyOutLink); // add dummy to next layer. //System.err.println("adding a dummy node at layer"+(i-1)); //System.err.println("node is "+dummy); layering.addToLayer(i-1,dummy); // adjust the semantic link to put dummy in between "from" and "to". // invariant is that "from" is directly before "to", so just put it //after "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
private void makeProperLink(GraphLayoutNode node,LayoutLink link,int i, HashSet newLinks) { // we know node is at i. GraphLayoutNode to = (GraphLayoutNode) link.getToNode(); //System.err.println("..link to "+to.getName()); int toLayer = to.getLayer(); if (toLayer == (i-1)) { // layer is correct newLinks.add(link); } else { // create new dummy node DummyNode dummy = new DummyNode(); //System.err.println("node is "+dummy); LayoutLinkData semantiLayoutLinkData = link.getSemanticLink(); // make this node point to "to" LayoutLink dummyOutLink = new LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); // make node point to new node LayoutLink newOutLink = new LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); // add new link to links. newLinks.add(newOutLink); // remove successor from node // don't need to do this, as we set the successors of this node // en masse // adjust predecessors for to to.removePredLink(link); to.addPredLink(dummyOutLink); // add dummy to next layer. //System.err.println("adding a dummy node at layer"+(i-1)); //System.err.println("node is "+dummy); layering.addToLayer(i-1,dummy); // adjust the semantic link to put dummy in between "from" and "to". // invariant is that "from" is directly before "to", so just put it //after "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
3,230,523
private void makeProperLink(GraphLayoutNode node,LayoutLink link,int i, HashSet newLinks) { // we know node is at i. GraphLayoutNode to = (GraphLayoutNode) link.getToNode(); //System.err.println("..link to "+to.getName()); int toLayer = to.getLayer(); if (toLayer == (i-1)) { // layer is correct newLinks.add(link); } else { // create new dummy node DummyNode dummy = new DummyNode(); //System.err.println("node is "+dummy); LayoutLinkData semantiLayoutLinkData = link.getSemanticLink(); // make this node point to "to" LayoutLink dummyOutLink = new LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); // make node point to new node LayoutLink newOutLink = new LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); // add new link to links. newLinks.add(newOutLink); // remove successor from node // don't need to do this, as we set the successors of this node // en masse // adjust predecessors for to to.removePredLink(link); to.addPredLink(dummyOutLink); // add dummy to next layer. //System.err.println("adding a dummy node at layer"+(i-1)); //System.err.println("node is "+dummy); layering.addToLayer(i-1,dummy); // adjust the semantic link to put dummy in between "from" and "to". // invariant is that "from" is directly before "to", so just put it //after "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
private void makeProperLink(GraphLayoutNode node,LayoutLink link,int i, HashSet newLinks) { // we know node is at i. GraphLayoutNode to = (GraphLayoutNode) link.getToNode(); //System.err.println("..link to "+to.getName()); int toLayer = to.getLayer(); if (toLayer == (i-1)) { // layer is correct newLinks.add(link); } else { // create new dummy node DummyNode dummy = new DummyNode(); //System.err.println("node is "+dummy); LayoutLinkData semantiLayoutLinkData = link.getSemanticLink(); // make this node point to "to" LayoutLink dummyOutLink = new LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); // make node point to new node LayoutLink newOutLink = new LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); // add new link to links. newLinks.add(newOutLink); // remove successor from node // don't need to do this, as we set the successors of this node // en masse // adjust predecessors for to to.removePredLink(link); to.addPredLink(dummyOutLink); // add dummy to next layer. //System.err.println("adding a dummy node at layer"+(i-1)); //System.err.println("node is "+dummy); layering.addToLayer(i-1,dummy); // adjust the semantic link to put dummy in between "from" and "to". // invariant is that "from" is directly before "to", so just put it //after "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
3,230,524
private void makeProperLink(GraphLayoutNode node,LayoutLink link,int i, HashSet newLinks) { // we know node is at i. GraphLayoutNode to = (GraphLayoutNode) link.getToNode(); //System.err.println("..link to "+to.getName()); int toLayer = to.getLayer(); if (toLayer == (i-1)) { // layer is correct newLinks.add(link); } else { // create new dummy node DummyNode dummy = new DummyNode(); //System.err.println("node is "+dummy); LayoutLinkData semantiLayoutLinkData = link.getSemanticLink(); // make this node point to "to" LayoutLink dummyOutLink = new LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); // make node point to new node LayoutLink newOutLink = new LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); // add new link to links. newLinks.add(newOutLink); // remove successor from node // don't need to do this, as we set the successors of this node // en masse // adjust predecessors for to to.removePredLink(link); to.addPredLink(dummyOutLink); // add dummy to next layer. //System.err.println("adding a dummy node at layer"+(i-1)); //System.err.println("node is "+dummy); layering.addToLayer(i-1,dummy); // adjust the semantic link to put dummy in between "from" and "to". // invariant is that "from" is directly before "to", so just put it //after "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
private void makeProperLink(GraphLayoutNode node,LayoutLink link,int i, HashSet newLinks) { // we know node is at i. GraphLayoutNode to = (GraphLayoutNode) link.getToNode(); //System.err.println("..link to "+to.getName()); int toLayer = to.getLayer(); if (toLayer == (i-1)) { // layer is correct newLinks.add(link); } else { // create new dummy node DummyNode dummy = new DummyNode(); //System.err.println("node is "+dummy); LayoutLinkData semantiLayoutLinkData = link.getSemanticLink(); // make this node point to "to" LayoutLink dummyOutLink = new LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); // make node point to new node LayoutLink newOutLink = new LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); // add new link to links. newLinks.add(newOutLink); // remove successor from node // don't need to do this, as we set the successors of this node // en masse // adjust predecessors for to to.removePredLink(link); to.addPredLink(dummyOutLink); // add dummy to next layer. //System.err.println("adding a dummy node at layer"+(i-1)); //System.err.println("node is "+dummy); layering.addToLayer(i-1,dummy); // adjust the semantic link to put dummy in between "from" and "to". // invariant is that "from" is directly before "to", so just put it //after "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
3,230,525
private void makeProperLink(GraphLayoutNode node,LayoutLink link,int i, HashSet newLinks) { // we know node is at i. GraphLayoutNode to = (GraphLayoutNode) link.getToNode(); //System.err.println("..link to "+to.getName()); int toLayer = to.getLayer(); if (toLayer == (i-1)) { // layer is correct newLinks.add(link); } else { // create new dummy node DummyNode dummy = new DummyNode(); //System.err.println("node is "+dummy); LayoutLinkData semantiLayoutLinkData = link.getSemanticLink(); // make this node point to "to" LayoutLink dummyOutLink = new LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); // make node point to new node LayoutLink newOutLink = new LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); // add new link to links. newLinks.add(newOutLink); // remove successor from node // don't need to do this, as we set the successors of this node // en masse // adjust predecessors for to to.removePredLink(link); to.addPredLink(dummyOutLink); // add dummy to next layer. //System.err.println("adding a dummy node at layer"+(i-1)); //System.err.println("node is "+dummy); layering.addToLayer(i-1,dummy); // adjust the semantic link to put dummy in between "from" and "to". // invariant is that "from" is directly before "to", so just put it //after "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
private void makeProperLink(GraphLayoutNode node,LayoutLink link,int i, HashSet newLinks) { // we know node is at i. GraphLayoutNode to = (GraphLayoutNode) link.getToNode(); //System.err.println("..link to "+to.getName()); int toLayer = to.getLayer(); if (toLayer == (i-1)) { // layer is correct newLinks.add(link); } else { // create new dummy node DummyNode dummy = new DummyNode(); //System.err.println("node is "+dummy); LayoutLinkData semantiLayoutLinkData = link.getSemanticLink(); // make this node point to "to" LayoutLink dummyOutLink = new LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); // make node point to new node LayoutLink newOutLink = new LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); // add new link to links. newLinks.add(newOutLink); // remove successor from node // don't need to do this, as we set the successors of this node // en masse // adjust predecessors for to to.removePredLink(link); to.addPredLink(dummyOutLink); // add dummy to next layer. //System.err.println("adding a dummy node at layer"+(i-1)); //System.err.println("node is "+dummy); layering.addToLayer(i-1,dummy); // adjust the semantic link to put dummy in between "from" and "to". // invariant is that "from" is directly before "to", so just put it //after "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
3,230,526
private void makeProperLink(GraphLayoutNode node,LayoutLink link,int i, HashSet newLinks) { // we know node is at i. GraphLayoutNode to = (GraphLayoutNode) link.getToNode(); //System.err.println("..link to "+to.getName()); int toLayer = to.getLayer(); if (toLayer == (i-1)) { // layer is correct newLinks.add(link); } else { // create new dummy node DummyNode dummy = new DummyNode(); //System.err.println("node is "+dummy); LayoutLinkData semantiLayoutLinkData = link.getSemanticLink(); // make this node point to "to" LayoutLink dummyOutLink = new LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); // make node point to new node LayoutLink newOutLink = new LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); // add new link to links. newLinks.add(newOutLink); // remove successor from node // don't need to do this, as we set the successors of this node // en masse // adjust predecessors for to to.removePredLink(link); to.addPredLink(dummyOutLink); // add dummy to next layer. //System.err.println("adding a dummy node at layer"+(i-1)); //System.err.println("node is "+dummy); layering.addToLayer(i-1,dummy); // adjust the semantic link to put dummy in between "from" and "to". // invariant is that "from" is directly before "to", so just put it //after "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
private void makeProperLink(GraphLayoutNode node,LayoutLink link,int i, HashSet newLinks) { // we know node is at i. GraphLayoutNode to = (GraphLayoutNode) link.getToNode(); //System.err.println("..link to "+to.getName()); int toLayer = to.getLayer(); if (toLayer == (i-1)) { // layer is correct newLinks.add(link); } else { // create new dummy node DummyNode dummy = new DummyNode(); //System.err.println("node is "+dummy); LayoutLinkData semantiLayoutLinkData = link.getSemanticLink(); // make this node point to "to" LayoutLink dummyOutLink = new LayoutLink(semantiLayoutLinkData,dummy,to); dummy.addSuccLink(dummyOutLink); // make node point to new node LayoutLink newOutLink = new LayoutLink(semantiLayoutLinkData,node,dummy); dummy.addPredLink(newOutLink); // add new link to links. newLinks.add(newOutLink); // remove successor from node // don't need to do this, as we set the successors of this node // en masse // adjust predecessors for to to.removePredLink(link); to.addPredLink(dummyOutLink); // add dummy to next layer. //System.err.println("adding a dummy node at layer"+(i-1)); //System.err.println("node is "+dummy); layering.addToLayer(i-1,dummy); // adjust the semantic link to put dummy in between "from" and "to". // invariant is that "from" is directly before "to", so just put it //after "from" semantiLayoutLinkData.addIntermediate(node,dummy); } }
3,230,527
public void write(Writer out, Context context) throws InvalidContextException, IOException { // now clobber values outside the loop: // Map listMap = new HashMap(); // listMap.include(context); Object list = _list; if (_macro) { while (list instanceof Macro) { list = ((Macro) list).evaluate(context); } } Iterator iter; try { iter = PropertyOperator.getIterator(list); } catch (Exception e) { throw new InvalidContextException("The object used as the list of values in a foreach statement must have some way of returning a list type, or be a list type itself. See the documentation for PropertyOperator.getIterator() for more details. No such property was found on the supplied object: " + list); } Object listItem; // deals with an empty list substitute appropriate variables and // prints block out once if (iter == null) { listItem = "<!--\n " + _list + ": is empty \n-->"; try { _iterVar.setValue(context, listItem); } catch (InvalidContextException e) { Engine.log.exception(e); Engine.log.error("Unable to resolve list" + _list); out.write("<!--\n Unable to resolve list " + _list + " \n-->"); } _body.write(out, context); // iterates through all items including null ones which will // print error messages } else { while(iter.hasNext()) { if ((listItem = iter.next()) == null) { listItem = "<!--\n " + _list + ": contained a null item \n-->"; } try { _iterVar.setValue(context, listItem); _body.write(out, context); } catch (InvalidContextException e) { Engine.log.exception(e); Engine.log.error("unable to set a list item of list: " + _list); out.write("<!--\n Unable to resolve list " + _list + " \n-->"); } } } }
public void write(Writer out, Context context) throws InvalidContextException, IOException { // now clobber values outside the loop: // Map listMap = new HashMap(); // listMap.include(context); Object list = _list; if (_macro) { while (list instanceof Macro) { list = ((Macro) list).evaluate(context); } } Iterator iter; try { iter = PropertyOperator.getIterator(list); } catch (Exception e) { throw new InvalidContextException("The object used as the list of values in a foreach statement must have some way of returning a list type, or be a list type itself. See the documentation for PropertyOperator.getIterator() for more details. No such property was found on the supplied object: " + list + ": " + e); } Object listItem; // deals with an empty list substitute appropriate variables and // prints block out once if (iter == null) { listItem = "<!--\n " + _list + ": is empty \n-->"; try { _iterVar.setValue(context, listItem); } catch (InvalidContextException e) { Engine.log.exception(e); Engine.log.error("Unable to resolve list" + _list); out.write("<!--\n Unable to resolve list " + _list + " \n-->"); } _body.write(out, context); // iterates through all items including null ones which will // print error messages } else { while(iter.hasNext()) { if ((listItem = iter.next()) == null) { listItem = "<!--\n " + _list + ": contained a null item \n-->"; } try { _iterVar.setValue(context, listItem); _body.write(out, context); } catch (InvalidContextException e) { Engine.log.exception(e); Engine.log.error("unable to set a list item of list: " + _list); out.write("<!--\n Unable to resolve list " + _list + " \n-->"); } } } }
3,230,528
public String toString(){ return "Experimenter"+(attributeId==null ? ":Hash"+this.hashCode() : ":"+attributeId); }
public String toString(){ return "Experimenter"+(attributeId==null ? ":Hash_"+this.hashCode() : ":Id_"+attributeId); }
3,230,529
public static RubyClass createNilClass(Ruby ruby) { RubyClass nilClass = ruby.defineClass("NilClass", ruby.getClasses().getObjectClass()); nilClass.defineMethod("type", CallbackFactory.getSingletonMethod(RubyNil.class, "type")); nilClass.defineMethod("to_i", CallbackFactory.getSingletonMethod(RubyNil.class, "to_i")); nilClass.defineMethod("to_s", CallbackFactory.getSingletonMethod(RubyNil.class, "to_s")); nilClass.defineMethod("to_a", CallbackFactory.getSingletonMethod(RubyNil.class, "to_a")); nilClass.defineMethod("inspect", CallbackFactory.getSingletonMethod(RubyNil.class, "inspect")); nilClass.defineMethod("&", CallbackFactory.getSingletonMethod(RubyNil.class, "op_and", RubyObject.class)); nilClass.defineMethod("|", CallbackFactory.getSingletonMethod(RubyNil.class, "op_or", RubyObject.class)); nilClass.defineMethod("^", CallbackFactory.getSingletonMethod(RubyNil.class, "op_xor", RubyObject.class)); nilClass.defineMethod("nil?", CallbackFactory.getTrueMethod()); nilClass.getRubyClass().undefMethod("new"); ruby.defineGlobalConstant("NIL", ruby.getNil()); return nilClass; }
public static RubyClass createNilClass(Ruby ruby) { RubyClass nilClass = ruby.defineClass("NilClass", ruby.getClasses().getObjectClass()); nilClass.defineMethod("type", CallbackFactory.getSingletonMethod(RubyNil.class, "type")); nilClass.defineMethod("to_i", CallbackFactory.getSingletonMethod(RubyNil.class, "to_i")); nilClass.defineMethod("to_s", CallbackFactory.getSingletonMethod(RubyNil.class, "to_s")); nilClass.defineMethod("to_a", CallbackFactory.getSingletonMethod(RubyNil.class, "to_a")); nilClass.defineMethod("inspect", CallbackFactory.getSingletonMethod(RubyNil.class, "inspect")); nilClass.defineMethod("&", CallbackFactory.getSingletonMethod(RubyNil.class, "op_and", RubyObject.class)); nilClass.defineMethod("|", CallbackFactory.getSingletonMethod(RubyNil.class, "op_or", RubyObject.class)); nilClass.defineMethod("^", CallbackFactory.getSingletonMethod(RubyNil.class, "op_xor", RubyObject.class)); nilClass.defineMethod("nil?", CallbackFactory.getTrueMethod(0)); nilClass.getRubyClass().undefMethod("new"); ruby.defineGlobalConstant("NIL", ruby.getNil()); return nilClass; }
3,230,530