public AddCurrentGraphInStoredGraphsCommand(
     AddCurrentGraphInStoredGraphsCommandArgs args,
     IModelField field)
     : base(field)
 {
     _args = args;
 }
 public RemoveModelsCommand(RemoveModelsCommandArgs args, IModelField field)
     : base(field)
 {
     _exec     = false;
     _args     = args;
     _edges    = new List <AEdgeModel>();
     _vertices = new List <AVertexModel>();
 }
        public static BindingTransformation CreateTransformation(
            this IBindingTransformFactory bindingTransformFactory,
            IModelField source, IModelField target
            )
        {
            var transformationBuilder = new FieldBindingTransformationBuilder(source, target, bindingTransformFactory);

            return(transformationBuilder.CreateBindingTransformation());
        }
示例#4
0
 public bool TryGetField(string fieldName, out IModelField field)
 {
     if (_fields.TryGetValue(fieldName, out var outField))
     {
         field = outField;
         return(true);
     }
     field = null;
     return(false);
 }
 public FieldBindingTransformationBuilder(
     IModelField source,
     IModelField target,
     IBindingTransformFactory transformFactory
     )
 {
     _source           = source;
     _target           = target;
     _transformFactory = transformFactory;
 }
示例#6
0
            public void WriteCopyValueInstruction(IModelField source, IModelField target, BindingTransformation transformationDelegate)
            {
                var sourceField = Expression.Constant(source, typeof(TSourceField));
                var readValue   = Expression.Variable(source.FieldType.Type, "readValue");
                var readMethod  = _dataModelReaderType.GetMethod(nameof(IDataModelReader <TSourceModel, TSourceField> .ReadField))
                                  .MakeGenericMethod(source.FieldType.Type);
                var assignReadValueExpression = Expression.Assign(readValue,
                                                                  Expression.Call(_sourceReader, readMethod, sourceField));

                var boxedReadValue   = Expression.Variable(typeof(object), "boxedReadValue");
                var boxReadValueExpr = Expression.Assign(boxedReadValue, BoxingHelper.BoxIfNeeded(source.FieldType.Type, readValue));

                var boxedConvertedValue = Expression.Variable(typeof(object), "boxedConvertedValue");

                MethodCallExpression callConvertMethodExpr;

                if (transformationDelegate.Method.IsStatic)
                {
                    callConvertMethodExpr = Expression.Call(transformationDelegate.Method, _bindingContext, boxedReadValue, boxedConvertedValue);
                }
                else
                {
                    callConvertMethodExpr = Expression.Call(Expression.Constant(transformationDelegate.Target), transformationDelegate.Method, _bindingContext, boxedReadValue, boxedConvertedValue);
                }

                var convertedValue     = Expression.Variable(target.FieldType.Type, "convertedValue");
                var unboxReadValueExpr = BoxingHelper.UnboxIfNeeded(target.FieldType.Type, boxedConvertedValue);

                var targetField = Expression.Constant(target, typeof(TTargetField));
                var writeMethod = _dataModelWriterType.GetMethod(nameof(IDataModelWriter <TTargetModel, TTargetField> .WriteField))
                                  .MakeGenericMethod(target.FieldType.Type);
                var writeConvertedValueExpr = Expression.Call(_targetWriter, writeMethod, targetField, unboxReadValueExpr);

                var writeIfConvertedExpr = Expression.IfThen(
                    callConvertMethodExpr,
                    writeConvertedValueExpr
                    );

                _expressionBody.Add(Expression.Block(
                                        new[] { readValue, boxedReadValue, boxedConvertedValue, convertedValue },
                                        assignReadValueExpression,
                                        boxReadValueExpr,
                                        writeIfConvertedExpr
                                        ));
            }
        private ContentExplorer(ContentExplorer parent, IModelField field, int index, object model, ContentMetadataProvider contentMetadata)
        {
            Field    = field;
            Model    = model;
            Metadata = contentMetadata;
            Parent   = parent ?? throw new ArgumentNullException(nameof(parent));

            FieldPath = field.Name;
            if (index >= 0)
            {
                FieldPath += "[" + index + "]";
            }

            ModelPath = !parent.IsRoot ? string.Concat(parent.ModelPath, Delimiter, FieldPath) : FieldPath;
            Index     = index;

            rootExplorer = parent.rootExplorer ?? parent;
            name         = rootExplorer.name + ":" + ModelPath;
        }
 public EdmondsKarpAlgorithm(EdmondsKarpCommandArgs args, IModelField field)
     : base(field)
 {
     _args = args;
     G     = ((ModelsField <TVertex>)Field).Graph;
     c     = new SortedDictionary <TVertex, SortedDictionary <TVertex, int> >();
     G.AdjList.Keys.ToList().ForEach(v =>
     {
         c[v] = new SortedDictionary <TVertex, int>();
         G.AdjList.Keys.ToList().ForEach(u =>
         {
             c[v][u] = 0;
         });
     });
     G.AdjList.ToList().ForEach(p =>
     {
         var v = p.Key;
         p.Value.ForEach(e =>
         {
             var u   = e.Vertex;
             c[v][u] = e.Weight;
         });
     });
 }
 public GraphsUnionCommand(GraphUnionCommandArgs args, IModelField field)
     : base(field)
 {
     _args = args;
 }
