/** * Return true if the variables of a ModelVariable are equal. * @param object ModelVariable to test equality. * @return true if the variables of a ModelVariable are equal. */ public boolean equals(Object object) { if (object == null) return false; if (object == this) return true; if (!(object instanceof ModelVariable)) return false; ModelVariable modelVar = (ModelVariable)object; return variable.equals(modelVar.variable); }
public int getColumnIndex(Variable variable) throws TuplesException { if (variable == null) { throw new IllegalArgumentException("variable is null"); } if (variable.equals(variables[0])) { // The variable matches the one and only column. return 0; } throw new TuplesException( "variable doesn't match any column: " + variable ); }
public int getColumnIndex(Variable column) throws TuplesException { // Validate "column" parameter if (column == null) { throw new IllegalArgumentException("Null \"column\" parameter"); } // Look for the requested variable in the "variables" array for (int i = 0; i < variables.length; i++) { if (column.equals(variables[i])) { return i; } } // Couldn't find the requested variable throw new TuplesException("No such column " + column); }
/** * Renames the variables which label the tuples if they have the "magic" names * such as "Subject", "Predicate", "Object" and "Meta". * * @param constraint PARAMETER TO DO */ public void renameVariables(Constraint constraint) { if (variables != null) { loop:for (int i = 0; i < variables.length; ++i) { Variable v = variables[i]; for (int j = 0; j < 4; ++j) { // v will be a reference to one of the objects in Graph.VARIABLES[]. if (v.equals(StatementStore.VARIABLES[j])) { // The array obtained from getVariables() is modifiable. variables[i] = (Variable) constraint.getElement(j); continue loop; } } throw new Error("Unexpected variable: " + v); } } }
/** * Gets the ColumnIndex attribute of the AnswerImpl object * * @param column PARAMETER TO DO * @return The ColumnIndex value * @throws TuplesException EXCEPTION TO DO */ public int getColumnIndex(Variable column) throws TuplesException { // Validate "column" parameter if (column == null) { throw new IllegalArgumentException("Null \"column\" parameter"); } // Look for the requested variable in the "variables" array for (int i = 0; i < variables.length; i++) { if (column.equals(variables[i])) { return i; } } // Couldn't find the requested variable throw new TuplesException("No such column " + column); }
/** * Gets the ColumnIndex attribute of the AbstractTuples object * * @param variable PARAMETER TO DO * @return The ColumnIndex value * @throws TuplesException EXCEPTION TO DO */ public int getColumnIndex(Variable variable) throws TuplesException { if (variable == null) { throw new IllegalArgumentException("Null \"variable\" parameter"); } Variable[] variables = getVariables(); for (int i = 0; i < variables.length; i++) { if (variables[i].equals(variable)) return i; } throw new TuplesException("No such variable " + variable + " in tuples " + Arrays.asList(variables) + " (" + getClass() + ")"); }
if (vars[i].equals(operandVariables[j])) { columnMapping[i] = j;
/** * @param column {@inheritDoc} * @return {@inheritDoc} * @throws TuplesException {@inheritDoc} */ public long getColumnValue(int column) throws TuplesException { if ((column < 0) || (column >= getNumberOfVariables())) { throw new TuplesException("Invalid column: " + column); } long result = operands[mapOperand[column]].getColumnValue(mapColumn[column]); if (result != Tuples.UNBOUND) { return result; } // Brute force search for a bound instance of variable in operands. // Note: No operands to the left of the mapOperand[column] contain desired variable. Variable desired = getVariables()[column]; for (int i = mapOperand[column] + 1; i < operands.length; i++) { Variable[] v = operands[i].getVariables(); for (int j = 0; j < v.length; j++) { if (v[j].equals(desired)) { result = operands[i].getColumnValue(j); if (result != Tuples.UNBOUND) { return result; } } } } return Tuples.UNBOUND; }
if (constraint.getElement(index) instanceof Variable) { Variable var = (Variable) constraint.getElement(index); if (!var.equals(Variable.FROM)) {
equals(initialTuples.getVariables()[0]);
if (!lhs.getVariables()[i].equals(rhs.getVariables()[i])) { return false;