Changeset 1684 for trunk/modelicaml/org.openmodelica.modelicaml.common/src
- Timestamp:
- 01/10/13 17:21:24 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modelicaml/org.openmodelica.modelicaml.common/src/org/openmodelica/modelicaml/common/services/ModelicaMLServices.java
r1642 r1684 862 862 //TODO: here the models are in different root Models which are at the same hierarchy? 863 863 // which to take? 864 System.err.println("PROBLEM detecting common root model : Root models are at the same hierarchy levels.");864 System.err.println("PROBLEM detecting common root model. The root models are at the same hierarchy levels."); 865 865 } 866 866 } … … 912 912 913 913 914 public static String getSimulationResultsFileName(NamedElement model){ 914 915 /* 916 * Simulation files handling 917 */ 918 919 public static String getOMCSimulationResultsFileName(NamedElement model){ 915 920 return getModelQName((NamedElement) model) + "_res.mat"; 916 921 } 917 922 918 public static String get SimulationResultsFileName(String modelName){923 public static String getOMCSimulationResultsFileName(String modelName){ 919 924 return StringUtls.replaceSpecCharExceptThis( modelName, "::").replaceAll("::", ".") + "_res.mat"; 920 925 } … … 923 928 return StringUtls.replaceSpecCharExceptThis( model.getQualifiedName(), "::").replaceAll("::", "."); 924 929 } 930 931 public static HashMap<Element,File> findSimulationFiles(HashSet<Element> generatedModels, String fileExtension, String folderAbsolutePath){ 932 HashMap<Element,File> foundFiles = new HashMap<Element,File>(); 933 HashSet<Element> ambiguousCases = new HashSet<Element>(); 934 if (folderAbsolutePath == null || fileExtension == null) { return null; } 935 936 File folder = new File(folderAbsolutePath); 937 938 if (folder.exists() && folder.isDirectory()) { 939 for (Element element : generatedModels) { 940 if (element instanceof NamedElement) { 941 NamedElement model = (NamedElement) element; 942 943 for (File file : folder.listFiles()) { 944 String fileName = file.getName(); 945 String modelName = StringUtls.replaceSpecChar(model.getName()); 946 if (fileName.contains(fileExtension) && fileName.contains(modelName)) { 947 948 /* 949 * We collect conflict case when for one model multiple files matches. 950 */ 951 if (foundFiles.get(element) != null) { 952 ambiguousCases.add(element); 953 } 954 foundFiles.put(element, file); 955 } 956 } 957 } 958 } 959 } 960 961 /* 962 * Remove all ambiguous cases. User should select the files manually. 963 */ 964 for (Element element : ambiguousCases) { 965 foundFiles.remove(element); 966 } 967 968 return foundFiles; 969 } 970 971 925 972 926 973
Note: See TracChangeset
for help on using the changeset viewer.