simplify set... methods

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@185088 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2005-06-06 22:57:18 +00:00
parent 1041068de0
commit 4fd3b6899d
1 changed files with 20 additions and 15 deletions

View File

@ -311,11 +311,12 @@ public class IndexModifier {
* @see IndexWriter#setInfoStream(PrintStream) * @see IndexWriter#setInfoStream(PrintStream)
* @throws IllegalStateException if the index is closed * @throws IllegalStateException if the index is closed
*/ */
public void setInfoStream(PrintStream infoStream) throws IOException { public void setInfoStream(PrintStream infoStream) {
synchronized(directory) { synchronized(directory) {
assureOpen(); assureOpen();
createIndexWriter(); if (indexWriter != null) {
indexWriter.setInfoStream(infoStream); indexWriter.setInfoStream(infoStream);
}
this.infoStream = infoStream; this.infoStream = infoStream;
} }
} }
@ -339,11 +340,12 @@ public class IndexModifier {
* @see IndexWriter#setUseCompoundFile(boolean) * @see IndexWriter#setUseCompoundFile(boolean)
* @throws IllegalStateException if the index is closed * @throws IllegalStateException if the index is closed
*/ */
public void setUseCompoundFile(boolean useCompoundFile) throws IOException { public void setUseCompoundFile(boolean useCompoundFile) {
synchronized(directory) { synchronized(directory) {
assureOpen(); assureOpen();
createIndexWriter(); if (indexWriter != null) {
indexWriter.setUseCompoundFile(useCompoundFile); indexWriter.setUseCompoundFile(useCompoundFile);
}
this.useCompoundFile = useCompoundFile; this.useCompoundFile = useCompoundFile;
} }
} }
@ -374,11 +376,12 @@ public class IndexModifier {
* @see IndexWriter#setMaxFieldLength(int) * @see IndexWriter#setMaxFieldLength(int)
* @throws IllegalStateException if the index is closed * @throws IllegalStateException if the index is closed
*/ */
public void setMaxFieldLength(int maxFieldLength) throws IOException { public void setMaxFieldLength(int maxFieldLength) {
synchronized(directory) { synchronized(directory) {
assureOpen(); assureOpen();
createIndexWriter(); if (indexWriter != null) {
indexWriter.setMaxFieldLength(maxFieldLength); indexWriter.setMaxFieldLength(maxFieldLength);
}
this.maxFieldLength = maxFieldLength; this.maxFieldLength = maxFieldLength;
} }
} }
@ -409,11 +412,12 @@ public class IndexModifier {
* @see IndexWriter#setMaxBufferedDocs(int) * @see IndexWriter#setMaxBufferedDocs(int)
* @throws IllegalStateException if the index is closed * @throws IllegalStateException if the index is closed
*/ */
public void setMaxBufferedDocs(int maxBufferedDocs) throws IOException { public void setMaxBufferedDocs(int maxBufferedDocs) {
synchronized(directory) { synchronized(directory) {
assureOpen(); assureOpen();
createIndexWriter(); if (indexWriter != null) {
indexWriter.setMaxBufferedDocs(maxBufferedDocs); indexWriter.setMaxBufferedDocs(maxBufferedDocs);
}
this.maxBufferedDocs = maxBufferedDocs; this.maxBufferedDocs = maxBufferedDocs;
} }
} }
@ -443,11 +447,12 @@ public class IndexModifier {
* @see IndexWriter#setMergeFactor(int) * @see IndexWriter#setMergeFactor(int)
* @throws IllegalStateException if the index is closed * @throws IllegalStateException if the index is closed
*/ */
public void setMergeFactor(int mergeFactor) throws IOException { public void setMergeFactor(int mergeFactor) {
synchronized(directory) { synchronized(directory) {
assureOpen(); assureOpen();
createIndexWriter(); if (indexWriter != null) {
indexWriter.setMergeFactor(mergeFactor); indexWriter.setMergeFactor(mergeFactor);
}
this.mergeFactor = mergeFactor; this.mergeFactor = mergeFactor;
} }
} }