@Test public void AtoCwithTwoHops() { registry.addTransformer(fromAtoB); registry.addTransformer(fromBtoC); registry.addTransformer(fromBtoE); LinkedList<QName> list = new LinkedList<QName>(); boolean resolved = resolver.resolvePath(list, A, C, 2); Assert.assertTrue(resolved); Assert.assertEquals(B, list.pop()); Assert.assertEquals(C, list.pop()); }
@SuppressWarnings("rawtypes") boolean resolvePath(LinkedList<QName> path, QName fromType, QName toType, int limit) { if (limit < 0) { return false; } --limit; if (fromType.equals(toType)) { return true; } for (Transformer fromT : _registry.getTransformersFrom(fromType)) { if (resolvePath(path, fromT.getTo(), toType, limit)) { path.addFirst(fromT.getTo()); return true; } } return false; }
BaseTransformResolver implements TransformResolver { @SuppressWarnings("rawtypes") boolean resolvePath(LinkedList<QName> path, QName fromType, QName toType, int limit) { if (limit < 0) { return false; } --limit; if (fromType.equals(toType)) { return true; } for (Transformer fromT : _registry.getTransformersFrom(fromType)) { if (resolvePath(path, fromT.getTo(), toType, limit)) { path.addFirst(fromT.getTo()); return true; } } return false; } }
BaseTransformResolver implements TransformResolver { @SuppressWarnings("rawtypes") boolean resolvePath(LinkedList<QName> path, QName fromType, QName toType, int limit) { if (limit < 0) { return false; } --limit; if (fromType.equals(toType)) { return true; } for (Transformer fromT : _registry.getTransformersFrom(fromType)) { if (resolvePath(path, fromT.getTo(), toType, limit)) { path.addFirst(fromT.getTo()); return true; } } return false; } BaseTransformResolver();  BaseTransformResolver(int numHops);  BaseTransformResolver(TransformerRegistry registry);  BaseTransformResolver(TransformerRegistry registry, int numHops); }
BaseTransformResolver implements TransformResolver { @SuppressWarnings("rawtypes") boolean resolvePath(LinkedList<QName> path, QName fromType, QName toType, int limit) { if (limit < 0) { return false; } --limit; if (fromType.equals(toType)) { return true; } for (Transformer fromT : _registry.getTransformersFrom(fromType)) { if (resolvePath(path, fromT.getTo(), toType, limit)) { path.addFirst(fromT.getTo()); return true; } } return false; } BaseTransformResolver();  BaseTransformResolver(int numHops);  BaseTransformResolver(TransformerRegistry registry);  BaseTransformResolver(TransformerRegistry registry, int numHops); @Override TransformSequence resolveSequence(QName from, QName to); TransformerRegistry getRegistry(); void setRegistry(TransformerRegistry registry); }
BaseTransformResolver implements TransformResolver { @SuppressWarnings("rawtypes") boolean resolvePath(LinkedList<QName> path, QName fromType, QName toType, int limit) { if (limit < 0) { return false; } --limit; if (fromType.equals(toType)) { return true; } for (Transformer fromT : _registry.getTransformersFrom(fromType)) { if (resolvePath(path, fromT.getTo(), toType, limit)) { path.addFirst(fromT.getTo()); return true; } } return false; } BaseTransformResolver();  BaseTransformResolver(int numHops);  BaseTransformResolver(TransformerRegistry registry);  BaseTransformResolver(TransformerRegistry registry, int numHops); @Override TransformSequence resolveSequence(QName from, QName to); TransformerRegistry getRegistry(); void setRegistry(TransformerRegistry registry); static final int DEFAULT_HOPS; }