/** * Checks that method already in dictionary. * * @param method IOpenMethod instance * @return <code>true</code> if method already exists in dictionary; * <code>false</code> - otherwise */ public boolean contains(IOpenMethod method) { MethodKey key = buildKey(method); return contains(key); }
/** * 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); } }
@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; }
@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; }
&& dictionary.contains((IOpenMethod) tableSyntaxNode.getMember())) {