public static XAttribute derivePrototype ( XAttribute instance ) { XAttribute prototype = ( XAttribute ) instance . clone ( ) ; if ( prototype instanceof XAttributeList ) { } else if ( prototype instanceof XAttributeContainer ) { } else if ( prototype instanceof XAttributeLiteral ) { ( ( XAttributeLiteral ) prototype ) . setValue ( "DEFAULT" ) ; } else if ( prototype instanceof XAttributeBoolean ) { ( ( XAttributeBoolean ) prototype ) . setValue ( true ) ; } else if ( prototype instanceof XAttributeContinuous ) { ( ( XAttributeContinuous ) prototype ) . setValue ( 0.0 ) ; } else if ( prototype instanceof XAttributeDiscrete ) { ( ( XAttributeDiscrete ) prototype ) . setValue ( 0 ) ; } else if ( prototype instanceof XAttributeTimestamp ) { ( ( XAttributeTimestamp ) prototype ) . setValueMillis ( 0 ) ; } else if ( prototype instanceof XAttributeID ) { ( ( XAttributeID ) prototype ) . setValue ( XIDFactory . instance ( ) . createId ( ) ) ; } else { throw new AssertionError ( "Unexpected attribute type!" ) ; } return prototype ; }
Derives a prototype for the given attribute . This prototype attribute will be equal in all respects expect for the value of the attribute . This value will be set to a default value depending on the specific type of the given attribute .