Resolves an element.

@param element
The element.
@param result
The result list.
766708
private void resolve(T element, List<T> result) {
        Set<T> dependencies = blockedBy.get(element);
        if (dependencies != null) {
            for (T dependency : dependencies) {
                resolve(dependency, result);
            }
            blockedBy.remove(element);
            result.add(element);
        }
    }
1020371
public void elementAdded(QueryControllerEntity element) {
		if (element instanceof QueryControllerGroup) {
			QueryControllerGroup group = (QueryControllerGroup) element;
			QueryGroupTreeElement ele = new QueryGroupTreeElement(group.getID());
			insertNodeInto(ele, (DefaultMutableTreeNode) root, root.getChildCount());
			nodeStructureChanged(root);
		} else if (element instanceof QueryControllerQuery) {
			QueryControllerQuery query = (QueryControllerQuery) element;
			QueryTreeElement ele = new QueryTreeElement(query.getID(), query.getQuery());
			insertNodeInto(ele, (DefaultMutableTreeNode) root, root.getChildCount());
			nodeStructureChanged(root);
		}
	}
365393
public void remove( Element<T> element ) {
		if( element.next == null ) {
			last = element.previous;
		} else {
			element.next.previous = element.previous;
		}
		if( element.previous == null ) {
			first = element.next;
		} else {
			element.previous.next = element.next;
		}
		size--;
		element.clear();
		available.push(element);
	}
340721
public void addElement(Element element) {
		synchronized(lock) {
			checkNotFrozen();
			element.setPage(this);
			// elements
			if(elements == null) elements = new ArrayList<>();
			elements.add(element);
			// elementsById
			addToElementsById(element, false);
		}
	}
169879
@Override
    public void handleResult(RHI result) {
        for (ResultHandler<RHI> resultHandler : resultHandlers) {
            resultHandler.handleResult(result);
        }
    }
1228972
public void setResult(java.util.Collection<WorkspacesIpGroup> result) {
        if (result == null) {
            this.result = null;
            return;
        }

        this.result = new com.amazonaws.internal.SdkInternalList<WorkspacesIpGroup>(result);
    }
657693
private boolean isValidElement(String element) {

        boolean validateNewElement = Boolean.valueOf(getParamValidateNewElement()).booleanValue();
        if (ALL.equals(getParamTemplate()) || !validateNewElement) {
            return true;
        }

        return isValidTemplateElement(getParamTemplate(), element);
    }
1245563
public static <R> MethodResult<R> success(R result) {
        return new MethodResult<>(result, null, false);
    }
1310739
public void addElement(ObjectProperty element) {
        assertNotNull(element);
        if (elements == null) {
            elements = new ArrayList<ObjectProperty>();
        }
        elements.add(element);
        element.setParent(this);
    }
1032869
private void processElement(final DeclarationScopeResolver resolver,
                                final Stack<RuleConditionElement> contextStack,
                                final RuleConditionElement element) {
        if ( element instanceof Pattern ) {
            Pattern pattern = (Pattern) element;
            for ( RuleConditionElement ruleConditionElement : pattern.getNestedElements() ) {
                processElement( resolver,
                                contextStack,
                                ruleConditionElement );
            }
            for (Constraint constraint : pattern.getConstraints()) {
                if (constraint instanceof Declaration) {
                    continue;
                }
                replaceDeclarations( resolver, pattern, constraint );
            }

        } else if ( element instanceof EvalCondition ) {
            processEvalCondition(resolver, (EvalCondition) element);

        } else if ( element instanceof Accumulate ) {
            for ( RuleConditionElement rce : element.getNestedElements() ) {
                processElement( resolver, contextStack, rce );
            }
            Accumulate accumulate = (Accumulate)element;
            replaceDeclarations( resolver, accumulate );

        } else if ( element instanceof From ) {
            DataProvider provider = ((From) element).getDataProvider();
            Declaration[] decl = provider.getRequiredDeclarations();
            for (Declaration aDecl : decl) {
                Declaration resolved = resolver.getDeclaration(aDecl.getIdentifier());
                if (resolved != null && resolved != aDecl) {
                    provider.replaceDeclaration(aDecl, resolved);
                } else if (resolved == null) {
                    // it is probably an implicit declaration, so find the corresponding pattern
                    Pattern old = aDecl.getPattern();
                    Pattern current = resolver.findPatternByIndex(old.getIndex());
                    if (current != null && old != current) {
                        resolved = new Declaration(aDecl.getIdentifier(), aDecl.getExtractor(), current);
                        provider.replaceDeclaration(aDecl, resolved);
                    }
                }
            }

        } else if ( element instanceof QueryElement ) {
            QueryElement qe = ( QueryElement ) element;
            Pattern pattern = qe.getResultPattern();

            for ( Entry<String, Declaration> entry : pattern.getInnerDeclarations().entrySet() ) {
                Declaration resolved = resolver.getDeclaration( entry.getValue().getIdentifier() );
                if ( resolved != null && resolved != entry.getValue() && resolved.getPattern() != pattern ) {
                    entry.setValue( resolved );
                }
            }

            List<Integer> varIndexes = asList( qe.getVariableIndexes() );
            for (int i = 0; i < qe.getArguments().length; i++) {
                if (!(qe.getArguments()[i] instanceof QueryArgument.Declr)) {
                    continue;
                }
                Declaration declr = ((QueryArgument.Declr) qe.getArguments()[i]).getDeclaration();
                Declaration resolved = resolver.getDeclaration( declr.getIdentifier() );
                if ( resolved != declr && resolved.getPattern() != pattern ) {
                    qe.getArguments()[i] = new QueryArgument.Declr(resolved);
                }

                if( ClassObjectType.DroolsQuery_ObjectType.isAssignableFrom( resolved.getPattern().getObjectType() ) ) {
                    // if the resolved still points to DroolsQuery, we know this is the first unification pattern, so redeclare it as the visible Declaration
                    declr = pattern.addDeclaration( declr.getIdentifier() );

                    // this bit is different, notice its the ArrayElementReader that we wire up to, not the declaration.
                    ArrayElementReader reader = new ArrayElementReader( new SelfReferenceClassFieldReader(Object[].class),
                                                                        i,
                                                                        resolved.getDeclarationClass() );
                    declr.setReadAccessor( reader );

                    varIndexes.add( i );
                }
            }
            qe.setVariableIndexes( toIntArray( varIndexes ) );

        }  else if ( element instanceof ConditionalBranch ) {
            processBranch( resolver, (ConditionalBranch) element );

        } else {
            contextStack.push( element );
            for (RuleConditionElement ruleConditionElement : element.getNestedElements()) {
                processElement(resolver,
                        contextStack,
                        ruleConditionElement);
            }
            contextStack.pop();
        }
    }
654366
public static void check(final Object result, final Class<?> targetType) {
        if (result != null && !targetType.isAssignableFrom(result.getClass())) {
            // note: conversion logic may go wrong (e.g. because converter expect collection input mostly and may
            // not work correctly for single element), but anyway overall conversion would be considered failed.
            throw new ResultConversionException(String.format("Failed to convert %s to %s",
                    toStringType(result), targetType.getSimpleName()));
        }
    }
1148631
private void addResult(ValidationResult result) {
		if (result == null || result.count() == 0) {
			return;
		}
		this.results.add(result);
	}
738850
public void processElement(OutputStream outputStream, Object element) throws IOException {
        if (canProcess(element)) {
            process(outputStream, element);
        } else {
            if (next != null) {
                this.next.processElement(outputStream, element);
            }
        }
    }
100772
public void addElement(Element element) {
        if (table != null) {
            table = null;
            column.setText(null);
        }
        column.addElement(element);
    }
909129
public synchronized void add(T element) {

    Assert.notNull(element, "Element cannot be null");

    int filterSize = getFilterSize();
    int hashFunctionCount = getHashFunctionCount(element);

    this.random.setSeed(element.hashCode());

    for (int count = 0; count < hashFunctionCount; count++) {
      int bitIndex = this.random.nextInt(filterSize);
      this.bitArray[bitIndex / 32] |= BIT_MASKS[bitIndex % 32];
    }
  }
869580
public Element merge(final Element element) {
        types.addAll(element.types);
        possibleValues.addAll(element.possibleValues);
        return this;
    }
1025467
public static void resolve(Map<String, String> properties) {
		boolean resolved = true;
		while (resolved) {
			resolved = false;
			for (Map.Entry<String, String> p : properties.entrySet()) {
				String v = p.getValue();
				if (v == null) continue;
				int i = v.indexOf("${");
				if (i < 0) continue;
				int j = v.indexOf('}', i + 2);
				if (j < 0) continue;
				String name = v.substring(i + 2, j);
				String val = properties.get(name);
				if (val == null) val = "";
				v = v.substring(0, i) + val + v.substring(j + 1);
				properties.put(p.getKey(), v);
				resolved = true;
				break;
			}
		}
	}