/** * Tests this object for equality with an arbitrary object. * * @param obj the object to test against (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof StandardEntityCollection) { StandardEntityCollection that = (StandardEntityCollection) obj; return ObjectUtilities.equal(this.entities, that.entities); } return false; }
/** * Returns a clone of the specified shape, or <code>null</code>. At the * current time, this method supports cloning for instances of * <code>Line2D</code>, <code>RectangularShape</code>, <code>Area</code> * and <code>GeneralPath</code>. * <p> * <code>RectangularShape</code> includes <code>Arc2D</code>, * <code>Ellipse2D</code>, <code>Rectangle2D</code>, * <code>RoundRectangle2D</code>. * * @param shape the shape to clone (<code>null</code> permitted, * returns <code>null</code>). * * @return A clone or <code>null</code>. */ public static Shape clone(final Shape shape) { if (shape instanceof Cloneable) { try { return (Shape) ObjectUtilities.clone(shape); } catch (CloneNotSupportedException cnse) { } } final Shape result = null; return result; }
/** * Returns the resource specified by the <strong>relative</strong> name. * * @param name the name of the resource relative to the given class * @param c the source class * @return the url of the resource or null, if not found. */ public static URL getResourceRelative(final String name, final Class c) { final ClassLoader cl = getClassLoader(c); final String cname = convertName(name, c); if (cl == null) { return null; } return cl.getResource(cname); }
/** * Returns the resource specified by the <strong>absolute</strong> name. * * @param name the name of the resource * @param c the source class * @return the url of the resource or null, if not found. */ public static URL getResource(final String name, final Class c) { final ClassLoader cl = getClassLoader(c); if (cl == null) { return null; } return cl.getResource(name); }
public static boolean isJDK14() { final ClassLoader loader = getClassLoader(ObjectUtilities.class); if (loader != null) { try { String[] versions = parseVersions(version); String[] target = new String[]{ "1", "4" }; return (ArrayUtilities.compareVersionArrays(versions, target) >= 0);
public static void main(String[] args) System.out.println ("Defined classloader source: " + ObjectUtilities.getClassLoaderSource()); System.out.println ("User classloader: " + ObjectUtilities.getClassLoader()); System.out.println ("Classloader for ObjectUtilities.class: " + ObjectUtilities.getClassLoader(ObjectUtilities.class)); System.out.println ("Classloader for String.class: " + ObjectUtilities.getClassLoader(String.class)); System.out.println ("Thread-Context Classloader: " + Thread.currentThread().getContextClassLoader()); System.out.println ("Defined System classloader: " + ClassLoader.getSystemClassLoader()); Enumeration resources = ObjectUtilities.getClassLoader (ObjectUtilities.class).getResources("jcommon.properties"); while (resources.hasMoreElements()) resources = ObjectUtilities.getClassLoader (ObjectUtilities.class).getResources("org/jfree/JCommonInfo.class"); while (resources.hasMoreElements())
/** * Loads the default module description from the file "module.properties". This file * must be in the same package as the implementing class. * * @throws ModuleInitializeException if an error occurs. */ protected void loadModuleInfo() throws ModuleInitializeException { final InputStream in = ObjectUtilities.getResourceRelativeAsStream ("module.properties", getClass()); if (in == null) { throw new ModuleInitializeException ("File 'module.properties' not found in module package."); } loadModuleInfo(in); }
/** * Returns the inputstream for the resource specified by the * <strong>absolute</strong> name. * * @param name the name of the resource * @param context the source class * @return the url of the resource or null, if not found. */ public static InputStream getResourceAsStream(final String name, final Class context) { final URL url = getResource(name, context); if (url == null) { return null; } try { return url.openStream(); } catch (IOException e) { return null; } }
ObjectUtilities.clone(this.legendItemLabelGenerator); ObjectUtilities.clone(this.legendItemToolTipGenerator); ObjectUtilities.clone(this.legendItemURLGenerator); clone.foregroundAnnotations = (List) ObjectUtilities.deepClone( this.foregroundAnnotations); clone.backgroundAnnotations = (List) ObjectUtilities.deepClone( this.backgroundAnnotations); ObjectUtilities.clone(this.legendItemLabelGenerator); ObjectUtilities.clone(this.legendItemToolTipGenerator); ObjectUtilities.clone(this.legendItemURLGenerator);
protected void performExternalInitialize(final String classname, final Class context) throws ModuleInitializeException { try { final ModuleInitializer mi = (ModuleInitializer) ObjectUtilities.loadAndInstantiate(classname, context, ModuleInitializer.class); if (mi == null) { throw new ModuleInitializeException("Failed to load specified initializer class."); } mi.performInit(); } catch (ModuleInitializeException mie) { throw mie; } catch (Exception e) { throw new ModuleInitializeException("Failed to load specified initializer class.", e); } }
/** * Returns the inputstream for the resource specified by the * <strong>relative</strong> name. * * @param name the name of the resource relative to the given class * @param context the source class * @return the url of the resource or null, if not found. */ public static InputStream getResourceRelativeAsStream (final String name, final Class context) { final URL url = getResourceRelative(name, context); if (url == null) { return null; } try { return url.openStream(); } catch (IOException e) { return null; } }
/** * Returns the resource specified by the <strong>absolute</strong> name. * * @param name the name of the resource * @param c the source class * @return the url of the resource or null, if not found. */ public static URL getResource(final String name, final Class c) { final ClassLoader cl = getClassLoader(c); if (cl == null) { return null; } return cl.getResource(name); }
final ClassLoader loader = getClassLoader(ObjectUtilities.class); if (loader != null) { try { String[] versions = parseVersions(version); String[] target = new String[]{ "1", "4" }; return (ArrayUtilities.compareVersionArrays(versions, target) >= 0);
System.out.println ("Defined classloader source: " + ObjectUtilities.getClassLoaderSource()); System.out.println ("User classloader: " + ObjectUtilities.getClassLoader()); System.out.println ("Classloader for ObjectUtilities.class: " + ObjectUtilities.getClassLoader(ObjectUtilities.class)); System.out.println ("Classloader for String.class: " + ObjectUtilities.getClassLoader(String.class)); System.out.println ("Thread-Context Classloader: " + Thread.currentThread().getContextClassLoader()); System.out.println ("Defined System classloader: " + ClassLoader.getSystemClassLoader()); Enumeration resources = ObjectUtilities.getClassLoader (ObjectUtilities.class).getResources("jcommon.properties"); while (resources.hasMoreElements()) resources = ObjectUtilities.getClassLoader (ObjectUtilities.class).getResources("org/jfree/JCommonInfo.class"); while (resources.hasMoreElements())
/** * Loads the default module description from the file "module.properties". This file * must be in the same package as the implementing class. * * @throws ModuleInitializeException if an error occurs. */ protected void loadModuleInfo() throws ModuleInitializeException { final InputStream in = ObjectUtilities.getResourceRelativeAsStream ("module.properties", getClass()); if (in == null) { throw new ModuleInitializeException ("File 'module.properties' not found in module package."); } loadModuleInfo(in); }
/** * Returns the inputstream for the resource specified by the * <strong>absolute</strong> name. * * @param name the name of the resource * @param context the source class * @return the url of the resource or null, if not found. */ public static InputStream getResourceAsStream(final String name, final Class context) { final URL url = getResource(name, context); if (url == null) { return null; } try { return url.openStream(); } catch (IOException e) { return null; } }
clone.domainAxes = (ObjectList) ObjectUtilities.clone(this.domainAxes); for (int i = 0; i < this.domainAxes.size(); i++) { ValueAxis axis = (ValueAxis) this.domainAxes.get(i); clone.rangeAxes = (ObjectList) ObjectUtilities.clone(this.rangeAxes); for (int i = 0; i < this.rangeAxes.size(); i++) { ValueAxis axis = (ValueAxis) this.rangeAxes.get(i); clone.rangeAxisLocations = (ObjectList) ObjectUtilities.clone( this.rangeAxisLocations); clone.datasets = (ObjectList) ObjectUtilities.clone(this.datasets); for (int i = 0; i < clone.datasets.size(); ++i) { XYDataset d = getDataset(i); clone.renderers = (ObjectList) ObjectUtilities.clone(this.renderers); for (int i = 0; i < this.renderers.size(); i++) { XYItemRenderer renderer2 = (XYItemRenderer) this.renderers.get(i); clone.foregroundDomainMarkers = (Map) ObjectUtilities.clone( this.foregroundDomainMarkers); clone.backgroundDomainMarkers = (Map) ObjectUtilities.clone( this.backgroundDomainMarkers); clone.foregroundRangeMarkers = (Map) ObjectUtilities.clone( this.foregroundRangeMarkers); clone.backgroundRangeMarkers = (Map) ObjectUtilities.clone( this.backgroundRangeMarkers); clone.annotations = (List) ObjectUtilities.deepClone(this.annotations); if (this.fixedDomainAxisSpace != null) {
/** * ???. * * @param classname ? * @param context ? * @throws ModuleInitializeException if there is an initialisation error. */ protected void performExternalInitialize(final String classname, final Class context) throws ModuleInitializeException { try { final ModuleInitializer mi = (ModuleInitializer) ObjectUtilities.loadAndInstantiate(classname, context, ModuleInitializer.class); if (mi == null) { throw new ModuleInitializeException("Failed to load specified initializer class."); } mi.performInit(); } catch (ModuleInitializeException mie) { throw mie; } catch (Exception e) { throw new ModuleInitializeException("Failed to load specified initializer class.", e); } }
/** * Returns the inputstream for the resource specified by the * <strong>relative</strong> name. * * @param name the name of the resource relative to the given class * @param context the source class * @return the url of the resource or null, if not found. */ public static InputStream getResourceRelativeAsStream (final String name, final Class context) { final URL url = getResourceRelative(name, context); if (url == null) { return null; } try { return url.openStream(); } catch (IOException e) { return null; } }
/** * Tests this instance for equality with an arbitrary object. * * @param obj the object (<code>null</code> permitted). * * @return A boolean. */ public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XIntervalSeriesCollection)) { return false; } XIntervalSeriesCollection that = (XIntervalSeriesCollection) obj; return ObjectUtilities.equal(this.data, that.data); }