/// <summary>Linkage specification for this symbol</summary> /// <typeparam name="T">Type of the value (Must be <see cref="GlobalValue"/> or a type derived from it)</typeparam> /// <param name="self">Value to modify</param> /// <param name="value">New value to set</param> /// <returns><paramref name="self"/> for fluent usage patterns</returns> /// <seealso cref="GlobalValue.Linkage"/> public static T Linkage <T>([ValidatedNotNull] this T self, Linkage value) where T : GlobalValue { self.ValidateNotNull(nameof(self)); self.Linkage = value; return(self); }
/// <summary> /// Deserialize JSON into a FHIR Linkage /// </summary> public static void DeserializeJson(this Linkage current, ref Utf8JsonReader reader, JsonSerializerOptions options) { string propertyName; while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndObject) { return; } if (reader.TokenType == JsonTokenType.PropertyName) { propertyName = reader.GetString(); if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug) { Console.WriteLine($"Linkage >>> Linkage.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } reader.Read(); current.DeserializeJsonProperty(ref reader, options, propertyName); } } throw new JsonException($"Linkage: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); }
public static Character CreateCharacter(int id) { Character c = null; switch (id) { //有没有bug看单位表和各个类 case 1: c = new MvpTemp(); break; case 2: c = new TankTemp(); break; case 3: c = new WarriorTemp(); break; case 4: c = new Taunter(); break; // 嘲讽盾 case 5: c = new Paladin(); break; // 奶骑 case 6: break; // 反甲 case 7: c = new Explosive(); break; // 自爆卡车 case 8: c = new Linkage(); break; // 联动 case 9: c = new TaiChi(); break; // 打太极 case 10: c = new Silence(); break; // 沉默 case 11: c = new GroupHealer(); break; // 群体治疗 case 12: break; // 单体治疗 case 13: break; // 操控怒气 case 14: c = new Calmer(); break; // 频繁减怒 case 15: c = new Buffer(); break; // 加buff case 16: c = new Pierce(); break; // 单体输出 case 17: c = new Sputter(); break; // 溅射 case 18: c = new Volition(); break; // 越打越痛 case 19: c = new Transformer(); break; // 变身 case 20: c = new DoubleAgent(); break; // 内鬼 case 21: c = new Lazer(); break; // 激光豆 case 22: c = new Darius(); break; // 人头狗 case 23: break; // 投石机 case 24: c = new Marshall(); break; // 黑胡子 default: Debug.Log("输入了错误的id,找不到对应单位"); break; } return(c); }
public static Function Create(FunctionType type, Linkage linkage, string name, Module m) { var value = LLVM.AddFunction(m.Unwrap(), name, type.Unwrap()); var f = new Function(value); LLVM.SetLinkage(value, linkage.Unwrap()); return(f); }
/// <summary>Adds a global to this module</summary> /// <param name="typeRef">Type of the global's value</param> /// <param name="isConst">Flag to indicate if this global is a constant</param> /// <param name="linkage">Linkage type for this global</param> /// <param name="constVal">Initial value for the global</param> /// <returns>New global variable</returns> public GlobalVariable AddGlobal(ITypeRef typeRef, bool isConst, Linkage linkage, Constant constVal) { ValidateHandle( ); typeRef.ValidateNotNull(nameof(typeRef)); linkage.ValidateDefined(nameof(linkage)); constVal.ValidateNotNull(nameof(constVal)); return(AddGlobal(typeRef, isConst, linkage, constVal, string.Empty)); }
public void CreateClustersTest1() { Start test = new Start(@"..\..\..\Data\Sample1D.csv"); List <DataPoint> temp = test.GetDataPoints(); Linkage link = new Linkage(10, temp); link.CreateInitClusters(); int num = link.GetClustersCount(); Assert.AreEqual(num, 6); }
/// <summary>Adds a global to this module</summary> /// <param name="typeRef">Type of the value</param> /// <param name="isConst">Flag to indicate if this global is a constant</param> /// <param name="linkage">Linkage type for this global</param> /// <param name="constVal">Initial value for the global</param> /// <param name="name">Name of the variable</param> /// <returns>New global variable</returns> public GlobalVariable AddGlobal(ITypeRef typeRef, bool isConst, Linkage linkage, Constant constVal, string name) { ThrowIfDisposed( ); var retVal = AddGlobal(typeRef, name); retVal.IsConstant = isConst; retVal.Linkage = linkage; retVal.Initializer = constVal; return(retVal); }
public void ClusterPairsTest4() { Start test = new Start(@"..\..\..\Data\IrisData.csv"); List <DataPoint> temp = test.GetDataPoints(); Linkage link = new Linkage(10, temp); link.CreateInitClusters(); link.CreateClusterPairs(); int num = link.GetClusterPairsCount(); Assert.AreEqual(num, 11175); }
public void OnSceneGUI() { Linkage links = (Linkage)target; if (Event.current.type == EventType.MouseDown && Event.current.button == 1) { Ray worldRay = HandleUtility.GUIPointToWorldRay(Event.current.mousePosition); RaycastHit hitInfo; if (Physics.Raycast(worldRay, out hitInfo)) { Joint selected; if (selected = hitInfo.collider.GetComponent <Joint>()) { if (previousSelection == null) // first selection { previousSelection = selected; } else // second selection { if (previousSelection == selected) // selected again, undo selection { previousSelection = null; } else if (previousSelection.initialEdges.Contains(selected)) { Undo.RecordObject(previousSelection, "Remove Edge"); previousSelection.initialEdges.Remove(selected); PrefabUtility.RecordPrefabInstancePropertyModifications(previousSelection); } else if (selected.initialEdges.Contains(previousSelection)) { Undo.RecordObject(selected, "Remove Edge"); selected.initialEdges.Remove(previousSelection); PrefabUtility.RecordPrefabInstancePropertyModifications(selected); } else // didn't exist yet, add from previous to new { Undo.RecordObject(previousSelection, "Add Edge"); previousSelection.initialEdges.Add(selected); PrefabUtility.RecordPrefabInstancePropertyModifications(previousSelection); } previousSelection = null; } Event.current.Use(); } } } if (previousSelection) { Handles.DrawWireCube(previousSelection.transform.position, previousSelection.transform.lossyScale); } }
/// <summary>Adds a global to this module</summary> /// <param name="typeRef">Type of the global's value</param> /// <param name="isConst">Flag to indicate if this global is a constant</param> /// <param name="linkage">Linkage type for this global</param> /// <param name="constVal">Initial value for the global</param> /// <param name="name">Name of the variable</param> /// <returns>New global variable</returns> public GlobalVariable AddGlobal(ITypeRef typeRef, bool isConst, Linkage linkage, Constant constVal, string name) { ValidateHandle( ); typeRef.ValidateNotNull(nameof(typeRef)); linkage.ValidateDefined(nameof(linkage)); constVal.ValidateNotNull(nameof(constVal)); name.ValidateNotNull(nameof(name)); var retVal = AddGlobal(typeRef, name); retVal.IsConstant = isConst; retVal.Linkage = linkage; retVal.Initializer = constVal; return(retVal); }
private static void Add <T>(Linkage <T> item, ICollection <T> list, IEnumerable <Linkage <T> > population, Func <T, T, bool> hasDependency, Func <T, int> getPriority) { if (item.Used) { return; } item.Used = true; foreach (var dependency in population.Where(dep => hasDependency(item.Element, dep.Element))) { Add(dependency, list, population, hasDependency, getPriority); } list.Add(item.Element); }
/// <summary> /// Serialize a FHIR Linkage into JSON /// </summary> public static void SerializeJson(this Linkage current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } writer.WriteString("resourceType", "Linkage"); // Complex: Linkage, Export: Linkage, Base: DomainResource (DomainResource) ((Hl7.Fhir.Model.DomainResource)current).SerializeJson(writer, options, false); if (current.ActiveElement != null) { if (current.ActiveElement.Value != null) { writer.WriteBoolean("active", (bool)current.ActiveElement.Value); } if (current.ActiveElement.HasExtensions() || (!string.IsNullOrEmpty(current.ActiveElement.ElementId))) { JsonStreamUtilities.SerializeExtensionList(writer, options, "_active", false, current.ActiveElement.Extension, current.ActiveElement.ElementId); } } if (current.Author != null) { writer.WritePropertyName("author"); current.Author.SerializeJson(writer, options); } if ((current.Item != null) && (current.Item.Count != 0)) { writer.WritePropertyName("item"); writer.WriteStartArray(); foreach (Linkage.ItemComponent val in current.Item) { val.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }
public override void MakeSchemaCompliant() { base.MakeSchemaCompliant(); Linkage.MakeSchemaCompliant(); }
/// <summary>Linkage specification for this symbol</summary> /// <typeparam name="T">Type of the value (Must be <see cref="GlobalValue"/> or a type derived from it)</typeparam> /// <param name="self">Value to modify</param> /// <param name="value">New value to set</param> /// <returns><paramref name="self"/> for fluent usage patterns</returns> /// <seealso cref="GlobalValue.Linkage"/> public static T Linkage <T>(this T self, Linkage value) where T : GlobalValue { self.Linkage = value; return(self); }
public unsafe static void SetLinkage(ValueRef Global, Linkage Linkage) { LLVMPINVOKE.SetLinkage(Global.Value, (int)Linkage); }
/// <summary>Adds a global to this module.</summary> /// <param name="addressSpace">Address space to add the global to.</param> /// <param name="typeRef">Type of the value.</param> /// <param name="isConst">Flag to indicate if this global is a constant.</param> /// <param name="linkage">Linkage type for this global.</param> /// <param name="constVal">Initial value for the global.</param> /// <param name="name">Name of the variable.</param> /// <returns>New global variable.</returns> public GlobalVariable AddGlobalInAddressSpace(uint addressSpace, ITypeRef typeRef, bool isConst, Linkage linkage, Constant constVal, string name) { this.ThrowIfDisposed(); var retVal = this.AddGlobalInAddressSpace(addressSpace, typeRef, name); retVal.IsConstant = isConst; retVal.Linkage = linkage; retVal.Initializer = constVal; return(retVal); }
/// <summary> /// Deserialize JSON into a FHIR Linkage /// </summary> public static void DeserializeJsonProperty(this Linkage current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName) { switch (propertyName) { case "active": if (reader.TokenType == JsonTokenType.Null) { current.ActiveElement = new FhirBoolean(); reader.Skip(); } else { current.ActiveElement = new FhirBoolean(reader.GetBoolean()); } break; case "_active": if (current.ActiveElement == null) { current.ActiveElement = new FhirBoolean(); } ((Hl7.Fhir.Model.Element)current.ActiveElement).DeserializeJson(ref reader, options); break; case "author": current.Author = new Hl7.Fhir.Model.ResourceReference(); ((Hl7.Fhir.Model.ResourceReference)current.Author).DeserializeJson(ref reader, options); break; case "item": if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read())) { throw new JsonException($"Linkage error reading 'item' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } current.Item = new List <Linkage.ItemComponent>(); while (reader.TokenType != JsonTokenType.EndArray) { Hl7.Fhir.Model.Linkage.ItemComponent v_Item = new Hl7.Fhir.Model.Linkage.ItemComponent(); v_Item.DeserializeJson(ref reader, options); current.Item.Add(v_Item); if (!reader.Read()) { throw new JsonException($"Linkage error reading 'item' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}"); } if (reader.TokenType == JsonTokenType.EndObject) { reader.Read(); } } if (current.Item.Count == 0) { current.Item = null; } break; // Complex: Linkage, Export: Linkage, Base: DomainResource default: ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName); break; } }
public static LLVMLinkage Unwrap(this Linkage wrapper) => (LLVMLinkage)(int)wrapper;
/// <summary>Adds a global to this module</summary> /// <param name="typeRef">Type of the value</param> /// <param name="isConst">Flag to indicate if this global is a constant</param> /// <param name="linkage">Linkage type for this global</param> /// <param name="constVal">Initial value for the global</param> /// <returns>New global variable</returns> public GlobalVariable AddGlobal(ITypeRef typeRef, bool isConst, Linkage linkage, Constant constVal) { ThrowIfDisposed( ); return(AddGlobal(typeRef, isConst, linkage, constVal, string.Empty)); }
/// <summary>Adds a global to this module</summary> /// <param name="addressSpace">Address space to add the global to</param> /// <param name="typeRef">Type of the value</param> /// <param name="isConst">Flag to indicate if this global is a constant</param> /// <param name="linkage">Linkage type for this global</param> /// <param name="constVal">Initial value for the global</param> /// <returns>New global variable</returns> public GlobalVariable AddGlobalInAddressSpace(uint addressSpace, ITypeRef typeRef, bool isConst, Linkage linkage, Constant constVal) { ThrowIfDisposed( ); return(AddGlobalInAddressSpace(addressSpace, typeRef, isConst, linkage, constVal, string.Empty)); }