X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fcommon%2FTools.java;h=26604d0d39a2d738c84e5d86765eb3651e2d8e95;hp=0bfca453cdf9eca2f76e17b9b71059b264c3f248;hb=2003a22e9463226869633edb92584cd8a1bc0462;hpb=ac842714074f0c80f799c950b1c04e8904a6fd06 diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java index 0bfca453cd..26604d0d39 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java @@ -27,12 +27,6 @@ import javax.swing.JComboBox; import javax.swing.JList; import javax.swing.JOptionPane; -import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; -import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdIdentification; -import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector; -import org.tianocore.frameworkwizard.packaging.PackageIdentification; -import org.tianocore.frameworkwizard.platform.PlatformIdentification; - /** The class is used to provides some useful interfaces @@ -342,191 +336,4 @@ public class Tools { } return arg0; } - - /** - Sort all elements in the vector as the specific sort type - - @param v The vector need to be sorted - @param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending - - **/ - public static void sortVectorString(Vector v, int mode) { - if (v != null) { - for (int indexI = 0; indexI < v.size(); indexI++) { - for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) { - if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING) - || (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) { - String temp = v.get(indexI); - v.setElementAt(v.get(indexJ), indexI); - v.setElementAt(temp, indexJ); - } - } - } - } - } - - /** - Sort all elements of vector and return sorted sequence - - @param v The vector need to be sorted - @param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending - @return Vector The sorted sequence - - **/ - public static Vector getVectorSortSequence(Vector v, int mode) { - Vector vSequence = new Vector(); - // - // Init sequence - // - if (v != null) { - for (int index = 0; index < v.size(); index++) { - vSequence.addElement(index); - } - } - - // - // sort and get new sequence - // - for (int indexI = 0; indexI < v.size(); indexI++) { - for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) { - if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING) - || (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) { - // - // Swap strings - // - String tempStr = v.get(indexI); - v.setElementAt(v.get(indexJ), indexI); - v.setElementAt(tempStr, indexJ); - - // - // Swap sequences - // - int tempInt = vSequence.get(indexI); - vSequence.setElementAt(vSequence.get(indexJ), indexI); - vSequence.setElementAt(tempInt, indexJ); - } - } - } - - return vSequence; - } - - /** - Sort all elements of vector as input sequence - - @param v The vector need to be sorted - @param vSequence The sort sequence should be followed - - **/ - public static void sortVectorString(Vector v, Vector vSequence) { - if (v != null && vSequence != null && v.size() == vSequence.size()) { - Vector tempV = new Vector(); - for (int index = 0; index < v.size(); index++) { - tempV.addElement(v.get(index)); - } - for (int index = 0; index < v.size(); index++) { - v.setElementAt(tempV.get(vSequence.get(index)), index); - } - } - } - - /** - Sort all modules - - @param v - @param mode - - **/ - public static void sortModules(Vector v, int mode) { - if (v != null) { - // - // sort by name - // - for (int indexI = 0; indexI < v.size(); indexI++) { - for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) { - if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING) - || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) { - ModuleIdentification temp = v.get(indexI); - v.setElementAt(v.get(indexJ), indexI); - v.setElementAt(temp, indexJ); - } - } - } - } - } - - /** - Sort all packages - - @param v - @param mode - - **/ - public static void sortPackages(Vector v, int mode) { - if (v != null) { - // - // sort by name - // - for (int indexI = 0; indexI < v.size(); indexI++) { - for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) { - if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING) - || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) { - PackageIdentification temp = v.get(indexI); - v.setElementAt(v.get(indexJ), indexI); - v.setElementAt(temp, indexJ); - } - } - } - } - } - - /** - Sort all platforms - - @param v - @param mode - - **/ - public static void sortPlatforms(Vector v, int mode) { - if (v != null) { - // - // sort by name - // - for (int indexI = 0; indexI < v.size(); indexI++) { - for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) { - if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING) - || (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) { - PlatformIdentification temp = v.get(indexI); - v.setElementAt(v.get(indexJ), indexI); - v.setElementAt(temp, indexJ); - } - } - } - } - } - - /** - Sort all pcd entries - - @param v - @param mode - - **/ - public static void sortPcds(PcdVector v, int mode) { - if (v != null) { - // - // sort by name - // - for (int indexI = 0; indexI < v.size(); indexI++) { - for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) { - if ((v.getPcd(indexJ).getName().compareTo(v.getPcd(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING) - || (v.getPcd(indexI).getName().compareTo(v.getPcd(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) { - PcdIdentification temp = v.getPcd(indexI); - v.setPcd(v.getPcd(indexJ), indexI); - v.setPcd(temp, indexJ); - } - } - } - } - } }