Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.jsword.book
Class DefaultBook

    java.lang.Object
      org.crosswire.jsword.book.DefaultBook

    public class DefaultBook

extends Object

Defines a single default book.

Author:
  Joe Walker [joe at eireneh dot com]
See Also:
  `for license details. The copyright to this program is held by it's authors.`

Field Summary
`private Book` | `book` The default book
`private BookList` | `books` The list of candidate books.
`private BookFilter` | `filter` The filter against books that returns candidates.
`private static Logger` | `log` The log stream

Constructor Summary
`DefaultBook(BookList bookList, BookFilter bookFilter)`

Method Summary
`protected void` | `checkReplacement()` Go through all of the current books checking to see if we need to replace the current defaults with one of these.
`Book` | `getDefault()` Get the current default book or null if there is none.
`String` | `getDefaultName()` This method is identical to `getDefault().getFullName()` and is only used by Config which works best with strings under reflection.
`void` | `setDefault(Book newBook)` Set the default Book.
`void` | `setDefaultByName(String name)` Trawl through all the known Books satisfying the filter looking for the one matching the given name.
`void` | `setDefaultConditionally(Book newBook)` Set the default Book conditionally.
`protected void` | `unsetDefault()` Unset the current default book and attempt to appoint another.
`protected void` | `unsetDefaultConditionally(Book oldBook)` Unset the current default book, if it matches the argument and attempt to appoint another.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### book

    private Book book

  The default book

### books

    private final BookList books

  The list of candidate books.

### filter

    private final BookFilter filter

  The filter against books that returns candidates.

### log

    private static final Logger log

  The log stream

Constructor Detail

### DefaultBook

    public DefaultBook(BookList bookList,
                       BookFilter bookFilter)

Method Detail

### setDefault

    public void setDefault(Book newBook)

  Set the default Book. It must satisfy the filter.

  Parameters:
    `newBook` - The version to use as default.

### setDefaultConditionally

    public void setDefaultConditionally(Book newBook)

  Set the default Book conditionally. It has to satisfy the filter and the book must not currently be set.

  Parameters:
    `newBook` - The version to use as default.

### unsetDefault

    protected void unsetDefault()

  Unset the current default book and attempt to appoint another.

### unsetDefaultConditionally

    protected void unsetDefaultConditionally(Book oldBook)

  Unset the current default book, if it matches the argument and attempt to appoint another.

### getDefault

    public Book getDefault()

  Get the current default book or null if there is none.

  Returns:
    the current default version

### getDefaultName

    public String getDefaultName()

  This method is identical to `getDefault().getFullName()` and is only used by Config which works best with strings under reflection.

### setDefaultByName

    public void setDefaultByName(String name)

  Trawl through all the known Books satisfying the filter looking for the one matching the given name.

  This method is for use with config scripts and other things that need to work with Strings. The preferred method is to use Book objects.

  This method is picky in that it only matches when the driver and the version are the same. The user (probably) only cares about the version though, and so might be dissapointed when we fail to match AV (FooDriver) against AV (BarDriver).

  Parameters:
    `name` - The version to use as default.

### checkReplacement

    protected void checkReplacement()

  Go through all of the current books checking to see if we need to replace the current defaults with one of these.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2005
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD