public void AddOp(OperatorName opName, int value) { #if DEBUG debugCheck(); #endif _insts.Add(new Type2Instruction(opName, value)); }
public Op(OperatorName OpName, float param1, double param2, string param3) { this.OpName = OpName; this.param1 = param1; this.param2 = param2; this.param3 = param3; }
public static IParsingResult Parse(ParsingContext context) { RewindState rewind = context.RewindState; IParsingResult name = SimpleId.Parse(context); if (name != null) { return(name); } if (context.Parser.VerifyString("on")) { IParsingResult operatorName = OperatorName.Parse(context); if (operatorName != null) { IParsingResult arguments = TemplateArgs.Parse(context); return(new Operator(operatorName, arguments)); } context.Rewind(rewind); return(null); } if (context.Parser.VerifyString("dn")) { return(DestructorName.Parse(context)); } return(null); }
private dynamic ComboInOperator(AdvancedSearchRequest item) { var eo = new ExpandoObject(); OperatorName op = (OperatorName)item.Operator.OperatorType; var lst = new List <string>(); try { JArray array = (JArray)item.Value; foreach (var ar in array) { lst.Add(ar.Value <string>("value")); } } catch (Exception) { var obj = (JObject)item.Value; lst.Add(obj.Value <string>("value")); } eo.TryAdd <string, object>($"{formatQueryParameter(item.Attribute.AttributeName)}", lst); return(new { sql = $"{_prefix}[{item.Attribute.AttributeName}] in @{formatQueryParameter(item.Attribute.AttributeName)}", value = eo }); }
private dynamic ComboEqualsOperator(ComplexAdvancedSearchRequest item, int index) { var eo = new ExpandoObject(); OperatorName op = (OperatorName)item.SearchRequest.Operator.OperatorType; eo.TryAdd <string, object>($"{item.SearchRequest.Attribute.AttributeName}{index}", ((JObject)item.SearchRequest.Value).Value <string>("value")); string extraCondition = ""; if (item.Prefix != "") { item.Prefix += "."; } foreach (var cond in item.AdditionalCondition) { extraCondition += $" AND {item.Prefix}{cond.Key}=@{cond.Key}{index}"; eo.TryAdd <string, object>($"{cond.Key}{index}", cond.Value); } return(new { sql = $"({item.Prefix}{item.SearchRequest.Attribute.AttributeName}=@{item.SearchRequest.Attribute.AttributeName}{index} {extraCondition})", value = eo }); }
public Type2Instruction(OperatorName op) { this.Op = (byte)op; this.Value = 0; #if DEBUG _dbug_OnlyOp = true; #endif }
public Type2Instruction(OperatorName op, int value) { this.Op = (byte)op; this.Value = value; #if DEBUG _dbug_OnlyOp = false; #endif }
public Name CreatePostfix(OperatorName op) { return(new Name() { Kind = NameKind.Postfix, Identifier = null, Operator = op }); }
public Name CreateOperator(OperatorName op) { return(new Name() { Kind = NameKind.Operator, Identifier = null, Operator = op }); }
public void ChangeBasedOnArchive(ArchiveId archiveId, Reason reason, OperatorName @operator, Organization.DutchTranslation organization, RequestedChanges requestedChanges) { //TODO: Verify there are no duplicate identifiers (will fail anyway) and report as rejection requestedChanges .VerifyWith(_view.With(requestedChanges)) .RecordUsing(archiveId, reason, @operator, organization, Apply); }
GetClientValidationRules(ModelMetadata metadata, ControllerContext context) { string errorMessage = this.FormatErrorMessage(metadata.DisplayName); ModelClientValidationRule compareRule = new ModelClientValidationRule(); compareRule.ErrorMessage = errorMessage; compareRule.ValidationType = "genericcompare"; compareRule.ValidationParameters.Add("comparetopropertyname", CompareToPropertyName); compareRule.ValidationParameters.Add("operatorname", OperatorName.ToString()); yield return(compareRule); }
private dynamic StringLikeOperatorStartWith(AdvancedSearchRequest item) { var eo = new ExpandoObject(); OperatorName op = (OperatorName)item.Operator.OperatorType; eo.TryAdd <string, object>($"{formatQueryParameter(item.Attribute.AttributeName)}", $"{item.Value}%"); return(new { sql = $"{_prefix}[{item.Attribute.AttributeName}] LIKE @{formatQueryParameter(item.Attribute.AttributeName)}", value = eo }); }
public static Command ChangesTheRoadNetworkBasedOnAnArchive(ArchiveId archive, Reason reason, OperatorName @operator, OrganizationId organization, params RequestedChange[] changes) { return(new Command(new ChangeRoadNetworkBasedOnArchive { ArchiveId = archive, Reason = reason, Operator = @operator, OrganizationId = organization, Changes = changes })); }
private dynamic DateTimeNotEqualsOperator(AdvancedSearchRequest item) { var eo = new ExpandoObject(); OperatorName op = (OperatorName)item.Operator.OperatorType; eo.TryAdd <string, object>($"{formatQueryParameter(item.Attribute.AttributeName)}", item.Value); return(new { sql = $"{_prefix}[{item.Attribute.AttributeName}] <> @{formatQueryParameter(item.Attribute.AttributeName)}", value = eo }); }
public void RecordUsing( ArchiveId archiveId, Reason reason, OperatorName @operator, Organization.DutchTranslation organization, Action <object> applier) { if (organization == null) { throw new ArgumentNullException(nameof(organization)); } if (applier == null) { throw new ArgumentNullException(nameof(applier)); } if (_changes.Count == 0) { return; } if (_changes.OfType <RejectedChange>().Any()) { applier(new Messages.RoadNetworkChangesBasedOnArchiveRejected { ArchiveId = archiveId, Reason = reason, Operator = @operator, OrganizationId = organization.Identifier, Organization = organization.Name, Changes = _changes .OfType <RejectedChange>() .Select(change => change.Translate()) .ToArray() }); } else { applier(new Messages.RoadNetworkChangesBasedOnArchiveAccepted { ArchiveId = archiveId, Reason = reason, Operator = @operator, OrganizationId = organization.Identifier, Organization = organization.Name, Changes = _changes .OfType <AcceptedChange>() .Select(change => change.Translate()) .ToArray() }); } }
private dynamic DecimalBetweenOperator(AdvancedSearchRequest item) { var eo = new ExpandoObject(); OperatorName op = (OperatorName)item.Operator.OperatorType; eo.TryAdd <string, object>($"{formatQueryParameter(item.Attribute.AttributeName)}Value1", item.Value); eo.TryAdd <string, object>($"{formatQueryParameter(item.Attribute.AttributeName)}Value2", item.Value2); return(new { sql = $"{_prefix}[{item.Attribute.AttributeName}] between @{formatQueryParameter(item.Attribute.AttributeName)}Value1 and @{formatQueryParameter(item.Attribute.AttributeName)}Value2", value = eo }); }
private dynamic RadioEqualsOperator(AdvancedSearchRequest item) { var eo = new ExpandoObject(); OperatorName op = (OperatorName)item.Operator.OperatorType; var data = (JObject)item.Value; eo.TryAdd <string, object>($"{formatQueryParameter(item.Attribute.AttributeName)}", data.Value <string>("value")); return(new { sql = $"{_prefix}[{item.Attribute.AttributeName}] = @{formatQueryParameter(item.Attribute.AttributeName)}", value = eo }); }
static OperatorName() { ops["nw"] = new OperatorName("nw", "new", "new"); ops["na"] = new OperatorName("na", "new_array", "new[]"); ops["dl"] = new OperatorName("dl", "delete", "delete"); ops["da"] = new OperatorName("da", "delete_array", "delete[]"); ops["ps"] = new OperatorName("ps", "ps", "+"); ops["ng"] = new OperatorName("ng", "ng", "-"); ops["ad"] = new OperatorName("ad", "ad", "&"); ops["de"] = new OperatorName("de", "de", "*"); ops["co"] = new OperatorName("co", "co", "~"); ops["pl"] = new OperatorName("pl", "pl", "+"); ops["mi"] = new OperatorName("mi", "mi", "-"); ops["ml"] = new OperatorName("ml", "ml", "*"); ops["dv"] = new OperatorName("dv", "dv", "/"); ops["rm"] = new OperatorName("rm", "rm", "%"); ops["an"] = new OperatorName("an", "an", "&"); ops["or"] = new OperatorName("or", "or", "|"); ops["eo"] = new OperatorName("eo", "eo", "^"); ops["aS"] = new OperatorName("aS", "aS", "="); ops["pL"] = new OperatorName("pL", "pL", "+="); ops["mI"] = new OperatorName("mI", "mI", "-="); ops["mL"] = new OperatorName("mL", "mL", "*="); ops["dV"] = new OperatorName("dV", "dV", "/="); ops["rM"] = new OperatorName("rM", "rM", "%="); ops["aN"] = new OperatorName("aN", "aN", "&="); ops["oR"] = new OperatorName("oR", "oR", "|="); ops["eO"] = new OperatorName("eO", "eO", "^="); ops["ls"] = new OperatorName("ls", "ls", "<<"); ops["rs"] = new OperatorName("rs", "rs", ">>"); ops["lS"] = new OperatorName("lS", "lS", "<<="); ops["rS"] = new OperatorName("rS", "rS", ">>="); ops["eq"] = new OperatorName("eq", "eq", "=="); ops["ne"] = new OperatorName("ne", "ne", "!="); ops["lt"] = new OperatorName("lt", "lt", "<"); ops["gt"] = new OperatorName("gt", "gt", ">"); ops["le"] = new OperatorName("le", "le", "<="); ops["ge"] = new OperatorName("ge", "ge", ">="); ops["ss"] = new OperatorName("ss", "ss", "<=>"); ops["nt"] = new OperatorName("nt", "nt", "!"); ops["aa"] = new OperatorName("aa", "aa", "&&"); ops["oo"] = new OperatorName("oo", "oo", "||"); ops["pp"] = new OperatorName("pp", "pp", "++"); ops["mm"] = new OperatorName("mm", "mm", "--"); ops["cm"] = new OperatorName("cm", "cm", ","); ops["pm"] = new OperatorName("pm", "pm", "->*"); ops["pt"] = new OperatorName("pt", "pt", "->"); ops["cl"] = new OperatorName("cl", "cl", "()"); ops["ix"] = new OperatorName("ix", "ix", "[]"); ops["qu"] = new OperatorName("qu", "qu", "?"); }
/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { unchecked { return(EVSEStatusRecords.GetHashCode() * 17 ^ OperatorId.GetHashCode() * 11 ^ (OperatorName != null ? OperatorName.GetHashCode() * 5 : 0) ^ Action.GetHashCode()); } }
/// <summary> /// Compares two push EVSE status requests for equality. /// </summary> /// <param name="PushEVSEStatus">An push EVSE status request to compare with.</param> /// <returns>True if both match; False otherwise.</returns> public override Boolean Equals(PushEVSEStatusRequest PushEVSEStatus) { if ((Object)PushEVSEStatus == null) { return(false); } return(EVSEStatusRecords.Count().Equals(PushEVSEStatus.EVSEStatusRecords.Count()) && OperatorId.Equals(PushEVSEStatus.OperatorId) && ((OperatorName == null && PushEVSEStatus.OperatorName == null) || (OperatorName != null && PushEVSEStatus.OperatorName != null && OperatorName.Equals(PushEVSEStatus.OperatorName))) && Action.Equals(PushEVSEStatus.Action)); }
private TranslatedChanges( Reason reason, OperatorName @operator, OrganizationId organization, ImmutableList <ITranslatedChange> changes, ImmutableDictionary <RecordNumber, RoadNodeId> mapToRoadNodeId, ImmutableDictionary <RecordNumber, RoadSegmentId> mapToRoadSegmentId) { Reason = reason; Operator = @operator; Organization = organization; _changes = changes ?? throw new ArgumentNullException(nameof(changes)); _mapToRoadNodeId = mapToRoadNodeId ?? throw new ArgumentNullException(nameof(mapToRoadNodeId)); _mapToRoadSegmentId = mapToRoadSegmentId ?? throw new ArgumentNullException(nameof(mapToRoadSegmentId)); }
static byte IsLoadIntOrMergeableLoadIntExtension(OperatorName opName) { switch (opName) { //case OperatorName.LoadSbyte3://except LoadSbyte3 *** case OperatorName.LoadInt: //merge-able return(1); case OperatorName.LoadShort2: //merge-able return(2); case OperatorName.LoadSbyte4: //merge-able return(3); } return(0); }
/// <inheritdoc /> public override int GetHashCode() { unchecked { var hash = 19; if (OperatorName != null) { hash = hash * 397 + OperatorName.GetHashCode(); } if (Arguments != null) { hash = Arguments.Aggregate(hash, (current, value) => current * 31 + value.GetHashCode()); } return(hash); } }
void AddStemToList(OperatorName stemName, ref int hintStemCount) { //support 4 kinds //1. //|- y dy {dya dyb}* hstemhm (18) |- //2. //|- x dx {dxa dxb}* vstemhm (23) |- //3. //|- y dy {dya dyb}* hstem (1) |- //4. //|- x dx {dxa dxb}* vstem (3) |- //----------------------- //notes //The sequence and form of a Type 2 charstring program may be //represented as: //w? { hs* vs*cm * hm * mt subpath}? { mt subpath} *endchar if ((current_int_count % 2) != 0) { //all kind has even number of stem if (foundSomeStem) { #if DEBUG insts.dbugDumpInstructionListToFile("d:\\WImageTest\\test_type2_" + (_dbugInstructionListMark - 1) + ".txt"); #endif throw new NotSupportedException(); } else { //the first one is 'width' insts.ChangeFirstInstToGlyphWidthValue(); current_int_count--; } } hintStemCount += (current_int_count / 2); //save a snapshot of stem count insts.AddOp(stemName); current_int_count = 0; //clear foundSomeStem = true; _latestOpName = stemName; }
public RoadNetworkCommandModule(IStreamStore store, IRoadNetworkSnapshotReader snapshotReader, IClock clock) { if (store == null) { throw new ArgumentNullException(nameof(store)); } if (snapshotReader == null) { throw new ArgumentNullException(nameof(snapshotReader)); } if (clock == null) { throw new ArgumentNullException(nameof(clock)); } For <ChangeRoadNetworkBasedOnArchive>() .UseValidator(new ChangeRoadNetworkBasedOnArchiveValidator()) .UseRoadRegistryContext(store, snapshotReader, EnrichEvent.WithTime(clock)) .Handle(async(context, message, ct) => { var archive = new ArchiveId(message.Body.ArchiveId); var @operator = new OperatorName(message.Body.Operator); var reason = new Reason(message.Body.Reason); var organizationId = new OrganizationId(message.Body.OrganizationId); var organization = await context.Organizations.TryGet(organizationId, ct); var translation = organization == null ? Organization.PredefinedTranslations.Unknown : organization.Translation; var network = await context.RoadNetworks.Get(ct); var translator = new RequestedChangeTranslator( network.ProvidesNextRoadNodeId(), network.ProvidesNextRoadSegmentId(), network.ProvidesNextGradeSeparatedJunctionId(), network.ProvidesNextEuropeanRoadAttributeId(), network.ProvidesNextNationalRoadAttributeId(), network.ProvidesNextNumberedRoadAttributeId(), network.ProvidesNextRoadSegmentLaneAttributeId(), network.ProvidesNextRoadSegmentWidthAttributeId(), network.ProvidesNextRoadSegmentSurfaceAttributeId() ); var requestedChanges = translator.Translate(message.Body.Changes); network.ChangeBasedOnArchive(archive, reason, @operator, translation, requestedChanges); }); }
private dynamic ComboInOperator(ComplexAdvancedSearchRequest item, int index) { var eo = new ExpandoObject(); OperatorName op = (OperatorName)item.SearchRequest.Operator.OperatorType; if (item.Prefix != "") { item.Prefix += "."; } var lst = new List <string>(); try { JArray array = (JArray)item.SearchRequest.Value; foreach (var ar in array) { lst.Add(ar.Value <string>("value")); } } catch (Exception) { var obj = (JObject)item.SearchRequest.Value; lst.Add(obj.Value <string>("value")); } eo.TryAdd <string, object>($"{item.SearchRequest.Attribute.AttributeName}{index}", lst); string extraCondition = ""; foreach (var cond in item.AdditionalCondition) { extraCondition += $" AND {item.Prefix}{cond.Key}=@{cond.Key}{index}"; eo.TryAdd <string, object>($"{cond.Key}{index}", cond.Value); } return(new { sql = $"({item.Prefix}{item.SearchRequest.Attribute.AttributeName} in @{item.SearchRequest.Attribute.AttributeName}{index} {extraCondition})", value = eo }); }
private dynamic MultiCheckboxEqualsOperator(AdvancedSearchRequest item) { var eo = new ExpandoObject(); OperatorName op = (OperatorName)item.Operator.OperatorType; if (item.Value.GetType() == typeof(JObject)) { var jObj = (JObject)item.Value; eo.TryAdd <string, object>($"{formatQueryParameter(item.Attribute.AttributeName)}", jObj.Value <string>("value")); } else { eo.TryAdd <string, object>($"{formatQueryParameter(item.Attribute.AttributeName)}", item.Value); } return(new { sql = $"{_prefix}[{item.Attribute.AttributeName}] = @{formatQueryParameter(item.Attribute.AttributeName)}", value = eo }); }
public override string ToString() { int merge_flags = Op >> 6; //upper most 2 bits we use as our extension //so operator name is lower 6 bits int only_operator = Op & 0b111111; OperatorName op_name = (OperatorName)only_operator; if (_dbug_OnlyOp) { return(op_name.ToString()); } else { if (s_dbugSb == null) { s_dbugSb = new System.Text.StringBuilder(); } s_dbugSb.Length = 0;//reset bool has_ExtenedForm = true; //this is my extension switch (merge_flags) { #if DEBUG default: throw new NotSupportedException(); #endif case 0: //nothing has_ExtenedForm = false; break; case 1: //contains merge data for LoadInt s_dbugSb.Append(Value.ToString() + " "); break; case 2: //contains merge data for LoadShort2 s_dbugSb.Append((short)(Value >> 16) + " " + (short)(Value >> 0) + " "); break; case 3: //contains merge data for LoadSbyte4 s_dbugSb.Append((sbyte)(Value >> 24) + " " + (sbyte)(Value >> 16) + " " + (sbyte)(Value >> 8) + " " + (sbyte)(Value) + " "); break; } switch (op_name) { case OperatorName.LoadInt: s_dbugSb.Append(Value); break; case OperatorName.LoadFloat: s_dbugSb.Append(ReadValueAsFixed1616().ToString()); break; //----------- case OperatorName.LoadShort2: s_dbugSb.Append((short)(Value >> 16) + " " + (short)(Value >> 0)); break; case OperatorName.LoadSbyte4: s_dbugSb.Append((sbyte)(Value >> 24) + " " + (sbyte)(Value >> 16) + " " + (sbyte)(Value >> 8) + " " + (sbyte)(Value)); break; case OperatorName.LoadSbyte3: s_dbugSb.Append((sbyte)(Value >> 24) + " " + (sbyte)(Value >> 16) + " " + (sbyte)(Value >> 8)); break; //----------- case OperatorName.hintmask1: case OperatorName.hintmask2: case OperatorName.hintmask3: case OperatorName.hintmask4: case OperatorName.hintmask_bits: s_dbugSb.Append((op_name).ToString() + " " + Convert.ToString(Value, 2)); break; default: if (has_ExtenedForm) { s_dbugSb.Append((op_name).ToString()); } else { s_dbugSb.Append((op_name).ToString() + " " + Value.ToString()); } break; } return(s_dbugSb.ToString()); } }
public Op(OperatorName OpName, float param1, double param2, string param3) { this.OpName = OpName; this.param1 = param1; this.param2 = param2; this.param3 = param3; }
public static bool StartsWith(ParsingContext context) { return(OperatorName.StartsWith(context) || CtorDtorName.StartsWith(context) || SourceName.StartsWith(context) || UnnamedTypeName.StartsWith(context)); }
public static IParsingResultExtended Parse(ParsingContext context) { return(OperatorName.Parse(context) ?? CtorDtorName.Parse(context) ?? SourceName.Parse(context) ?? UnnamedTypeName.Parse(context)); }