4000-520-616
欢迎来到免疫在线!(蚂蚁淘生物旗下平台)  请登录 |  免费注册 |  询价篮
主营:原厂直采,平行进口,授权代理(蚂蚁淘为您服务)
咨询热线电话
4000-520-616
当前位置: 首页 > 新闻动态 >
新闻详情
ChemObjectConfig.ttinclude · Cooper_Liu/NCDK - Gitee.com
来自 : gitee.com/KKCodeRepository/NCD 发布时间:2021-03-25
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
 # /* * Copyright (C) 2017-2018 Kazuya Ujihara ujihara.kazuya@gmail.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * All we ask is that proper credit is given for our work, which includes * - but is not limited to - adding the above copyright notice to the beginning * of your source code files, and to any copyright notice that you may distribute * with programs based on this work. * * This program is distributed in the hope that it will be useful, * but WITHOUT Any WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ # #@ template debug=\"true\" hostspecific=\"true\" language=\"C#\" # #@ output extension=\".tt.cs\" # #@ Assembly Name=\"System.Core.dll\" # #@ Assembly Name=\"System.Xml.dll\" # #@ Assembly Name=\"System.Xml.Linq.dll\" # #@ import namespace=\"System\" # #@ import namespace=\"System.Collections\" # #@ import namespace=\"System.Collections.Generic\" # #@ import namespace=\"System.Diagnostics\" # #@ import namespace=\"System.IO\" # #@ import namespace=\"System.Linq\" # #@ import namespace=\"System.Text\" # #@ import namespace=\"System.Text.RegularExpressions\" # #@ import namespace=\"System.Xml\" # #@ import namespace=\"System.Xml.Linq\" # #+ public const string Namespace_Default = \"NCDK.Default\"; public const string Namespace_Silent = \"NCDK.Silent\"; public const string Namespace_Fixed = \"NCDK.Fixed\"; public class PackageInfo { public string NS { get; set; } public bool IsSilent { get; private set; } public PackageInfo(string ns, bool silent) { NS = ns; IsSilent = silent; } } public static PackageInfo[] namespaces = new[] { new PackageInfo(Namespace_Default, false), new PackageInfo(Namespace_Silent, true), }; public void IncludePropertiesImplementation(bool addNofityChanged) { # #if DEBUG private static IList System.Type AcceptablePropertyKeyTypes { get; } = new List System.Type () { typeof(string), typeof(NCDK.Dict.DictRef), typeof(System.Guid), }; #endif /// summary /// A dictionary for the storage of any kind of properties of this object. /// /summary private Dictionary object, object properties; private void InitProperties() { properties = new Dictionary object, object } /// inheritdoc/ public virtual void SetProperty(object description, object value) { #if DEBUG if (description != null !AcceptablePropertyKeyTypes.Contains(description.GetType())) throw new System.Exception(); #endif if (this.properties == null) InitProperties(); properties[description] = value; #+ if (addNofityChanged) { # NotifyChanged(); #+ } # } /// inheritdoc/ public virtual void RemoveProperty(object description) { #if DEBUG if (!AcceptablePropertyKeyTypes.Contains(description.GetType())) throw new System.Exception(); #endif if (this.properties == null) return; var removed = properties.Remove(description); #+ if (addNofityChanged) { # if (removed) NotifyChanged(); #+ } # } /// inheritdoc/ public virtual T GetProperty T (object description) { #if DEBUG if (!AcceptablePropertyKeyTypes.Contains(description.GetType())) throw new System.Exception(); #endif return GetProperty(description, default(T)); } /// inheritdoc/ public virtual T GetProperty T (object description, T defaultValue) { #if DEBUG if (!AcceptablePropertyKeyTypes.Contains(description.GetType())) throw new System.Exception(); #endif if (this.properties == null) return defaultValue; if (properties.TryGetValue(description, out object property) property != null) return (T)property; return defaultValue; } private static readonly IReadOnlyDictionary object, object emptyProperties = NCDK.Common.Collections.Dictionaries.Empty object, object /// inheritdoc/ public virtual IReadOnlyDictionary object, object GetProperties() { if (this.properties == null) return emptyProperties; return this.properties; } /// inheritdoc/ public void SetProperties(IEnumerable KeyValuePair object, object properties) { this.properties = null; if (properties == null) return; AddProperties(properties); } /// inheritdoc/ public virtual void AddProperties(IEnumerable KeyValuePair object, object properties) { if (properties == null) return; if (this.properties == null) InitProperties(); foreach (var pair in properties) this.properties[pair.Key] = pair.Value; #+ if (addNofityChanged) { # NotifyChanged(); #+ } # } #+ } public void AddIsFlag(string modifier, string name, bool addNofityChanged) { # /// inheritdoc/ public #= modifier # bool #= name # { get { return (flags CDKConstants. #= name # Mask) != 0; } [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] set { Set #= name # WithoutNotify(value); #+ if (addNofityChanged) { # NotifyChanged(); #+ } # } } /*private protected*/ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] internal void Set #= name # WithoutNotify(bool value) { if (value) flags |= CDKConstants. #= name # Mask; else flags = ~CDKConstants. #= name # Mask; } #+ } # 

本文链接: http://iharachem.immuno-online.com/view-738249.html

发布于 : 2021-03-25 阅读(0)