org.crosswire.jsword.passage
Enum RestrictionType

java.lang.Object
  extended by java.lang.Enum<RestrictionType>
      extended by org.crosswire.jsword.passage.RestrictionType
All Implemented Interfaces:
Serializable, Comparable<RestrictionType>

public enum RestrictionType
extends Enum<RestrictionType>

Types of Passage Blurring Restrictions.

Author:
Joe Walker, DM Smith
See Also:
The GNU Lesser General Public License for details.

Enum Constant Summary
CHAPTER
          Blurring is restricted to the chapter
NONE
          There is no restriction on blurring.
 
Field Summary
private static RestrictionType defaultBlurRestriction
          A default restriction type for blurring.
 
Method Summary
abstract  VerseRange blur(Versification v11n, Verse verse, int blurDown, int blurUp)
          Blur a verse the specified amount.
abstract  VerseRange blur(Versification v11n, VerseRange range, int blurDown, int blurUp)
          Blur a verse range the specified amount.
static RestrictionType fromInteger(int i)
          Lookup method to convert from an integer
static RestrictionType fromString(String name)
          Lookup method to convert from a String
static int getBlurRestriction()
          The default Blur settings.
static RestrictionType getDefaultBlurRestriction()
          The default Blur settings.
abstract  boolean isSameScope(Versification v11n, Verse start, Verse end)
          Are the two verses in the same scope.
static void setBlurRestriction(int value)
          The default Blur settings.
 int toInteger()
          Get an integer representation for this RestrictionType
abstract  VerseRange toRange(Versification v11n, Verse verse, int count)
          Create a range from the verse having the specified number of verses.
static RestrictionType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static RestrictionType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NONE

public static final RestrictionType NONE
There is no restriction on blurring.


CHAPTER

public static final RestrictionType CHAPTER
Blurring is restricted to the chapter

Field Detail

defaultBlurRestriction

private static RestrictionType defaultBlurRestriction
A default restriction type for blurring.

Method Detail

values

public static RestrictionType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (RestrictionType c : RestrictionType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static RestrictionType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

isSameScope

public abstract boolean isSameScope(Versification v11n,
                                    Verse start,
                                    Verse end)
Are the two verses in the same scope.

Parameters:
v11n - the versification to which this reference pertains
start - the first verse
end - the second verse
Returns:
true if the two are in the same scope.

blur

public abstract VerseRange blur(Versification v11n,
                                VerseRange range,
                                int blurDown,
                                int blurUp)
Blur a verse range the specified amount. Since verse ranges are immutable, it creates a new one.

Parameters:
v11n - the versification to which this reference pertains
range -
blurDown -
blurUp -
Returns:
a verse range after blurring.

blur

public abstract VerseRange blur(Versification v11n,
                                Verse verse,
                                int blurDown,
                                int blurUp)
Blur a verse the specified amount. Since verse are immutable and refer to a single verse, it creates a verse range.

Parameters:
v11n - the versification to which this reference pertains
verse -
blurDown -
blurUp -
Returns:
a verse range after blurring

toRange

public abstract VerseRange toRange(Versification v11n,
                                   Verse verse,
                                   int count)
Create a range from the verse having the specified number of verses.

Parameters:
v11n - the versification to which this reference pertains
verse -
count -
Returns:
a verse range created by extending a verse forward.

toInteger

public int toInteger()
Get an integer representation for this RestrictionType

Returns:
the integer representation

fromString

public static RestrictionType fromString(String name)
Lookup method to convert from a String

Parameters:
name -
Returns:
the matching restriction type

fromInteger

public static RestrictionType fromInteger(int i)
Lookup method to convert from an integer

Parameters:
i -
Returns:
the restriction type from its ordinal value

setBlurRestriction

public static void setBlurRestriction(int value)
The default Blur settings. This is used by config to set a default.

Parameters:
value - The new default blur setting

getBlurRestriction

public static int getBlurRestriction()
The default Blur settings. This is used by config to manage a default setting.

Returns:
The current default blurRestriction setting

getDefaultBlurRestriction

public static RestrictionType getDefaultBlurRestriction()
The default Blur settings. This is used by BlurCommandWord

Returns:
The current default blurRestriction setting

Copyright ยจ 2003-2015