/** * Copyright (C) 2009-2013 FoundationDB, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.foundationdb.qp.row; import com.foundationdb.ais.model.Table; import com.foundationdb.server.types.value.ValueRecord; import com.foundationdb.qp.rowtype.RowType; import com.foundationdb.util.Debug; public interface Row extends ValueRecord { /** * Setting this to true causes every value type to be checked against the rowtype, * to make sure they're the same. This can be rather expensive, and happens for every * value examined. Generally speaking the rest of the code does a good enough job that * this is rare at best, but it can act as a canary for bigger problems. */ final boolean DEBUG_ROWTYPE = Debug.isOn("row_type"); RowType rowType(); HKey hKey(); HKey ancestorHKey(Table table); boolean ancestorOf(Row that); boolean containsRealRowOf(Table table); Row subRow(RowType subRowType); boolean isBindingsSensitive(); /** * Compares two rows and indicates if and where they differ. * @param row The row to be compared to this row. * @param leftStartIndex First field to compare in this row. * @param rightStartIndex First field to compare in the other row. * @param fieldCount Number of fields to compare. * @return 0 if all fields are equal. A negative value indicates that this row had the first field * that was not equal to the corresponding field in the other row. A positive value indicates that the * other row had the first field that was not equal to the corresponding field in this row. In both non-zero * cases, the absolute value of the return value is the position of the field that differed, starting the numbering * at 1. E.g. a return value of -2 means that the first fields of the rows match, and that in the second field, * this row had the smaller value. */ int compareTo(Row row, int leftStartIndex, int rightStartIndex, int fieldCount); }