/// <summary> /// Returns true iff the reference marker is equal to the /// current marker value. /// </summary> /// <param name="referenceMarker">The reference marker.</param> /// <returns> /// True, iff the current marker is equal to the current /// marker value. /// </returns> public bool IsMarked(NodeMarker referenceMarker) => Interlocked.Read(ref markerValue) == referenceMarker.Marker;
/// <summary> /// Marks the current node with the new marker value. /// </summary> /// <param name="newMarker">The new value to apply.</param> /// <returns> /// True, iff the old marker was not equal to the new marker /// (the node was not marked with the new marker value). /// </returns> public bool Mark(NodeMarker newMarker) => Interlocked.Exchange(ref markerValue, newMarker.Marker) != newMarker.Marker;