本文整理了Java中org.apache.metamodel.data.DataSet
类的一些代码示例,展示了DataSet
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DataSet
类的具体详情如下:
包路径:org.apache.metamodel.data.DataSet
类名称:DataSet
[英]Represents a tabular DataSet where values are bound to columns and rows. A DataSet works similarly to a slightly modularized ResultSet when you traverse it - use the next() method to loop through the rows of the DataSet and use the getRow() method to get the current row.
[中]表示将值绑定到列和行的表格数据集。当遍历数据集时,它的工作方式与稍微模块化的ResultSet类似-使用next()方法循环遍历数据集的行,并使用getRow()方法获取当前行。
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public boolean hasNext() {
if (_iterationState == 0 || _iterationState == 2) {
if (_dataSet.next()) {
_iterationState = 1;
_row = _dataSet.getRow();
} else {
_iterationState = 3;
_row = null;
_dataSet.close();
}
}
return _iterationState == 1;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
public DataSetTableModel(DataSet dataSet) {
_dataSet = dataSet;
_selectItems = dataSet.getSelectItems();
_materialized = false;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public boolean next() {
boolean next = false;
while (_dataSet.next()) {
Row row = _dataSet.getRow();
for (IRowFilter filter : _filters) {
next = filter.accept(row);
if (!next) {
break;
}
}
if (next) {
_row = row;
break;
}
}
return next;
}
代码示例来源:origin: apache/metamodel
@Override
public Row getRow() {
if (_currentDataSet == null) {
return null;
}
return _currentDataSet.getRow();
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
throw new IllegalArgumentException("Right DataSet cannot be null");
List<SelectItem> si1 = ds1.getSelectItems();
List<SelectItem> si2 = ds2.getSelectItems();
List<SelectItem> selectItems = Stream.concat(si1.stream(), si2.stream()).collect(Collectors.toList());
List<Row> resultRows = new ArrayList<Row>();
while (ds1.next()) {
Row ds1row = ds1.getRow();
List<Row> ds1rows = new ArrayList<Row>();
ds1rows.add(ds1row);
ds1.close();
代码示例来源:origin: apache/metamodel
@Override
public boolean next() {
if (_rowsLeft > 0) {
boolean next = _dataSet.next();
if (next) {
_rowsLeft--;
}
return next;
}
return false;
}
}
代码示例来源:origin: org.eobjects.datacleaner/DataCleaner-monitor-services
final SelectItem[] selectItems = dataSet.getSelectItems();
for (SelectItem selectItem : selectItems) {
final String label = selectItem.getSuperQueryAlias(false);
while (dataSet.next()) {
writer.write("\n<tr>");
Row row = dataSet.getRow();
for (int i = 0; i < selectItems.length; i++) {
Object value = row.getValue(i);
代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc
@Override
public boolean next() {
boolean result;
if (_currentDataSet == null) {
result = false;
} else {
result = _currentDataSet.next();
}
if (!result && _queryIterator.hasNext()) {
if (_currentDataSet != null) {
logger.debug("currentDataSet.close()");
_currentDataSet.close();
}
Query q = _queryIterator.next();
_currentDataSet = _dataContext.executeQuery(q);
if (logger.isDebugEnabled()) {
_queryIndex++;
logger.debug("Executing query #{}", _queryIndex);
}
result = next();
}
return result;
}
}
代码示例来源:origin: apache/metamodel
@Override
public void close() {
_dataSet.close();
}
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public boolean next() {
if (_iterator == null) {
_iterator = _dataSetProviders.iterator();
}
while (_currentDataSet == null || !_currentDataSet.next()) {
if (!_iterator.hasNext()) {
_currentDataSet = null;
return false;
}
_currentDataSet = _iterator.next().get();
assert getHeader().size() == _currentDataSet.getSelectItems().size();
}
return true;
}
代码示例来源:origin: org.eobjects.datacleaner/DataCleaner-monitor-services
private List<String> createRowValueList(DataSet dataSet) {
final List<String> values = new ArrayList<>();
Row row = dataSet.getRow();
for (int i = 0; i < dataSet.getSelectItems().length; i++) {
Object value = row.getValue(i);
values.add(ConvertToStringTransformer.transformValue(value));
}
return values;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
/**
* Executes a simple nested loop join. The innerLoopDs will be copied in an in-memory dataset.
*
*/
public static InMemoryDataSet nestedLoopJoin(DataSet innerLoopDs, DataSet outerLoopDs,
Iterable<FilterItem> filtersIterable) {
List<FilterItem> filters = new ArrayList<>();
for (FilterItem fi : filtersIterable) {
filters.add(fi);
}
List<Row> innerRows = innerLoopDs.toRows();
List<SelectItem> allItems = new ArrayList<>(outerLoopDs.getSelectItems());
allItems.addAll(innerLoopDs.getSelectItems());
Set<FilterItem> applicableFilters = applicableFilters(filters, allItems);
DataSetHeader jointHeader = new CachingDataSetHeader(allItems);
List<Row> resultRows = new ArrayList<>();
for (Row outerRow : outerLoopDs) {
for (Row innerRow : innerRows) {
Object[] joinedRowObjects = new Object[outerRow.getValues().length + innerRow.getValues().length];
System.arraycopy(outerRow.getValues(), 0, joinedRowObjects, 0, outerRow.getValues().length);
System.arraycopy(innerRow.getValues(), 0, joinedRowObjects, outerRow.getValues().length,
innerRow.getValues().length);
Row joinedRow = new DefaultRow(jointHeader, joinedRowObjects);
if (applicableFilters.isEmpty() || applicableFilters.stream().allMatch(fi -> fi.accept(joinedRow))) {
resultRows.add(joinedRow);
}
}
}
return new InMemoryDataSet(jointHeader, resultRows);
}
代码示例来源:origin: apache/metamodel
for (int i = 0; i < orderByItems.length; i++) {
OrderByItem item = orderByItems[i];
int indexOf = dataSet.indexOf(item.getSelectItem());
sortIndexes[i] = indexOf;
return new EmptyDataSet(dataSet.getSelectItems());
代码示例来源:origin: apache/metamodel
@Override
public boolean next() {
boolean next = false;
while (_dataSet.next()) {
Row row = _dataSet.getRow();
for (IRowFilter filter : _filters) {
next = filter.accept(row);
if (!next) {
break;
}
}
if (next) {
_row = row;
break;
}
}
return next;
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public Row getRow() {
if (_currentDataSet == null) {
return null;
}
return _currentDataSet.getRow();
}
代码示例来源:origin: apache/metamodel
throw new IllegalArgumentException("Right DataSet cannot be null");
List<SelectItem> si1 = ds1.getSelectItems();
List<SelectItem> si2 = ds2.getSelectItems();
List<SelectItem> selectItems = Stream.concat(si1.stream(), si2.stream()).collect(Collectors.toList());
List<Row> resultRows = new ArrayList<Row>();
while (ds1.next()) {
Row ds1row = ds1.getRow();
List<Row> ds1rows = new ArrayList<Row>();
ds1rows.add(ds1row);
ds1.close();
代码示例来源:origin: apache/metamodel
@Override
public boolean next() {
return _dataSet.next();
}
代码示例来源:origin: apache/metamodel
@Override
public boolean next() {
boolean result;
if (_currentDataSet == null) {
result = false;
} else {
result = _currentDataSet.next();
}
if (!result && _queryIterator.hasNext()) {
if (_currentDataSet != null) {
logger.debug("currentDataSet.close()");
_currentDataSet.close();
}
Query q = _queryIterator.next();
_currentDataSet = _dataContext.executeQuery(q);
if (logger.isDebugEnabled()) {
_queryIndex++;
logger.debug("Executing query #{}", _queryIndex);
}
result = next();
}
return result;
}
}
代码示例来源:origin: org.apache.metamodel/MetaModel-core
@Override
public void close() {
_dataSet.close();
}
}
代码示例来源:origin: apache/metamodel
@Override
public boolean next() {
if (_iterator == null) {
_iterator = _dataSetProviders.iterator();
}
while (_currentDataSet == null || !_currentDataSet.next()) {
if (!_iterator.hasNext()) {
_currentDataSet = null;
return false;
}
_currentDataSet = _iterator.next().get();
assert getHeader().size() == _currentDataSet.getSelectItems().size();
}
return true;
}
内容来源于网络,如有侵权,请联系作者删除!