public static void main(String[] args) throws Exception { TermifiableTest tt = PJ.newInstance(TermifiableTest.class); Counter c1 = new Counter(1); Counter c2 = new Counter(2); Counter c3 = new Counter(3); java.util.Collection<Counter> l = java.util.Arrays.<Counter>asList(new Counter[] {c1, c2, c3}); for (List<JavaTerm<Counter>> p : tt.permutations(Term.<List<JavaTerm<Counter>>>fromJava(List.fromJava(l)))) { System.out.println(p.toJava()); } System.out.println(tt.inc(new JavaTerm(c1))); }
/** * Creates a new {@code PJ} structure derived from an existing {@code PJ} object. This constructor * is usually for getting the {@linkplain org.opengis.referencing.crs.ProjectedCRS#getBaseCRS() * base geographic CRS} from a {@linkplain org.opengis.referencing.crs.ProjectedCRS projected * CRS}. * * @param crs The CRS (usually projected) from which to derive a new CRS. * @param type The type of the new CRS. Currently, only {@link Type#GEOGRAPHIC} is supported. * @throws IllegalArgumentException If the PJ structure can not be created. */ public PJ(final PJ crs, final Type type) throws IllegalArgumentException { if (crs == null) { // TODO: Use Objects with JDK 7. throw new NullPointerException("The CRS must be non-null."); } if (type != Type.GEOGRAPHIC) { throw new IllegalArgumentException("Can not derive the " + type + " type."); } ptr = allocateGeoPJ(crs); if (ptr == 0) { throw new IllegalArgumentException(crs.getLastError()); } }