Exemplo n.º 1
0
  public IAccessPath<E> getAccessPath(final IPredicate<E> predicate) {

    return new AccessPathFusedView<E>( //
        (AccessPath<E>) relation1.getAccessPath(predicate), //
        (AccessPath<E>) relation2.getAccessPath(predicate) //
        );
  }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
  public Set<String> getIndexNames() {

    final Set<String> set = new HashSet<String>();

    set.addAll(relation1.getIndexNames());

    set.addAll(relation2.getIndexNames());

    return set;
  }
Exemplo n.º 4
0
 @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);
     }
   }
 }
Exemplo n.º 5
0
  /** The {@link IIndexManager} for the first relation in the view. */
  public IIndexManager getIndexManager() {

    return relation1.getIndexManager();
  }
Exemplo n.º 6
0
  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();
  }
Exemplo n.º 7
0
  public E newElement(final List<BOp> a, final IBindingSet bindingSet) {

    return relation1.newElement(a, bindingSet);
  }
Exemplo n.º 8
0
  public ExecutorService getExecutorService() {

    return relation1.getExecutorService();
  }
Exemplo n.º 9
0
  @SuppressWarnings("unchecked")
  public Iterator<IKeyOrder<E>> getKeyOrders() {

    return new Striterator(relation1.getKeyOrders()).append(relation2.getKeyOrders());
  }
Exemplo n.º 10
0
  /** The value for the first relation in the view. */
  public IKeyOrder<E> getPrimaryKeyOrder() {

    return relation1.getPrimaryKeyOrder();
  }
Exemplo n.º 11
0
  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;
  }