本文整理汇总了C#中IRoute.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# IRoute.Contains方法的具体用法?C# IRoute.Contains怎么用?C# IRoute.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRoute
的用法示例。
在下文中一共展示了IRoute.Contains方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
public IRouteResult Process(IRoute route)
{
if (_presenter == null)
return new EndRouteResult(route);
if (!route.Contains(KnownParameters.Errors))
throw new NoErrorsFoundToShowException(route);
var errors = route[KnownParameters.Errors] as IEnumerable<IError>;
_presenter.Show(route, errors);
return new EndRouteResult(route);
}
示例2: GetParameters
object[] GetParameters(IRoute route, MethodInfo method)
{
var parameters = new List<object>();
foreach (var p in method.GetParameters())
{
if (route.Contains(p.Name))
{
parameters.Add(route[p.Name]);
}
else
{
parameters.Add(IoC.Get(p.ParameterType));
}
}
return parameters.ToArray();
}
示例3: Improve
/// <summary>
/// Tries to improve the existing route using CI and return true if succesful.
/// </summary>
/// <param name="problem"></param>
/// <param name="route"></param>
/// <param name="difference"></param>
/// <returns></returns>
public bool Improve(IProblemWeights problem, IRoute route, out double difference)
{
bool improvement = false;
difference = 0;
if (route.Count > 3)
{
// loop over all customers and try cheapest insertion.
for (int customer = 0; customer < problem.Size; customer++)
{
//string route_string = route.ToString();
//IRoute previous = route.Clone() as IRoute;
if (route.Contains(customer))
{
// remove customer and keep position.
int next = route.GetNeigbours(customer)[0];
route.Remove(customer);
// insert again.
ArbitraryInsertionSolver.InsertOne(problem, route, customer, out difference);
if (!route.IsValid())
{
throw new Exception();
}
if (route.GetNeigbours(customer)[0] != next
&& difference < 0)
{ // another customer was found as the best, improvement is succesful.
improvement = true;
break;
}
}
}
}
return improvement;
}
示例4: CanProcess
public bool CanProcess(IRoute route)
{
return route.Contains(KnownParameters.Errors)
&& !route.Resource.Matches("errors");
}
示例5: CanProcess
public bool CanProcess(IRoute route)
{
return route.Contains(KnownParameters.View)
&& route.Contains(KnownParameters.ShowAs);
}
示例6: CanProcess
public bool CanProcess(IRoute route)
{
return route.Contains(KnownParameters.Listener)
&& route.DoesNotContain(KnownParameters.ProcessedByListener);
}
示例7: CanProcess
public bool CanProcess(IRoute route)
{
return route.Contains(KnownParameters.Controller)
&& !route.Contains(KnownParameters.ProcessedByController);
}
示例8: CanProcessFilter
public override bool CanProcessFilter(IRoute route)
{
return !route.Contains(KnownParameters.Controller);
}