/** * Empty collection is empty composite */ public Collection makeCollection() { return new CompositeCollection(); }
/** * Returns a collection view of the values contained in this map. The * collection is backed by the map, so changes to the map are reflected in * the collection, and vice-versa. If the map is modified while an * iteration over the collection is in progress, the results of the * iteration are undefined. The collection supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Collection.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt> and <tt>clear</tt> operations. * It does not support the add or <tt>addAll</tt> operations. * * @return a collection view of the values contained in this map. */ public Collection values() { CompositeCollection keys = new CompositeCollection(); for (int i = this.composite.length - 1; i >= 0; --i) { keys.addComposited(this.composite[i].values()); } return keys; }
/** * Returns a collection view of the values contained in this map. The * collection is backed by the map, so changes to the map are reflected in * the collection, and vice-versa. If the map is modified while an * iteration over the collection is in progress, the results of the * iteration are undefined. The collection supports element removal, * which removes the corresponding mapping from the map, via the * <tt>Iterator.remove</tt>, <tt>Collection.remove</tt>, * <tt>removeAll</tt>, <tt>retainAll</tt> and <tt>clear</tt> operations. * It does not support the add or <tt>addAll</tt> operations. * * @return a collection view of the values contained in this map. */ public Collection values() { CompositeCollection keys = new CompositeCollection(); for (int i = this.composite.length - 1; i >= 0; --i) { keys.addComposited(this.composite[i].values()); } return keys; }
protected void setUpTest() { c = new CompositeCollection(); one = new HashSet(); two = new HashSet(); }
/** * Full collection consists of 4 collections, each with one element */ public Collection makeFullCollection() { CompositeCollection compositeCollection = new CompositeCollection(); Object[] elements = getFullElements(); for (int i = 0; i < elements.length; i++) { Collection summand = new HashSet(); summand.add(elements[i]); compositeCollection.addComposited(summand); } return compositeCollection; }
/** * Returns a {@link LimitedCookieStoreFacade} whose * {@link LimitedCookieStoreFacade#getCookies()} method returns only cookies * from {@code host} and its parent domains, if applicable. */ public CookieStore cookieStoreFor(String host) { CompositeCollection cookieCollection = new CompositeCollection(); if (InternetDomainName.isValid(host)) { InternetDomainName domain = InternetDomainName.from(host); while (domain != null) { Collection<Cookie> subset = hostSubset(domain.toString()); cookieCollection.addComposited(subset); if (domain.hasParent()) { domain = domain.parent(); } else { domain = null; } } } else { Collection<Cookie> subset = hostSubset(host.toString()); cookieCollection.addComposited(subset); } @SuppressWarnings("unchecked") List<Cookie> cookieList = new RestrictedCollectionWrappedList<Cookie>(cookieCollection); LimitedCookieStoreFacade store = new LimitedCookieStoreFacade(cookieList); return store; }
/** * Returns a collection of all axes, including the slicer as the first * element, if there is a slicer. * * @return Collection of all axes including slicer */ private Collection<QueryAxis> allAxes() { if (slicerAxis == null) { return Arrays.asList(axes); } else { //noinspection unchecked return new CompositeCollection( new Collection[] { Collections.singletonList(slicerAxis), Arrays.asList(axes)}); } }
public Collection getProcedures() { CompositeCollection c = new CompositeCollection(); Iterator it = getDataMaps().iterator(); while (it.hasNext()) { DataMap map = (DataMap) it.next(); c.addComposited(map.getProcedures()); } return c; }
public Collection getQueries() { CompositeCollection c = new CompositeCollection(); Iterator it = getDataMaps().iterator(); while (it.hasNext()) { DataMap map = (DataMap) it.next(); c.addComposited(map.getQueries()); } return c; }
/** * Returns all DbEntities. */ public Collection getDbEntities() { CompositeCollection c = new CompositeCollection(); Iterator it = getDataMaps().iterator(); while (it.hasNext()) { DataMap map = (DataMap) it.next(); c.addComposited(map.getDbEntities()); } return c; }
public Collection getQueries() { CompositeCollection c = new CompositeCollection(); Iterator it = getDataMaps().iterator(); while (it.hasNext()) { DataMap map = (DataMap) it.next(); c.addComposited(map.getQueries()); } return c; }
public Collection getObjEntities() { CompositeCollection c = new CompositeCollection(); Iterator it = getDataMaps().iterator(); while (it.hasNext()) { DataMap map = (DataMap) it.next(); c.addComposited(map.getObjEntities()); } return c; }
/** * Returns all DbEntities. */ public Collection getDbEntities() { CompositeCollection c = new CompositeCollection(); Iterator it = getDataMaps().iterator(); while (it.hasNext()) { DataMap map = (DataMap) it.next(); c.addComposited(map.getDbEntities()); } return c; }
public Collection getObjEntities() { CompositeCollection c = new CompositeCollection(); Iterator it = getDataMaps().iterator(); while (it.hasNext()) { DataMap map = (DataMap) it.next(); c.addComposited(map.getObjEntities()); } return c; }
public Collection getProcedures() { CompositeCollection c = new CompositeCollection(); Iterator it = getDataMaps().iterator(); while (it.hasNext()) { DataMap map = (DataMap) it.next(); c.addComposited(map.getProcedures()); } return c; }
@SuppressWarnings("unchecked") @Override public Enumeration getAttributeNames() { List servletRequestAttrs = EnumerationUtils.toList(super.getAttributeNames()); Set<String> localRequestAttrs = this.getAttributeMap().keySet(); Collection composite = new CompositeCollection(new Collection [] { servletRequestAttrs, localRequestAttrs }); return Collections.enumeration(composite); }
public Collection<ObjEntity> getObjEntities() { // TODO: LEGACY SUPPORT: // some downstream code (like Modeler and merge framework) expect // always fresh list here, so instead of doing the right thing of // refreshing the cache and returning cache.entries(), we are scanning // the list of DataMaps. if (maps.size() == 0) { return Collections.emptyList(); } if (maps.size() == 1) { return maps.iterator().next().getObjEntities(); } CompositeCollection c = new CompositeCollection(); for (DataMap map : maps) { c.addComposited(map.getObjEntities()); } return c; }
@Override public Enumeration getAttributeNames() { List servletRequestAttrs = EnumerationUtils.toList(super.getAttributeNames()); Set localRequestAttrs = this.getAttributeMap().keySet(); Collection composite = new CompositeCollection(new Collection [] { servletRequestAttrs, localRequestAttrs }); return Collections.enumeration(composite); }
public Collection<SQLResult> getResults() { // TODO: LEGACY SUPPORT: // some downstream code (like Modeler and merge framework) expect // always fresh list here, so instead of doing the right thing of // refreshing the cache and returning cache.entries(), we are scanning // the list of DataMaps. if (maps.size() == 0) { return Collections.emptyList(); } if (maps.size() == 1) { return maps.iterator().next().getResults(); } CompositeCollection c = new CompositeCollection(); for (DataMap map : maps) { c.addComposited(map.getResults()); } return c; } }
public Collection cons(Collection c1, Collection c2) { CompositeCollection cons = new CompositeCollection(); cons.addComposited(c1); cons.addComposited(c2); return cons; }