codesimian.wrap
Class WrapAbilities.WrapWrapAbilities

java.lang.Object
  extended by codesimian.wrap.WrapAbilities.WrapWrapAbilities
All Implemented Interfaces:
WrapAbilities
Enclosing interface:
WrapAbilities

public static class WrapAbilities.WrapWrapAbilities
extends java.lang.Object
implements WrapAbilities

wrap a subclass of WrapAbilities in this to limit it to the functions of WrapAbilities. You may want to do that if you give a WrapAbilities to objects that may try to modify it by casting to a type they know how to modify.

This class is probably not needed... Instead I should build a general transformer of java object to string java code for wrapper class of that object type.


Nested Class Summary
 
Nested classes/interfaces inherited from interface codesimian.wrap.WrapAbilities
WrapAbilities.WrapWrapAbilities
 
Constructor Summary
WrapAbilities.WrapWrapAbilities(WrapAbilities wa)
           
 
Method Summary
 double accuracyOfWrap(java.lang.Class from, java.lang.Class to)
          returns 0 if can not wrap that way, else returns a number between 0 and 1.
 double costOfWrap(java.lang.Class from, java.lang.Class to)
          default should be 1000
 java.util.List<java.lang.Class> getAllFrom()
          all types of input objects that can be used to create at least 1 other type of object each, (and optionally with preferred classes at lower index)
 java.util.List<java.lang.Class> getAllFromForThisTo(java.lang.Class to)
          returns all input types that can be converted to the 'to' type, (and optionally with preferred classes at lower index)
 java.util.List<java.lang.Class> getAllTo()
          all types that can be created, given the required input object, (and optionally with preferred classes at lower index)
 java.util.List<java.lang.Class> getAllToForThisFrom(java.lang.Class from)
          returns all output types that can be converted to the 'from' type, (and optionally with preferred classes at lower index)
 java.util.List<WrapAbility> getAllWrapAbilitys()
          beware: these could be generated at the time this function is called
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrapAbilities.WrapWrapAbilities

public WrapAbilities.WrapWrapAbilities(WrapAbilities wa)
Method Detail

accuracyOfWrap

public double accuracyOfWrap(java.lang.Class from,
                             java.lang.Class to)
Description copied from interface: WrapAbilities
returns 0 if can not wrap that way, else returns a number between 0 and 1.

For example, accuracyOfWrap(byte.class,int.class) should return 1, but accuracyOfWrap(int.class,byte.class) should return 0.25 since 3/4 of the bits are lost, but since ints use all their bits less often than bytes use all their bytes, you may return (for example) .4 instead.

accuracyOfWrap(StringBuffer.class,String.class) should return a high fraction. accuracyOfWrap(boolean.class,ANYTHINGEXCEPTBOOLEAN.class) should return a very low fraction because there is only 1 bit of information in a boolean.

Specified by:
accuracyOfWrap in interface WrapAbilities

costOfWrap

public double costOfWrap(java.lang.Class from,
                         java.lang.Class to)
Description copied from interface: WrapAbilities
default should be 1000

Specified by:
costOfWrap in interface WrapAbilities

getAllFrom

public java.util.List<java.lang.Class> getAllFrom()
Description copied from interface: WrapAbilities
all types of input objects that can be used to create at least 1 other type of object each, (and optionally with preferred classes at lower index)

Specified by:
getAllFrom in interface WrapAbilities

getAllTo

public java.util.List<java.lang.Class> getAllTo()
Description copied from interface: WrapAbilities
all types that can be created, given the required input object, (and optionally with preferred classes at lower index)

Specified by:
getAllTo in interface WrapAbilities

getAllFromForThisTo

public java.util.List<java.lang.Class> getAllFromForThisTo(java.lang.Class to)
Description copied from interface: WrapAbilities
returns all input types that can be converted to the 'to' type, (and optionally with preferred classes at lower index)

Specified by:
getAllFromForThisTo in interface WrapAbilities

getAllToForThisFrom

public java.util.List<java.lang.Class> getAllToForThisFrom(java.lang.Class from)
Description copied from interface: WrapAbilities
returns all output types that can be converted to the 'from' type, (and optionally with preferred classes at lower index)

Specified by:
getAllToForThisFrom in interface WrapAbilities

getAllWrapAbilitys

public java.util.List<WrapAbility> getAllWrapAbilitys()
Description copied from interface: WrapAbilities
beware: these could be generated at the time this function is called

Specified by:
getAllWrapAbilitys in interface WrapAbilities