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.GrammarModel}.
*/
@SuppressWarnings("deprecation")
class ReadOnlyGrammarModelImpl implements ReadOnlyGrammarModel, eu.mihosoft.vmf.runtime.core.internal.VObjectInternal, VCloneableInternal {
private final GrammarModel 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 customRules;
private VList ruleClasses;
public ReadOnlyGrammarModelImpl(GrammarModel mutableObject) {
this.mutableObject = mutableObject;
}
@Override
// generic type is a model-type
public VList getCustomRules() {
// 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.customRules == null) {
this.customRules = VMappedList.newUnmodifiableInstance(mutableObject.getCustomRules(), (e)->e.asReadOnly());
}
return this.customRules;
}
@Override
public java.lang.String getGrammarName() {
return this.mutableObject.getGrammarName();
}
@Override
public java.lang.String getPackageName() {
return this.mutableObject.getPackageName();
}
@Override
// generic type is a model-type
public VList getRuleClasses() {
// 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.ruleClasses == null) {
this.ruleClasses = VMappedList.newUnmodifiableInstance(mutableObject.getRuleClasses(), (e)->e.asReadOnly());
}
return this.ruleClasses;
}
@Override
// property type is a model-type
public ReadOnlyTypeMappings getTypeMappings() {
if(this.mutableObject.getTypeMappings()!=null) {
return this.mutableObject.getTypeMappings().asReadOnly();
} else {
return null;
}
}
// 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 GrammarModel _vmf_getMutableObject() {
return this.mutableObject;
}
@Override
public ReadOnlyGrammarModelImpl asReadOnly() {
return this;
}
// --------------------------------------------------------------------
// --- Cloning
// --------------------------------------------------------------------
@Override
public ReadOnlyGrammarModel clone() {
return this.mutableObject.clone().asReadOnly();
}
@Override
public GrammarModel asModifiable() {
return this.mutableObject.clone();
}
@Override
public GrammarModel _vmf_deepCopy(
java.util.IdentityHashMap