Alachisoft.NCache.Common.DataReader.RecordSetEnumeratorImpl Maven / Gradle / Ivy
package Alachisoft.NCache.Common.DataReader;
// Copyright (c) 2020 Alachisoft
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License
public class RecordSetEnumeratorImpl implements RecordSetEnumerator {
private RecordSet _recordSet = null;
private RecordRow _current = null;
private int _rowId = -1;
public RecordSetEnumeratorImpl(RecordSet recordSet) {
_recordSet = recordSet;
}
public final RecordRow getCurrent() {
return _current;
}
public final ColumnCollection getColumnCollection() {
return _recordSet != null ? _recordSet.getColumnMetaData() : null;
}
public final boolean moveNext() {
if (_recordSet != null) {
if (_recordSet.containsRow(++_rowId)) {
_current = _recordSet.getRow(_rowId);
_recordSet.removeRow(_rowId);
return true;
}
}
return false;
}
@Override
public void close() {
_recordSet = null;
_current = null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy