// Path: src/main/java/org/neo4j/index/impl/lucene/LuceneTransaction.java
// static class CommandList
// {
//     private final List<LuceneCommand> commands = new ArrayList<LuceneCommand>();
//     private boolean containsWrites;
// 
//     void add( LuceneCommand command )
//     {
//         this.commands.add( command );
//     }
// 
//     boolean containsWrites()
//     {
//         return containsWrites;
//     }
//         
//     boolean isDeletion()
//     {
//         return commands.size() == 1 && commands.get( 0 ) instanceof DeleteCommand;
//     }
// 
//     void clear()
//     {
//         commands.clear();
//         containsWrites = false;
//     }
// 
//     void incCounter( LuceneCommand command )
//     {
//         if ( command.isConsideredNormalWriteCommand() )
//         {
//             containsWrites = true;
//         }
//     }
// 
//     boolean isEmpty()
//     {
//         return commands.isEmpty();
//     }
// 
//     boolean isRecovery()
//     {
//         return commands.get( 0 ).isRecovered();
//     }
// }


import java.util.HashMap;
import java.util.Map;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexWriter;
import org.neo4j.index.impl.lucene.LuceneTransaction.CommandList;
/**
 * Copyright (c) 2002-2014 "Neo Technology,"
 * Network Engine for Objects in Lund AB [http://neotechnology.com]
 *
 * This file is part of Neo4j.
 *
 * Neo4j is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.neo4j.index.impl.lucene;



/**
 * This presents a context for each {@link LuceneCommand} when they are
 * committing its data.
 */
class CommitContext
{
    final LuceneDataSource dataSource;
    final IndexIdentifier identifier;
    final IndexType indexType;
    final Map<Long, DocumentContext> documents = new HashMap<Long, DocumentContext>();
    final CommandList commandList;
    final boolean recovery;

    IndexReference searcher;
    IndexWriter writer;

// Path: src/main/java/org/neo4j/index/impl/lucene/LuceneTransaction.java
// static class CommandList
// {
//     private final List<LuceneCommand> commands = new ArrayList<LuceneCommand>();
//     private boolean containsWrites;
// 
//     void add( LuceneCommand command )
//     {
//         this.commands.add( command );
//     }
// 
//     boolean containsWrites()
//     {
//         return containsWrites;
//     }
//         
//     boolean isDeletion()
//     {
//         return commands.size() == 1 && commands.get( 0 ) instanceof DeleteCommand;
//     }
// 
//     void clear()
//     {
//         commands.clear();
//         containsWrites = false;
//     }
// 
//     void incCounter( LuceneCommand command )
//     {
//         if ( command.isConsideredNormalWriteCommand() )
//         {
//             containsWrites = true;
//         }
//     }
// 
//     boolean isEmpty()
//     {
//         return commands.isEmpty();
//     }
// 
//     boolean isRecovery()
//     {
//         return commands.get( 0 ).isRecovered();
//     }
// }


// Path: src/main/java/org/neo4j/index/impl/lucene/CommitContext.java
import java.util.HashMap;
import java.util.Map;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.IndexWriter;
import org.neo4j.index.impl.lucene.LuceneTransaction.CommandList;

/**
 * Copyright (c) 2002-2014 "Neo Technology,"
 * Network Engine for Objects in Lund AB [http://neotechnology.com]
 *
 * This file is part of Neo4j.
 *
 * Neo4j is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.neo4j.index.impl.lucene;



/**
 * This presents a context for each {@link LuceneCommand} when they are
 * committing its data.
 */
class CommitContext
{
    final LuceneDataSource dataSource;
    final IndexIdentifier identifier;
    final IndexType indexType;
    final Map<Long, DocumentContext> documents = new HashMap<Long, DocumentContext>();
    final CommandList commandList;
    final boolean recovery;

    IndexReference searcher;
    IndexWriter writer;

    CommitContext( LuceneDataSource dataSource, IndexIdentifier identifier, IndexType indexType, CommandList commandList )