Class TimeShift
- Namespace
- Hi.Numerical.StepSelectionUtils
- Assembly
- HiMech.dll
Represents a time-based shift operation for machining steps. This class provides functionality to shift step indices based on time offsets.
public class TimeShift : IStepShift, IMakeXmlSource
- Inheritance
-
TimeShift
- Implements
- Inherited Members
- Extension Methods
Constructors
TimeShift(TimeSpan, bool)
Initializes a new instance of the TimeShift class with the specified parameters.
public TimeShift(TimeSpan timeShift, bool isBackward)
Parameters
timeShiftTimeSpanThe amount of time to shift.
isBackwardboolTrue to shift backward in time, false to shift forward.
TimeShift(XElement)
Initializes a new instance of the TimeShift class from XML.
public TimeShift(XElement src)
Parameters
srcXElementThe XML element containing the time shift configuration.
Properties
IsBackward
Gets or sets a value indicating whether the shift is backward in time. When true, shifts steps earlier in time; when false, shifts steps later in time.
public bool IsBackward { get; set; }
Property Value
ShiftTimeSpan
Gets or sets the amount of time to shift: a duration, the direction given by IsBackward
(SessionShell.ShiftTime_s gives a negative time as its magnitude with IsBackward set).
public TimeSpan ShiftTimeSpan { get; set; }
Property Value
XName
Gets the XML element name used for serialization.
public static string XName { get; }
Property Value
Remarks
This name is used as the XML tag when serializing/deserializing TimeShift instances. The value is the unqualified name of the class (TimeShift).
Methods
GetShiftedStepIndex(ClStrip, int)
Gets the shifted step index based on the original index and the time shift configuration.
public int GetShiftedStepIndex(ClStrip host, int originalStepIndex)
Parameters
hostClStripThe cutter location strip containing the steps.
originalStepIndexintThe original step index to shift.
Returns
- int
The shifted step index, or -1 when
originalStepIndexis a position without a step, or no position of the strip at all: -1 itself (an end anchor on a line before any step, a touch anchor that found no touched step) or an index at or past the strip's count.
Remarks
A position without a step has no time: one the pipeline dropped at a stop (the strip keeps the
positions of the steps it had submitted, play-core migration P17 / P15 R5) or whose stage faulted.
Such positions are skipped on the way, and a shift that reaches the strip's end answers the last
position that holds a step, never a hole. An origin outside the strip is answered -1 rather than thrown
on: the selection's readers take -1 as “no step” (the mapping maps nothing), where an exception out of
the mapping's task read as Map–Exception.
MakeXmlSource(string, string, bool)
Creates an XML representation of the object. This method may also generate additional resources such as related files.
public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)
Parameters
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif true, the extended file creation is suppressed.
Returns
- XElement
An XML element representing the object's state
Remarks
For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied.
The baseDirectory is typically the folder at the nearest configuration file folder.
Since the folder can be moving with the configuration file.
Reg(XFactory)
Registers this type's deserializer with the given XFactory
(or Default when factory is
null). Idempotent.
public static void Reg(XFactory factory = null)
Parameters
factoryXFactory