private Type evalMainType ( final Collection < Type > _baseTypes ) throws EFapsException { final Type ret ; if ( _baseTypes . size ( ) == 1 ) { ret = _baseTypes . iterator ( ) . next ( ) ; } else { final List < List < Type > > typeLists = new ArrayList <> ( ) ; for ( final Type type : _baseTypes ) { final List < Type > typesTmp = new ArrayList <> ( ) ; typeLists . add ( typesTmp ) ; Type tmpType = type ; while ( tmpType != null ) { typesTmp . add ( tmpType ) ; tmpType = tmpType . getParentType ( ) ; } } final Set < Type > common = new LinkedHashSet <> ( ) ; if ( ! typeLists . isEmpty ( ) ) { final Iterator < List < Type > > iterator = typeLists . iterator ( ) ; common . addAll ( iterator . next ( ) ) ; while ( iterator . hasNext ( ) ) { common . retainAll ( iterator . next ( ) ) ; } } if ( common . isEmpty ( ) ) { throw new EFapsException ( Selection . class , "noCommon" , _baseTypes ) ; } else { // first common type ret = common . iterator ( ) . next ( ) ; } } return ret ; }
Gets the main type .