示例#1
0
 public ForceDirectedLayoutAlgorithm(
     IVertexAndEdgeListGraph visitedGraph
     )
     : base(visitedGraph)
 {
     this.preLayoutAlgorithm = new RandomLayoutAlgorithm(visitedGraph, this.Positions);
     this.potential          = new DirectedForcePotential(this);
     this.potentials         = new VertexPointFDictionary();
 }
 public ForceDirectedLayoutAlgorithm(
     IVertexAndEdgeListGraph visitedGraph
     )
     : base(visitedGraph)
 {
     this.preLayoutAlgorithm=new RandomLayoutAlgorithm(visitedGraph,this.Positions);
     this.potential=new DirectedForcePotential(this);
     this.potentials=new VertexPointFDictionary();
 }
示例#3
0
        public ArrayStruct(Context context, IType baseType, IPotential <bool> loopCondition)
        {
            Context = new Context(context);

            BaseType      = baseType;
            LoopCondition = loopCondition;

            Items = new List <IStruct>();
        }
 public ForceDirectedLayoutAlgorithm(
     IVertexAndEdgeListGraph visitedGraph,
     IPotential potential,
     ILayoutAlgorithm preLayoutAlgorithm
     )
     : base(visitedGraph)
 {
     this.preLayoutAlgorithm=preLayoutAlgorithm;
     this.potential=potential;
     this.potentials=new VertexPointFDictionary();
 }
示例#5
0
 public ForceDirectedLayoutAlgorithm(
     IVertexAndEdgeListGraph visitedGraph,
     IPotential potential,
     ILayoutAlgorithm preLayoutAlgorithm
     )
     : base(visitedGraph)
 {
     this.preLayoutAlgorithm = preLayoutAlgorithm;
     this.potential          = potential;
     this.potentials         = new VertexPointFDictionary();
 }
 public ForceDirectedLayoutAlgorithm(IVertexAndEdgeListGraph visitedGraph, IPotential potential, ILayoutAlgorithm preLayoutAlgorithm)
     : base(visitedGraph)
 {
     this.preLayoutAlgorithm = null;
     this.potential = null;
     this.currentIteration = 0;
     this.maxIteration = 500;
     this.potentials = new VertexPointFDictionary();
     this.maxMovement = 50f;
     this.heat = 1f;
     this.heatDecayRate = 0.99f;
     this.syncRoot = null;
     this.preLayoutAlgorithm = preLayoutAlgorithm;
     this.potential = potential;
     this.potentials = new VertexPointFDictionary();
 }
 public ForceDirectedLayoutAlgorithm(IVertexAndEdgeListGraph visitedGraph)
     : base(visitedGraph)
 {
     this.preLayoutAlgorithm = null;
     this.potential = null;
     this.currentIteration = 0;
     this.maxIteration = 500;
     this.potentials = new VertexPointFDictionary();
     this.maxMovement = 50f;
     this.heat = 1f;
     this.heatDecayRate = 0.99f;
     this.syncRoot = null;
     this.preLayoutAlgorithm = new RandomLayoutAlgorithm(visitedGraph, base.Positions);
     this.potential = new DirectedForcePotential(this);
     this.potentials = new VertexPointFDictionary();
 }
示例#8
0
        public static UserType ParseType(XElement xmlType, Dictionary <string, IType> scopedTypes)
        {
            var typeName = xmlType.Attribute("name");
            var type     = new UserType(typeName.Value);

            var subTypes   = xmlType.Elements("type");
            var attributes = xmlType.Elements("attr");

            scopedTypes.Add(type.Name, type);
            foreach (var subType in subTypes)
            {
                var parsed = ParseType(subType, new Dictionary <string, IType>(scopedTypes));
                scopedTypes.Add(parsed.Name, parsed);
            }

            foreach (var attr in attributes)
            {
                var attrName = attr.Attribute("name");

                var typeAttr = attr.Attribute("type");
                var typeExpr = attr.Element("type");

                var offsetExpr = attr.Element("offset");
                var sizeExpr   = attr.Element("size");

                var conditionExpr = attr.Element("if");

                var repeatType = attr.Element("repeat");

                IPotential <IType> typePotential;

                if (typeAttr != null || typeExpr != null)
                {
                    IPotential <string> namePotential = typeAttr != null ?
                                                        (IPotential <string>) new TrivialPotential <string>(typeAttr.Value) :
                                                        (IPotential <string>) new Expression <string>(typeExpr.Value);

                    typePotential = new NamedTypePotential(scopedTypes, namePotential);
                }
                else
                {
                    typePotential = new TrivialPotential <IType>(new VoidType(new Expression <long>(sizeExpr.Value)));
                }

                if (offsetExpr != null)
                {
                    var baseType   = typePotential;
                    var offsetType = new OffsetType(baseType, new Expression <long>(offsetExpr.Value));

                    typePotential = new TrivialPotential <IType>(offsetType);
                }

                if (conditionExpr != null)
                {
                    var baseType        = typePotential;
                    var conditionalType = new ConditionalType(baseType, new Expression <bool>(conditionExpr.Value));

                    typePotential = new TrivialPotential <IType>(conditionalType);
                }

                if (repeatType != null)
                {
                    var lengthExpr = attr.Element("repeat-expr");
                    var untilExpr  = attr.Element("repeat-until");

                    var baseType = typePotential;

                    if (repeatType.Value == "expr")
                    {
                        var arrayType = new DefiniteArrayType(baseType, new Expression <int>(lengthExpr.Value));
                        typePotential = new TrivialPotential <IType>(arrayType);
                    }
                    else if (repeatType.Value == "until")
                    {
                        var arrayType = new IndefiniteArrayType(baseType, new Expression <bool>(untilExpr.Value));
                        typePotential = new TrivialPotential <IType>(arrayType);
                    }
                }

                type.Attributes.Add(attrName.Value, typePotential);
            }

            return(type);
        }
示例#9
0
 public ConditionalType(IPotential <IType> baseType, IPotential <bool> condition)
 {
     BaseType  = baseType;
     Condition = condition;
 }
示例#10
0
 public NamedTypePotential(Dictionary <string, IType> types, IPotential <string> typeName)
 {
     Types    = new Dictionary <string, IType>(types);
     TypeName = typeName;
 }
示例#11
0
 public VoidType(IPotential <long> length)
 {
     Length = length;
 }
 public IndefiniteArrayType(IPotential <IType> baseType, IPotential <bool> condition) : base(baseType)
 {
     LoopCondition = condition;
 }
示例#13
0
 public OffsetType(IPotential <IType> baseType, IPotential <long> offset)
 {
     BaseType = baseType;
     Offset   = offset;
 }
示例#14
0
 public ArrayType(IPotential <IType> baseType)
 {
     BaseType = baseType;
 }
 public DefiniteArrayType(IPotential <IType> baseType, IPotential <int> length) : base(baseType)
 {
     Length = length;
 }