bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
|---|---|---|
public Object build(BuildContext bc) throws BuildException { if (directive == null) throw new BuildException("Error instantiating Directive object for #" + desc.name); return directive.build(this, bc); }
|
public Object build(BuildContext bc) throws BuildException { if (directive == null) throw new BuildException("Error instantiating Directive object for #" + desc.name); }; return d.build(this, bc); }
| 3,230,863
|
protected String renderGT() { System.err.println ("render: >"); return ">"; }
|
protected String renderGT() { return ">"; }
| 3,230,864
|
protected String renderLT() { System.err.println ("render: <"); return "<"; }
|
protected String renderLT() { return "<"; }
| 3,230,865
|
public Object doInHibernate(org.hibernate.Session session) throws org.hibernate.HibernateException, java.sql.SQLException { Experimenter o = (Experimenter) session.get(Experimenter.class, new Integer(1)); if (o == null) { o = new Experimenter(); o.setOmeName("test"); session.save(o); } Event e = (Event) session.get(Event.class, new Integer(1)); if (e == null) { e = new Event(); e.setName("test"); session.save(e); } ome.model.core.Pixels p = new ome.model.core.Pixels(); p.setSizeX(new Integer(1)); p.setSizeY(new Integer(1)); p.setSizeZ(new Integer(1)); p.setSizeC(new Integer(1)); p.setSizeT(new Integer(1)); p.setSha1("09bc7b2dcc9a510f4ab3a40c47f7a4cb77954356"); // "pixels" p.setBigEndian(Boolean.TRUE); p.setCreationEvent(e); p.setOwner(o); session.save(p); return null; };
|
public Object doInHibernate(org.hibernate.Session session) throws org.hibernate.HibernateException, java.sql.SQLException { Experimenter o = (Experimenter) session.get(Experimenter.class, new Integer(1)); if (o == null) { o = new Experimenter(); o.setOmeName("test"); session.save(o); } Event e = (Event) session.get(Event.class, new Integer(1)); if (e == null) { e = new Event(); e.setName("test"); session.save(e); } ome.model.core.Pixels p = new ome.model.core.Pixels(); p.setSizeX(new Integer(1)); p.setSizeY(new Integer(1)); p.setSizeZ(new Integer(1)); p.setSizeC(new Integer(1)); p.setSizeT(new Integer(1)); p.setSha1("09bc7b2dcc9a510f4ab3a40c47f7a4cb77954356"); // "pixels" p.setBigEndian(Boolean.TRUE); p.setCreationEvent(e); p.setOwner(o); session.save(p); return null; };
| 3,230,866
|
public Object doInHibernate(org.hibernate.Session session) throws org.hibernate.HibernateException, java.sql.SQLException { Experimenter o = (Experimenter) session.get(Experimenter.class, new Integer(1)); if (o == null) { o = new Experimenter(); o.setOmeName("test"); session.save(o); } Event e = (Event) session.get(Event.class, new Integer(1)); if (e == null) { e = new Event(); e.setName("test"); session.save(e); } ome.model.core.Pixels p = new ome.model.core.Pixels(); p.setSizeX(new Integer(1)); p.setSizeY(new Integer(1)); p.setSizeZ(new Integer(1)); p.setSizeC(new Integer(1)); p.setSizeT(new Integer(1)); p.setSha1("09bc7b2dcc9a510f4ab3a40c47f7a4cb77954356"); // "pixels" p.setBigEndian(Boolean.TRUE); p.setCreationEvent(e); p.setOwner(o); session.save(p); return null; };
|
public Object doInHibernate(org.hibernate.Session session) throws org.hibernate.HibernateException, java.sql.SQLException { Experimenter o = (Experimenter) session.get(Experimenter.class, new Integer(1)); if (o == null) { o = new Experimenter(); o.setOmeName("test"); session.save(o); } Event e = (Event) session.get(Event.class, new Integer(1)); if (e == null) { e = new Event(); e.setName("test"); session.save(e); } ome.model.core.Pixels p = new ome.model.core.Pixels(); p.setSizeX(new Integer(1)); p.setSizeY(new Integer(1)); p.setSizeZ(new Integer(1)); p.setSizeC(new Integer(1)); p.setSizeT(new Integer(1)); p.setSha1("09bc7b2dcc9a510f4ab3a40c47f7a4cb77954356"); // "pixels" p.setBigEndian(Boolean.TRUE); p.setCreationEvent(e); p.setOwner(o); session.save(p); return null; };
| 3,230,867
|
public Object doInHibernate(org.hibernate.Session session) throws org.hibernate.HibernateException, java.sql.SQLException { Experimenter o = (Experimenter) session.get(Experimenter.class, new Integer(1)); if (o == null) { o = new Experimenter(); o.setOmeName("test"); session.save(o); } Event e = (Event) session.get(Event.class, new Integer(1)); if (e == null) { e = new Event(); e.setName("test"); session.save(e); } ome.model.core.Pixels p = new ome.model.core.Pixels(); p.setSizeX(new Integer(1)); p.setSizeY(new Integer(1)); p.setSizeZ(new Integer(1)); p.setSizeC(new Integer(1)); p.setSizeT(new Integer(1)); p.setSha1("09bc7b2dcc9a510f4ab3a40c47f7a4cb77954356"); // "pixels" p.setBigEndian(Boolean.TRUE); p.setCreationEvent(e); p.setOwner(o); session.save(p); return null; };
|
public Object doInHibernate(org.hibernate.Session session) throws org.hibernate.HibernateException, java.sql.SQLException { Experimenter o = (Experimenter) session.get(Experimenter.class, new Integer(1)); if (o == null) { o = new Experimenter(); o.setOmeName("test"); session.save(o); } Event e = (Event) session.get(Event.class, new Integer(1)); if (e == null) { e = new Event(); e.setName("test"); session.save(e); } ome.model.core.Pixels p = new ome.model.core.Pixels(); p.setSizeX(new Integer(1)); p.setSizeY(new Integer(1)); p.setSizeZ(new Integer(1)); p.setSizeC(new Integer(1)); p.setSizeT(new Integer(1)); p.setSha1("09bc7b2dcc9a510f4ab3a40c47f7a4cb77954356"); // "pixels" p.setBigEndian(Boolean.TRUE); p.setCreationEvent(e); p.setOwner(o); session.save(p); return null; };
| 3,230,868
|
protected void setUp() { String[] paths = new String[] { "config.xml", "data.xml", "hibernate.xml" }; ctx = new ClassPathXmlApplicationContext(paths); ht = (HibernateTemplate) ctx.getBean("hibernateTemplate"); ht.execute(new HibernateCallback() { public Object doInHibernate(org.hibernate.Session session) throws org.hibernate.HibernateException, java.sql.SQLException { Experimenter o = (Experimenter) session.get(Experimenter.class, new Integer(1)); if (o == null) { o = new Experimenter(); o.setOmeName("test"); session.save(o); } Event e = (Event) session.get(Event.class, new Integer(1)); if (e == null) { e = new Event(); e.setName("test"); session.save(e); } ome.model.core.Pixels p = new ome.model.core.Pixels(); p.setSizeX(new Integer(1)); p.setSizeY(new Integer(1)); p.setSizeZ(new Integer(1)); p.setSizeC(new Integer(1)); p.setSizeT(new Integer(1)); p.setSha1("09bc7b2dcc9a510f4ab3a40c47f7a4cb77954356"); // "pixels" p.setBigEndian(Boolean.TRUE); p.setCreationEvent(e); p.setOwner(o); session.save(p); return null; }; }); }
|
protected void setUp() throws IOException { String[] paths = new String[] { "config.xml", "data.xml", "hibernate.xml" }; ctx = new ClassPathXmlApplicationContext(paths); ht = (HibernateTemplate) ctx.getBean("hibernateTemplate"); ht.execute(new HibernateCallback() { public Object doInHibernate(org.hibernate.Session session) throws org.hibernate.HibernateException, java.sql.SQLException { Experimenter o = (Experimenter) session.get(Experimenter.class, new Integer(1)); if (o == null) { o = new Experimenter(); o.setOmeName("test"); session.save(o); } Event e = (Event) session.get(Event.class, new Integer(1)); if (e == null) { e = new Event(); e.setName("test"); session.save(e); } ome.model.core.Pixels p = new ome.model.core.Pixels(); p.setSizeX(new Integer(1)); p.setSizeY(new Integer(1)); p.setSizeZ(new Integer(1)); p.setSizeC(new Integer(1)); p.setSizeT(new Integer(1)); p.setSha1("09bc7b2dcc9a510f4ab3a40c47f7a4cb77954356"); // "pixels" p.setBigEndian(Boolean.TRUE); p.setCreationEvent(e); p.setOwner(o); session.save(p); return null; }; }); }
| 3,230,869
|
protected void setUp() { String[] paths = new String[] { "config.xml", "data.xml", "hibernate.xml" }; ctx = new ClassPathXmlApplicationContext(paths); ht = (HibernateTemplate) ctx.getBean("hibernateTemplate"); ht.execute(new HibernateCallback() { public Object doInHibernate(org.hibernate.Session session) throws org.hibernate.HibernateException, java.sql.SQLException { Experimenter o = (Experimenter) session.get(Experimenter.class, new Integer(1)); if (o == null) { o = new Experimenter(); o.setOmeName("test"); session.save(o); } Event e = (Event) session.get(Event.class, new Integer(1)); if (e == null) { e = new Event(); e.setName("test"); session.save(e); } ome.model.core.Pixels p = new ome.model.core.Pixels(); p.setSizeX(new Integer(1)); p.setSizeY(new Integer(1)); p.setSizeZ(new Integer(1)); p.setSizeC(new Integer(1)); p.setSizeT(new Integer(1)); p.setSha1("09bc7b2dcc9a510f4ab3a40c47f7a4cb77954356"); // "pixels" p.setBigEndian(Boolean.TRUE); p.setCreationEvent(e); p.setOwner(o); session.save(p); return null; }; }); }
|
protected void setUp() { String[] paths = new String[] { "config.xml", "data.xml", "hibernate.xml" }; ctx = new ClassPathXmlApplicationContext(paths); ht = (HibernateTemplate) ctx.getBean("hibernateTemplate"); ht.execute(new HibernateCallback() { public Object doInHibernate(org.hibernate.Session session) throws org.hibernate.HibernateException, java.sql.SQLException { Experimenter o = (Experimenter) session.get(Experimenter.class, new Integer(1)); if (o == null) { o = new Experimenter(); o.setOmeName("test"); session.save(o); } Event e = (Event) session.get(Event.class, new Integer(1)); if (e == null) { e = new Event(); e.setName("test"); session.save(e); } ome.model.core.Pixels p = new ome.model.core.Pixels(); p.setSizeX(new Integer(1)); p.setSizeY(new Integer(1)); p.setSizeZ(new Integer(1)); p.setSizeC(new Integer(1)); p.setSizeT(new Integer(1)); p.setSha1("09bc7b2dcc9a510f4ab3a40c47f7a4cb77954356"); // "pixels" p.setBigEndian(Boolean.TRUE); p.setCreationEvent(e); p.setOwner(o); session.save(p); return null; }; }); }
| 3,230,870
|
private RubyRegexp getPattern(IRubyObject[] args) { if (args.length == 0) { isWhitespace = true; return RubyRegexp.newRegexp(runtime, "\\s+", 0, null); } if (args[0] instanceof RubyRegexp) { // Even if we have whitespace-only explicit regexp we do not // mark it as whitespace. Apparently, this is so ruby can // still get the do not ignore the front match behavior. return RubyRegexp.regexpValue(args[0]); } String stringPattern = RubyString.stringValue(args[0]).getValue(); if (stringPattern.equals(" ")) { isWhitespace = true; return RubyRegexp.newRegexp(runtime, "\\s+", 0, null); } return RubyRegexp.newRegexp(runtime, unescapeString(stringPattern), 0, null); }
|
private RubyRegexp getPattern(IRubyObject[] args) { if (args.length == 0) { isWhitespace = true; return RubyRegexp.newRegexp(runtime, "\\s+", 0, null); } if (args[0] instanceof RubyRegexp) { // Even if we have whitespace-only explicit regexp we do not // mark it as whitespace. Apparently, this is so ruby can // still get the do not ignore the front match behavior. return RubyRegexp.regexpValue(args[0]); } String stringPattern = RubyString.stringValue(args[0]).getValue(); if (stringPattern.equals(" ")) { isWhitespace = true; return RubyRegexp.newRegexp(runtime, "\\s+", 0, null); } return RubyRegexp.newRegexp(runtime, unescapeString(stringPattern), 0, null); }
| 3,230,872
|
private void process() { if (limit == 1) { result.add(splitee); return; } int last = 0; int beg = 0; int hits = 0; int len = splitee.length(); while ((beg = pattern.searchAgain(splitee)) > -1) { hits++; RubyMatchData matchData = (RubyMatchData) runtime.getCurrentContext().getBackref(); int end = matchData.matchEndPosition(); // Skip first positive lookahead match if (beg == 0 && beg == end) { continue; } // Whitespace splits are supposed to ignore leading whitespace if (beg != 0 || !isWhitespace) { addResult(substring(splitee, last, (beg == last && end == beg) ? 1 : beg - last)); // Add to list any /(.)/ matched. long extraPatterns = matchData.getSize(); for (int i = 1; i < extraPatterns; i++) { IRubyObject matchValue = matchData.group(i); if (!matchValue.isNil()) { addResult(((RubyString) matchValue).getValue()); } } } last = end; if (hits + 1 == limit) { break; } } if (hits == 0) { addResult(splitee); } else if (last <= len) { addResult(substring(splitee, last, len - last)); } if (limit == 0 && result.size() > 0) { for (int size = result.size() - 1; size >= 0 && ((String) result.get(size)).length() == 0; size--) { result.remove(size); } } }
|
private void process() { if (limit == 1) { result.add(splitee); return; } int last = 0; int beg = 0; int hits = 0; int len = splitee.length(); while ((beg = pattern.searchAgain(splitee)) > -1) { hits++; RubyMatchData matchData = (RubyMatchData) runtime.getCurrentContext().getBackref(); int end = matchData.matchEndPosition(); // Skip first positive lookahead match if (beg == 0 && beg == end) { continue; } // Whitespace splits are supposed to ignore leading whitespace if (beg != 0 || !isWhitespace) { addResult(substring(splitee, last, (beg == last && end == beg) ? 1 : beg - last)); // Add to list any /(.)/ matched. long extraPatterns = matchData.getSize(); for (int i = 1; i < extraPatterns; i++) { IRubyObject matchValue = matchData.group(i); if (!matchValue.isNil()) { addResult(((RubyString) matchValue).toString()); } } } last = end; if (hits + 1 == limit) { break; } } if (hits == 0) { addResult(splitee); } else if (last <= len) { addResult(substring(splitee, last, len - last)); } if (limit == 0 && result.size() > 0) { for (int size = result.size() - 1; size >= 0 && ((String) result.get(size)).length() == 0; size--) { result.remove(size); } } }
| 3,230,873
|
public PixelBuffer (Integer id, Pixels pixels) { if (id == null) throw new NullPointerException("Expecting a not-null id."); this.pixels = pixels; this.id = id; path = Helper.getPixelsPath(id); }
|
PixelBuffer (Pixels pixels) { if (id == null) throw new NullPointerException("Expecting a not-null id."); this.pixels = pixels; this.id = id; path = Helper.getPixelsPath(id); }
| 3,230,874
|
public PixelBuffer (Integer id, Pixels pixels) { if (id == null) throw new NullPointerException("Expecting a not-null id."); this.pixels = pixels; this.id = id; path = Helper.getPixelsPath(id); }
|
public PixelBuffer (Integer id, Pixels pixels) { if (id == null) throw new NullPointerException("Expecting a not-null id."); this.pixels = pixels; this.id = id; path = Helper.getPixelsPath(id); }
| 3,230,875
|
public PixelBuffer (Integer id, Pixels pixels) { if (id == null) throw new NullPointerException("Expecting a not-null id."); this.pixels = pixels; this.id = id; path = Helper.getPixelsPath(id); }
|
public PixelBuffer (Integer id, Pixels pixels) { if (id == null) throw new NullPointerException("Expecting a not-null id."); this.pixels = pixels; this.id = id; path = Helper.getPixelsPath(id); }
| 3,230,876
|
int getBitDepth() { return 2; // FIXME pixels.getPixelsType(); }
|
int getBitDepth() { return 16; // FIXME pixels.getPixelsType(); }
| 3,230,877
|
public MappedByteBuffer getPlane(Integer z, Integer c, Integer t) throws IOException { Long offset = getPlaneOffset(z, c, t); Integer size = getPlaneSize(); return getRegion(size, offset); }
|
publicMappedByteBuffergetPlane(Integerz,Integerc,Integert)throwsIOException{Longoffset=getPlaneOffset(z,c,t);Integersize=getPlaneSize();returngetRegion(size,offset);}
| 3,230,878
|
public Integer getPlaneSize() { if (planeSize == null) planeSize = getSizeX() * getSizeY() * getBitDepth(); return planeSize; }
|
public Integer getPlaneSize() { if (planeSize == null) planeSize = getSizeX() * getSizeY() * getByteWidth(); return planeSize; }
| 3,230,879
|
public void testNowLetsTryToSaveSomething() throws Exception { // prepare data ImageData imgData = new ImageData(); imgData.setName("My test image"); imgData.setDescription("My test description"); // convert it // FIXME mapper.reverse }
|
Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); publicImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); voidImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); testNowLetsTryToSaveSomething()Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); throwsImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); ExceptionImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); {Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); //Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); prepareImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); dataImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); ImageDataImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); imgDataImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); =Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); newImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); ImageData();Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); imgData.setName("MyImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); testImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); image");Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); imgData.setDescription("MyImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); testImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); description");Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); //Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); convertImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); itImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); //Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); FIXMEImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); mapper.reverseImage img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); Image img = (Image) reverse.map(imgData); img = (Image) psrv.createDataObject(img,null); assertNotNull("We should get something back",img); assertNotNull("Should have an id",img.getId()); Image img2 = (Image) q.getById(Image.class,img.getId()); assertNotNull("And we should be able to find it again.",img2); }
| 3,230,881
|
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { super.visitBeanDefinition(beanDefinition); if (!(beanDefinition instanceof RootBeanDefinition)) { return; } RootBeanDefinition rootBeanDefinition = ((RootBeanDefinition) beanDefinition); Class beanType = rootBeanDefinition.getBeanClass(); for (Iterator iterator = lifecycleMap.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); Class lifecycleInterface = (Class) entry.getKey(); LifecycleMethods value = (LifecycleMethods) entry.getValue(); if (lifecycleInterface.isAssignableFrom(beanType)) { if (rootBeanDefinition.getInitMethodName() == null) { rootBeanDefinition.setInitMethodName(value.initMethodName); } if (rootBeanDefinition.getDestroyMethodName() == null) { rootBeanDefinition.setDestroyMethodName(value.destroyMethodName); } if (rootBeanDefinition.getInitMethodName() != null && rootBeanDefinition.getDestroyMethodName() != null) { return; } } } }
|
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { super.visitBeanDefinition(beanDefinition); if (!(beanDefinition instanceof RootBeanDefinition)) { return; } RootBeanDefinition rootBeanDefinition = ((RootBeanDefinition) beanDefinition); Class beanType = rootBeanDefinition.getBeanClass(); for (Iterator iterator = lifecycleMap.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); Class lifecycleInterface = (Class) entry.getKey(); LifecycleMethods value = (LifecycleMethods) entry.getValue(); if (lifecycleInterface.isAssignableFrom(beanType)) { if (rootBeanDefinition.getInitMethodName() == null) { rootBeanDefinition.setInitMethodName(value.initMethodName); } if (rootBeanDefinition.getDestroyMethodName() == null) { rootBeanDefinition.setDestroyMethodName(value.destroyMethodName); } if (rootBeanDefinition.getInitMethodName() != null && rootBeanDefinition.getDestroyMethodName() != null) { return; } } } }
| 3,230,882
|
void visitBeanFactory(ConfigurableListableBeanFactory beanRegistry) throws BeansException;
|
void visitBeanFactory(ConfigurableListableBeanFactory beanRegistry) throws BeansException;
| 3,230,883
|
public static Date getDate() { synchronized(_clock) { if ((TIME - dateTime) > 1000) { date = new Date(TIME); } return date; } }
|
public static Date getDate() { synchronized(_clock) { if ((TIME - dateTime) > 1000) { date = new Date(TIME); } return date; } }
| 3,230,884
|
protected String getExceptedArgsString(RubyObject[] methodArgs) { StringBuffer sb = new StringBuffer(); sb.append("Wrong arguments:"); if (methodArgs == null || methodArgs.length == 0) { sb.append(" No args"); } else { sb.append(" ("); for (int i = 0; i < methodArgs.length; i++) { if (i > 0) { sb.append(", "); } String className = methodArgs[i].getClass().getName(); className = className.substring(className.lastIndexOf(".Ruby") + 5); sb.append("a"); if (className.charAt(0) == 'A' || className.charAt(0) == 'E' || className.charAt(0) == 'I' || className.charAt(0) == 'O' || className.charAt(0) == 'U') { sb.append("n"); } sb.append(className); } sb.append(")"); } sb.append(" given, "); if (args == null || args.length == 0) { sb.append("no arguments excepted."); } else { sb.append("("); for (int i = 0; i < args.length; i++) { if (i > 0) { sb.append(","); } String className = args[i].getName(); sb.append("a").append(className.substring(className.lastIndexOf(".Ruby") + 5)); } if (restArgs) { sb.append(", ..."); } sb.append(") excepted."); } return sb.toString(); }
|
protected String getExceptedArgsString(RubyObject[] methodArgs) { StringBuffer sb = new StringBuffer(); sb.append("Wrong arguments:"); if (methodArgs.length == 0) { sb.append(" No args"); } else { sb.append(" ("); for (int i = 0; i < methodArgs.length; i++) { if (i > 0) { sb.append(", "); } String className = methodArgs[i].getClass().getName(); className = className.substring(className.lastIndexOf(".Ruby") + 5); sb.append("a"); if (className.charAt(0) == 'A' || className.charAt(0) == 'E' || className.charAt(0) == 'I' || className.charAt(0) == 'O' || className.charAt(0) == 'U') { sb.append("n"); } sb.append(className); } sb.append(")"); } sb.append(" given, "); if (args == null || args.length == 0) { sb.append("no arguments excepted."); } else { sb.append("("); for (int i = 0; i < args.length; i++) { if (i > 0) { sb.append(","); } String className = args[i].getName(); sb.append("a").append(className.substring(className.lastIndexOf(".Ruby") + 5)); } if (restArgs) { sb.append(", ..."); } sb.append(") excepted."); } return sb.toString(); }
| 3,230,886
|
protected String getExceptedArgsString(RubyObject[] methodArgs) { StringBuffer sb = new StringBuffer(); sb.append("Wrong arguments:"); if (methodArgs == null || methodArgs.length == 0) { sb.append(" No args"); } else { sb.append(" ("); for (int i = 0; i < methodArgs.length; i++) { if (i > 0) { sb.append(", "); } String className = methodArgs[i].getClass().getName(); className = className.substring(className.lastIndexOf(".Ruby") + 5); sb.append("a"); if (className.charAt(0) == 'A' || className.charAt(0) == 'E' || className.charAt(0) == 'I' || className.charAt(0) == 'O' || className.charAt(0) == 'U') { sb.append("n"); } sb.append(className); } sb.append(")"); } sb.append(" given, "); if (args == null || args.length == 0) { sb.append("no arguments excepted."); } else { sb.append("("); for (int i = 0; i < args.length; i++) { if (i > 0) { sb.append(","); } String className = args[i].getName(); sb.append("a").append(className.substring(className.lastIndexOf(".Ruby") + 5)); } if (restArgs) { sb.append(", ..."); } sb.append(") excepted."); } return sb.toString(); }
|
protected String getExceptedArgsString(RubyObject[] methodArgs) { StringBuffer sb = new StringBuffer(); sb.append("Wrong arguments:"); if (methodArgs == null || methodArgs.length == 0) { sb.append(" No args"); } else { sb.append(" ("); for (int i = 0; i < methodArgs.length; i++) { if (i > 0) { sb.append(", "); } String className = methodArgs[i].getClass().getName(); className = className.substring(className.lastIndexOf(".Ruby") + 5); sb.append("a"); if (className.charAt(0) == 'A' || className.charAt(0) == 'E' || className.charAt(0) == 'I' || className.charAt(0) == 'O' || className.charAt(0) == 'U') { sb.append("n"); } sb.append(className); } sb.append(")"); } sb.append(" given, "); if (args.length == 0) { sb.append("no arguments excepted."); } else { sb.append("("); for (int i = 0; i < args.length; i++) { if (i > 0) { sb.append(","); } String className = args[i].getName(); sb.append("a").append(className.substring(className.lastIndexOf(".Ruby") + 5)); } if (restArgs) { sb.append(", ..."); } sb.append(") excepted."); } return sb.toString(); }
| 3,230,887
|
protected RubyObject invokeMethod(RubyObject recv, Object[] methodArgs, Ruby ruby) { if (methodArgs == null) { methodArgs = new Object[0]; } if (restArgs) { RubyObject[] restArray = new RubyObject[methodArgs.length - (args.length - 1)]; Object[] newMethodArgs = new Object[args.length]; System.arraycopy(methodArgs, args.length - 1, restArray, 0, methodArgs.length - (args.length - 1)); System.arraycopy(methodArgs, 0, newMethodArgs, 0, args.length - 1); newMethodArgs[args.length - 1] = restArray; methodArgs = newMethodArgs; } if (staticMethod) { Object[] newMethodArgs = new Object[methodArgs.length + 1]; System.arraycopy(methodArgs, 0, newMethodArgs, 1, methodArgs.length); newMethodArgs[0] = ruby; methodArgs = newMethodArgs; } try { return (RubyObject)getMethod().invoke(staticMethod ? null : recv, methodArgs); } catch (IllegalAccessException iaExcptn) { throw new RuntimeException("IllegalAccessException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (IllegalArgumentException iaExcptn) { throw new RuntimeException("IllegalArgumentException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (InvocationTargetException itExcptn) { throw new RuntimeException("InvocationTargetException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } }
|
protected RubyObject invokeMethod(RubyObject recv, Object[] methodArgs, Ruby ruby) { if (methodArgs == null) { methodArgs = new Object[0]; } if (restArgs) { RubyObject[] restArray = new RubyObject[methodArgs.length - (args.length - 1)]; Object[] newMethodArgs = new Object[args.length]; System.arraycopy(methodArgs, args.length - 1, restArray, 0, methodArgs.length - (args.length - 1)); System.arraycopy(methodArgs, 0, newMethodArgs, 0, args.length - 1); newMethodArgs[args.length - 1] = restArray; methodArgs = newMethodArgs; } if (staticMethod) { Object[] newMethodArgs = new Object[methodArgs.length + 1]; System.arraycopy(methodArgs, 0, newMethodArgs, 1, methodArgs.length); newMethodArgs[0] = ruby; methodArgs = newMethodArgs; } try { return (RubyObject)getMethod().invoke(staticMethod ? null : recv, methodArgs); } catch (IllegalAccessException iaExcptn) { throw new RuntimeException("IllegalAccessException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (IllegalArgumentException iaExcptn) { throw new RuntimeException("IllegalArgumentException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (InvocationTargetException itExcptn) { throw new RuntimeException("InvocationTargetException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } }
| 3,230,888
|
protected RubyObject invokeMethod(RubyObject recv, Object[] methodArgs, Ruby ruby) { if (methodArgs == null) { methodArgs = new Object[0]; } if (restArgs) { RubyObject[] restArray = new RubyObject[methodArgs.length - (args.length - 1)]; Object[] newMethodArgs = new Object[args.length]; System.arraycopy(methodArgs, args.length - 1, restArray, 0, methodArgs.length - (args.length - 1)); System.arraycopy(methodArgs, 0, newMethodArgs, 0, args.length - 1); newMethodArgs[args.length - 1] = restArray; methodArgs = newMethodArgs; } if (staticMethod) { Object[] newMethodArgs = new Object[methodArgs.length + 1]; System.arraycopy(methodArgs, 0, newMethodArgs, 1, methodArgs.length); newMethodArgs[0] = ruby; methodArgs = newMethodArgs; } try { return (RubyObject)getMethod().invoke(staticMethod ? null : recv, methodArgs); } catch (IllegalAccessException iaExcptn) { throw new RuntimeException("IllegalAccessException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (IllegalArgumentException iaExcptn) { throw new RuntimeException("IllegalArgumentException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (InvocationTargetException itExcptn) { throw new RuntimeException("InvocationTargetException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } }
|
protected RubyObject invokeMethod(RubyObject recv, Object[] methodArgs, Ruby ruby) { if (methodArgs == null) { methodArgs = new Object[0]; } if (restArgs) { RubyObject[] restArray = new RubyObject[methodArgs.length - (args.length - 1)]; Object[] newMethodArgs = new Object[args.length]; try { System.arraycopy(methodArgs, args.length - 1, restArray, 0, methodArgs.length - (args.length - 1)); } catch (ArrayIndexOutOfBoundsException aioobExcptn) { throw new RuntimeException("Cannot call \"" + methodName + "\" in class \"" + klass.getName() + "\". " + getExceptedArgsString((RubyObject[])methodArgs)); } System.arraycopy(methodArgs, 0, newMethodArgs, 0, args.length - 1); newMethodArgs[args.length - 1] = restArray; methodArgs = newMethodArgs; } if (staticMethod) { Object[] newMethodArgs = new Object[methodArgs.length + 1]; System.arraycopy(methodArgs, 0, newMethodArgs, 1, methodArgs.length); newMethodArgs[0] = ruby; methodArgs = newMethodArgs; } try { return (RubyObject)getMethod().invoke(staticMethod ? null : recv, methodArgs); } catch (IllegalAccessException iaExcptn) { throw new RuntimeException("IllegalAccessException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (IllegalArgumentException iaExcptn) { throw new RuntimeException("IllegalArgumentException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (InvocationTargetException itExcptn) { throw new RuntimeException("InvocationTargetException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } }
| 3,230,889
|
protected RubyObject invokeMethod(RubyObject recv, Object[] methodArgs, Ruby ruby) { if (methodArgs == null) { methodArgs = new Object[0]; } if (restArgs) { RubyObject[] restArray = new RubyObject[methodArgs.length - (args.length - 1)]; Object[] newMethodArgs = new Object[args.length]; System.arraycopy(methodArgs, args.length - 1, restArray, 0, methodArgs.length - (args.length - 1)); System.arraycopy(methodArgs, 0, newMethodArgs, 0, args.length - 1); newMethodArgs[args.length - 1] = restArray; methodArgs = newMethodArgs; } if (staticMethod) { Object[] newMethodArgs = new Object[methodArgs.length + 1]; System.arraycopy(methodArgs, 0, newMethodArgs, 1, methodArgs.length); newMethodArgs[0] = ruby; methodArgs = newMethodArgs; } try { return (RubyObject)getMethod().invoke(staticMethod ? null : recv, methodArgs); } catch (IllegalAccessException iaExcptn) { throw new RuntimeException("IllegalAccessException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (IllegalArgumentException iaExcptn) { throw new RuntimeException("IllegalArgumentException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (InvocationTargetException itExcptn) { throw new RuntimeException("InvocationTargetException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } }
|
protected RubyObject invokeMethod(RubyObject recv, Object[] methodArgs, Ruby ruby) { if (methodArgs == null) { methodArgs = new Object[0]; } if (restArgs) { RubyObject[] restArray = new RubyObject[methodArgs.length - (args.length - 1)]; Object[] newMethodArgs = new Object[args.length]; System.arraycopy(methodArgs, args.length - 1, restArray, 0, methodArgs.length - (args.length - 1)); System.arraycopy(methodArgs, 0, newMethodArgs, 0, args.length - 1); newMethodArgs[args.length - 1] = restArray; methodArgs = newMethodArgs; } if (staticMethod) { Object[] newMethodArgs = new Object[methodArgs.length + 1]; System.arraycopy(methodArgs, 0, newMethodArgs, 1, methodArgs.length); newMethodArgs[0] = ruby; methodArgs = newMethodArgs; } try { return (RubyObject)getMethod().invoke(staticMethod ? null : recv, methodArgs); } catch (Exception excptn) { excptn.printStackTrace(); return null; } /* } catch (IllegalAccessException iaExcptn) { throw new RuntimeException("IllegalAccessException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (IllegalArgumentException iaExcptn) { throw new RuntimeException("IllegalArgumentException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (InvocationTargetException itExcptn) { throw new RuntimeException("InvocationTargetException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } }
| 3,230,890
|
protected RubyObject invokeMethod(RubyObject recv, Object[] methodArgs, Ruby ruby) { if (methodArgs == null) { methodArgs = new Object[0]; } if (restArgs) { RubyObject[] restArray = new RubyObject[methodArgs.length - (args.length - 1)]; Object[] newMethodArgs = new Object[args.length]; System.arraycopy(methodArgs, args.length - 1, restArray, 0, methodArgs.length - (args.length - 1)); System.arraycopy(methodArgs, 0, newMethodArgs, 0, args.length - 1); newMethodArgs[args.length - 1] = restArray; methodArgs = newMethodArgs; } if (staticMethod) { Object[] newMethodArgs = new Object[methodArgs.length + 1]; System.arraycopy(methodArgs, 0, newMethodArgs, 1, methodArgs.length); newMethodArgs[0] = ruby; methodArgs = newMethodArgs; } try { return (RubyObject)getMethod().invoke(staticMethod ? null : recv, methodArgs); } catch (IllegalAccessException iaExcptn) { throw new RuntimeException("IllegalAccessException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (IllegalArgumentException iaExcptn) { throw new RuntimeException("IllegalArgumentException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } catch (InvocationTargetException itExcptn) { throw new RuntimeException("InvocationTargetException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); } }
|
protected RubyObject invokeMethod(RubyObject recv, Object[] methodArgs, Ruby ruby) { if (methodArgs == null) { methodArgs = new Object[0]; }*/ if (restArgs) { RubyObject[] restArray = new RubyObject[methodArgs.length - (args.length - 1)]; Object[] newMethodArgs = new Object[args.length]; System.arraycopy(methodArgs, args.length - 1, restArray, 0, methodArgs.length - (args.length - 1)); System.arraycopy(methodArgs, 0, newMethodArgs, 0, args.length - 1); newMethodArgs[args.length - 1] = restArray; methodArgs = newMethodArgs; }*/ if (staticMethod) { Object[] newMethodArgs = new Object[methodArgs.length + 1]; System.arraycopy(methodArgs, 0, newMethodArgs, 1, methodArgs.length); newMethodArgs[0] = ruby; methodArgs = newMethodArgs; }*/ try { return (RubyObject)getMethod().invoke(staticMethod ? null : recv, methodArgs); }*/ catch (IllegalAccessException iaExcptn) { throw new RuntimeException("IllegalAccessException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); }*/ catch (IllegalArgumentException iaExcptn) { throw new RuntimeException("IllegalArgumentException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); }*/ catch (InvocationTargetException itExcptn) { throw new RuntimeException("InvocationTargetException: Cannot invoke method \"" + methodName + "\" in class \"" + klass.getName() + "\" by Reflection."); }*/ }
| 3,230,891
|
protected void testArgsCount(RubyObject[] methodArgs) { if (args == null && methodArgs != null && methodArgs.length > 0) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } else if (args == null && (methodArgs == null || methodArgs.length == 0)) { return; } else if (restArgs) { if (methodArgs == null && (args.length == 1)) { return; } else if (methodArgs.length < (args.length - 1)) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } else { if ((methodArgs == null) || (methodArgs.length != args.length)) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } }
|
protected void testArgsCount(RubyObject[] methodArgs) { if (args == null && methodArgs != null && methodArgs.length > 0) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } else if (args == null && (methodArgs == null || methodArgs.length == 0)) { return; } else if (restArgs) { if (methodArgs == null && (args.length == 1)) { return; } else if (methodArgs.length < (args.length - 1)) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } else { if ((methodArgs == null) || (methodArgs.length != args.length)) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } }
| 3,230,892
|
protected void testArgsCount(RubyObject[] methodArgs) { if (args == null && methodArgs != null && methodArgs.length > 0) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } else if (args == null && (methodArgs == null || methodArgs.length == 0)) { return; } else if (restArgs) { if (methodArgs == null && (args.length == 1)) { return; } else if (methodArgs.length < (args.length - 1)) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } else { if ((methodArgs == null) || (methodArgs.length != args.length)) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } }
|
protected void testArgsCount(RubyObject[] methodArgs) { if (args == null && methodArgs != null && methodArgs.length > 0) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } else if (args == null && (methodArgs == null || methodArgs.length == 0)) { return; } else if (restArgs) { if (methodArgs == null && (args.length == 1)) { return; } else if (methodArgs.length < (args.length - 1)) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } else { if ((methodArgs == null) || (methodArgs.length != args.length)) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } }
| 3,230,893
|
protected void testArgsCount(RubyObject[] methodArgs) { if (args == null && methodArgs != null && methodArgs.length > 0) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } else if (args == null && (methodArgs == null || methodArgs.length == 0)) { return; } else if (restArgs) { if (methodArgs == null && (args.length == 1)) { return; } else if (methodArgs.length < (args.length - 1)) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } else { if ((methodArgs == null) || (methodArgs.length != args.length)) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } }
|
protected void testArgsCount(RubyObject[] methodArgs) { if (args == null && methodArgs != null && methodArgs.length > 0) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } else if (args == null && (methodArgs == null || methodArgs.length == 0)) { return; } else if (restArgs) { if (methodArgs == null && (args.length == 1)) { return; } else if (methodArgs.length < (args.length - 1)) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } else { if (methodArgs.length != args.length) { throw new RubyArgumentException(getExceptedArgsString(methodArgs)); } } }
| 3,230,894
|
public Class getJavaClass() { return value.getClass(); }
|
public Class getJavaClass() { return value != null ? value.getClass() : Object.class; }
| 3,230,895
|
public void setIvar(RubyId id, RubyObject value) { //return null; }
|
public RubyObject setIvar(RubyId id, RubyObject value) { return null; //return null; }
| 3,230,896
|
public String[] getNames() { try { getFiles(); } catch (PatternSyntaxException e) { System.out.println("BAD PATTERN: " + e.getPattern()); // This can happen if someone does Dir.glob("{") or similiar. return new String[] {}; } Collection allMatchedNames = new TreeSet(); 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[] {}; } Collection allMatchedNames = new TreeSet(); 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,230,897
|
public Collection findCollection(Collection source){ if (source==null) return null; Collection target = (Collection) model2target.get(source); if (null==target) { try { target = (Collection) source.getClass().newInstance(); // TODO do we want to use the map here? model2target.put(source,target); } catch (InstantiationException ie){ throw new RuntimeException(ie); } catch (IllegalAccessException iae){ throw new RuntimeException(iae); } } return target; }
|
public Collection findCollection(Collection source){ if (source==null) return null; Collection target = (Collection) model2target.get(source); if (null==target) { try { target = (Collection) source.getClass().newInstance(); // TODO do we want to use the map here? model2target.put(source,target); } catch (InstantiationException ie){ throw new RuntimeException(ie); } catch (IllegalAccessException iae){ throw new RuntimeException(iae); } } return target; }
| 3,230,898
|
public Object findTarget(Object current){ // IMMUTABLES if (null == current | current instanceof Integer | current instanceof String) // TODO can use findTarget then for these as well. { return current; } else // Special cases TODO put into doFindTarget if (current instanceof Date){ return new Timestamp(((Date)current).getTime()); // FIXME should cache these in model2pojo } Object target = model2target.get(current); if (null == target) { Class targetType = findClass(current.getClass()); if (null != targetType){ try { target = targetType.newInstance(); } catch (Exception e) { throw new RuntimeException("Internal error: could not instantiate object of type "+targetType+" while trying to map "+current,e); } model2target.put(current,target); } else { throw new RuntimeException("Internal error: could not find target class type for "+current.getClass()); } } return target; }
|
public Object findTarget(Object current){ // IMMUTABLES if (null == current | current instanceof Integer | current instanceof String) // TODO can use findTarget then for these as well. { return current; } else // Special cases TODO put into doFindTarget if (current instanceof Date){ return new Timestamp(((Date)current).getTime()); // FIXME should cache these in model2pojo } Object target = model2target.get(current); if (null == target) { Class targetType = findClass(current.getClass()); if (null != targetType){ try { target = targetType.newInstance(); } catch (Exception e) { throw new RuntimeException("Internal error: could not instantiate object of type "+targetType+" while trying to map "+current,e); } model2target.put(current,target); } else { throw new RuntimeException("Internal error: could not find target class type for "+current.getClass()); } } return target; }
| 3,230,899
|
public Object findTarget(Object current){ // IMMUTABLES if (null == current | current instanceof Integer | current instanceof String) // TODO can use findTarget then for these as well. { return current; } else // Special cases TODO put into doFindTarget if (current instanceof Date){ return new Timestamp(((Date)current).getTime()); // FIXME should cache these in model2pojo } Object target = model2target.get(current); if (null == target) { Class targetType = findClass(current.getClass()); if (null != targetType){ try { target = targetType.newInstance(); } catch (Exception e) { throw new RuntimeException("Internal error: could not instantiate object of type "+targetType+" while trying to map "+current,e); } model2target.put(current,target); } else { throw new RuntimeException("Internal error: could not find target class type for "+current.getClass()); } } return target; }
|
public Object findTarget(Object current){ // IMMUTABLES if (null == current | current instanceof Integer | current instanceof String) // TODO can use findTarget then for these as well. { return current; } else // Special cases TODO put into doFindTarget if (current instanceof Date){ return new Timestamp(((Date)current).getTime()); // FIXME should cache these in model2pojo } Object target = model2target.get(current); if (null == target) { Class targetType = findClass(current.getClass()); if (null != targetType){ try { target = targetType.newInstance(); } catch (Exception e) { throw new RuntimeException("Internal error: could not instantiate object of type "+targetType+" while trying to map "+current,e); } model2target.put(current,target); } else { throw new RuntimeException("Internal error: could not find target class type for "+current.getClass()); } } return target; }
| 3,230,900
|
public Object findTarget(Object current){ // IMMUTABLES if (null == current | current instanceof Integer | current instanceof String) // TODO can use findTarget then for these as well. { return current; } else // Special cases TODO put into doFindTarget if (current instanceof Date){ return new Timestamp(((Date)current).getTime()); // FIXME should cache these in model2pojo } Object target = model2target.get(current); if (null == target) { Class targetType = findClass(current.getClass()); if (null != targetType){ try { target = targetType.newInstance(); } catch (Exception e) { throw new RuntimeException("Internal error: could not instantiate object of type "+targetType+" while trying to map "+current,e); } model2target.put(current,target); } else { throw new RuntimeException("Internal error: could not find target class type for "+current.getClass()); } } return target; }
|
public Object findTarget(Object current){ // IMMUTABLES if (null == current | current instanceof Integer | current instanceof String) // TODO can use findTarget then for these as well. { return current; } else // Special cases TODO put into doFindTarget if (current instanceof Date){ return new Timestamp(((Date)current).getTime()); // FIXME should cache these in model2pojo } Object target = model2target.get(current); if (null == target) { Class targetType = findClass(current.getClass()); if (null != targetType){ try { target = targetType.newInstance(); } catch (Exception e) { throw new RuntimeException("Internal error: could not instantiate object of type "+targetType+" while trying to map "+current,e); } model2target.put(current,target); } else { throw new RuntimeException("Internal error: could not find target class type for "+current.getClass()); } } return target; }
| 3,230,901
|
public Object findTarget(Object current){ // IMMUTABLES if (null == current | current instanceof Integer | current instanceof String) // TODO can use findTarget then for these as well. { return current; } else // Special cases TODO put into doFindTarget if (current instanceof Date){ return new Timestamp(((Date)current).getTime()); // FIXME should cache these in model2pojo } Object target = model2target.get(current); if (null == target) { Class targetType = findClass(current.getClass()); if (null != targetType){ try { target = targetType.newInstance(); } catch (Exception e) { throw new RuntimeException("Internal error: could not instantiate object of type "+targetType+" while trying to map "+current,e); } model2target.put(current,target); } else { throw new RuntimeException("Internal error: could not find target class type for "+current.getClass()); } } return target; }
|
public Object findTarget(Object current){ // IMMUTABLES if (null == current | current instanceof Integer | current instanceof String) // TODO can use findTarget then for these as well. { return current; } else // Special cases TODO put into doFindTarget if (current instanceof Date){ return new Timestamp(((Date)current).getTime()); // FIXME should cache these in model2pojo } Object target = model2target.get(current); if (null == target) { Class targetType = findClass(current.getClass()); if (null != targetType){ try { target = targetType.newInstance(); } catch (Exception e) { throw new RuntimeException("Internal error: could not instantiate object of type "+targetType+" while trying to map "+current,e); } model2target.put(current,target); } else { throw new RuntimeException("Internal error: could not find target class type for "+current.getClass()); } } return target; }
| 3,230,902
|
public Object findTarget(Object current){ // IMMUTABLES if (null == current | current instanceof Integer | current instanceof String) // TODO can use findTarget then for these as well. { return current; } else // Special cases TODO put into doFindTarget if (current instanceof Date){ return new Timestamp(((Date)current).getTime()); // FIXME should cache these in model2pojo } Object target = model2target.get(current); if (null == target) { Class targetType = findClass(current.getClass()); if (null != targetType){ try { target = targetType.newInstance(); } catch (Exception e) { throw new RuntimeException("Internal error: could not instantiate object of type "+targetType+" while trying to map "+current,e); } model2target.put(current,target); } else { throw new RuntimeException("Internal error: could not find target class type for "+current.getClass()); } } return target; }
|
public Object findTarget(Object current){ // IMMUTABLES if (null == current | current instanceof Integer | current instanceof String) // TODO can use findTarget then for these as well. { return current; } else // Special cases TODO put into doFindTarget if (current instanceof Date){ return new Timestamp(((Date)current).getTime()); // FIXME should cache these in model2pojo } Object target = model2target.get(current); if (null == target) { Class targetType = findClass(current.getClass()); if (null != targetType){ try { target = targetType.newInstance(); } catch (Exception e) { throw new RuntimeException("Internal error: could not instantiate object of type "+targetType+" while trying to map "+current,e); } model2target.put(current,target); } else { throw new RuntimeException("Internal error: could not find target class type for "+current.getClass()); } } return target; }
| 3,230,903
|
public HTMLReport(ProjectData projectData, File outputDir, FileFinder finder) throws Exception { this.destinationDir = outputDir; this.finder = finder; this.projectData = projectData; CopyFiles.copy(outputDir); generatePackageList(); generateSourceFileLists(); generateOverviews(); generateSourceFiles(); }
|
public HTMLReport(ProjectData projectData, File outputDir, FileFinder finder) throws Exception { this.destinationDir = outputDir; this.finder = finder; this.projectData = projectData; CopyFiles.copy(outputDir); generatePackageList(); generateSourceFileLists(); generateOverviews(); generateSourceFiles(); }
| 3,230,905
|
private void generateSourceFile(SourceFileData sourceFileData) throws IOException { if (!sourceFileData.containsInstrumentationInfo()) { LOGGER.info("Data file does not contain instrumentation " + "information for the file " + sourceFileData.getName() + ". Ensure this class was instrumented, and this " + "data file contains the instrumentation information."); } String filename = sourceFileData.getNormalizedName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = sourceFileData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(sourceFileData.getPackageName() + "."); } out.print(sourceFileData.getBaseName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeader("Classes in this File", false)); // TODO: Change this to actually show multiple classes. out.println(generateTableRowForSourceFile(sourceFileData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = finder.findFile(sourceFileData.getName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (sourceFileData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = sourceFileData .getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
|
private void generateSourceFile(SourceFileData sourceFileData) throws IOException { if (!sourceFileData.containsInstrumentationInfo()) { LOGGER.info("Data file does not contain instrumentation " + "information for the file " + sourceFileData.getName() + ". Ensure this class was instrumented, and this " + "data file contains the instrumentation information."); } String filename = sourceFileData.getNormalizedName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = sourceFileData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(sourceFileData.getPackageName() + "."); } out.print(sourceFileData.getBaseName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeader("Classes in this File", false)); // TODO: Change this to actually show multiple classes. out.println(generateTableRowForSourceFile(sourceFileData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = finder.findFile(sourceFileData.getName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (sourceFileData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = sourceFileData .getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
| 3,230,907
|
private String generateTableRowForPackage(PackageData packageData) { StringBuffer ret = new StringBuffer(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-sourcefiles-" + packageData.getName() + ".html"; double lineCoverage = -1; double branchCoverage = -1; double ccn = packageData.getCCN(finder); if (packageData.getNumberOfValidLines() > 0) lineCoverage = packageData.getLineCoverageRate(); if (packageData.getNumberOfValidBranches() > 0) branchCoverage = packageData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + url1 + "\" onClick='parent.sourceFileList.location.href=\"" + url2 + "\"'>" + generatePackageName(packageData) + "</a></td>"); ret.append("<td class=\"value\">" + packageData.getNumberOfChildren() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); }
|
private String generateTableRowForPackage(PackageData packageData) { StringBuffer ret = new StringBuffer(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-sourcefiles-" + packageData.getName() + ".html"; double lineCoverage = -1; double branchCoverage = -1; double ccn = packageData.getCCN(finder); if (packageData.getNumberOfValidLines() > 0) lineCoverage = packageData.getLineCoverageRate(); if (packageData.getNumberOfValidBranches() > 0) branchCoverage = packageData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + url1 + "\" onClick='parent.sourceFileList.location.href=\"" + url2 + "\"'>" + generatePackageName(packageData) + "</a></td>"); ret.append("<td class=\"value\">" + packageData.getNumberOfChildren() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); }
| 3,230,908
|
private String generateTableRowForSourceFile(SourceFileData sourceFileData) { StringBuffer ret = new StringBuffer(); double lineCoverage = -1; double branchCoverage = -1; File file = finder.findFile(sourceFileData.getName()); if (file == null) { System.out.println("FILE IS NULL: " + sourceFileData.getName()); } double ccn = Util.getCCN(file, false); if (sourceFileData.getNumberOfValidLines() > 0) lineCoverage = sourceFileData.getLineCoverageRate(); if (sourceFileData.getNumberOfValidBranches() > 0) branchCoverage = sourceFileData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + sourceFileData.getNormalizedName() + ".html\">" + sourceFileData.getBaseName() + "</a></td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); }
|
private String generateTableRowForSourceFile(SourceFileData sourceFileData) { StringBuffer ret = new StringBuffer(); double lineCoverage = -1; double branchCoverage = -1; File file = finder.findFile(sourceFileData.getName()); if (file == null) { System.out.println("FILE IS NULL: " + sourceFileData.getName()); } double ccn = Util.getCCN(file, false); if (sourceFileData.getNumberOfValidLines() > 0) lineCoverage = sourceFileData.getLineCoverageRate(); if (sourceFileData.getNumberOfValidBranches() > 0) branchCoverage = sourceFileData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + sourceFileData.getNormalizedName() + ".html\">" + sourceFileData.getBaseName() + "</a></td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); }
| 3,230,909
|
private String generateTableRowForTotal() { StringBuffer ret = new StringBuffer(); double lineCoverage = -1; double branchCoverage = -1; double ccnSum = 0; int count = 0; for (Iterator it = finder.getBaseDirectories().iterator(); it.hasNext(); ) { File basedir = (File) it.next(); ccnSum += Util.getCCN(basedir.getAbsoluteFile(), true); count++; } double ccn = ccnSum / (double) count; if (projectData.getNumberOfValidLines() > 0) lineCoverage = projectData.getLineCoverageRate(); if (projectData.getNumberOfValidBranches() > 0) branchCoverage = projectData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><b>All Packages</b></td>"); ret.append("<td class=\"value\">" + projectData.getNumberOfSourceFiles() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); }
|
private String generateTableRowForTotal() { StringBuffer ret = new StringBuffer(); double lineCoverage = -1; double branchCoverage = -1; double ccnSum = 0; int count = 0; for (Iterator it = finder.getBaseDirectories().iterator(); it.hasNext(); ) { File basedir = (File) it.next(); ccnSum += Util.getCCN(basedir.getAbsoluteFile(), true); count++; } double ccn = ccnSum / (double) count; if (projectData.getNumberOfValidLines() > 0) lineCoverage = projectData.getLineCoverageRate(); if (projectData.getNumberOfValidBranches() > 0) branchCoverage = projectData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><b>All Packages</b></td>"); ret.append("<td class=\"value\">" + projectData.getNumberOfSourceFiles() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); }
| 3,230,910
|
public IRubyObject chomp_bang(IRubyObject[] args) { if (isEmpty()) { return getRuntime().getNil(); } String separator = getRuntime().getGlobalVariables().get("$/").asSymbol(); if (args.length > 0) { separator = args[0].asSymbol(); } if (getValue().endsWith(separator)) { setValue(getValue().substring(0, getValue().length() - separator.length())); return this; } return getRuntime().getNil(); }
|
public IRubyObject chomp_bang(IRubyObject[] args) { if (isEmpty()) { return getRuntime().getNil(); } String separator = getRuntime().getGlobalVariables().get("$/").asSymbol(); if (args.length > 0) { separator = args[0].asSymbol(); } if (getValue().endsWith(separator)) { setValue(getValue().substring(0, getValue().length() - separator.length())); return this; } return getRuntime().getNil(); }
| 3,230,911
|
private void buildContactList() { XMPPConnection con = SparkManager.getConnection(); final Roster roster = con.getRoster(); roster.addRosterListener(this); for (RosterGroup group : roster.getGroups()) { ContactGroup contactGroup = addContactGroup(group.getName()); for (RosterEntry entry : group.getEntries()) { String name = entry.getName(); if (name == null) { name = entry.getUser(); } ContactItem contactItem = new ContactItem(name, entry.getUser()); contactItem.setPresence(null); if ((entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { // Add to contact group. contactGroup.addContactItem(contactItem); contactGroup.setVisible(true); } else { if (offlineGroup.getContactItemByJID(entry.getUser()) == null) { offlineGroup.addContactItem(contactItem); } } } } // Add Unfiled Group // addContactGroup(unfiledGroup); for (RosterEntry entry : roster.getUnfiledEntries()) { String name = entry.getName(); if (name == null) { name = entry.getUser(); } ContactItem contactItem = new ContactItem(name, entry.getUser()); offlineGroup.addContactItem(contactItem); } unfiledGroup.setVisible(false); }
|
private void buildContactList() { XMPPConnection con = SparkManager.getConnection(); final Roster roster = con.getRoster(); roster.addRosterListener(this); for (RosterGroup group : roster.getGroups()) { ContactGroup contactGroup = addContactGroup(group.getName()); for (RosterEntry entry : group.getEntries()) { String name = entry.getName(); if (name == null) { name = entry.getUser(); } ContactItem contactItem = new ContactItem(name, entry.getUser()); contactItem.setPresence(null); if ((entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus()) { // Add to contact group. contactGroup.addContactItem(contactItem); contactGroup.setVisible(true); } else { if (offlineGroup.getContactItemByJID(entry.getUser()) == null) { offlineGroup.addContactItem(contactItem); } } } } // Add Unfiled Group // addContactGroup(unfiledGroup); for (RosterEntry entry : roster.getUnfiledEntries()) { String name = entry.getName(); if (name == null) { name = entry.getUser(); } ContactItem contactItem = new ContactItem(name, entry.getUser()); offlineGroup.addContactItem(contactItem); } unfiledGroup.setVisible(false); }
| 3,230,913
|
private synchronized void handleEntriesUpdated(final Collection addresses) { SwingUtilities.invokeLater(new Runnable() { public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } }); }
|
private synchronized void handleEntriesUpdated(final Collection addresses) { SwingUtilities.invokeLater(new Runnable() { public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } }); }
| 3,230,914
|
public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } }
|
public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } }
| 3,230,915
|
private void moveToOfflineGroup(String bareJID) { final Iterator groupIterator = new ArrayList(groupList).iterator(); while (groupIterator.hasNext()) { final ContactGroup group = (ContactGroup)groupIterator.next(); final ContactItem item = group.getContactItemByJID(bareJID); if (item != null) { item.showUserGoingOfflineOnline(); item.setIcon(SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON)); group.fireContactGroupUpdated(); int numberOfMillisecondsInTheFuture = 3000; Date timeToRun = new Date(System.currentTimeMillis() + numberOfMillisecondsInTheFuture); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { item.setPresence(null); // Check for ContactItemHandler. group.removeContactItem(item); checkGroup(group); if (offlineGroup.getContactItemByJID(item.getFullJID()) == null) { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } }, timeToRun); } } }
|
private void moveToOfflineGroup(final String bareJID) { final Iterator groupIterator = new ArrayList(groupList).iterator(); while (groupIterator.hasNext()) { final ContactGroup group = (ContactGroup)groupIterator.next(); final ContactItem item = group.getContactItemByJID(bareJID); if (item != null) { item.showUserGoingOfflineOnline(); item.setIcon(SparkRes.getImageIcon(SparkRes.CLEAR_BALL_ICON)); group.fireContactGroupUpdated(); int numberOfMillisecondsInTheFuture = 3000; Date timeToRun = new Date(System.currentTimeMillis() + numberOfMillisecondsInTheFuture); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { item.setPresence(null); // Check for ContactItemHandler. group.removeContactItem(item); checkGroup(group); if (offlineGroup.getContactItemByJID(item.getFullJID()) == null) { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } }, timeToRun); } } }
| 3,230,916
|
private void updateUserPresence(Presence presence) { if (presence == null) { return; } Roster roster = SparkManager.getConnection().getRoster(); final String bareJID = StringUtils.parseBareAddress(presence.getFrom()); RosterEntry entry = roster.getEntry(bareJID); boolean isPending = entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus(); // If online, check to see if they are in the offline group. // If so, remove from offline group and add to all groups they // belong to. if (presence.getType() == Presence.Type.available && offlineGroup.getContactItemByJID(bareJID) != null) { changeOfflineToOnline(bareJID, entry, presence); } else if (presence.getFrom().indexOf("workgroup.") != -1) { changeOfflineToOnline(bareJID, entry, presence); } // If online, but not in offline group, update presence. else if (presence.getType() == Presence.Type.available) { final Iterator groupIterator = groupList.iterator(); while (groupIterator.hasNext()) { ContactGroup group = (ContactGroup)groupIterator.next(); ContactItem item = group.getContactItemByJID(bareJID); if (item != null) { item.setPresence(presence); group.fireContactGroupUpdated(); } } } // If not available, move to offline group. else if (presence.getType() == Presence.Type.unavailable && !isPending) { presence = roster.getPresence(bareJID); if (presence == null) { moveToOfflineGroup(bareJID); } } }
|
private void updateUserPresence(Presence presence) { if (presence == null) { return; } Roster roster = SparkManager.getConnection().getRoster(); final String bareJID = StringUtils.parseBareAddress(presence.getFrom()); RosterEntry entry = roster.getEntry(bareJID); boolean isPending = entry != null && (entry.getType() == RosterPacket.ItemType.NONE || entry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == entry.getStatus(); // If online, check to see if they are in the offline group. // If so, remove from offline group and add to all groups they // belong to. if (presence.getType() == Presence.Type.available && offlineGroup.getContactItemByJID(bareJID) != null) { changeOfflineToOnline(bareJID, entry, presence); } else if (presence.getFrom().indexOf("workgroup.") != -1) { changeOfflineToOnline(bareJID, entry, presence); } // If online, but not in offline group, update presence. else if (presence.getType() == Presence.Type.available) { final Iterator groupIterator = groupList.iterator(); while (groupIterator.hasNext()) { ContactGroup group = (ContactGroup)groupIterator.next(); ContactItem item = group.getContactItemByJID(bareJID); if (item != null) { item.setPresence(presence); group.fireContactGroupUpdated(); } } } // If not available, move to offline group. else if (presence.getType() == Presence.Type.unavailable && !isPending) { presence = roster.getPresence(bareJID); if (presence == null) { moveToOfflineGroup(bareJID); } } }
| 3,230,919
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
|
public void searchContacts(String contact, final JFrame parent) { if (parents.get(parent) == null) { parents.put(parent, parent.getGlassPane()); } final Component glassPane = (Component)parents.get(parent); parent.setGlassPane(glassPane); final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
| 3,230,920
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
| 3,230,921
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
| 3,230,922
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
| 3,230,923
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 50, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
| 3,230,924
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
| 3,230,925
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { } } }); contactField.setText(contact); }
| 3,230,926
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { window.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); window.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { window.dispose(); } } }); contactField.setText(contact); }
|
public void searchContacts(String contact, JFrame parent) { final Map contactMap = new HashMap(); final Set contacts = new HashSet(); final ContactList contactList = SparkManager.getWorkspace().getContactList(); Iterator groups = contactList.getContactGroups().iterator(); while (groups.hasNext()) { ContactGroup group = (ContactGroup)groups.next(); Iterator contactItems = group.getContactItems().iterator(); while (contactItems.hasNext()) { ContactItem item = (ContactItem)contactItems.next(); if (contactMap.get(item.getNickname()) == null) { contacts.add(item); contactMap.put(item.getNickname(), item); } } } if (window != null) { parent.setGlassPane(glassPane); parent.getGlassPane().setVisible(false); contactField.dispose(); } window = new JWindow(parent); final JContactItemField contactField = new JContactItemField(new ArrayList(contacts)); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); window.setLayout(new BorderLayout()); JLabel enterLabel = new JLabel(Res.getString("label.contact.to.find")); enterLabel.setFont(new Font("dialog", Font.BOLD, 10)); layoutPanel.add(enterLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0)); layoutPanel.add(contactField, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 200, 0)); layoutPanel.setBorder(BorderFactory.createBevelBorder(0)); window.add(layoutPanel); window.pack(); window.setLocationRelativeTo(parent); window.setVisible(true); window.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { parent.setGlassPane(glassPane); parent.getGlassPane().setVisible(false); contactField.dispose(); } } }); contactField.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { if (keyEvent.getKeyChar() == KeyEvent.VK_ENTER) { if (ModelUtil.hasLength(contactField.getText())) { ContactItem item = (ContactItem)contactMap.get(contactField.getText()); if (item != null) { SparkManager.getChatManager().activateChat(item.getFullJID(), item.getNickname()); parent.setGlassPane(glassPane); parent.getGlassPane().setVisible(false); contactField.dispose(); } } } else if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) { parent.setGlassPane(glassPane); parent.getGlassPane().setVisible(false); contactField.dispose(); } } }); contactField.setText(contact); }
| 3,230,927
|
public static void createDigestMD5(IRuby runtime) { runtime.getModule("Kernel").callMethod(runtime.getCurrentContext(),"require",runtime.newString("digest.so")); RubyModule mDigest = runtime.getModule("Digest"); RubyClass cDigestBase = mDigest.getClass("Base"); RubyClass cDigest_MD5 = mDigest.defineClassUnder("MD5",cDigestBase); cDigest_MD5.setClassVar("metadata",runtime.newString("MD5")); }
|
public static void createDigestMD5(IRuby runtime) { runtime.getLoadService().require("digest.so"); RubyModule mDigest = runtime.getModule("Digest"); RubyClass cDigestBase = mDigest.getClass("Base"); RubyClass cDigest_MD5 = mDigest.defineClassUnder("MD5",cDigestBase); cDigest_MD5.setClassVar("metadata",runtime.newString("MD5")); }
| 3,230,929
|
public static void createDigestRMD160(IRuby runtime) { runtime.getModule("Kernel").callMethod(runtime.getCurrentContext(),"require",runtime.newString("digest.so")); RubyModule mDigest = runtime.getModule("Digest"); RubyClass cDigestBase = mDigest.getClass("Base"); RubyClass cDigest_RMD160 = mDigest.defineClassUnder("RMD160",cDigestBase); cDigest_RMD160.setClassVar("metadata",runtime.newString("RIPEMD160")); }
|
public static void createDigestRMD160(IRuby runtime) { runtime.getLoadService().require("digest.so"); RubyModule mDigest = runtime.getModule("Digest"); RubyClass cDigestBase = mDigest.getClass("Base"); RubyClass cDigest_RMD160 = mDigest.defineClassUnder("RMD160",cDigestBase); cDigest_RMD160.setClassVar("metadata",runtime.newString("RIPEMD160")); }
| 3,230,930
|
public static void createDigestSHA1(IRuby runtime) { runtime.getModule("Kernel").callMethod(runtime.getCurrentContext(),"require",runtime.newString("digest.so")); RubyModule mDigest = runtime.getModule("Digest"); RubyClass cDigestBase = mDigest.getClass("Base"); RubyClass cDigest_SHA1 = mDigest.defineClassUnder("SHA1",cDigestBase); cDigest_SHA1.setClassVar("metadata",runtime.newString("SHA1")); }
|
public static void createDigestSHA1(IRuby runtime) { runtime.getLoadService().require("digest.so"); RubyModule mDigest = runtime.getModule("Digest"); RubyClass cDigestBase = mDigest.getClass("Base"); RubyClass cDigest_SHA1 = mDigest.defineClassUnder("SHA1",cDigestBase); cDigest_SHA1.setClassVar("metadata",runtime.newString("SHA1")); }
| 3,230,931
|
public static void createDigestSHA2(IRuby runtime) { try { MessageDigest.getInstance("SHA-256"); } catch(NoSuchAlgorithmException e) { throw runtime.newLoadError("SHA2 not supported"); } runtime.getModule("Kernel").callMethod(runtime.getCurrentContext(),"require",runtime.newString("digest.so")); RubyModule mDigest = runtime.getModule("Digest"); RubyClass cDigestBase = mDigest.getClass("Base"); RubyClass cDigest_SHA2_256 = mDigest.defineClassUnder("SHA256",cDigestBase); cDigest_SHA2_256.setClassVar("metadata",runtime.newString("SHA-256")); RubyClass cDigest_SHA2_384 = mDigest.defineClassUnder("SHA384",cDigestBase); cDigest_SHA2_384.setClassVar("metadata",runtime.newString("SHA-384")); RubyClass cDigest_SHA2_512 = mDigest.defineClassUnder("SHA512",cDigestBase); cDigest_SHA2_512.setClassVar("metadata",runtime.newString("SHA-512")); }
|
public static void createDigestSHA2(IRuby runtime) { try { MessageDigest.getInstance("SHA-256"); } catch(NoSuchAlgorithmException e) { throw runtime.newLoadError("SHA2 not supported"); } runtime.getLoadService().require("digest.so"); RubyModule mDigest = runtime.getModule("Digest"); RubyClass cDigestBase = mDigest.getClass("Base"); RubyClass cDigest_SHA2_256 = mDigest.defineClassUnder("SHA256",cDigestBase); cDigest_SHA2_256.setClassVar("metadata",runtime.newString("SHA-256")); RubyClass cDigest_SHA2_384 = mDigest.defineClassUnder("SHA384",cDigestBase); cDigest_SHA2_384.setClassVar("metadata",runtime.newString("SHA-384")); RubyClass cDigest_SHA2_512 = mDigest.defineClassUnder("SHA512",cDigestBase); cDigest_SHA2_512.setClassVar("metadata",runtime.newString("SHA-512")); }
| 3,230,932
|
public void setZoomFactor(double factor) { if(factor != -1) { if (factor > ZoomAction.MAX_ZOOM_FACTOR || factor < ZoomAction.MIN_ZOOM_FACTOR) throw new IllegalArgumentException("The zoom factor is value " + "between "+ZoomAction.MIN_ZOOM_FACTOR+" and "+ ZoomAction.MAX_ZOOM_FACTOR); } else { int width = model.getRenderedImage().getWidth(); int height = model.getRenderedImage().getHeight(); Dimension viewport = view.getCurrentViewport(); double zoomFactorX = viewport.getWidth()/width; double zoomFactorY = viewport.getHeight()/height; factor = Math.min(zoomFactorX, zoomFactorY); } model.setZoomFactor(factor); view.zoomImage(); }
|
public void setZoomFactor(double factor) { if (factor != -1) { if (factor > ZoomAction.MAX_ZOOM_FACTOR || factor < ZoomAction.MIN_ZOOM_FACTOR) throw new IllegalArgumentException("The zoom factor is value " + "between "+ZoomAction.MIN_ZOOM_FACTOR+" and "+ ZoomAction.MAX_ZOOM_FACTOR); } else { int width = model.getRenderedImage().getWidth(); int height = model.getRenderedImage().getHeight(); Dimension viewport = view.getCurrentViewport(); double zoomFactorX = viewport.getWidth()/width; double zoomFactorY = viewport.getHeight()/height; factor = Math.min(zoomFactorX, zoomFactorY); } model.setZoomFactor(factor); view.zoomImage(); }
| 3,230,933
|
public static IRubyObject nth_match(int n, IRubyObject match) { return match.isNil() ? match : ((RubyMatchData) match).group(n); }
|
public static IRubyObject nth_match(int n, IRubyObject match) { IRubyObject nil = match.getRuntime().getNil(); if (match.isNil()) { return nil; } RubyMatchData rmd = (RubyMatchData) match; if (n > rmd.getSize()) { return nil; } if (n < 0) { n += rmd.getSize(); if (n <= 0) { return nil; } } return rmd.group(n); }
| 3,230,934
|
public void copy(IObject model, ModelMapper mapper) { if (model instanceof Image) { Image i = (Image) model; super.copy(model,mapper); // Details if (i.getDetails() != null){ Details d = i.getDetails(); this.setCreated(mapper.event2timestamp(d.getCreationEvent())); this.setInserted(mapper.event2timestamp(d.getUpdateEvent()));//TODO this.setOwner((ExperimenterData) mapper.findTarget(d.getOwner())); if ( d.getCounts() != null ) { Object annotationCount = d.getCounts().get( Image.ANNOTATIONS ); if ( annotationCount instanceof Integer ) this.setAnnotationCount( (Integer) annotationCount ); Object classificationCount = d.getCounts().get( Image.CATEGORYLINKS ); if ( classificationCount instanceof Integer ) this.setClassificationCount( (Integer) classificationCount ); } } // Fields this.setName(i.getName()); this.setDescription(i.getDescription()); this.setDefaultPixels((PixelsData)mapper.findTarget(i.getDefaultPixels())); // Collections MapperBlock block = new MapperBlock( mapper ); setDatasets( new HashSet( i.eachLinkedDataset( block ))); setAllPixels( new HashSet( i.collectPixels( block ))); setAnnotations( new HashSet( i.collectAnnotations( block ))); } else { throw new IllegalArgumentException("ImageData copies only from Image"); } }
|
public void copy(IObject model, ModelMapper mapper) { if (model instanceof Image) { Image i = (Image) model; super.copy(model,mapper); // Details if (i.getDetails() != null){ Details d = i.getDetails(); this.setCreated(mapper.event2timestamp(d.getCreationEvent())); this.setInserted(mapper.event2timestamp(d.getUpdateEvent()));//TODO this.setOwner((ExperimenterData) mapper.findTarget(d.getOwner())); if ( d.getCounts() != null ) { Object annotationCount = d.getCounts().get( Image.ANNOTATIONS ); if ( annotationCount instanceof Integer ) this.setAnnotationCount( (Integer) annotationCount ); Object classificationCount = d.getCounts().get( Image.CATEGORYLINKS ); if ( classificationCount instanceof Integer ) this.setClassificationCount( (Integer) classificationCount ); } } // Fields this.setName(i.getName()); this.setDescription(i.getDescription()); this.setDefaultPixels((PixelsData)mapper.findTarget(i.getDefaultPixels())); // Collections MapperBlock block = new MapperBlock( mapper ); setDatasets( new HashSet( i.eachLinkedDataset( block ))); setAllPixels( new HashSet( i.collectPixels( block ))); setAnnotations( new HashSet( i.collectAnnotations( block ))); } else { throw new IllegalArgumentException("ImageData copies only from Image"); } }
| 3,230,936
|
public OMEData init() { // Test data : calculated before to not change times. if (!initialized) { super.init(); imgsPDI = getPercentOfCollection(allImgs, percent); imgsCGCI = getPercentOfCollection(allImgs, percent); imgsAnn1 = getPercentOfCollection(allImgs, percent); imgsAnn2 = getPercentOfCollection(allImgs, percent); dsAnn1 = getPercentOfCollection(allDss, percent); dsAnn2 = getPercentOfCollection(allDss, percent); } return this; }
|
public OMEData init() { // Test data : calculated before to not change times. if (!initialized) { super.init(); imgsPDI = getPercentOfCollection(allImgs, percent); imgsCGCI = getPercentOfCollection(allImgs, percent); imgsAnn1 = getPercentOfCollection(allImgs, percent); imgsAnn2 = getPercentOfCollection(allImgs, percent); dsAnn1 = getPercentOfCollection(allDss, percent); dsAnn2 = getPercentOfCollection(allDss, percent); } return this; }
| 3,230,937
|
public List childNodes() { return Collections.EMPTY_LIST; }
|
public List childNodes() { return EMPTY_LIST; }
| 3,230,938
|
public void copy(IObject model, ModelMapper mapper) { if (model instanceof Dataset) { Dataset d = (Dataset) model; super.copy(model,mapper); // Details if (d.getDetails() != null){ Details details = d.getDetails(); this.setOwner((ExperimenterData)mapper.findTarget( details.getOwner())); if ( details.getCounts() != null ) { Object annotationCount = details.getCounts().get( Dataset.ANNOTATIONS ); if ( annotationCount instanceof Integer ) this.setAnnotationCount( (Integer) annotationCount ); } } // Fields this.setName(d.getName()); this.setDescription(d.getDescription()); // Collections MapperBlock block = new MapperBlock( mapper ); setImages( new HashSet( d.collectFromImageLinks( block ))); setProjects( new HashSet( d.collectFromProjectLinks( block ))); setAnnotations( new HashSet( d.collectFromAnnotations( block ))); } else { throw new IllegalArgumentException( "DatasetData can only copy from Dataset"); } }
|
public void copy(IObject model, ModelMapper mapper) { if (model instanceof Dataset) { Dataset d = (Dataset) model; super.copy(model,mapper); // Details if (d.getDetails() != null){ Details details = d.getDetails(); this.setOwner((ExperimenterData)mapper.findTarget( details.getOwner())); if ( details.getCounts() != null ) { Object annotationCount = details.getCounts().get( Dataset.ANNOTATIONS ); if ( annotationCount instanceof Integer ) this.setAnnotationCount( (Integer) annotationCount ); } } // Fields this.setName(d.getName()); this.setDescription(d.getDescription()); // Collections MapperBlock block = new MapperBlock( mapper ); setImages( new HashSet( d.collectFromImageLinks( block ))); setProjects( new HashSet( d.collectFromProjectLinks( block ))); setAnnotations( new HashSet( d.collectFromAnnotations( block ))); } else { throw new IllegalArgumentException( "DatasetData can only copy from Dataset"); } }
| 3,230,939
|
private boolean ISUPPER(char c) { return Character.toUpperCase(c) == c; }
|
private boolean ISUPPER(char c) { return Character.isUpperCase(c); }
| 3,230,940
|
public void testFindImageAnnotationsSet() { System.out .println("HierarchyBrowsingTest.testFindImageAnnotationsSet()"); Set ids = new HashSet(); ids.add(new Integer(11)); ids.add(new Integer(13)); Map map = hb.findImageAnnotations(ids); assertTrue(nonNull, map != null && map.size() != 0); }
|
public void testFindImageAnnotationsSet() { System.out .println(" ***** HierarchyBrowsingTest.testFindImageAnnotationsSet()"); Set ids = new HashSet(); ids.add(new Integer(11)); ids.add(new Integer(13)); Map map = hb.findImageAnnotations(ids); assertTrue(nonNull, map != null && map.size() != 0); }
| 3,230,942
|
public void testFindImageAnnotationsSetint() { System.out.println(" ***** HierarchyBrowsingTest.testFindImageAnnotationsSetint()"); Set ids = new HashSet(); ids.add(new Integer(11)); ids.add(new Integer(13)); Map map = hb.findImageAnnotations(ids,5); assertTrue(nonNull, map != null && map.size() != 0); }
|
public void testFindImageAnnotationsSetint() { System.out.println(" ***** HierarchyBrowsingTest.testFindImageAnnotationsSetint()"); Set ids = new HashSet(); ids.add(new Integer(11)); ids.add(new Integer(13)); Map map = hb.findImageAnnotationsForExperimenter(ids,5); assertTrue(nonNull, map != null && map.size() != 0); }
| 3,230,943
|
public void testNulls(){ // Each method should return a null or an empty set as appropriate //TODO hb.findCGCIHierarchies( ); Set test = new HashSet(); test.add(new Integer(0)); // Non-existence set of ids int nonExp = 0; // Non-existence experimenter ID // assertTrue(emptyColl,hb.findDatasetAnnotations(test).size()==0); assertTrue(emptyColl,hb.findDatasetAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,hb.findDatasetAnnotations(test,nonExp).size()==0); assertTrue(emptyColl,hb.findDatasetAnnotations(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,hb.findImageAnnotations(test).size()==0); assertTrue(emptyColl,hb.findImageAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,hb.findImageAnnotations(test,nonExp).size()==0); assertTrue(emptyColl,hb.findImageAnnotations(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,hb.findPDIHierarchies(test).size()==0); assertTrue(emptyColl,hb.findPDIHierarchies(new HashSet()).size()==0); // assertNull(nullObj,hb.loadCGCIHierarchy(CategoryGroupData.class, 0)); assertNull(nullObj,hb.loadCGCIHierarchy(CategoryData.class, 0)); // assertNull(nullObj,hb.loadPDIHierarchy(ProjectData.class, 0)); assertNull(nullObj,hb.loadPDIHierarchy(DatasetData.class, 0)); }
|
public void testNulls(){ // Each method should return a null or an empty set as appropriate //TODO hb.findCGCIHierarchies( ); Set test = new HashSet(); test.add(new Integer(0)); // Non-existence set of ids int nonExp = 0; // Non-existence experimenter ID // assertTrue(emptyColl,hb.findDatasetAnnotations(test).size()==0); assertTrue(emptyColl,hb.findDatasetAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,hb.findDatasetAnnotations(test,nonExp).size()==0); assertTrue(emptyColl,hb.findDatasetAnnotations(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,hb.findImageAnnotations(test).size()==0); assertTrue(emptyColl,hb.findImageAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,hb.findImageAnnotations(test,nonExp).size()==0); assertTrue(emptyColl,hb.findImageAnnotations(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,hb.findPDIHierarchies(test).size()==0); assertTrue(emptyColl,hb.findPDIHierarchies(new HashSet()).size()==0); // assertNull(nullObj,hb.loadCGCIHierarchy(CategoryGroupData.class, 0)); assertNull(nullObj,hb.loadCGCIHierarchy(CategoryData.class, 0)); // assertNull(nullObj,hb.loadPDIHierarchy(ProjectData.class, 0)); assertNull(nullObj,hb.loadPDIHierarchy(DatasetData.class, 0)); }
| 3,230,944
|
public void testNulls(){ // Each method should return a null or an empty set as appropriate //TODO hb.findCGCIHierarchies( ); Set test = new HashSet(); test.add(new Integer(0)); // Non-existence set of ids int nonExp = 0; // Non-existence experimenter ID // assertTrue(emptyColl,hb.findDatasetAnnotations(test).size()==0); assertTrue(emptyColl,hb.findDatasetAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,hb.findDatasetAnnotations(test,nonExp).size()==0); assertTrue(emptyColl,hb.findDatasetAnnotations(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,hb.findImageAnnotations(test).size()==0); assertTrue(emptyColl,hb.findImageAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,hb.findImageAnnotations(test,nonExp).size()==0); assertTrue(emptyColl,hb.findImageAnnotations(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,hb.findPDIHierarchies(test).size()==0); assertTrue(emptyColl,hb.findPDIHierarchies(new HashSet()).size()==0); // assertNull(nullObj,hb.loadCGCIHierarchy(CategoryGroupData.class, 0)); assertNull(nullObj,hb.loadCGCIHierarchy(CategoryData.class, 0)); // assertNull(nullObj,hb.loadPDIHierarchy(ProjectData.class, 0)); assertNull(nullObj,hb.loadPDIHierarchy(DatasetData.class, 0)); }
|
public void testNulls(){ // Each method should return a null or an empty set as appropriate //TODO hb.findCGCIHierarchies( ); Set test = new HashSet(); test.add(new Integer(0)); // Non-existence set of ids int nonExp = 0; // Non-existence experimenter ID // assertTrue(emptyColl,hb.findDatasetAnnotations(test).size()==0); assertTrue(emptyColl,hb.findDatasetAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,hb.findDatasetAnnotations(test,nonExp).size()==0); assertTrue(emptyColl,hb.findDatasetAnnotations(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,hb.findImageAnnotations(test).size()==0); assertTrue(emptyColl,hb.findImageAnnotations(new HashSet()).size()==0); // assertTrue(emptyColl,hb.findImageAnnotations(test,nonExp).size()==0); assertTrue(emptyColl,hb.findImageAnnotations(new HashSet(),nonExp).size()==0); // assertTrue(emptyColl,hb.findPDIHierarchies(test).size()==0); assertTrue(emptyColl,hb.findPDIHierarchies(new HashSet()).size()==0); // assertNull(nullObj,hb.loadCGCIHierarchy(CategoryGroupData.class, 0)); assertNull(nullObj,hb.loadCGCIHierarchy(CategoryData.class, 0)); // assertNull(nullObj,hb.loadPDIHierarchy(ProjectData.class, 0)); assertNull(nullObj,hb.loadPDIHierarchy(DatasetData.class, 0)); }
| 3,230,945
|
public void setRefreshedHierarchy(Map set);
|
public void setRefreshedHierarchy(Map set);
| 3,230,946
|
public TestRubyHash(String name) { super(name); }
|
public TestRubyHash(String name) { super(name); }
| 3,230,948
|
public void setUp() { ruby = Ruby.getDefaultInstance(GNURegexpAdapter.class); eval("$h = {'foo' => 'bar'}"); }
|
public void setUp() { ruby = Ruby.getDefaultInstance(GNURegexpAdapter.class); eval("$h = {'foo' => 'bar'}"); }
| 3,230,949
|
public void tearDown() { super.tearDown(); }
|
public void tearDown() { super.tearDown(); }
| 3,230,950
|
public void testConstructors() { result = eval("hash = {'a', 100}; p hash"); assertEquals("{\"a\"=>100}", result); result = eval("hash = Hash['b', 200]; p hash"); assertEquals("{\"b\"=>200}", result); result = eval("hash = Hash.new(); p hash['test']"); assertEquals("nil", result); result = eval("hash = Hash.new('default'); p hash['test']"); assertEquals("\"default\"", result); }
|
public void testConstructors() { result = eval("hash = {'a', 100}; p hash"); assertEquals("{\"a\"=>100}", result); result = eval("hash = Hash['b', 200]; p hash"); assertEquals("{\"b\"=>200}", result); result = eval("hash = Hash.new(); p hash['test']"); assertEquals("nil", result); result = eval("hash = Hash.new('default'); p hash['test']"); assertEquals("\"default\"", result); }
| 3,230,951
|
public void testConversions() { result = eval("p $h.to_s"); assertEquals("\"foobar\"", result); result = eval("p $h.to_a"); assertEquals("[[\"foo\", \"bar\"]]", result); result = eval("p $h.to_hash"); assertEquals("{\"foo\"=>\"bar\"}", result); }
|
public void testConversions() { result = eval("p $h.to_s"); assertEquals("\"foobar\"", result); result = eval("p $h.to_a"); assertEquals("[[\"foo\", \"bar\"]]", result); result = eval("p $h.to_hash"); assertEquals("{\"foo\"=>\"bar\"}", result); }
| 3,230,952
|
public void testLookups() { // value equality result = eval("key = 'a'; hash = {key => 'one'}; hash.store('a', 'two'); puts hash[key]"); assertEquals("two", result); result = eval("key = [1,2]; hash = {key => 'one'}; hash[[1,2]] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = :a; hash = {key => 'one'}; hash[:a] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 1234; hash = {key => 'one'}; hash[1234] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 12.4; hash = {key => 'one'}; hash[12.4] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 19223372036854775807; hash = {key => 'one'}; hash[19223372036854775807] = 'two'; puts hash[key]"); assertEquals("two", result); // identity equality result = eval("key = /a/; hash = {key => 'one'}; hash[/a/] = 'two'; puts hash[key]"); assertEquals("one", result); result = eval("key = (1..3); hash = {key => 'one'}; hash[(1..3)] = 'two'; puts hash[key]"); assertEquals("one", result); }
|
public void testLookups() { // value equality result = eval("key = 'a'; hash = {key => 'one'}; hash.store('a', 'two'); puts hash[key]"); assertEquals("two", result); result = eval("key = [1,2]; hash = {key => 'one'}; hash[[1,2]] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = :a; hash = {key => 'one'}; hash[:a] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 1234; hash = {key => 'one'}; hash[1234] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 12.4; hash = {key => 'one'}; hash[12.4] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 19223372036854775807; hash = {key => 'one'}; hash[19223372036854775807] = 'two'; puts hash[key]"); assertEquals("two", result); // identity equality result = eval("key = /a/; hash = {key => 'one'}; hash[/a/] = 'two'; puts hash[key]"); assertEquals("one", result); result = eval("key = (1..3); hash = {key => 'one'}; hash[(1..3)] = 'two'; puts hash[key]"); assertEquals("one", result); }
| 3,230,953
|
public void testSizeRelated() { assertEquals("1", eval("p $h.size")); assertEquals("1", eval("p $h.length")); assertEquals("false", eval("p $h.empty?")); assertEquals("true", eval("p Hash.new().empty?")); }
|
public void testSizeRelated() { assertEquals("1", eval("p $h.size")); assertEquals("1", eval("p $h.length")); assertEquals("false", eval("p $h.empty?")); assertEquals("true", eval("p Hash.new().empty?")); }
| 3,230,954
|
public void testLookups() throws Exception { // value equality result = eval("key = 'a'; hash = {key => 'one'}; hash.store('a', 'two'); puts hash[key]"); assertEquals("two", result); result = eval("key = [1,2]; hash = {key => 'one'}; hash[[1,2]] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = :a; hash = {key => 'one'}; hash[:a] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 1234; hash = {key => 'one'}; hash[1234] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 12.4; hash = {key => 'one'}; hash[12.4] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 19223372036854775807; hash = {key => 'one'}; hash[19223372036854775807] = 'two'; puts hash[key]"); assertEquals("two", result); // identity equality result = eval("key = /a/; hash = {key => 'one'}; hash[/a/] = 'two'; puts hash[key]"); assertEquals("one", result); result = eval("key = (1..3); hash = {key => 'one'}; hash[(1..3)] = 'two'; puts hash[key]"); assertEquals("one", result); }
|
public void testLookups() throws Exception { // value equality result = eval("key = 'a'; hash = {key => 'one'}; hash.store('a', 'two'); puts hash[key]"); assertEquals("two", result); result = eval("key = [1,2]; hash = {key => 'one'}; hash[[1,2]] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = :a; hash = {key => 'one'}; hash[:a] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 1234; hash = {key => 'one'}; hash[1234] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 12.4; hash = {key => 'one'}; hash[12.4] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = 19223372036854775807; hash = {key => 'one'}; hash[19223372036854775807] = 'two'; puts hash[key]"); assertEquals("two", result); // identity equality result = eval("key = /a/; hash = {key => 'one'}; hash[/a/] = 'two'; puts hash[key]"); assertEquals("two", result); result = eval("key = (1..3); hash = {key => 'one'}; hash[(1..3)] = 'two'; puts hash[key]"); assertEquals("two", result); }
| 3,230,955
|
public RubyModule defineModuleUnder(String name, RubyModule parentModule) { RubyModule newModule = RubyModule.newModule(this, name, parentModule); getClasses().putClass(name, newModule); return newModule; }
|
public RubyModule defineModuleUnder(String name, RubyModule parentModule) { RubyModule newModule = RubyModule.newModule(this, name, parentModule); getClasses().putClass(name, newModule, parentModule); return newModule; }
| 3,230,956
|
private static void initializeRuntime(final Ruby runtime, String filename) { IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, commandline.scriptArguments)); runtime.setVerbose(runtime.newBoolean(commandline.verbose)); // $VERBOSE can be true, false, or nil. Any non-false-nil value will get stored as true runtime.getGlobalVariables().define("$VERBOSE", new IAccessor() { public IRubyObject getValue() { return runtime.getVerbose(); } public IRubyObject setValue(IRubyObject newValue) { if (newValue.isNil()) { runtime.setVerbose(newValue); } else { runtime.setVerbose(runtime.newBoolean(newValue != runtime.getFalse())); } return newValue; } }); runtime.getClasses().getObjectClass().setConstant("$VERBOSE", commandline.verbose ? runtime.getTrue() : runtime.getNil()); runtime.defineGlobalConstant("ARGV", argumentArray); // I guess ENV is not a hash, but should support a to_hash, though // it supposedly supports methods of a Hash? Also, I think that // RubyGlobal may need to create an empty ENV var in the case that // the runtime is not initialized by Main. Properties envs = new Properties(); runtime.defineGlobalConstant("ENV", RubyHash.newHash(runtime, envs, null)); defineGlobal(runtime, "$-p", commandline.assumePrinting); defineGlobal(runtime, "$-n", commandline.assumeLoop); defineGlobal(runtime, "$-a", commandline.sDoSplit); defineGlobal(runtime, "$-l", commandline.processLineEnds); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); runtime.defineVariable(new RubyGlobal.StringGlobalVariable(runtime, "$0", runtime.newString(filename))); runtime.getLoadService().init(runtime, commandline.loadPaths()); Iterator iter = commandline.requiredLibraries().iterator(); while (iter.hasNext()) { String scriptName = (String) iter.next(); RubyKernel.require(runtime.getTopSelf(), runtime.newString(scriptName)); } }
|
private static void initializeRuntime(final Ruby runtime, String filename) { IRubyObject argumentArray = runtime.newArray(JavaUtil.convertJavaArrayToRuby(runtime, commandline.scriptArguments)); runtime.setVerbose(runtime.newBoolean(commandline.verbose)); // $VERBOSE can be true, false, or nil. Any non-false-nil value will get stored as true runtime.getGlobalVariables().define("$VERBOSE", new IAccessor() { public IRubyObject getValue() { return runtime.getVerbose(); } public IRubyObject setValue(IRubyObject newValue) { if (newValue.isNil()) { runtime.setVerbose(newValue); } else { runtime.setVerbose(runtime.newBoolean(newValue != runtime.getFalse())); } return newValue; } }); runtime.getClasses().getObjectClass().setConstant("$VERBOSE", commandline.verbose ? runtime.getTrue() : runtime.getNil()); runtime.defineGlobalConstant("ARGV", argumentArray); // I guess ENV is not a hash, but should support a to_hash, though // it supposedly supports methods of a Hash? Also, I think that // RubyGlobal may need to create an empty ENV var in the case that // the runtime is not initialized by Main. Properties envs = new Properties(); runtime.defineGlobalConstant("ENV", RubyHash.newHash(runtime, envs, null)); defineGlobal(runtime, "$-p", commandline.assumePrinting); defineGlobal(runtime, "$-n", commandline.assumeLoop); defineGlobal(runtime, "$-a", commandline.sDoSplit); defineGlobal(runtime, "$-l", commandline.processLineEnds); runtime.getGlobalVariables().defineReadonly("$*", new ValueAccessor(argumentArray)); runtime.defineVariable(new RubyGlobal.StringGlobalVariable(runtime, "$0", runtime.newString(filename))); runtime.getLoadService().init(commandline.loadPaths()); Iterator iter = commandline.requiredLibraries().iterator(); while (iter.hasNext()) { String scriptName = (String) iter.next(); RubyKernel.require(runtime.getTopSelf(), runtime.newString(scriptName)); } }
| 3,230,957
|
public MetaClass getSingletonClass() { if (isNil()) { return getNilSingletonClass(); } RubyClass type = getMetaClass(); if (!type.isSingleton()) { type = makeMetaClass(getMetaClass()); } assert type instanceof MetaClass; type.setTaint(isTaint()); type.setFrozen(isFrozen()); return (MetaClass)type; }
|
public MetaClass getSingletonClass() { if (isNil()) { return getNilSingletonClass(); } RubyClass type = getMetaClass(); if (!type.isSingleton()) { type = makeMetaClass(getMetaClass()); } assert type instanceof MetaClass; type.setTaint(isTaint()); type.setFrozen(isFrozen()); return (MetaClass)type; }
| 3,230,958
|
public MetaClass getSingletonClass() { if (isNil()) { return getNilSingletonClass(); } RubyClass type = getMetaClass(); if (!type.isSingleton()) { type = makeMetaClass(getMetaClass()); } assert type instanceof MetaClass; type.setTaint(isTaint()); type.setFrozen(isFrozen()); return (MetaClass)type; }
|
public MetaClass getSingletonClass() { if (isNil()) { return getNilSingletonClass(); } RubyClass type = getMetaClass(); if (!type.isSingleton()) { type = makeMetaClass(type, getRuntime().getCurrentContext().getRubyClass()); } assert type instanceof MetaClass; type.setTaint(isTaint()); type.setFrozen(isFrozen()); return (MetaClass)type; }
| 3,230,959
|
public MetaClass getSingletonClass() { if (isNil()) { return getNilSingletonClass(); } RubyClass type = getMetaClass(); if (!type.isSingleton()) { type = makeMetaClass(getMetaClass()); } assert type instanceof MetaClass; type.setTaint(isTaint()); type.setFrozen(isFrozen()); return (MetaClass)type; }
|
public MetaClass getSingletonClass() { if (isNil()) { return getNilSingletonClass(); } RubyClass type = getMetaClass(); if (!type.isSingleton()) { type = makeMetaClass(getMetaClass()); } assert type instanceof MetaClass; type.setTaint(isTaint()); type.setFrozen(isFrozen()); return (MetaClass)type; }
| 3,230,960
|
public MetaClass makeMetaClass(RubyClass type) { MetaClass metaClass = type.newSingletonClass(); setMetaClass(metaClass); metaClass.attachToObject(this); return metaClass; }
|
public MetaClass makeMetaClass(RubyClass type) { MetaClass metaClass = type.newSingletonClass(); setMetaClass(metaClass); metaClass.attachToObject(this); return metaClass; }
| 3,230,961
|
public static Test suite() throws Throwable { TestSuite suite = new TestSuite(); suite.addTest(new TestSuite(TestRubyObject.class)); suite.addTest(new TestSuite(TestRubyNil.class)); suite.addTest(new TestSuite(TestRubyHash.class)); suite.addTest(new TestSuite(TestRubyTime.class)); suite.addTest(new TestSuite(TestRuby.class)); suite.addTest(new TestSuite(TestRequire.class)); suite.addTest(new TestSuite(TestJavaUtil.class)); suite.addTestSuite(TestJavaClass.class); suite.addTest(new TestSuite(TestKernel.class)); suite.addTest(new TestSuite(TestKernel.class)); suite.addTest(new TestSuite(TestRubyCollect.class)); suite.addTest(new TestSuite(TestObjectSpace.class)); suite.addTest(ScriptTestSuite.suite()); suite.addTest(new TestSuite(TestRubySymbol.class)); suite.addTest(JavaSupportTestSuite.suite()); suite.addTest(new TestSuite(TestIdentitySet.class)); suite.addTest(new TestSuite(TestCommandlineParser.class)); suite.addTest(new TestSuite(TestRubyException.class)); suite.addTest(new TestSuite(TestReflectionCallback.class)); suite.addTest(new TestSuite(TestRegexpTranslator.class)); //suite.addTest(new TestSuite(TestAdoptedThreading.class)); suite.addTest(new TestSuite(TestRubyArray.class)); return suite; }
|
public static Test suite() throws Throwable { TestSuite suite = new TestSuite(); suite.addTest(new TestSuite(TestRubyObject.class)); suite.addTest(new TestSuite(TestRubyNil.class)); suite.addTest(new TestSuite(TestRubyHash.class)); suite.addTest(new TestSuite(TestRuby.class)); suite.addTest(new TestSuite(TestRequire.class)); suite.addTest(new TestSuite(TestJavaUtil.class)); suite.addTestSuite(TestJavaClass.class); suite.addTest(new TestSuite(TestKernel.class)); suite.addTest(new TestSuite(TestKernel.class)); suite.addTest(new TestSuite(TestRubyCollect.class)); suite.addTest(new TestSuite(TestObjectSpace.class)); suite.addTest(ScriptTestSuite.suite()); suite.addTest(new TestSuite(TestRubySymbol.class)); suite.addTest(JavaSupportTestSuite.suite()); suite.addTest(new TestSuite(TestIdentitySet.class)); suite.addTest(new TestSuite(TestCommandlineParser.class)); suite.addTest(new TestSuite(TestRubyException.class)); suite.addTest(new TestSuite(TestReflectionCallback.class)); suite.addTest(new TestSuite(TestRegexpTranslator.class)); //suite.addTest(new TestSuite(TestAdoptedThreading.class)); suite.addTest(new TestSuite(TestRubyArray.class)); return suite; }
| 3,230,962
|
public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new TestSuite(TestRubyProxyFactory.class)); return suite; }
|
public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new TestSuite(TestBSF.class)); return suite; }
| 3,230,963
|
public ArticleListViewer() { super(); setBeanIdentifier(ARTICLE_LIST_BEAN); setResourcePath(DEFAULT_RESOURCE_PATH); }
|
public ArticleListViewer() { super(); setBeanIdentifier(ARTICLE_LIST_BEAN); setResourcePath(DEFAULT_RESOURCE_PATH); }
| 3,230,964
|
private Object[] extractConstructorArgs(Map propertyValues, Class[] constructorArgTypes) { Object[] parameters = new Object[constructorArgNames.length]; for (int i = 0; i < constructorArgNames.length; i++) { String name = constructorArgNames[i]; Class type = constructorArgTypes[i]; Object value; if (propertyValues.containsKey(name)) { value = propertyValues.remove(name); if (!isInstance(type, value) && !isConvertable(type, value)) { throw new ConstructionException("Invalid and non-convertable constructor parameter type: " + "name=" + name + ", " + "index=" + i + ", " + "expected=" + Classes.getClassName(type, true) + ", " + "actual=" + Classes.getClassName(value, true)); } value = convert(type, value); } else { value = getDefaultValue(type); } parameters[i] = value; } return parameters; }
|
private Object[] extractConstructorArgs(Map propertyValues, Class[] constructorArgTypes) { Object[] parameters = new Object[constructorArgNames.length]; for (int i = 0; i < constructorArgNames.length; i++) { Property name = new Property(constructorArgNames[i]); Class type = constructorArgTypes[i]; Object value; if (propertyValues.containsKey(name)) { value = propertyValues.remove(name); if (!isInstance(type, value) && !isConvertable(type, value)) { throw new ConstructionException("Invalid and non-convertable constructor parameter type: " + "name=" + name + ", " + "index=" + i + ", " + "expected=" + Classes.getClassName(type, true) + ", " + "actual=" + Classes.getClassName(value, true)); } value = convert(type, value); } else { value = getDefaultValue(type); } parameters[i] = value; } return parameters; }
| 3,230,965
|
public Object getProperty(String name) { if (name == null) throw new NullPointerException("name is null"); Object value = properties.get(name); return value; }
|
public Object getProperty(String name) { if (name == null) throw new NullPointerException("name is null"); Object value = properties.get(name); return value; }
| 3,230,966
|
public static RubyFloat str2fnum(IRuby runtime, RubyString arg) { String str = arg.toString().trim(); double d = 0.0; int pos = str.length(); for (int i = 0; i < pos; i++) { if ("0123456789eE+-.".indexOf(str.charAt(i)) == -1) { pos = i + 1; break; } } for (; pos > 0; pos--) { try { d = Double.parseDouble(str.substring(0, pos)); } catch (NumberFormatException ex) { continue; } break; } return new RubyFloat(runtime, d); }
|
public static RubyFloat str2fnum(IRuby runtime, RubyString arg) { String str = arg.toString().trim(); double d = 0.0; int pos = str.length(); for (int i = 0; i < pos; i++) { if ("0123456789eE+-.".indexOf(str.charAt(i)) == -1) { pos = i + 1; break; } } for (; pos > 0; pos--) { try { d = Double.parseDouble(str.substring(0, pos)); } catch (NumberFormatException ex) { continue; } break; } return new RubyFloat(runtime, d); }
| 3,230,967
|
public static RubyInteger str2inum(IRuby runtime, RubyString str, int base) { StringBuffer sbuf = new StringBuffer(str.toString().trim()); if (sbuf.length() == 0) { return RubyFixnum.zero(runtime); } int pos = 0; int radix = (base != 0) ? base : 10; boolean digitsFound = false; if (sbuf.charAt(pos) == '-') { pos++; } else if (sbuf.charAt(pos) == '+') { sbuf.deleteCharAt(pos); } if (pos == sbuf.length()) { return RubyFixnum.zero(runtime); } if (sbuf.charAt(pos) == '0') { sbuf.deleteCharAt(pos); if (pos == sbuf.length()) { return RubyFixnum.zero(runtime); } if (sbuf.charAt(pos) == 'x' || sbuf.charAt(pos) == 'X') { if (base == 0 || base == 16) { radix = 16; sbuf.deleteCharAt(pos); } } else if (sbuf.charAt(pos) == 'b' || sbuf.charAt(pos) == 'B') { if (base == 0 || base == 2) { radix = 2; sbuf.deleteCharAt(pos); } } else { radix = (base == 0) ? 8 : base; } } while (pos < sbuf.length()) { if (sbuf.charAt(pos) == '_') { sbuf.deleteCharAt(pos); } else if (Character.digit(sbuf.charAt(pos), radix) != -1) { digitsFound = true; pos++; } else { break; } } if (!digitsFound) { return RubyFixnum.zero(runtime); } try { long l = Long.parseLong(sbuf.substring(0, pos), radix); return runtime.newFixnum(l); } catch (NumberFormatException ex) { BigInteger bi = new BigInteger(sbuf.substring(0, pos), radix); return new RubyBignum(runtime, bi); } }
|
public static RubyInteger str2inum(IRuby runtime, RubyString str, int base) { StringBuffer sbuf = new StringBuffer(str.toString().trim()); if (sbuf.length() == 0) { return RubyFixnum.zero(runtime); } int pos = 0; int radix = (base != 0) ? base : 10; boolean digitsFound = false; if (sbuf.charAt(pos) == '-') { pos++; } else if (sbuf.charAt(pos) == '+') { sbuf.deleteCharAt(pos); } if (pos == sbuf.length()) { return RubyFixnum.zero(runtime); } if (sbuf.charAt(pos) == '0') { sbuf.deleteCharAt(pos); if (pos == sbuf.length()) { return RubyFixnum.zero(runtime); } if (sbuf.charAt(pos) == 'x' || sbuf.charAt(pos) == 'X') { if (base == 0 || base == 16) { radix = 16; sbuf.deleteCharAt(pos); } } else if (sbuf.charAt(pos) == 'b' || sbuf.charAt(pos) == 'B') { if (base == 0 || base == 2) { radix = 2; sbuf.deleteCharAt(pos); } } else { radix = (base == 0) ? 8 : base; } } while (pos < sbuf.length()) { if (sbuf.charAt(pos) == '_') { sbuf.deleteCharAt(pos); } else if (Character.digit(sbuf.charAt(pos), radix) != -1) { digitsFound = true; pos++; } else { break; } } if (!digitsFound) { return RubyFixnum.zero(runtime); } try { long l = Long.parseLong(sbuf.substring(0, pos), radix); return runtime.newFixnum(l); } catch (NumberFormatException ex) { BigInteger bi = new BigInteger(sbuf.substring(0, pos), radix); return new RubyBignum(runtime, bi); } }
| 3,230,968
|
public static RubyBoolean op_ge(Ruby ruby, RubyObject recv, RubyObject other) { RubyFixnum fn = (RubyFixnum) recv.funcall("<=>", other); return RubyBoolean.newBoolean(ruby, fn.getValue() >= 0); }
|
public static RubyBoolean op_ge(Ruby ruby, RubyObject recv, RubyObject other) { RubyFixnum fn = (RubyFixnum) recv.funcall("<=>", other); return RubyBoolean.newBoolean(ruby, fn.getValue() >= 0); }
| 3,230,969
|
public static RubyBoolean op_gt(Ruby ruby, RubyObject recv, RubyObject other) { RubyFixnum fn = (RubyFixnum) recv.funcall("<=>", other); return RubyBoolean.newBoolean(ruby, fn.getValue() > 0); }
|
public static RubyBoolean op_gt(Ruby ruby, RubyObject recv, RubyObject other) { RubyFixnum fn = (RubyFixnum) recv.funcall("<=>", other); return RubyBoolean.newBoolean(ruby, fn.getValue() > 0); }
| 3,230,970
|
public static RubyBoolean op_le(Ruby ruby, RubyObject recv, RubyObject other) { RubyFixnum fn = (RubyFixnum) recv.funcall("<=>", other); return RubyBoolean.newBoolean(ruby, fn.getValue() <= 0); }
|
public static RubyBoolean op_le(Ruby ruby, RubyObject recv, RubyObject other) { RubyFixnum fn = (RubyFixnum) recv.funcall("<=>", other); return RubyBoolean.newBoolean(ruby, fn.getValue() <= 0); }
| 3,230,971
|
public static RubyBoolean op_lt(Ruby ruby, RubyObject recv, RubyObject other) { RubyFixnum fn = (RubyFixnum) recv.funcall("<=>", other); return RubyBoolean.newBoolean(ruby, fn.getValue() < 0); }
|
public static RubyBoolean op_lt(Ruby ruby, RubyObject recv, RubyObject other) { RubyFixnum fn = (RubyFixnum) recv.funcall("<=>", other); return RubyBoolean.newBoolean(ruby, fn.getValue() < 0); }
| 3,230,972
|
private Class returnedObjectType(Object javaResult, Method returningMethod) { Class narrowestClass = javaResult.getClass(); Class widestClass = returningMethod.getReturnType(); if (narrowestClass.isPrimitive()) { return narrowestClass; } if (widestClass.isPrimitive()) { return widestClass; } Asserts.assertExpression(widestClass.isAssignableFrom(narrowestClass)); if (Modifier.isPublic(narrowestClass.getModifiers())) { return narrowestClass; } if (widestClass.isInterface()) { return widestClass; } // If there is any interface on the narrowest that isn't on the widest, // then we should use that. The theory is that this should minimize information // loss. (This theory is open to discussion ;-) Iterator narrowestClassInterfaces = Arrays.asList(narrowestClass.getInterfaces()).iterator(); List widestClassInterfaces = Arrays.asList(widestClass.getInterfaces()); while (narrowestClassInterfaces.hasNext()) { Class iface = (Class) narrowestClassInterfaces.next(); if (! widestClassInterfaces.contains(iface)) { return iface; } } while (true) { narrowestClass = narrowestClass.getSuperclass(); Asserts.assertExpression(narrowestClass != null); if (Modifier.isPublic(narrowestClass.getModifiers())) { return narrowestClass; } } }
|
private Class returnedObjectType(Object javaResult, Method returningMethod) { Class narrowestClass = javaResult.getClass(); if (narrowestClass.isPrimitive()) { return narrowestClass; } if (widestClass.isPrimitive()) { return widestClass; } Asserts.assertExpression(widestClass.isAssignableFrom(narrowestClass)); if (Modifier.isPublic(narrowestClass.getModifiers())) { return narrowestClass; } if (widestClass.isInterface()) { return widestClass; } // If there is any interface on the narrowest that isn't on the widest, // then we should use that. The theory is that this should minimize information // loss. (This theory is open to discussion ;-) Iterator narrowestClassInterfaces = Arrays.asList(narrowestClass.getInterfaces()).iterator(); List widestClassInterfaces = Arrays.asList(widestClass.getInterfaces()); while (narrowestClassInterfaces.hasNext()) { Class iface = (Class) narrowestClassInterfaces.next(); if (! widestClassInterfaces.contains(iface)) { return iface; } } while (true) { narrowestClass = narrowestClass.getSuperclass(); Asserts.assertExpression(narrowestClass != null); if (Modifier.isPublic(narrowestClass.getModifiers())) { return narrowestClass; } } }
| 3,230,973
|
public static boolean isCompatible(IRubyObject arg, Class javaClass) { if (arg.isNil()) { return true; } if (javaClass.isInstance(arg)) { // arg is already of the required jruby class (or subclass) return true; } if (javaClass == Object.class || javaClass == null) { return true; } else if (javaClass.isPrimitive()) { String cName = javaClass.getName(); if (cName == "boolean") { return true; } return arg instanceof RubyNumeric || arg instanceof RubyString; } else if (javaClass.isArray()) { if (!(arg instanceof RubyArray)) { return false; } Class arrayClass = javaClass.getComponentType(); for (int i = 0; i < ((RubyArray) arg).getLength(); i++) { if (!isCompatible(((RubyArray) arg).entry(i), arrayClass)) { return false; } } return true; } else if (List.class.isAssignableFrom(javaClass)) { return arg instanceof RubyArray; } else if (Map.class.isAssignableFrom(javaClass)) { return arg instanceof RubyHash; } else { return javaClass.isAssignableFrom(arg.getJavaClass()); } }
|
public static boolean isCompatible(IRubyObject arg, Class javaClass) { if (arg.isNil()) { return true; } if (javaClass.isInstance(arg)) { // arg is already of the required jruby class (or subclass) return true; } if (javaClass == Object.class || javaClass == null) { return true; } else if (javaClass.isPrimitive()) { String cName = javaClass.getName(); if (cName == "boolean") { return true; } return arg instanceof RubyNumeric || arg instanceof RubyString; } else if (javaClass.isArray()) { if (!(arg instanceof RubyArray)) { return false; } Class arrayClass = javaClass.getComponentType(); for (int i = 0; i < ((RubyArray) arg).getLength(); i++) { if (!isCompatible(((RubyArray) arg).entry(i), arrayClass)) { return false; } } return true; } else if (List.class.isAssignableFrom(javaClass)) { return arg instanceof RubyArray; } else if (Map.class.isAssignableFrom(javaClass)) { return arg instanceof RubyHash; } else { return javaClass.isAssignableFrom(arg.getJavaClass()); } }
| 3,230,974
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.