All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xowl.infra.lang.actions.OpaqueExpression Maven / Gradle / Ivy

There is a newer version: 2.3.4
Show newest version
/* This file has been generated by:
   xOWL Code Generator
*/
package org.xowl.infra.lang.actions;

public class OpaqueExpression implements org.xowl.infra.lang.actions.DynamicExpression {
    // 
    public static interface value {
        boolean check_contains(java.lang.Object elem);
        boolean user_check_add(java.lang.Object elem);
        boolean user_check_remove(java.lang.Object elem);
        boolean user_check_replace(java.lang.Object oldElem, java.lang.Object  newElem);
        void user_add(java.lang.Object elem);
        void user_remove(java.lang.Object elem);
        boolean inverse_check_add(java.lang.Object elem);
        boolean inverse_check_remove(java.lang.Object elem);
        boolean inverse_check_replace(java.lang.Object oldElem, java.lang.Object  newElem);
        void inverse_add(java.lang.Object elem);
        void inverse_remove(java.lang.Object elem);
    }
    private static class value_impl implements org.xowl.infra.lang.actions.OpaqueExpression.value {
        private org.xowl.infra.lang.actions.OpaqueExpression domain;
        private java.lang.Object data;
        public java.lang.Object get_raw() { return data; }
        public java.lang.Object get() { return data; }
        private boolean check_card(int modifier) {
            int card = modifier + 0;
            if (data != null) card++;
            return (card >= 0 && card <= 1);
        }
        @Override public boolean check_contains(java.lang.Object elem) { return (data == elem); }
        public boolean simple_check_add(java.lang.Object elem) {
            if (check_contains(elem)) return false;
            if (!check_card(1)) return false;
            return true;
        }
        public boolean simple_check_remove(java.lang.Object elem) {
            if (!check_contains(elem)) return false;
            if (!check_card(-1)) return false;
            return true;
        }
        public boolean simple_check_replace(java.lang.Object oldElem, java.lang.Object  newElem) {
            if (check_contains(newElem)) return false;
            if (!check_contains(oldElem)) return false;
            return true;
        }
        public void simple_add(java.lang.Object elem) {
            data = elem;
        }
        public void simple_remove(java.lang.Object elem) {
            data = null;
        }
        private boolean tree_check_add(java.lang.Object elem) {
            if (!simple_check_add(elem)) return false;
            return true;
        }
        private boolean tree_check_remove(java.lang.Object elem) {
            if (!simple_check_remove(elem)) return false;
            return true;
        }
        private boolean tree_check_replace(java.lang.Object oldElem, java.lang.Object  newElem) {
            if (!simple_check_replace(oldElem, newElem)) return false;
            return true;
        }
        private void tree_add(java.lang.Object elem) {
            simple_add(elem);
        }
        private void tree_remove(java.lang.Object elem) {
            simple_remove(elem);
        }
        @Override public boolean user_check_add(java.lang.Object elem) {
            return tree_check_add(elem);
        }
        @Override public boolean user_check_remove(java.lang.Object elem) {
            return tree_check_remove(elem);
        }
        @Override public boolean user_check_replace(java.lang.Object oldElem, java.lang.Object  newElem) {
            return tree_check_replace(oldElem, newElem);
        }
        @Override public void user_add(java.lang.Object elem) {
            tree_add(elem);
        }
        @Override public void user_remove(java.lang.Object elem) {
            tree_remove(elem);
        }
        @Override public boolean inverse_check_add(java.lang.Object elem) {
            return tree_check_add(elem);
        }
        @Override public boolean inverse_check_remove(java.lang.Object elem) {
            return tree_check_remove(elem);
        }
        @Override public boolean inverse_check_replace(java.lang.Object oldElem, java.lang.Object  newElem) {
            return tree_check_replace(oldElem, newElem);
        }
        @Override public void inverse_add(java.lang.Object elem) {
            tree_add(elem);
        }
        @Override public void inverse_remove(java.lang.Object elem) {
            tree_remove(elem);
        }
        public value_impl(org.xowl.infra.lang.actions.OpaqueExpression domain) {
            this.domain = domain;
        }
    }
    private value_impl dataValue;
    public org.xowl.infra.lang.actions.OpaqueExpression.value __getImplOfvalue() { return dataValue; }
    public boolean setValue(java.lang.Object elem) {
        if (dataValue.get() != null) {
            if (elem == null) {
                if (!dataValue.user_check_remove(dataValue.get())) return false;
                dataValue.user_remove(dataValue.get());
            } else {
                if (!dataValue.user_check_replace(dataValue.get(), elem)) return false;
                dataValue.user_remove(dataValue.get());
                dataValue.user_add(elem);
            }
        } else {
            if (elem == null) return true;
            if (!dataValue.user_check_add(elem)) return false;
            dataValue.user_add(elem);
        }
        return true;
    }
    public java.lang.Object getValue() { return dataValue.get(); }
    // 

    public OpaqueExpression() {
        dataValue = new value_impl(this);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy