bugged
stringlengths
6
599k
fixed
stringlengths
6
40.8M
__index_level_0__
int64
0
3.24M
public void mousePressed(MouseEvent me) {}
public void mousePressed(MouseEvent me) {}
3,233,970
public RubyBoolean equal(IRubyObject other) { if (other instanceof JavaObject) { return (getValue() != null && getValue().equals(((JavaObject) other).getValue())) ? getRuntime().getTrue() : getRuntime().getFalse(); } return getRuntime().getFalse(); }
public RubyBoolean equal(IRubyObject other) { if (other instanceof JavaObject) { if (getValue() == null && ((JavaObject) other).getValue() == null) { return getRuntime().getTrue(); } return (getValue().equals(((JavaObject) other).getValue())) ? getRuntime().getTrue() : getRuntime().getFalse(); } return getRuntime().getFalse(); }
3,233,971
public RubyFixnum hash() { return RubyFixnum.newFixnum(runtime, value.hashCode()); }
public RubyFixnum hash() { int result; if (value == null) { result = 0; } else { result = value.hashCode(); } return RubyFixnum.newFixnum(runtime, result); }
3,233,972
public RubyString to_s() { return RubyString.newString(getRuntime(), getValue().toString()); }
public RubyString to_s() { String result; if (getValue() == null) { result = "null"; } else { result = getValue().toString(); } return RubyString.newString(getRuntime(), result); }
3,233,973
private void registerPresenceListener() { SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; Transport transport = TransportUtils.getTransport(packet.getFrom()); if (transport != null) { boolean registered = presence != null && presence.getMode() != null; if (presence.getType() == Presence.Type.unavailable) { registered = false; } GatewayButton button = uiMap.get(transport); button.signedIn(registered); } } }, new PacketTypeFilter(Presence.class)); ChatManager chatManager = SparkManager.getChatManager(); chatManager.addContactItemHandler(this); // Iterate through Contacts and check for final ContactList contactList = SparkManager.getWorkspace().getContactList(); for (ContactGroup contactGroup : contactList.getContactGroups()) { for (ContactItem contactItem : contactGroup.getContactItems()) { Presence presence = contactItem.getPresence(); if (presence != null) { String domain = StringUtils.parseServer(presence.getFrom()); Transport transport = TransportUtils.getTransport(domain); if (transport != null) { handlePresence(contactItem, presence); contactGroup.fireContactGroupUpdated(); } } } } SparkManager.getSessionManager().addPresenceListener(new PresenceListener() { public void presenceChanged(Presence presence) { for (Transport transport : TransportUtils.getTransports()) { presence.setTo(transport.getServiceName()); SparkManager.getConnection().sendPacket(presence); } } }); }
private void registerPresenceListener() { SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; Transport transport = TransportUtils.getTransport(packet.getFrom()); if (transport != null) { boolean registered = presence != null && presence.getMode() != null; if (presence.getType() == Presence.Type.unavailable) { registered = false; } GatewayButton button = uiMap.get(transport); button.signedIn(registered); } } }, new PacketTypeFilter(Presence.class)); ChatManager chatManager = SparkManager.getChatManager(); chatManager.addContactItemHandler(this); // Iterate through Contacts and check for final ContactList contactList = SparkManager.getWorkspace().getContactList(); for (ContactGroup contactGroup : contactList.getContactGroups()) { for (ContactItem contactItem : contactGroup.getContactItems()) { Presence presence = contactItem.getPresence(); if (presence != null) { String domain = StringUtils.parseServer(presence.getFrom()); Transport transport = TransportUtils.getTransport(domain); if (transport != null) { handlePresence(contactItem, presence); contactGroup.fireContactGroupUpdated(); } } } } SparkManager.getSessionManager().addPresenceListener(new PresenceListener() { public void presenceChanged(Presence presence) { for (Transport transport : TransportUtils.getTransports()) { presence.setTo(transport.getServiceName()); SparkManager.getConnection().sendPacket(presence); } } }); }
3,233,974
public void presenceChanged(Presence presence) { for (Transport transport : TransportUtils.getTransports()) { presence.setTo(transport.getServiceName()); SparkManager.getConnection().sendPacket(presence); } }
public void presenceChanged(Presence presence) { for (Transport transport : TransportUtils.getTransports()) { presence.setTo(transport.getServiceName()); SparkManager.getConnection().sendPacket(presence); } }
3,233,975
public SortedSet getSourceFiles() { SortedSet sourceFiles = new TreeSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); sourceFiles.addAll(packageData.getChildren()); } return sourceFiles; }
public SortedSet getSourceFiles() { SortedSet sourceFiles = new TreeSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); sourceFiles.addAll(packageData.getChildren()); } return sourceFiles; }
3,233,976
public SortedSet getSourceFiles() { SortedSet sourceFiles = new TreeSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); sourceFiles.addAll(packageData.getChildren()); } return sourceFiles; }
public SortedSet getSourceFiles() { SortedSet sourceFiles = new TreeSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); sourceFiles.addAll(packageData.getChildren()); } return sourceFiles; }
3,233,977
public Collection getSubPackages(String packageName) { Collection subPackages = new HashSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); if (packageData.getName().equals(packageName)) subPackages.add(packageData); } return subPackages; }
public Collection getSubPackages(String packageName) { Collection subPackages = new HashSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); if (packageData.getName().equals(packageName)) subPackages.add(packageData); } return subPackages; }
3,233,978
public Collection getSubPackages(String packageName) { Collection subPackages = new HashSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); if (packageData.getName().equals(packageName)) subPackages.add(packageData); } return subPackages; }
public Collection getSubPackages(String packageName) { Collection subPackages = new HashSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); if (packageData.getName().equals(packageName)) subPackages.add(packageData); } return subPackages; }
3,233,979
public Collection getSubPackages(String packageName) { Collection subPackages = new HashSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); if (packageData.getName().equals(packageName)) subPackages.add(packageData); } return subPackages; }
public Collection getSubPackages(String packageName) { Collection subPackages = new HashSet(); Iterator iter = this.children.values().iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); if (packageData.getName().equals(packageName)) subPackages.add(packageData); } return subPackages; }
3,233,980
public RubyClass newSubClass(String name, RubyModule parent) { return new IOMetaClass(name, this, parent); }
public RubyClass newSubClass(String name, RubyModule parent) { return new IOMetaClass(name, this, parent); }
3,233,982
public ZoomMenu(ImageInspectorManager mng, double magFactor) { setText("Zooming"); manager = new ZoomMenuManager(mng); buildGUI(magFactor); }
public ZoomMenu(ImageInspectorManager mng, double magFactor) { setText("Zooming"); manager = new ZoomMenuManager(mng); buildGUI(magFactor); }
3,233,983
public CategoryLoader(HiViewer viewer, Set categoriesID) { super(viewer); this.categoriesID = categoriesID; }
public CategoryLoader(HiViewer viewer, Set categoriesID, boolean refresh) { super(viewer); this.categoriesID = categoriesID; }
3,233,984
public void handleResult(Object result) { if (viewer.getState() == HiViewer.DISCARDED) return; //Async cancel. viewer.setHierarchyRoots((Set) result, false); }
public void handleResult(Object result) { if (viewer.getState() == HiViewer.DISCARDED) return; //Async cancel. viewer.setHierarchyRoots((Set) result, false, refresh); }
3,233,986
private void afterSave() { // Save all that and go back to AUTO flush. getHibernateTemplate().flush(); // TODO performance? currentSession().setFlushMode(FlushMode.AUTO); // Let's save the event again using a temporary event. Event currentEvent = CurrentDetails.getCreationEvent(); EventType afterSave = new EventType(); afterSave.setValue( "afterSave" ); CurrentDetails.newEvent( afterSave ); getHibernateTemplate().saveOrUpdate( currentEvent ); // Checks. List logs = CurrentDetails.getCreationEvent().collectFromLogs( null ); if (logs.size() > 0) log.error("New logs created on update.afterSave:\n"+logs); // FIXME we shouldn't be updating experimenter etc. here. // Return the previous event. CurrentDetails.setCreationEvent( currentEvent ); // Cleanup filter = null; }
private void afterSave() { // Save all that and go back to AUTO flush. getHibernateTemplate().flush(); // TODO performance? currentSession().setFlushMode(FlushMode.AUTO); // Let's save the event again using a temporary event. Event currentEvent = CurrentDetails.getCreationEvent(); EventType afterSave = new EventType(); afterSave.setValue( "afterSave" ); CurrentDetails.newEvent( afterSave ); getHibernateTemplate().saveOrUpdate( currentEvent ); // Checks. List logs = CurrentDetails.getCreationEvent().collectLogs( null ); if (logs.size() > 0) log.error("New logs created on update.afterSave:\n"+logs); // FIXME we shouldn't be updating experimenter etc. here. // Return the previous event. CurrentDetails.setCreationEvent( currentEvent ); // Cleanup filter = null; }
3,233,987
public RubyNumeric(Ruby ruby, RubyClass rubyClass) { super(ruby, rubyClass); }
public RubyNumeric(Ruby ruby, RubyClass rubyClass) { super(ruby, rubyClass); }
3,233,988
public RubyNumeric abs() { if (funcall("<", RubyFixnum.zero(getRuby())).isTrue()) { return (RubyNumeric)funcall("-@"); } else { return this; } }
public RubyNumeric abs() { if (funcall("<", RubyFixnum.zero(getRuby())).isTrue()) { return (RubyNumeric)funcall("-@"); } else { return this; } }
3,233,989
public RubyInteger ceil() { return RubyFloat.newFloat(getRuby(), getDoubleValue()).ceil(); }
public RubyInteger ceil() { return RubyFloat.newFloat(getRuby(), getDoubleValue()).ceil(); }
3,233,990
public RubyArray coerce(RubyObject num) { RubyNumeric other = numericValue(num); if (getRubyClass() == other.getRubyClass()) { return RubyArray.newArray(getRuby(), this, other); } else { return RubyArray.newArray(getRuby(), Arrays.asList(getCoerce((RubyNumeric)num))); } }
public RubyArray coerce(RubyObject num) { RubyNumeric other = numericValue(num); if (getRubyClass() == other.getRubyClass()) { return RubyArray.newArray(getRuby(), this, other); } else { return RubyArray.newArray(getRuby(), Arrays.asList(getCoerce((RubyNumeric)num))); } }
3,233,991
public static RubyClass createNumericClass(Ruby ruby) { RubyClass numericClass = ruby.defineClass("Numeric", ruby.getClasses().getObjectClass()); numericClass.includeModule(ruby.getClasses().getComparableModule()); numericClass.defineMethod("coerce", CallbackFactory.getMethod(RubyNumeric.class, "coerce", RubyObject.class)); numericClass.defineMethod("clone", CallbackFactory.getMethod(RubyNumeric.class, "rbClone")); numericClass.defineMethod("+@", CallbackFactory.getMethod(RubyNumeric.class, "op_uplus")); numericClass.defineMethod("-@", CallbackFactory.getMethod(RubyNumeric.class, "op_uminus")); numericClass.defineMethod("===", CallbackFactory.getMethod(RubyNumeric.class, "equal", RubyObject.class)); numericClass.defineMethod("eql?", CallbackFactory.getMethod(RubyNumeric.class, "eql", RubyObject.class)); numericClass.defineMethod("divmod", CallbackFactory.getMethod(RubyNumeric.class, "divmod", RubyNumeric.class)); numericClass.defineMethod("modulo", CallbackFactory.getMethod(RubyNumeric.class, "modulo", RubyNumeric.class)); numericClass.defineMethod("remainder", CallbackFactory.getMethod(RubyNumeric.class, "remainder", RubyNumeric.class)); numericClass.defineMethod("abs", CallbackFactory.getMethod(RubyNumeric.class, "abs")); numericClass.defineMethod("integer?", CallbackFactory.getMethod(RubyNumeric.class, "int_p")); numericClass.defineMethod("zero?", CallbackFactory.getMethod(RubyNumeric.class, "zero_p")); numericClass.defineMethod("nonzero?", CallbackFactory.getMethod(RubyNumeric.class, "nonzero_p")); numericClass.defineMethod("floor", CallbackFactory.getMethod(RubyNumeric.class, "floor")); numericClass.defineMethod("ceil", CallbackFactory.getMethod(RubyNumeric.class, "ceil")); numericClass.defineMethod("round", CallbackFactory.getMethod(RubyNumeric.class, "round")); numericClass.defineMethod("truncate", CallbackFactory.getMethod(RubyNumeric.class, "truncate")); return numericClass; }
public static RubyClass createNumericClass(Ruby ruby) { RubyClass numericClass = ruby.defineClass("Numeric", ruby.getClasses().getObjectClass()); numericClass.includeModule(ruby.getClasses().getComparableModule()); numericClass.defineMethod("coerce", CallbackFactory.getMethod(RubyNumeric.class, "coerce", RubyObject.class)); numericClass.defineMethod("clone", CallbackFactory.getMethod(RubyNumeric.class, "rbClone")); numericClass.defineMethod("+@", CallbackFactory.getMethod(RubyNumeric.class, "op_uplus")); numericClass.defineMethod("-@", CallbackFactory.getMethod(RubyNumeric.class, "op_uminus")); numericClass.defineMethod("===", CallbackFactory.getMethod(RubyNumeric.class, "equal", RubyObject.class)); numericClass.defineMethod("eql?", CallbackFactory.getMethod(RubyNumeric.class, "eql", RubyObject.class)); numericClass.defineMethod("divmod", CallbackFactory.getMethod(RubyNumeric.class, "divmod", RubyNumeric.class)); numericClass.defineMethod("modulo", CallbackFactory.getMethod(RubyNumeric.class, "modulo", RubyNumeric.class)); numericClass.defineMethod("remainder", CallbackFactory.getMethod(RubyNumeric.class, "remainder", RubyNumeric.class)); numericClass.defineMethod("abs", CallbackFactory.getMethod(RubyNumeric.class, "abs")); numericClass.defineMethod("integer?", CallbackFactory.getMethod(RubyNumeric.class, "int_p")); numericClass.defineMethod("zero?", CallbackFactory.getMethod(RubyNumeric.class, "zero_p")); numericClass.defineMethod("nonzero?", CallbackFactory.getMethod(RubyNumeric.class, "nonzero_p")); numericClass.defineMethod("floor", CallbackFactory.getMethod(RubyNumeric.class, "floor")); numericClass.defineMethod("ceil", CallbackFactory.getMethod(RubyNumeric.class, "ceil")); numericClass.defineMethod("round", CallbackFactory.getMethod(RubyNumeric.class, "round")); numericClass.defineMethod("truncate", CallbackFactory.getMethod(RubyNumeric.class, "truncate")); return numericClass; }
3,233,992
public static RubyClass createNumericClass(Ruby ruby) { RubyClass numericClass = ruby.defineClass("Numeric", ruby.getClasses().getObjectClass()); numericClass.includeModule(ruby.getClasses().getComparableModule()); numericClass.defineMethod("coerce", CallbackFactory.getMethod(RubyNumeric.class, "coerce", RubyObject.class)); numericClass.defineMethod("clone", CallbackFactory.getMethod(RubyNumeric.class, "rbClone")); numericClass.defineMethod("+@", CallbackFactory.getMethod(RubyNumeric.class, "op_uplus")); numericClass.defineMethod("-@", CallbackFactory.getMethod(RubyNumeric.class, "op_uminus")); numericClass.defineMethod("===", CallbackFactory.getMethod(RubyNumeric.class, "equal", RubyObject.class)); numericClass.defineMethod("eql?", CallbackFactory.getMethod(RubyNumeric.class, "eql", RubyObject.class)); numericClass.defineMethod("divmod", CallbackFactory.getMethod(RubyNumeric.class, "divmod", RubyNumeric.class)); numericClass.defineMethod("modulo", CallbackFactory.getMethod(RubyNumeric.class, "modulo", RubyNumeric.class)); numericClass.defineMethod("remainder", CallbackFactory.getMethod(RubyNumeric.class, "remainder", RubyNumeric.class)); numericClass.defineMethod("abs", CallbackFactory.getMethod(RubyNumeric.class, "abs")); numericClass.defineMethod("integer?", CallbackFactory.getMethod(RubyNumeric.class, "int_p")); numericClass.defineMethod("zero?", CallbackFactory.getMethod(RubyNumeric.class, "zero_p")); numericClass.defineMethod("nonzero?", CallbackFactory.getMethod(RubyNumeric.class, "nonzero_p")); numericClass.defineMethod("floor", CallbackFactory.getMethod(RubyNumeric.class, "floor")); numericClass.defineMethod("ceil", CallbackFactory.getMethod(RubyNumeric.class, "ceil")); numericClass.defineMethod("round", CallbackFactory.getMethod(RubyNumeric.class, "round")); numericClass.defineMethod("truncate", CallbackFactory.getMethod(RubyNumeric.class, "truncate")); return numericClass; }
public static RubyClass createNumericClass(Ruby ruby) { RubyClass numericClass = ruby.defineClass("Numeric", ruby.getClasses().getObjectClass()); numericClass.includeModule(ruby.getClasses().getComparableModule()); numericClass.defineMethod("coerce", CallbackFactory.getMethod(RubyNumeric.class, "coerce", RubyObject.class)); numericClass.defineMethod("clone", CallbackFactory.getMethod(RubyNumeric.class, "rbClone")); numericClass.defineMethod("+@", CallbackFactory.getMethod(RubyNumeric.class, "op_uplus")); numericClass.defineMethod("-@", CallbackFactory.getMethod(RubyNumeric.class, "op_uminus")); numericClass.defineMethod("===", CallbackFactory.getMethod(RubyNumeric.class, "equal", RubyObject.class)); numericClass.defineMethod("eql?", CallbackFactory.getMethod(RubyNumeric.class, "eql", RubyObject.class)); numericClass.defineMethod("divmod", CallbackFactory.getMethod(RubyNumeric.class, "divmod", RubyNumeric.class)); numericClass.defineMethod("modulo", CallbackFactory.getMethod(RubyNumeric.class, "modulo", RubyNumeric.class)); numericClass.defineMethod("remainder", CallbackFactory.getMethod(RubyNumeric.class, "remainder", RubyNumeric.class)); numericClass.defineMethod("abs", CallbackFactory.getMethod(RubyNumeric.class, "abs")); numericClass.defineMethod("integer?", CallbackFactory.getMethod(RubyNumeric.class, "int_p")); numericClass.defineMethod("zero?", CallbackFactory.getMethod(RubyNumeric.class, "zero_p")); numericClass.defineMethod("nonzero?", CallbackFactory.getMethod(RubyNumeric.class, "nonzero_p")); numericClass.defineMethod("floor", CallbackFactory.getMethod(RubyNumeric.class, "floor")); numericClass.defineMethod("ceil", CallbackFactory.getMethod(RubyNumeric.class, "ceil")); numericClass.defineMethod("round", CallbackFactory.getMethod(RubyNumeric.class, "round")); numericClass.defineMethod("truncate", CallbackFactory.getMethod(RubyNumeric.class, "truncate")); return numericClass; }
3,233,993
public RubyArray divmod(RubyNumeric other) { RubyNumeric div = (RubyNumeric)funcall("/", other); if (div instanceof RubyFloat) { double d = Math.floor(((RubyFloat)div).getValue()); if (((RubyFloat)div).getValue() > d) { div = RubyFloat.newFloat(getRuby(), d); } } RubyNumeric mod = (RubyNumeric)funcall("%", other); return RubyArray.newArray(getRuby(), div, mod); }
public RubyArray divmod(RubyNumeric other) { RubyNumeric div = (RubyNumeric)funcall("/", other); if (div instanceof RubyFloat) { double d = Math.floor(((RubyFloat)div).getValue()); if (((RubyFloat)div).getValue() > d) { div = RubyFloat.newFloat(getRuby(), d); } } RubyNumeric mod = (RubyNumeric)funcall("%", other); return RubyArray.newArray(getRuby(), div, mod); }
3,233,994
public RubyBoolean eql(RubyObject other) { if (getRubyClass() != other.getRubyClass()) { return getRuby().getFalse(); } else { return super.equal(other); // +++ rb_equal } }
public RubyBoolean eql(RubyObject other) { if (getRubyClass() != other.getRubyClass()) { return getRuby().getFalse(); } else { return super.equal(other); // +++ rb_equal } }
3,233,995
public RubyBoolean equal(RubyObject other) { return super.equal(other); // +++ rb_equal }
public RubyBoolean equal(RubyObject other) { return super.equal(other); // +++ rb_equal }
3,233,996
public static int fix2int(RubyObject arg) { long val = fix2long(arg); if (val > Integer.MAX_VALUE || val < Integer.MIN_VALUE) { throw new TypeError(arg.getRuby(), "argument value is too big to convert to int"); } return (int)val; }
public static int fix2int(RubyObject arg) { long val = fix2long(arg); if (val > Integer.MAX_VALUE || val < Integer.MIN_VALUE) { throw new TypeError(arg.getRuby(), "argument value is too big to convert to int"); } return (int)val; }
3,233,997
public static long fix2long(RubyObject arg) { if (arg instanceof RubyFixnum) { return ((RubyFixnum)arg).getLongValue(); } throw new TypeError(arg.getRuby(), "argument is not a Fixnum"); }
public static long fix2long(RubyObject arg) { if (arg instanceof RubyFixnum) { return ((RubyFixnum)arg).getLongValue(); } throw new TypeError(arg.getRuby(), "argument is not a Fixnum"); }
3,233,998
public RubyInteger floor() { return RubyFloat.newFloat(getRuby(), getDoubleValue()).floor(); }
public RubyInteger floor() { return RubyFloat.newFloat(getRuby(), getDoubleValue()).floor(); }
3,233,999
public RubyNumeric[] getCoerce(RubyNumeric other) { if (getRubyClass() == other.getRubyClass()) { return new RubyNumeric[] {this, other}; } else { return new RubyNumeric[] {RubyFloat.newFloat(getRuby(), getDoubleValue()), RubyFloat.newFloat(getRuby(), other.getDoubleValue())}; } }
public RubyNumeric[] getCoerce(RubyNumeric other) { if (getRubyClass() == other.getRubyClass()) { return new RubyNumeric[] {this, other}; } else { return new RubyNumeric[] {RubyFloat.newFloat(getRuby(), getDoubleValue()), RubyFloat.newFloat(getRuby(), other.getDoubleValue())}; } }
3,234,000
public RubyBoolean int_p() { return getRuby().getFalse(); }
public RubyBoolean int_p() { return getRuby().getFalse(); }
3,234,001
public RubyNumeric modulo(RubyNumeric other) { return (RubyNumeric)funcall("%", other); }
public RubyNumeric modulo(RubyNumeric other) { return (RubyNumeric)funcall("%", other); }
3,234,002
public RubyObject nonzero_p() { if (funcall("zero?").isTrue()) { return getRuby().getNil(); } return this; }
public RubyObject nonzero_p() { if (funcall("zero?").isTrue()) { return getRuby().getNil(); } return this; }
3,234,003
public static long num2long(RubyObject arg) { if (arg instanceof RubyNumeric) { return ((RubyNumeric)arg).getLongValue(); } throw new TypeError(arg.getRuby(), "argument is not numeric"); }
public static long num2long(RubyObject arg) { if (arg instanceof RubyNumeric) { return ((RubyNumeric)arg).getLongValue(); } throw new TypeError(arg.getRuby(), "argument is not numeric"); }
3,234,004
public static RubyNumeric numericValue(RubyObject arg) { if (!(arg instanceof RubyNumeric)) { throw new TypeError(arg.getRuby(), "argument not numeric"); } return (RubyNumeric)arg; }
public static RubyNumeric numericValue(RubyObject arg) { if (!(arg instanceof RubyNumeric)) { throw new TypeError(arg.getRuby(), "argument not numeric"); } return (RubyNumeric)arg; }
3,234,005
public RubyNumeric op_uminus() { RubyNumeric[] coerce = getCoerce(RubyFixnum.zero(getRuby())); return (RubyNumeric)coerce[1].funcall("-", coerce[0]); }
public RubyNumeric op_uminus() { RubyNumeric[] coerce = getCoerce(RubyFixnum.zero(getRuby())); return (RubyNumeric)coerce[1].funcall("-", coerce[0]); }
3,234,006
public RubyNumeric op_uplus() { return this; }
public RubyNumeric op_uplus() { return this; }
3,234,007
public RubyObject rbClone() { return this; }
public RubyObject rbClone() { return this; }
3,234,008
public RubyNumeric remainder(RubyNumeric other) { RubyNumeric mod = (RubyNumeric)funcall("%", other); final RubyNumeric zero = RubyFixnum.zero(getRuby()); if (funcall("<", zero).isTrue() && other.funcall(">", zero).isTrue() || funcall(">", zero).isTrue() && other.funcall("<", zero).isTrue()) { return (RubyNumeric)mod.funcall("-", other); } return mod; }
public RubyNumeric remainder(RubyNumeric other) { RubyNumeric mod = (RubyNumeric)funcall("%", other); final RubyNumeric zero = RubyFixnum.zero(getRuby()); if (funcall("<", zero).isTrue() && other.funcall(">", zero).isTrue() || funcall(">", zero).isTrue() && other.funcall("<", zero).isTrue()) { return (RubyNumeric)mod.funcall("-", other); } return mod; }
3,234,009
public RubyInteger round() { return RubyFloat.newFloat(getRuby(), getDoubleValue()).round(); }
public RubyInteger round() { return RubyFloat.newFloat(getRuby(), getDoubleValue()).round(); }
3,234,010
public static RubyFloat str2fnum(Ruby ruby, RubyString arg) { String str = arg.getValue().trim(); double d = 0.0; int pos = str.length(); for (int i = 0; i < pos; i++) { if ("0123456789eE+-.".indexOf(str.charAt(i)) == -1) { pos = i + 1; break; } } for (; pos > 0; pos--) { try { d = Double.parseDouble(str.substring(0, pos)); } catch (NumberFormatException ex) { continue; } break; } return new RubyFloat(ruby, d); }
public static RubyFloat str2fnum(Ruby ruby, RubyString arg) { String str = arg.getValue().trim(); double d = 0.0; int pos = str.length(); for (int i = 0; i < pos; i++) { if ("0123456789eE+-.".indexOf(str.charAt(i)) == -1) { pos = i + 1; break; } } for (; pos > 0; pos--) { try { d = Double.parseDouble(str.substring(0, pos)); } catch (NumberFormatException ex) { continue; } break; } return new RubyFloat(ruby, d); }
3,234,011
public static RubyInteger str2inum(Ruby ruby, RubyString str, int base) { StringBuffer sbuf = new StringBuffer(str.getValue().trim()); if (sbuf.length() == 0) { return RubyFixnum.zero(ruby); } int pos = 0; int radix = (base != 0) ? base : 10; boolean digitsFound = false; if (sbuf.charAt(pos) == '-') { pos++; } else if (sbuf.charAt(pos) == '+') { sbuf.deleteCharAt(pos); } if (pos == sbuf.length()) { return RubyFixnum.zero(ruby); } if (sbuf.charAt(pos) == '0') { sbuf.deleteCharAt(pos); if (pos == sbuf.length()) { return RubyFixnum.zero(ruby); } if (sbuf.charAt(pos) == 'x' || sbuf.charAt(pos) == 'X') { if (base == 0 || base == 16) { radix = 16; sbuf.deleteCharAt(pos); } } else if (sbuf.charAt(pos) == 'b' || sbuf.charAt(pos) == 'B') { if (base == 0 || base == 2) { radix = 2; sbuf.deleteCharAt(pos); } } else { radix = (base == 0) ? 8 : base; } } while (pos < sbuf.length()) { if (sbuf.charAt(pos) == '_') { sbuf.deleteCharAt(pos); } else if (Character.digit(sbuf.charAt(pos), radix) != -1) { digitsFound = true; pos++; } else { break; } } if (!digitsFound) { return RubyFixnum.zero(ruby); } try { long l = Long.parseLong(sbuf.substring(0, pos), radix); return RubyFixnum.newFixnum(ruby, l); } catch (NumberFormatException ex) { BigInteger bi = new BigInteger(sbuf.substring(0, pos), radix); return new RubyBignum(ruby, bi); } }
public static RubyInteger str2inum(Ruby ruby, RubyString str, int base) { StringBuffer sbuf = new StringBuffer(str.getValue().trim()); if (sbuf.length() == 0) { return RubyFixnum.zero(ruby); } int pos = 0; int radix = (base != 0) ? base : 10; boolean digitsFound = false; if (sbuf.charAt(pos) == '-') { pos++; } else if (sbuf.charAt(pos) == '+') { sbuf.deleteCharAt(pos); } if (pos == sbuf.length()) { return RubyFixnum.zero(ruby); } if (sbuf.charAt(pos) == '0') { sbuf.deleteCharAt(pos); if (pos == sbuf.length()) { return RubyFixnum.zero(ruby); } if (sbuf.charAt(pos) == 'x' || sbuf.charAt(pos) == 'X') { if (base == 0 || base == 16) { radix = 16; sbuf.deleteCharAt(pos); } } else if (sbuf.charAt(pos) == 'b' || sbuf.charAt(pos) == 'B') { if (base == 0 || base == 2) { radix = 2; sbuf.deleteCharAt(pos); } } else { radix = (base == 0) ? 8 : base; } } while (pos < sbuf.length()) { if (sbuf.charAt(pos) == '_') { sbuf.deleteCharAt(pos); } else if (Character.digit(sbuf.charAt(pos), radix) != -1) { digitsFound = true; pos++; } else { break; } } if (!digitsFound) { return RubyFixnum.zero(ruby); } try { long l = Long.parseLong(sbuf.substring(0, pos), radix); return RubyFixnum.newFixnum(ruby, l); } catch (NumberFormatException ex) { BigInteger bi = new BigInteger(sbuf.substring(0, pos), radix); return new RubyBignum(ruby, bi); } }
3,234,012
public RubyInteger truncate() { return RubyFloat.newFloat(getRuby(), getDoubleValue()).truncate(); }
public RubyInteger truncate() { return RubyFloat.newFloat(getRuby(), getDoubleValue()).truncate(); }
3,234,013
public RubyBoolean zero_p() { return equal(RubyFixnum.zero(getRuby())); }
public RubyBoolean zero_p() { return equal(RubyFixnum.zero(getRuby())); }
3,234,014
void fireThumbnailLoading() { state = HiViewer.LOADING_THUMBNAILS; currentLoader = new ThumbnailLoader(component, browser.getImages()); currentLoader.load(); }
void fireThumbnailLoading() { state = HiViewer.LOADING_THUMBNAILS; currentLoader = new ThumbnailLoader(component, images); currentLoader.load(); }
3,234,015
public void setZoomLevel(double zoomLevel) { // error condition if(zoomLevel <= 0) { return; } if(scaleToShow) return; Dimension dim = getSize(); double width = dim.getWidth(); double height = dim.getHeight(); double scale = getCamera().getViewScale(); double viewWidth = getCamera().getViewBounds().getWidth(); double viewHeight = getCamera().getViewBounds().getHeight(); double viewCenterX = getCamera().getViewBounds().getCenterX(); double viewCenterY = getCamera().getViewBounds().getCenterY(); double scaleX = 0; double scaleY = 0; System.err.println(footprint.getWidth()+","+footprint.getWidth()); System.err.println("dim:"+width+","+height); if(width/zoomLevel < footprint.getWidth()) { scaleX = viewCenterX; if((viewCenterX - (scale/zoomLevel)*viewWidth/2) < 0) { scaleX = 0; } } if(height/zoomLevel < footprint.getHeight()) { scaleY = viewCenterY; if((viewCenterY - (scale/zoomLevel)*viewWidth/2) < 0) { scaleY = 0; } } System.err.println("scaleX="+scaleX+", scaleY="+scaleY); getCamera().scaleViewAboutPoint(zoomLevel/scale,scaleX,scaleY); updateConstraints(); }
public void setZoomLevel(double zoomLevel) { // error condition if(zoomLevel <= 0) { return; } if(scaleToShow) return; Dimension dim = getSize(); double width = dim.getWidth(); double height = dim.getHeight(); double scale = getCamera().getViewScale(); double viewWidth = getCamera().getViewBounds().getWidth(); double viewHeight = getCamera().getViewBounds().getHeight(); double viewCenterX = getCamera().getViewBounds().getCenterX(); double viewCenterY = getCamera().getViewBounds().getCenterY(); double scaleX = 0; double scaleY = 0; System.err.println(footprint.getWidth()+","+footprint.getWidth()); System.err.println("dim:"+width+","+height); if(width/zoomLevel < footprint.getWidth()) { scaleX = viewCenterX; if((viewCenterX - (scale/zoomLevel)*viewWidth/2) < 0) { scaleX = 0; } } if(height/zoomLevel < footprint.getHeight()) { scaleY = viewCenterY; if((viewCenterY - (scale/zoomLevel)*viewWidth/2) < 0) { scaleY = 0; } } System.err.println("scaleX="+scaleX+", scaleY="+scaleY); getCamera().scaleViewAboutPoint(zoomLevel/scale,scaleX,scaleY); updateConstraints(); }
3,234,016
public void setZoomLevel(double zoomLevel) { // error condition if(zoomLevel <= 0) { return; } if(scaleToShow) return; Dimension dim = getSize(); double width = dim.getWidth(); double height = dim.getHeight(); double scale = getCamera().getViewScale(); double viewWidth = getCamera().getViewBounds().getWidth(); double viewHeight = getCamera().getViewBounds().getHeight(); double viewCenterX = getCamera().getViewBounds().getCenterX(); double viewCenterY = getCamera().getViewBounds().getCenterY(); double scaleX = 0; double scaleY = 0; System.err.println(footprint.getWidth()+","+footprint.getWidth()); System.err.println("dim:"+width+","+height); if(width/zoomLevel < footprint.getWidth()) { scaleX = viewCenterX; if((viewCenterX - (scale/zoomLevel)*viewWidth/2) < 0) { scaleX = 0; } } if(height/zoomLevel < footprint.getHeight()) { scaleY = viewCenterY; if((viewCenterY - (scale/zoomLevel)*viewWidth/2) < 0) { scaleY = 0; } } System.err.println("scaleX="+scaleX+", scaleY="+scaleY); getCamera().scaleViewAboutPoint(zoomLevel/scale,scaleX,scaleY); updateConstraints(); }
public void setZoomLevel(double zoomLevel) { // error condition if(zoomLevel <= 0) { return; } if(scaleToShow) return; Dimension dim = getSize(); double width = dim.getWidth(); double height = dim.getHeight(); double scale = getCamera().getViewScale(); double viewWidth = getCamera().getViewBounds().getWidth(); double viewHeight = getCamera().getViewBounds().getHeight(); double viewCenterX = getCamera().getViewBounds().getCenterX(); double viewCenterY = getCamera().getViewBounds().getCenterY(); double scaleX = 0; double scaleY = 0; System.err.println(footprint.getWidth()+","+footprint.getWidth()); System.err.println("dim:"+width+","+height); if(width/zoomLevel < footprint.getWidth()) { scaleX = viewCenterX; if((viewCenterX - (scale/zoomLevel)*viewWidth/2) < 0) { scaleX = 0; } } if(height/zoomLevel < footprint.getHeight()) { scaleY = viewCenterY; if((viewCenterY - (scale/zoomLevel)*viewHeight/2) < 0) { scaleY = 0; } } System.err.println("scaleX="+scaleX+", scaleY="+scaleY); getCamera().scaleViewAboutPoint(zoomLevel/scale,scaleX,scaleY); updateConstraints(); }
3,234,017
public void updateConstraints() { Dimension dimension = getSize(); double width = dimension.getWidth(); double height = dimension.getHeight(); double xRatio = width / footprint.getWidth(); double yRatio = height / footprint.getHeight(); if(Math.min(xRatio,yRatio) != minZoomLevel) { minZoomLevel = Math.min(xRatio,yRatio); for(Iterator iter = zoomParamListeners.iterator(); iter.hasNext();) { ZoomParamListener listener = (ZoomParamListener)iter.next(); listener.minZoomLevelChanged(minZoomLevel); } } // for some reason, setting setViewScale(0) screws things up // in a big way. if(scaleToShow) { if((xRatio < 1 || yRatio < 1) && (xRatio != 0 && yRatio != 0)) { double min = Math.min(xRatio,yRatio); getCamera().setViewScale(min); } else { getCamera().setViewScale(1); } } boundCameraPosition(); double viewScale = getCamera().getViewScale(); backgroundNode.setBounds(0,0,width/viewScale,height/viewScale); // update things for(Iterator iter = regionSensitive.iterator(); iter.hasNext();) { RegionSensitive rs = (RegionSensitive)iter.next(); rs.setActiveRegion(footprint); } System.err.println(footprint); System.err.println("Dim: "+width+","+height); overlayCamera.cameraResized(new Rectangle2D.Double(0,0,width,height)); for(Iterator iter = zoomParamListeners.iterator(); iter.hasNext();) { ZoomParamListener listener = (ZoomParamListener)iter.next(); listener.zoomLevelChanged(viewScale); } }
publicvoidupdateConstraints(){Dimensiondimension=getSize();doublewidth=dimension.getWidth();doubleheight=dimension.getHeight();doublexRatio=width/footprint.getWidth();doubleyRatio=height/footprint.getHeight();if(Math.min(xRatio,yRatio)!=minZoomLevel){minZoomLevel=Math.min(xRatio,yRatio);for(Iteratoriter=zoomParamListeners.iterator();iter.hasNext();){ZoomParamListenerlistener=(ZoomParamListener)iter.next();listener.minZoomLevelChanged(minZoomLevel);}}//forsomereason,settingsetViewScale(0)screwsthingsup//inabigway.if(scaleToShow){if((xRatio<1||yRatio<1)&&(xRatio!=0&&yRatio!=0)){doublemin=Math.min(xRatio,yRatio);getCamera().setViewScale(min);}else{getCamera().setViewScale(1);}}boundCameraPosition();doubleviewScale=getCamera().getViewScale();backgroundNode.setBounds(0,0,width/viewScale,height/viewScale);//updatethingsfor(Iteratoriter=regionSensitive.iterator();iter.hasNext();){RegionSensitivers=(RegionSensitive)iter.next();rs.setActiveRegion(footprint);}System.err.println(footprint);System.err.println("Dim:"+width+","+height);overlayCamera.cameraResized(newRectangle2D.Double(0,0,width,height));for(Iteratoriter=zoomParamListeners.iterator();iter.hasNext();){ZoomParamListenerlistener=(ZoomParamListener)iter.next();listener.zoomLevelChanged(viewScale);}}
3,234,018
public void updateConstraints() { Dimension dimension = getSize(); double width = dimension.getWidth(); double height = dimension.getHeight(); double xRatio = width / footprint.getWidth(); double yRatio = height / footprint.getHeight(); if(Math.min(xRatio,yRatio) != minZoomLevel) { minZoomLevel = Math.min(xRatio,yRatio); for(Iterator iter = zoomParamListeners.iterator(); iter.hasNext();) { ZoomParamListener listener = (ZoomParamListener)iter.next(); listener.minZoomLevelChanged(minZoomLevel); } } // for some reason, setting setViewScale(0) screws things up // in a big way. if(scaleToShow) { if((xRatio < 1 || yRatio < 1) && (xRatio != 0 && yRatio != 0)) { double min = Math.min(xRatio,yRatio); getCamera().setViewScale(min); } else { getCamera().setViewScale(1); } } boundCameraPosition(); double viewScale = getCamera().getViewScale(); backgroundNode.setBounds(0,0,width/viewScale,height/viewScale); // update things for(Iterator iter = regionSensitive.iterator(); iter.hasNext();) { RegionSensitive rs = (RegionSensitive)iter.next(); rs.setActiveRegion(footprint); } System.err.println(footprint); System.err.println("Dim: "+width+","+height); overlayCamera.cameraResized(new Rectangle2D.Double(0,0,width,height)); for(Iterator iter = zoomParamListeners.iterator(); iter.hasNext();) { ZoomParamListener listener = (ZoomParamListener)iter.next(); listener.zoomLevelChanged(viewScale); } }
public void updateConstraints() { Dimension dimension = getSize(); double width = dimension.getWidth(); double height = dimension.getHeight(); double xRatio = width / footprint.getWidth(); double yRatio = height / footprint.getHeight(); if(Math.min(xRatio,yRatio) != minZoomLevel) { minZoomLevel = Math.min(xRatio,yRatio); for(Iterator iter = zoomParamListeners.iterator(); iter.hasNext();) { ZoomParamListener listener = (ZoomParamListener)iter.next(); listener.minZoomLevelChanged(minZoomLevel); } } // for some reason, setting setViewScale(0) screws things up // in a big way. if(scaleToShow) { if((xRatio < 1 || yRatio < 1) && (xRatio != 0 && yRatio != 0)) { double min = Math.min(xRatio,yRatio); getCamera().setViewScale(min); } else { getCamera().setViewScale(1); } } boundCameraPosition(); double viewScale = getCamera().getViewScale(); backgroundNode.setBounds(0,0,width/viewScale,height/viewScale); // update things for(Iterator iter = regionSensitive.iterator(); iter.hasNext();) { RegionSensitive rs = (RegionSensitive)iter.next(); rs.setActiveRegion(footprint); } System.err.println(footprint); System.err.println("Dim: "+width+","+height); overlayCamera.cameraResized(new Rectangle2D.Double(0,0,width,height)); for(Iterator iter = zoomParamListeners.iterator(); iter.hasNext();) { ZoomParamListener listener = (ZoomParamListener)iter.next(); listener.zoomLevelChanged(viewScale); } }
3,234,019
public ImageInspector(ViewerCtrl control, ImageCanvas canvas, double magFactor) { super(control.getReferenceFrame(), "Image inspector"); init(control, canvas, magFactor); setJMenuBar(menuBar); buildGUI(); pack(); }
public ImageInspector(ViewerCtrl control, ImageCanvas canvas, double magFactor) { super(control.getReferenceFrame(), "Image inspector"); init(control, canvas, magFactor); setJMenuBar(menuBar); buildGUI(); pack(); }
3,234,020
public ImageInspector(ViewerCtrl control, ImageCanvas canvas, double magFactor) { super(control.getReferenceFrame(), "Image inspector"); init(control, canvas, magFactor); setJMenuBar(menuBar); buildGUI(); pack(); }
public ImageInspector(ViewerCtrl control, ImageCanvas canvas, double magFactor) { super(control.getReferenceFrame(), "Image inspector"); init(control, canvas, magFactor); setJMenuBar(menuBar); buildGUI(); pack(); }
3,234,021
private void buildGUI() { setResizable(false); getContentPane().add(toolBar, BorderLayout.NORTH); }
private void buildGUI() { setResizable(false); getContentPane().add(toolBar, BorderLayout.NORTH); }
3,234,022
private void buildGUI() { setResizable(false); getContentPane().add(toolBar, BorderLayout.NORTH); }
private void buildGUI() { setResizable(false); getContentPane().add(toolBar, BorderLayout.NORTH); }
3,234,023
private void init(ViewerCtrl control, ImageCanvas canvas, double magFactor) { Registry reg = control.getRegistry(); manager = new ImageInspectorManager(this, control, magFactor); BufferedImage img = control.getBufferedImage(); manager.setImageDimension(img.getWidth(), img.getHeight()); manager.setCanvas(canvas); menuBar = new MenuBar(manager, magFactor); toolBar = new ToolBar(reg, manager, magFactor); }
private void init(ViewerCtrl control, ImageCanvas canvas, double magFactor) { Registry reg = control.getRegistry(); manager = new ImageInspectorManager(this, control, magFactor); BufferedImage img = control.getBufferedImage(); manager.setImageDimension(img.getWidth(), img.getHeight()); manager.setCanvas(canvas); menuBar = new MenuBar(manager, magFactor); toolBar = new ToolBar(reg, manager, magFactor); }
3,234,024
private void init(ViewerCtrl control, ImageCanvas canvas, double magFactor) { Registry reg = control.getRegistry(); manager = new ImageInspectorManager(this, control, magFactor); BufferedImage img = control.getBufferedImage(); manager.setImageDimension(img.getWidth(), img.getHeight()); manager.setCanvas(canvas); menuBar = new MenuBar(manager, magFactor); toolBar = new ToolBar(reg, manager, magFactor); }
private void init(ViewerCtrl control, ImageCanvas canvas, double magFactor) { Registry reg = control.getRegistry(); manager = new ImageInspectorManager(this, control, magFactor); BufferedImage img = control.getBufferedImage(); manager.setImageDimension(img.getWidth(), img.getHeight()); manager.setCanvas(canvas); menuBar = new MenuBar(manager, magFactor); toolBar = new ToolBar(reg, manager, magFactor); }
3,234,025
private void init(ViewerCtrl control, ImageCanvas canvas, double magFactor) { Registry reg = control.getRegistry(); manager = new ImageInspectorManager(this, control, magFactor); BufferedImage img = control.getBufferedImage(); manager.setImageDimension(img.getWidth(), img.getHeight()); manager.setCanvas(canvas); menuBar = new MenuBar(manager, magFactor); toolBar = new ToolBar(reg, manager, magFactor); }
private void init(ViewerCtrl control, ImageCanvas canvas, double magFactor) { Registry reg = control.getRegistry(); manager = new ImageInspectorManager(this, control, magFactor); BufferedImage img = control.getBufferedImage(); manager.setImageDimension(img.getWidth(), img.getHeight()); manager.setCanvas(canvas); menuBar = new MenuBar(manager, magFactor); toolBar = new ToolBar(reg, manager, magFactor); }
3,234,026
protected void openInternal(String path, String mode) { this.path = path; setMode(mode); File file = new File(path); try { if (isReadable()) { this.inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); } if (isWriteable()) { this.outStream = new BufferedOutputStream(new FileOutputStream(file, append)); } } catch (IOException ioExcptn) { throw new IOError(getRuby(), ioExcptn.getMessage()); } }
protected void openInternal(String path, String mode) { this.path = path; setMode(mode); File file = new File(path); try { if (isReadable()) { this.inStream = new RubyInputStream(new BufferedInputStream(new FileInputStream(file))); } if (isWriteable()) { this.outStream = new BufferedOutputStream(new FileOutputStream(file.getAbsolutePath(), append)); } } catch (IOException ioExcptn) { throw new IOError(getRuby(), ioExcptn.getMessage()); } }
3,234,027
public void testAndHeresHowWeUnlinkThings() throws Exception { // Method 1: saveImage(); List updated = unlinkImage(); iUpdate.saveCollection( updated ); test that row is gone. // Method 2: saveImage(); updated = unlinkImage(); iPojos.udpateDataObjects( (IObject[]) updated.toArray(new IObject[updated.size()]), null); // Method 3: Dataset d = new Dataset(); Project p = new Project(); p = (Project) iPojos.createDataObject( p, null ); d = (Dataset) iPojos.createDataObject( d, null ); ProjectDatasetLink link = new ProjectDatasetLink(); link.setParent( p ); link.setChild( c ); }
public void testAndHeresHowWeUnlinkThings() throws Exception { // Method 1: saveImage(); List updated = unlinkImage(); iUpdate.saveCollection( updated ); fail("test that row is gone."); // Method 2: saveImage(); updated = unlinkImage(); iPojos.udpateDataObjects( (IObject[]) updated.toArray(new IObject[updated.size()]), null); // Method 3: Dataset d = new Dataset(); Project p = new Project(); p = (Project) iPojos.createDataObject( p, null ); d = (Dataset) iPojos.createDataObject( d, null ); ProjectDatasetLink link = new ProjectDatasetLink(); link.setParent( p ); link.setChild( c ); }
3,234,028
public void testAndHeresHowWeUnlinkThings() throws Exception { // Method 1: saveImage(); List updated = unlinkImage(); iUpdate.saveCollection( updated ); test that row is gone. // Method 2: saveImage(); updated = unlinkImage(); iPojos.udpateDataObjects( (IObject[]) updated.toArray(new IObject[updated.size()]), null); // Method 3: Dataset d = new Dataset(); Project p = new Project(); p = (Project) iPojos.createDataObject( p, null ); d = (Dataset) iPojos.createDataObject( d, null ); ProjectDatasetLink link = new ProjectDatasetLink(); link.setParent( p ); link.setChild( c ); }
public void testAndHeresHowWeUnlinkThings() throws Exception { // Method 1: saveImage(); List updated = unlinkImage(); iUpdate.saveCollection( updated ); test that row is gone. // Method 2: saveImage(); updated = unlinkImage(); iPojos.udpateDataObjects( (IObject[]) updated.toArray(new IObject[updated.size()]), null); // Method 3: Dataset d = new Dataset(); Project p = new Project(); p = (Project) iPojos.createDataObject( p, null ); d = (Dataset) iPojos.createDataObject( d, null ); ProjectDatasetLink link = new ProjectDatasetLink(); link.setParent( p ); link.setChild( d ); }
3,234,029
public static void main(String[] args) { final IRBConsole console = new IRBConsole("JRuby IRB Console"); PipedInputStream pipeIn = new PipedInputStream(); console.setLayout(new BorderLayout()); console.setSize(700, 600); JEditorPane text = new JTextPane(); text.setMargin(new Insets(8,8,8,8)); text.setCaretColor(new Color(0xa4, 0x00, 0x00)); text.setBackground(new Color(0xf2, 0xf2, 0xf2)); text.setForeground(new Color(0xa4, 0x00, 0x00)); Font font = console.findFont("Monospaced", Font.PLAIN, 14, new String[] {"Monaco", "Andale Mono"}); text.setFont(font); JScrollPane pane = new JScrollPane(); pane.setViewportView(text); pane.setBorder(BorderFactory.createLineBorder(Color.darkGray)); console.add(pane); console.validate(); TextAreaReadline tar = new TextAreaReadline(text, " Welcome to the JRuby IRB Console \n\n"); final IRuby runtime = Ruby.newInstance(pipeIn, new PrintStream(tar), new PrintStream(tar), false); IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, args)); runtime.defineGlobalConstant("ARGV", argumentArray); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(System.identityHashCode(runtime)))); runtime.getLoadService().init(new ArrayList()); tar.hookIntoRuntime(runtime); Thread t2 = new Thread() { public void run() { console.setVisible(true); runtime.evalScript("require 'irb'; require 'irb/completion'; IRB.start"); } }; t2.start(); try { t2.join(); } catch (InterruptedException ie) { // ignore } System.exit(0); }
public static void main(String[] args) { final IRBConsole console = new IRBConsole("JRuby IRB Console"); PipedInputStream pipeIn = new PipedInputStream(); console.getContentPane().setLayout(new BorderLayout()); console.setSize(700, 600); JEditorPane text = new JTextPane(); text.setMargin(new Insets(8,8,8,8)); text.setCaretColor(new Color(0xa4, 0x00, 0x00)); text.setBackground(new Color(0xf2, 0xf2, 0xf2)); text.setForeground(new Color(0xa4, 0x00, 0x00)); Font font = console.findFont("Monospaced", Font.PLAIN, 14, new String[] {"Monaco", "Andale Mono"}); text.setFont(font); JScrollPane pane = new JScrollPane(); pane.setViewportView(text); pane.setBorder(BorderFactory.createLineBorder(Color.darkGray)); console.add(pane); console.validate(); TextAreaReadline tar = new TextAreaReadline(text, " Welcome to the JRuby IRB Console \n\n"); final IRuby runtime = Ruby.newInstance(pipeIn, new PrintStream(tar), new PrintStream(tar), false); IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, args)); runtime.defineGlobalConstant("ARGV", argumentArray); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(System.identityHashCode(runtime)))); runtime.getLoadService().init(new ArrayList()); tar.hookIntoRuntime(runtime); Thread t2 = new Thread() { public void run() { console.setVisible(true); runtime.evalScript("require 'irb'; require 'irb/completion'; IRB.start"); } }; t2.start(); try { t2.join(); } catch (InterruptedException ie) { // ignore } System.exit(0); }
3,234,030
public static void main(String[] args) { final IRBConsole console = new IRBConsole("JRuby IRB Console"); PipedInputStream pipeIn = new PipedInputStream(); console.setLayout(new BorderLayout()); console.setSize(700, 600); JEditorPane text = new JTextPane(); text.setMargin(new Insets(8,8,8,8)); text.setCaretColor(new Color(0xa4, 0x00, 0x00)); text.setBackground(new Color(0xf2, 0xf2, 0xf2)); text.setForeground(new Color(0xa4, 0x00, 0x00)); Font font = console.findFont("Monospaced", Font.PLAIN, 14, new String[] {"Monaco", "Andale Mono"}); text.setFont(font); JScrollPane pane = new JScrollPane(); pane.setViewportView(text); pane.setBorder(BorderFactory.createLineBorder(Color.darkGray)); console.add(pane); console.validate(); TextAreaReadline tar = new TextAreaReadline(text, " Welcome to the JRuby IRB Console \n\n"); final IRuby runtime = Ruby.newInstance(pipeIn, new PrintStream(tar), new PrintStream(tar), false); IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, args)); runtime.defineGlobalConstant("ARGV", argumentArray); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(System.identityHashCode(runtime)))); runtime.getLoadService().init(new ArrayList()); tar.hookIntoRuntime(runtime); Thread t2 = new Thread() { public void run() { console.setVisible(true); runtime.evalScript("require 'irb'; require 'irb/completion'; IRB.start"); } }; t2.start(); try { t2.join(); } catch (InterruptedException ie) { // ignore } System.exit(0); }
public static void main(String[] args) { final IRBConsole console = new IRBConsole("JRuby IRB Console"); PipedInputStream pipeIn = new PipedInputStream(); console.setLayout(new BorderLayout()); console.setSize(700, 600); JEditorPane text = new JTextPane(); text.setMargin(new Insets(8,8,8,8)); text.setCaretColor(new Color(0xa4, 0x00, 0x00)); text.setBackground(new Color(0xf2, 0xf2, 0xf2)); text.setForeground(new Color(0xa4, 0x00, 0x00)); Font font = console.findFont("Monospaced", Font.PLAIN, 14, new String[] {"Monaco", "Andale Mono"}); text.setFont(font); JScrollPane pane = new JScrollPane(); pane.setViewportView(text); pane.setBorder(BorderFactory.createLineBorder(Color.darkGray)); console.getContentPane().add(pane); console.validate(); TextAreaReadline tar = new TextAreaReadline(text, " Welcome to the JRuby IRB Console \n\n"); final IRuby runtime = Ruby.newInstance(pipeIn, new PrintStream(tar), new PrintStream(tar), false); IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, args)); runtime.defineGlobalConstant("ARGV", argumentArray); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); runtime.getGlobalVariables().defineReadonly("$$", new ValueAccessor(runtime.newFixnum(System.identityHashCode(runtime)))); runtime.getLoadService().init(new ArrayList()); tar.hookIntoRuntime(runtime); Thread t2 = new Thread() { public void run() { console.setVisible(true); runtime.evalScript("require 'irb'; require 'irb/completion'; IRB.start"); } }; t2.start(); try { t2.join(); } catch (InterruptedException ie) { // ignore } System.exit(0); }
3,234,031
public IRubyObject index(IRubyObject obj) { ThreadContext context = getRuntime().getCurrentContext(); for (int i = 0, len = getLength(); i < len; i++) { if (obj.callMethod(context, "==", entry(i)).isTrue()) { return getRuntime().newFixnum(i); } } return getRuntime().getNil(); }
public IRubyObject index(IRubyObject obj) { ThreadContext context = getRuntime().getCurrentContext(); for (int i = 0, len = getLength(); i < len; i++) { if (obj.callMethod(context, "==", entry(i)).isTrue()) { return getRuntime().newFixnum(i); } } return getRuntime().getNil(); }
3,234,032
public IRubyObject rindex(IRubyObject obj) { ThreadContext context = getRuntime().getCurrentContext(); for (int i = getLength() - 1; i >= 0; i--) { if (obj.callMethod(context, "==", entry(i)).isTrue()) { return getRuntime().newFixnum(i); } } return getRuntime().getNil(); }
public IRubyObject rindex(IRubyObject obj) { ThreadContext context = getRuntime().getCurrentContext(); for (int i = getLength() - 1; i >= 0; i--) { if (entry(i).callMethod(context, "==", obj).isTrue()) { return getRuntime().newFixnum(i); } } return getRuntime().getNil(); }
3,234,033
public IRubyObject aref(IRubyObject[] args) { if (argCount(args, 1, 2) == 2) { int beg = RubyNumeric.fix2int(args[0]); int len = RubyNumeric.fix2int(args[1]); return substr(beg, len); } if (args[0] instanceof RubyFixnum) { int idx = RubyNumeric.fix2int(args[0]); if (idx < 0) { idx += getValue().length(); } if (idx < 0 || idx >= getValue().length()) { return getRuntime().getNil(); } return RubyFixnum.newFixnum(getRuntime(), getValue().charAt(idx)); } if (args[0] instanceof RubyRegexp) { if (RubyRegexp.regexpValue(args[0]).search(this, 0) >= 0) { return RubyRegexp.last_match(getRuntime().getBackref()); } return getRuntime().getNil(); } if (args[0] instanceof RubyString) { if (getValue().indexOf(stringValue(args[0]).getValue()) != -1) { return args[0]; } return getRuntime().getNil(); } if (args[0] instanceof RubyRange) { long[] begLen = ((RubyRange) args[0]).getBeginLength(getValue().length(), true, false); if (begLen == null) { return getRuntime().getNil(); } return substr((int) begLen[0], (int) begLen[1]); } int idx = (int) RubyNumeric.num2long(args[0]); if (idx < 0) { idx += getValue().length(); } if (idx < 0 || idx >= getValue().length()) { return getRuntime().getNil(); } return RubyFixnum.newFixnum(getRuntime(), getValue().charAt(idx)); }
public IRubyObject aref(IRubyObject[] args) { if (argCount(args, 1, 2) == 2) { int beg = RubyNumeric.fix2int(args[0]); int len = RubyNumeric.fix2int(args[1]); return substr(beg, len); } if (args[0] instanceof RubyFixnum) { int idx = RubyNumeric.fix2int(args[0]); if (idx < 0) { idx += getValue().length(); } if (idx < 0 || idx >= getValue().length()) { return getRuntime().getNil(); } return RubyFixnum.newFixnum(getRuntime(), getValue().charAt(idx)); } if (args[0] instanceof RubyRegexp) { if (RubyRegexp.regexpValue(args[0]).search(this, 0) >= 0) { return RubyRegexp.last_match(getRuntime().getBackref()); } return getRuntime().getNil(); } if (args[0] instanceof RubyString) { if (getValue().indexOf(stringValue(args[0]).getValue()) != -1) { return args[0]; } return getRuntime().getNil(); } if (args[0] instanceof RubyRange) { long[] begLen = ((RubyRange) args[0]).getBeginLength(getValue().length(), true, false); if (begLen == null) { return getRuntime().getNil(); } return substr((int) begLen[0], (int) begLen[1]); } int idx = (int) RubyNumeric.num2long(args[0]); if (idx < 0) { idx += getValue().length(); } if (idx < 0 || idx >= getValue().length()) { return getRuntime().getNil(); } return RubyFixnum.newFixnum(getRuntime(), getValue().charAt(idx)); }
3,234,034
public int cmp(RubyString other) { /* use Java implementatiom */ return getValue().compareTo(other.getValue()); }
public int cmp(RubyString other) { /* use Java implementatiom */ return getValue().compareTo(other.getValue()); }
3,234,035
public IRubyObject slice_bang(IRubyObject[] args) { int argc = argCount(args, 1, 2); IRubyObject[] newArgs = new IRubyObject[argc + 1]; newArgs[0] = args[0]; if (argc > 1) { newArgs[1] = args[1]; } newArgs[argc] = newString(""); IRubyObject result = aref(args); aset(newArgs); return result; }
public IRubyObject slice_bang(IRubyObject[] args) { int argc = argCount(args, 1, 2); IRubyObject[] newArgs = new IRubyObject[argc + 1]; newArgs[0] = args[0]; if (argc > 1) { newArgs[1] = args[1]; } newArgs[argc] = newString(""); IRubyObject result = aref(args); aset(newArgs); return result; }
3,234,036
public RubyString swapcase() { RubyString newString = newString(getValue()); return newString.swapcase_bang(); }
public RubyString swapcase() { RubyString newString = newString(getValue()); return newString.swapcase_bang(); }
3,234,037
public RubyString swapcase_bang() { char[] chars = getValue().toCharArray(); StringBuffer sb = new StringBuffer(chars.length); for (int i = 0; i < chars.length; i++) { if (!Character.isLetter(chars[i])) { sb.append(chars[i]); } else if (Character.isLowerCase(chars[i])) { sb.append(Character.toUpperCase(chars[i])); } else { sb.append(Character.toLowerCase(chars[i])); } } setValue(getValue().toLowerCase()); return this; }
public RubyString swapcase_bang() { char[] chars = getValue().toCharArray(); StringBuffer sb = new StringBuffer(chars.length); for (int i = 0; i < chars.length; i++) { if (!Character.isLetter(chars[i])) { sb.append(chars[i]); } else if (Character.isLowerCase(chars[i])) { sb.append(Character.toUpperCase(chars[i])); } else { sb.append(Character.toLowerCase(chars[i])); } } setValue(getValue().toLowerCase()); return this; }
3,234,038
public RubyString swapcase_bang() { char[] chars = getValue().toCharArray(); StringBuffer sb = new StringBuffer(chars.length); for (int i = 0; i < chars.length; i++) { if (!Character.isLetter(chars[i])) { sb.append(chars[i]); } else if (Character.isLowerCase(chars[i])) { sb.append(Character.toUpperCase(chars[i])); } else { sb.append(Character.toLowerCase(chars[i])); } } setValue(getValue().toLowerCase()); return this; }
public RubyString swapcase_bang() { char[] chars = getValue().toCharArray(); StringBuffer sb = new StringBuffer(chars.length); for (int i = 0; i < chars.length; i++) { if (!Character.isLetter(chars[i])) { sb.append(chars[i]); } else if (Character.isLowerCase(chars[i])) { sb.append(Character.toUpperCase(chars[i])); } else { sb.append(Character.toLowerCase(chars[i])); } } setValue(getValue().toLowerCase()); return this; }
3,234,039
public RubyString swapcase_bang() { char[] chars = getValue().toCharArray(); StringBuffer sb = new StringBuffer(chars.length); for (int i = 0; i < chars.length; i++) { if (!Character.isLetter(chars[i])) { sb.append(chars[i]); } else if (Character.isLowerCase(chars[i])) { sb.append(Character.toUpperCase(chars[i])); } else { sb.append(Character.toLowerCase(chars[i])); } } setValue(getValue().toLowerCase()); return this; }
public RubyString swapcase_bang() { char[] chars = getValue().toCharArray(); StringBuffer sb = new StringBuffer(chars.length); for (int i = 0; i < chars.length; i++) { if (!Character.isLetter(chars[i])) { sb.append(chars[i]); } else if (Character.isLowerCase(chars[i])) { sb.append(Character.toUpperCase(chars[i])); } else { sb.append(Character.toLowerCase(chars[i])); } } setValue(getValue().toLowerCase()); return this; }
3,234,040
public static void main (String args[]) { System.out.println(); System.out.println("----------------------------------------------------"); System.out.println("--- WARNING this is an ALPHA version of JRuby!!! ---"); System.out.println("----------------------------------------------------"); System.out.println(); // Benchmark long now = -1; if (args.length == 0) { printUsage(); } else { int lenArg = args.length; for (int i = 0; i < lenArg; i++) { if (args[i].equals("-h") || args[i].equals("-help")) { printUsage(); } else if (args[i].equals("-e")) { if (i++ >= lenArg) { System.err.println("invalid argument " + i); System.err.println(" -e must be followed by an expression to evaluate"); printUsage(); } else { runInterpreter(args[i], "command line " + i); } } else if (args[i].equals("-b")) { // Benchmark now = System.currentTimeMillis(); } else { runInterpreterOnFile(args[i]); } } } // Benchmark if (now != -1) { System.out.println("Runtime: " + (System.currentTimeMillis() - now) + " ms"); } }
public static void main (String args[]) { System.out.println(); System.out.println("----------------------------------------------------"); System.out.println("--- WARNING this is an ALPHA version of JRuby!!! ---"); System.out.println("----------------------------------------------------"); System.out.println(); // Benchmark long now = -1; if (args.length == 0) { printUsage(); } else { int lenArg = args.length; for (int i = 0; i < lenArg; i++) { if (args[i].equals("-h") || args[i].equals("-help")) { printUsage(); } else if (args[i].equals("-e")) { if (i++ >= lenArg) { System.err.println("invalid argument " + i); System.err.println(" -e must be followed by an expression to evaluate"); printUsage(); } else { runInterpreter(args[i], "command line " + i, new String[0]); } } else if (args[i].equals("-b")) { // Benchmark now = System.currentTimeMillis(); } else { runInterpreterOnFile(args[i]); } } } // Benchmark if (now != -1) { System.out.println("Runtime: " + (System.currentTimeMillis() - now) + " ms"); } }
3,234,041
public static void main (String args[]) { System.out.println(); System.out.println("----------------------------------------------------"); System.out.println("--- WARNING this is an ALPHA version of JRuby!!! ---"); System.out.println("----------------------------------------------------"); System.out.println(); // Benchmark long now = -1; if (args.length == 0) { printUsage(); } else { int lenArg = args.length; for (int i = 0; i < lenArg; i++) { if (args[i].equals("-h") || args[i].equals("-help")) { printUsage(); } else if (args[i].equals("-e")) { if (i++ >= lenArg) { System.err.println("invalid argument " + i); System.err.println(" -e must be followed by an expression to evaluate"); printUsage(); } else { runInterpreter(args[i], "command line " + i); } } else if (args[i].equals("-b")) { // Benchmark now = System.currentTimeMillis(); } else { runInterpreterOnFile(args[i]); } } } // Benchmark if (now != -1) { System.out.println("Runtime: " + (System.currentTimeMillis() - now) + " ms"); } }
public static void main (String args[]) { System.out.println(); System.out.println("----------------------------------------------------"); System.out.println("--- WARNING this is an ALPHA version of JRuby!!! ---"); System.out.println("----------------------------------------------------"); System.out.println(); // Benchmark long now = -1; if (args.length == 0) { printUsage(); } else { int lenArg = args.length; for (int i = 0; i < lenArg; i++) { if (args[i].equals("-h") || args[i].equals("-help")) { printUsage(); } else if (args[i].equals("-e")) { if (i++ >= lenArg) { System.err.println("invalid argument " + i); System.err.println(" -e must be followed by an expression to evaluate"); printUsage(); } else { runInterpreter(args[i], "command line " + i); } } else if (args[i].equals("-b")) { // Benchmark now = System.currentTimeMillis(); } else { String[] argv = new String[lenArg - i - 1]; System.arraycopy(args, i + 1, argv, 0, argv.length); runInterpreterOnFile(args[i], argv); break; } } } // Benchmark if (now != -1) { System.out.println("Runtime: " + (System.currentTimeMillis() - now) + " ms"); } }
3,234,042
protected static void runInterpreter(String iString2Eval, String iFileName) { // Initialize Runtime Ruby ruby = new Ruby(); // Parse and interpret file RubyString rs = RubyString.m_newString(ruby, iString2Eval); // New Version // // ruby.getInterpreter().eval(ruby.getClasses().getObjectClass(), ruby.getRubyParser().compileString(iFileName, rs, 0)); // Old Version // // Initialize Parser parse p = new parse(ruby); ruby.getInterpreter().eval(ruby.getClasses().getObjectClass(), p.rb_compile_string(iFileName, rs, 0)); }
protected static void runInterpreter(String iString2Eval, String iFileName, String[] args) { // Initialize Runtime Ruby ruby = new Ruby(); // Parse and interpret file RubyString rs = RubyString.m_newString(ruby, iString2Eval); // New Version // // ruby.getInterpreter().eval(ruby.getClasses().getObjectClass(), ruby.getRubyParser().compileString(iFileName, rs, 0)); // Old Version // // Initialize Parser parse p = new parse(ruby); ruby.getInterpreter().eval(ruby.getClasses().getObjectClass(), p.rb_compile_string(iFileName, rs, 0)); }
3,234,043
protected static void runInterpreter(String iString2Eval, String iFileName) { // Initialize Runtime Ruby ruby = new Ruby(); // Parse and interpret file RubyString rs = RubyString.m_newString(ruby, iString2Eval); // New Version // // ruby.getInterpreter().eval(ruby.getClasses().getObjectClass(), ruby.getRubyParser().compileString(iFileName, rs, 0)); // Old Version // // Initialize Parser parse p = new parse(ruby); ruby.getInterpreter().eval(ruby.getClasses().getObjectClass(), p.rb_compile_string(iFileName, rs, 0)); }
protected static void runInterpreter(String iString2Eval, String iFileName) { // Initialize Runtime Ruby ruby = new Ruby(); // Parse and interpret file RubyString rs = RubyString.m_newString(ruby, iString2Eval); // New Version // // ruby.getInterpreter().eval(ruby.getClasses().getObjectClass(), ruby.getRubyParser().compileString(iFileName, rs, 0)); // Old Version // // Initialize Parser parse p = new parse(ruby); ruby.getInterpreter().eval(ruby.getRubyTopSelf(), p.rb_compile_string(iFileName, rs, 0)); }
3,234,044
protected static void runInterpreterOnFile(String fileName) { File rubyFile = new File(fileName); if (!rubyFile.canRead()) { System.out.println("Cannot read Rubyfile: \"" + fileName + "\""); } else { try { StringBuffer sb = new StringBuffer((int)rubyFile.length()); BufferedReader br = new BufferedReader(new FileReader(rubyFile)); String line; while ((line = br.readLine()) != null) { sb.append(line).append('\n'); } br.close(); runInterpreter(sb.toString(), fileName); } catch (IOException ioExcptn) { System.out.println("Cannot read Rubyfile: \"" + fileName + "\""); System.out.println("IOEception: " + ioExcptn.getMessage()); } } }
protected static void runInterpreterOnFile(String fileName, String[] args) { File rubyFile = new File(fileName); if (!rubyFile.canRead()) { System.out.println("Cannot read Rubyfile: \"" + fileName + "\""); } else { try { StringBuffer sb = new StringBuffer((int)rubyFile.length()); BufferedReader br = new BufferedReader(new FileReader(rubyFile)); String line; while ((line = br.readLine()) != null) { sb.append(line).append('\n'); } br.close(); runInterpreter(sb.toString(), fileName); } catch (IOException ioExcptn) { System.out.println("Cannot read Rubyfile: \"" + fileName + "\""); System.out.println("IOEception: " + ioExcptn.getMessage()); } } }
3,234,045
protected static void runInterpreterOnFile(String fileName) { File rubyFile = new File(fileName); if (!rubyFile.canRead()) { System.out.println("Cannot read Rubyfile: \"" + fileName + "\""); } else { try { StringBuffer sb = new StringBuffer((int)rubyFile.length()); BufferedReader br = new BufferedReader(new FileReader(rubyFile)); String line; while ((line = br.readLine()) != null) { sb.append(line).append('\n'); } br.close(); runInterpreter(sb.toString(), fileName); } catch (IOException ioExcptn) { System.out.println("Cannot read Rubyfile: \"" + fileName + "\""); System.out.println("IOEception: " + ioExcptn.getMessage()); } } }
protected static void runInterpreterOnFile(String fileName) { File rubyFile = new File(fileName); if (!rubyFile.canRead()) { System.out.println("Cannot read Rubyfile: \"" + fileName + "\""); } else { try { StringBuffer sb = new StringBuffer((int)rubyFile.length()); BufferedReader br = new BufferedReader(new FileReader(rubyFile)); String line; while ((line = br.readLine()) != null) { sb.append(line).append('\n'); } br.close(); runInterpreter(sb.toString(), fileName, args); } catch (IOException ioExcptn) { System.out.println("Cannot read Rubyfile: \"" + fileName + "\""); System.out.println("IOEception: " + ioExcptn.getMessage()); } } }
3,234,046
private void selectComponent() { WFComponentSelector cs = (WFComponentSelector) findComponent(COMPONENT_SELECTOR_ID); String headline = WFUtil.getStringValue(ARTICLE_ITEM_BEAN_ID, "headline"); if (cs != null) { if (headline == null || headline.length() == 0) { cs.setSelectedId(NO_ARTICLE_ID, true); cs.setSelectedId(ARTICLE_VIEW_ID, false); }else { cs.setSelectedId(NO_ARTICLE_ID, false); cs.setSelectedId(ARTICLE_VIEW_ID, true); } }else { cs.setSelectedId(NO_ARTICLE_ID, false); cs.setSelectedId(ARTICLE_VIEW_ID, true); System.out.println("Could not find the Component selector!!!"); } }
private void selectComponent() { WFComponentSelector cs = (WFComponentSelector) findComponent(COMPONENT_SELECTOR_ID); String headline = WFUtil.getStringValue(ARTICLE_ITEM_BEAN_ID, "headline"); if (cs != null) { if (headline == null || headline.length() == 0) { cs.setSelectedId(NO_ARTICLE_ID, true); cs.setSelectedId(ARTICLE_VIEW_ID, false); }else { cs.setSelectedId(NO_ARTICLE_ID, false); cs.setSelectedId(ARTICLE_VIEW_ID, true); } }else { cs.setSelectedId(NO_ARTICLE_ID, false); cs.setSelectedId(ARTICLE_VIEW_ID, true); System.out.println("Could not find the Component selector!!!"); } }
3,234,048
public static FastWriter getInstance(OutputStream out, String encoding) throws UnsupportedEncodingException { FastWriter fw = null; SimpleStack ss = (SimpleStack) _writerCache.get(encoding); if (ss != null) { fw = (FastWriter) ss.pop(); fw.reset(out); } if (fw == null) { fw = new FastWriter(out,encoding); } return fw; }
public static FastWriter getInstance(OutputStream out, String encoding) throws UnsupportedEncodingException { FastWriter fw = null; SimpleStack ss = (SimpleStack) _writerCache.get(encoding); if (ss != null) { fw = (FastWriter) ss.pop(); if (fw != null) { fw.reset(out); return fw; } } if (fw == null) { fw = new FastWriter(out,encoding); } return fw; }
3,234,049
public static FastWriter getInstance(OutputStream out, String encoding) throws UnsupportedEncodingException { FastWriter fw = null; SimpleStack ss = (SimpleStack) _writerCache.get(encoding); if (ss != null) { fw = (FastWriter) ss.pop(); fw.reset(out); } if (fw == null) { fw = new FastWriter(out,encoding); } return fw; }
public static FastWriter getInstance(OutputStream out, String encoding) throws UnsupportedEncodingException { FastWriter fw = null; SimpleStack ss = (SimpleStack) _writerCache.get(encoding); if (ss != null) { fw = (FastWriter) ss.pop(); fw.reset(out); } if (fw == null) { fw = new FastWriter(out,encoding); } return fw; }
3,234,050
Object clean(Object obj) { //TODO push OMEModel down into all calls if (null != obj) { if (obj instanceof OMEModel) { daoUtils.clean((OMEModel) obj); } else if (obj instanceof Set) { daoUtils.clean((Set) obj); } else if (obj instanceof HashMap) { //daoUtils.clean(((Map) obj).keySet());TODO here only integers, but... daoUtils.clean(new HashSet(((Map) obj).values())); } else { String msg = "Instances of " + obj.getClass().getName() + " not supported."; throw new IllegalArgumentException(msg); } } return obj; }
Object clean(Object obj) { //TODO push OMEModel down into all calls if (null != obj) { if (obj instanceof OMEModel) { daoUtils.clean((OMEModel) obj); } else if (obj instanceof Set) { daoUtils.clean((Set) obj); } else if (obj instanceof Map) { //daoUtils.clean(((Map) obj).keySet());TODO here only integers, but... daoUtils.clean(new HashSet(((Map) obj).values())); } else { String msg = "Instances of " + obj.getClass().getName() + " not supported."; throw new IllegalArgumentException(msg); } } return obj; }
3,234,051
public Map findDatasetAnnotationsForExperimenter(final Set arg0, final int arg1) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashMap(); } List result = annotationDao.findDataListAnnotationForExperimenter(arg0, arg1); return sortDatasetAnnotations(result); }
public Map findDatasetAnnotationsForExperimenter(final Set arg0, final int arg1) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashMap(); } List result = annotationDao.findDataListAnnotationForExperimenter(arg0, arg1); return (Map) clean(sortDatasetAnnotations(result)); }
3,234,052
public IRubyObject offset(RubyFixnum index) { if (outOfBounds(index)) { return getRuntime().getNil(); } return RubyArray.create(this, new IRubyObject[] { begin(index), end(index)}); }
public IRubyObject offset(RubyFixnum index) { if (outOfBounds(index)) { return getRuntime().getNil(); } return RubyArray.newArray(getRuntime(), new IRubyObject[] { begin(index), end(index)}); }
3,234,053
public void testCopyConstructor() throws Exception { Permissions p1 = new Permissions(); p1.revoke(GROUP, WRITE); assertFalse(p1.isGranted(GROUP, WRITE)); Permissions p2 = new Permissions(p1); assertFalse(p2.isGranted(GROUP, WRITE)); Permissions none = new Permissions(Permissions.EMPTY); assertFalse(none.isGranted(USER, READ)); assertFalse(none.isGranted(USER, WRITE)); assertFalse(none.isGranted(USER, USE)); assertFalse(none.isGranted(GROUP, READ)); assertFalse(none.isGranted(GROUP, WRITE)); assertFalse(none.isGranted(GROUP, USE)); assertFalse(none.isGranted(WORLD, READ)); assertFalse(none.isGranted(WORLD, WRITE)); assertFalse(none.isGranted(WORLD, USE)); }
public void testCopyConstructor() throws Exception { Permissions p1 = new Permissions(); p1.revoke(GROUP, WRITE); assertFalse(p1.isGranted(GROUP, WRITE)); Permissions p2 = new Permissions(p1); assertFalse(p2.isGranted(GROUP, WRITE)); Permissions none = new Permissions(Permissions.EMPTY); assertFalse(none.isGranted(USER, READ)); assertFalse(none.isGranted(USER, WRITE)); assertFalse(none.isGranted(USER, USE)); assertFalse(none.isGranted(GROUP, READ)); assertFalse(none.isGranted(GROUP, WRITE)); assertFalse(none.isGranted(GROUP, USE)); assertFalse(none.isGranted(WORLD, READ)); assertFalse(none.isGranted(WORLD, WRITE)); assertFalse(none.isGranted(WORLD, USE)); }
3,234,054
public void testCopyConstructor() throws Exception { Permissions p1 = new Permissions(); p1.revoke(GROUP, WRITE); assertFalse(p1.isGranted(GROUP, WRITE)); Permissions p2 = new Permissions(p1); assertFalse(p2.isGranted(GROUP, WRITE)); Permissions none = new Permissions(Permissions.EMPTY); assertFalse(none.isGranted(USER, READ)); assertFalse(none.isGranted(USER, WRITE)); assertFalse(none.isGranted(USER, USE)); assertFalse(none.isGranted(GROUP, READ)); assertFalse(none.isGranted(GROUP, WRITE)); assertFalse(none.isGranted(GROUP, USE)); assertFalse(none.isGranted(WORLD, READ)); assertFalse(none.isGranted(WORLD, WRITE)); assertFalse(none.isGranted(WORLD, USE)); }
public void testCopyConstructor() throws Exception { Permissions p1 = new Permissions(); p1.revoke(GROUP, WRITE); assertFalse(p1.isGranted(GROUP, WRITE)); Permissions p2 = new Permissions(p1); assertFalse(p2.isGranted(GROUP, WRITE)); Permissions none = new Permissions(Permissions.EMPTY); assertFalse(none.isGranted(USER, READ)); assertFalse(none.isGranted(USER, WRITE)); assertFalse(none.isGranted(USER, USE)); assertFalse(none.isGranted(GROUP, READ)); assertFalse(none.isGranted(GROUP, WRITE)); assertFalse(none.isGranted(GROUP, USE)); assertFalse(none.isGranted(WORLD, READ)); assertFalse(none.isGranted(WORLD, WRITE)); assertFalse(none.isGranted(WORLD, USE)); }
3,234,055
public void testCopyConstructor() throws Exception { Permissions p1 = new Permissions(); p1.revoke(GROUP, WRITE); assertFalse(p1.isGranted(GROUP, WRITE)); Permissions p2 = new Permissions(p1); assertFalse(p2.isGranted(GROUP, WRITE)); Permissions none = new Permissions(Permissions.EMPTY); assertFalse(none.isGranted(USER, READ)); assertFalse(none.isGranted(USER, WRITE)); assertFalse(none.isGranted(USER, USE)); assertFalse(none.isGranted(GROUP, READ)); assertFalse(none.isGranted(GROUP, WRITE)); assertFalse(none.isGranted(GROUP, USE)); assertFalse(none.isGranted(WORLD, READ)); assertFalse(none.isGranted(WORLD, WRITE)); assertFalse(none.isGranted(WORLD, USE)); }
public void testCopyConstructor() throws Exception { Permissions p1 = new Permissions(); p1.revoke(GROUP, WRITE); assertFalse(p1.isGranted(GROUP, WRITE)); Permissions p2 = new Permissions(p1); assertFalse(p2.isGranted(GROUP, WRITE)); Permissions none = new Permissions(Permissions.EMPTY); assertFalse(none.isGranted(USER, READ)); assertFalse(none.isGranted(USER, WRITE)); assertFalse(none.isGranted(USER, USE)); assertFalse(none.isGranted(GROUP, READ)); assertFalse(none.isGranted(GROUP, WRITE)); assertFalse(none.isGranted(GROUP, USE)); assertFalse(none.isGranted(WORLD, READ)); assertFalse(none.isGranted(WORLD, WRITE)); assertFalse(none.isGranted(WORLD, USE)); }
3,234,056
public void testGrantAndRevokePermissions() throws Exception { revokeGrantCheck(USER, READ); revokeGrantCheck(USER, WRITE); revokeGrantCheck(USER, USE); revokeGrantCheck(GROUP, READ); revokeGrantCheck(GROUP, WRITE); revokeGrantCheck(GROUP, USE); revokeGrantCheck(WORLD, READ); revokeGrantCheck(WORLD, WRITE); revokeGrantCheck(WORLD, USE); }
public void testGrantAndRevokePermissions() throws Exception { revokeGrantCheck(USER, READ); revokeGrantCheck(USER, WRITE); revokeGrantCheck(USER, USE); revokeGrantCheck(GROUP, READ); revokeGrantCheck(GROUP, WRITE); revokeGrantCheck(GROUP, USE); revokeGrantCheck(WORLD, READ); revokeGrantCheck(WORLD, WRITE); revokeGrantCheck(WORLD, USE); }
3,234,057
public void testGrantAndRevokePermissions() throws Exception { revokeGrantCheck(USER, READ); revokeGrantCheck(USER, WRITE); revokeGrantCheck(USER, USE); revokeGrantCheck(GROUP, READ); revokeGrantCheck(GROUP, WRITE); revokeGrantCheck(GROUP, USE); revokeGrantCheck(WORLD, READ); revokeGrantCheck(WORLD, WRITE); revokeGrantCheck(WORLD, USE); }
public void testGrantAndRevokePermissions() throws Exception { revokeGrantCheck(USER, READ); revokeGrantCheck(USER, WRITE); revokeGrantCheck(USER, USE); revokeGrantCheck(GROUP, READ); revokeGrantCheck(GROUP, WRITE); revokeGrantCheck(GROUP, USE); revokeGrantCheck(WORLD, READ); revokeGrantCheck(WORLD, WRITE); revokeGrantCheck(WORLD, USE); }
3,234,058
public void testGrantAndRevokePermissions() throws Exception { revokeGrantCheck(USER, READ); revokeGrantCheck(USER, WRITE); revokeGrantCheck(USER, USE); revokeGrantCheck(GROUP, READ); revokeGrantCheck(GROUP, WRITE); revokeGrantCheck(GROUP, USE); revokeGrantCheck(WORLD, READ); revokeGrantCheck(WORLD, WRITE); revokeGrantCheck(WORLD, USE); }
public void testGrantAndRevokePermissions() throws Exception { revokeGrantCheck(USER, READ); revokeGrantCheck(USER, WRITE); revokeGrantCheck(USER, USE); revokeGrantCheck(GROUP, READ); revokeGrantCheck(GROUP, WRITE); revokeGrantCheck(GROUP, USE); revokeGrantCheck(WORLD, READ); revokeGrantCheck(WORLD, WRITE); revokeGrantCheck(WORLD, USE); }
3,234,059
public void testSimplePermissionsAllowsEverything() throws Exception { assertTrue(p.isGranted(USER, READ)); assertTrue(p.isGranted(USER, WRITE)); assertTrue(p.isGranted(USER, USE)); assertTrue(p.isGranted(GROUP, READ)); assertTrue(p.isGranted(GROUP, WRITE)); assertTrue(p.isGranted(GROUP, USE)); assertTrue(p.isGranted(WORLD, READ)); assertTrue(p.isGranted(WORLD, WRITE)); assertTrue(p.isGranted(WORLD, USE)); // assertTrue( p.isGranted(ALL, READ) ); // assertTrue( p.isGranted(ALL, WRITE) ); // assertTrue( p.isGranted(ALL, USE) ); }
public void testSimplePermissionsAllowsEverything() throws Exception { assertTrue(p.isGranted(USER, READ)); assertTrue(p.isGranted(USER, WRITE)); assertTrue(p.isGranted(USER, USE)); assertTrue(p.isGranted(GROUP, READ)); assertTrue(p.isGranted(GROUP, WRITE)); assertTrue(p.isGranted(GROUP, USE)); assertTrue(p.isGranted(WORLD, READ)); assertTrue(p.isGranted(WORLD, WRITE)); assertTrue(p.isGranted(WORLD, USE)); // assertTrue( p.isGranted(ALL, READ) ); // assertTrue( p.isGranted(ALL, WRITE) ); // assertTrue( p.isGranted(ALL, USE) ); }
3,234,060
public void testSimplePermissionsAllowsEverything() throws Exception { assertTrue(p.isGranted(USER, READ)); assertTrue(p.isGranted(USER, WRITE)); assertTrue(p.isGranted(USER, USE)); assertTrue(p.isGranted(GROUP, READ)); assertTrue(p.isGranted(GROUP, WRITE)); assertTrue(p.isGranted(GROUP, USE)); assertTrue(p.isGranted(WORLD, READ)); assertTrue(p.isGranted(WORLD, WRITE)); assertTrue(p.isGranted(WORLD, USE)); // assertTrue( p.isGranted(ALL, READ) ); // assertTrue( p.isGranted(ALL, WRITE) ); // assertTrue( p.isGranted(ALL, USE) ); }
public void testSimplePermissionsAllowsEverything() throws Exception { assertTrue(p.isGranted(USER, READ)); assertTrue(p.isGranted(USER, WRITE)); assertTrue(p.isGranted(USER, USE)); assertTrue(p.isGranted(GROUP, READ)); assertTrue(p.isGranted(GROUP, WRITE)); assertTrue(p.isGranted(GROUP, USE)); assertTrue(p.isGranted(WORLD, READ)); assertTrue(p.isGranted(WORLD, WRITE)); assertTrue(p.isGranted(WORLD, USE)); // assertTrue( p.isGranted(ALL, READ) ); // assertTrue( p.isGranted(ALL, WRITE) ); // assertTrue( p.isGranted(ALL, USE) ); }
3,234,061
public void testSimplePermissionsAllowsEverything() throws Exception { assertTrue(p.isGranted(USER, READ)); assertTrue(p.isGranted(USER, WRITE)); assertTrue(p.isGranted(USER, USE)); assertTrue(p.isGranted(GROUP, READ)); assertTrue(p.isGranted(GROUP, WRITE)); assertTrue(p.isGranted(GROUP, USE)); assertTrue(p.isGranted(WORLD, READ)); assertTrue(p.isGranted(WORLD, WRITE)); assertTrue(p.isGranted(WORLD, USE)); // assertTrue( p.isGranted(ALL, READ) ); // assertTrue( p.isGranted(ALL, WRITE) ); // assertTrue( p.isGranted(ALL, USE) ); }
public void testSimplePermissionsAllowsEverything() throws Exception { assertTrue(p.isGranted(USER, READ)); assertTrue(p.isGranted(USER, WRITE)); assertTrue(p.isGranted(USER, USE)); assertTrue(p.isGranted(GROUP, READ)); assertTrue(p.isGranted(GROUP, WRITE)); assertTrue(p.isGranted(GROUP, USE)); assertTrue(p.isGranted(WORLD, READ)); assertTrue(p.isGranted(WORLD, WRITE)); assertTrue(p.isGranted(WORLD, USE)); // assertTrue( p.isGranted(ALL, READ) ); // assertTrue( p.isGranted(ALL, WRITE) ); // assertTrue( p.isGranted(ALL, USE) ); }
3,234,062
public void testToBits() throws Exception { bitCompare(USER, READ); bitCompare(USER, WRITE); bitCompare(USER, USE); bitCompare(GROUP, READ); bitCompare(GROUP, WRITE); bitCompare(GROUP, USE); bitCompare(WORLD, READ); bitCompare(WORLD, WRITE); bitCompare(WORLD, USE); }
public void testToBits() throws Exception { bitCompare(USER, READ); bitCompare(USER, WRITE); bitCompare(USER, USE); bitCompare(GROUP, READ); bitCompare(GROUP, WRITE); bitCompare(GROUP, USE); bitCompare(WORLD, READ); bitCompare(WORLD, WRITE); bitCompare(WORLD, USE); }
3,234,063
public void testToBits() throws Exception { bitCompare(USER, READ); bitCompare(USER, WRITE); bitCompare(USER, USE); bitCompare(GROUP, READ); bitCompare(GROUP, WRITE); bitCompare(GROUP, USE); bitCompare(WORLD, READ); bitCompare(WORLD, WRITE); bitCompare(WORLD, USE); }
public void testToBits() throws Exception { bitCompare(USER, READ); bitCompare(USER, WRITE); bitCompare(USER, USE); bitCompare(GROUP, READ); bitCompare(GROUP, WRITE); bitCompare(GROUP, USE); bitCompare(WORLD, READ); bitCompare(WORLD, WRITE); bitCompare(WORLD, USE); }
3,234,064
public void testToBits() throws Exception { bitCompare(USER, READ); bitCompare(USER, WRITE); bitCompare(USER, USE); bitCompare(GROUP, READ); bitCompare(GROUP, WRITE); bitCompare(GROUP, USE); bitCompare(WORLD, READ); bitCompare(WORLD, WRITE); bitCompare(WORLD, USE); }
public void testToBits() throws Exception { bitCompare(USER, READ); bitCompare(USER, WRITE); bitCompare(USER, USE); bitCompare(GROUP, READ); bitCompare(GROUP, WRITE); bitCompare(GROUP, USE); bitCompare(WORLD, READ); bitCompare(WORLD, WRITE); bitCompare(WORLD, USE); }
3,234,065
public void testVarArgs() throws Exception { p.revoke(GROUP, USE,READ,WRITE); assertFalse( p.isGranted(GROUP, READ)); assertFalse( p.isGranted(GROUP, WRITE)); assertFalse( p.isGranted(GROUP, USE)); }
public void testVarArgs() throws Exception { p.revoke(GROUP, USE,READ,WRITE); assertFalse( p.isGranted(GROUP, READ)); assertFalse( p.isGranted(GROUP, WRITE)); assertFalse( p.isGranted(GROUP, USE)); }
3,234,066
public void testVarArgs() throws Exception { p.revoke(GROUP, USE,READ,WRITE); assertFalse( p.isGranted(GROUP, READ)); assertFalse( p.isGranted(GROUP, WRITE)); assertFalse( p.isGranted(GROUP, USE)); }
public void testVarArgs() throws Exception { p.revoke(GROUP, USE,READ,WRITE); assertFalse( p.isGranted(GROUP, READ)); assertFalse( p.isGranted(GROUP, WRITE)); assertFalse( p.isGranted(GROUP, USE)); }
3,234,067
public void annotate(TreeImageDisplay[] nodes) { if (model.getState() == DISCARDED) throw new IllegalStateException("This method cannot be invoked " + "in the DISCARDED state."); if (nodes == null) throw new IllegalArgumentException("No dataObject to annotate"); if (nodes.length == 1) { PropertiesCmd cmd = new PropertiesCmd(this); cmd.execute(); return; } DataHandler dh = model.annotateDataObjects(nodes); dh.addPropertyChangeListener(controller); dh.activate(); }
public void annotate(TreeImageDisplay[] nodes) { if (model.getState() == DISCARDED) throw new IllegalStateException("This method cannot be invoked " + "in the DISCARDED state."); if (nodes == null) throw new IllegalArgumentException("No dataObject to annotate"); if (nodes.length == 1) { PropertiesCmd cmd = new PropertiesCmd(this); cmd.execute(); return; } DataHandler dh = model.annotateDataObjects(nodes); dh.addPropertyChangeListener(controller); dh.activate(); }
3,234,068
public void setThumbnail(BufferedImage thumbnail) { if (model.getState() == LOADING_THUMBNAIL) { model.setState(READY); if (thumbnail != null) firePropertyChange(THUMBNAIL_LOADED_PROPERTY, null, thumbnail); fireStateChange(); } }
public void setThumbnail(BufferedImage thumbnail) { if (model.getState() == LOADING_THUMBNAIL) { model.setState(READY); if (thumbnail != null) model.getEditor().setThumbnail(thumbnail); fireStateChange(); } }
3,234,069
public void showClassifier(ImageData[] images, int mode) { switch (model.getState()) { //case READY: case DISCARDED: throw new IllegalStateException("This method should cannot " + "be invoked in the DISCARDED state."); } if (images == null) throw new IllegalArgumentException("Object cannot be null."); if (images.length == 0) throw new IllegalArgumentException("No images to classify or " + "declassify."); DataHandler dh = model.classifyImageObjects(images, mode); dh.addPropertyChangeListener(controller); dh.activate(); /* model.cancel(); // cancel annotation loader or thumbnail loader removeEditor(); model.setEditorType(CLASSIFIER_EDITOR); Classifier classifier = ClassifierFactory.getClassifier(this, mode, images); classifier.addPropertyChangeListener(controller); classifier.activate(); view.addComponent(classifier.getUI()); */ }
public void showClassifier(ImageData[] images, int mode) { switch (model.getState()) { //case READY: case DISCARDED: throw new IllegalStateException("This method should cannot " + "be invoked in the DISCARDED state."); } if (images == null) throw new IllegalArgumentException("Object cannot be null."); if (images.length == 0) throw new IllegalArgumentException("No images to classify or " + "declassify."); DataHandler dh = model.classifyImageObjects(view, images, mode); dh.addPropertyChangeListener(controller); dh.activate(); /* model.cancel(); // cancel annotation loader or thumbnail loader removeEditor(); model.setEditorType(CLASSIFIER_EDITOR); Classifier classifier = ClassifierFactory.getClassifier(this, mode, images); classifier.addPropertyChangeListener(controller); classifier.activate(); view.addComponent(classifier.getUI()); */ }
3,234,070
public void visit(ImageNode node) { Thumbnail thumb = node.getThumbnail(); thumbnails.add(thumb.getImageFor(node)); }
public void visit(ImageNode node) { Thumbnail thumb = node.getThumbnail(); thumbnails.add(thumb.getDisplayedImage()); }
3,234,072
public PDILoader(HiViewer viewer, Set images) { super(viewer); this.images = images; }
public PDILoader(HiViewer viewer, Set images, boolean refresh) { super(viewer); this.images = images; }
3,234,073