Package org.evolizer.famix.model.entities

Examples of org.evolizer.famix.model.entities.FamixPackage


                }
            }
        } else if (entity instanceof FamixMethod) {
            openInEditor(entity, true);
        } else if (entity instanceof FamixPackage) {
            FamixPackage selectedPackage = (FamixPackage) entity;
            final Set<FamixClass> classes = selectedPackage.getClasses();
            final String message = "You are about to open the source code of " + classes.size()
            + " files. Do you really want to continue?";
            final IWorkbench workbench = PlatformUI.getWorkbench();
            Display display = workbench.getDisplay();
            display.syncExec(new Runnable() {
View Full Code Here


//        assertEquals("No or wrong parent package for package " + subPackage.getUniqueName(), parentPackage, subPackage.getParent());
//    }

    @Test
    public void testClassContainer() {
        FamixPackage lPackage = (FamixPackage) aModel.getElement(aFactory.createPackage("testPackage", null));
        FamixClass classSum = (FamixClass) aModel.getElement(aFactory.createClass("testPackage.Sum", null));

        assertNotNull("FamixModel must contain package testPackage", lPackage);
        assertNotNull("FamixModel must contain class testPackage.Sum", classSum);

        assertTrue("FamixPackage must contain class " + classSum.getUniqueName(), lPackage.getClasses().contains(classSum));
        assertEquals("No or wrong package for class " + classSum.getUniqueName(), lPackage, classSum.getParent());
    }
View Full Code Here

public class McCabeFamixPackageStrategy extends McCabeFamixEntitiesStrategy {

  @Override
  protected double calculateValue(AbstractFamixEntity entity) {
        double value = 0d;
    FamixPackage pEntity = (FamixPackage) entity;
    Set<AbstractFamixEntity> children = pEntity.getChildren();
    for (AbstractFamixEntity famixEntity : children) {
      if (famixEntity instanceof FamixClass) {
        //TODO: Alternativen als Summer anbieten (Median, Mittel, Modus)
        value += (new McCabeFamixClassStrategy()).calculateValue(famixEntity);
      }
View Full Code Here

    private void addClassToPackage() {
        String lParentPackageID = getTypeBinding().getPackage().getName();
        if (lParentPackageID.equals("")) {
            lParentPackageID = AbstractFamixEntity.DEFAULT_PACKAGE_NAME;
        }
        FamixPackage lParentPackageHelper = getFactory().createPackage(lParentPackageID, null);
        if (getModel().contains(lParentPackageHelper)) {
            FamixPackage lParentPackage = (FamixPackage) getModel().getElement(lParentPackageHelper);
            lParentPackage.getClasses().add(getCurrType());
            getCurrType().setParent(lParentPackage);
        } else {
            sLogger.warn("No parent package defined for class " + getCurrType().getUniqueName());
        }
    }
View Full Code Here

     */
    public String getNodeInfo(Node node) {
        AbstractFamixEntity entity = (AbstractFamixEntity) getNodeToFamixMap().get(node);
        String result = "Name: " + entity.getUniqueName();
        if (entity instanceof FamixPackage) {
            FamixPackage famixPackage = (FamixPackage) entity;
            // int nop = famixPackage.getPackages().size();
            // result = result + "\nSubpackages: " + nop;
            int noc = famixPackage.getClasses().size();
            result = result + "\nClasses: " + noc;
        } else if (entity instanceof FamixClass) {
            FamixClass famixClass = (FamixClass) entity;
            int nom = famixClass.getMethods().size();
            result = result + "\nMethods: " + nom;
View Full Code Here

*/
public class LOCFamixPackageStrategy extends AbstractLOCStrategy {

  @Override
  protected double calculate() {
    FamixPackage pEntity = (FamixPackage) getCurrentEntity();

    float value = 0f;
    for (AbstractFamixEntity famixEntity : pEntity.getChildren()) {
      if (famixEntity instanceof FamixClass) {
        value += (new LOCFamixClassStrategy()).calculateValue(famixEntity, getCurrentSession());
      }
    }

View Full Code Here

    //TODO re-implement this test!
  }
 
  @Test
  public void testFamixPackage() throws EvolizerException{
    FamixPackage p = new FamixPackage("java.awt");
       
    FamixClass clazz = new FamixClass("ActionEvent");
    p.getClasses().add(clazz);
       
    fEvolizerSession.startTransaction();
    fEvolizerSession.saveObject(p);
    fEvolizerSession.saveObject(clazz);
    fEvolizerSession.endTransaction();
    fEvolizerSession.close();
   
    fEvolizerSession = fSessionHandler.getCurrentSession(fDBUrl);
   
    List<FamixPackage> packages = fEvolizerSession.query("from FamixPackage as p where p.uniqueName = 'java.awt'", FamixPackage.class);
    assertEquals(1, packages.size());
    FamixPackage returnedFamixPackage = packages.get(0);
    assertEquals("java.awt", returnedFamixPackage.getUniqueName());
       
    assertEquals(1, returnedFamixPackage.getClasses().size());
    FamixClass returnedClass = returnedFamixPackage.getClasses().iterator().next();
    assertEquals("ActionEvent", returnedClass.getUniqueName());
  }
View Full Code Here

                String lPackageID = pFragment.getElementName();
                if ((lPackageID == null) || lPackageID.equals("")) {
                    lPackageID = AbstractFamixEntity.DEFAULT_PACKAGE_NAME;
                }
   
                FamixPackage lPackage = fFactory.createPackage(lPackageID, null);
                lPackage = (FamixPackage) fModel.addElement(lPackage);
                // set parent package
    //            if (lPackageID.lastIndexOf(".") > -1) {
    //                String lParentPackageID = lPackageID.substring(0, lPackageID.lastIndexOf("."));
    //                FamixPackage lParentPackage = (FamixPackage) fModel.getElement(fFactory.createPackage(lParentPackageID, null));
View Full Code Here

     * @param uniqueName Unique name of the package (full package name).
     * @param parent Parent package (optional).
     * @return FamixPackage.
     */
    public FamixPackage createPackage(String uniqueName, FamixPackage parent) {
        return new FamixPackage(uniqueName, parent);
    }
View Full Code Here

TOP

Related Classes of org.evolizer.famix.model.entities.FamixPackage

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.