Examples of UsingItem


Examples of org.openquark.cal.compiler.SourceModel.Import.UsingItem

           
            public void update(UsingItem[] oldUsingItems, List<UsingItem> newUsingItemsList, Summarizer summarizer, DataConsNameComparator dataconsComparator, ModuleTypeInfo importedModuleTypeInfo){
                if(preserveItems) {
                    for (final UsingItem oldUsingItem : oldUsingItems) {
                        Comparator<String> comparator = (oldUsingItem instanceof UsingItem.DataConstructor) ? dataconsComparator : null;
                        UsingItem newItem = calculateFactoredUsingItem(summarizer, oldUsingItem.getUsingItemCategoryName(), oldUsingItem.getUsingNames(), comparator);
                        if(newItem != null) {
                            newUsingItemsList.add(newItem);
                        }
                    }

                } else {
                    String[] emptyStingArray = new String[0];

                    List<String> functionNames = new ArrayList<String>();
                    List<String> dataConsNames = new ArrayList<String>();
                    List<String> typeConsNames = new ArrayList<String>();
                    List<String> typeClassNames = new ArrayList<String>();

                    Map<String, List<String>> groups = new HashMap<String, List<String>>();
                    groups.put(UsingItem.Function.CATEGORY_NAME, functionNames);
                    groups.put(UsingItem.DataConstructor.CATEGORY_NAME, dataConsNames);
                    groups.put(UsingItem.TypeConstructor.CATEGORY_NAME, typeConsNames);
                    groups.put(UsingItem.TypeClass.CATEGORY_NAME, typeClassNames);

                    for (final UsingItem oldUsingItem : oldUsingItems) {
                        List<String> groupNames = groups.get(oldUsingItem.getUsingItemCategoryName());
                        groupNames.addAll(Arrays.asList(oldUsingItem.getUsingNames()));
                    }

                    UsingItem typeClassUsingItem = calculateFactoredUsingItem(summarizer, UsingItem.TypeClass.CATEGORY_NAME, typeClassNames.toArray(emptyStingArray), null);
                    if(typeClassUsingItem != null) {
                        newUsingItemsList.add(typeClassUsingItem);
                    }

                    UsingItem typeConsUsingItem = calculateFactoredUsingItem(summarizer, UsingItem.TypeConstructor.CATEGORY_NAME, typeConsNames.toArray(emptyStingArray), null);
                    if(typeConsUsingItem != null) {
                        newUsingItemsList.add(typeConsUsingItem);
                    }

                    UsingItem dataConsUsingItem = calculateFactoredUsingItem(summarizer, UsingItem.DataConstructor.CATEGORY_NAME, dataConsNames.toArray(emptyStingArray), dataconsComparator);
                    if(dataConsUsingItem != null) {
                        newUsingItemsList.add(dataConsUsingItem);
                    }

                    UsingItem functionUsingItem = calculateFactoredUsingItem(summarizer, UsingItem.Function.CATEGORY_NAME, functionNames.toArray(emptyStingArray), null);
                    if(functionUsingItem != null) {
                        newUsingItemsList.add(functionUsingItem);
                    }
                }
            }
View Full Code Here

Examples of org.openquark.cal.compiler.SourceModel.Import.UsingItem

            public void update(UsingItem[] oldUsingItems, List<UsingItem> newUsingItemsList, Summarizer summarizer, DataConsNameComparator dataconsComparator, ModuleTypeInfo importedModuleTypeInfo){
                // Update the newUsingItemsList
                {
                    boolean wasAdded = false;
                    for (final UsingItem oldItem : oldUsingItems) {
                        UsingItem newItem = maybeGetNewUsingItem(oldItem, insertImport.getUnqualifiedName(), category, importedModuleTypeInfo);
                        // if wasAdded then the symbol has already been added to an import statement.
                        // The user has used multiple import statements for the same type so use the old definition.
                        if (wasAdded || newItem == null){
                            newUsingItemsList.add(oldItem);
                        }
View Full Code Here

Examples of org.openquark.cal.compiler.SourceModel.Import.UsingItem

    private static SourceModel.Import removeUsingClauseEntry(SourceModel.Import importStatement, String unqualifiedName, Category category) {

        List<UsingItem> newUsingItems = new ArrayList<UsingItem>();
        UsingItem[] oldItems = importStatement.getUsingItems();
        for (final UsingItem oldItem : oldItems) {
            UsingItem newItem = removeUsingItemEntry(oldItem, unqualifiedName, category);
            if(newItem != null) {
                newUsingItems.add(newItem);
            }
        }
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.