text: //
  //  TestSetOne.hpp
  //
  //  Created by Anton Leuski on 7/31/15.
  //  Copyright (c) 2015 Anton Leuski & ICT/USC. All rights reserved.
  //
  //  This file is part of Jerome.
  //
  //  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.
  //
  
  #ifndef __jerome_ir_training_TestSetOne_hpp__
  #define __jerome_ir_training_TestSetOne_hpp__
  
  #include <jerome/ir/training/TestSet.hpp>
  
  namespace jerome {
    namespace ir {
      namespace training {
  
        template <class Q, class D, class Index>
        struct TestSetOne : public TestSet<Q, D> {
          typedef TestSet<Q, D> parent_type;
          typedef typename parent_type::entry_list_type entry_list_type;
  
          template <class QueryRange, class DocumentRange, class LinkRange>
          TestSetOne(const QueryRange& inQueries,
                     const DocumentRange& inDocuments, const LinkRange& inLinks)
          : parent_type(inQueries, inDocuments, inLinks) {
            init();
          }
  
          template <class Data>
          TestSetOne(const Data& inData)
          : parent_type(inData) {
            init();
          }
  
          template <class Data, class A>
          TestSetOne(const Data& inData, const A& inAnalyzer)
          : parent_type(inData, inAnalyzer) {
            init();
          }
  
          const Index& index() const { return mIndex; }
  
         private:
          void init() {
            for (auto& dse : this->entries()) {
              mIndex.addIndex(dse.query());
            }
          }
  
          Index mIndex;
        };
      }
    }
  }
  
  #endif // defined __jerome_ir_training_TestSetOne_hpp__
  