All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yworks.yshrink.YShrinkModelImpl Maven / Gradle / Ivy

Go to download

The open-source Java obfuscation tool working with Ant and Gradle by yWorks - the diagramming experts

The newest version!
package com.yworks.yshrink;

import com.yworks.common.ShrinkBag;
import com.yworks.yshrink.ant.ResourceCpResolver;
import com.yworks.yshrink.model.Model;
import com.yworks.yshrink.core.Analyzer;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Path;

import java.util.Collection;
import java.util.Set;
import java.util.HashSet;
import java.util.List;
import java.io.IOException;

/**
 * The type Y shrink model.
 *
 * @author Michael Schroeder, yWorks GmbH http://www.yworks.com
 */
public class YShrinkModelImpl implements YShrinkModel {

  /**
   * The Model.
   */
  Model model;

  /**
   * Instantiates a new Y shrink model.
   */
  public YShrinkModelImpl() {
    model = new Model();
  }

  public void createSimpleModel( List bags ) throws IOException {

    Analyzer analyzer = new Analyzer();
    analyzer.initModel( model, bags );
    analyzer.createInheritanceEdges( model );

  }

  public Set getAllAncestorClasses( String className ) {
    Set parents = new HashSet( 3 );
    model.getAllAncestorClasses( className, parents );
    return parents;
  }

  public Set getAllImplementedInterfaces( String className ) {
    Set interfaces = new HashSet( 3 );
    model.getAllImplementedInterfaces( className, interfaces );
    return interfaces;
  }

  public Collection getAllClassNames() {
    return model.getAllClassNames();
  }

  public void setResourceClassPath(Path resourceClassPath, Task target) {
    ResourceCpResolver resourceCpResolver = new ResourceCpResolver(resourceClassPath, target);
    model.setClassResolver(resourceCpResolver);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy