X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.procore%2Fsrc%2Ffi%2Fvtt%2Fsimantics%2Fprocore%2Finternal%2FDirectStatementsImpl.java;h=8313beecad40da561e4e9916dc115d35b99aa5c8;hp=804d8007a19ff6d9ec45f379d16401df176056aa;hb=cec265e1216a0a211e6e6dc4f91d5fda4c5747db;hpb=969bd23cab98a79ca9101af33334000879fb60c5 diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DirectStatementsImpl.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DirectStatementsImpl.java index 804d8007a..8313beeca 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DirectStatementsImpl.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/DirectStatementsImpl.java @@ -1,139 +1,139 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 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 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package fi.vtt.simantics.procore.internal; - -import gnu.trove.list.array.TIntArrayList; - -import java.util.Collection; -import java.util.Iterator; - -import org.simantics.db.DirectStatements; -import org.simantics.db.Resource; -import org.simantics.db.Statement; -import org.simantics.db.impl.ResourceImpl; -import org.simantics.db.impl.support.ResourceSupport; - -final public class DirectStatementsImpl implements DirectStatements { - - final ResourceSupport support; - final int subject; - final TIntArrayList statements = new TIntArrayList(); - - DirectStatementsImpl(ResourceSupport support, int subject) { - this.support = support; - this.subject = subject; - } - - void addStatement(int p, int o) { - statements.add(p); - statements.add(o); - } - - @Override - public Resource getSubject() { - return new ResourceImpl(support, subject); - } - - @Override - public boolean add(Statement arg0) { - throw new Error("Not supported"); - } - - @Override - public boolean addAll(Collection arg0) { - throw new Error("Not supported"); - } - - @Override - public void clear() { - throw new Error("Not supported"); - } - - @Override - public boolean contains(Object arg0) { - Statement stm = (Statement)arg0; - ResourceImpl p = (ResourceImpl)stm.getPredicate(); - ResourceImpl o = (ResourceImpl)stm.getObject(); - for(int i=0;i arg0) { - throw new Error("Not supported"); - } - - @Override - public boolean isEmpty() { - throw new Error("Not supported"); - } - - @Override - public Iterator iterator() { - return new Iterator() { - - int index = 0; - int max = statements.size(); - - @Override - public boolean hasNext() { - return index < max; - } - - @Override - public Statement next() { - return new DirectStatementImpl(support, subject, statements.getQuick(index++), statements.getQuick(index++)); - } - - @Override - public void remove() { - throw new Error("Not supported"); - } - - }; - } - - @Override - public boolean remove(Object arg0) { - throw new Error("Not supported"); - } - - @Override - public boolean removeAll(Collection arg0) { - throw new Error("Not supported"); - } - - @Override - public boolean retainAll(Collection arg0) { - throw new Error("Not supported"); - } - - @Override - public int size() { - return statements.size() >> 1; - } - - @Override - public Object[] toArray() { - throw new Error("Not supported"); - } - - @Override - public T[] toArray(T[] arg0) { - throw new Error("Not supported"); - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 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 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package fi.vtt.simantics.procore.internal; + +import gnu.trove.list.array.TIntArrayList; + +import java.util.Collection; +import java.util.Iterator; + +import org.simantics.db.DirectStatements; +import org.simantics.db.Resource; +import org.simantics.db.Statement; +import org.simantics.db.impl.ResourceImpl; +import org.simantics.db.impl.support.ResourceSupport; + +final public class DirectStatementsImpl implements DirectStatements { + + final ResourceSupport support; + final int subject; + final TIntArrayList statements = new TIntArrayList(); + + DirectStatementsImpl(ResourceSupport support, int subject) { + this.support = support; + this.subject = subject; + } + + void addStatement(int p, int o) { + statements.add(p); + statements.add(o); + } + + @Override + public Resource getSubject() { + return new ResourceImpl(support, subject); + } + + @Override + public boolean add(Statement arg0) { + throw new Error("Not supported"); + } + + @Override + public boolean addAll(Collection arg0) { + throw new Error("Not supported"); + } + + @Override + public void clear() { + throw new Error("Not supported"); + } + + @Override + public boolean contains(Object arg0) { + Statement stm = (Statement)arg0; + ResourceImpl p = (ResourceImpl)stm.getPredicate(); + ResourceImpl o = (ResourceImpl)stm.getObject(); + for(int i=0;i arg0) { + throw new Error("Not supported"); + } + + @Override + public boolean isEmpty() { + throw new Error("Not supported"); + } + + @Override + public Iterator iterator() { + return new Iterator() { + + int index = 0; + int max = statements.size(); + + @Override + public boolean hasNext() { + return index < max; + } + + @Override + public Statement next() { + return new DirectStatementImpl(support, subject, statements.getQuick(index++), statements.getQuick(index++)); + } + + @Override + public void remove() { + throw new Error("Not supported"); + } + + }; + } + + @Override + public boolean remove(Object arg0) { + throw new Error("Not supported"); + } + + @Override + public boolean removeAll(Collection arg0) { + throw new Error("Not supported"); + } + + @Override + public boolean retainAll(Collection arg0) { + throw new Error("Not supported"); + } + + @Override + public int size() { + return statements.size() >> 1; + } + + @Override + public Object[] toArray() { + throw new Error("Not supported"); + } + + @Override + public T[] toArray(T[] arg0) { + throw new Error("Not supported"); + } + +}