Github user ajs6f commented on a diff in the pull request:

    https://github.com/apache/jena/pull/317#discussion_r153284608
  
    --- Diff: 
jena-db/jena-dboe-base/src/main/java/org/apache/jena/dboe/base/buffer/RecordBufferIteratorMapper.java
 ---
    @@ -0,0 +1,105 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you 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.
    + */
    +
    +package org.apache.jena.dboe.base.buffer;
    +
    +import static org.apache.jena.atlas.lib.Alg.decodeIndex ;
    +
    +import java.util.Iterator;
    +import java.util.NoSuchElementException;
    +
    +import org.apache.jena.atlas.lib.Bytes;
    +import org.apache.jena.dboe.base.record.Record;
    +import org.apache.jena.dboe.base.record.RecordMapper;
    +
    +// Iterate over one RecordBuffer
    +public class RecordBufferIteratorMapper<X> implements Iterator<X>
    +{
    +    private RecordBuffer rBuff ;
    +    private int nextIdx ;
    +    private X slot = null ;
    +    private final byte[] keySlot ;
    +    private final Record maxRec ;
    +    private final Record minRec ;
    +    private final RecordMapper<X> mapper;
    +    
    +//    RecordBufferIteratorMapper(RecordBuffer rBuff)
    +//    { this(rBuff, null, null); }
    +    
    +    RecordBufferIteratorMapper(RecordBuffer rBuff, Record minRecord, 
Record maxRecord, int keyLen, RecordMapper<X> mapper)
    +    {
    +        this.rBuff = rBuff ;
    +        this.mapper = mapper ;
    +        this.keySlot = (maxRecord==null) ? null : new byte[keyLen];
    +        nextIdx = 0 ;
    +        minRec = minRecord ;
    +        if ( minRec != null )
    +        {
    +            nextIdx = rBuff.find(minRec) ;
    +            if ( nextIdx < 0 )
    +                nextIdx = decodeIndex(nextIdx) ;
    +        }
    +        
    +        maxRec = maxRecord ; 
    +    }
    +
    +    private void finish()
    +    {
    +        rBuff = null ;
    +        nextIdx = -99 ;
    --- End diff --
    
    Might be nice to call this out as a constant, like `NO_NEXT_INDEX` or the 
like.


---

Reply via email to