public override void Start() { DeserializationFilter deserializationFilter = new DeserializationFilter(); deserializationFilter.UseLegacyCollection = this.IsLegacyCollection; ServiceMapFilter serviceMapFilter = new ServiceMapFilter(this); WsdlFilter wsdlFilter = new WsdlFilter(); ContextFilter contextFilter = new ContextFilter(this); AuthenticationFilter authenticationFilter = new AuthenticationFilter(this); DescribeServiceFilter describeServiceFilter = new DescribeServiceFilter(); //CacheFilter cacheFilter = new CacheFilter(); ProcessFilter processFilter = new ProcessFilter(this); MessageFilter messageFilter = new MessageFilter(this); DebugFilter debugFilter = new DebugFilter(); SerializationFilter serializationFilter = new SerializationFilter(); serializationFilter.UseLegacyCollection = this.IsLegacyCollection; serializationFilter.UseLegacyThrowable = this.IsLegacyThrowable; deserializationFilter.Next = serviceMapFilter; serviceMapFilter.Next = wsdlFilter; wsdlFilter.Next = contextFilter; contextFilter.Next = authenticationFilter; authenticationFilter.Next = describeServiceFilter; describeServiceFilter.Next = processFilter; //describeServiceFilter.Next = cacheFilter; //cacheFilter.Next = processFilter; processFilter.Next = debugFilter; debugFilter.Next = messageFilter; messageFilter.Next = serializationFilter; _filterChain = new FilterChain(deserializationFilter); }
private static void RunContextStatistics() { var io = new PreprocessingIo(DirContexts, DirTmp, DirTmp); var cf = new ContextFilter(GeneratedCode.Include, Duplication.Include); new ContextStatisticsRunner(io, cf, new ContextStatisticsLogger(), NumWorkers).Run(); }
public override Vector2 CalculateMove(FlockAgent agent, List <Transform> context, Flock flock) { // If no neighbors, then no adjustment if (context.Count == 0) { return(Vector2.zero); } // Otherwise average out position of neighbors Vector2 move = Vector2.zero; int nAvoid = 0; List <Transform> filteredContext = (ContextFilter != null) ? ContextFilter.Filter(agent, context) : context; foreach (Transform item in filteredContext) { bool inAvoidanceRadius = Vector2.SqrMagnitude(item.position - agent.transform.position) < flock.SquareAvoidanceRadius; if (!inAvoidanceRadius) { continue; } ++nAvoid; move += (Vector2)(agent.transform.position - item.position); } return((nAvoid > 0) ? move / nAvoid : move); }
public override Vector2 CalculateMove(FlockAgent agent, List <Transform> context, Flock flock) { // If no neighbors, then no adjustment if (context.Count == 0) { return(Vector2.zero); } // Otherwise average out position of neighbors Vector2 move = Vector2.zero; List <Transform> filteredContext = (ContextFilter != null) ? ContextFilter.Filter(agent, context) : context; foreach (Transform item in filteredContext) { move += (Vector2)item.position; } if (filteredContext.Count != 0) { move /= filteredContext.Count; } // Create offset from agent position move -= (Vector2)agent.transform.position; move = Vector2.SmoothDamp(agent.transform.up, move, ref currentVelocity, agentSmoothTime); return(move); }
public object Provide(object context) { object prvContext = context; if (ContextFilter != null) { prvContext = ContextFilter.Provide(prvContext); } object res = Provider.Provide(prvContext); if (ResultFilter != null) { res = ResultFilter.Provide(res); } return(res); }
public object Provide(object context) { var opContext = context; if (ContextFilter != null) { opContext = ContextFilter.Provide(opContext); } Operation.Execute(opContext); var result = opContext; if (ResultExtractor != null) { result = ResultExtractor.Provide(result); } return(result); }
public override Vector2 CalculateMove(FlockAgent agent, List <Transform> context, Flock flock) { // If no neighbors, maintain current alignment if (context.Count == 0) { return(agent.transform.up); } // Otherwise average out alignment of neighbors Vector2 move = Vector2.zero; List <Transform> filteredContext = (ContextFilter != null) ? ContextFilter.Filter(agent, context) : context; foreach (Transform item in filteredContext) { move += (Vector2)item.up; } if (filteredContext.Count != 0) { move /= filteredContext.Count; } return(move); }
private void UpdatePropertiesPanel(XmlNode selectedItem) { if (selectedItem.Name == "input") { switch (selectedItem.Attributes["type"].Value) { case "MSMQ": MyGrid = new MSMQIN(selectedItem, this.View); break; case "MQ": MyGrid = new MQIN(selectedItem, this.View); break; case "FILE": MyGrid = new FILEIN(selectedItem, this.View); break; case "KAFKA": MyGrid = new KAFKAIN(selectedItem, this.View); break; case "HTTP": MyGrid = new HTTPIN(selectedItem, this.View); break; case "RABBITDEFEX": MyGrid = new RABBITIN(selectedItem, this.View); break; case "MQTT": MyGrid = new MQTTIN(selectedItem, this.View); break; case "TCPSERVER": MyGrid = new TCPIN(selectedItem, this.View); break; case "TESTSOURCE": MyGrid = new TESTSOURCE(selectedItem, this.View); break; } } else if (selectedItem.Name == "output" || selectedItem.Name == "altqueue") { switch (selectedItem.Attributes["type"].Value) { case "MSMQ": MyGrid = new MSMQOUT(selectedItem, this.View); break; case "MQ": MyGrid = new MQOUT(selectedItem, this.View); break; case "FILE": MyGrid = new FILEOUT(selectedItem, this.View); break; case "KAFKA": MyGrid = new KAFKAOUT(selectedItem, this.View); break; case "REST": MyGrid = new RESTOUT(selectedItem, this.View); break; case "HTTP": MyGrid = new HTTPOUT(selectedItem, this.View); break; case "TCPCLIENT": MyGrid = new TCPOUT(selectedItem, this.View); break; case "RABBITDEFEX": MyGrid = new RABBITOUT(selectedItem, this.View); break; case "MQTT": MyGrid = new MQTTIN(selectedItem, this.View); break; case "SMTP": MyGrid = new SMTPOut(selectedItem, this.View); break; case "FTP": MyGrid = new FTPOut(selectedItem, this.View); break; case "SINK": MyGrid = new SINK(selectedItem, this.View); break; } } else if (selectedItem.Name == "monitor") { MyGrid = new MonitorGrid(selectedItem, this.View); } else if (selectedItem.Name == "filter") { MyGrid = new Filter(selectedItem, this.View); } else if (selectedItem.Name == "pipe") { MyGrid = new PIPE(selectedItem, this.View); } else if (selectedItem.Name == "namespace") { MyGrid = new NameSpaceGrid(selectedItem, this.View); } else if (selectedItem.Name == "service") { MyGrid = new ServiceSetting(selectedItem, this.View); } else if (selectedItem.Name == "and" || selectedItem.Name == "or" || selectedItem.Name == "xor" || selectedItem.Name == "not") { MyGrid = new BooleanExpression(selectedItem, this.View); } else if (selectedItem.Name == "contains") { MyGrid = new ContainsFilter(selectedItem, this.View); } else if (selectedItem.Name == "equals") { MyGrid = new EqualsFilter(selectedItem, this.View); } else if (selectedItem.Name == "matches") { MyGrid = new MatchesFilter(selectedItem, this.View); } else if (selectedItem.Name == "length") { MyGrid = new LengthFilter(selectedItem, this.View); } else if (selectedItem.Name == "xpexists") { MyGrid = new XPExistsFilter(selectedItem, this.View); } else if (selectedItem.Name == "xpmatches") { MyGrid = new XPMatchesFilter(selectedItem, this.View); } else if (selectedItem.Name == "xpequals") { MyGrid = new XPEqualsFilter(selectedItem, this.View); } else if (selectedItem.Name == "dateRange") { MyGrid = new DateRangeFilter(selectedItem, this.View); } else if (selectedItem.Name == "contextContains") { MyGrid = new ContextFilter(selectedItem, this.View); } OnPropertyChanged("MyGrid"); }
public void ToStringInformsAboutConfiguration_b() { var sut = new ContextFilter(GeneratedCode.Exclude, Duplication.Include); Assert.AreEqual("ContextFilter(GeneratedCode.Exclude, Duplication.Include)", sut.ToString()); }
public void ShouldProcessMethodSecondTime(GeneratedCode g, Duplication d, bool shouldProcess) { _sut = new ContextFilter(g, d); Assert.True(_sut.ShouldProcessOrRegister(M(1))); Assert.AreEqual(shouldProcess, _sut.ShouldProcessOrRegister(M(1))); }
public void ShouldProcessSecondTimePartialClasses(GeneratedCode g, Duplication d) { _sut = new ContextFilter(g, d); Assert.True(_sut.ShouldProcessOrRegister(Part(1))); Assert.True(_sut.ShouldProcessOrRegister(Part(1))); }
public void ShouldProcessGeneratedCore(GeneratedCode g, Duplication d, bool shouldProcess) { _sut = new ContextFilter(g, d); Assert.AreEqual(shouldProcess, _sut.ShouldProcessOrRegister(Gen(1))); }
protected void SetUp(GeneratedCode genCode, Duplication dupe) { var uc = new ContextFilter(genCode, dupe); Sut = new ContextStatisticsExtractor(uc); }
public static ContextFilter FromContextDefinition(string contextString) { /* * Context string format is a list of tokens joined by either & or | but not both * and grouped inside (). Groups can also be joined by either & or | but not both * Context strings can not be nested * Examples: a,b,c are tokens * (a) * (a&b&c) * (a|b|c) * (a|b|c)&(a&b&c) * (a|b|c)|(a&b&c) */ // parse context string bool supportsZeroDoc = false; ContextFilter ctxFilter = new ContextFilter(); var collectedConditions = new HashSet <Condition>(); bool capturingSubCondition = false; bool subConditionIsNot = false; CompoundCondition subCondition = new AllCondition(); var collectedSubConditions = new HashSet <Condition>(); bool capturingToken = false; string currentToken = string.Empty; Action captureToken = () => { if (capturingToken && currentToken != string.Empty) { if (Condition.FromToken(currentToken) is Condition condition) { if (condition is ZeroDocCondition) { supportsZeroDoc = true; } collectedSubConditions.Add(condition); } currentToken = string.Empty; } }; Action captureSubConditions = () => { if (capturingSubCondition) { if (collectedSubConditions.Count > 0) { subCondition.Conditions = collectedSubConditions; subCondition.IsNot = subConditionIsNot; collectedConditions.Add(subCondition); } collectedSubConditions = new HashSet <Condition>(); capturingSubCondition = false; subConditionIsNot = false; } }; foreach (char c in contextString) { switch (c) { // sub conditions case '(': if (capturingSubCondition) { captureToken(); } else { capturingSubCondition = true; capturingToken = true; } continue; case ')': captureToken(); captureSubConditions(); continue; // (sub)condition types case CONTEXT_CONDITION_ALL_SEP: captureToken(); if (capturingSubCondition) { subCondition = new AllCondition(); } else { ctxFilter.Condition = new AllCondition(); } continue; case CONTEXT_CONDITION_ANY_SEP: captureToken(); if (capturingSubCondition) { subCondition = new AnyCondition(); } else { ctxFilter.Condition = new AnyCondition(); } continue; case CONTEXT_CONDITION_EXACT_SEP: captureToken(); if (capturingSubCondition) { subCondition = new ExactCondition(); } else { ctxFilter.Condition = new ExactCondition(); } continue; case CONTEXT_CONDITION_NOT: if (!capturingSubCondition) { subConditionIsNot = true; } continue; // tokens default: if (capturingToken) { currentToken += c; } continue; } } ctxFilter.Condition.Conditions = collectedConditions; ctxFilter.EnsureActiveDocument = !supportsZeroDoc; return(ctxFilter); }