edu.rice.cs.drjava.config
Class UnaryOpProperty<P,R>

java.lang.Object
  extended by edu.rice.cs.drjava.config.DrJavaProperty
      extended by edu.rice.cs.drjava.config.EagerProperty
          extended by edu.rice.cs.drjava.config.UnaryOpProperty<P,R>
All Implemented Interfaces:
Cloneable

public class UnaryOpProperty<P,R>
extends EagerProperty

Class representing unary operations that can be inserted as variables in external processes.

Version:
$Id$

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.rice.cs.drjava.config.DrJavaProperty
DrJavaProperty.InfiniteLoopException
 
Field Summary
protected  Lambda<R,String> _format
          Lambda to format the result.
protected  Lambda<P,R> _op
          Operation to perform.
protected  String _op1Default
          Operator default
protected  String _op1Name
          Operator name
protected  Lambda<String,P> _parse
          Lambda to turn a string into the operand.
static Lambda<Boolean,String> FORMAT_BOOL
          Formatter for Booleans.
static Lambda<Double,String> FORMAT_DOUBLE
          Formatter for Numbers.
static Lambda<String,String> FORMAT_STRING
          Formatter for Strings.
static Lambda<String,Boolean> PARSE_BOOL
          Lambda to parse a String into a Boolean.
static Lambda<String,Double> PARSE_DOUBLE
          Lambda to parse a String into a Double.
static Lambda<String,String> PARSE_STRING
          Lambda to parse a String into a String.
 
Fields inherited from class edu.rice.cs.drjava.config.DrJavaProperty
_attributes, _help, _isCurrent, _listening, _name, _value, DEACTIVATED_DUE_TO_ERROR
 
Constructor Summary
UnaryOpProperty(String name, String help, Lambda<P,R> op, Lambda<String,P> parse, Lambda<R,String> format)
          Create an eager property.
UnaryOpProperty(String name, String help, Lambda<P,R> op, String op1Name, String op1Default, Lambda<String,P> parse, Lambda<R,String> format)
          Create an eager property.
 
Method Summary
 void resetAttributes()
          Reset attributes to their defaults.
 void update(PropertyMaps pm)
          Update the property so the value is current.
 
Methods inherited from class edu.rice.cs.drjava.config.EagerProperty
getLazy, isCurrent
 
Methods inherited from class edu.rice.cs.drjava.config.DrJavaProperty
_invalidate, equals, getAttribute, getCurrent, getHelp, getName, hashCode, invalidate, invalidateOthers, listenToInvalidatesOf, setAttribute, setAttributes, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_op

protected Lambda<P,R> _op
Operation to perform.


_op1Name

protected String _op1Name
Operator name


_op1Default

protected String _op1Default
Operator default


_parse

protected Lambda<String,P> _parse
Lambda to turn a string into the operand.


_format

protected Lambda<R,String> _format
Lambda to format the result.


PARSE_DOUBLE

public static final Lambda<String,Double> PARSE_DOUBLE
Lambda to parse a String into a Double.


PARSE_BOOL

public static final Lambda<String,Boolean> PARSE_BOOL
Lambda to parse a String into a Boolean.


PARSE_STRING

public static final Lambda<String,String> PARSE_STRING
Lambda to parse a String into a String.


FORMAT_BOOL

public static final Lambda<Boolean,String> FORMAT_BOOL
Formatter for Booleans.


FORMAT_DOUBLE

public static final Lambda<Double,String> FORMAT_DOUBLE
Formatter for Numbers.


FORMAT_STRING

public static final Lambda<String,String> FORMAT_STRING
Formatter for Strings.

Constructor Detail

UnaryOpProperty

public UnaryOpProperty(String name,
                       String help,
                       Lambda<P,R> op,
                       String op1Name,
                       String op1Default,
                       Lambda<String,P> parse,
                       Lambda<R,String> format)
Create an eager property.


UnaryOpProperty

public UnaryOpProperty(String name,
                       String help,
                       Lambda<P,R> op,
                       Lambda<String,P> parse,
                       Lambda<R,String> format)
Create an eager property.

Method Detail

update

public void update(PropertyMaps pm)
Update the property so the value is current.

Specified by:
update in class DrJavaProperty
Parameters:
pm - PropertyMaps used for substitution when replacing variables

resetAttributes

public void resetAttributes()
Description copied from class: DrJavaProperty
Reset attributes to their defaults. Should be overridden by properties that use attributes.

Overrides:
resetAttributes in class DrJavaProperty