Search Results for

    Show / Hide Table of Contents

    Class Location

    Represents a location inside a possibly nested IAbstractMarkupDataContainer collection.

    Inheritance
    System.Object
    Location
    Implements
    System.ICloneable
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Sdl.FileTypeSupport.Framework.BilingualApi
    Assembly: Sdl.FileTypeSupport.Framework.Core.dll
    Syntax
    public class Location : ICloneable
    Remarks

    The parent in the top level location (index 0) is the root container (often IParagraph or ISegment). The BottomLevel is the location in the lowest level.

    Constructors

    Location()

    Default constructor

    Declaration
    public Location()

    Location(IAbstractMarkupDataContainer, IAbstractMarkupData)

    Creates a location that corresponds to the position of the item with regards to the specified root container.

    Declaration
    public Location(IAbstractMarkupDataContainer rootContainer, IAbstractMarkupData itemAtLocation)
    Parameters
    Type Name Description
    IAbstractMarkupDataContainer rootContainer

    Must not be null

    IAbstractMarkupData itemAtLocation

    Must be an item somewhere inside the root container, i.e. the root container must be an ancestor to the item.

    Location(IAbstractMarkupDataContainer, Boolean)

    Initialize the location to the first or last position in the specified root container.

    Declaration
    public Location(IAbstractMarkupDataContainer rootContainer, bool firstLocation)
    Parameters
    Type Name Description
    IAbstractMarkupDataContainer rootContainer
    System.Boolean firstLocation

    Indicates whether the location should be initialized to the first or the last available location of the root container. Pass true to initialize it to the first location, and false to initialize it to the last location.

    Location(LevelLocation)

    Initializes the location with one level only. This generates a location that is equivalent to the passed-in LevelLocation.

    Declaration
    public Location(LevelLocation location)
    Parameters
    Type Name Description
    LevelLocation location

    must not be null

    Location(Location)

    Creates a deep clone

    Declaration
    public Location(Location other)
    Parameters
    Type Name Description
    Location other

    Properties

    BottomLevel

    Quick access to the most specific level

    Declaration
    public LevelLocation BottomLevel { get; }
    Property Value
    Type Description
    LevelLocation

    Depth

    Returns the number of levels in the location.

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

    IsAtEnd

    True if the MoveNext() method returns false.

    Declaration
    public bool IsAtEnd { get; }
    Property Value
    Type Description
    System.Boolean

    IsAtStart

    True if the MovePrevious() method returns false.

    Declaration
    public bool IsAtStart { get; }
    Property Value
    Type Description
    System.Boolean

    IsValid

    True if all levels are valid locations and each level corresponds to the location defined in the parent layer.

    Declaration
    public bool IsValid { get; }
    Property Value
    Type Description
    System.Boolean

    ItemAtLocation

    Returns the item at the location specified by the bottom level.

    If the location is not valid, or if there is not item at the location (i.e. if it is a location after the last element in a collection), this property returns null.

    Declaration
    public IAbstractMarkupData ItemAtLocation { get; }
    Property Value
    Type Description
    IAbstractMarkupData

    Levels

    Provides access to the actual collection of levels that this location represents.

    Declaration
    public List<LevelLocation> Levels { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<LevelLocation>

    Methods

    Clone()

    Creates a deep clone of this object.

    Declaration
    public object Clone()
    Returns
    Type Description
    System.Object

    Equals(Object)

    Returns true if this location refers to the same position as the other location.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj
    Returns
    Type Description
    System.Boolean
    Overrides
    System.Object.Equals(System.Object)

    GetHashCode()

    Returns the hash code of the levels in this location.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    System.Object.GetHashCode()

    MoveFirstChild()

    Changes the location to refer to the position just before the first child node of the item at the current location.

    If no child node is available (i.e. the current location does not refer to a node that is an IAbstractMarkupDataContainer), the location is not changed, and this method returns false.

    Note that if the item at the current location is a container, but it has no content, the location is still advanced to a location at the index 0 inside the collection, as it is possible to insert new content there.

    Declaration
    public bool MoveFirstChild()
    Returns
    Type Description
    System.Boolean

    True if the location was changed successfully

    MoveLastChild()

    Changes the location to just behind the last child node of the item at the current location.

    If no child node is available (i.e. the current location does not refer to a node that is an IAbstractMarkupDataContainer), the location is not changed, and this method returns false.

    Note that if the item at the current location is a container, but it has no content, the location is still advanced to a location at the index 0 inside the collection, as it is possible to insert new content there.

    Declaration
    public bool MoveLastChild()
    Returns
    Type Description
    System.Boolean

    True if the location was changed successfully

    MoveNext()

    Advances to the next possible location. This will move to the next available position according to the following priority list:

    If no such location is available (i.e. the location is currently behind the last item in the top level), the location is not changed, and the method returns false.

    If the location is invalid, the behavior is undefined and exceptions may be thrown.

    Declaration
    public bool MoveNext()
    Returns
    Type Description
    System.Boolean

    True if location was successfully advanced to the next possible position.

    MoveNextSibling()

    Advance the location to the next sibling position in the current bottom layer.

    If no next sibling position is available (i.e. the location is already behind the last item in the parent collection), the location is not changed, and this method returns false.

    Declaration
    public bool MoveNextSibling()
    Returns
    Type Description
    System.Boolean

    True if the location was changed successfully

    MoveParent()

    Changes the location to refer to the position just before the parent of the current bottom level location.

    If no parent location is available (i.e. the location is already in the top layer), the location is not changed, and this method returns false.

    Declaration
    public bool MoveParent()
    Returns
    Type Description
    System.Boolean

    True if the location was changed successfully

    MovePrevious()

    Moves the location to the preceding available position according to the following priority list:

    If no parent is available (i.e. location is before the first item in the top level), the location is not changed, and the method returns false.

    Declaration
    public bool MovePrevious()
    Returns
    Type Description
    System.Boolean

    True if the location was successfully moved to a previous position.

    MovePreviousSibling()

    Moves the location to the preceding sibling position in the current bottom layer.

    If no previous sibling location is available (i.e. the current location is already at the start of the parent collection), the location is not changed, and this method returns false.

    Declaration
    public bool MovePreviousSibling()
    Returns
    Type Description
    System.Boolean

    True if the location was changed successfully

    ToString()

    Overridden to provide more useful information while debugging

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.Object.ToString()

    Implements

    System.ICloneable

    On this page

    • Constructors
      • Location()
      • Location(IAbstractMarkupDataContainer, IAbstractMarkupData)
      • Location(IAbstractMarkupDataContainer, Boolean)
      • Location(LevelLocation)
      • Location(Location)
    • Properties
      • BottomLevel
      • Depth
      • IsAtEnd
      • IsAtStart
      • IsValid
      • ItemAtLocation
      • Levels
    • Methods
      • Clone()
      • Equals(Object)
      • GetHashCode()
      • MoveFirstChild()
      • MoveLastChild()
      • MoveNext()
      • MoveNextSibling()
      • MoveParent()
      • MovePrevious()
      • MovePreviousSibling()
      • ToString()
    • Implements
    Back to top Generated by DocFX