private OverloadedMethodsDictionary makeMethodNodesDictionary(TableSyntaxNode[] tableSyntaxNodes) { // Create open methods dictionary that organizes // open methods in groups using their meta info. // Dictionary contains required information what will be used to create // groups of methods in tree. // author: Alexey Gamanovich // List<TableSyntaxNode> executableNodes = getAllExecutableTables(tableSyntaxNodes); OverloadedMethodsDictionary methodNodesDictionary = new OverloadedMethodsDictionary(); methodNodesDictionary.addAll(executableNodes); return methodNodesDictionary; }
/** * Adds all nodes to dictionary. * * @param tables list of executable nodes */ public void addAll(List<TableSyntaxNode> tables) { for (TableSyntaxNode table : tables) { add(table); } }
@Override public boolean isBuilderApplicableForObject(TableSyntaxNode tableSyntaxNode) { if (tableSyntaxNode.getMember() instanceof IOpenMethod) { IOpenMethod method = (IOpenMethod) tableSyntaxNode.getMember(); OverloadedMethodsDictionary openMethodGroupsDictionary = getOpenMethodGroupsDictionary(); if (openMethodGroupsDictionary.contains(method)) { Set<TableSyntaxNodeKey> methodOverloads = openMethodGroupsDictionary.getAllMethodOverloads(method); // If group of methods size is over then 1 create the tree // element (folder); otherwise - method is unique and additional // element will not be created. // author: Alexey Gamanovich if (methodOverloads != null && methodOverloads.size() > 1) { return true; } } } return false; }
private String getFolderName(IOpenMethod method) { OverloadedMethodsDictionary openMethodGroupsDictionary = getOpenMethodGroupsDictionary(); Set<TableSyntaxNodeKey> methodOverloads = openMethodGroupsDictionary.getAllMethodOverloads(method); String folderName = getMajorityName(methodOverloads); return folderName; }
/** * Gets group of all possible overloads for specified method. * * @param method IOpenMethod instance * @return group of methods */ public Set<TableSyntaxNodeKey> getAllMethodOverloads(IOpenMethod method) { MethodKey key = buildKey(method); return internalMap.get(key); }
@Override public boolean isBuilderApplicableForObject(TableSyntaxNode tableSyntaxNode) { if (tableSyntaxNode.getMember() instanceof IOpenMethod) { IOpenMethod method = (IOpenMethod) tableSyntaxNode.getMember(); OverloadedMethodsDictionary openMethodGroupsDictionary = getOpenMethodGroupsDictionary(); if (openMethodGroupsDictionary.contains(method)) { Set<TableSyntaxNodeKey> methodOverloads = openMethodGroupsDictionary.getAllMethodOverloads(method); // If group of methods size is over then 1 create the tree // element (folder); otherwise - method is unique and additional // element will not be created. // author: Alexey Gamanovich if (methodOverloads != null && methodOverloads.size() > 1) { return true; } } } return false; }
private String getFolderName(IOpenMethod method) { OverloadedMethodsDictionary openMethodGroupsDictionary = getOpenMethodGroupsDictionary(); Set<TableSyntaxNodeKey> methodOverloads = openMethodGroupsDictionary.getAllMethodOverloads(method); String folderName = getMajorityName(methodOverloads); return folderName; }
&& dictionary.contains((IOpenMethod) tableSyntaxNode.getMember())) { if (dictionary.getAllMethodOverloads((IOpenMethod)tableSyntaxNode.getMember()).size() > 1) {
/** * Adds TableSyntaxNode instance to dictionary. If method(s) with same signature * already exists in dictionary new one will be added to its group; * otherwise - new entry will be created. * * @param table executable table */ public void add(TableSyntaxNode table) { IOpenMethod method = (IOpenMethod)table.getMember(); MethodKey key = buildKey(method); if (contains(key)) { Set<TableSyntaxNodeKey> value = internalMap.get(key); value.add(buildKey(table)); } else { Set<TableSyntaxNodeKey> value = new HashSet<>(); value.add(buildKey(table)); internalMap.put(key, value); } }
private OverloadedMethodsDictionary makeMethodNodesDictionary(TableSyntaxNode[] tableSyntaxNodes) { // Create open methods dictionary that organizes // open methods in groups using their meta info. // Dictionary contains required information what will be used to create // groups of methods in tree. // author: Alexey Gamanovich // List<TableSyntaxNode> executableNodes = getAllExecutableTables(tableSyntaxNodes); OverloadedMethodsDictionary methodNodesDictionary = new OverloadedMethodsDictionary(); methodNodesDictionary.addAll(executableNodes); return methodNodesDictionary; }