Example usage for java.util AbstractSet addAll

List of usage examples for java.util AbstractSet addAll

Introduction

In this page you can find the example usage for java.util AbstractSet addAll.

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Adds all of the elements in the specified collection to this set if they're not already present (optional operation).

Usage

From source file:org.ontologyengineering.conceptdiagrams.web.shared.concretesyntax.ConcreteDiagram.java

public AbstractSet<ConcreteDiagramElement> elementsInBoundingBox(Point topLeft, Point botRight) {
    AbstractSet<ConcreteDiagramElement> result = new HashSet<ConcreteDiagramElement>();

    for (ConcreteBoundaryRectangle rec : getRectangles()) {
        result.addAll(rec.elementsInBoundingBox(topLeft, botRight));
    }//ww w  .  j  av a 2  s . com

    return result;
}

From source file:org.ontologyengineering.conceptdiagrams.web.shared.concretesyntax.ConcreteBoundaryRectangle.java

protected AbstractSet<ConcreteDiagramElement> getAllChildren() {
    AbstractSet<ConcreteDiagramElement> result = new HashSet<ConcreteDiagramElement>();
    result.addAll(getCurves());
    result.addAll(getSpiders());/*from www.  j  ava2s .  c om*/
    result.addAll(getArrows());
    result.addAll(getZones());
    return result;
}

From source file:org.ontologyengineering.conceptdiagrams.web.shared.concretesyntax.ConcreteBoundaryRectangle.java

public AbstractSet<ConcreteDiagramElement> elementsInBoundingBox(Point topLeft, Point botRight) {
    AbstractSet<ConcreteDiagramElement> result = new HashSet<ConcreteDiagramElement>();

    if (completelyEnclosed(topLeft, botRight)) {
        // we are completely inside the given bounds, so return everything, including this boundary rectangle
        result.add(this);
        result.addAll(getAllChildren());
    } else if (completelyEncloses(topLeft, botRight)) {
        // the bound is completely inside me
        result.addAll(elementsInBoundingBoxHelper(topLeft, botRight));
    } else {//from   w  ww.j  av  a  2s  . c  o  m
        if (ConcreteRectangularElement.rectanglesIntersect(topLeft(), bottomRight(), topLeft, botRight)) {
            // must intersect the rectangle so add that too
            result.add(this);
            result.addAll(elementsInBoundingBoxHelper(topLeft, botRight));
        }
    }
    return result;
}