Esempio n. 1
0
 /**
  * remove the specific association from the vector fromAssociation that
  *
  * <p>have the ManagedElement element as a "from"
  *
  * @param the ManagedElement that represents the "from" into the Association
  * @return true if association is removed from the vector, false otherwise
  */
 public boolean removeFromAssociationByElement(ManagedElement element) {
   for (Association assoc : fromAssociations)
     if (assoc.getFrom().equals(element)) {
       return removeFromAssociation(assoc);
     }
   return false;
 }
Esempio n. 2
0
  /**
   * Returns the firsts Association from fromAssociations that matches with association type and
   * have the ManagedElement element as "from" element
   *
   * @param clazz specific Association.class
   * @param element that represents the "from"
   * @return Association of type clazz that have I as a "to" and the element as "from"
   */
  public Association getFirstFromAssociationByTypeAndElement(
      Class<? extends Association> clazz, ManagedElement element) {
    for (Association assoc : fromAssociations)
      if (clazz.isInstance(assoc)) if (assoc.getFrom().equals(element)) return assoc;

    return null;
  }
Esempio n. 3
0
  /**
   * Returns the firsts ManagedElement that represents the "from" of the fromAssociations that match
   * with association type
   *
   * @param specific Association.class
   * @return ManagedElement that represents the "from" of the fromAssociations
   */
  public ManagedElement getFirstFromAssociatedElementByType(Class<? extends Association> clazz) {
    ManagedElement element = null;

    for (Association assoc : fromAssociations) {
      if (clazz.isInstance(assoc)) return assoc.getFrom();
    }

    return element;
  }
Esempio n. 4
0
  /**
   * Returns the list of ManagedElement that represents the "from" of the fromAssociations, that
   * match with association type
   *
   * @param specific Association.class
   * @return list of ManagedElement that represents the "from" of the fromAssociations
   */
  public List<? extends ManagedElement> getFromAssociatedElementsByType(
      Class<? extends Association> clazz) {
    List<ManagedElement> elements = new LinkedList<ManagedElement>();

    for (Association assoc : fromAssociations) {
      if (clazz.isInstance(assoc)) elements.add(assoc.getFrom());
    }

    return elements;
  }
Esempio n. 5
0
  /**
   * Returns the firsts Association from fromAssociations that have the ManagedElement element as
   * "from" element
   *
   * @param element that represents the "from"
   * @return Association that have I as a "to" and the element as "from"
   */
  public Association getFromAssociationByElement(ManagedElement element) {
    for (Association assoc : fromAssociations) if (assoc.getFrom().equals(element)) return assoc;

    return null;
  }