public IAccessPath<E> getAccessPath(final IPredicate<E> predicate) { return new AccessPathFusedView<E>( // (AccessPath<E>) relation1.getAccessPath(predicate), // (AccessPath<E>) relation2.getAccessPath(predicate) // ); }
public IKeyOrder<E> getKeyOrder(IPredicate<E> predicate) { // @todo I am not sure that we really need to cross check this. final IKeyOrder<E> keyOrder1 = relation1.getKeyOrder(predicate); final IKeyOrder<E> keyOrder2 = relation2.getKeyOrder(predicate); if (keyOrder1 == null || keyOrder2 == null) throw new UnsupportedOperationException(); if (!keyOrder1.equals(keyOrder2)) throw new UnsupportedOperationException(); return keyOrder1; }
public Set<String> getIndexNames() { final Set<String> set = new HashSet<String>(); set.addAll(relation1.getIndexNames()); set.addAll(relation2.getIndexNames()); return set; }
@Override public void spot(IModel m) { this.m = m; Set<IRelation> relations = m.getRelations(); Set<IRelation> filtered = new HashSet<IRelation>(); Set<String> impclasses = new HashSet<String>(); Set<String> assocclasses = new HashSet<String>(); for (IRelation r : relations) { if (r.getType().equals("IMPLEMENTS")) { filtered.add(r); impclasses.add(r.getSrc()); } if (r.getType().equals("ASSOCIATION")) { filtered.add(r); assocclasses.add(r.getSrc()); } if (r.getType().equals("USES")) { filtered.add(r); impclasses.add(r.getSrc()); } } for (String s : impclasses) { if (assocclasses.contains(s)) { checkForAdapter(s, filtered); } } }
/** The {@link IIndexManager} for the first relation in the view. */ public IIndexManager getIndexManager() { return relation1.getIndexManager(); }
public Class<E> getElementClass() { // @todo could choose the common ancestor Class. If so, do that in the ctor and validate that // one exists. return relation1.getElementClass(); }
public E newElement(final List<BOp> a, final IBindingSet bindingSet) { return relation1.newElement(a, bindingSet); }
public ExecutorService getExecutorService() { return relation1.getExecutorService(); }
@SuppressWarnings("unchecked") public Iterator<IKeyOrder<E>> getKeyOrders() { return new Striterator(relation1.getKeyOrders()).append(relation2.getKeyOrders()); }
/** The value for the first relation in the view. */ public IKeyOrder<E> getPrimaryKeyOrder() { return relation1.getPrimaryKeyOrder(); }
private boolean checkForAdapter(String s, Set<IRelation> filtered) { IClass adapter = findClass(s); IClass adaptee = null; IClass target = null; for (IRelation r : filtered) { if (r.getSrc().equals(s) && r.getType().equals("ASSOCIATION")) { adaptee = findClass(r.getDest()); } if (r.getSrc().equals(s) && r.getType().equals("IMPLEMENTS")) { target = findClass(r.getDest()); } } if (adaptee == null || target == null) return false; for (IField f : adapter.getFields()) { if (f.getType().equals(adaptee.getName())) { adapter.setStereotype("adapter"); adaptee.setStereotype("adaptee"); target.setStereotype("target"); adapter.setPattern("ADAPTER"); adaptee.setPattern("ADAPTER"); target.setPattern("ADAPTER"); for (IRelation r : m.getRelations()) { if (r.getSrc().equals(s) && r.getDest().equals(adaptee.getName()) && r.getType().equals("ASSOCIATION")) { r.setLabel("adapts"); } } return true; } } return false; }