Search Results for

    Show / Hide Table of Contents

    Class StackContext

    A transformation context whose state at a point in the transformation is given by a stack.

    Inheritance
    Object
    StackContext
    BasicTransformContext
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Microsoft.ML.Probabilistic.Compiler
    Assembly: Microsoft.ML.Probabilistic.Compiler.dll
    Syntax
    public class StackContext

    Fields

    InputStack

    Stack holding transformation info for elements on the path down the input tree to the input cursor (the location currently being transformed).

    Declaration
    public List<TransformInfo> InputStack
    Field Value
    Type Description
    List<TransformInfo>

    Properties

    Depth

    The depth of the current point in the transformation

    Declaration
    public int Depth { get; }
    Property Value
    Type Description
    Int32

    Methods

    AddStatementAfter(IStatement, IStatement)

    Adds a statement after the statement which is currently being processed.

    Declaration
    public void AddStatementAfter(IStatement ancestorStatement, IStatement statementToAdd)
    Parameters
    Type Name Description
    IStatement ancestorStatement
    IStatement statementToAdd

    AddStatementAfterAncestorIndex(Int32, IStatement, Boolean)

    Adds a statement after the ancestor statement at the specified index, optionally converting the statement before it is added.

    Declaration
    public virtual void AddStatementAfterAncestorIndex(int ancestorIndex, IStatement statementToAdd, bool convertBeforeAdding = false)
    Parameters
    Type Name Description
    Int32 ancestorIndex
    IStatement statementToAdd
    Boolean convertBeforeAdding

    AddStatementAfterCurrent(IStatement)

    Adds a statement which will be inserted after the current statement has been transformed.

    Declaration
    public void AddStatementAfterCurrent(IStatement statementToAdd)
    Parameters
    Type Name Description
    IStatement statementToAdd

    AddStatementBeforeAncestorIndex(Int32, IStatement, Boolean)

    Adds a statement immediately before the output element for the ancestor index given.

    Declaration
    public virtual void AddStatementBeforeAncestorIndex(int ancInd, IStatement stmt, bool convertBeforeAdding = false)
    Parameters
    Type Name Description
    Int32 ancInd
    IStatement stmt
    Boolean convertBeforeAdding

    AddStatementBeforeCurrent(IStatement)

    Adds a statement immediately before the statement currently being processed.

    Declaration
    public virtual void AddStatementBeforeCurrent(IStatement statementToAdd)
    Parameters
    Type Name Description
    IStatement statementToAdd

    AddStatementsAfter(IStatement, IEnumerable<IStatement>)

    Adds a collection of statements after the statement which is currently being processed.

    Declaration
    public void AddStatementsAfter(IStatement ancestorStatement, IEnumerable<IStatement> statementsToAdd)
    Parameters
    Type Name Description
    IStatement ancestorStatement
    IEnumerable<IStatement> statementsToAdd

    AddStatementsAfterAncestorIndex(Int32, IEnumerable<IStatement>, Boolean)

    Adds mulitple statements after the ancestor statement at the specified index, optionally converting the statement before it is added.

    Declaration
    public void AddStatementsAfterAncestorIndex(int ancestorIndex, IEnumerable<IStatement> statementsToAdd, bool convertBeforeAdding = false)
    Parameters
    Type Name Description
    Int32 ancestorIndex
    IEnumerable<IStatement> statementsToAdd
    Boolean convertBeforeAdding

    AddStatementsAfterCurrent(IEnumerable<IStatement>)

    Declaration
    public void AddStatementsAfterCurrent(IEnumerable<IStatement> statementsToAdd)
    Parameters
    Type Name Description
    IEnumerable<IStatement> statementsToAdd

    AddStatementsBeforeAncestorIndex(Int32, IEnumerable<IStatement>, Boolean)

    Adds statements immediately before the output element for the ancestor index given.

    Declaration
    public void AddStatementsBeforeAncestorIndex(int ancInd, IEnumerable<IStatement> stmts, bool convertBeforeAdding = false)
    Parameters
    Type Name Description
    Int32 ancInd
    IEnumerable<IStatement> stmts
    Boolean convertBeforeAdding

    AddStatementsBeforeCurrent(IEnumerable<IStatement>)

    Declaration
    public void AddStatementsBeforeCurrent(IEnumerable<IStatement> statementsToAdd)
    Parameters
    Type Name Description
    IEnumerable<IStatement> statementsToAdd

    FindAncestor<T>()

    Finds the closest ancestor of the specified type (or assignable to that type) in the input path.

    Declaration
    public T FindAncestor<T>()
        where T : class
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    FindAncestorIndex<T>()

    Finds the index of the closest ancestor of the specified type (or assignable to that type) in the input path, or -1 if none.

    Declaration
    public int FindAncestorIndex<T>()
    Returns
    Type Description
    Int32
    Type Parameters
    Name Description
    T

    FindAncestorNotSelf<T>()

    Finds the closest ancestor of the specified type (or assignable to that type) in the input path, excluding the current item.

    Declaration
    public T FindAncestorNotSelf<T>()
        where T : class
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    FindAncestorNotSelfIndex<T>()

    Finds the index of the closest ancestor of the specified type (or assignable to that type) in the input path.

    Declaration
    public int FindAncestorNotSelfIndex<T>()
    Returns
    Type Description
    Int32
    Type Parameters
    Name Description
    T

    FindAncestors<T>()

    Finds all ancestors assignable to type T, in high-to-low order.

    Declaration
    public List<T> FindAncestors<T>()
    Returns
    Type Description
    List<T>
    Type Parameters
    Name Description
    T

    FindAncestors<T>(Int32)

    Finds all ancestors assignable to type T, in high-to-low order, up to and excluding the specified ancestor index.

    Declaration
    public List<T> FindAncestors<T>(int ancIndex)
    Parameters
    Type Name Description
    Int32 ancIndex
    Returns
    Type Description
    List<T>
    Type Parameters
    Name Description
    T

    FindAncestorsBelow<T>(Int32)

    Finds all ancestors assignable to type T, in high-to-low order, whose index is greater than the specified ancestor index.

    Declaration
    public List<T> FindAncestorsBelow<T>(int ancIndex)
    Parameters
    Type Name Description
    Int32 ancIndex
    Returns
    Type Description
    List<T>
    Type Parameters
    Name Description
    T

    FindOutputForAncestor<TAnc, TTransformed>()

    Returns the transformed output for the closest ancestor of the specified type.

    Declaration
    public TTransformed FindOutputForAncestor<TAnc, TTransformed>()
    Returns
    Type Description
    TTransformed
    Type Parameters
    Name Description
    TAnc
    TTransformed

    FindTopAncestor<T>()

    Finds the highest ancestor of the specified type (or assignable to that type) in the input path.

    Declaration
    public T FindTopAncestor<T>()
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    FindTopAncestorIndex<T>()

    Finds the index of the highest ancestor of the specified type (or assignable to that type) in the input path.

    Declaration
    public int FindTopAncestorIndex<T>()
    Returns
    Type Description
    Int32
    Type Parameters
    Name Description
    T

    GetAncestor(Int32)

    Returns the ancestor object at the specified index in the transformation stack.

    Declaration
    public object GetAncestor(int index)
    Parameters
    Type Name Description
    Int32 index
    Returns
    Type Description
    Object

    GetAncestorIndex(Object)

    Returns the index in the transformation stack of the specified ancestor object, or -1 if the object is not an ancestor.

    Declaration
    public int GetAncestorIndex(object ancestor)
    Parameters
    Type Name Description
    Object ancestor
    Returns
    Type Description
    Int32

    GetOutputForAncestorIndex<TTransformed>(Int32)

    Returns the transformed output for the ancestor at the specified index.

    Declaration
    public TTransformed GetOutputForAncestorIndex<TTransformed>(int i)
    Parameters
    Type Name Description
    Int32 i
    Returns
    Type Description
    TTransformed
    Type Parameters
    Name Description
    TTransformed

    SetPrimaryOutput(Object)

    Sets the primary output of the last opened input object.

    Declaration
    public virtual void SetPrimaryOutput(object outputItem)
    Parameters
    Type Name Description
    Object outputItem
    Remarks

    This should be called when converting objects that contain other statements, before converting those statements.
    For objects that do not contain statements, it is unnecessary.

    In This Article
    Back to top Copyright © .NET Foundation. All rights reserved.