question: protected Attribute generateAttribute ( int index , int attType , String namePrefix ) throws Exception { Attribute result ; String name ; int valIndex ; int nomCount ; String prefix ; result = null ; if ( index == CLASS_IS_LAST ) { valIndex = 0 ; name = "Class" ; prefix = "class" ; nomCount = getNumClasses ( ) ; } else { valIndex = index ; nomCount = getNumNominalValues ( ) ; prefix = "att" + ( valIndex + 1 ) + "val" ; switch ( attType ) { case Attribute . NOMINAL : name = "Nominal" + ( valIndex + 1 ) ; break ; case Attribute . NUMERIC : name = "Numeric" + ( valIndex + 1 ) ; break ; case Attribute . STRING : name = "String" + ( valIndex + 1 ) ; break ; case Attribute . DATE : name = "Date" + ( valIndex + 1 ) ; break ; case Attribute . RELATIONAL : name = "Relational" + ( valIndex + 1 ) ; break ; default : throw new IllegalArgumentException ( "Attribute type '" + attType + "' unknown!" ) ; } } switch ( attType ) { case Attribute . NOMINAL : ArrayList < String > nomStrings = new ArrayList < String > ( valIndex + 1 ) ; for ( int j = 0 ; j < nomCount ; j ++ ) { nomStrings . add ( prefix + ( j + 1 ) ) ; } result = new Attribute ( namePrefix + name , nomStrings ) ; break ; case Attribute . NUMERIC : result = new Attribute ( namePrefix + name ) ; break ; case Attribute . STRING : result = new Attribute ( namePrefix + name , ( ArrayList < String > ) null ) ; break ; case Attribute . DATE : result = new Attribute ( namePrefix + name , "yyyy-mm-dd" ) ; break ; case Attribute . RELATIONAL : Instances rel ; if ( index == CLASS_IS_LAST ) { rel = getRelationalClassFormat ( ) ; } else { rel = getRelationalFormat ( index ) ; } if ( rel == null ) { TestInstances dataset = new TestInstances ( ) ; dataset . setNumNominal ( getNumRelationalNominal ( ) ) ; dataset . setNumNominalValues ( getNumRelationalNominalValues ( ) ) ; dataset . setNumNumeric ( getNumRelationalNumeric ( ) ) ; dataset . setNumString ( getNumRelationalString ( ) ) ; dataset . setNumDate ( getNumRelationalDate ( ) ) ; dataset . setNumInstances ( 0 ) ; dataset . setClassType ( Attribute . NOMINAL ) ; rel = new Instances ( dataset . generate ( ) ) ; if ( ! getNoClass ( ) ) { int clsIndex = rel . classIndex ( ) ; rel . setClassIndex ( - 1 ) ; rel . deleteAttributeAt ( clsIndex ) ; } } result = new Attribute ( namePrefix + name , rel ) ; break ; default : throw new IllegalArgumentException ( "Attribute type '" + attType + "' unknown!" ) ; } return result ; }
target:  creates a new Attribute of the given type