Search in sources :

Example 1 with WalkerState

use of org.finos.legend.pure.m3.compiler.unload.walk.WalkerState in project legend-pure by finos.

the class IncrementalCompiler_Old method walkTheGraphForUnload.

private SetIterable<CoreInstance> walkTheGraphForUnload() {
    WalkerState walkerState = new WalkerState(this.processorSupport);
    Matcher walkerMatcher = new Matcher(this.modelRepository, this.context, this.processorSupport);
    this.library.getParsers().asLazy().flatCollect(Parser::getUnLoadWalkers).concatenate(this.dslLibrary.getInlineDSLs().asLazy().flatCollect(InlineDSL::getUnLoadWalkers)).forEach(walkerMatcher::addMatchIfTypeIsKnown);
    this.toUnload.forEach(i -> walkerMatcher.match(i, walkerState));
    return walkerState.getInstances();
}
Also used : WalkerState(org.finos.legend.pure.m3.compiler.unload.walk.WalkerState) Matcher(org.finos.legend.pure.m3.tools.matcher.Matcher) InlineDSL(org.finos.legend.pure.m3.serialization.grammar.m3parser.inlinedsl.InlineDSL) Parser(org.finos.legend.pure.m3.serialization.grammar.Parser) TopParser(org.finos.legend.pure.m3.serialization.grammar.top.TopParser)

Example 2 with WalkerState

use of org.finos.legend.pure.m3.compiler.unload.walk.WalkerState in project legend-pure by finos.

the class ProfileUnloaderWalk method run.

@Override
public void run(Profile profile, MatcherState state, Matcher matcher, ModelRepository modelRepository, Context context) throws PureCompilationException {
    WalkerState walkerState = (WalkerState) state;
    walkerState.addInstance(profile);
    for (Tag tag : profile._p_tags()) {
        for (AnnotatedElement modelElement : tag._modelElements()) {
            matcher.fullMatch(modelElement, state);
        }
    }
    for (Stereotype stereotype : profile._p_stereotypes()) {
        for (AnnotatedElement modelElement : stereotype._modelElements()) {
            matcher.fullMatch(modelElement, state);
        }
    }
}
Also used : AnnotatedElement(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.AnnotatedElement) Stereotype(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Stereotype) Tag(org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Tag)

Example 3 with WalkerState

use of org.finos.legend.pure.m3.compiler.unload.walk.WalkerState in project legend-pure by finos.

the class IncrementalCompiler_New method walkTheGraphForUnload.

private MutableSet<CoreInstance> walkTheGraphForUnload(MutableSet<CoreInstance> instances) {
    WalkerState walkerState = new WalkerState(this.processorSupport);
    Matcher walkerMatcher = new Matcher(this.modelRepository, this.context, this.processorSupport);
    this.library.getParsers().asLazy().flatCollect(Parser::getUnLoadWalkers).concatenate(this.dslLibrary.getInlineDSLs().asLazy().flatCollect(InlineDSL::getUnLoadWalkers)).forEach(walkerMatcher::addMatchIfTypeIsKnown);
    instances.forEach(i -> walkerMatcher.match(i, walkerState));
    return walkerState.getInstances().toSet();
}
Also used : WalkerState(org.finos.legend.pure.m3.compiler.unload.walk.WalkerState) Matcher(org.finos.legend.pure.m3.tools.matcher.Matcher) InlineDSL(org.finos.legend.pure.m3.serialization.grammar.m3parser.inlinedsl.InlineDSL) Parser(org.finos.legend.pure.m3.serialization.grammar.Parser) TopParser(org.finos.legend.pure.m3.serialization.grammar.top.TopParser)

Example 4 with WalkerState

use of org.finos.legend.pure.m3.compiler.unload.walk.WalkerState in project legend-pure by finos.

the class MappingUnloaderWalk method run.

@Override
public void run(Mapping mapping, MatcherState state, Matcher matcher, ModelRepository modelRepository, Context context) throws PureCompilationException {
    WalkerState walkerState = (WalkerState) state;
    walkerState.addInstance(mapping);
    for (SetImplementation classMapping : mapping._classMappings()) {
        matcher.fullMatch(classMapping, state);
    }
    for (EnumerationMapping enumerationMapping : mapping._enumerationMappings()) {
        matcher.fullMatch(enumerationMapping, state);
    }
    for (AssociationImplementation associationMapping : mapping._associationMappings()) {
        matcher.fullMatch(associationMapping, state);
    }
}
Also used : WalkerState(org.finos.legend.pure.m3.compiler.unload.walk.WalkerState) EnumerationMapping(org.finos.legend.pure.m3.coreinstance.meta.pure.mapping.EnumerationMapping) AssociationImplementation(org.finos.legend.pure.m3.coreinstance.meta.pure.mapping.AssociationImplementation) SetImplementation(org.finos.legend.pure.m3.coreinstance.meta.pure.mapping.SetImplementation)

Example 5 with WalkerState

use of org.finos.legend.pure.m3.compiler.unload.walk.WalkerState in project legend-pure by finos.

the class DiagramUnloaderWalk method run.

@Override
public void run(Diagram diagram, MatcherState state, Matcher matcher, ModelRepository modelRepository, Context context) throws PureCompilationException {
    WalkerState walkerState = (WalkerState) state;
    walkerState.addInstance(diagram);
    walkerState.addInstances(diagram._typeViewsCoreInstance());
    walkerState.addInstances(diagram._associationViews());
    walkerState.addInstances(diagram._propertyViews());
    walkerState.addInstances(diagram._generalizationViews());
}
Also used : WalkerState(org.finos.legend.pure.m3.compiler.unload.walk.WalkerState)

Aggregations

WalkerState (org.finos.legend.pure.m3.compiler.unload.walk.WalkerState)4 Matcher (org.finos.legend.pure.m3.tools.matcher.Matcher)3 Parser (org.finos.legend.pure.m3.serialization.grammar.Parser)2 InlineDSL (org.finos.legend.pure.m3.serialization.grammar.m3parser.inlinedsl.InlineDSL)2 TopParser (org.finos.legend.pure.m3.serialization.grammar.top.TopParser)2 Lists (org.eclipse.collections.api.factory.Lists)1 MutableList (org.eclipse.collections.api.list.MutableList)1 Context (org.finos.legend.pure.m3.compiler.Context)1 MilestoningFunctions (org.finos.legend.pure.m3.compiler.postprocessing.processor.milestoning.MilestoningFunctions)1 AssociationImplementation (org.finos.legend.pure.m3.coreinstance.meta.pure.mapping.AssociationImplementation)1 EnumerationMapping (org.finos.legend.pure.m3.coreinstance.meta.pure.mapping.EnumerationMapping)1 SetImplementation (org.finos.legend.pure.m3.coreinstance.meta.pure.mapping.SetImplementation)1 PropertyOwner (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.PropertyOwner)1 AnnotatedElement (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.AnnotatedElement)1 Stereotype (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Stereotype)1 Tag (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.extension.Tag)1 AbstractProperty (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.property.AbstractProperty)1 Association (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.Association)1 AssociationProjection (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.relationship.AssociationProjection)1 Class (org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.type.Class)1