/** * Creates an affine transform from a matrix. If the transform's input dimension is {@code M}, * and output dimension is {@code N}, then the matrix will have size {@code [N+1][M+1]}. The +1 * in the matrix dimensions allows the matrix to do a shift, as well as a rotation. The {@code * [M][j]} element of the matrix will be the j'th ordinate of the moved origin. The {@code * [i][N]} element of the matrix will be 0 for <var>i</var> less than {@code M}, and 1 for * <var>i</var> equals {@code M}. * * @param matrix The matrix used to define the affine transform. * @return The affine transform. * @throws FactoryException if the object creation failed. */ public MathTransform createAffineTransform(final Matrix matrix) throws FactoryException { lastMethod.remove(); // To be strict, we should set ProjectiveTransform.Provider return pool.unique(ProjectiveTransform.create(matrix)); }
/** * Returns an object equals to the specified object, if present. If this set doesn't contains * any object equals to {@code object}, then this method returns {@code null}. * * @param <T> The type of the element to get. * @param object The element to get. * @return An element equals to the given one if already presents in the set, or {@code null} * otherwise. * @see #unique(Object) */ public synchronized <T extends E> T get(final T object) { return intern(object, GET); }
/** * Constructs a {@code CanonicalSet} for elements of the specified type. * * @param <E> The type of elements in the set. * @param type The type of elements in the set. * @return An initially empty set for elements of the given type. * @since 2.5 */ public static <E> CanonicalSet<E> newInstance(final Class<E> type) { return new CanonicalSet<E>(type); }
CanonicalSet.newInstance(CoordinateOperation.class); operation = pool.unique(operation); return operation;
/** * Releases resources immediately instead of waiting for the garbage collector. This method do * <strong>not</strong> dispose the resources of wrapped factories (e.g. {@link #crsFactory * crsFactory}), because they may still in use by other classes. */ public synchronized void dispose() throws FactoryException { pool.clear(); super.dispose(); } }
/** * Creates a concatenated operation from a sequence of operations. * * @param properties Set of properties. Should contains at least {@code "name"}. * @param operations The sequence of operations. * @return The concatenated operation. * @throws FactoryException if the object creation failed. */ public CoordinateOperation createConcatenatedOperation( final Map<String, ?> properties, final CoordinateOperation[] operations) throws FactoryException { CoordinateOperation operation; operation = new DefaultConcatenatedOperation(properties, operations, mtFactory); operation = pool.unique(operation); return operation; }
/** * Iteratively call {@link #unique(Object)} for an array of objects. This method is equivalents * to the following code: * * <blockquote> * * <pre> * for (int i=0; i<objects.length; i++) { * objects[i] = unique(objects[i]); * } * </pre> * * </blockquote> * * @param objects On input, the objects to add to this set if not already present. On output, * elements that are {@linkplain Object#equals equal}, but where every reference to an * instance already presents in this set has been replaced by a reference to the existing * instance. */ public synchronized void uniques(final E[] objects) { for (int i = 0; i < objects.length; i++) { objects[i] = intern(objects[i], INTERN); } } }
/** * Constructs a {@code CanonicalSet} for elements of the specified type. * * @param <E> The type of elements in the set. * @param type The type of elements in the set. * @return An initially empty set for elements of the given type. * * @since 2.5 */ public static <E> CanonicalSet<E> newInstance(final Class<E> type) { return new CanonicalSet<E>(type); }
/** * Constructs a defining conversion from a set of properties. * * @param properties Set of properties. Should contains at least {@code "name"}. * @param method The operation method. * @param parameters The parameter values. * @return The defining conversion. * @throws FactoryException if the object creation failed. * @see DefiningConversion * @since 2.5 */ public Conversion createDefiningConversion( final Map<String, ?> properties, final OperationMethod method, final ParameterValueGroup parameters) throws FactoryException { Conversion conversion = new DefiningConversion(properties, method, parameters); conversion = pool.unique(conversion); return conversion; }
/** * Returns an object equals to {@code object} if such an object already exist in this {@code * CanonicalSet}. Otherwise, adds {@code object} to this {@code CanonicalSet}. This method is * equivalents to the following code: * * <blockquote> * * <pre> * if (object != null) { * Object current = get(object); * if (current != null) { * return current; * } else { * add(object); * } * } * return object; * </pre> * * </blockquote> * * @param <T> The type of the element to get. * @param object The element to get or to add in the set if not already presents. * @return An element equals to the given one if already presents in the set, or the given * {@code object} otherwise. */ public synchronized <T extends E> T unique(final T object) { return intern(object, INTERN); }
/** * Creates an engineering datum. * * @param properties Name and other properties to give to the new object. * @throws FactoryException if the object creation failed. */ public EngineeringDatum createEngineeringDatum(Map<String, ?> properties) throws FactoryException { EngineeringDatum datum; try { datum = new DefaultEngineeringDatum(properties); } catch (IllegalArgumentException exception) { throw new FactoryException(exception); } datum = pool.unique(datum); return datum; }
/** * Returns an object equals to the specified object, if present. If * this set doesn't contains any object equals to {@code object}, * then this method returns {@code null}. * * @see #unique(Object) */ public synchronized Object get(final Object object) { return intern(object, GET); }
/** * Creates a linear coordinate system. * * @param properties Name and other properties to give to the new object. * @param axis The axis. * @throws FactoryException if the object creation failed. */ public LinearCS createLinearCS(Map<String, ?> properties, CoordinateSystemAxis axis) throws FactoryException { LinearCS cs; try { cs = new DefaultLinearCS(properties, axis); } catch (IllegalArgumentException exception) { throw new FactoryException(exception); } cs = pool.unique(cs); return cs; }
/** * Returns an object equals to the specified object, if present. If * this set doesn't contains any object equals to {@code object}, * then this method returns {@code null}. * * @param <T> The type of the element to get. * @param object The element to get. * @return An element equals to the given one if already presents in the set, * or {@code null} otherwise. * * @see #unique(Object) */ public synchronized <T extends E> T get(final T object) { return intern(object, GET); }
/** * Creates a temporal coordinate system. * * @param properties Name and other properties to give to the new object. * @param axis The axis. * @throws FactoryException if the object creation failed. */ public TimeCS createTimeCS(Map<String, ?> properties, CoordinateSystemAxis axis) throws FactoryException { TimeCS cs; try { cs = new DefaultTimeCS(properties, axis); } catch (IllegalArgumentException exception) { throw new FactoryException(exception); } cs = pool.unique(cs); return cs; }