示例#10
0
 public AFieldCommand(IModelField field) => Field = field;
 public EdmondsKarpAlgorithm(IModelField field)
     : base(field)
 {
 }
示例#12
0
 public SaveGraphToFileCommand(IModelField field)
     : base(field)
 {
 }
示例#13
0
 public HalfLifeDegreeCommand(HalfLifeDegreeCommandArgs args, IModelField field)
     : base(field)
 {
     _args = args;
 }
 public DFSalgorithmCommand(DFScommandArgs args, IModelField field)
     : base(field)
 {
     _args = args;
 }
 public CreateGraphCommand(IModelField field) : base(field)
 {
 }
示例#16
0
 public DijkstraAlgorithm(DijkstraCommandArgs args, IModelField field)
     : base(field)
 {
     _args = args;
     G     = ((ModelsField <TVertex>)field).Graph;
 }
示例#17
0
 public SaveGraphToFileCommand(SaveGraphToFileCommandArgs args, IModelField field)
     : base(field)
 {
     _args = args;
 }
 public GraphsUnionCommand(IModelField field)
     : base(field)
 {
 }
示例#19
0
 protected ModelFieldBinding(IModelField sourceField, IModelField targetField, BindingTransformation transformation)
 {
     SourceField    = sourceField ?? throw new ArgumentNullException(nameof(sourceField));
     TargetField    = targetField ?? throw new ArgumentNullException(nameof(targetField));
     Transformation = transformation ?? throw new ArgumentNullException(nameof(transformation));
 }
示例#20
0
 public void AttachField(IModelField field) => _field = field;
 public WayNoMoreThenLCommand(WayNoMoreThenLCommandArgs args, IModelField field)
     : base(field)
 {
     _args = args;
     G     = ((ModelsField <TVertex>)Field).Graph;
 }
 public WayNoMoreThenLCommand(IModelField field)
     : base(field)
 {
 }
示例#23
0
 public DijkstraAlgorithm(IModelField field)
     : base(field)
 {
 }
 public RemoveModelsCommand(IModelField field)
     : base(field)
 {
 }
示例#25
0
 public static SqlFieldConfiguration Create(IModelField modelField)
 {
     return(((SqlFieldConfigurationWrapper) new FieldConverter().Visit(modelField))
            .SqlFieldConfiguration);
 }
示例#26
0
 public RemoveStoredGraphCommand(RemoveStoredGraphCommandArgs args, IModelField field)
     : base(field)
 {
     _args = args;
 }
 public CreateGraphCommand(CreateGraphCommandArgs args, IModelField field)
     : base(field)
 {
     _args = args;
 }
 public DFSalgorithmCommand(IModelField field)
     : base(field)
 {
 }
示例#29
0
 public RemoveGraphCommand(IModelField field)
     : base(field)
 {
 }
示例#30
0
 public HalfLifeDegreeCommand(IModelField field)
     : base(field)
 {
 }