public bool Contains(AttributeName name) { for (int i = 0; i < length; i++) { if (name.Equals(names[i])) { return(true); } } // [NOCPP[ for (int i = 0; i < xmlnsLength; i++) { if (name.Equals(xmlnsNames[i])) { return(true); } } // ]NOCPP] return(false); }
public override bool Equals(object otherObject) { if (otherObject is AttributeUpdate) { var otherUpdate = otherObject as AttributeUpdate; return(EntityGuid.Equals(otherUpdate.EntityGuid) && ComponentName.Equals(otherUpdate.ComponentName) && AttributeName.Equals(otherUpdate.AttributeName) && NewValue.Equals(otherUpdate.NewValue)); } return(false); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is CatalogQueryPrefix other && ((AttributeName == null && other.AttributeName == null) || (AttributeName?.Equals(other.AttributeName) == true)) && ((AttributePrefix == null && other.AttributePrefix == null) || (AttributePrefix?.Equals(other.AttributePrefix) == true))); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is CatalogQueryRange other && ((AttributeName == null && other.AttributeName == null) || (AttributeName?.Equals(other.AttributeName) == true)) && ((AttributeMinValue == null && other.AttributeMinValue == null) || (AttributeMinValue?.Equals(other.AttributeMinValue) == true)) && ((AttributeMaxValue == null && other.AttributeMaxValue == null) || (AttributeMaxValue?.Equals(other.AttributeMaxValue) == true))); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is CatalogQuerySortedAttribute other && ((AttributeName == null && other.AttributeName == null) || (AttributeName?.Equals(other.AttributeName) == true)) && ((InitialAttributeValue == null && other.InitialAttributeValue == null) || (InitialAttributeValue?.Equals(other.InitialAttributeValue) == true)) && ((SortOrder == null && other.SortOrder == null) || (SortOrder?.Equals(other.SortOrder) == true))); }
/// <summary> /// Returns true if OrgApacheSlingHcCoreImplJmxAttributeHealthCheckProperties instances are equal /// </summary> /// <param name="other">Instance of OrgApacheSlingHcCoreImplJmxAttributeHealthCheckProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(OrgApacheSlingHcCoreImplJmxAttributeHealthCheckProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( HcName == other.HcName || HcName != null && HcName.Equals(other.HcName) ) && ( HcTags == other.HcTags || HcTags != null && HcTags.Equals(other.HcTags) ) && ( HcMbeanName == other.HcMbeanName || HcMbeanName != null && HcMbeanName.Equals(other.HcMbeanName) ) && ( MbeanName == other.MbeanName || MbeanName != null && MbeanName.Equals(other.MbeanName) ) && ( AttributeName == other.AttributeName || AttributeName != null && AttributeName.Equals(other.AttributeName) ) && ( AttributeValueConstraint == other.AttributeValueConstraint || AttributeValueConstraint != null && AttributeValueConstraint.Equals(other.AttributeValueConstraint) )); }
/// <summary> /// Returns true if InlineResponseDefault2Field instances are equal /// </summary> /// <param name="other">Instance of InlineResponseDefault2Field to be compared</param> /// <returns>Boolean</returns> public bool Equals(InlineResponseDefault2Field other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( AttributeName == other.AttributeName || AttributeName != null && AttributeName.Equals(other.AttributeName) ) && ( IsRequired == other.IsRequired || IsRequired != null && IsRequired.Equals(other.IsRequired) )); }
public bool IsRandomParameter() { return(AttributeName.Equals("rand")); }
public string GetParameterValue(Entity Target) { if (Target.Contains(AttributeName)) { if (Target[AttributeName] is EntityReference) { // Lookup condition is based on GUID return(Conditional.HasCondition ? Conditional.GetResult(Target.GetAttributeValue <EntityReference>(AttributeName).Id) : Target.GetAttributeValue <EntityReference>(AttributeName).Name); } else if (Target[AttributeName] is OptionSetValue) { // Conditional OptionSetValue is based on the integer value return(Conditional.HasCondition ? Conditional.GetResult(Target.GetAttributeValue <OptionSetValue>(AttributeName).Value.ToString()) : Target.FormattedValues[AttributeName]); } else if (Target[AttributeName] is bool) { // Note: Boolean values ignore the match value, they just use the attribute value itself as the condition return(Conditional.HasCondition ? Conditional.GetResult(Target.GetAttributeValue <bool>(AttributeName)) : Target.FormattedValues[AttributeName]); } else if (Target[AttributeName] is DateTime) { // If there is a format AND a condition, apply formatting first, then evaluate condition as a string // If there is a condition without any format, evaluate condition as DateTime return(String.IsNullOrEmpty(StringFormatter) ? Conditional.GetResult(Target.GetAttributeValue <DateTime>(AttributeName)) : Conditional.GetResult(Target.GetAttributeValue <DateTime>(AttributeName).ToString(StringFormatter))); } else if (Target[AttributeName] is Money) { return(Conditional.HasCondition ? Conditional.GetResult(Target.GetAttributeValue <Money>(AttributeName).Value) : Target.GetAttributeValue <Money>(AttributeName).Value.ToString(StringFormatter)); } else if (Target[AttributeName] is int) { return(Conditional.HasCondition ? Conditional.GetResult(Target.GetAttributeValue <double>(AttributeName)) : Target.GetAttributeValue <double>(AttributeName).ToString(StringFormatter)); } else if (Target[AttributeName] is decimal) { return(Conditional.HasCondition ? Conditional.GetResult(Target.GetAttributeValue <decimal>(AttributeName)) : Target.GetAttributeValue <decimal>(AttributeName).ToString(StringFormatter)); } else if (Target[AttributeName] is double) { return(Conditional.HasCondition ? Conditional.GetResult(Target.GetAttributeValue <double>(AttributeName)) : Target.GetAttributeValue <double>(AttributeName).ToString(StringFormatter)); } else if (Target[AttributeName] is string) { return(Conditional.GetResult(Target[AttributeName].ToString())); } } else if (AttributeName.Equals("rand")) { string length = ""; string stringStyle = "upper"; int stringLength = 5; // Seems like reasonable default if (StringFormatter.Contains('?')) { length = StringFormatter.Split('?')[0]; stringStyle = StringFormatter.Split('?')[1].ToLower(); } else { length = StringFormatter; } if (!Int32.TryParse(length, out stringLength)) { stringLength = 5; } string stringValues = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (stringStyle == "mix") { stringValues = stringValues + stringValues.ToLower(); } else if (stringStyle == "lower") { stringValues = stringValues.ToLower(); } Random rnd = new Random(); return(String.Join("", Enumerable.Range(0, stringLength).Select(n => stringValues[rnd.Next(stringValues.Length)]))); } return(DefaultValue); }
public string GetParameterValue(Entity target) { if (target.Contains(AttributeName)) { switch (target[AttributeName]) { case EntityReference _: // Lookup condition is based on GUID return(Conditional.HasCondition ? Conditional.GetResult(target.GetAttributeValue <EntityReference>(AttributeName).Id) : target.GetAttributeValue <EntityReference>(AttributeName).Name); case OptionSetValue _: // Conditional OptionSetValue is based on the integer value return(Conditional.HasCondition ? Conditional.GetResult(target.GetAttributeValue <OptionSetValue>(AttributeName).Value.ToString()) : target.FormattedValues[AttributeName]); case bool _: // Note: Boolean values ignore the match value, they just use the attribute value itself as the condition return(Conditional.HasCondition ? Conditional.GetResult(target.GetAttributeValue <bool>(AttributeName)) : target.FormattedValues[AttributeName]); case DateTime _: // If there is a format AND a condition, apply formatting first, then evaluate condition as a string // If there is a condition without any format, evaluate condition as DateTime return(string.IsNullOrEmpty(StringFormatter) ? Conditional.GetResult(target.GetAttributeValue <DateTime>(AttributeName)) : Conditional.GetResult(target.GetAttributeValue <DateTime>(AttributeName).ToString(StringFormatter))); case Money _: return(Conditional.HasCondition ? Conditional.GetResult(target.GetAttributeValue <Money>(AttributeName).Value) : target.GetAttributeValue <Money>(AttributeName).Value.ToString(StringFormatter)); case int _: return(Conditional.HasCondition ? Conditional.GetResult(target.GetAttributeValue <double>(AttributeName)) : target.GetAttributeValue <double>(AttributeName).ToString(StringFormatter)); case decimal _: return(Conditional.HasCondition ? Conditional.GetResult(target.GetAttributeValue <decimal>(AttributeName)) : target.GetAttributeValue <decimal>(AttributeName).ToString(StringFormatter)); case double _: return(Conditional.HasCondition ? Conditional.GetResult(target.GetAttributeValue <double>(AttributeName)) : target.GetAttributeValue <double>(AttributeName).ToString(StringFormatter)); case string _: return(Conditional.GetResult(target[AttributeName].ToString())); } } else if (AttributeName.Equals("rand")) { string length; var stringStyle = "upper"; if (StringFormatter.Contains('?')) { length = StringFormatter.Split('?')[0]; stringStyle = StringFormatter.Split('?')[1].ToLower(); } else { length = StringFormatter; } if (!int.TryParse(length, out var stringLength)) { stringLength = 5; } var stringValues = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (stringStyle == "mix") { stringValues = stringValues + stringValues.ToLower(); } else if (stringStyle == "lower") { stringValues = stringValues.ToLower(); } return(string.Join("", Enumerable.Range(0, stringLength).Select(n => stringValues[Random.Next(stringValues.Length)]))); } return(DefaultValue); }
public int CompareTo(Attribute other) { return(!AttributeName.Equals(other.AttributeName) ? String.CompareOrdinal(AttributeName, other.AttributeName) : ID.CompareTo(other.ID)); }