Exemple #1
0
    public ISortEnumValue?ParseSortLiteral(IValueNode valueSyntax)
    {
        if (valueSyntax is null)
        {
            throw new ArgumentNullException(nameof(valueSyntax));
        }

        if (valueSyntax is EnumValueNode evn &&
            ValueLookup.TryGetValue(evn.Value, out IEnumValue? ev) &&
            ev is ISortEnumValue sortEnumValue)
        {
            return(sortEnumValue);
        }

        if (valueSyntax is StringValueNode svn &&
            NameLookup.TryGetValue(svn.Value, out ev) &&
            ev is ISortEnumValue sortEnumValueOfString)
        {
            return(sortEnumValueOfString);
        }

        if (valueSyntax is NullValueNode)
        {
            return(null);
        }

        throw new SerializationException(
                  string.Format(
                      CultureInfo.InvariantCulture,
                      DataResources.SortingEnumType_Cannot_ParseLiteral,
                      Name,
                      valueSyntax.GetType().Name),
                  this);
    }
Exemple #2
0
 public EvalContext(ValueLookup lookup, TabularLookup tabularLookup)
 {
     Lookup        = lookup;
     TabularLookup = tabularLookup;
 }
Exemple #3
0
 /// <summary>
 /// Determines whether a value has been associated with a key.
 /// </summary>
 /// <param name="key">The key to check for.</param>
 /// <returns>True if the key has already been associated with a value; otherwise, false.</returns>
 public bool ContainsKey(Key key)
 {
     return(ValueLookup.ContainsKey(key));
 }
Exemple #4
0
 /// <summary>
 /// Associates the given value with the given key.
 /// </summary>
 /// <param name="key">The multi-index key to associate the value with.</param>
 /// <param name="value">The value to add to the cube.</param>
 public void Add(Key key, UValue value)
 {
     ValueLookup.Add(key, value);
     addKeyLookup(key);
 }