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
See Also:
  `The GNU Lesser General Public License for details.`

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 org.slf4j.Logger` | `LOGGER` 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().getName()` 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.

### LOGGER

    private static final org.slf4j.Logger LOGGER

  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.

  Parameters:
    `oldBook` - the book to unset if it is the default

### 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().getName()` and is only used by Config which works best with strings under reflection.

  Returns:
    the default book name

### 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 disappointed 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-2015
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD