Search in sources :

Example 1 with TypeParameterDefinition

use of eu.esdihumboldt.hale.common.align.extension.function.TypeParameterDefinition in project hale by halestudio.

the class FunctionGraphContentProvider method getElements.

/**
 * @see ArrayContentProvider#getElements(Object)
 */
@Override
public Object[] getElements(Object inputElement) {
    Collection<Object> collection = new ArrayList<Object>();
    if (inputElement instanceof FunctionDefinition<?>) {
        FunctionDefinition<?> function = (FunctionDefinition<?>) inputElement;
        collection.add(function);
        if (inputElement instanceof TypeFunctionDefinition) {
            for (TypeParameterDefinition type : ((TypeFunctionDefinition) function).getSource()) {
                collection.add(new Pair<Object, Object>(type, function));
            }
            for (TypeParameterDefinition type : ((TypeFunctionDefinition) function).getTarget()) {
                collection.add(type);
            }
        }
        if (inputElement instanceof PropertyFunctionDefinition) {
            for (PropertyParameterDefinition prop : ((PropertyFunctionDefinition) function).getSource()) {
                collection.add(new Pair<Object, Object>(prop, function));
            }
            for (PropertyParameterDefinition prop : ((PropertyFunctionDefinition) function).getTarget()) {
                collection.add(prop);
            }
        }
        return collection.toArray();
    }
    return super.getElements(inputElement);
}
Also used : TypeFunctionDefinition(eu.esdihumboldt.hale.common.align.extension.function.TypeFunctionDefinition) TypeParameterDefinition(eu.esdihumboldt.hale.common.align.extension.function.TypeParameterDefinition) ArrayList(java.util.ArrayList) FunctionDefinition(eu.esdihumboldt.hale.common.align.extension.function.FunctionDefinition) TypeFunctionDefinition(eu.esdihumboldt.hale.common.align.extension.function.TypeFunctionDefinition) PropertyFunctionDefinition(eu.esdihumboldt.hale.common.align.extension.function.PropertyFunctionDefinition) PropertyFunctionDefinition(eu.esdihumboldt.hale.common.align.extension.function.PropertyFunctionDefinition) PropertyParameterDefinition(eu.esdihumboldt.hale.common.align.extension.function.PropertyParameterDefinition)

Aggregations

FunctionDefinition (eu.esdihumboldt.hale.common.align.extension.function.FunctionDefinition)1 PropertyFunctionDefinition (eu.esdihumboldt.hale.common.align.extension.function.PropertyFunctionDefinition)1 PropertyParameterDefinition (eu.esdihumboldt.hale.common.align.extension.function.PropertyParameterDefinition)1 TypeFunctionDefinition (eu.esdihumboldt.hale.common.align.extension.function.TypeFunctionDefinition)1 TypeParameterDefinition (eu.esdihumboldt.hale.common.align.extension.function.TypeParameterDefinition)1 ArrayList (java.util.ArrayList)1