[Mulgara-svn] r1593 - branches/mgr-183-project/src/jar/tuples/java/org/mulgara/store/tuples
andrae at mulgara.org
andrae at mulgara.org
Thu Mar 5 08:44:43 UTC 2009
Author: andrae
Date: 2009-03-05 00:44:42 -0800 (Thu, 05 Mar 2009)
New Revision: 1593
Modified:
branches/mgr-183-project/src/jar/tuples/java/org/mulgara/store/tuples/UnorderedProjection.java
Log:
refs #183
Code cleanups.
Modified: branches/mgr-183-project/src/jar/tuples/java/org/mulgara/store/tuples/UnorderedProjection.java
===================================================================
--- branches/mgr-183-project/src/jar/tuples/java/org/mulgara/store/tuples/UnorderedProjection.java 2009-03-04 17:25:34 UTC (rev 1592)
+++ branches/mgr-183-project/src/jar/tuples/java/org/mulgara/store/tuples/UnorderedProjection.java 2009-03-05 08:44:42 UTC (rev 1593)
@@ -44,44 +44,23 @@
* discarded but not rearranged, {@link OrderedProjection} should be used
* instead.
*
- * @created 2003-02-04
- *
- * @author <a href="http://staff.pisoftware.com/raboczi">Simon Raboczi</a>
- *
- * @version $Revision: 1.9 $
- *
- * @modified $Date: 2005/01/05 04:59:10 $
- *
- * @maintenanceAuthor $Author: newmana $
- *
* @company <A href="mailto:info at PIsoftware.com">Plugged In Software</A>
- *
* @copyright © 2003 <A href="http://www.PIsoftware.com/">Plugged In
* Software Pty Ltd</A>
- *
* @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
*/
class UnorderedProjection extends AbstractTuples {
- /**
- * Logger.
- */
+ /** Logger. */
private final static Logger logger = Logger.getLogger(UnorderedProjection.class);
- /**
- * The proposition to project.
- */
+ /** The proposition to project. */
private final Tuples operand;
- /**
- * Array indexed on operand columns, whose values are projected columns.
- */
+ /** Array indexed on operand columns, whose values are projected columns. */
private final int[] columnMapping;
- /**
- * Value within the {@link #columnMapping} array to indicate that the operand
- * lacks a given column.
- */
+ /** Value within the {@link #columnMapping} array to indicate that the operand lacks a given column. */
private final int ABSENT_COLUMN = -1;
/**
@@ -95,23 +74,16 @@
* @throws TuplesException EXCEPTION TO DO
*/
UnorderedProjection(Tuples operand, List columnList) throws TuplesException {
-
- // Validate "operand" parameter
if (operand == null) {
throw new IllegalArgumentException("Null \"operand\" parameter");
- }
-
- // Validate "variables" parameter
- if (columnList == null) {
+ } else if (columnList == null) {
throw new IllegalArgumentException("Null \"columnList\" parameter");
}
- if (logger.isDebugEnabled()) {
- logger.debug("Projecting columns " + columnList + " on " + operand);
- }
+ if (logger.isDebugEnabled()) logger.debug("Projecting columns " + columnList + " on " + operand);
// Initialize fields
- this.operand = (Tuples) operand.clone();
+ this.operand = (Tuples)operand.clone();
setVariables(columnList);
// Create column mapping
@@ -133,18 +105,7 @@
}
}
- /**
- * Cloning constructor.
- *
- * @param parent PARAMETER TO DO
- */
- private UnorderedProjection(UnorderedProjection parent) {
- operand = (Tuples) parent.operand.clone();
- setVariables(parent.getVariables());
- columnMapping = parent.columnMapping;
- }
-
/**
* Gets the ColumnValue attribute of the UnorderedProjection object
*
@@ -153,16 +114,11 @@
* @throws TuplesException EXCEPTION TO DO
*/
public long getColumnValue(int column) throws TuplesException {
- assert((column >= 0) && (column < getNumberOfVariables())) ||
- (column == ABSENT_COLUMN):"Invalid column " + column;
+ assert((column >= 0) && (column < getNumberOfVariables())) || (column == ABSENT_COLUMN):"Invalid column " + column;
if (columnMapping[column] == ABSENT_COLUMN) {
- if (logger.isInfoEnabled()) {
- logger.info(getVariables()[column] + " is never bound\n " + new StackTrace());
- }
return Tuples.UNBOUND;
- }
- else {
+ } else {
return operand.getColumnValue(columnMapping[column]);
}
}
@@ -173,7 +129,6 @@
* @return The Comparator value
*/
public RowComparator getComparator() {
-
return null;
}
@@ -184,7 +139,6 @@
* @throws TuplesException EXCEPTION TO DO
*/
public long getRowCount() throws TuplesException {
-
return operand.getRowCount();
}
@@ -196,19 +150,11 @@
* A column is unbound if it is unbound in the source of the projection.
*/
public boolean isColumnEverUnbound(int column) throws TuplesException {
- assert((column >= 0) && (column < getNumberOfVariables())) ||
- (column == ABSENT_COLUMN):"Invalid column " + column;
+ assert((column >= 0) && (column < getNumberOfVariables())) || (column == ABSENT_COLUMN):"Invalid column " + column;
if (columnMapping[column] == ABSENT_COLUMN) {
-
- if (logger.isInfoEnabled()) {
- logger.info(getVariables()[column] + " is never bound\n" + new StackTrace());
- }
-
return true;
- }
- else {
-
+ } else {
return operand.isColumnEverUnbound(columnMapping[column]);
}
}
@@ -219,7 +165,6 @@
* @return The Materialized value
*/
public boolean isMaterialized() {
-
return operand.isMaterialized();
}
@@ -241,18 +186,8 @@
// Methods implementing Tuples
//
- /**
- * METHOD TO DO
- *
- * @param prefix PARAMETER TO DO
- * @param suffixTruncation PARAMETER TO DO
- * @throws TuplesException EXCEPTION TO DO
- */
- public void beforeFirst(long[] prefix,
- int suffixTruncation) throws TuplesException {
-
+ public void beforeFirst(long[] prefix, int suffixTruncation) throws TuplesException {
if (suffixTruncation != 0) {
-
throw new TuplesException("Suffix truncation not supported");
}
@@ -264,50 +199,25 @@
operand.beforeFirst(prefix, 0);
}
- /**
- * METHOD TO DO
- *
- * @throws TuplesException EXCEPTION TO DO
- */
public void close() throws TuplesException {
-
operand.close();
}
- /**
- * METHOD TO DO
- *
- * @return RETURNED VALUE TO DO
- * @throws TuplesException EXCEPTION TO DO
- */
public boolean hasNoDuplicates() throws TuplesException {
-
- return (operand.getVariables().length == getNumberOfVariables())
- ? operand.hasNoDuplicates() : false;
+ return (operand.getVariables().length == getNumberOfVariables()) ? operand.hasNoDuplicates() : false;
}
- /**
- * METHOD TO DO
- *
- * @return RETURNED VALUE TO DO
- * @throws TuplesException EXCEPTION TO DO
- */
public boolean next() throws TuplesException {
-
return operand.next();
}
- //
- // Methods overriding Object
- //
-
- /**
- * METHOD TO DO
- *
- * @return RETURNED VALUE TO DO
- */
public Object clone() {
+ UnorderedProjection cloned = (UnorderedProjection)super.clone();
- return new UnorderedProjection(this);
+ cloned.operand = (Tuples)operand.clone();
+ cloned.setVariables(getVariables());
+ cloned.columnMapping = columnMapping;
+
+ return cloned;
}
}
More information about the Mulgara-svn
mailing list