Skip to content

Commit

Permalink
Update variables naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Konard authored Jan 17, 2024
1 parent bade79f commit ec91334
Showing 1 changed file with 61 additions and 61 deletions.
122 changes: 61 additions & 61 deletions csharp/Platform.Data.Doublets.Json/DefaultJsonStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class DefaultJsonStorage<TLinkAddress> : IJsonStorage<TLinkAddress>
/// </para>
/// <para></para>
/// </summary>
public readonly TLinkAddress MeaningRoot;
public readonly TLinkAddress Type;
/// <summary>
/// <para>
/// The default.
Expand Down Expand Up @@ -171,91 +171,91 @@ public class DefaultJsonStorage<TLinkAddress> : IJsonStorage<TLinkAddress>
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress DocumentMarker { get; }
public TLinkAddress DocumentType { get; }
/// <summary>
/// <para>
/// Gets the object marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress ObjectMarker { get; }
public TLinkAddress ObjectType { get; }
/// <summary>
/// <para>
/// Gets the member marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress MemberMarker { get; }
public TLinkAddress MemberType { get; }
/// <summary>
/// <para>
/// Gets the value marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress ValueMarker { get; }
public TLinkAddress ValueType { get; }
/// <summary>
/// <para>
/// Gets the string marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress StringMarker { get; }
public TLinkAddress StringType { get; }
/// <summary>
/// <para>
/// Gets the empty string marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress EmptyStringMarker { get; }
public TLinkAddress EmptyStringType { get; }
/// <summary>
/// <para>
/// Gets the number marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress NumberMarker { get; }
public TLinkAddress NumberType { get; }
/// <summary>
/// <para>
/// Gets the negative number marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress NegativeNumberMarker { get; }
public TLinkAddress NegativeNumberType { get; }
/// <summary>
/// <para>
/// Gets the array marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress ArrayMarker { get; }
public TLinkAddress ArrayType { get; }
/// <summary>
/// <para>
/// Gets the empty array marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress EmptyArrayMarker { get; }
public TLinkAddress EmptyArrayType { get; }
/// <summary>
/// <para>
/// Gets the true marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress TrueMarker { get; }
public TLinkAddress TrueType { get; }
/// <summary>
/// <para>
/// Gets the false marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress FalseMarker { get; }
public TLinkAddress FalseType { get; }
/// <summary>
/// <para>
/// Gets the null marker value.
/// </para>
/// <para></para>
/// </summary>
public TLinkAddress NullMarker { get; }
public TLinkAddress NullType { get; }

