Package org.eclipse.emf.ecore.change

Examples of org.eclipse.emf.ecore.change.ListChange


        adds.add(value);
        return adds;
    }

    private int remove(int change, Collection listChanges, List list, int begin, int end) {
        ListChange listChange = createListChange(ChangeKind.REMOVE_LITERAL, change, listChanges);
        if (sequence(listChanges)) {
            Collection removes = listChange.getFeatureMapEntryValues();
            do {
                FeatureMap.Entry fme = (FeatureMap.Entry) list.get(begin);
                removes.add(changeFactory.createFeatureMapEntry(fme.getEStructuralFeature(), fme.getValue()));
            } while (++begin != end);
            return begin;
        }
        Collection removes = listChange.getValues();
        do
            removes.add(list.get(begin));
        while (++begin != end);
        return begin;
    }
View Full Code Here


    }

    static protected List optimize(List values, Object featureChange, int size) {
        int fromIndex = size, toIndex = 0;
        for (Iterator changes = ((FeatureChange) featureChange).getListChanges().iterator(); changes.hasNext();) {
            ListChange change = (ListChange) changes.next();
            Object kind = change.getKind();
            if (kind == ChangeKind.MOVE_LITERAL)
                return values;
            int index = change.getIndex();
            if (kind == ChangeKind.ADD_LITERAL) {
                if (index == 0) {
                    fromIndex = 0;
                    if (toIndex == 0)
                        toIndex = 1;
View Full Code Here

    static private boolean sequence(Object listChanges) {
        return FeatureMapUtil.isFeatureMap(((FeatureChange) ((EStructuralFeature.Setting) listChanges).getEObject()).getFeature());
    }

    private ListChange createListChange(ChangeKind changeKind, int index, Collection listChanges) {
        ListChange listChange = changeFactory.createListChange();
        listChange.setKind(changeKind);
        listChange.setIndex(index);
        listChanges.add(listChange);
        return listChange;
    }
View Full Code Here

        return listChange;
    }

    Collection add(Collection adds, int change, Collection listChanges, Object value) {
        if (adds == null) {
            ListChange listChange = createListChange(ChangeKind.ADD_LITERAL, change, listChanges);
            adds = sequence(listChanges) ? listChange.getFeatureMapEntryValues() : listChange.getValues();
        }
        adds.add(value);
        return adds;
    }
View Full Code Here

    }

    static protected List optimize(List values, Object featureChange, int size) {
        int fromIndex = size, toIndex = 0;
        for (Iterator changes = ((FeatureChange) featureChange).getListChanges().iterator(); changes.hasNext();) {
            ListChange change = (ListChange) changes.next();
            Object kind = change.getKind();
            if (kind == ChangeKind.MOVE_LITERAL)
                return values;
            int index = change.getIndex();
            if (kind == ChangeKind.ADD_LITERAL) {
                if (index == 0) {
                    fromIndex = 0;
                    if (toIndex == 0)
                        toIndex = 1;
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.change.ListChange

Copyright © 2018 www.massapicom. 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.