PlC() публичный статический Метод

public static PlC ( string decl ) : SbsSW.SwiPlCs.PlTerm
decl string
Результат SbsSW.SwiPlCs.PlTerm
Пример #1
0
 /// <summary>
 /// Gets or sets the element with the specified key.
 /// </summary>
 /// <returns>
 /// The element with the specified key.
 /// </returns>
 /// <param name="key">The key of the element to get or set.
 ///                 </param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.
 ///                 </exception><exception cref="T:System.Collections.Generic.KeyNotFoundException">The property is retrieved and <paramref name="key"/> is not found.
 ///                 </exception><exception cref="T:System.NotSupportedException">The property is set and the <see cref="T:System.Collections.Generic.IDictionary`2"/> is read-only.
 ///                 </exception>
 public TValue this[TKey key]
 {
     get
     {
         TValue tvalue = default(TValue);
         InForiegnFrame(() =>
         {
             PlTerm newPlTermV = PrologCLR.PlC(_getvalue, KeyToTerm(key), PlTerm.PlVar());
             bool res          = PlCall(_module, _getvalue, new PlTermV(newPlTermV));
             if (res)
             {
                 tvalue = (TValue)PrologCLR.CastTerm(newPlTermV.Arg(1), valueType);
             }
             else
             {
                 // tvalue = default(TValue);
             }
         });
         return(tvalue);
     }
     set
     {
         Remove(key);
         Add(new KeyValuePair <TKey, TValue>(key, value));
     }
 }
Пример #2
0
 public void Clear()
 {
     InForiegnFrame(() =>
     {
         PlTerm newPlTermV = PrologCLR.PlC(_querypred, new PlTermV(1));
         PlCall(_module, _retractall, new PlTermV(newPlTermV));
     });
 }
Пример #3
0
        /// <summary>
        /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
        /// </summary>
        /// <returns>
        /// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1"/>.
        /// </returns>
        /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
        ///                 </param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.
        ///                 </exception>
        public bool Remove(KeyValuePair <TKey, TValue> item)
        {
            bool removed = false;

            InForiegnFrame(() =>
            {
                PlTerm newPlTermV = PrologCLR.PlC(_getvalue, TermVOf(item));
                removed           = PlCall(_module, _retractPred, new PlTermV(newPlTermV));
            });
            return(removed);
        }
Пример #4
0
 public void Add(T item)
 {
     if (_assertPred == null)
     {
         throw new NotSupportedException("add " + this);
     }
     InForiegnFrame(() =>
     {
         PlTerm newPlTermV = PrologCLR.PlC(_querypred, new PlTermV(KeyToTerm(item)));
         PlCall(_module, _assertPred, new PlTermV(newPlTermV));
     });
 }
Пример #5
0
 /// <summary>
 /// Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </summary>
 /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.
 ///                 </exception>
 public void Clear()
 {
     if (_retractall == null)
     {
         throw new NotSupportedException("clear " + this);
     }
     InForiegnFrame(() =>
     {
         PlTerm newPlTermV = PrologCLR.PlC(_getvalue, new PlTermV(2));
         PlCall(_module, _retractall, new PlTermV(newPlTermV));
     });
 }
Пример #6
0
 /// <summary>
 /// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </summary>
 /// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1"/>.
 ///                 </param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.
 ///                 </exception>
 public void Add(KeyValuePair <TKey, TValue> item)
 {
     if (_assertPred == null)
     {
         throw new NotSupportedException("add " + this);
     }
     InForiegnFrame(() =>
     {
         PlTerm newPlTermV = PrologCLR.PlC(_getvalue, TermVOf(item));
         PlCall(_module, _assertPred, new PlTermV(newPlTermV));
     });
 }
Пример #7
0
        /// <summary>
        /// Removes the element with the specified key from the <see cref="T:System.Collections.Generic.IDictionary`2"/>.
        /// </summary>
        /// <returns>
        /// true if the element is successfully removed; otherwise, false.  This method also returns false if <paramref name="key"/> was not found in the original <see cref="T:System.Collections.Generic.IDictionary`2"/>.
        /// </returns>
        /// <param name="key">The key of the element to remove.
        ///                 </param><exception cref="T:System.ArgumentNullException"><paramref name="key"/> is null.
        ///                 </exception><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.IDictionary`2"/> is read-only.
        ///                 </exception>
        public bool Remove(TKey key)
        {
            if (Keyz != null)
            {
                if (!Keyz.IsReadOnly)
                {
                    return(Keyz.Remove(key));
                }
            }
            if (_retractPred == null)
            {
                throw new NotSupportedException("remove " + this);
            }
            bool removed = false;

            InForiegnFrame(() =>
            {
                PlTerm newPlTermV = PrologCLR.PlC(_getvalue, KeyToTerm(key), PlTerm.PlVar());
                removed           = PlCall(_module, _retractPred, new PlTermV(newPlTermV));
            });
            return(removed);
        }