/// <summary>
/// <para>
Expand All @@ -277,41 +277,41 @@ public DefaultJsonStorage(ILinks<TLinkAddress> links, IConverter<IList<TLinkAddr
ListToSequenceConverter = listToSequenceConverter;
// Initializes constants
Any = Links.Constants.Any;
var markerIndex = One;
MeaningRoot = links.GetOrCreate(markerIndex, markerIndex);
var unicodeSymbolMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
var unicodeSequenceMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
DocumentMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
ObjectMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
MemberMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
ValueMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
StringMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
EmptyStringMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
NumberMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
NegativeNumberMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
ArrayMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
EmptyArrayMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
TrueMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
FalseMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
NullMarker = links.GetOrCreate(MeaningRoot, Arithmetic.Increment(ref markerIndex));
var typeAddress = One;
Type = links.GetOrCreate(typeAddress, typeAddress);
var unicodeSymbolType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
var unicodeSequenceType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
DocumentType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
ObjectType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
MemberType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
ValueType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
StringType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
EmptyStringType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
NumberType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
NegativeNumberType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
ArrayType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
EmptyArrayType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
TrueType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
FalseType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
NullType = links.GetOrCreate(Type, Arithmetic.Increment(ref typeAddress));
BalancedVariantConverter = new(links);
TargetMatcher<TLinkAddress> unicodeSymbolCriterionMatcher = new(Links, unicodeSymbolMarker);
TargetMatcher<TLinkAddress> unicodeSequenceCriterionMatcher = new(Links, unicodeSequenceMarker);
TargetMatcher<TLinkAddress> unicodeSymbolCriterionMatcher = new(Links, unicodeSymbolType);
TargetMatcher<TLinkAddress> unicodeSequenceCriterionMatcher = new(Links, unicodeSequenceType);
CharToUnicodeSymbolConverter<TLinkAddress> charToUnicodeSymbolConverter =
new(Links, AddressToNumberConverter, unicodeSymbolMarker);
new(Links, AddressToNumberConverter, unicodeSymbolType);
UnicodeSymbolToCharConverter<TLinkAddress> unicodeSymbolToCharConverter =
new(Links, NumberToAddressConverter, unicodeSymbolCriterionMatcher);
StringToUnicodeSequenceConverter = new CachingConverterDecorator<string, TLinkAddress>(
new StringToUnicodeSequenceConverter<TLinkAddress>(Links, charToUnicodeSymbolConverter,
BalancedVariantConverter, unicodeSequenceMarker));
BalancedVariantConverter, unicodeSequenceType));
RightSequenceWalker<TLinkAddress> sequenceWalker =
new(Links, new DefaultStack<TLinkAddress>(), unicodeSymbolCriterionMatcher.IsMatched);
UnicodeSequenceToStringConverter = new CachingConverterDecorator<TLinkAddress, string>(
new UnicodeSequenceToStringConverter<TLinkAddress>(Links, unicodeSequenceCriterionMatcher, sequenceWalker,
unicodeSymbolToCharConverter));
BigIntegerToRawNumberSequenceConverter =
new(links, AddressToNumberConverter, ListToSequenceConverter, NegativeNumberMarker);
RawNumberSequenceToBigIntegerConverter = new(links, NumberToAddressConverter, NegativeNumberMarker);
new(links, AddressToNumberConverter, ListToSequenceConverter, NegativeNumberType);
RawNumberSequenceToBigIntegerConverter = new(links, NumberToAddressConverter, NegativeNumberType);
DecimalToRationalConverter = new(links, BigIntegerToRawNumberSequenceConverter);
RationalToDecimalConverter = new(links, RawNumberSequenceToBigIntegerConverter);
JsonArrayElementCriterionMatcher = new(this);
Expand All @@ -336,7 +336,7 @@ public DefaultJsonStorage(ILinks<TLinkAddress> links, IConverter<IList<TLinkAddr
public TLinkAddress CreateString(string content)
{
var @string = GetStringSequence(content);
return Links.GetOrCreate(StringMarker, @string);
return Links.GetOrCreate(StringType, @string);
}

/// <summary>
Expand Down Expand Up @@ -376,7 +376,7 @@ public TLinkAddress CreateStringValue(string content)
public TLinkAddress CreateNumber(decimal number)
{
var numberSequence = DecimalToRationalConverter.Convert(number);
return Links.GetOrCreate(NumberMarker, numberSequence);
return Links.GetOrCreate(NumberType, numberSequence);
}

/// <summary>
Expand Down Expand Up @@ -413,7 +413,7 @@ public TLinkAddress CreateNumberValue(decimal number)
/// <para>The link</para>
/// <para></para>
/// </returns>
public TLinkAddress CreateBooleanValue(bool value) => CreateValue(value ? TrueMarker : FalseMarker);
public TLinkAddress CreateBooleanValue(bool value) => CreateValue(value ? TrueType : FalseType);

/// <summary>
/// <para>
Expand All @@ -425,7 +425,7 @@ public TLinkAddress CreateNumberValue(decimal number)
/// <para>The link</para>
/// <para></para>
/// </returns>
public TLinkAddress CreateNullValue() => CreateValue(NullMarker);
public TLinkAddress CreateNullValue() => CreateValue(NullType);

/// <summary>
/// <para>
Expand All @@ -444,7 +444,7 @@ public TLinkAddress CreateNumberValue(decimal number)
public TLinkAddress CreateDocument(string name)
{
var documentName = CreateString(name);
return Links.GetOrCreate(DocumentMarker, documentName);
return Links.GetOrCreate(DocumentType, documentName);
}

/// <summary>
Expand All @@ -460,7 +460,7 @@ public TLinkAddress CreateDocument(string name)
public TLinkAddress CreateObject()
{
var @object = Links.Create();
return Links.Update(@object, newSource: ObjectMarker, newTarget: @object);
return Links.Update(@object, newSource: ObjectType, newTarget: @object);
}

/// <summary>
Expand Down Expand Up @@ -495,7 +495,7 @@ public TLinkAddress CreateObjectValue()
/// </returns>
public TLinkAddress CreateArray(IList<TLinkAddress>? array)
{
var arraySequence = array.Count == 0 ? EmptyArrayMarker : BalancedVariantConverter.Convert(array);
var arraySequence = array.Count == 0 ? EmptyArrayType : BalancedVariantConverter.Convert(array);
return CreateArray(arraySequence);
}

Expand All @@ -513,7 +513,7 @@ public TLinkAddress CreateArray(IList<TLinkAddress>? array)
/// <para>The link</para>
/// <para></para>
/// </returns>
public TLinkAddress CreateArray(TLinkAddress sequence) => Links.GetOrCreate(ArrayMarker, sequence);
public TLinkAddress CreateArray(TLinkAddress sequence) => Links.GetOrCreate(ArrayType, sequence);

/// <summary>
/// <para>
Expand Down Expand Up @@ -572,7 +572,7 @@ public TLinkAddress CreateArrayValue(TLinkAddress sequence)
public TLinkAddress CreateMember(string name)
{
var nameLink = CreateString(name);
return Links.GetOrCreate(MemberMarker, nameLink);
return Links.GetOrCreate(MemberType, nameLink);
}

/// <summary>
Expand All @@ -589,7 +589,7 @@ public TLinkAddress CreateMember(string name)
/// <para>The link</para>
/// <para></para>
/// </returns>
public TLinkAddress CreateValue(TLinkAddress value) => Links.GetOrCreate(ValueMarker, value);
public TLinkAddress CreateValue(TLinkAddress value) => Links.GetOrCreate(ValueType, value);

/// <summary>
/// <para>
Expand Down Expand Up @@ -792,7 +792,7 @@ public TLinkAddress AppendArrayValue(TLinkAddress arrayValue, TLinkAddress appen
var array = GetArray(arrayValue);
var arraySequence = Links.GetTarget(array);
TLinkAddress newArrayValue;
if (EqualityComparer.Equals(arraySequence, EmptyArrayMarker))
if (EqualityComparer.Equals(arraySequence, EmptyArrayType))
{
newArrayValue = CreateArrayValue(appendant);
}
Expand Down Expand Up @@ -821,14 +821,14 @@ public TLinkAddress AppendArrayValue(TLinkAddress arrayValue, TLinkAddress appen
public TLinkAddress GetDocumentOrDefault(string name)
{
var stringSequence = GetStringSequence(name);
var @string = Links.SearchOrDefault(StringMarker, stringSequence);
var @string = Links.SearchOrDefault(StringType, stringSequence);
if (EqualityComparer.Equals(@string, default))
{
return default;
}
return Links.SearchOrDefault(DocumentMarker, @string);
return Links.SearchOrDefault(DocumentType, @string);
}
private TLinkAddress GetStringSequence(string content) => content == "" ? EmptyStringMarker : StringToUnicodeSequenceConverter.Convert(content);
private TLinkAddress GetStringSequence(string content) => content == "" ? EmptyStringType : StringToUnicodeSequenceConverter.Convert(content);

/// <summary>
/// <para>
Expand All @@ -855,10 +855,10 @@ public string GetString(TLinkAddress stringValue)
for (int i = 0; i < 3; i++)
{
source = Links.GetSource(current);
if (EqualityComparer.Equals(source, StringMarker))
if (EqualityComparer.Equals(source, StringType))
{
var sequence = Links.GetTarget(current);
var isEmpty = EqualityComparer.Equals(sequence, EmptyStringMarker);
var isEmpty = EqualityComparer.Equals(sequence, EmptyStringType);
return isEmpty ? "" : UnicodeSequenceToStringConverter.Convert(sequence);
}
current = Links.GetTarget(current);
Expand Down Expand Up @@ -893,7 +893,7 @@ public decimal GetNumber(TLinkAddress valueLink)
{
source = Links.GetSource(current);
target = Links.GetTarget(current);
if (EqualityComparer.Equals(source, NumberMarker))
if (EqualityComparer.Equals(source, NumberType))
{
return RationalToDecimalConverter.Convert(target);
}
Expand Down Expand Up @@ -928,7 +928,7 @@ public TLinkAddress GetObject(TLinkAddress objectValueLink)
for (int i = 0; i < 3; i++)
{
source = Links.GetSource(current);
if (EqualityComparer.Equals(source, ObjectMarker))
if (EqualityComparer.Equals(source, ObjectType))
{
return current;
}
Expand Down Expand Up @@ -962,7 +962,7 @@ public TLinkAddress GetArray(TLinkAddress arrayValueLink)
for (int i = 0; i < 3; i++)
{
source = Links.GetSource(current);
if (EqualityComparer.Equals(source, ArrayMarker))
if (EqualityComparer.Equals(source, ArrayType))
{
return current;
}
Expand Down Expand Up @@ -1023,7 +1023,7 @@ public TLinkAddress GetValueLink(TLinkAddress parent)
return default;
case 1:
var resultLinkTarget = Links.GetTarget(resultLinks[0]);
if (EqualityComparer.Equals(Links.GetSource(resultLinkTarget), ValueMarker))
if (EqualityComparer.Equals(Links.GetSource(resultLinkTarget), ValueType))
{
return resultLinkTarget;
}
Expand Down Expand Up @@ -1052,11 +1052,11 @@ public TLinkAddress GetValueLink(TLinkAddress parent)
/// <para>The target source.</para>
/// <para></para>
/// </returns>
public TLinkAddress GetValueMarker(TLinkAddress value)
public TLinkAddress GetValueType(TLinkAddress value)
{
var target = Links.GetTarget(value);
var targetSource = Links.GetSource(target);
if (EqualityComparer.Equals(MeaningRoot, targetSource))
if (EqualityComparer.Equals(Type, targetSource))
{
return target;
}
Expand Down Expand Up @@ -1084,8 +1084,8 @@ public List<TLinkAddress> GetMembersLinks(TLinkAddress @object)
Links.Each(objectMemberLink =>
{
var memberLink = Links.GetTarget(objectMemberLink);
var memberMarker = Links.GetSource(memberLink);
if (EqualityComparer.Equals(memberMarker, MemberMarker))
var memberType = Links.GetSource(memberLink);
if (EqualityComparer.Equals(memberType, MemberType))
{
members.Add(Links.GetIndex(objectMemberLink));
}
Expand Down

0 comments on commit ec91334

Please sign in to comment.