Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.maddyhome.idea.vim.option
Class NumberOption  view NumberOption download NumberOption.java

java.lang.Object
  extended bycom.maddyhome.idea.vim.option.Option
      extended bycom.maddyhome.idea.vim.option.TextOption
          extended bycom.maddyhome.idea.vim.option.NumberOption

public class NumberOption
extends TextOption

Represents an option with a numeric value


Nested Class Summary
 
Nested classes inherited from class com.maddyhome.idea.vim.option.Option
Option.NameSorter
 
Field Summary
private  int dflt
           
private  int max
           
private  int min
           
private  int value
           
 
Fields inherited from class com.maddyhome.idea.vim.option.Option
abbrev, listeners, name
 
Constructor Summary
(package private) NumberOption(java.lang.String name, java.lang.String abbrev, int dflt)
          Creates a number option that must contain a zero or positive value
(package private) NumberOption(java.lang.String name, java.lang.String abbrev, int dflt, int min, int max)
          Creates a number option
 
Method Summary
 boolean append(java.lang.String val)
          Adds the value to the option's value after parsing the string into a number.
protected  java.lang.Integer asNumber(java.lang.String val)
           
 java.lang.String getValue()
          Gets the option's value as a string
protected  boolean inRange(int val)
           
 boolean isDefault()
          Checks to see if the option's current value equals the default value
 boolean prepend(java.lang.String val)
          Multiplies the value by the option's value after parsing the string into a number.
 boolean remove(java.lang.String val)
          Substracts the value from the option's value after parsing the string into a number.
 void resetDefault()
          Sets the option to its default value.
 boolean set(int val)
          Sets the option's value if the value is in the proper range
 boolean set(java.lang.String val)
          Sets the option's value after parsing the string into a number.
 java.lang.String toString()
          {name}={value}
 int value()
          Gets the option's value as an int
 
Methods inherited from class com.maddyhome.idea.vim.option.Option
addOptionChangeListener, fireOptionChangeEvent, getAbbreviation, getName, removeOptionChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dflt

private int dflt

value

private int value

min

private int min

max

private int max
Constructor Detail

NumberOption

NumberOption(java.lang.String name,
             java.lang.String abbrev,
             int dflt)
Creates a number option that must contain a zero or positive value


NumberOption

NumberOption(java.lang.String name,
             java.lang.String abbrev,
             int dflt,
             int min,
             int max)
Creates a number option

Method Detail

getValue

public java.lang.String getValue()
Gets the option's value as a string

Specified by:
getValue in class TextOption

value

public int value()
Gets the option's value as an int


set

public boolean set(int val)
Sets the option's value if the value is in the proper range


set

public boolean set(java.lang.String val)
Sets the option's value after parsing the string into a number. The supplied value can be in decimal, hex, or octal formats. Octal numbers must be preceded with a zero and all digits must be 0 - 7. Hex values must start with 0x or 0X and all digits must be 0 - 9, a - F, or A - F. All others will be tried as a decimal number.

Specified by:
set in class TextOption

append

public boolean append(java.lang.String val)
Adds the value to the option's value after parsing the string into a number. The supplied value can be in decimal, hex, or octal formats. Octal numbers must be preceded with a zero and all digits must be 0 - 7. Hex values must start with 0x or 0X and all digits must be 0 - 9, a - F, or A - F. All others will be tried as a decimal number.

Specified by:
append in class TextOption

prepend

public boolean prepend(java.lang.String val)
Multiplies the value by the option's value after parsing the string into a number. The supplied value can be in decimal, hex, or octal formats. Octal numbers must be preceded with a zero and all digits must be 0 - 7. Hex values must start with 0x or 0X and all digits must be 0 - 9, a - F, or A - F. All others will be tried as a decimal number.

Specified by:
prepend in class TextOption

remove

public boolean remove(java.lang.String val)
Substracts the value from the option's value after parsing the string into a number. The supplied value can be in decimal, hex, or octal formats. Octal numbers must be preceded with a zero and all digits must be 0 - 7. Hex values must start with 0x or 0X and all digits must be 0 - 9, a - F, or A - F. All others will be tried as a decimal number.

Specified by:
remove in class TextOption

isDefault

public boolean isDefault()
Checks to see if the option's current value equals the default value

Specified by:
isDefault in class Option

resetDefault

public void resetDefault()
Sets the option to its default value.

Specified by:
resetDefault in class Option

asNumber

protected java.lang.Integer asNumber(java.lang.String val)

inRange

protected boolean inRange(int val)

toString

public java.lang.String toString()
{name}={value}