예제 #1
0
  /**
   * Returns the firsts Association from toAssociations that matches with association type and have
   * the ManagedElement element as "to" element
   *
   * @param clazz specific Association.class
   * @param element that represents the "to"
   * @return Association of type clazz that have I as a "from" and the element as "to"
   */
  public Association getFirstToAssociationByTypeAndElement(
      Class<? extends Association> clazz, ManagedElement element) {
    for (Association assoc : toAssociations)
      if (clazz.isInstance(assoc)) if (assoc.getTo().equals(element)) return assoc;

    return null;
  }
예제 #2
0
 /**
  * remove the specific association from the vector toAssociation that
  *
  * <p>have the ManagedElement element as a "to"
  *
  * @param the ManagedElement that represents the "to" into the Association
  * @return true if association is removed from the vector, false otherwise
  */
 public boolean removeToAssociationByElement(ManagedElement element) {
   for (Association assoc : toAssociations)
     if (assoc.getTo().equals(element)) {
       return removeToAssociation(assoc);
     }
   return false;
 }
예제 #3
0
  /**
   * Returns the firsts ManagedElement that represents the "to" of the toAssociations that match
   * with association type
   *
   * @param specific Association.class
   * @return ManagedElement that represents the "to" of the toAssociations
   */
  public ManagedElement getFisrtsToAssociatedElementByType(Class<? extends Association> clazz) {
    ManagedElement element = null;

    for (Association assoc : toAssociations) {
      if (clazz.isInstance(assoc)) return assoc.getTo();
    }

    return element;
  }
예제 #4
0
  /**
   * Returns the list of ManagedElement that represents the "to" of the toAssociations, that match
   * with association type
   *
   * @param specific Association.class
   * @return list of ManagedElement that represents the "to" of the toAssociations
   */
  public List<? extends ManagedElement> getToAssociatedElementsByType(
      Class<? extends Association> clazz) {
    List<ManagedElement> elements = new LinkedList<ManagedElement>();
    for (Association assoc : toAssociations) {

      if (clazz.isInstance(assoc)) elements.add(assoc.getTo());
    }

    return elements;
  }
예제 #5
0
  /**
   * Returns the firsts Association from toAssociations that have the ManagedElement element as "to"
   * element
   *
   * @param element that represents the "to"
   * @return Association that have I as a "from" and the element as "to"
   */
  public Association getToAssociationByElement(ManagedElement element) {
    for (Association assoc : toAssociations) if (assoc.getTo().equals(element)) return assoc;

    return null;
  }