Package cuchaz.enigma.convert.ClassNamer

Examples of cuchaz.enigma.convert.ClassNamer.SidedClassNamer


    for( boolean useReferences : Arrays.asList( false, true ) )
    {
      int numMatches = 0;
      do
      {
        SidedClassNamer sourceNamer = null;
        SidedClassNamer destNamer = null;
        if( matching != null )
        {
          // build a class namer
          ClassNamer namer = new ClassNamer( matching.getUniqueMatches() );
          sourceNamer = namer.getSourceNamer();
          destNamer = namer.getDestNamer();
         
          // note the number of matches
          numMatches = matching.getUniqueMatches().size();
        }
       
        // get the entries left to match
        Set<ClassEntry> sourceClassEntries = Sets.newHashSet();
        Set<ClassEntry> destClassEntries = Sets.newHashSet();
        if( matching == null )
        {
          sourceClassEntries.addAll( sourceIndex.getObfClassEntries() );
          destClassEntries.addAll( destIndex.getObfClassEntries() );
          matching = new ClassMatching();
        }
        else
        {
          for( Map.Entry<List<ClassIdentity>,List<ClassIdentity>> entry : matching.getAmbiguousMatches().entrySet() )
          {
            for( ClassIdentity c : entry.getKey() )
            {
              sourceClassEntries.add( c.getClassEntry() );
              matching.removeSource( c );
            }
            for( ClassIdentity c : entry.getValue() )
            {
              destClassEntries.add( c.getClassEntry() );
              matching.removeDest( c );
            }
          }
          for( ClassIdentity c : matching.getUnmatchedSourceClasses() )
          {
            sourceClassEntries.add( c.getClassEntry() );
            matching.removeSource( c );
          }
          for( ClassIdentity c : matching.getUnmatchedDestClasses() )
          {
            destClassEntries.add( c.getClassEntry() );
            matching.removeDest( c );
          }
        }
       
        // compute a matching for the classes
        for( ClassEntry classEntry : sourceClassEntries )
        {
          CtClass c = sourceLoader.loadClass( classEntry.getName() );
          ClassIdentity sourceClass = new ClassIdentity( c, sourceNamer, sourceIndex, useReferences );
          matching.addSource( sourceClass );
        }
        for( ClassEntry classEntry : destClassEntries )
        {
          CtClass c = destLoader.loadClass( classEntry.getName() );
          ClassIdentity destClass = new ClassIdentity( c, destNamer, destIndex, useReferences );
          matching.matchDestClass( destClass );
        }
       
        // TEMP
        System.out.println( matching );
      }
      while( matching.getUniqueMatches().size() - numMatches > 0 );
    }
   
    // check the class matches
    System.out.println( "Checking class matches..." );
    ClassNamer namer = new ClassNamer( matching.getUniqueMatches() );
    SidedClassNamer sourceNamer = namer.getSourceNamer();
    SidedClassNamer destNamer = namer.getDestNamer();
    for( Map.Entry<ClassIdentity,ClassIdentity> entry : matching.getUniqueMatches().entrySet() )
    {
      // check source
      ClassIdentity sourceClass = entry.getKey();
      CtClass sourceC = sourceLoader.loadClass( sourceClass.getClassEntry().getName() );
View Full Code Here

TOP

Related Classes of cuchaz.enigma.convert.ClassNamer.SidedClassNamer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.