Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package eu.mihosoft.vmf.vmftext.grammar.impl;
// vmf imports
//import eu.mihosoft.vmf.runtime.core.*;
//import eu.mihosoft.vmf.runtime.core.internal.*;
import eu.mihosoft.vcollections.*;
import eu.mihosoft.vmf.vmftext.grammar.*;
import java.beans.PropertyChangeListener;
// property types imports
import eu.mihosoft.vcollections.*;
// interface
/**
* An read-only representation of the model object {@code eu.mihosoft.vmf.vmftext.grammar.RuleClass}.
*/
@SuppressWarnings("deprecation")
class ReadOnlyRuleClassImpl implements ReadOnlyRuleClass, eu.mihosoft.vmf.runtime.core.internal.VObjectInternal, VCloneableInternal {
private final RuleClass mutableObject;
// Read-only view for collection properties
// - properties with collection type (model & non-model collections)
// - we don't allow/provide setters for collection properties
private VList childClasses;
private VList customProperties;
private VList customRuleAnnotations;
private VList delegationMethods;
private VList properties;
private VList superInterfaces;
public ReadOnlyRuleClassImpl(RuleClass mutableObject) {
this.mutableObject = mutableObject;
}
@Override
// generic type is a model-type
public VList getChildClasses() {
// we return an unmodifiable mapped list that contains read-only versions of the list elements
// since read-only types and normal types are incompatible by design, we specify the lambda
// operation that converts an element into a read-only version of that element
if(this.childClasses == null) {
this.childClasses = VMappedList.newUnmodifiableInstance(mutableObject.getChildClasses(), (e)->e.asReadOnly());
}
return this.childClasses;
}
@Override
// property type is a model-type
public CodeRange getCodeRange() {
if(this.mutableObject.getCodeRange()!=null) {
return this.mutableObject.getCodeRange();
} else {
return null;
}
}
@Override
// generic type is a model-type
public VList getCustomProperties() {
// we return an unmodifiable mapped list that contains read-only versions of the list elements
// since read-only types and normal types are incompatible by design, we specify the lambda
// operation that converts an element into a read-only version of that element
if(this.customProperties == null) {
this.customProperties = VMappedList.newUnmodifiableInstance(mutableObject.getCustomProperties(), (e)->e.asReadOnly());
}
return this.customProperties;
}
@Override
// generic type is a model-type
public VList getCustomRuleAnnotations() {
// we return an unmodifiable mapped list that contains read-only versions of the list elements
// since read-only types and normal types are incompatible by design, we specify the lambda
// operation that converts an element into a read-only version of that element
if(this.customRuleAnnotations == null) {
this.customRuleAnnotations = VMappedList.newUnmodifiableInstance(mutableObject.getCustomRuleAnnotations(), (e)->e.asReadOnly());
}
return this.customRuleAnnotations;
}
@Override
// generic type is a model-type
public VList getDelegationMethods() {
// we return an unmodifiable mapped list that contains read-only versions of the list elements
// since read-only types and normal types are incompatible by design, we specify the lambda
// operation that converts an element into a read-only version of that element
if(this.delegationMethods == null) {
this.delegationMethods = VMappedList.newUnmodifiableInstance(mutableObject.getDelegationMethods(), (e)->e.asReadOnly());
}
return this.delegationMethods;
}
@Override
// property type is a model-type
public ReadOnlyGrammarModel getModel() {
if(this.mutableObject.getModel()!=null) {
return this.mutableObject.getModel().asReadOnly();
} else {
return null;
}
}
@Override
public java.lang.String getName() {
return this.mutableObject.getName();
}
@Override
// generic type is a model-type
public VList getProperties() {
// we return an unmodifiable mapped list that contains read-only versions of the list elements
// since read-only types and normal types are incompatible by design, we specify the lambda
// operation that converts an element into a read-only version of that element
if(this.properties == null) {
this.properties = VMappedList.newUnmodifiableInstance(mutableObject.getProperties(), (e)->e.asReadOnly());
}
return this.properties;
}
@Override
public boolean isRoot() {
return this.mutableObject.isRoot();
}
@Override
// property type is a model-type
public ReadOnlyRuleClass getSuperClass() {
if(this.mutableObject.getSuperClass()!=null) {
return this.mutableObject.getSuperClass().asReadOnly();
} else {
return null;
}
}
@Override
public VList getSuperInterfaces() {
if(this.superInterfaces == null) {
this.superInterfaces = this.mutableObject.getSuperInterfaces();
}
return this.superInterfaces;
}
// end for each property
@Override
public void addPropertyChangeListener(PropertyChangeListener l) {
((eu.mihosoft.vmf.runtime.core.internal.VObjectInternal)this.mutableObject).addPropertyChangeListener(l);
}
@Override
public void removePropertyChangeListener(PropertyChangeListener l) {
((eu.mihosoft.vmf.runtime.core.internal.VObjectInternal)this.mutableObject).removePropertyChangeListener(l);
}
@Override
public String toString() {
return this.mutableObject.toString();
}
@Override
public boolean equals(Object o) {
return this.mutableObject.equals(o);
}
@Override
public int hashCode() {
return this.mutableObject.hashCode();
}
@Override
public RuleClass _vmf_getMutableObject() {
return this.mutableObject;
}
@Override
public ReadOnlyRuleClassImpl asReadOnly() {
return this;
}
// --------------------------------------------------------------------
// --- Cloning
// --------------------------------------------------------------------
@Override
public ReadOnlyRuleClass clone() {
return this.mutableObject.clone().asReadOnly();
}
@Override
public RuleClass asModifiable() {
return this.mutableObject.clone();
}
@Override
public RuleClass _vmf_deepCopy(
java.util.IdentityHashMap