|
From: <mrp...@us...> - 2010-07-20 17:06:30
|
Revision: 3246
http://bigdata.svn.sourceforge.net/bigdata/?rev=3246&view=rev
Author: mrpersonick
Date: 2010-07-20 17:06:24 +0000 (Tue, 20 Jul 2010)
Log Message:
-----------
move to bigdata-rdf module from bigdata module
Added Paths:
-----------
branches/LEXICON_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/relation/rule/BindingSetSortKeyBuilder.java
Removed Paths:
-------------
branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/relation/rule/BindingSetSortKeyBuilder.java
Deleted: branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/relation/rule/BindingSetSortKeyBuilder.java
===================================================================
--- branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/relation/rule/BindingSetSortKeyBuilder.java 2010-07-20 17:05:39 UTC (rev 3245)
+++ branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/relation/rule/BindingSetSortKeyBuilder.java 2010-07-20 17:06:24 UTC (rev 3246)
@@ -1,103 +0,0 @@
-/*
-
-Copyright (C) SYSTAP, LLC 2006-2008. All rights reserved.
-
-Contact:
- SYSTAP, LLC
- 4501 Tower Road
- Greensboro, NC 27410
- lic...@bi...
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-*/
-/*
- * Created on Sep 15, 2008
- */
-
-package com.bigdata.relation.rule;
-
-import com.bigdata.btree.keys.IKeyBuilder;
-import com.bigdata.btree.keys.ISortKeyBuilder;
-import com.bigdata.rdf.internal.IV;
-
-/**
- * Builds unsigned byte[] sort keys from {@link IBindingSet}s.
- *
- * @author <a href="mailto:tho...@us...">Bryan Thompson</a>
- * @version $Id$
- */
-public class BindingSetSortKeyBuilder implements ISortKeyBuilder<IBindingSet> {
-
- private final IKeyBuilder keyBuilder;
- private final IVariable[] vars;
-
- /**
- *
- * @param keyBuilder
- * Used to generate the unsigned byte[] key for each bound
- * variable. In particular, the configuration for the
- * {@link IKeyBuilder} governs how Unicode fields are handled.
- * @param vars
- * An array of {@link IVariable}s, all of which MUST be bound.
- */
- public BindingSetSortKeyBuilder(final IKeyBuilder keyBuilder,
- final IVariable[] vars) {
-
- if (keyBuilder == null)
- throw new IllegalArgumentException();
-
- if (vars == null || vars.length == 0)
- throw new IllegalArgumentException();
-
- this.keyBuilder = keyBuilder;
-
- this.vars = vars;
-
- }
-
- public byte[] getSortKey(final IBindingSet bindingSet) {
-
- keyBuilder.reset();
-
- for (int i = 0; i < vars.length; i++) {
-
- final IVariable var = vars[i];
-
- Object val = bindingSet.get(var);
- if(val==null) {
- val=Long.valueOf(0);
- }else if(val instanceof Constant) {
- val=((Constant)val).get();
- }
-
- if (val instanceof IV) {
-
- final IV iv = (IV) val;
-
- iv.encode(keyBuilder);
-
- } else {
-
- keyBuilder.append(val);
-
- }
-
- }
-
- return keyBuilder.getKey();
-
- }
-
-}
Copied: branches/LEXICON_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/relation/rule/BindingSetSortKeyBuilder.java (from rev 3242, branches/LEXICON_REFACTOR_BRANCH/bigdata/src/java/com/bigdata/relation/rule/BindingSetSortKeyBuilder.java)
===================================================================
--- branches/LEXICON_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/relation/rule/BindingSetSortKeyBuilder.java (rev 0)
+++ branches/LEXICON_REFACTOR_BRANCH/bigdata-rdf/src/java/com/bigdata/rdf/relation/rule/BindingSetSortKeyBuilder.java 2010-07-20 17:06:24 UTC (rev 3246)
@@ -0,0 +1,110 @@
+/*
+
+Copyright (C) SYSTAP, LLC 2006-2008. All rights reserved.
+
+Contact:
+ SYSTAP, LLC
+ 4501 Tower Road
+ Greensboro, NC 27410
+ lic...@bi...
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+/*
+ * Created on Sep 15, 2008
+ */
+
+package com.bigdata.rdf.relation.rule;
+
+import com.bigdata.btree.keys.IKeyBuilder;
+import com.bigdata.btree.keys.ISortKeyBuilder;
+import com.bigdata.rdf.internal.IV;
+import com.bigdata.relation.rule.Constant;
+import com.bigdata.relation.rule.IBindingSet;
+import com.bigdata.relation.rule.IVariable;
+
+/**
+ * Builds unsigned byte[] sort keys from {@link IBindingSet}s.
+ *
+ * @author <a href="mailto:tho...@us...">Bryan Thompson</a>
+ * @version $Id$
+ */
+public class BindingSetSortKeyBuilder implements ISortKeyBuilder<IBindingSet> {
+
+ private final IKeyBuilder keyBuilder;
+ private final IVariable[] vars;
+
+ /**
+ *
+ * @param keyBuilder
+ * Used to generate the unsigned byte[] key for each bound
+ * variable. In particular, the configuration for the
+ * {@link IKeyBuilder} governs how Unicode fields are handled.
+ * @param vars
+ * An array of {@link IVariable}s, all of which MUST be bound.
+ */
+ public BindingSetSortKeyBuilder(final IKeyBuilder keyBuilder,
+ final IVariable[] vars) {
+
+ if (keyBuilder == null)
+ throw new IllegalArgumentException();
+
+ if (vars == null || vars.length == 0)
+ throw new IllegalArgumentException();
+
+ this.keyBuilder = keyBuilder;
+
+ this.vars = vars;
+
+ }
+
+ public byte[] getSortKey(final IBindingSet bindingSet) {
+
+ keyBuilder.reset();
+
+ for (int i = 0; i < vars.length; i++) {
+
+ final IVariable var = vars[i];
+
+ /*
+ * FIXME Do we ever get unbound values here? This looks suspiciously
+ * like old Long code to me.
+ */
+ Object val = bindingSet.get(var);
+ if(val==null) {
+ val=Long.valueOf(0);
+ }else if(val instanceof Constant) {
+ val=((Constant)val).get();
+ }
+
+ if (val instanceof IV) {
+
+ final IV iv = (IV) val;
+
+ iv.encode(keyBuilder);
+
+ } else {
+
+ keyBuilder.append(val);
+
+ }
+
+ }
+
+ return keyBuilder.getKey();
+
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|