use of org.whole.lang.models.model.Model in project whole by wholeplatform.
the class ModelFragmentsBuilderTest method testModelFeaturesBuilderWithFeatureEvents.
@Test
public void testModelFeaturesBuilderWithFeatureEvents() {
ITemplateFactory<Model> modelsModel = new ModelsModelWithFeatureEvents();
Features features = ModelsEntityFactory.instance.createFeatures(0);
modelsModel.apply(new SpecificBuilderAdapterOperation(new ModelFeaturesBuilder(features)));
int count = 0;
Model model = modelsModel.create();
AbstractPatternFilterIterator<Feature> i = IteratorFactory.<Feature>descendantOrSelfMatcherIterator().withPattern(ModelsEntityDescriptorEnum.Feature);
i.reset(model);
for (Feature feature : i) if (EntityUtils.isNotResolver(feature))
count++;
assertEquals(features.wSize(), count);
}
use of org.whole.lang.models.model.Model in project whole by wholeplatform.
the class ModelFragmentsBuilderTest method testModelFeaturesBuilder.
@Test
public void testModelFeaturesBuilder() {
ITemplateFactory<Model> modelsModel = new ModelsModel();
final Features features = ModelsEntityFactory.instance.createFeatures(0);
modelsModel.apply(new SpecificBuilderAdapterOperation(new ModelFeaturesBuilder(features)));
int count = 0;
Model model = modelsModel.create();
AbstractPatternFilterIterator<Feature> i = IteratorFactory.<Feature>descendantOrSelfMatcherIterator().withPattern(ModelsEntityDescriptorEnum.Feature);
i.reset(model);
for (Feature feature : i) if (EntityUtils.isNotResolver(feature))
count++;
assertEquals(features.wSize(), count);
}
use of org.whole.lang.models.model.Model in project whole by wholeplatform.
the class GrammarsUtilsTest method testGrammarToModelMapping.
@Test
public void testGrammarToModelMapping() {
Model m = new XmlModel().create();
Grammar g = new XmlGrammar().create();
Model m1 = GrammarsUtils.deriveModel(g, true);
Assert.assertTrue(Matcher.match(m, m1));
}
use of org.whole.lang.models.model.Model in project whole by wholeplatform.
the class ModelsJavaModelGeneratorVisitor method visit.
public void visit(Model modelOrig) {
Model model = EntityUtils.clone(modelOrig);
modelInfo = new ModelInfo(model);
modelInfo.addInheritedFeatures(model);
modelInfo.addUndeclaredTypes(model);
modelInfo.sortFeatures(model);
beforeModel(model);
modelsGen.visitorsBuilder();
modelsGen.entityInterfaceBuilder();
modelsGen.entityFactoryBuilder();
if (hasUI)
modelsGen.partFactoryVisitorBuilder();
model.getDeclarations().accept(this);
model.getTypeRelations().accept(this);
// modelsGen.applyTypeDeclarations();
afterModel();
}
use of org.whole.lang.models.model.Model in project whole by wholeplatform.
the class GrammarsJavaModelGeneratorVisitor method visit.
@Override
public void visit(Grammar entity) {
TargetLanguage targetLanguage = entity.getTargetLanguage();
if (Matcher.match(GrammarsEntityDescriptorEnum.LanguageDescriptor, targetLanguage)) {
Model targetModel = GrammarsUtils.deriveModel(entity, true);
stagedVisit(targetModel);
}
}
Aggregations