Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
IndexCommit.cs
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 using System;
19 using System.Collections.Generic;
20 using Lucene.Net.Store;
21 using Directory = Lucene.Net.Store.Directory;
22 
23 namespace Lucene.Net.Index
24 {
25 
43 
44  public abstract class IndexCommit
45  {
49  public abstract string SegmentsFileName { get; }
50 
52  public abstract ICollection<string> FileNames { get; }
53 
55  public abstract Directory Directory { get; }
56 
68  public abstract void Delete();
69 
70  public abstract bool IsDeleted { get; }
71 
73  public abstract bool IsOptimized { get; }
74 
76  public override bool Equals(System.Object other)
77  {
78  if (other is IndexCommit)
79  {
80  IndexCommit otherCommit = (IndexCommit) other;
81  return otherCommit.Directory.Equals(Directory) && otherCommit.Version == Version;
82  }
83  else
84  return false;
85  }
86 
87  public override int GetHashCode()
88  {
89  return (int)(Directory.GetHashCode() + Version);
90  }
91 
96  public abstract long Version { get; }
97 
101  public abstract long Generation { get; }
102 
108  public virtual long Timestamp
109  {
110  get { return Directory.FileModified(SegmentsFileName); }
111  }
112 
117  public abstract IDictionary<string, string> UserData { get; }
118  }
119 }