protected IndexedTriangleBuffer(ITransformationContext parent) { _parent = parent; _vertexStream = new float[8 * 65536]; _indexStream = new int[3 * 65536]; }
public void InitTestContext() { ruleT1 = new TestRuleT1(); ruleT2 = new TestRuleT2(); ruleTN = new TestRuleTN(); ruleDependent = new OtherRuleT1(); transformation = new MockTransformation(ruleT1, ruleT2, ruleTN, ruleDependent); transformation.Initialize(); context = CreateContext(transformation); trace = context.Trace; c_a = context.CallTransformation(ruleT1, new object[] { "a" }); c_b = context.CallTransformation(ruleT1, new object[] { "b" }); c_ab = context.CallTransformation(ruleT2, new object[] { "a", "b" }); c_bc = context.CallTransformation(ruleT2, new object[] { "b", "c" }); c_abc = context.CallTransformation(ruleTN, new object[] { "a", "b", "c" }); c_bcd = context.CallTransformation(ruleTN, new object[] { "b", "c", "d" }); c_a.InitializeOutput("b"); c_b.InitializeOutput(null); c_ab.InitializeOutput("c"); c_bc.InitializeOutput(null); c_abc.InitializeOutput("d"); c_bcd.InitializeOutput(null); }
public override void Transform(FSM.State input, Place output, ITransformationContext context) { var colored = output as ColoredPlace; if (colored != null && input.IsStartState) { colored.Tokens.Add(context.Bag.DefaultColor, 1); } }
public override PetriNet CreateOutput(FSM.FiniteStateMachine input, ITransformationContext context) { var coloredNet = new ColoredPetriNet(); var defaultColor = new Color(); coloredNet.Colors.Add(defaultColor); context.Bag.DefaultColor = defaultColor; return coloredNet; }
protected override List<IReference> GetImplementingReferences(IClass scope, ITransformationContext context) { var generatedType = context.Trace.ResolveIn(Rule<Class2Type>(), scope); var r2p = Rule<Reference2Property>(); return (from c in scope.Closure(c => c.BaseTypes) from r in c.References where generatedType.Members.Contains(context.Trace.ResolveIn(r2p, r)) select r).ToList(); }
protected override IEnumerable<IExpressionRewriter> GetRewriters( Expression expression, ITransformationContext context) { var originalRewriters = base.GetRewriters(expression, context); var customRewriters = this.GetCustomRewriters(expression, context); return originalRewriters.Concat(customRewriters); }
protected virtual IEnumerable<IExpressionRewriter> GetPostprocessingRewriters( Expression expression, ITransformationContext context) { yield return new SumTransformerVisitor(); yield return new ExcrescentInitializationCleanserVisitor(); yield return new ExcrescentSingleResultCleanserVisitor(); }
protected override IEnumerable<IExpressionRewriter> GetRewriters( Expression expression, ITransformationContext context) { foreach (IExpressionRewriter rewriter in base.GetRewriters(expression, context)) { yield return rewriter; } // Additional rewriters }
public static IncrementalPatternEngine GetForContext(ITransformationContext context) { if (context == null) throw new ArgumentNullException("context"); if (context.Data == null) throw new ArgumentException("Data container not set", "context"); object engine; if (context.Data.TryGetValue(_DataKey, out engine)) { return engine as IncrementalPatternEngine; } else { IncrementalPatternEngine _engine = new IncrementalPatternEngine(context); context.Data.Add(_DataKey, _engine); return _engine; } }
protected override Expression PostprocessExpression( Expression expression, ITransformationContext context) { expression = base.PostprocessExpression(expression, context); IEnumerable<IExpressionRewriter> rewriters = this.GetPostprocessingRewriters(expression, context); foreach (IExpressionRewriter rewriter in rewriters) { expression = rewriter.Rewrite(expression); } return expression; }
private static CodeTypeReference CreateTypeReference(ITypedElement typedElement, System.Action<CodeAttributeDeclaration> attributePersistor, System.Func<ITypedElement, CodeTypeReference, ITransformationContext, CodeTypeReference> getCollectionType, ITransformationContext context) { if (typedElement == null) return new CodeTypeReference(typeof(void)); CodeTypeReference elementType; var systemType = typedElement.Type as IPrimitiveType; if (systemType != null) { elementType = new CodeTypeReference(systemType.SystemType); } else { var type = typedElement.Type; bool isReference; if (type != null) { isReference = type is IReferenceType; } else { isReference = typedElement is IReference; } elementType = CreateReference(typedElement.Type, isReference, context); } if (typedElement.UpperBound == 1) { return elementType; } else { if (attributePersistor != null) { if (typedElement.LowerBound > 0) attributePersistor(new CodeAttributeDeclaration(new CodeTypeReference(typeof(LowerBoundAttribute).Name), new CodeAttributeArgument(new CodePrimitiveExpression(typedElement.LowerBound)))); if (typedElement.UpperBound > 1) attributePersistor(new CodeAttributeDeclaration(new CodeTypeReference(typeof(UpperBoundAttribute).Name), new CodeAttributeArgument(new CodePrimitiveExpression(typedElement.UpperBound)))); } if (getCollectionType == null) { return new CodeTypeReference(typeof(IEnumerable<>).Name, elementType); } else { return getCollectionType(typedElement, elementType, context); } } }
private IEnumerable<IExpressionRewriter> GetCustomRewriters( Expression expression, ITransformationContext context) { if (this.EnableOptimization) { yield return new InnerJoinLogicalRewriter(); yield return new OuterJoinLogicalRewriter(); } yield return new TableAccessRewriter(); if (this.EnableOptimization) { yield return new JoinPhysicalRewriter(); yield return new GroupJoinPhysicalRewriter(); } yield return new PropertyAccessRewriter(); yield break; }
public TransformationKind Visit(ICommentStatement statement, ITransformationContext context) { throw new NotImplementedException(); }
public DatabaseParameterRewriter(ITransformationContext context) { this.context = context; }
public TransformationKind Visit <TSignatureParameter, TSignature, TParent>(IMethodReferenceStub <TSignatureParameter, TSignature, TParent> member, ITransformationContext context) where TSignatureParameter : IMethodSignatureParameterMember <TSignatureParameter, TSignature, TParent> where TSignature : IMethodSignatureMember <TSignatureParameter, TSignature, TParent> where TParent : ISignatureParent <IGeneralGenericSignatureMemberUniqueIdentifier, TSignature, TSignatureParameter, TParent> { throw new NotImplementedException(); }
public override Transition CreateOutput(FSM.Transition input, ITransformationContext context) { return new PN.ColoredTransition() { Color = context.Bag.DefaultColor }; }
public TransformationKind Visit <TMethod, TIntermediateMethod, TMethodParent, TIntermediateMethodParent>(IIntermediateMethodMember <TMethod, TIntermediateMethod, TMethodParent, TIntermediateMethodParent> method, ITransformationContext context) where TMethod : IMethodMember <TMethod, TMethodParent> where TIntermediateMethod : IIntermediateMethodMember <TMethod, TIntermediateMethod, TMethodParent, TIntermediateMethodParent>, TMethod where TMethodParent : IMethodParent <TMethod, TMethodParent> where TIntermediateMethodParent : IIntermediateMethodParent <TMethod, TIntermediateMethod, TMethodParent, TIntermediateMethodParent>, TMethodParent { throw new NotImplementedException(); }
private Fam.Female LookupFemale(string name, ITransformationContext context) { return context.Trace.FindWhere<Ps.Person, Fam.Female>(f => f.FirstName == name).FirstOrDefault(); }
/// <summary> /// Creates a reference to the given NMeta type /// </summary> /// <param name="type">The NMeta type</param> /// <param name="isReference">A value indicating whether to default to IModelElement or object</param> /// <param name="context">The transformation context</param> /// <returns>A code type reference</returns> protected static CodeTypeReference CreateReference(IType type, bool isReference, ITransformationContext context) { if (type != null) { var declaration = context.Trace.ResolveIn((Type2Type)context.Transformation.GetRuleForRuleType(typeof(Type2Type)), type); if (declaration != null) { return CodeDomHelper.GetReferenceForType(declaration); } } var primitiveType = type as IPrimitiveType; if (primitiveType != null) { return new CodeTypeReference(primitiveType.SystemType); } if (isReference) { return typeof(IModelElement).ToTypeReference(); } else { return new CodeTypeReference(typeof(object)); } }
public TransformationKind Visit(IIntermediateNamespaceDeclaration @namespace, ITransformationContext context) { throw new NotImplementedException(); }
public TransformationKind Visit(IIntermediateAssembly assembly, ITransformationContext context) { throw new NotImplementedException(); }
public TransformationKind Visit(ILinqRangeVariable rangeVariable, ITransformationContext context) { throw new NotImplementedException(); }
public TransformationKind Visit <TParent, TIntermediateParent>(IIntermediateParameterMember <TParent, TIntermediateParent> parameter, ITransformationContext context) where TParent : IParameterParent where TIntermediateParent : TParent, IIntermediateParameterParent { throw new NotImplementedException(); }
public TransformationKind Visit <TProperty, TIntermediateProperty, TPropertyParent, TIntermediatePropertyParent>(IIntermediatePropertyMember <TProperty, TIntermediateProperty, TPropertyParent, TIntermediatePropertyParent> property, ITransformationContext context) where TProperty : IPropertyMember <TProperty, TPropertyParent> where TIntermediateProperty : TProperty, IIntermediatePropertyMember <TProperty, TIntermediateProperty, TPropertyParent, TIntermediatePropertyParent> where TPropertyParent : IPropertyParent <TProperty, TPropertyParent> where TIntermediatePropertyParent : TPropertyParent, IIntermediatePropertyParent <TProperty, TIntermediateProperty, TPropertyParent, TIntermediatePropertyParent> { throw new NotImplementedException(); }
public TransformationKind Visit <TSignature, TIntermediateSignature, TParent, TIntermediateParent>(IIntermediateMethodSignatureMember <TSignature, TIntermediateSignature, TParent, TIntermediateParent> methodSignature, ITransformationContext context) where TSignature : IMethodSignatureMember <TSignature, TParent> where TIntermediateSignature : TSignature, IIntermediateMethodSignatureMember <TSignature, TIntermediateSignature, TParent, TIntermediateParent> where TParent : IMethodSignatureParent <TSignature, TParent> where TIntermediateParent : TParent, IIntermediateMethodSignatureParent <TSignature, TIntermediateSignature, TParent, TIntermediateParent> { throw new NotImplementedException(); }
public TransformationKind Visit <TField, TIntermediateField, TFieldParent, TIntermediateFieldParent>(IIntermediateFieldMember <TField, TIntermediateField, TFieldParent, TIntermediateFieldParent> field, ITransformationContext context) where TField : IFieldMember <TField, TFieldParent> where TIntermediateField : TField, IIntermediateFieldMember <TField, TIntermediateField, TFieldParent, TIntermediateFieldParent> where TFieldParent : IFieldParent <TField, TFieldParent> where TIntermediateFieldParent : TFieldParent, IIntermediateFieldParent <TField, TIntermediateField, TFieldParent, TIntermediateFieldParent> { throw new NotImplementedException(); }
/// <summary> /// Creates a new computation context for the given transformation context /// </summary> /// <param name="context">The transformation context</param> public ComputationContext(ITransformationContext context) { this.context = context; }
public TransformationKind Visit(IIntermediateClassType @class, ITransformationContext context) { throw new NotImplementedException(); }
/// <summary> /// Initializes the transformation output /// </summary> /// <param name="input">The input of the transformation rule</param> /// <param name="context">The context (and trace!) object</param> /// <remarks>At this point, all the transformation outputs are created (also the delayed ones), thus, the trace is fully reliable</remarks> public abstract void Transform(object[] input, ITransformationContext context);
public TransformationKind Visit(IIntermediateDelegateType @delegate, ITransformationContext context) { throw new NotImplementedException(); }
public TransformationKind Visit <TEvent, TEventParameter, TEventParent, TSignatureParameter, TSignature, TSignatureParent>(IBoundChangeEventSignatureHandlerStatement <TEvent, TEventParameter, TEventParent, TSignatureParameter, TSignature, TSignatureParent> statement, ITransformationContext context) where TEvent : IEventSignatureMember <TEvent, TEventParameter, TEventParent> where TEventParameter : IEventSignatureParameterMember <TEvent, TEventParameter, TEventParent> where TEventParent : IEventSignatureParent <TEvent, TEventParameter, TEventParent> where TSignatureParameter : IMethodSignatureParameterMember <TSignatureParameter, TSignature, TSignatureParent> where TSignature : IMethodSignatureMember <TSignatureParameter, TSignature, TSignatureParent> where TSignatureParent : ISignatureParent <IGeneralGenericSignatureMemberUniqueIdentifier, TSignature, TSignatureParameter, TSignatureParent> { throw new NotImplementedException(); }
public TransformationKind Visit(IIntermediateEnumType @enum, ITransformationContext context) { throw new NotImplementedException(); }
private void HandleNonDelayedComputation(Computation computation, ITransformationContext context) { var output = computation.Output; var inCollection = Selector(computation); if (inCollection != null) { if (Persistor != null) { Type listType = (typeof(List<>)).MakeGenericType(DependencyTransformation.OutputType); IList list = System.Activator.CreateInstance(listType) as IList; MultipleResultAwaitingPersistor delayPersistor = new MultipleResultAwaitingPersistor() { List = list, Persistor = Persistor, Target = output }; bool needDependencyPersistor = false; GeneralTransformationRule dependent = DependencyTransformation; if (context.IsThreadSafe) { Parallel.ForEach(inCollection, dependencyInput => { if (HandleNonDelayedPersistedDependencyInput(computation, context, list, delayPersistor, dependent, dependencyInput)) { needDependencyPersistor = true; } }); } else { foreach (var dependencyInput in inCollection) { if (HandleNonDelayedPersistedDependencyInput(computation, context, list, delayPersistor, dependent, dependencyInput)) { needDependencyPersistor = true; } } } if (!needDependencyPersistor) Persistor(output, list); } else { GeneralTransformationRule dependent = DependencyTransformation; if (context.IsThreadSafe) { Parallel.ForEach(inCollection, dependencyInput => { var comp2 = context.CallTransformation(dependent, dependencyInput); computation.MarkRequireInternal(comp2, ExecuteBefore, this); }); } else { foreach (var dependencyInput in inCollection) { var comp2 = context.CallTransformation(dependent, dependencyInput); computation.MarkRequireInternal(comp2, ExecuteBefore, this); } } } } }
public TransformationKind Visit(IIntermediateInterfaceType @interface, ITransformationContext context) { throw new NotImplementedException(); }
public override Place CreateOutput(FSM.State input, ITransformationContext context) { return new ColoredPlace(); }
public TransformationKind Visit(IIntermediateStructType @struct, ITransformationContext context) { throw new NotImplementedException(); }
public TransformationKind Visit(ILocalMember local, ITransformationContext context) { throw new NotImplementedException(); }
public TransformationKind Visit <TGenericParameter, TIntermediateGenericParameter, TParent, TIntermediateParent>(IIntermediateGenericParameter <TGenericParameter, TIntermediateGenericParameter, TParent, TIntermediateParent> parameter, ITransformationContext context) where TGenericParameter : IGenericParameter <TGenericParameter, TParent> where TIntermediateGenericParameter : TGenericParameter, IIntermediateGenericParameter <TGenericParameter, TIntermediateGenericParameter, TParent, TIntermediateParent> where TParent : IGenericParamParent <TGenericParameter, TParent> where TIntermediateParent : TParent, IIntermediateGenericParameterParent <TGenericParameter, TIntermediateGenericParameter, TParent, TIntermediateParent> { throw new NotImplementedException(); }
ITransformationPatternContext ITransformationPattern.CreatePattern(ITransformationContext context) { Context = context; return this; }
public TransformationKind Visit(IMethodReferenceStub member, ITransformationContext context) { throw new NotImplementedException(); }
/// <summary> /// Creates the uninitialized output type declaration /// </summary> /// <param name="scope">The scope in which the reference is refined</param> /// <param name="context">The transformation context</param> /// <returns>The newly created code type declaration</returns> public override CodeTypeDeclaration CreateOutput(IClass scope, ITransformationContext context) { if (!scope.References.Any()) return null; return CodeDomHelper.CreateTypeDeclarationWithReference(scope.Name.ToPascalCase() + "ReferencedElementsCollection"); }
public TransformationKind Visit(IDefaultValueExpression member, ITransformationContext context) { throw new NotImplementedException(); }
private IncrementalPatternEngine(ITransformationContext context) { Patterns = new List<IncrementalPatternContext>(); context.ComputationCompleted += context_ComputationCompleted; }
public TransformationKind Visit(IPrimitiveExpression <float> expression, ITransformationContext context) { return(TransformationKind.Ignore); }
public TaskParallelComputationContext(ITransformationContext context) : base(context) { transformTask = new Task(Transform); }
public TransformationKind Visit(INamespaceInclusionScopeCoercion namespaceInclusion, ITransformationContext context) { throw new NotImplementedException(); }
public ParallelComputationContext(ITransformationContext context) : base(context) { }
public TransformationKind Visit <TCtor, TIntermediateCtor, TType, TIntermediateType>(IIntermediateConstructorMember <TCtor, TIntermediateCtor, TType, TIntermediateType> ctor, ITransformationContext context) where TCtor : IConstructorMember <TCtor, TType> where TIntermediateCtor : TCtor, IIntermediateConstructorMember <TCtor, TIntermediateCtor, TType, TIntermediateType> where TType : ICreatableParent <TCtor, TType> where TIntermediateType : TType, IIntermediateCreatableParent <TCtor, TIntermediateCtor, TType, TIntermediateType> { throw new NotImplementedException(); }
public StoredProcedureParameterRewriter(ITransformationContext context) { this.context = context; }
/// <summary> /// Creates a new mocked computation /// </summary> /// <param name="input">The input for the mocked computation</param> /// <param name="rule">The transformation rule for the mocked computation</param> /// <param name="context">The transformation context</param> public MockComputation(object[] input, GeneralTransformationRule rule, ITransformationContext context) : this(input, rule, new ComputationContext(context)) { }
public PositionColorLineListBuffer(ITransformationContext parent) { _parent = parent; _vertexStream = new float[8 + 32 * FloatsPerLine]; }
public TransformationKind Visit(IIntermediateEnumFieldMember field, ITransformationContext context) { throw new NotImplementedException(); }
public TransformationKind Visit <TCoercionParent>(IUnaryOperatorCoercionMember <TCoercionParent> unaryCoercion, ITransformationContext context) where TCoercionParent : ICoercibleType <IUnaryOperatorUniqueIdentifier, IUnaryOperatorCoercionMember <TCoercionParent>, TCoercionParent> { throw new NotImplementedException(); }
public TransformationKind Visit <TIndexer, TIntermediateIndexer, TIndexerParent, TIntermediateIndexerParent>(IIntermediateIndexerSignatureMember <TIndexer, TIntermediateIndexer, TIndexerParent, TIntermediateIndexerParent> indexerSignature, ITransformationContext context) where TIndexer : IIndexerSignatureMember <TIndexer, TIndexerParent> where TIntermediateIndexer : TIndexer, IIntermediateIndexerSignatureMember <TIndexer, TIntermediateIndexer, TIndexerParent, TIntermediateIndexerParent> where TIndexerParent : IIndexerSignatureParent <TIndexer, TIndexerParent> where TIntermediateIndexerParent : TIndexerParent, IIntermediateIndexerSignatureParent <TIndexer, TIntermediateIndexer, TIndexerParent, TIntermediateIndexerParent> { throw new NotImplementedException(); }
public TransformationKind Visit(INewLineExpression expression, ITransformationContext context) { return(TransformationKind.Ignore); }
private void HandleDelayedDependencyInput(Computation computation, ITransformationContext context, IList list, MultipleResultAwaitingPersistor delayPersistor, object[] dependencyInput) { GeneralTransformationRule dependent = DependencyTransformation; var comp2 = context.CallTransformation(dependent, dependencyInput); if (!comp2.IsDelayed) { if (comp2.Output != null) { if (context.IsThreadSafe) { lock (list) { list.Add(comp2.Output); } } else { list.Add(comp2.Output); } } } else { computation.DelayOutputAtLeast(comp2.Context.MinOutputDelayLevel); delayPersistor.WaitFor(comp2); } if (ExecuteBefore) { computation.DelayTransformationAtLeast(comp2.Context.MinTransformDelayLevel); } else { comp2.DelayTransformationAtLeast(computation.Context.MinTransformDelayLevel); } }
public TransformationKind Visit(ITypeInclusionRenameScopeCoercion renamedTypeInclusion, ITransformationContext context) { throw new NotImplementedException(); }
public TransformationKind Visit <TEvent, TIntermediateEvent, TEventParent, TIntermediateEventParent>(IIntermediateEventSignatureMember <TEvent, TIntermediateEvent, TEventParent, TIntermediateEventParent> @event, ITransformationContext context) where TEvent : IEventSignatureMember <TEvent, TEventParent> where TIntermediateEvent : TEvent, IIntermediateEventSignatureMember <TEvent, TIntermediateEvent, TEventParent, TIntermediateEventParent> where TEventParent : IEventSignatureParent <TEvent, TEventParent> where TIntermediateEventParent : TEventParent, IIntermediateEventSignatureParent <TEvent, TIntermediateEvent, TEventParent, TIntermediateEventParent> { throw new NotImplementedException(); }
public PositionNormalUIndexedTriangleBuffer(ITransformationContext parent) : base(parent) { }
public TransformationKind Visit(IStaticInclusionScopeCoercion staticInclusion, ITransformationContext context) { throw new NotImplementedException(); }