All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.featherfly.data.impl.SimpleDataSet Maven / Gradle / Ivy

There is a newer version: 0.1.8
Show newest version

package cn.featherfly.data.impl;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import cn.featherfly.common.lang.Lang;
import cn.featherfly.data.core.DataSet;

/**
 * 

* 简单数据记录 *

* * @param 数据记录 * @author 钟冀 */ public class SimpleDataSet implements DataSet { private List records = new ArrayList<>(); private int index = -1; /** */ public SimpleDataSet() { } /** * @param records 记录集合 */ public SimpleDataSet(Collection records) { this.records.addAll(records); } /** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public > D addRecord(R record) { records.add(record); return (D) this; } /** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public > D addRecord(R... records) { if (Lang.isNotEmpty(records)) { for (R record : records) { addRecord(record); } } return (D) this; } /** * {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public > D addRecords(Collection records) { if (Lang.isNotEmpty(records)) { for (R record : records) { addRecord(record); } } return (D) this; } /** * {@inheritDoc} */ @Override public Collection getDataRecords() { return records; } /** * {@inheritDoc} */ @Override public R getDataRecord(int index) { return records.get(index); } /** * {@inheritDoc} */ @Override public int getDataRecordsNumber() { return records.size(); } /** * {@inheritDoc} */ @Override public int getIndex() { return index; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy