Module dev.civl.mc

Interface ArrayCutter


public interface ArrayCutter

This interface provides methods for dealing with array slices, e.g. carving an array slice out of an array or writing an ArraySlice to an array.

An array slice is a sequence of elements in an array.

  • Method Summary

    Modifier and Type
    Method
    Description
    dev.civl.sarl.IF.expr.SymbolicExpression
    arraySlice(dev.civl.sarl.IF.expr.SymbolicExpression array, ArrayToolBox.ArrayShape shape, dev.civl.sarl.IF.expr.NumericExpression[] indices, int count)
    Same as
    invalid reference
    #arraySliceRead(SymbolicExpression, NumericExpression[], NumericExpression)
    but the "count" is known as having a concrete value.
    dev.civl.sarl.IF.expr.SymbolicExpression
    arraySlice(dev.civl.sarl.IF.expr.SymbolicExpression array, ArrayToolBox.ArrayShape shape, dev.civl.sarl.IF.expr.NumericExpression[] indices, dev.civl.sarl.IF.expr.NumericExpression count)
    Return an array slice value which is an one-dimensional array of elements of type t, where t is the base type of the given array shape ( ArrayToolBox.ArrayShape.baseType).
    dev.civl.sarl.IF.expr.SymbolicExpression
    arraySliceWrite(dev.civl.sarl.IF.expr.SymbolicExpression sliceArray, ArrayToolBox.ArrayShape sliceArrayShape, dev.civl.sarl.IF.expr.NumericExpression[] sliceIndices, dev.civl.sarl.IF.expr.NumericExpression count, dev.civl.sarl.IF.expr.SymbolicExpression targetArray, ArrayToolBox.ArrayShape targetShape, dev.civl.sarl.IF.expr.NumericExpression[] targetStartIndices)
    Writes an array slice s, which is represents by the three given arguments : sliceArray, sliceIndices, count, into the targetArray, starting from the given targetStartIndices
    dev.civl.sarl.IF.expr.SymbolicExpression
    mdArrayRead(dev.civl.sarl.IF.expr.SymbolicExpression array, dev.civl.sarl.IF.expr.NumericExpression[] indices)
    Read a multi-dimensional array
    dev.civl.sarl.IF.expr.SymbolicExpression
    mdArrayWrite(dev.civl.sarl.IF.expr.SymbolicExpression array, dev.civl.sarl.IF.expr.NumericExpression[] indices, dev.civl.sarl.IF.expr.SymbolicExpression value)
    Write a value to a multi-dimensional array
  • Method Details

    • arraySlice

      dev.civl.sarl.IF.expr.SymbolicExpression arraySlice(dev.civl.sarl.IF.expr.SymbolicExpression array, ArrayToolBox.ArrayShape shape, dev.civl.sarl.IF.expr.NumericExpression[] indices, dev.civl.sarl.IF.expr.NumericExpression count)

      Return an array slice value which is an one-dimensional array of elements of type t, where t is the base type of the given array shape ( ArrayToolBox.ArrayShape.baseType).

      Notice that the ArrayToolBox.ArrayShape.baseType doesn't have to be non-array type.

      Notice that the given indices must refer to element of the type t, i.e. ArrayToolBox.ArrayShape.dimensions == indices.length

      Parameters:
      array - an array
      shape - the ArrayToolBox.ArrayShape of the given array, the ArrayToolBox.ArrayShape.dimensions must equals to the indices.length
      indices - the indices of the element in the given array which is the first element in the returned array. (inclusive)
      count - the number of elements in the returned array
      Returns:
      an another array that contains a consecutive part of elements of the given array.
    • arraySlice

      dev.civl.sarl.IF.expr.SymbolicExpression arraySlice(dev.civl.sarl.IF.expr.SymbolicExpression array, ArrayToolBox.ArrayShape shape, dev.civl.sarl.IF.expr.NumericExpression[] indices, int count)
      Same as
      invalid reference
      #arraySliceRead(SymbolicExpression, NumericExpression[], NumericExpression)
      but the "count" is known as having a concrete value.
    • arraySliceWrite

      dev.civl.sarl.IF.expr.SymbolicExpression arraySliceWrite(dev.civl.sarl.IF.expr.SymbolicExpression sliceArray, ArrayToolBox.ArrayShape sliceArrayShape, dev.civl.sarl.IF.expr.NumericExpression[] sliceIndices, dev.civl.sarl.IF.expr.NumericExpression count, dev.civl.sarl.IF.expr.SymbolicExpression targetArray, ArrayToolBox.ArrayShape targetShape, dev.civl.sarl.IF.expr.NumericExpression[] targetStartIndices)

      Writes an array slice s, which is represents by the three given arguments : sliceArray, sliceIndices, count, into the targetArray, starting from the given targetStartIndices

      Parameters:
      sliceArray - the array where the slice is carved out
      sliceArrayShape - the ArrayToolBox.ArrayShape of the sliceArray
      sliceIndices - the starting indices of the slice in the sliceArray. The ArrayToolBox.ArrayShape.dimensions of sliceArrayShape must equal to sliceIndices.length
      count - the number of elements in the slice, the type of the element is ArrayToolBox.ArrayShape.baseType
      targetArray - the target array where the slice will be written into
      targetShape - the ArrayToolBox.ArrayShape of the target array. The ArrayToolBox.ArrayShape.baseType of targetShape must equal to the one of sliceArrayShape
      targetStartIndices - The ArrayToolBox.ArrayShape.dimensions of targetShape must equal to targetStartIndices.length
      Returns:
    • mdArrayRead

      dev.civl.sarl.IF.expr.SymbolicExpression mdArrayRead(dev.civl.sarl.IF.expr.SymbolicExpression array, dev.civl.sarl.IF.expr.NumericExpression[] indices)
      Read a multi-dimensional array
      Parameters:
      array - a multi-dimensional array
      indices - indices for reading
      Returns:
      The element indexed by the given indices
    • mdArrayWrite

      dev.civl.sarl.IF.expr.SymbolicExpression mdArrayWrite(dev.civl.sarl.IF.expr.SymbolicExpression array, dev.civl.sarl.IF.expr.NumericExpression[] indices, dev.civl.sarl.IF.expr.SymbolicExpression value)
      Write a value to a multi-dimensional array
      Parameters:
      array - a multi-dimensional array
      indices - indices for reading
      Returns:
      new array after writing