use of org.whole.lang.models.model.ModelDeclaration in project whole by wholeplatform.
the class ModelsValidatorVisitor method visit.
@Override
public void visit(ModelDeclarations entity) {
for (int i = 0; i < entity.wSize(); i++) {
ModelDeclaration decl = (ModelDeclaration) entity.wGet(i);
currentEntity = decl;
decl.accept(this);
}
}
use of org.whole.lang.models.model.ModelDeclaration in project whole by wholeplatform.
the class ResolversTest method testSimpleEntityResolverTighteningByIndex.
@Test
public void testSimpleEntityResolverTighteningByIndex() {
ModelDeclaration modelDeclaration = createResolver(ModelsEntityDescriptorEnum.ModelDeclaration);
ModelDeclarations modelDeclarations = mf.createModelDeclarations(modelDeclaration);
int index = ModelsEntityDescriptorEnum.ModelDeclaration.indexOf(ModelsFeatureDescriptorEnum.name);
try {
modelDeclaration.wSet(index, mf.createSimpleName("testName"));
Assert.fail();
} catch (IllegalArgumentException e) {
}
}
use of org.whole.lang.models.model.ModelDeclaration in project whole by wholeplatform.
the class ResolversTest method testSimpleEntityResolverTighteningByFD.
@Test
public void testSimpleEntityResolverTighteningByFD() {
ModelDeclaration modelDeclaration = createResolver(ModelsEntityDescriptorEnum.ModelDeclaration);
ModelDeclarations modelDeclarations = mf.createModelDeclarations(modelDeclaration);
modelDeclaration.wSet(ModelsFeatureDescriptorEnum.name, mf.createSimpleName("testName"));
Assert.assertTrue(EntityUtils.isResolver(modelDeclaration));
modelDeclaration.wSet(ModelsFeatureDescriptorEnum.componentType, mf.createSimpleName("testTypeName"));
Assert.assertTrue(Matcher.matchImpl(ModelsEntityDescriptorEnum.CompositeEntity, modelDeclarations.wGet(0)));
}
use of org.whole.lang.models.model.ModelDeclaration in project whole by wholeplatform.
the class Grammars2ModelsVisitor method visit.
@Override
public void visit(Productions entity) {
ModelsEntityFactory mf = ModelsEntityFactory.instance;
ScannerIterator<Production> i = IteratorFactory.<Production>childScannerIterator();
i.reset(entity);
for (Production p : i) {
String eName = getMappedEntityName(p);
ModelDeclaration mDecl = CommonsEntityAdapterFactory.createResolver(ModelsEntityDescriptorEnum.ModelDeclaration);
productionMap.put(p.getName().getValue(), p);
declarationMap.put(eName, mDecl);
modelDeclarations.wAdd(mDecl);
mDecl.setModifiers(mf.createEntityModifiers());
mDecl.setName(mf.createSimpleName(eName));
mDecl.setTypes(mf.createTypes());
}
super.visit(entity);
}
use of org.whole.lang.models.model.ModelDeclaration in project whole by wholeplatform.
the class Grammars2ModelsVisitor method getModelDeclaration.
protected <T extends ModelDeclaration> T getModelDeclaration(String name, EntityDescriptor<T> ed) {
ModelDeclaration e = declarationMap.get(name);
T result = e.wResolveWith(ed);
if (result != e)
declarationMap.put(name, result);
return result;
}
Aggregations