/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2018 Association for Decentralized Information Management
* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
*******************************************************************************/
package org.simantics.db.impl.query;
-import gnu.trove.procedure.TIntProcedure;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import org.simantics.db.Resource;
import org.simantics.db.ResourceSet;
+import org.simantics.db.exception.DatabaseException;
import org.simantics.db.impl.ResourceImpl;
+import org.simantics.db.impl.graph.ReadGraphImpl;
import org.simantics.db.impl.support.ResourceSupport;
+import gnu.trove.procedure.TIntProcedure;
+
final public class IntSet implements ResourceSet {
private static final Object[] EMPTY_ARRAY = new Object[0];
- public IntSet() {
+ public static IntSet EMPTY = new IntSet();
+
+ private IntSet() {
support = null;
- data = null;
- sizeOrData = NO_DATA;
}
public IntSet(QuerySupport support) {
}
}
+ public void forEach(ReadGraphImpl graph, IntProcedure procedure) throws DatabaseException {
+ if (data != null) {
+ for (int i=0;i<sizeOrData;++i)
+ procedure.execute(graph, data[i]);
+ } else if(sizeOrData == NO_DATA) {
+ } else {
+ procedure.execute(graph, sizeOrData);
+ }
+ procedure.finished(graph);
+ }
+
}
\ No newline at end of file