bugged
stringlengths
6
599k
fixed
stringlengths
6
40.8M
__index_level_0__
int64
0
3.24M
public StackElement pop() { localNames.decreaseBlockLevel(); return super.pop(); }
public StackElement pop() { localNames.setBlockLevel(localNames.getBlockLevel() - 1); return super.pop(); }
3,232,552
public void push(StackElement newElement) { localNames.increaseBlockLevel(); super.push(newElement); }
public void push(StackElement newElement) { localNames.setBlockLevel(localNames.getBlockLevel() + 1); super.push(newElement); }
3,232,553
private void initCoreClasses() { ObjectMetaClass objectMetaClass = new ObjectMetaClass(this); objectMetaClass.initializeClass(); objectClass = objectMetaClass; objectClass.setConstant("Object", objectClass); RubyClass moduleClass = new ModuleMetaClass(this, objectClass); objectClass.setConstant("Module", moduleClass); RubyClass classClass = new RubyClass(this, null /* Would be Class if it could */, moduleClass, null, "Class"); objectClass.setConstant("Class", classClass); // I don't think the containment is correct here (parent cref) RubyClass metaClass = objectClass.makeMetaClass(classClass, objectMetaClass.getCRef()); metaClass = moduleClass.makeMetaClass(metaClass, objectMetaClass.getCRef()); metaClass = classClass.makeMetaClass(metaClass, objectMetaClass.getCRef()); ((ObjectMetaClass) moduleClass).initializeBootstrapClass(); kernelModule = RubyKernel.createKernelModule(this); objectClass.includeModule(kernelModule); RubyClass.createClassClass(classClass); nilClass = RubyNil.createNilClass(this); // We cannot define this constant until nil itself was made objectClass.defineConstant("NIL", getNil()); // Pre-create the core classes we know we will get referenced by starting up the runtime. RubyBoolean.createFalseClass(this); RubyBoolean.createTrueClass(this); RubyComparable.createComparable(this); RubyEnumerable.createEnumerableModule(this); stringClass = new StringMetaClass(this); stringClass.initializeClass(); new SymbolMetaClass(this).initializeClass(); RubyThreadGroup.createThreadGroupClass(this); RubyThread.createThreadClass(this); RubyException.createExceptionClass(this); RubyPrecision.createPrecisionModule(this); new NumericMetaClass(this).initializeClass(); new IntegerMetaClass(this).initializeClass(); fixnumClass = new FixnumMetaClass(this); fixnumClass.initializeClass(); new HashMetaClass(this).initializeClass(); new IOMetaClass(this).initializeClass(); new ArrayMetaClass(this).initializeClass(); Java.createJavaModule(this); RubyClass structClass = RubyStruct.createStructClass(this); tmsStruct = RubyStruct.newInstance(structClass, new IRubyObject[] { newString("Tms"), newSymbol("utime"), newSymbol("stime"), newSymbol("cutime"), newSymbol("cstime")}); RubyFloat.createFloatClass(this); new BignumMetaClass(this).initializeClass(); new BindingMetaClass(this).initializeClass(); RubyMath.createMathModule(this); // depends on all numeric types RubyRegexp.createRegexpClass(this); RubyRange.createRangeClass(this); RubyObjectSpace.createObjectSpaceModule(this); RubyGC.createGCModule(this); new ProcMetaClass(this).initializeClass(); RubyMethod.createMethodClass(this); RubyMatchData.createMatchDataClass(this); RubyMarshal.createMarshalModule(this); RubyDir.createDirClass(this); RubyFileTest.createFileTestModule(this); new FileMetaClass(this).initializeClass(); // depends on IO, FileTest RubyProcess.createProcessModule(this); new TimeMetaClass(this).initializeClass(); RubyUnboundMethod.defineUnboundMethodClass(this); RubyClass exceptionClass = getClass("Exception"); RubyClass standardError = defineClass("StandardError", exceptionClass); RubyClass runtimeError = defineClass("RuntimeError", standardError); RubyClass ioError = defineClass("IOError", standardError); RubyClass scriptError = defineClass("ScriptError", exceptionClass); RubyClass nameError = RubyNameError.createNameErrorClass(this, standardError); RubyClass rangeError = defineClass("RangeError", standardError); defineClass("SystemExit", exceptionClass); defineClass("Fatal", exceptionClass); defineClass("Interrupt", exceptionClass); defineClass("SignalException", exceptionClass); defineClass("TypeError", standardError); defineClass("ArgumentError", standardError); defineClass("IndexError", standardError); defineClass("SyntaxError", scriptError); defineClass("LoadError", scriptError); defineClass("NotImplementedError", scriptError); defineClass("NoMethodError", nameError); defineClass("SecurityError", standardError); defineClass("NoMemoryError", exceptionClass); defineClass("RegexpError", standardError); defineClass("EOFError", ioError); defineClass("LocalJumpError", standardError); defineClass("ThreadError", standardError); defineClass("SystemStackError", exceptionClass); defineClass("ZeroDivisionError", standardError); // FIXME: Actually this somewhere defineClass("FloatDomainError", rangeError); NativeException.createClass(this, runtimeError); systemCallError = defineClass("SystemCallError", standardError); errnoModule = defineModule("Errno"); initErrnoErrors(); defineClass("Data",objectClass); }
private void initCoreClasses() { ObjectMetaClass objectMetaClass = new ObjectMetaClass(this); objectMetaClass.initializeClass(); objectClass = objectMetaClass; objectClass.setConstant("Object", objectClass); RubyClass moduleClass = new ModuleMetaClass(this, objectClass); objectClass.setConstant("Module", moduleClass); RubyClass classClass = new RubyClass(this, null /* Would be Class if it could */, moduleClass, null, "Class"); objectClass.setConstant("Class", classClass); // I don't think the containment is correct here (parent cref) RubyClass metaClass = objectClass.makeMetaClass(classClass, objectMetaClass.getCRef()); metaClass = moduleClass.makeMetaClass(metaClass, objectMetaClass.getCRef()); metaClass = classClass.makeMetaClass(metaClass, objectMetaClass.getCRef()); ((ObjectMetaClass) moduleClass).initializeBootstrapClass(); kernelModule = RubyKernel.createKernelModule(this); objectClass.includeModule(kernelModule); RubyClass.createClassClass(classClass); nilClass = RubyNil.createNilClass(this); // We cannot define this constant until nil itself was made objectClass.defineConstant("NIL", getNil()); // Pre-create the core classes we know we will get referenced by starting up the runtime. RubyBoolean.createFalseClass(this); RubyBoolean.createTrueClass(this); RubyComparable.createComparable(this); RubyEnumerable.createEnumerableModule(this); stringClass = new StringMetaClass(this); stringClass.initializeClass(); new SymbolMetaClass(this).initializeClass(); RubyThreadGroup.createThreadGroupClass(this); RubyThread.createThreadClass(this); RubyException.createExceptionClass(this); RubyPrecision.createPrecisionModule(this); new NumericMetaClass(this).initializeClass(); new IntegerMetaClass(this).initializeClass(); fixnumClass = new FixnumMetaClass(this); fixnumClass.initializeClass(); new HashMetaClass(this).initializeClass(); new IOMetaClass(this).initializeClass(); new ArrayMetaClass(this).initializeClass(); RubyClass structClass = RubyStruct.createStructClass(this); tmsStruct = RubyStruct.newInstance(structClass, new IRubyObject[] { newString("Tms"), newSymbol("utime"), newSymbol("stime"), newSymbol("cutime"), newSymbol("cstime")}); RubyFloat.createFloatClass(this); new BignumMetaClass(this).initializeClass(); new BindingMetaClass(this).initializeClass(); RubyMath.createMathModule(this); // depends on all numeric types RubyRegexp.createRegexpClass(this); RubyRange.createRangeClass(this); RubyObjectSpace.createObjectSpaceModule(this); RubyGC.createGCModule(this); new ProcMetaClass(this).initializeClass(); RubyMethod.createMethodClass(this); RubyMatchData.createMatchDataClass(this); RubyMarshal.createMarshalModule(this); RubyDir.createDirClass(this); RubyFileTest.createFileTestModule(this); new FileMetaClass(this).initializeClass(); // depends on IO, FileTest RubyProcess.createProcessModule(this); new TimeMetaClass(this).initializeClass(); RubyUnboundMethod.defineUnboundMethodClass(this); RubyClass exceptionClass = getClass("Exception"); RubyClass standardError = defineClass("StandardError", exceptionClass); RubyClass runtimeError = defineClass("RuntimeError", standardError); RubyClass ioError = defineClass("IOError", standardError); RubyClass scriptError = defineClass("ScriptError", exceptionClass); RubyClass nameError = RubyNameError.createNameErrorClass(this, standardError); RubyClass rangeError = defineClass("RangeError", standardError); defineClass("SystemExit", exceptionClass); defineClass("Fatal", exceptionClass); defineClass("Interrupt", exceptionClass); defineClass("SignalException", exceptionClass); defineClass("TypeError", standardError); defineClass("ArgumentError", standardError); defineClass("IndexError", standardError); defineClass("SyntaxError", scriptError); defineClass("LoadError", scriptError); defineClass("NotImplementedError", scriptError); defineClass("NoMethodError", nameError); defineClass("SecurityError", standardError); defineClass("NoMemoryError", exceptionClass); defineClass("RegexpError", standardError); defineClass("EOFError", ioError); defineClass("LocalJumpError", standardError); defineClass("ThreadError", standardError); defineClass("SystemStackError", exceptionClass); defineClass("ZeroDivisionError", standardError); // FIXME: Actually this somewhere defineClass("FloatDomainError", rangeError); NativeException.createClass(this, runtimeError); systemCallError = defineClass("SystemCallError", standardError); errnoModule = defineModule("Errno"); initErrnoErrors(); defineClass("Data",objectClass); }
3,232,554
private void initLibraries() { loadService = new LoadService(this); loadService.registerBuiltin("java.rb", new BuiltinScript("javasupport")); loadService.registerBuiltin("socket.rb", new SocketLibrary()); loadService.registerBuiltin("rbconfig.rb", new RbConfigLibrary()); for (int i=0; i<BUILTIN_LIBRARIES.length; i++) { loadService.registerRubyBuiltin(BUILTIN_LIBRARIES[i]); } loadService.registerBuiltin("jruby.rb", new JRubyLibrary()); loadService.registerBuiltin("iconv.rb", new IConvLibrary()); loadService.registerBuiltin("stringio.rb", new StringIOLibrary()); loadService.registerBuiltin("strscan.rb", new StringScannerLibrary()); loadService.registerBuiltin("zlib.rb", new ZlibLibrary()); loadService.registerBuiltin("yaml_internal.rb", new YamlLibrary()); loadService.registerBuiltin("enumerator.rb", new EnumeratorLibrary()); loadService.registerBuiltin("readline.rb", new Readline.Service()); loadService.registerBuiltin("openssl.so", new RubyOpenSSL.Service()); loadService.registerBuiltin("digest.so", new DigestLibrary()); loadService.registerBuiltin("digest.rb", new DigestLibrary()); loadService.registerBuiltin("digest/md5.rb", new DigestLibrary.MD5()); loadService.registerBuiltin("digest/rmd160.rb", new DigestLibrary.RMD160()); loadService.registerBuiltin("digest/sha1.rb", new DigestLibrary.SHA1()); loadService.registerBuiltin("digest/sha2.rb", new DigestLibrary.SHA2()); loadService.registerBuiltin("bigdecimal.rb", new BigDecimalLibrary()); }
private void initLibraries() { loadService = new LoadService(this); loadService.registerBuiltin("java.rb", new Library() { public void load(IRuby runtime) throws IOException { Java.createJavaModule(runtime); new BuiltinScript("javasupport").load(runtime); } }); loadService.registerBuiltin("socket.rb", new SocketLibrary()); loadService.registerBuiltin("rbconfig.rb", new RbConfigLibrary()); for (int i=0; i<BUILTIN_LIBRARIES.length; i++) { loadService.registerRubyBuiltin(BUILTIN_LIBRARIES[i]); } loadService.registerBuiltin("jruby.rb", new JRubyLibrary()); loadService.registerBuiltin("iconv.rb", new IConvLibrary()); loadService.registerBuiltin("stringio.rb", new StringIOLibrary()); loadService.registerBuiltin("strscan.rb", new StringScannerLibrary()); loadService.registerBuiltin("zlib.rb", new ZlibLibrary()); loadService.registerBuiltin("yaml_internal.rb", new YamlLibrary()); loadService.registerBuiltin("enumerator.rb", new EnumeratorLibrary()); loadService.registerBuiltin("readline.rb", new Readline.Service()); loadService.registerBuiltin("openssl.so", new RubyOpenSSL.Service()); loadService.registerBuiltin("digest.so", new DigestLibrary()); loadService.registerBuiltin("digest.rb", new DigestLibrary()); loadService.registerBuiltin("digest/md5.rb", new DigestLibrary.MD5()); loadService.registerBuiltin("digest/rmd160.rb", new DigestLibrary.RMD160()); loadService.registerBuiltin("digest/sha1.rb", new DigestLibrary.SHA1()); loadService.registerBuiltin("digest/sha2.rb", new DigestLibrary.SHA2()); loadService.registerBuiltin("bigdecimal.rb", new BigDecimalLibrary()); }
3,232,555
public void parse() throws IOException, TemplateException { if (!_parsed) { Block newContent = null; Map newParameters = null; Map newMacros = null; Reader in = null; try { Parser parser = getParser(); in = getReader(); BlockBuilder bb = parser.parseBlock(getName(), in); in.close(); BuildContext bc = new BuildContext(_broker); newParameters = bc.getMap(); newMacros = bc.getMacros(); newContent = (Block) bb.build(bc); } catch (BuildException be) { newContent = null; _log.error("Template contained invalid data", be); throw be; } catch (IOException e) { newContent = null; // don't let the old one survive _log.error("Template: Could not read template: " + this); throw e; } catch (Exception e) { _log.error("Error parsing template: " + this, e); throw new BuildException("Error parsing template: " + this, e); } finally { try { in.close(); } catch (Exception e) { } _parameters = newParameters; _content = newContent; _macros = newMacros; _parsed = true; } } else { _log.debug("Ignoring parse request on already parsed template " + this); } }
public void parse() throws IOException, TemplateException { if (!_parsed) { Block newContent = null; Map newParameters = null; Map newMacros = null; Reader in = null; try { Parser parser = getParser(); in = getReader(); BlockBuilder bb = parser.parseBlock(getName(), in); if (in != null) in.close(); BuildContext bc = new BuildContext(_broker); newParameters = bc.getMap(); newMacros = bc.getMacros(); newContent = (Block) bb.build(bc); } catch (BuildException be) { newContent = null; _log.error("Template contained invalid data", be); throw be; } catch (IOException e) { newContent = null; // don't let the old one survive _log.error("Template: Could not read template: " + this); throw e; } catch (Exception e) { _log.error("Error parsing template: " + this, e); throw new BuildException("Error parsing template: " + this, e); } finally { try { if (in != null) in.close(); } catch (Exception e) { } _parameters = newParameters; _content = newContent; _macros = newMacros; _parsed = true; } } else { _log.debug("Ignoring parse request on already parsed template " + this); } }
3,232,556
public Template handle(WebContext context) throws HandlerException { Object output = new Object(); String templateName; // get the form variables output = (String) context.getForm("loadFile"); name = (String) context.getForm("name"); email = (String) context.getForm("email"); comment = (String) context.getForm("comment"); if (output == null) { output = "form.wm"; templateName = "form.wm"; } if (name == null) { name = "<!-- form variable 'name' not defined -->"; } if (email == null) { email = "<!-- form variable 'email' not defined -->"; } if (comment == null) { comment = "<!-- form variable 'comment' not defined -->"; } // verifying for submissions if (output.equals("verify")) { myGuestEntry = new GuestEntry(name, email, comment); book.addElement(myGuestEntry); context.put("registry", book); templateName = "verify.wm"; // for guest book view } else if (output.equals("allguest")) { context.put("registry",book); templateName = "allguest.wm"; // default } else { templateName = "form.wm"; } // return the appropriate template try { return getTemplate(templateName); } catch (Exception e) { throw new HandlerException("Could not locate template: " + templateName); } }
public Template handle(WebContext context) throws HandlerException { Object output = new Object(); String templateName; // get the form variables output = (String) context.getForm("loadFile"); name = (String) context.getForm("name"); email = (String) context.getForm("email"); comment = (String) context.getForm("comment"); if (output == null) { output = "form.wm"; templateName = "form.wm"; } if (name == null) { name = "<!-- form variable 'name' not defined -->"; } if (email == null) { email = "<!-- form variable 'email' not defined -->"; } if (comment == null) { comment = "<!-- form variable 'comment' not defined -->"; } // verifying for submissions if (output.equals("verify")) { myGuestEntry = new GuestEntry(name, email, comment); book.addElement(myGuestEntry); context.put("registry", book); templateName = "verify.wm"; // for guest book view } else if (output.equals("allguest")) { context.put("registry",book); templateName = "allguest.wm"; // default } else { templateName = "form.wm"; } // return the appropriate template try { Template t = getTemplate(templateName); return t; } catch (Exception e) { throw new HandlerException("Could not locate template: " + templateName); } }
3,232,557
public void handleCancellation() { String info = "The data saving has been cancelled."; registry.getLogger().info(this, info); // registry.getUserNotifier().notifyInfo("Data Saving Cancellation", // info); }
registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); public void handleCancellation()registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); {registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); String info = "The data saving has been cancelled.";registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getLogger().info(this, info);registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); // registry.getUserNotifier().notifyInfo("Data Saving Cancellation",registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); //registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); info);registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); registry.getUserNotifier().notifyInfo("Data Saving Cancellation", info); }
3,232,560
void setSelectedNode() { DefaultMutableTreeNode node = (DefaultMutableTreeNode) getLastSelectedPathComponent(); if (selectedNode == node) return; ImageDisplay newObject = (ImageDisplay) node.getUserObject(); ImageDisplay oldObject = null; if (selectedNode != null) oldObject = (ImageDisplay) selectedNode.getUserObject(); firePropertyChange(LOCALIZE_IMAGE_DISPLAY, oldObject, newObject); selectedNode = node; }
void setSelectedNode() { DefaultMutableTreeNode node = (DefaultMutableTreeNode) getLastSelectedPathComponent(); if (selectedNode == node) return; ImageDisplay newObject = (ImageDisplay) node.getUserObject(); ImageDisplay oldObject = null; if (selectedNode != null) oldObject = (ImageDisplay) selectedNode.getUserObject(); firePropertyChange(ClipBoard.LOCALIZE_IMAGE_DISPLAY, oldObject, newObject); selectedNode = node; }
3,232,561
public boolean isBlockGiven() { return getCurrentFrame().isBlockGiven(); }
public boolean isBlockGiven() { return getCurrentFrame().isBlockGiven() && blockStack.peek() != null; }
3,232,562
public RubyBlock cloneBlock() { return new RubyBlock( var, body, self, frame, scope, klass, iter, vmode, flags, dynamicVars, origThread, prev != null ? prev.cloneBlock() : null, ruby); }
public RubyBlock cloneBlock() { return new RubyBlock( var, body, self, frame, scope, klass, iter, vmode, flags, dynamicVars, origThread, prev, ruby); }
3,232,563
public String getWikiPageName(WikiSystem wiki, WebContext wc) { return null; }
public String getWikiPageName(WikiSystem wiki, WebContext wc) { return "RecentChanges"; }
3,232,564
ProjectEditorManager(ProjectEditor view, DataManagerCtrl agentCtrl, ProjectData model) { this.view = view; this.agentCtrl = agentCtrl; this.model = model; nameChange = false; isName = false; datasetsToRemove = new ArrayList(); datasetsToAdd = new ArrayList(); datasetsToAddToRemove = new ArrayList(); }
ProjectEditorManager(ProjectEditor view, DataManagerCtrl agentCtrl, ProjectData model) { this.view = view; this.agentCtrl = agentCtrl; this.model = model; nameChange = false; isName = false; datasetsToRemove = new ArrayList(); datasetsToAdd = new ArrayList(); datasetsToAddToRemove = new ArrayList(); }
3,232,565
void initListeners() { //buttons attachButtonListener(view.getViewButton(), VIEW); attachButtonListener(view.getSaveButton(), SAVE); attachButtonListener(view.getAddButton(), ADD); attachButtonListener(view.getRemoveButton(), REMOVE); attachButtonListener(view.getResetButton(), RESET); attachButtonListener(view.getRemoveToAddButton(), REMOVE_ADDED); attachButtonListener(view.getResetToAddButton(), RESET_ADDED); //text fields. JTextArea nameField = view.getNameField(); nameField.getDocument().addDocumentListener(this); nameField.addMouseListener(this); JTextArea descriptionArea = view.getDescriptionArea(); descriptionArea.getDocument().addDocumentListener(this); }
void initListeners() { //buttons attachButtonListener(view.getViewButton(), VIEW); attachButtonListener(view.getSaveButton(), SAVE); attachButtonListener(view.getAddButton(), ADD); attachButtonListener(view.getRemoveButton(), REMOVE); attachButtonListener(view.getResetButton(), RESET); attachButtonListener(view.getRemoveToAddButton(), REMOVE_ADDED); attachButtonListener(view.getResetToAddButton(), RESET_ADDED); //text fields. JTextArea nameField = view.getNameField(); nameField.getDocument().addDocumentListener(this); nameField.addMouseListener(this); JTextArea descriptionArea = view.getDescriptionArea(); descriptionArea.getDocument().addDocumentListener(this); }
3,232,566
public void insertUpdate(DocumentEvent e) { view.getSaveButton().setEnabled(isName); }
public void insertUpdate(DocumentEvent e) { view.getSaveButton().setEnabled(isName); }
3,232,567
public void removeUpdate(DocumentEvent e) { view.getSaveButton().setEnabled(isName); }
public void removeUpdate(DocumentEvent e) { view.getSaveButton().setEnabled(isName); }
3,232,568
public void initializeSession(XMPPConnection connection, String username, String password) { this.connection = connection; this.username = username; this.password = password; this.userBareAddress = StringUtils.parseBareAddress(connection.getUser()); // create workgroup session personalDataManager = new PrivateDataManager(getConnection()); LocalPreferences localPref = SettingsManager.getLocalPreferences(); // Start Idle listener if (localPref.isIdleOn()) { int delay = localPref.getIdleTime() * 60000; if (Spark.isWindows()) { try { setIdleListener(delay); } catch (Exception e) { Log.error(e); } } } // Discover items discoverItems(); ProviderManager.addExtensionProvider("event", "http://jabber.org/protocol/disco#info", new Features.Provider()); }
public void initializeSession(XMPPConnection connection, String username, String password) { this.connection = connection; this.username = username; this.password = password; this.userBareAddress = StringUtils.parseBareAddress(connection.getUser()); // create workgroup session personalDataManager = new PrivateDataManager(getConnection()); LocalPreferences localPref = SettingsManager.getLocalPreferences(); // Start Idle listener if (localPref.isIdleOn()) { int delay = localPref.getIdleTime() * 60000; if (Spark.isWindows()) { try { setIdleListener(delay); } catch (Exception e) { Log.error(e); } } } // Discover items discoverItems(); ProviderManager.addExtensionProvider("event", "http://jabber.org/protocol/disco#info", new Features.Provider()); }
3,232,569
private void setIdleListener(final long mill) throws Exception { final Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { long idleTime = SystemInfo.getSessionIdleTime(); boolean isLocked = SystemInfo.isSessionLocked(); if (idleTime > mill) { try { // Handle if spark is not connected to the server. if (SparkManager.getConnection() == null || !SparkManager.getConnection().isConnected()) { return; } // Change Status Workspace workspace = SparkManager.getWorkspace(); Presence presence = workspace.getStatusBar().getPresence(); if (workspace != null && presence.getMode() == Presence.Mode.available) { unavaliable = true; StatusItem away = workspace.getStatusBar().getStatusItem("Away"); Presence p = away.getPresence(); if (isLocked) { p.setStatus("User has locked their workstation."); } else { p.setStatus("Away due to idle."); } previousPriority = presence.getPriority(); p.setPriority(0); SparkManager.getSessionManager().changePresence(p); } } catch (Exception e) { Log.error("Error with IDLE status.", e); timer.cancel(); } } else { if (unavaliable) { setAvailableIfActive(); } } } }, 1000, 1000); }
private void setIdleListener() throws Exception { final Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { long idleTime = SystemInfo.getSessionIdleTime(); boolean isLocked = SystemInfo.isSessionLocked(); if (idleTime > mill) { try { // Handle if spark is not connected to the server. if (SparkManager.getConnection() == null || !SparkManager.getConnection().isConnected()) { return; } // Change Status Workspace workspace = SparkManager.getWorkspace(); Presence presence = workspace.getStatusBar().getPresence(); if (workspace != null && presence.getMode() == Presence.Mode.available) { unavaliable = true; StatusItem away = workspace.getStatusBar().getStatusItem("Away"); Presence p = away.getPresence(); if (isLocked) { p.setStatus("User has locked their workstation."); } else { p.setStatus("Away due to idle."); } previousPriority = presence.getPriority(); p.setPriority(0); SparkManager.getSessionManager().changePresence(p); } } catch (Exception e) { Log.error("Error with IDLE status.", e); timer.cancel(); } } else { if (unavaliable) { setAvailableIfActive(); } } } }, 1000, 1000); }
3,232,570
private void setIdleListener(final long mill) throws Exception { final Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { long idleTime = SystemInfo.getSessionIdleTime(); boolean isLocked = SystemInfo.isSessionLocked(); if (idleTime > mill) { try { // Handle if spark is not connected to the server. if (SparkManager.getConnection() == null || !SparkManager.getConnection().isConnected()) { return; } // Change Status Workspace workspace = SparkManager.getWorkspace(); Presence presence = workspace.getStatusBar().getPresence(); if (workspace != null && presence.getMode() == Presence.Mode.available) { unavaliable = true; StatusItem away = workspace.getStatusBar().getStatusItem("Away"); Presence p = away.getPresence(); if (isLocked) { p.setStatus("User has locked their workstation."); } else { p.setStatus("Away due to idle."); } previousPriority = presence.getPriority(); p.setPriority(0); SparkManager.getSessionManager().changePresence(p); } } catch (Exception e) { Log.error("Error with IDLE status.", e); timer.cancel(); } } else { if (unavaliable) { setAvailableIfActive(); } } } }, 1000, 1000); }
private void setIdleListener(final long mill) throws Exception { final Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { long idleTime = SystemInfo.getSessionIdleTime(); boolean isLocked = SystemInfo.isSessionLocked(); if (idleTime > delay) { try { // Handle if spark is not connected to the server. if (SparkManager.getConnection() == null || !SparkManager.getConnection().isConnected()) { return; } // Change Status Workspace workspace = SparkManager.getWorkspace(); Presence presence = workspace.getStatusBar().getPresence(); if (workspace != null && presence.getMode() == Presence.Mode.available) { unavaliable = true; StatusItem away = workspace.getStatusBar().getStatusItem("Away"); Presence p = away.getPresence(); if (isLocked) { p.setStatus("User has locked their workstation."); } else { p.setStatus("Away due to idle."); } previousPriority = presence.getPriority(); p.setPriority(0); SparkManager.getSessionManager().changePresence(p); } } catch (Exception e) { Log.error("Error with IDLE status.", e); timer.cancel(); } } else { if (unavaliable) { setAvailableIfActive(); } } } }, 1000, 1000); }
3,232,571
public void run() { long idleTime = SystemInfo.getSessionIdleTime(); boolean isLocked = SystemInfo.isSessionLocked(); if (idleTime > mill) { try { // Handle if spark is not connected to the server. if (SparkManager.getConnection() == null || !SparkManager.getConnection().isConnected()) { return; } // Change Status Workspace workspace = SparkManager.getWorkspace(); Presence presence = workspace.getStatusBar().getPresence(); if (workspace != null && presence.getMode() == Presence.Mode.available) { unavaliable = true; StatusItem away = workspace.getStatusBar().getStatusItem("Away"); Presence p = away.getPresence(); if (isLocked) { p.setStatus("User has locked their workstation."); } else { p.setStatus("Away due to idle."); } previousPriority = presence.getPriority(); p.setPriority(0); SparkManager.getSessionManager().changePresence(p); } } catch (Exception e) { Log.error("Error with IDLE status.", e); timer.cancel(); } } else { if (unavaliable) { setAvailableIfActive(); } } }
public void run() { long idleTime = SystemInfo.getSessionIdleTime(); boolean isLocked = SystemInfo.isSessionLocked(); if (idleTime > delay) { try { // Handle if spark is not connected to the server. if (SparkManager.getConnection() == null || !SparkManager.getConnection().isConnected()) { return; } // Change Status Workspace workspace = SparkManager.getWorkspace(); Presence presence = workspace.getStatusBar().getPresence(); if (workspace != null && presence.getMode() == Presence.Mode.available) { unavaliable = true; StatusItem away = workspace.getStatusBar().getStatusItem("Away"); Presence p = away.getPresence(); if (isLocked) { p.setStatus("User has locked their workstation."); } else { p.setStatus("Away due to idle."); } previousPriority = presence.getPriority(); p.setPriority(0); SparkManager.getSessionManager().changePresence(p); } } catch (Exception e) { Log.error("Error with IDLE status.", e); timer.cancel(); } } else { if (unavaliable) { setAvailableIfActive(); } } }
3,232,572
void buildUI() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(createLabelText(groupNameLabel, groupName, 20)); panel.add(Box.createRigidArea(new Dimension(5, 5))); panel.add(createLabelText(descriptionLabel, description, 60)); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(Box.createHorizontalStrut(250)); buttonPanel.add(saveBtn); panel.add(buttonPanel); panel.add(Box.createVerticalStrut(50)); JPanel userGroupListButtonPanel = new JPanel(); userGroupListButtonPanel.setLayout(new BoxLayout( userGroupListButtonPanel, BoxLayout.Y_AXIS)); userGroupListButtonPanel.add(addUserBtn); userGroupListButtonPanel.add(removeUserBtn); JPanel userGroupPanel = new JPanel(); userGroupPanel .setLayout(new BoxLayout(userGroupPanel, BoxLayout.Y_AXIS)); userGroupPanel.add(userGroupListLabel); userGroupPanel.add(groupMembershipList); JPanel userGroupListPanel = new JPanel(); userGroupListPanel.setLayout(new BoxLayout(userGroupListPanel, BoxLayout.X_AXIS)); userGroupListPanel.add(userGroupListButtonPanel); userGroupListPanel.add(userGroupPanel); JPanel infoPanel = new JPanel(); infoPanel.setLayout(new BoxLayout(infoPanel, BoxLayout.Y_AXIS)); infoPanel.add(panel); infoPanel.add(userGroupListPanel); JPanel groupListPanel = new JPanel(); groupListPanel .setLayout(new BoxLayout(groupListPanel, BoxLayout.Y_AXIS)); groupListPanel.add(groupListLabel); groupListPanel.add(groupList); JPanel groupListButtonPanel = new JPanel(); groupListButtonPanel.setLayout(new BoxLayout(groupListButtonPanel, BoxLayout.Y_AXIS)); groupListButtonPanel.add(addGroupBtn); // groupListButtonPanel.add(removeGroupBtn); JPanel groupPanel = new JPanel(); groupPanel.setLayout(new BoxLayout(groupPanel, BoxLayout.X_AXIS)); groupPanel.add(groupListButtonPanel); groupPanel.add(Box.createHorizontalStrut(20)); groupPanel.add(groupListPanel); JPanel usersPanel = new JPanel(); usersPanel.setLayout(new BoxLayout(usersPanel, BoxLayout.Y_AXIS)); usersPanel.add(userListLabel); usersPanel.add(userList); JPanel spacerPanel = new JPanel(); spacerPanel.setLayout(new BoxLayout(spacerPanel, BoxLayout.X_AXIS)); spacerPanel.add(Box.createHorizontalStrut(60)); spacerPanel.add(usersPanel); JPanel listContainer = new JPanel(); listContainer.setLayout(new BoxLayout(listContainer, BoxLayout.Y_AXIS)); listContainer.add(groupPanel); listContainer.add(spacerPanel); JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS)); container.add(listContainer); container.add(Box.createHorizontalStrut(50)); container.add(infoPanel); container.add(Box.createHorizontalStrut(10)); this.setLayout(new BorderLayout()); this.add(container); }
void buildUI() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(createLabelText(groupNameLabel, groupName, 20)); panel.add(Box.createRigidArea(new Dimension(5, 5))); panel.add(createLabelText(descriptionLabel, description, 60)); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(Box.createHorizontalStrut(100)); buttonPanel.add(setDefaultBtn); buttonPanel.add(Box.createHorizontalStrut(50)); buttonPanel.add(saveBtn); panel.add(buttonPanel); panel.add(Box.createVerticalStrut(50)); JPanel userGroupListButtonPanel = new JPanel(); userGroupListButtonPanel.setLayout(new BoxLayout( userGroupListButtonPanel, BoxLayout.Y_AXIS)); userGroupListButtonPanel.add(addUserBtn); userGroupListButtonPanel.add(removeUserBtn); JPanel userGroupPanel = new JPanel(); userGroupPanel .setLayout(new BoxLayout(userGroupPanel, BoxLayout.Y_AXIS)); userGroupPanel.add(userGroupListLabel); userGroupPanel.add(groupMembershipList); JPanel userGroupListPanel = new JPanel(); userGroupListPanel.setLayout(new BoxLayout(userGroupListPanel, BoxLayout.X_AXIS)); userGroupListPanel.add(userGroupListButtonPanel); userGroupListPanel.add(userGroupPanel); JPanel infoPanel = new JPanel(); infoPanel.setLayout(new BoxLayout(infoPanel, BoxLayout.Y_AXIS)); infoPanel.add(panel); infoPanel.add(userGroupListPanel); JPanel groupListPanel = new JPanel(); groupListPanel .setLayout(new BoxLayout(groupListPanel, BoxLayout.Y_AXIS)); groupListPanel.add(groupListLabel); groupListPanel.add(groupList); JPanel groupListButtonPanel = new JPanel(); groupListButtonPanel.setLayout(new BoxLayout(groupListButtonPanel, BoxLayout.Y_AXIS)); groupListButtonPanel.add(addGroupBtn); // groupListButtonPanel.add(removeGroupBtn); JPanel groupPanel = new JPanel(); groupPanel.setLayout(new BoxLayout(groupPanel, BoxLayout.X_AXIS)); groupPanel.add(groupListButtonPanel); groupPanel.add(Box.createHorizontalStrut(20)); groupPanel.add(groupListPanel); JPanel usersPanel = new JPanel(); usersPanel.setLayout(new BoxLayout(usersPanel, BoxLayout.Y_AXIS)); usersPanel.add(userListLabel); usersPanel.add(userList); JPanel spacerPanel = new JPanel(); spacerPanel.setLayout(new BoxLayout(spacerPanel, BoxLayout.X_AXIS)); spacerPanel.add(Box.createHorizontalStrut(60)); spacerPanel.add(usersPanel); JPanel listContainer = new JPanel(); listContainer.setLayout(new BoxLayout(listContainer, BoxLayout.Y_AXIS)); listContainer.add(groupPanel); listContainer.add(spacerPanel); JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS)); container.add(listContainer); container.add(Box.createHorizontalStrut(50)); container.add(infoPanel); container.add(Box.createHorizontalStrut(10)); this.setLayout(new BorderLayout()); this.add(container); }
3,232,573
void createActionButtons() { saveBtn = new JButton("Save"); ImageIcon addUserIcon = ImageFactory.get().image( ImageFactory.LEFT_ARROW); ImageIcon removeUserIcon = ImageFactory.get().image( ImageFactory.RIGHT_ARROW); ImageIcon addGroupIcon = ImageFactory.get() .image(ImageFactory.ADD_USER); ImageIcon removeGroupIcon = ImageFactory.get().image( ImageFactory.REMOVE_USER); addUserBtn = new JButton(addUserIcon); removeUserBtn = new JButton(removeUserIcon); addGroupBtn = new JButton(addGroupIcon); removeGroupBtn = new JButton(removeGroupIcon); }
void createActionButtons() { saveBtn = new JButton("Save"); ImageIcon addUserIcon = ImageFactory.get().image( ImageFactory.LEFT_ARROW); ImageIcon removeUserIcon = ImageFactory.get().image( ImageFactory.RIGHT_ARROW); ImageIcon addGroupIcon = ImageFactory.get() .image(ImageFactory.ADD_USER); ImageIcon removeGroupIcon = ImageFactory.get().image( ImageFactory.REMOVE_USER); addUserBtn = new JButton(addUserIcon); removeUserBtn = new JButton(removeUserIcon); addGroupBtn = new JButton(addGroupIcon); removeGroupBtn = new JButton(removeGroupIcon); }
3,232,574
public MainController(DisplayedDocument displayedDocument) { super(displayedDocument); }
public MainController(DisplayedDocument displayedDocument) { super(displayedDocument); }
3,232,577
private void getFiles() { for (Iterator iter = patterns.iterator(); iter.hasNext();) { GlobPattern globPattern = (GlobPattern) iter.next(); String[] dirs = globPattern.getPattern().split(File.separator); File root = new File(dirs[0]); int idx = 1; if (glob2Regexp(dirs[0]) != null) { root = new File("."); idx = 0; } for (int size = dirs.length; idx < size; idx++) { if (glob2Regexp(dirs[idx]) == null) { root = new File(root, dirs[idx]); } else { break; } } ArrayList matchingFiles = new ArrayList(); if (idx == dirs.length) { if (root.exists()) { matchingFiles.add(root); } globPattern.setMatchedFiles(matchingFiles); continue; } matchingFiles.add(root); for (int length = dirs.length; idx < length; idx++) { ArrayList currentMatchingFiles = new ArrayList(); for (int i = 0, size = matchingFiles.size(); i < size; i++) { boolean isDirectory = idx + 1 != length; String pattern = dirs[idx]; File parent = (File) matchingFiles.get(i); currentMatchingFiles.addAll(getMatchingFiles(parent, pattern, isDirectory)); } matchingFiles = currentMatchingFiles; } globPattern.setMatchedFiles(matchingFiles); } }
private void getFiles() { for (Iterator iter = patterns.iterator(); iter.hasNext();) { GlobPattern globPattern = (GlobPattern) iter.next(); String[] dirs = globPattern.getPattern().split(pathSplitter); File root = new File(dirs[0]); int idx = 1; if (glob2Regexp(dirs[0]) != null) { root = new File("."); idx = 0; } for (int size = dirs.length; idx < size; idx++) { if (glob2Regexp(dirs[idx]) == null) { root = new File(root, dirs[idx]); } else { break; } } ArrayList matchingFiles = new ArrayList(); if (idx == dirs.length) { if (root.exists()) { matchingFiles.add(root); } globPattern.setMatchedFiles(matchingFiles); continue; } matchingFiles.add(root); for (int length = dirs.length; idx < length; idx++) { ArrayList currentMatchingFiles = new ArrayList(); for (int i = 0, size = matchingFiles.size(); i < size; i++) { boolean isDirectory = idx + 1 != length; String pattern = dirs[idx]; File parent = (File) matchingFiles.get(i); currentMatchingFiles.addAll(getMatchingFiles(parent, pattern, isDirectory)); } matchingFiles = currentMatchingFiles; } globPattern.setMatchedFiles(matchingFiles); } }
3,232,579
public String[] getNames() { try { getFiles(); } catch (PatternSyntaxException e) { // This can happen if someone does Dir.glob("{") or similiar. return new String[] {}; } ArrayList allMatchedNames = new ArrayList(); for (Iterator iter = patterns.iterator(); iter.hasNext();) { GlobPattern pattern = (GlobPattern) iter.next(); allMatchedNames.addAll(pattern.getMatchedFiles()); } return (String[]) allMatchedNames.toArray(new String[allMatchedNames.size()]); }
public String[] getNames() { try { getFiles(); } catch (PatternSyntaxException e) { // This can happen if someone does Dir.glob("{") or similiar. return new String[] {}; } ArrayList allMatchedNames = new ArrayList(); for (Iterator iter = patterns.iterator(); iter.hasNext();) { GlobPattern pattern = (GlobPattern) iter.next(); allMatchedNames.addAll(pattern.getMatchedFiles()); } return (String[]) allMatchedNames.toArray(new String[allMatchedNames.size()]); }
3,232,580
public boolean getOnOff() { return onOff; }
public boolean getOnOff() { return onOff; }
3,232,581
private void paintROICollection(Graphics2D g2D, List l) { Iterator i = l.iterator(); ROIShape roi; Shape s; Rectangle r; magFactor = manager.getCurrentImageAffineTransform().getMagFactor(); while (i.hasNext()) { roi = (ROIShape) i.next(); setShapeBounds(roi); s = roi.getShape(); g2D.setColor(roi.getLineColor()); g2D.draw(s); r = s.getBounds(); if (textOnOff) { Point p = ROIFactory.setLabelLocation(s, roi.getShapeType(), LENGTH); g2D.drawString(roi.getText(), p.x, p.y); } if (roi.getIndex() == indexSelected) { square.setRect(r.x-LENGTH/2, r.y+r.height/2-LENGTH/2, LENGTH, LENGTH); g2D.setPaint(squareColor); g2D.fill(square); } } }
private void paintROICollection(Graphics2D g2D, List l) { Iterator i = l.iterator(); ROIShape roi; Shape s; Rectangle r; magFactor = manager.getCurrentImageAffineTransform().getMagFactor(); while (i.hasNext()) { roi = (ROIShape) i.next(); setShapeBounds(roi); s = roi.getShape(); r = s.getBounds(); g2D.setStroke(dashed); g2D.setColor(alphaColor(roi.getLineColor())); if (roi.getIndex() == indexSelected) { g2D.setStroke(stroke); g2D.setColor(roi.getLineColor()); } g2D.draw(s); r = s.getBounds(); if (textOnOff) { Point p = ROIFactory.setLabelLocation(s, roi.getShapeType(), LENGTH); g2D.drawString(roi.getText(), p.x, p.y); } if (roi.getIndex() == indexSelected) { square.setRect(r.x-LENGTH/2, r.y+r.height/2-LENGTH/2, LENGTH, LENGTH); g2D.setPaint(squareColor); g2D.fill(square); } } }
3,232,582
private void paintROICollection(Graphics2D g2D, List l) { Iterator i = l.iterator(); ROIShape roi; Shape s; Rectangle r; magFactor = manager.getCurrentImageAffineTransform().getMagFactor(); while (i.hasNext()) { roi = (ROIShape) i.next(); setShapeBounds(roi); s = roi.getShape(); g2D.setColor(roi.getLineColor()); g2D.draw(s); r = s.getBounds(); if (textOnOff) { Point p = ROIFactory.setLabelLocation(s, roi.getShapeType(), LENGTH); g2D.drawString(roi.getText(), p.x, p.y); } if (roi.getIndex() == indexSelected) { square.setRect(r.x-LENGTH/2, r.y+r.height/2-LENGTH/2, LENGTH, LENGTH); g2D.setPaint(squareColor); g2D.fill(square); } } }
private void paintROICollection(Graphics2D g2D, List l) { Iterator i = l.iterator(); ROIShape roi; Shape s; Rectangle r; magFactor = manager.getCurrentImageAffineTransform().getMagFactor(); while (i.hasNext()) { roi = (ROIShape) i.next(); setShapeBounds(roi); s = roi.getShape(); g2D.setColor(roi.getLineColor()); g2D.draw(s); if (textOnOff) { Point p = ROIFactory.setLabelLocation(s, roi.getShapeType(), LENGTH); g2D.drawString(roi.getText(), p.x, p.y); } if (roi.getIndex() == indexSelected) { square.setRect(r.x-LENGTH/2, r.y+r.height/2-LENGTH/2, LENGTH, LENGTH); g2D.setPaint(squareColor); g2D.fill(square); } } }
3,232,583
private void paintROICollection(Graphics2D g2D, List l) { Iterator i = l.iterator(); ROIShape roi; Shape s; Rectangle r; magFactor = manager.getCurrentImageAffineTransform().getMagFactor(); while (i.hasNext()) { roi = (ROIShape) i.next(); setShapeBounds(roi); s = roi.getShape(); g2D.setColor(roi.getLineColor()); g2D.draw(s); r = s.getBounds(); if (textOnOff) { Point p = ROIFactory.setLabelLocation(s, roi.getShapeType(), LENGTH); g2D.drawString(roi.getText(), p.x, p.y); } if (roi.getIndex() == indexSelected) { square.setRect(r.x-LENGTH/2, r.y+r.height/2-LENGTH/2, LENGTH, LENGTH); g2D.setPaint(squareColor); g2D.fill(square); } } }
private void paintROICollection(Graphics2D g2D, List l) { Iterator i = l.iterator(); ROIShape roi; Shape s; Rectangle r; magFactor = manager.getCurrentImageAffineTransform().getMagFactor(); while (i.hasNext()) { roi = (ROIShape) i.next(); setShapeBounds(roi); s = roi.getShape(); g2D.setColor(roi.getLineColor()); g2D.draw(s); r = s.getBounds(); if (textOnOff) { Point p = ROIFactory.setLabelLocation(s, roi.getShapeType(), LENGTH); g2D.drawString(roi.getLabel(), p.x, p.y); } if (roi.getIndex() == indexSelected) { square.setRect(r.x-LENGTH/2, r.y+r.height/2-LENGTH/2, LENGTH, LENGTH); g2D.setPaint(squareColor); g2D.fill(square); } } }
3,232,584
private void paintROICollection(Graphics2D g2D, List l) { Iterator i = l.iterator(); ROIShape roi; Shape s; Rectangle r; magFactor = manager.getCurrentImageAffineTransform().getMagFactor(); while (i.hasNext()) { roi = (ROIShape) i.next(); setShapeBounds(roi); s = roi.getShape(); g2D.setColor(roi.getLineColor()); g2D.draw(s); r = s.getBounds(); if (textOnOff) { Point p = ROIFactory.setLabelLocation(s, roi.getShapeType(), LENGTH); g2D.drawString(roi.getText(), p.x, p.y); } if (roi.getIndex() == indexSelected) { square.setRect(r.x-LENGTH/2, r.y+r.height/2-LENGTH/2, LENGTH, LENGTH); g2D.setPaint(squareColor); g2D.fill(square); } } }
private void paintROICollection(Graphics2D g2D, List l) { Iterator i = l.iterator(); ROIShape roi; Shape s; Rectangle r; magFactor = manager.getCurrentImageAffineTransform().getMagFactor(); while (i.hasNext()) { roi = (ROIShape) i.next(); setShapeBounds(roi); s = roi.getShape(); g2D.setColor(roi.getLineColor()); g2D.draw(s); r = s.getBounds(); if (textOnOff) { Point p = ROIFactory.setLabelLocation(s, roi.getShapeType(), LENGTH); g2D.drawString(roi.getText(), p.x, p.y); } if (roi.getAnnotation() != null && onOff) { square.setRect(r.x-LENGTH/2, r.y+r.height/2-LENGTH/2, LENGTH, LENGTH); g2D.setPaint(squareColor); g2D.fill(square); } } }
3,232,585
private void paintROICollection(Graphics2D g2D, List l) { Iterator i = l.iterator(); ROIShape roi; Shape s; Rectangle r; magFactor = manager.getCurrentImageAffineTransform().getMagFactor(); while (i.hasNext()) { roi = (ROIShape) i.next(); setShapeBounds(roi); s = roi.getShape(); g2D.setColor(roi.getLineColor()); g2D.draw(s); r = s.getBounds(); if (textOnOff) { Point p = ROIFactory.setLabelLocation(s, roi.getShapeType(), LENGTH); g2D.drawString(roi.getText(), p.x, p.y); } if (roi.getIndex() == indexSelected) { square.setRect(r.x-LENGTH/2, r.y+r.height/2-LENGTH/2, LENGTH, LENGTH); g2D.setPaint(squareColor); g2D.fill(square); } } }
private void paintROICollection(Graphics2D g2D, List l) { Iterator i = l.iterator(); ROIShape roi; Shape s; Rectangle r; magFactor = manager.getCurrentImageAffineTransform().getMagFactor(); while (i.hasNext()) { roi = (ROIShape) i.next(); setShapeBounds(roi); s = roi.getShape(); g2D.setColor(roi.getLineColor()); g2D.draw(s); r = s.getBounds(); if (textOnOff) { Point p = ROIFactory.setLabelLocation(s, roi.getShapeType(), LENGTH); g2D.drawString(roi.getText(), p.x, p.y); } if (roi.getIndex() == indexSelected) { square.setRect(r.x-LENGTH/2, r.y+r.height/2-LENGTH/2, LENGTH, LENGTH); g2D.setPaint(squareColor); g2D.fill(square); } } }
3,232,586
private void setShapeBounds(ROIShape roi) { Shape shape = roi.getShape(); Rectangle r = shape.getBounds(); double factor = roi.getAffineTransform().getMagFactor(); int shapeType = roi.getShapeType(); double coeff = magFactor/factor; ROIFactory.setShapeBounds(shape, shapeType, (int) (r.x*coeff), (int) (r.y*coeff), (int) (r.width*coeff), (int) (r.height*coeff)); roi.getAffineTransform().setMagFactor(magFactor); roi.setShape(shape); }
privatevoidsetShapeBounds(ROIShaperoi){Shapeshape=roi.getShape();Rectangler=shape.getBounds();doublefactor=roi.getAffineTransform().getMagFactor();intshapeType=roi.getShapeType();doublecoeff=magFactor/factor;ROIFactory.setShapeBounds(shape,shapeType,(int)(r.x*coeff),(int)(r.y*coeff),(int)(r.width*coeff),(int)(r.height*coeff));roi.getAffineTransform().setMagFactor(magFactor);roi.setShape(shape);}
3,232,587
public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh, List xmlPreprocessors) throws BeansException { this(configLocations, refresh, null, xmlPreprocessors); }
public FileSystemXmlApplicationContext(String[] configLocations, boolean refresh, List xmlPreprocessors) throws BeansException { this(configLocations, refresh, null, xmlPreprocessors); }
3,232,588
protected void setUp() throws IOException { // Create set up the base fixture which sets up the database for us baseFixture = new PixbufIOFixture(); pixels = baseFixture.setUp(); // "Our" fixture which creates the planes needed for this test case. PixelsService service = new PixelsService(); pixbuf = service.createPixelBuffer(pixels); }
protected void setUp() throws IOException { // Create set up the base fixture which sets up the database for us baseFixture = new PixbufIOFixture(); pixels = baseFixture.setUp(); // "Our" fixture which creates the planes needed for this test case. PixelsService service = new PixelsService(PixelsService.ROOT_DEFAULT); pixbuf = service.createPixelBuffer(pixels); }
3,232,589
int convertGraphicsIntoReal(int x) { int b = control.getGlobalMaximum(); int y = x-tW; double a = (double) (control.getGlobalMinimum()-b)/(double) rangeGraphics; return (int) (a*y+b); }
int convertGraphicsIntoReal(int x) { int b = control.getGlobalMaximum(); int y = x-tW; double a = (double) (control.getGlobalMinimum()-b)/(double) rangeGraphics; return (int) (a*y+b); }
3,232,590
int convertRealIntoGraphics(int x) { int b = control.getGlobalMinimum(); int c = control.getGlobalMaximum(); double a = (double) rangeGraphics/(double) (b-c); return (int) (a*(x-c)+tW); }
int convertRealIntoGraphics(int x) { int b = control.getGlobalMinimum(); int c = control.getGlobalMaximum(); double a = (double) rangeGraphics/(double) (b-c); return (int) (a*(x-c)+tW); }
3,232,591
public Iterator findIterator(Object instance) throws PropertyException { if (iteratorMethod != null) { try { Object ret = invoke(iteratorMethod, instance, null); if (ret instanceof Iterator) { return (Iterator) ret; } else if (ret instanceof Enumeration) { return new EnumIterator((Enumeration) ret); } else if (ret instanceof Object[]) { return new ArrayIterator((Object[]) ret); } } catch (NoSuchMethodException e) { throw new PropertyException("Error in PropertyOperator!", e); } } throw new PropertyException(instance + " is not a list", null); }
public Iterator findIterator(Object instance) throws PropertyException { if (iteratorMethod != null) { try { Object ret = invoke(iteratorMethod, instance, null); if (ret instanceof Iterator) { return (Iterator) ret; } else if (ret instanceof Enumeration) { return new EnumIterator((Enumeration) ret); } else if (ret instanceof Object[]) { return new ArrayIterator((Object[]) ret); } } catch (NoSuchMethodException e) { throw new PropertyException("Error in PropertyOperator!", e); } } throw new PropertyException(instance + " is not a list", null); }
3,232,592
public Iterator findIterator(Object instance) throws PropertyException { if (iteratorMethod != null) { try { Object ret = invoke(iteratorMethod, instance, null); if (ret instanceof Iterator) { return (Iterator) ret; } else if (ret instanceof Enumeration) { return new EnumIterator((Enumeration) ret); } else if (ret instanceof Object[]) { return new ArrayIterator((Object[]) ret); } } catch (NoSuchMethodException e) { throw new PropertyException("Error in PropertyOperator!", e); } } throw new PropertyException(instance + " is not a list", null); }
public Iterator findIterator(Object instance) throws PropertyException { if (iteratorMethod != null) { try { Object ret = invoke(iteratorMethod, instance, null); if (ret instanceof Iterator) { return (Iterator) ret; } else if (ret instanceof Enumeration) { return new EnumIterator((Enumeration) ret); } else if (ret instanceof Object[]) { return new ArrayIterator((Object[]) ret); } } catch (NoSuchMethodException e) { throw new PropertyException("Error in PropertyOperator!", e); } } throw new PropertyException(instance + " is not a list", null); }
3,232,593
static Object invoke(Method meth, Object instance, Object[] args) throws PropertyException, NoSuchMethodException { try { Object obj = meth.invoke(instance, args); // if the method's return type is void return the VoidMacro // instance, instead of the 'null' we used to return here // otherwise, just return whatever the method returned if (obj == null && meth.getReturnType() == java.lang.Void.TYPE) return org.webmacro.engine.VoidMacro.instance; else return obj; } catch (IllegalAccessException e) { throw new PropertyException( "You don't have permission to access the requested method (" + meth + " in class " + instance.getClass() + " on object " + instance + "). Private/protected/package access " + " values cannot be accessed via property introspection.", e); } catch (IllegalArgumentException e) { throw new PropertyException( "Some kind of error occurred processing your request: this " + "indicates a failure in PropertyOperator.java that should be " + "reported: attempt to access method " + meth + " on object " + instance + " with " + args.length + " parameters " + " threw an exception: " + e, e); } catch (InvocationTargetException e) { // if this is a wrapped UndefinedVariableException, unwrap and rethrow it if (e.getTargetException() instanceof PropertyException.UndefinedVariableException) throw (PropertyException) e.getTargetException(); throw new PropertyException( "Attempt to invoke method " + meth + " on object " + instance + " of " + instance.getClass() + " raised an exception: " + e.getTargetException(), e.getTargetException()); } catch (NullPointerException e) { throw new PropertyException( "NullPointerException thrown from method " + meth + " on object " + instance + " -- most likely you have attempted " + "to use an undefined value, or a failure in that method.", e); } }
static Object invoke(Method meth, Object instance, Object[] args) throws PropertyException { try { Object obj = meth.invoke(instance, args); // if the method's return type is void return the VoidMacro // instance, instead of the 'null' we used to return here // otherwise, just return whatever the method returned if (obj == null && meth.getReturnType() == java.lang.Void.TYPE) return org.webmacro.engine.VoidMacro.instance; else return obj; } catch (IllegalAccessException e) { throw new PropertyException( "You don't have permission to access the requested method (" + meth + " in class " + instance.getClass() + " on object " + instance + "). Private/protected/package access " + " values cannot be accessed via property introspection.", e); } catch (IllegalArgumentException e) { throw new PropertyException( "Some kind of error occurred processing your request: this " + "indicates a failure in PropertyOperator.java that should be " + "reported: attempt to access method " + meth + " on object " + instance + " with " + args.length + " parameters " + " threw an exception: " + e, e); } catch (InvocationTargetException e) { // if this is a wrapped UndefinedVariableException, unwrap and rethrow it if (e.getTargetException() instanceof PropertyException.UndefinedVariableException) throw (PropertyException) e.getTargetException(); throw new PropertyException( "Attempt to invoke method " + meth + " on object " + instance + " of " + instance.getClass() + " raised an exception: " + e.getTargetException(), e.getTargetException()); } catch (NullPointerException e) { throw new PropertyException( "NullPointerException thrown from method " + meth + " on object " + instance + " -- most likely you have attempted " + "to use an undefined value, or a failure in that method.", e); } }
3,232,594
Object clean(Object obj) { if (!Hibernate.isInitialized(obj)) { throw new IllegalStateException( "If the return object is not initialized then we can't send it."); } Set done = new HashSet(); hessianClean(obj, done); return obj; }
Object clean(Object obj) { if (!Hibernate.isInitialized(obj)) { throw new IllegalStateException( "If the return object is not initialized then we can't send it."); } Set done = new HashSet(); hessianClean(obj, done); return obj; }
3,232,595
Object clean(Object obj) { if (!Hibernate.isInitialized(obj)) { throw new IllegalStateException( "If the return object is not initialized then we can't send it."); } Set done = new HashSet(); hessianClean(obj, done); return obj; }
Object clean(Object obj) { if (!Hibernate.isInitialized(obj)) { throw new IllegalStateException( "If the return object is not initialized then we can't send it."); } Set done = new HashSet(); hessianClean(obj, done); return obj; }
3,232,596
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
3,232,597
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
3,232,598
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = classifications.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
3,232,599
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
3,232,600
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
3,232,601
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
3,232,602
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ // TODO where else could be null with outer join categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
3,232,603
void hessianClean(Object obj, Set done) { if (null == obj) return; if (done.contains(obj)) return; done.add(obj); if (obj instanceof Map) { Map map = (Map) obj; for (Iterator i = map.values().iterator(); i.hasNext();) { Object value = i.next(); hessianClean(value, done); } } else if (obj instanceof Set) { Set set = (Set) obj; for (Iterator i = set.iterator(); i.hasNext();) { Object item = i.next(); hessianClean(item, done); } } else { Method[] methods = ReflectionUtils.getGettersAndSetters(obj); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().startsWith("set")) continue; Object result = ReflectionUtils.invokeGetter(obj, method); if (!Hibernate.isInitialized(result)) { Method setter = ReflectionUtils.getSetterForGetter(methods, method); if (null == setter) { throw new IllegalStateException( "No setter for getter; this will explode:" + method); } ReflectionUtils.setToNull(obj, setter); } else { hessianClean(result, done); } } } }
private void hessianClean(Object obj, Set done) { if (null == obj) return; if (done.contains(obj)) return; done.add(obj); if (obj instanceof Map) { Map map = (Map) obj; for (Iterator i = map.values().iterator(); i.hasNext();) { Object value = i.next(); hessianClean(value, done); } } else if (obj instanceof Set) { Set set = (Set) obj; for (Iterator i = set.iterator(); i.hasNext();) { Object item = i.next(); hessianClean(item, done); } } else { Method[] methods = ReflectionUtils.getGettersAndSetters(obj); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().startsWith("set")) continue; Object result = ReflectionUtils.invokeGetter(obj, method); if (!Hibernate.isInitialized(result)) { Method setter = ReflectionUtils.getSetterForGetter(methods, method); if (null == setter) { throw new IllegalStateException( "No setter for getter; this will explode:" + method); } ReflectionUtils.setToNull(obj, setter); } else { hessianClean(result, done); } } } }
3,232,604
void hessianClean(Object obj, Set done) { if (null == obj) return; if (done.contains(obj)) return; done.add(obj); if (obj instanceof Map) { Map map = (Map) obj; for (Iterator i = map.values().iterator(); i.hasNext();) { Object value = i.next(); hessianClean(value, done); } } else if (obj instanceof Set) { Set set = (Set) obj; for (Iterator i = set.iterator(); i.hasNext();) { Object item = i.next(); hessianClean(item, done); } } else { Method[] methods = ReflectionUtils.getGettersAndSetters(obj); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().startsWith("set")) continue; Object result = ReflectionUtils.invokeGetter(obj, method); if (!Hibernate.isInitialized(result)) { Method setter = ReflectionUtils.getSetterForGetter(methods, method); if (null == setter) { throw new IllegalStateException( "No setter for getter; this will explode:" + method); } ReflectionUtils.setToNull(obj, setter); } else { hessianClean(result, done); } } } }
void hessianClean(Object obj, Set done) { if (null == obj) return; if (done.contains(obj)) return; done.add(obj); if (obj instanceof Map) { Map map = (Map) obj; for (Iterator i = map.values().iterator(); i.hasNext();) { Object value = i.next(); hessianClean(value, done); } } else if (obj instanceof Set) { Set set = (Set) obj; for (Iterator i = set.iterator(); i.hasNext();) { Object item = i.next(); hessianClean(item, done); } } else { Method[] methods = ReflectionUtils.getGettersAndSetters(obj); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().startsWith("set")) continue; Object result = ReflectionUtils.invokeGetter(obj, method); if (!Hibernate.isInitialized(result)) { Method setter = ReflectionUtils.getSetterForGetter(methods, method); if (null == setter) { throw new IllegalStateException( "No setter for getter; this will explode:" + method); } ReflectionUtils.setToNull(obj, setter); } else { hessianClean(result, done); } } } }
3,232,605
public void testFindCGCPaths() { T t = new T(IllegalArgumentException.class){ @Override public void doTest(Object[] arg) { manager.findCGCPaths((Set)arg[0],((Integer)arg[1]).intValue(), (Map)arg[2]); } }; // param1: not null t.blowup(true,null,1,new HashMap()); t.blowup(false,new HashSet(),1,new HashMap()); // param2: // TODO }
public void testFindCGCPaths() { T t = new T(IllegalArgumentException.class){ @Override public void doTest(Object[] arg) { manager.findCGCPaths((Set)arg[0],((Integer)arg[1]).intValue(), (Map)arg[2]); } }; // param1: not null t.blowup(true,null,1,new HashMap()); t.blowup(false,new HashSet(),1,new HashMap()); // param2: // TODO }
3,232,606
public void testFindCGCPaths() { T t = new T(IllegalArgumentException.class){ @Override public void doTest(Object[] arg) { manager.findCGCPaths((Set)arg[0],((Integer)arg[1]).intValue(), (Map)arg[2]); } }; // param1: not null t.blowup(true,null,1,new HashMap()); t.blowup(false,new HashSet(),1,new HashMap()); // param2: // TODO }
public void testFindCGCPaths() { T t = new T(IllegalArgumentException.class){ @Override public void doTest(Object[] arg) { manager.findCGCPaths((Set)arg[0],((Integer)arg[1]).intValue(), (Map)arg[2]); } }; // param1: not null t.blowup(true,null,1,new HashMap()); t.blowup(false,new HashSet(),1,new HashMap()); // param2: // TODO }
3,232,607
public void doTest(Object[] arg) { manager.findCGCPaths((Set)arg[0],((Integer)arg[1]).intValue(), (Map)arg[2]); }
public void doTest(Object[] arg) { manager.findCGCPaths((Set)arg[0],((Integer)arg[1]).intValue(), (Map)arg[2]); }
3,232,608
public boolean accept(WikiSystem wiki, WebContext wc, WikiUser user) { Enumeration enum = wc.getRequest().getParameterNames(); // don't accept if we have request parameters while (enum.hasMoreElements()) return false; // and then only accept if this is a get request return wc.getRequest().getMethod().equalsIgnoreCase("GET"); }
public boolean accept(WikiSystem wiki, WebContext wc, WikiUser user) { Enumeration enum = wc.getRequest().getParameterNames(); // don't accept if we have request parameters if (enum.hasMoreElements()) return false; // and then only accept if this is a get request return wc.getRequest().getMethod().equalsIgnoreCase("GET"); }
3,232,609
public String getTemplateName(WikiSystem wiki, WikiPage page) { Properties props = wiki.getProperties(); String template = props.getProperty (page.getTitle()); return template == null ? props.getProperty ("ViewPageAction.Template") : template; }
public String getTemplateName(WikiSystem wiki, WikiPage page) { Properties props = wiki.getProperties(); String template = props.getProperty (page.getTitle()); return template == null ? props.getProperty ("ViewPageAction.Template") : template; }
3,232,610
public void create() { super.create(); delegate = (RenderingEngine) applicationContext.getBean("renderService"); }
public void create() { super.create(); delegate = (RenderingEngine) applicationContext.getBean( RenderingEngine.class.getName()); }
3,232,611
public String toString() { StringBuffer buffer = new StringBuffer(100); StringBuffer off = new StringBuffer(3); buffer.append("(?"); flagToString(buffer, off, Pattern.DOTALL, 'm'); flagToString(buffer, off, Pattern.CASE_INSENSITIVE, 'i'); flagToString(buffer, off, Pattern.COMMENTS, 'x'); if (off.length() > 0) { buffer.append('-').append(off); } buffer.append(':'); buffer.append(pattern.pattern()); buffer.append(')'); return buffer.toString(); }
public String toString() { StringBuffer buffer = new StringBuffer(100); StringBuffer off = new StringBuffer(3); buffer.append("(?"); flagToString(buffer, off, Pattern.DOTALL, 'm'); flagToString(buffer, off, Pattern.CASE_INSENSITIVE, 'i'); flagToString(buffer, off, Pattern.COMMENTS, 'x'); if (off.length() > 0) { buffer.append('-').append(off); } buffer.append(':'); buffer.append(pattern.pattern()); buffer.append(')'); return buffer.toString(); }
3,232,616
public void refreshEdit(DataObject object, int op) { Object o = object; if (op == Editor.CREATE_OBJECT) o = getSelectedDisplay().getUserObject(); EditVisitor visitor = new EditVisitor(this, o); accept(visitor, TreeImageDisplayVisitor.TREEIMAGE_SET_ONLY); Set nodes = visitor.getFoundNodes(); if (op == Editor.UPDATE_OBJECT) view.updateNodes(nodes, object); else if (op == TreeViewer.REMOVE_OBJECT) view.removeNodes(nodes); else if (op == Editor.CREATE_OBJECT) { TreeImageDisplay display = TreeViewerTranslator.transformDataObject(object); setSelectedDisplay(display); view.createNodes(nodes, display); } }
public void refreshEdit(DataObject object, int op) { Object o = object; if (op == Editor.CREATE_OBJECT) o = getSelectedDisplay().getUserObject(); EditVisitor visitor = new EditVisitor(this, o); accept(visitor, TreeImageDisplayVisitor.TREEIMAGE_SET_ONLY); Set nodes = visitor.getFoundNodes(); if (op == Editor.UPDATE_OBJECT) view.updateNodes(nodes, object); else if (op == TreeViewer.REMOVE_OBJECT) view.removeNodes(nodes); else if (op == Editor.CREATE_OBJECT) { TreeImageDisplay display = TreeViewerTranslator.transformDataObject(object); setSelectedDisplay(display); view.createNodes(nodes, display); } }
3,232,617
public void refreshEdit(DataObject object, int op) { Object o = object; if (op == Editor.CREATE_OBJECT) o = getSelectedDisplay().getUserObject(); EditVisitor visitor = new EditVisitor(this, o); accept(visitor, TreeImageDisplayVisitor.TREEIMAGE_SET_ONLY); Set nodes = visitor.getFoundNodes(); if (op == Editor.UPDATE_OBJECT) view.updateNodes(nodes, object); else if (op == TreeViewer.REMOVE_OBJECT) view.removeNodes(nodes); else if (op == Editor.CREATE_OBJECT) { TreeImageDisplay display = TreeViewerTranslator.transformDataObject(object); setSelectedDisplay(display); view.createNodes(nodes, display); } }
public void refreshEdit(DataObject object, int op) { Object o = object; if (op == Editor.CREATE_OBJECT) o = getSelectedDisplay().getUserObject(); EditVisitor visitor = new EditVisitor(this, o); accept(visitor, TreeImageDisplayVisitor.TREEIMAGE_SET_ONLY); Set nodes = visitor.getFoundNodes(); if (op == Editor.UPDATE_OBJECT) view.updateNodes(nodes, object); else if (op == TreeViewer.REMOVE_OBJECT) view.removeNodes(nodes); else if (op == Editor.CREATE_OBJECT) { TreeImageDisplay display = TreeViewerTranslator.transformDataObject(object); setSelectedDisplay(display); view.createNodes(nodes, display, parentDisplay); } }
3,232,618
protected InputStream loadResource(String uri) { if (System.getProperty("xbean.dir") != null) { File f = new File(System.getProperty("xbean.dir") + uri); try { return new FileInputStream(f); } catch (FileNotFoundException e) { // Ignore } } // lets try the thread context class loader first InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri); if (in == null) { in = getClass().getClassLoader().getResourceAsStream(uri); if (in == null) { log.debug("Could not find resource: " + uri); } } return in; }
protected InputStream loadResource(String uri) { if (System.getProperty("xbean.dir") != null) { File f = new File(System.getProperty("xbean.dir") + uri); try { return new FileInputStream(f); } catch (FileNotFoundException e) { // Ignore } } // lets try the thread context class loader first InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri); if (in == null) { ClassLoader cl = parserContext.getReaderContext().getReader().getBeanClassLoader(); if (cl != null) { in = cl.getResourceAsStream(uri); } if (in == null) { log.debug("Could not find resource: " + uri); } } return in; }
3,232,619
protected InputStream loadResource(String uri) { if (System.getProperty("xbean.dir") != null) { File f = new File(System.getProperty("xbean.dir") + uri); try { return new FileInputStream(f); } catch (FileNotFoundException e) { // Ignore } } // lets try the thread context class loader first InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri); if (in == null) { in = getClass().getClassLoader().getResourceAsStream(uri); if (in == null) { log.debug("Could not find resource: " + uri); } } return in; }
protected InputStream loadResource(String uri) { if (System.getProperty("xbean.dir") != null) { File f = new File(System.getProperty("xbean.dir") + uri); try { return new FileInputStream(f); } catch (FileNotFoundException e) { // Ignore } } // lets try the thread context class loader first InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri); if (in == null) { in = getClass().getClassLoader().getResourceAsStream(uri); if (in == null) { in = getClass().getClassLoader().getResourceAsStream(uri); if (in == null) { log.debug("Could not find resource: " + uri); } } } return in; }
3,232,620
public static Broker getBroker(Servlet s) throws InitException { int minorVersion, majorVersion; ServletContext sc = s.getServletConfig().getServletContext(); try { majorVersion = sc.getMajorVersion(); minorVersion = sc.getMinorVersion(); } catch (NoSuchMethodError e) { majorVersion = 2; minorVersion = 0; } if (majorVersion > 2 || (majorVersion == 2 && minorVersion >= 2)) return Servlet22Broker.getBroker(s); else return Servlet20Broker.getBroker(s); }
public static Broker getBroker(Servlet s) throws InitException { int minorVersion, majorVersion; ServletContext sc = s.getServletConfig().getServletContext(); try { majorVersion = sc.getMajorVersion(); minorVersion = sc.getMinorVersion(); } catch (NoSuchMethodError e) { majorVersion = 2; minorVersion = 0; } if (majorVersion > 2 || (majorVersion == 2 && minorVersion >= 2)) b = Servlet22Broker.getBroker(s); else return Servlet20Broker.getBroker(s); }
3,232,622
public static Broker getBroker(Servlet s) throws InitException { int minorVersion, majorVersion; ServletContext sc = s.getServletConfig().getServletContext(); try { majorVersion = sc.getMajorVersion(); minorVersion = sc.getMinorVersion(); } catch (NoSuchMethodError e) { majorVersion = 2; minorVersion = 0; } if (majorVersion > 2 || (majorVersion == 2 && minorVersion >= 2)) return Servlet22Broker.getBroker(s); else return Servlet20Broker.getBroker(s); }
public static Broker getBroker(Servlet s) throws InitException { int minorVersion, majorVersion; ServletContext sc = s.getServletConfig().getServletContext(); try { majorVersion = sc.getMajorVersion(); minorVersion = sc.getMinorVersion(); } catch (NoSuchMethodError e) { majorVersion = 2; minorVersion = 0; } if (majorVersion > 2 || (majorVersion == 2 && minorVersion >= 2)) return Servlet22Broker.getBroker(s); else b = Servlet20Broker.getBroker(s); b.startClient(); return b; }
3,232,623
final public boolean directiveOk() { if (size() == 0 || size() == literalMark) return true; else { Object o = elementAt(size() - 1); if (!(o instanceof String)) return true; else { String s = (String) o; char ch = s.charAt(s.length()-1); if (ch == '=' || ch == '\'' || ch == '\"' || Character.isLetterOrDigit(ch)) return false; } } return true; }
final public boolean directiveOk() { if (size() == 0 || size() == literalMark) return true; else { Object o = elementAt(size() - 1); if (!(o instanceof String)) return true; else { String s = (String) o; char ch = s.charAt(s.length()-1); if (ch == '=' || ch == '\'' || ch == '\"' || ch == ':' || Character.isLetterOrDigit(ch)) return false; } } return true; }
3,232,624
public String toString(){ return "Dataset"+(datasetId==null ? ":Hash"+this.hashCode() : ":"+datasetId); }
public String toString(){ return "Dataset"+(datasetId==null ? ":Hash_"+this.hashCode() : ":Id_"+datasetId); }
3,232,625
public static void createReadline(IRuby runtime) throws IOException { readline = new ConsoleReader(); readline.setUseHistory(false); readline.setUsePagination(true); ((CandidateListCompletionHandler) readline.getCompletionHandler()).setAlwaysIncludeNewline(false); currentCompletor = new RubyFileNameCompletor(); readline.addCompletor(currentCompletor); RubyModule mReadline = runtime.defineModule("Readline"); CallbackFactory readlinecb = runtime.callbackFactory(Readline.class); mReadline.defineMethod("readline",readlinecb.getSingletonMethod("s_readline",IRubyObject.class,IRubyObject.class)); mReadline.module_function(new IRubyObject[]{runtime.newSymbol("readline")}); mReadline.defineMethod("completion_append_character=",readlinecb.getSingletonMethod("s_set_completion_append_character",IRubyObject.class)); mReadline.module_function(new IRubyObject[]{runtime.newSymbol("completion_append_character=")}); mReadline.defineMethod("completion_proc=",readlinecb.getSingletonMethod("s_set_completion_proc",IRubyObject.class)); mReadline.module_function(new IRubyObject[]{runtime.newSymbol("completion_proc=")}); IRubyObject hist = runtime.getObject().callMethod(runtime.getCurrentContext(), "new"); mReadline.setConstant("HISTORY",hist); hist.defineSingletonMethod("push",readlinecb.getSingletonMethod("s_push",IRubyObject.class)); hist.defineSingletonMethod("pop",readlinecb.getSingletonMethod("s_pop")); hist.defineSingletonMethod("to_a",readlinecb.getSingletonMethod("s_hist_to_a")); }
public static void createReadline(IRuby runtime) throws IOException { readline = new ConsoleReader(); readline.setUseHistory(false); readline.setUsePagination(true); ((CandidateListCompletionHandler) readline.getCompletionHandler()).setAlwaysIncludeNewline(false); currentCompletor = new RubyFileNameCompletor(); readline.addCompletor(currentCompletor); RubyModule mReadline = runtime.defineModule("Readline"); CallbackFactory readlinecb = runtime.callbackFactory(Readline.class); mReadline.defineMethod("readline",readlinecb.getSingletonMethod("s_readline",IRubyObject.class,IRubyObject.class)); mReadline.module_function(new IRubyObject[]{runtime.newSymbol("readline")}); mReadline.defineMethod("completion_append_character=",readlinecb.getSingletonMethod("s_set_completion_append_character",IRubyObject.class)); mReadline.module_function(new IRubyObject[]{runtime.newSymbol("completion_append_character=")}); mReadline.defineMethod("completion_proc=",readlinecb.getSingletonMethod("s_set_completion_proc",IRubyObject.class)); mReadline.module_function(new IRubyObject[]{runtime.newSymbol("completion_proc=")}); IRubyObject hist = runtime.getObject().callMethod(runtime.getCurrentContext(), "new"); mReadline.setConstant("HISTORY",hist); hist.defineSingletonMethod("push",readlinecb.getSingletonMethod("s_push",IRubyObject.class)); hist.defineSingletonMethod("pop",readlinecb.getSingletonMethod("s_pop")); hist.defineSingletonMethod("to_a",readlinecb.getSingletonMethod("s_hist_to_a")); }
3,232,628
public static IRubyObject s_hist_to_a(IRubyObject recv) throws Exception { RubyArray histList = recv.getRuntime().newArray(); for (Iterator i = readline.getHistory().getHistoryList().iterator(); i.hasNext();) { histList.append(recv.getRuntime().newString((String) i.next())); } return histList; }
public static IRubyObject s_hist_to_a(IRubyObject recv) throws Exception { RubyArray histList = recv.getRuntime().newArray(); for (Iterator i = readline.getHistory().getHistoryList().iterator(); i.hasNext();) { histList.append(recv.getRuntime().newString((String) i.next())); } return histList; }
3,232,629
public static IRubyObject s_push(IRubyObject recv, IRubyObject line) throws Exception { readline.getHistory().addToHistory(line.toString()); return recv.getRuntime().getNil(); }
public static IRubyObject s_push(IRubyObject recv, IRubyObject line) throws Exception { history.addToHistory(line.toString()); return recv.getRuntime().getNil(); }
3,232,630
public static IRubyObject s_set_completion_proc(IRubyObject recv, IRubyObject proc) throws Exception { if (!proc.respondsTo("call")) throw recv.getRuntime().newArgumentError("argument must respond to call"); readline.removeCompletor(currentCompletor); currentCompletor = new ProcCompletor(proc); readline.addCompletor(currentCompletor); return recv.getRuntime().getNil(); }
public static IRubyObject s_set_completion_proc(IRubyObject recv, IRubyObject proc) throws Exception { if (!proc.respondsTo("call")) throw recv.getRuntime().newArgumentError("argument must respond to call"); readline.removeCompletor(currentCompletor); currentCompletor = new ProcCompletor(proc); readline.addCompletor(currentCompletor); return recv.getRuntime().getNil(); }
3,232,632
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); categories.add(cla.getCategory()); } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
public Set findCGCIHierarchies(final Set arg0) { // CONTRACT if (null == arg0 || arg0.size() == 0) { return new HashSet(); } List result = containerDao.findCGCIHierarchies(arg0); Set imagesAll = new HashSet(result); if (null == imagesAll || imagesAll.size() == 0) { if (log.isDebugEnabled()) { log.debug("findCGCIHierarchies() -- no results found:\n" + arg0.toString()); } return new HashSet(); } // LOGIC Set hierarchies = new HashSet(); Iterator i = imagesAll.iterator(); while (i.hasNext()) { Image img = (Image) i.next(); Set classifications = img.getClassifications(); Set categories = new HashSet(); for (Iterator c = classifications.iterator(); c.hasNext();) { Classification cla = (Classification) c.next(); if (null!=cla.getCategory()){ categories.add(cla.getCategory()); } } if (categories == null || categories.size() < 1) { hierarchies.add(img); } else { Iterator c = categories.iterator(); while (c.hasNext()) { Category tmp = (Category) c.next(); Category2 ca = new Category2(tmp); //TODO Hack if (!(ca.getImages() instanceof HashSet)) ca.setImages(new HashSet()); ca.getImages().add(img); CategoryGroup cg = ca.getCategoryGroup(); if (cg == null) { hierarchies.add(ca); } else { if (!(cg.getCategories() instanceof HashSet)) cg.setCategories(new HashSet()); cg.getCategories().add(ca); hierarchies.add(cg); } } } } return (Set) clean(hierarchies); }
3,232,633
public IterNode(Node varNode, Node bodyNode, Node iterNode) { super(Constants.NODE_ITER, varNode, bodyNode, iterNode); }
public IterNode(Node varNode, Node bodyNode, Node iterNode) { super(Constants.NODE_ITER, varNode, bodyNode, iterNode); }
3,232,634
public void accept(NodeVisitor iVisitor) { iVisitor.visitIterNode(this); }
public void accept(NodeVisitor iVisitor) { iVisitor.visitIterNode(this); }
3,232,635
public RubyObject eval(Ruby ruby, RubyObject self) { RubyObject result; ruby.getBlock().push(getVarNode(), getBodyNode(), self); ruby.getIter().push(RubyIter.ITER_PRE); try { while (true) { try { return getIterNode().eval(ruby, self); } catch (RetryException rExcptn) { } } } catch (ReturnException rExcptn) { return rExcptn.getReturnValue(); } catch (BreakJump bExcptn) { return ruby.getNil(); } finally { ruby.getIter().pop(); ruby.getBlock().pop(); } }
public RubyObject eval(Ruby ruby, RubyObject self) { RubyObject result; ruby.getBlock().push(getVarNode(), getBodyNode(), self); ruby.getIter().push(RubyIter.ITER_PRE); try { while (true) { try { return getIterNode().eval(ruby, self); } catch (RetryException rExcptn) { } } } catch (ReturnException rExcptn) { return rExcptn.getReturnValue(); } catch (BreakJump bExcptn) { return ruby.getNil(); } finally { ruby.getIter().pop(); ruby.getBlock().pop(); } }
3,232,636
public RubyObject eval(Ruby ruby, RubyObject self) { RubyObject result; ruby.getBlock().push(getVarNode(), getBodyNode(), self); ruby.getIter().push(RubyIter.ITER_PRE); try { while (true) { try { return getIterNode().eval(ruby, self); } catch (RetryException rExcptn) { } } } catch (ReturnException rExcptn) { return rExcptn.getReturnValue(); } catch (BreakJump bExcptn) { return ruby.getNil(); } finally { ruby.getIter().pop(); ruby.getBlock().pop(); } }
public RubyObject eval(Ruby ruby, RubyObject self) { RubyObject result; ruby.getBlock().push(getVarNode(), getBodyNode(), self); ruby.getIter().push(RubyIter.ITER_PRE); try { while (true) { try { return getIterNode().eval(ruby, self); } catch (RetryException rExcptn) { } } } catch (ReturnException rExcptn) { return rExcptn.getReturnValue(); } catch (BreakJump bExcptn) { return ruby.getNil(); } finally { ruby.getIter().pop(); ruby.getBlock().pop(); } }
3,232,637
private JLabel buildLabel() { JLabel label = new JLabel("Preview"); label.setBounds(BORDER+WIDTH+HSPACE, TOP, 45, 10); return label; }
private JLabel buildLabel() { JLabel label = new JLabel("Preview"); label.setBounds(BORDER+WIDTH+HSPACE, TOP, 45, 10); return label; }
3,232,638
public Node gettable(String id, ISourcePosition position) { if (id.equals("self")) { return new SelfNode(position); } else if (id.equals("nil")) { return new NilNode(position); } else if (id.equals("true")) { return new TrueNode(position); } else if (id.equals("false")) { return new FalseNode(position); } /*else if (id == k__FILE__) { return NEW_STR(rb_str_new2(ruby_sourcefile)); } else if (id == k__LINE__) { return NEW_LIT(INT2FIX(ruby_sourceline)); }*/ else if (IdUtil.isLocal(id)) { BlockNamesElement blockNames = (BlockNamesElement) blockNamesStack.peek(); LocalNamesElement localNames = (LocalNamesElement) localNamesStack.peek(); if (localNames.isInBlock() && blockNames.isDefined(id)) { return new DVarNode(position, id); } else if (localNames.isLocalRegistered(id)) { return new LocalVarNode(position, localNames.getLocalIndex(id)); } return new VCallNode(position, id); // RubyMethod call without arguments. } else if (IdUtil.isGlobal(id)) { return new GlobalVarNode(position, id); } else if (IdUtil.isInstanceVariable(id)) { return new InstVarNode(position, id); } else if (IdUtil.isConstant(id)) { return new ConstNode(position, id); } else if (IdUtil.isClassVariable(id)) { return new ClassVarNode(position, id); } // not reached assert false; return null; }
public Node gettable(String id, ISourcePosition position) { if (id.equals("self")) { return new SelfNode(position); } else if (id.equals("nil")) { return new NilNode(position); } else if (id.equals("true")) { return new TrueNode(position); } else if (id.equals("false")) { return new FalseNode(position); } /* TODO: add __FILE__ and __LINE__ support? else if (id == k__FILE__) { return NEW_STR(rb_str_new2(ruby_sourcefile)); } else if (id == k__LINE__) { return NEW_LIT(INT2FIX(ruby_sourceline)); }*/ else if (IdUtil.isLocal(id)) { BlockNamesElement blockNames = (BlockNamesElement) blockNamesStack.peek(); LocalNamesElement localNames = (LocalNamesElement) localNamesStack.peek(); if (localNames.isInBlock() && blockNames.isDefined(id)) { return new DVarNode(position, id); } else if (localNames.isLocalRegistered(id)) { return new LocalVarNode(position, localNames.getLocalIndex(id)); } return new VCallNode(position, id); // RubyMethod call without arguments. } else if (IdUtil.isGlobal(id)) { return new GlobalVarNode(position, id); } else if (IdUtil.isInstanceVariable(id)) { return new InstVarNode(position, id); } else if (IdUtil.isConstant(id)) { return new ConstNode(position, id); } else if (IdUtil.isClassVariable(id)) { return new ClassVarNode(position, id); } // not reached assert false; return null; }
3,232,639
public void initTopLocalVariables() { localNamesStack.push(new LocalNamesElement()); String[] names = configuration.getLocalVariables(); if (names != null && names.length > 0) { LocalNamesElement localNames = (LocalNamesElement) localNamesStack.peek(); List namesList = new ArrayList(names.length); for (int i = 0; i < names.length; i++) namesList.add(names[i]); localNames.setNames(namesList); } }
public void initTopLocalVariables() { LocalNamesElement localNames = new LocalNamesElement(); localNamesStack.push(localNames); String[] names = configuration.getLocalVariables(); if (names != null && names.length > 0) { LocalNamesElement localNames = (LocalNamesElement) localNamesStack.peek(); List namesList = new ArrayList(names.length); for (int i = 0; i < names.length; i++) namesList.add(names[i]); localNames.setNames(namesList); } }
3,232,640
public void initTopLocalVariables() { localNamesStack.push(new LocalNamesElement()); String[] names = configuration.getLocalVariables(); if (names != null && names.length > 0) { LocalNamesElement localNames = (LocalNamesElement) localNamesStack.peek(); List namesList = new ArrayList(names.length); for (int i = 0; i < names.length; i++) namesList.add(names[i]); localNames.setNames(namesList); } }
public void initTopLocalVariables() { localNamesStack.push(new LocalNamesElement()); String[] names = configuration.getLocalVariables(); if (names != null && names.length > 0) { LocalNamesElement localNames = (LocalNamesElement) localNamesStack.peek(); List namesList = new ArrayList(names.length); for (int i = 0; i < names.length; i++) namesList.add(names[i]); localNames.setNames(namesList); } }
3,232,641
public void actionPerformed(ActionEvent e) { try { File file = new File(transfer.getFilePath()); transfer = transferManager.createOutgoingFileTransfer(fullJID); transfer.sendFile(file, "Sending"); } catch (XMPPException e1) { e1.printStackTrace(); } sendFile(transfer, transferManager, fullJID, nickname); }
public void actionPerformed(ActionEvent e) { try { File file = new File(transfer.getFilePath()); transfer = transferManager.createOutgoingFileTransfer(fullJID); transfer.sendFile(file, "Sending"); } catch (XMPPException e1) { Log.error(e1); } sendFile(transfer, transferManager, fullJID, nickname); }
3,232,643
private void paintROI(Graphics2D g2D) { if (currentShape != null) { if (!manager.isMoving()) g2D.setColor(manager.getLineColor()); g2D.draw(currentShape); } List l = manager.getListROI(); if (l.size()>0) paintROICollection(g2D, l); }
private void paintROI(Graphics2D g2D) { if (currentShape != null) { g2D.setColor(manager.getLineColor()); g2D.draw(currentShape); } List l = manager.getListROI(); if (l.size()>0) paintROICollection(g2D, l); }
3,232,644
public Set getCache(){ return (Set) cache.get(); }
public Set getCache(){ return (Set) cache.get(); }
3,232,645
protected void addSeen(Object o){ if (cache.get()==null) newCache(); ( (Set) cache.get()).add(o); }
protected void addSeen(Object o){ if (cache.get()==null) newCache(); ( (Set) cache.get()).add(o); }
3,232,646
public RubyObject execute(RubyObject recv, RubyObject[] args, Ruby ruby) { LinkedList executeMethods = new LinkedList(Arrays.asList(methods)); int argsLength = args != null ? args.length : 0; // remove mehods with wrong parameter count. Iterator iter = executeMethods.iterator(); while (iter.hasNext()) { Method method = (Method)iter.next(); if (method.getParameterTypes().length != argsLength) { iter.remove(); } } // remove mehods with wrong parameter types. iter = executeMethods.iterator(); while (iter.hasNext()) { Method method = (Method)iter.next(); for (int i = 0; i < method.getParameterTypes().length; i++) { if (!JavaUtil.isCompatible(args[i], method.getParameterTypes()[i])) { iter.remove(); break; } } } if (executeMethods.isEmpty()) { throw new RubyArgumentException(ruby, "wrong arguments."); } // take the first method. Method method = (Method)executeMethods.getFirst(); Object[] newArgs = new Object[argsLength]; for (int i = 0; i < argsLength; i++) { newArgs[i] = JavaUtil.convertRubyToJava(ruby, args[i], method.getParameterTypes()[i]); } try { Object obj = !singleton ? ((RubyJavaObject)recv).getValue() : null; Object result = method.invoke(obj, newArgs); return JavaUtil.convertJavaToRuby(ruby, result, method.getReturnType()); } catch (IllegalAccessException iaExcptn) { } catch (IllegalArgumentException iaExcptn) { } catch (InvocationTargetException itExcptn) { } return ruby.getNil(); }
public RubyObject execute(RubyObject recv, RubyObject[] args, Ruby ruby) { LinkedList executeMethods = new LinkedList(Arrays.asList(methods)); int argsLength = args != null ? args.length : 0; // remove mehods with wrong parameter count. Iterator iter = executeMethods.iterator(); while (iter.hasNext()) { Method method = (Method)iter.next(); if (method.getParameterTypes().length != argsLength) { iter.remove(); } } // remove mehods with wrong parameter types. iter = executeMethods.iterator(); while (iter.hasNext()) { Method method = (Method)iter.next(); for (int i = 0; i < method.getParameterTypes().length; i++) { if (!JavaUtil.isCompatible(args[i], method.getParameterTypes()[i])) { iter.remove(); break; } } } if (executeMethods.isEmpty()) { throw new RubyArgumentException(ruby, "wrong arguments."); } // take the first method. Method method = (Method)executeMethods.getFirst(); Object[] newArgs = new Object[argsLength]; for (int i = 0; i < argsLength; i++) { newArgs[i] = JavaUtil.convertRubyToJava(ruby, args[i], method.getParameterTypes()[i]); } try { Object obj = !singleton ? ((RubyJavaObject)recv).getValue() : null; Object result = method.invoke(obj, newArgs); return JavaUtil.convertJavaToRuby(ruby, result, method.getReturnType()); } catch (IllegalAccessException iaExcptn) { } catch (IllegalArgumentException iaExcptn) { } catch (InvocationTargetException itExcptn) { } return ruby.getNil(); }
3,232,647
public RubyObject execute(RubyObject recv, RubyObject[] args, Ruby ruby) { LinkedList executeMethods = new LinkedList(Arrays.asList(methods)); int argsLength = args != null ? args.length : 0; // remove mehods with wrong parameter count. Iterator iter = executeMethods.iterator(); while (iter.hasNext()) { Method method = (Method)iter.next(); if (method.getParameterTypes().length != argsLength) { iter.remove(); } } // remove mehods with wrong parameter types. iter = executeMethods.iterator(); while (iter.hasNext()) { Method method = (Method)iter.next(); for (int i = 0; i < method.getParameterTypes().length; i++) { if (!JavaUtil.isCompatible(args[i], method.getParameterTypes()[i])) { iter.remove(); break; } } } if (executeMethods.isEmpty()) { throw new RubyArgumentException(ruby, "wrong arguments."); } // take the first method. Method method = (Method)executeMethods.getFirst(); Object[] newArgs = new Object[argsLength]; for (int i = 0; i < argsLength; i++) { newArgs[i] = JavaUtil.convertRubyToJava(ruby, args[i], method.getParameterTypes()[i]); } try { Object obj = !singleton ? ((RubyJavaObject)recv).getValue() : null; Object result = method.invoke(obj, newArgs); return JavaUtil.convertJavaToRuby(ruby, result, method.getReturnType()); } catch (IllegalAccessException iaExcptn) { } catch (IllegalArgumentException iaExcptn) { } catch (InvocationTargetException itExcptn) { } return ruby.getNil(); }
public RubyObject execute(RubyObject recv, RubyObject[] args, Ruby ruby) { LinkedList executeMethods = new LinkedList(Arrays.asList(methods)); int argsLength = args != null ? args.length : 0; // remove mehods with wrong parameter count. Iterator iter = executeMethods.iterator(); while (iter.hasNext()) { Method method = (Method)iter.next(); if (method.getParameterTypes().length != argsLength) { iter.remove(); } } // remove mehods with wrong parameter types. iter = executeMethods.iterator(); while (iter.hasNext()) { Method method = (Method)iter.next(); for (int i = 0; i < method.getParameterTypes().length; i++) { if (!JavaUtil.isCompatible(args[i], method.getParameterTypes()[i])) { iter.remove(); break; } } } if (executeMethods.isEmpty()) { throw new RubyArgumentException(ruby, "wrong arguments."); } // take the first method. Method method = (Method)executeMethods.getFirst(); Object[] newArgs = new Object[argsLength]; for (int i = 0; i < argsLength; i++) { newArgs[i] = JavaUtil.convertRubyToJava(ruby, args[i], method.getParameterTypes()[i]); } try { Object obj = !singleton ? ((RubyJavaObject)recv).getValue() : null; Object result = method.invoke(obj, newArgs); return JavaUtil.convertJavaToRuby(ruby, result, method.getReturnType()); } catch (IllegalAccessException iaExcptn) { } catch (IllegalArgumentException iaExcptn) { } catch (InvocationTargetException itExcptn) { } }
3,232,648
public int compare(Object arg0, Object arg1) { SourceFileData sourceFileData0 = (SourceFileData)arg0; SourceFileData sourceFileData1 = (SourceFileData)arg1; int comparison = sourceFileData0.getBaseName().compareTo( sourceFileData1.getBaseName()); if (comparison != 0) return comparison; return sourceFileData0.getName().compareTo(sourceFileData1.getName()); }
public int compare(Object arg0, Object arg1) { SourceFileData sourceFileData0 = (SourceFileData)arg0; SourceFileData sourceFileData1 = (SourceFileData)arg1; int comparison = sourceFileData0.getBaseName().compareTo( sourceFileData1.getBaseName()); if (comparison != 0) return comparison; return sourceFileData0.getName().compareTo(sourceFileData1.getName()); }
3,232,649
public void actionPerformed(ActionEvent e) { int index = Integer.parseInt(e.getActionCommand()); try { switch (index) { case RECTANGLE: setType(ROIFactory.RECTANGLE, true); break; case ELLIPSE: setType(ROIFactory.ELLIPSE, false); break; case ERASE: control.erase(); break; case ERASE_ALL: control.eraseAll(); break; case MOVE_ROI: handleState(ROIAgt.MOVING, true); break; case SIZE_ROI: handleState(ROIAgt.RESIZING, false); break; case DRAW_ON_OFF: handleOnOffDrawing(e); break; case TEXT_ON_OFF: handleOnOffText(e); break; case ANNOTATION_ON_OFF: handleOnOffAnnotation(e); break; case COLOR: handleColor(e); break; case CHANNEL: handleChannel(e); break; case ANALYSE: control.analyse(); break; case UNDO_ERASE: control.undoErase(); } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+index, nfe); } }
public void actionPerformed(ActionEvent e) { int index = Integer.parseInt(e.getActionCommand()); try { switch (index) { case RECTANGLE: setType(ROIFactory.RECTANGLE, true); break; case ELLIPSE: setType(ROIFactory.ELLIPSE, false); break; case ERASE: control.erase(); break; case ERASE_ALL: control.eraseAll(); break; case MOVE_ROI: handleState(ROIAgt.MOVING, true); break; case SIZE_ROI: handleState(ROIAgt.RESIZING, false); break; case DRAW_ON_OFF: handleOnOffDrawing(e); break; case TEXT_ON_OFF: handleOnOffText(e); break; case ANNOTATION_ON_OFF: handleOnOffAnnotation(e); break; case COLOR: handleColor(e); break; case CHANNEL: handleChannel(e); break; case ANALYSE: control.analyse(); break; case UNDO_ERASE: control.undoErase(); } } catch(NumberFormatException nfe) { throw new Error("Invalid Action ID "+index, nfe); } }
3,232,650
private void paintedDrawingButtons(boolean b) { view.getRectangle().setBorderPainted(b); view.getEllipse().setBorderPainted(!b); view.getMoveROI().setBorderPainted(false); view.getSizeROI().setBorderPainted(false); }
private void paintedDrawingButtons(boolean b) { view.getRectangle().setBorderPainted(b); view.getEllipse().setBorderPainted(!b); view.getMoveROI().setBorderPainted(false); view.getSizeROI().setBorderPainted(false); }
3,232,651
private void setType(int type, boolean b) { paintedDrawingButtons(b); control.setType(type); control.setState(ROIAgt.CONSTRUCTING); }
private void setType(int type, boolean b) { paintedDrawingButtons(b); control.setType(type); }
3,232,652
public void scale(double f) { if (f < MIN_SCALING_FACTOR || f > MAX_SCALING_FACTOR) return; scalingFactor = f; int w = (int) (originalWidth*f), h = (int) (originalHeight*f); if (fullScaleThumb != null) { displayThumb = magnifyImage(f, fullScaleThumb); w = displayThumb.getWidth(); h = displayThumb.getHeight(); } if (display != null) { display.setCanvasSize(w, h); display.pack(); } }
public void scale(double f) { if (f < MIN_SCALING_FACTOR || f > MAX_SCALING_FACTOR) return; scalingFactor = f; int w = (int) (originalWidth*f), h = (int) (originalHeight*f); if (fullScaleThumb != null) { displayThumb = magnifyImage(f, fullScaleThumb); w = displayThumb.getWidth(); h = displayThumb.getHeight(); } if (display != null) { display.setCanvasSize(w, h); display.pack(); } }
3,232,653
public RubyFixnum aref(IRubyObject other) { RubyNumeric pos = numericValue(other); boolean isSet = getValue().testBit((int) pos.getLongValue()); return RubyFixnum.newFixnum(getRuntime(), (isSet ? 1 : 0)); }
public RubyFixnum aref(IRubyObject other) { RubyNumeric pos = numericValue(other); boolean isSet = getValue().testBit((int) pos.getLongValue()); return RubyFixnum.newFixnum(getRuntime(), (isSet ? 1 : 0)); }
3,232,655
public static RubyClass createBignumClass(Ruby ruby) { return new BignumDefinition(ruby).getType(); }
public static RubyClass createBignumClass(Ruby ruby) { RubyClass result = ruby.defineClass("Bignum", ruby.getClasses().getIntegerClass()); CallbackFactory callbackFactory = ruby.callbackFactory(); result.defineMethod("~", callbackFactory.getMethod(RubyBignum.class, "op_invert")); result.defineMethod("&", callbackFactory.getMethod(RubyBignum.class, "op_and", RubyNumeric.class)); result.defineMethod("<<", callbackFactory.getMethod(RubyBignum.class, "op_lshift", RubyNumeric.class)); result.defineMethod("%", callbackFactory.getMethod(RubyBignum.class, "op_mod", RubyNumeric.class)); result.defineMethod("+", callbackFactory.getMethod(RubyBignum.class, "op_plus", RubyNumeric.class)); result.defineMethod("*", callbackFactory.getMethod(RubyBignum.class, "op_mul", RubyNumeric.class)); result.defineMethod("**", callbackFactory.getMethod(RubyBignum.class, "op_pow", RubyNumeric.class)); result.defineMethod("-", callbackFactory.getMethod(RubyBignum.class, "op_minus", RubyNumeric.class)); result.defineMethod("modulo", callbackFactory.getMethod(RubyBignum.class, "op_mod", RubyNumeric.class)); result.defineMethod("/", callbackFactory.getMethod(RubyBignum.class, "op_div", RubyNumeric.class)); result.defineMethod(">>", callbackFactory.getMethod(RubyBignum.class, "op_rshift", RubyNumeric.class)); result.defineMethod("|", callbackFactory.getMethod(RubyBignum.class, "op_or", RubyNumeric.class)); result.defineMethod("^", callbackFactory.getMethod(RubyBignum.class, "op_xor", RubyNumeric.class)); result.defineMethod("-@", callbackFactory.getMethod(RubyBignum.class, "op_uminus")); result.defineMethod("[]", callbackFactory.getMethod(RubyBignum.class, "aref", RubyNumeric.class)); result.defineMethod("coerce", callbackFactory.getMethod(RubyBignum.class, "coerce", RubyNumeric.class)); result.defineMethod("remainder", callbackFactory.getMethod(RubyBignum.class, "remainder", RubyNumeric.class)); result.defineMethod("hash", callbackFactory.getMethod(RubyBignum.class, "hash")); result.defineMethod("size", callbackFactory.getMethod(RubyBignum.class, "size")); result.defineMethod("to_f", callbackFactory.getMethod(RubyBignum.class, "to_f")); result.defineMethod("to_i", callbackFactory.getMethod(RubyBignum.class, "to_i")); result.defineMethod("to_s", callbackFactory.getMethod(RubyBignum.class, "to_s")); return result; }
3,232,658
public RubyNumeric op_and(IRubyObject other) { RubyNumeric otherNumeric = numericValue(other); if (otherNumeric instanceof RubyBignum) { return bigNorm(getRuntime(), value.and(((RubyBignum) other).value)); } else { return bigNorm(getRuntime(), getValue().and(newBignum(getRuntime(), otherNumeric.getLongValue()).getValue())); /* return RubyFixnum.newFixnum(getRuntime(), getTruncatedLongValue() & otherNumeric.getLongValue()); */ } }
public RubyNumeric op_and(IRubyObject other) { RubyNumeric otherNumeric = numericValue(other); if (otherNumeric instanceof RubyBignum) { return bigNorm(getRuntime(), value.and(((RubyBignum) other).value)); } else { return bigNorm(getRuntime(), getValue().and(newBignum(getRuntime(), otherNumeric.getLongValue()).getValue())); /* return RubyFixnum.newFixnum(getRuntime(), getTruncatedLongValue() & otherNumeric.getLongValue()); */ } }
3,232,659
public RubyNumeric op_and(IRubyObject other) { RubyNumeric otherNumeric = numericValue(other); if (otherNumeric instanceof RubyBignum) { return bigNorm(getRuntime(), value.and(((RubyBignum) other).value)); } else { return bigNorm(getRuntime(), getValue().and(newBignum(getRuntime(), otherNumeric.getLongValue()).getValue())); /* return RubyFixnum.newFixnum(getRuntime(), getTruncatedLongValue() & otherNumeric.getLongValue()); */ } }
public RubyNumeric op_and(IRubyObject other) { RubyNumeric otherNumeric = numericValue(other); if (otherNumeric instanceof RubyBignum) { return bigNorm(getRuntime(), value.and(((RubyBignum) other).value)); } else { return bigNorm(getRuntime(), getValue().and(newBignum(getRuntime(), otherNumeric.getLongValue()).getValue())); /* return RubyFixnum.newFixnum(getRuntime(), getTruncatedLongValue() & otherNumeric.getLongValue()); */ } }
3,232,660
public RubyNumeric op_div(IRubyObject num) { RubyNumeric other = numericValue(num); if (other instanceof RubyFloat) { return RubyFloat.newFloat(getRuntime(), getDoubleValue()).op_div(other); } BigInteger results[] = getValue().divideAndRemainder(bigIntValue(other)); if (results[0].compareTo(BigInteger.ZERO) <= 0 && results[1].compareTo(BigInteger.ZERO) != 0) { return bigNorm(getRuntime(), results[0].subtract(BigInteger.ONE)); } return bigNorm(getRuntime(), results[0]); }
public RubyNumeric op_div(IRubyObject num) { RubyNumeric other = numericValue(num); if (other instanceof RubyFloat) { return RubyFloat.newFloat(getRuntime(), getDoubleValue()).op_div(other); } BigInteger results[] = getValue().divideAndRemainder(bigIntValue(other)); if (results[0].compareTo(BigInteger.ZERO) <= 0 && results[1].compareTo(BigInteger.ZERO) != 0) { return bigNorm(getRuntime(), results[0].subtract(BigInteger.ONE)); } return bigNorm(getRuntime(), results[0]); }
3,232,662
public RubyNumeric op_div(IRubyObject num) { RubyNumeric other = numericValue(num); if (other instanceof RubyFloat) { return RubyFloat.newFloat(getRuntime(), getDoubleValue()).op_div(other); } BigInteger results[] = getValue().divideAndRemainder(bigIntValue(other)); if (results[0].compareTo(BigInteger.ZERO) <= 0 && results[1].compareTo(BigInteger.ZERO) != 0) { return bigNorm(getRuntime(), results[0].subtract(BigInteger.ONE)); } return bigNorm(getRuntime(), results[0]); }
publicRubyNumericop_div(IRubyObjectnum){RubyNumericother=numericValue(num);if(otherinstanceofRubyFloat){returnRubyFloat.newFloat(getRuntime(),getDoubleValue()).op_div(other);}BigIntegerresults[]=getValue().divideAndRemainder(bigIntValue(other));if(results[0].compareTo(BigInteger.ZERO)<=0&&results[1].compareTo(BigInteger.ZERO)!=0){returnbigNorm(getRuntime(),results[0].subtract(BigInteger.ONE));}returnbigNorm(getRuntime(),results[0]);}
3,232,663
public RubyBignum op_lshift(IRubyObject iNum) { long shift = numericValue(iNum).getLongValue(); if (shift > Integer.MAX_VALUE || shift < Integer.MIN_VALUE) throw new RangeError(runtime, "bignum too big to convert into `int'"); return new RubyBignum(runtime, value.shiftLeft((int) shift)); }
public RubyBignum op_lshift(IRubyObject iNum) { long shift = numericValue(iNum).getLongValue(); if (shift > Integer.MAX_VALUE || shift < Integer.MIN_VALUE) throw new RangeError(runtime, "bignum too big to convert into `int'"); return new RubyBignum(runtime, value.shiftLeft((int) shift)); }
3,232,664
public RubyNumeric op_minus(IRubyObject num) { RubyNumeric other = numericValue(num); if (other instanceof RubyFloat) { return RubyFloat.newFloat(getRuntime(), getDoubleValue()).op_minus(other); } return bigNorm(getRuntime(), getValue().subtract(bigIntValue(other))); }
public RubyNumeric op_minus(IRubyObject num) { RubyNumeric other = numericValue(num); if (other instanceof RubyFloat) { return RubyFloat.newFloat(getRuntime(), getDoubleValue()).op_minus(other); } return bigNorm(getRuntime(), getValue().subtract(bigIntValue(other))); }
3,232,665
public RubyNumeric op_mod(IRubyObject num) { RubyNumeric other = numericValue(num); if (other instanceof RubyFloat) { return RubyFloat.newFloat(getRuntime(), getDoubleValue()).modulo(other); } BigInteger m = bigIntValue(other); BigInteger result = getValue().mod(m.abs()); if (m.compareTo(BigInteger.ZERO) < 0) { result = m.add(result); } return bigNorm(getRuntime(), result); }
public RubyNumeric op_mod(IRubyObject num) { RubyNumeric other = numericValue(num); if (other instanceof RubyFloat) { return RubyFloat.newFloat(getRuntime(), getDoubleValue()).modulo(other); } BigInteger m = bigIntValue(other); BigInteger result = getValue().mod(m.abs()); if (m.compareTo(BigInteger.ZERO) < 0) { result = m.add(result); } return bigNorm(getRuntime(), result); }
3,232,666
public RubyNumeric op_mul(IRubyObject num) { return numericValue(num).multiplyWith(this); }
public RubyNumeric op_mul(IRubyObject num) { return numericValue(num).multiplyWith(this); }
3,232,667
public RubyInteger op_or(IRubyObject num) { RubyNumeric other = numericValue(num); return newBignum(value.or(bigIntValue(other))); }
public RubyInteger op_or(IRubyObject num) { RubyNumeric other = numericValue(num); return newBignum(value.or(bigIntValue(other))); }
3,232,668
public RubyNumeric op_plus(IRubyObject num) { RubyNumeric other = numericValue(num); if (other instanceof RubyFloat) { return ((RubyFloat)other).op_plus(this); } return bigNorm(getRuntime(), getValue().add(bigIntValue(other))); }
public RubyNumeric op_plus(IRubyObject num) { RubyNumeric other = numericValue(num); if (other instanceof RubyFloat) { return ((RubyFloat)other).op_plus(this); } return bigNorm(getRuntime(), getValue().add(bigIntValue(other))); }
3,232,669