Skip to content

Commit

Permalink
Fixed spellings of orginal
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchiecarroll committed Oct 19, 2023
1 parent 7fc2703 commit 0c90fee
Show file tree
Hide file tree
Showing 13 changed files with 158 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ public override int Read(byte[] value, int offset, int count)

private int Read2(byte[] value, int offset, int count)
{
int origionalCount = count;
int originalCount = count;
while (count > 0)
{
if (RemainingReadLength <= 0)
Expand All @@ -654,7 +654,7 @@ private int Read2(byte[] value, int offset, int count)
count -= availableLength;
offset += availableLength;
}
return origionalCount;
return originalCount;
}

public override void SetLength(long value)
Expand Down
6 changes: 3 additions & 3 deletions Source/Libraries/GSF.SortedTreeStore/IO/RemoteBinaryStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public override int Read(byte[] buffer, int offset, int count)
m_receivePosition += count;
return count;
}
int origionalCount = count;
int originalCount = count;

//first empty the receive buffer.
if (receiveBufferLength > 0)
Expand Down Expand Up @@ -161,7 +161,7 @@ public override int Read(byte[] buffer, int offset, int count)
offset += receiveBufferLength;
count -= receiveBufferLength;
}
return origionalCount;
return originalCount;
}
else
{
Expand All @@ -188,7 +188,7 @@ public override int Read(byte[] buffer, int offset, int count)
}
Array.Copy(m_receiveBuffer, 0, buffer, offset, count);
m_receivePosition = count;
return origionalCount;
return originalCount;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace GSF.Security
/// </summary>
internal class PBDKFCredentials
{
//Origional Username and Passwords
//original Username and Passwords
/// <summary>
/// The UTF8 encoded normalized username.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ protected override void Split(uint newNodeIndex, TKey dividingKey)
if (RightSiblingNodeIndex != uint.MaxValue)
SetLeftSiblingProperty(RightSiblingNodeIndex, NodeIndex, newNodeIndex);

//update the origional header
//update the original header
RecordCount = (ushort)recordsInTheFirstNode;
ValidBytes = (ushort)(HeaderSize + recordsInTheFirstNode * KeyValueSize);
RightSiblingNodeIndex = newNodeIndex;
Expand Down
4 changes: 2 additions & 2 deletions Source/Libraries/GSF.SortedTreeStore/Text/NaturalComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//
//******************************************************************************************************

// Origional Source From http://www.codeproject.com/Articles/22517/Natural-Sort-Comparer
// Original Source From http://www.codeproject.com/Articles/22517/Natural-Sort-Comparer
// Licensed under The Code Project Open License (CPOL)

using System.Collections.Generic;
Expand All @@ -30,7 +30,7 @@
namespace GSF.Text
{
/// <summary>
/// Does a sort on a string that is natual to how humans look at it.
/// Does a sort on a string that is natural to how humans look at it.
/// Such as sorting numbers.
/// </summary>
public class NaturalComparer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ public class ISupportsReadonlyTest
{
public static void Test<T>(IImmutableObject<T> obj)
{
bool origional = obj.IsReadOnly;
bool original = obj.IsReadOnly;

IImmutableObject<T> ro = (IImmutableObject<T>)obj.CloneReadonly();
Assert.AreEqual(true, ro.IsReadOnly);
Assert.AreEqual(origional, obj.IsReadOnly);
Assert.AreEqual(original, obj.IsReadOnly);

IImmutableObject<T> rw = (IImmutableObject<T>)obj.CloneEditable();
Assert.AreEqual(false, rw.IsReadOnly);
Assert.AreEqual(origional, obj.IsReadOnly);
Assert.AreEqual(original, obj.IsReadOnly);
rw.IsReadOnly = true;
Assert.AreEqual(origional, obj.IsReadOnly);
Assert.AreEqual(original, obj.IsReadOnly);

Assert.AreEqual(true, rw.IsReadOnly);
HelperFunctions.ExpectError(() => rw.IsReadOnly = false);
Assert.AreEqual(origional, obj.IsReadOnly);
Assert.AreEqual(original, obj.IsReadOnly);

HelperFunctions.ExpectError(() => ro.IsReadOnly = false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
using System;
using GSF.Diagnostics;
using GSF.Snap.Services;
using GSF.Units;
using NUnit.Framework;
using openHistorian.Net;

namespace openHistorian.PerformanceTests
{
// SnapDB Engine Code
internal class SnapDBEngine : IDisposable
{
private readonly Action<string> m_logMessage;
private HistorianServer m_server;
private LogSubscriber m_logSubscriber;
private bool m_disposed;

public SnapDBEngine(Action<string> logMessage, string instanceName, string destinationFilesLocation, string targetFileSize = null, string directoryNamingMethod = null, bool readOnly = false)
{
m_logMessage = logMessage;

m_logSubscriber = Logger.CreateSubscriber(VerboseLevel.High);
m_logSubscriber.NewLogMessage += m_logSubscriber_Log;

if (string.IsNullOrEmpty(instanceName))
instanceName = "PPA";
else
instanceName = instanceName.Trim();

// Establish archive information for this historian instance
HistorianServerDatabaseConfig archiveInfo = new(instanceName, destinationFilesLocation, !readOnly);

if (!double.TryParse(targetFileSize, out double targetSize))
targetSize = 1.5D;

archiveInfo.TargetFileSize = (long)(targetSize * SI.Giga);

if (!int.TryParse(directoryNamingMethod, out int methodIndex) || !Enum.IsDefined(typeof(ArchiveDirectoryMethod), methodIndex))
methodIndex = (int)ArchiveDirectoryMethod.TopDirectoryOnly;

archiveInfo.DirectoryMethod = (ArchiveDirectoryMethod)methodIndex;

m_server = new HistorianServer(archiveInfo);
m_logMessage("[SnapDB] Engine initialized");
}

/// <summary>
/// Releases the unmanaged resources before the <see cref="SnapDBEngine"/> object is reclaimed by <see cref="GC"/>.
/// </summary>
~SnapDBEngine()
{
Dispose(false);
}

public SnapServer ServerHost => m_server.Host;

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (m_disposed)
return;

try

{
if (m_server is not null)
{
m_server.Dispose();
m_server = null;
}

if (m_logSubscriber is not null)
{
m_logSubscriber.NewLogMessage -= m_logSubscriber_Log;
m_logSubscriber = null;
}

m_logMessage("[SnapDB] Engine terminated");
}
finally
{
m_disposed = true; // Prevent duplicate dispose.
}
}

// Expose SnapDB log messages via Adapter status and exception event raisers
private void m_logSubscriber_Log(LogMessage logMessage)
{
m_logMessage(logMessage.Exception is null ?
$"[SnapDB] {logMessage.Level}: {logMessage.GetMessage()}" :
$"[SnapDB] Exception during {logMessage.EventPublisherDetails.EventName}: {logMessage.GetMessage()}");
}
}

[TestFixture]
public class DownsampledWriter
{
[Test]
public void TestDataExtraction()
{

}

private object OpenArchiveFile(string archiveFileName)
{
throw new NotImplementedException();
}

private void ExtractData(object source, DateTime startTime, DateTime endTime, string targetFilePath, int downsampling = 0)
{
//string completeFileName = GetDestinationFileName(stream.ArchiveFile, sourceFileName, instanceName, destinationPath, method);
//string pendingFileName = Path.Combine(FilePath.GetDirectoryName(completeFileName), FilePath.GetFileNameWithoutExtension(completeFileName) + ".~d2i");

//SortedTreeFileSimpleWriter<HistorianKey, HistorianValue>.Create(pendingFileName, completeFileName, 4096, null, encoder.EncodingMethod, stream);

//migratedPoints = stream.PointCount;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<LangVersion>8</LangVersion>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -81,6 +81,7 @@
<ItemGroup>
<Compile Include="BenchmarkSockets.cs" />
<Compile Include="CheckSHA1Guid.cs" />
<Compile Include="DownsampledWriter.cs" />
<Compile Include="ConcurrentReading.cs" />
<Compile Include="Diagnostics\StackTrace_Test.cs" />
<Compile Include="GCTime.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,27 +129,27 @@ public static SortedList<DateTime, FrameData> GetFrames(this IDatabaseReader<His
/// <summary>
/// Rounds the frame to the nearest level of specified tolerance.
/// </summary>
/// <param name="origional">the frame to round</param>
/// <param name="original">the frame to round</param>
/// <param name="toleranceMilliseconds">the timespan in milliseconds.</param>
/// <returns>A new frame that is rounded.</returns>
public static SortedList<DateTime, FrameData> RoundToTolerance(this SortedList<DateTime, FrameData> origional, int toleranceMilliseconds)
public static SortedList<DateTime, FrameData> RoundToTolerance(this SortedList<DateTime, FrameData> original, int toleranceMilliseconds)
{
return origional.RoundToTolerance(new TimeSpan(TimeSpan.TicksPerMillisecond * toleranceMilliseconds));
return original.RoundToTolerance(new TimeSpan(TimeSpan.TicksPerMillisecond * toleranceMilliseconds));
}

/// <summary>
/// Rounds the frame to the nearest level of specified tolerance.
/// </summary>
/// <param name="origional">the frame to round</param>
/// <param name="original">the frame to round</param>
/// <param name="tolerance">the timespan to round on.</param>
/// <returns>A new frame that is rounded.</returns>
public static SortedList<DateTime, FrameData> RoundToTolerance(this SortedList<DateTime, FrameData> origional, TimeSpan tolerance)
public static SortedList<DateTime, FrameData> RoundToTolerance(this SortedList<DateTime, FrameData> original, TimeSpan tolerance)
{
SortedList<DateTime, FrameData> results = new SortedList<DateTime, FrameData>();

SortedList<DateTime, List<FrameData>> buckets = new SortedList<DateTime, List<FrameData>>();

foreach (KeyValuePair<DateTime, FrameData> items in origional)
foreach (KeyValuePair<DateTime, FrameData> items in original)
{
DateTime roundedDate = items.Key.Round(tolerance);
if (!buckets.TryGetValue(roundedDate, out List<FrameData> frames))
Expand Down Expand Up @@ -205,12 +205,12 @@ public static SortedList<DateTime, FrameData> RoundToTolerance(this SortedList<D
return results;
}

static DateTime Round(this DateTime origional, TimeSpan tolerance)
static DateTime Round(this DateTime original, TimeSpan tolerance)
{
long delta = origional.Ticks % tolerance.Ticks;
long delta = original.Ticks % tolerance.Ticks;
if (delta >= tolerance.Ticks >> 1)
return new DateTime(origional.Ticks - delta + tolerance.Ticks);
return new DateTime(origional.Ticks - delta);
return new DateTime(original.Ticks - delta + tolerance.Ticks);
return new DateTime(original.Ticks - delta);
}

static EnumerableHelper Min(EnumerableHelper left, EnumerableHelper right)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace openHistorian.Data.Query
{
/// <summary>
/// This type of signal only supports reading and writing data via
/// its raw type. Type conversions are not supported since its origional
/// its raw type. Type conversions are not supported since its original
/// type is unknown.
/// </summary>
public class SignalDataUnknown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override void Calculate(IDictionary<Guid, SignalDataBase> signals)
{
Dependencies[0].Calculate(signals);

SignalDataBase origionalSignal = signals[Dependencies[0].UniqueId];
SignalDataBase originalSignal = signals[Dependencies[0].UniqueId];

SignalDataBase newSignal = TryGetSignal(m_newSignal, signals);

Expand All @@ -61,9 +61,9 @@ public override void Calculate(IDictionary<Guid, SignalDataBase> signals)

int pos = 0;

while (pos < origionalSignal.Count)
while (pos < originalSignal.Count)
{
origionalSignal.GetData(pos, out ulong time, out double vm);
originalSignal.GetData(pos, out ulong time, out double vm);
pos++;

newSignal.AddData(time, vm);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public override void Calculate(IDictionary<Guid, SignalDataBase> signals)
{
Dependencies[0].Calculate(signals);

SignalDataBase origionalSignal = signals[Dependencies[0].UniqueId];
SignalDataBase originalSignal = signals[Dependencies[0].UniqueId];

SignalDataBase newSignal = TryGetSignal(m_newSignal, signals);

Expand All @@ -57,9 +57,9 @@ public override void Calculate(IDictionary<Guid, SignalDataBase> signals)

int pos = 0;

while (pos < origionalSignal.Count)
while (pos < originalSignal.Count)
{
origionalSignal.GetData(pos, out ulong time, out double vm);
originalSignal.GetData(pos, out ulong time, out double vm);
pos++;

newSignal.AddData(time, vm * m_scalingFactor);
Expand Down
1 change: 1 addition & 0 deletions Source/openHistorian.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CFF/@EntryIndexedValue">CFF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DB/@EntryIndexedValue">DB</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Digitals/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Grafana/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Reasonability/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

0 comments on commit 0c90fee

Please sign in to comment.