public LinkNode(Object key, Object value)
 {
     m_Previous = null;
     m_Next = null;
     m_Key = key;
     m_Value = value;
 }
Esempio n. 2
0
        public void Preserve_Reference_For_Circular_Reference()
        {
            TypeAdapterConfig.GlobalSettings.Default.Settings.PreserveReference = true;

            var node1 = new LinkNode {Id = Guid.NewGuid()};
            var node2 = new LinkNode {Id = Guid.NewGuid()};
            node1.AttachRight(node2);

            var another = TypeAdapter.Adapt<LinkNode>(node1);
            var another2 = another.Right;
            another.ShouldBeSameAs(another2.Left);
        }
Esempio n. 3
0
		public object Remove()
		{
			if (head == null)
			{
				return null;
			}
			else
			{
				LinkNode node = head;
				head = node.next;
				return node.data;
			}
		}
            public void Remove()
            {
                if (m_Previous != null)
                {
                    m_Previous.m_Next = m_Next;
                }

                if (m_Next != null)
                {
                    m_Next.m_Previous = m_Previous;
                }

                m_Previous = null;
                m_Next = null;
            }
Esempio n. 5
0
		public void Add(object obj)
		{
			if (head == null)
			{
				head = new LinkNode();
				head.data = obj;
				head.next = null;
			}
			else
			{
				LinkNode node = new LinkNode();
				node.data = obj;
				node.next = head;
				head = node;
			}
		}
Esempio n. 6
0
 public void OnLinkEnd(LinkNode node)
 {
     this.m_TransformationStack.Pop();
 }
        private void FinishExport(bool exportSTL)
        {
            logger.Info("Completing URDF export");
            SaveConfigTree(ActiveSWModel, BaseNode, false);

            // Saving selected node
            LinkNode node = (LinkNode)treeViewLinkProperties.SelectedNode;

            if (node != null)
            {
                SaveLinkDataFromPropertyBoxes(node.Link);
            }

            Exporter.URDFRobot = CreateRobotFromTreeView(treeViewLinkProperties);

            // The UI should prevent these sorts of errors, but just in case
            string errors = CheckLinksForErrors(Exporter.URDFRobot.BaseLink);

            if (!string.IsNullOrWhiteSpace(errors))
            {
                logger.Info("Link errors encountered:\n " + errors);

                string message = "The following links contained errors in either their link or joint " +
                                 "properties. Please address before continuing\r\n\r\n" + errors;
                MessageBox.Show(message, "URDF Errors");
                return;
            }

            string warnings = CheckLinksForWarnings(Exporter.URDFRobot.BaseLink);

            if (!string.IsNullOrWhiteSpace(warnings))
            {
                logger.Info("Link warnings encountered:\r\n" + warnings);

                string message = "The following links contained issues that may cause problems. " +
                                 "Do you wish to proceed?\r\n\r\n" + warnings;
                DialogResult result =
                    MessageBox.Show(message, "URDF Warnings", MessageBoxButtons.YesNo);

                if (result == DialogResult.No)
                {
                    logger.Info("Export canceled for user to review warnings");
                    return;
                }
            }

            SaveFileDialog saveFileDialog1 = new SaveFileDialog
            {
                RestoreDirectory = true,
                InitialDirectory = Exporter.SavePath,
                FileName         = Exporter.PackageName
            };

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                Exporter.SavePath    = Path.GetDirectoryName(saveFileDialog1.FileName);
                Exporter.PackageName = Path.GetFileName(saveFileDialog1.FileName);

                logger.Info("Saving URDF package to " + saveFileDialog1.FileName);
                Exporter.ExportRobot(exportSTL);
                Close();
            }
        }
Esempio n. 8
0
 public LinkNode(T value, LinkNode <T> next, LinkNode <T> prev)
 {
     this.value = value;
     this.next  = next;
     this.prev  = prev;
 }
Esempio n. 9
0
        public Polinomio(string expresion)
        {
            // TODO: Usando la clase Polinomio.Parser, construye el linked list con
            //       los terminos del polinomio.
            // NOTA1: Puedes asumir que el string 'expresion':
            //       A) contiene los terminos del polinomio en orden descendente del
            //          exponente.  O sea, el termino con mayor exponente va primero;
            //          le sigue el segundo mayor exponente, etc.
            //       B) no contiene mas de un termino con el mismo exponente.
            //       C) no contiene terminos con coeficiente == 0.
            // Complejidad: O(N) worst-case, donde N es la cantidad de terminos
            //              del polinomio
            // Valor: 1 punto


            // TODO: Implementalo sin asumir nada de lo indicado en NOTA1
            // Complejidad: O(N^2) worst-case, donde N es la cantidad de terminos
            //              del polinomio
            // Extra: 3 puntos

            Parser expr = new Parser(expresion);

            foreach (Termino term in expr)
            {
                LinkNode newNode = new LinkNode(term);
                if (head == null)
                {
                    head = newNode;
                    tail = newNode;
                }

                else
                {
                    LinkNode current = head;
                    while (current != null)
                    {
                        if (term.exponente > current.value.exponente && current == head)
                        {
                            newNode.next = current;
                            current.prev = newNode;
                            head         = newNode;
                            break;
                        }
                        else if (term.exponente > current.value.exponente && current != head)
                        {
                            current.prev.next = newNode;
                            newNode.prev      = current.prev;
                            current.prev      = newNode;
                            newNode.next      = current;
                            break;
                        }

                        else if (current.next == null)
                        {
                            current.next = newNode;
                            newNode.prev = current;
                            tail         = newNode;
                            break;
                        }

                        else
                        {
                            current = current.next;
                        }
                    }
                }
            }
        }
Esempio n. 10
0
	/**
	 * LinkNode
	 */
	public LinkNode()
	{
		NextLink = null;
	}
 public void OnLinkEnd(LinkNode node)
 {
     // Note: This method is invoked even for instances that were skipped.
     transformationStack.Pop();
 }
Esempio n. 12
0
	/**
	 * LightNode
	 *
	 * @param newLight
	 * @param nextlink
	 */
	public LightNode(Light newLight, LinkNode nextlink)
		: base(nextlink)
	{
		theLight = newLight;
	}
 public LinkedHashMap(int capacity)
 {
     m_Head = null;
     m_Tail = null;
     m_Hashtable = new Hashtable(capacity);
 }
 public LinkedHashMap()
 {
     m_Head = null;
     m_Tail = null;
     m_Hashtable = new Hashtable();
 }
Esempio n. 15
0
        protected LinkNode<int> CreateNodeHeader()
        {
            var first = new LinkNode<int> { Value = 0 };
            var second = new LinkNode<int>() { Value = 1 };
            var third = new LinkNode<int>() { Value = 2 };
            var fourth = new LinkNode<int>() { Value = 4 };

            first.Next = second;
            second.Next = third;
            third.Next = fourth;

            return first;
        }
Esempio n. 16
0
 public void OnLinkEnd(LinkNode node)
 {
 }
Esempio n. 17
0
 public RenderNodeAction OnLinkBegin(LinkNode node)
 {
     num++;
     return RenderNodeAction.Proceed;
 }
Esempio n. 18
0
	/**
	 * LinkNode
	 *
	 * @param nextlink
	 */
	public LinkNode(LinkNode nextlink)
	{
		NextLink = nextlink;
	}
Esempio n. 19
0
 public void AttachLeft(LinkNode another)
 {
     this.Left     = another;
     another.Right = this;
 }
 private void ReleaseNode(LinkNode <T> node)
 {
     node.Dispose();
     _nodePool.Enqueue(node);
 }
 protected virtual MarkdownNode VisitLink(LinkNode link)
 {
     Visit(link.Children);
     return(link);
 }
Esempio n. 22
0
 public void OnLinkEnd(LinkNode node)
 {
     throw new NotImplementedException();
 }
Esempio n. 23
0
        /// <summary>
        /// 入力されたオイラーグラフのオイラー路を返す。
        /// 入力がオイラーグラフであるかは判定せず、そうでない場合は正常に動作しない。
        /// </summary>
        /// <param name="graph">オイラーグラフ</param>
        /// <returns>オイラー路</returns>
        public static int[] Calc(AdjacencyList graph)
        {
            bool[] passed = new bool[graph.EdgeNum];
            // 各ノードから出発できるエッジのリスト
            // current_list[i]: ノードiに接続しているノードのリスト
            LinkNode[] current_list = new LinkNode[graph.NodeNum];
            for (int i = 0; i < graph.NodeNum; i++)
            {
                current_list[i] = graph.GetOutLinkedEdgeList(i).head;
            }

            // 再帰呼び出し用のスタック
            Stack <LinkNode> v_stack = new Stack <LinkNode>(graph.NodeNum);
            // オイラー路
            LinkList eulerian = new LinkList();

            // 出発点としてノード0を追加しておく
            eulerian.AddNode(0);
            v_stack.Push(eulerian.head);
            // 再帰呼び出し用のスタックが空になるまで
            while (v_stack.CheckPop(out var v))
            {
                int x = v.data;
                // この反復で得られるウォーク
                LinkList walk = new LinkList();

                // 行けるノードが無くなるまでウォークを構成する
                while (current_list[x] != null)
                {
                    int edgeID = current_list[x].data;
                    current_list[x] = current_list[x].next;
                    // ノードから出発できるエッジでも通過済みならウォークにしない
                    if (!passed[edgeID])
                    {
                        int y = GraphUtil.GetOpposite(x, graph.EdgeList[edgeID]);
                        walk.AddNode(y, walk.tail);
                        passed[edgeID] = true;
                        //次のノードへ移動
                        x = y;
                    }
                }


                // 出発点のノードから行けるエッジがあるなら
                if (current_list[v.data] != null)
                {
                    v_stack.Push(v);
                }
                // ウォークの途中のノードから行けるエッジがあるなら
                for (LinkNode node = walk.head; node != null; node = node.next)
                {
                    if (current_list[node.data] != null)
                    {
                        v_stack.Push(node);
                    }
                }

                // 出発点のノードの後ろにウォークを追加する
                eulerian.ConnectList(walk, v);
            }

            // idの配列に変換
            int count = 0;

            int[] result = new int[graph.EdgeNum + 1];
            for (LinkNode node = eulerian.head; node != null; node = node.next)
            {
                result[count] = node.data;
                count++;
            }

            return(result);
        }
Esempio n. 24
0
 public void OnLinkEnd(LinkNode node)
 {
     Debug.WriteLine("  OnLinkEnd: " + node.NodeName);
     // Note: This method is invoked even for instances that were skipped.
     _transformationStack.Pop();
 }
Esempio n. 25
0
 public void SaveConfigTree(ModelDoc2 model, LinkNode BaseNode, bool warnUser)
 {
     CommonSwOperations.RetrieveSWComponentPIDs(model, BaseNode);
     ConfigurationSerialization.SaveConfigTreeXML(swApp, model, BaseNode, warnUser);
 }
 public void OnLinkEnd(LinkNode inNode)
 {
 }
        public void Add(Object key, Object value)
        {
            if (m_Hashtable.ContainsKey(key))
            {
                return;
            }

            LinkNode node = new LinkNode(key, value);

            if (m_Head == null)
            {
                m_Head = node;
            }
            else
            {
                m_Tail.m_Next = node;
            }

            m_Tail = node;

            m_Hashtable.Add(key, node);
        }
Esempio n. 28
0
 /**
  * LightNode
  *
  * @param newLight
  * @param nextlink
  */
 public LightNode(Light newLight, LinkNode nextlink)
     : base(nextlink)
 {
     theLight = newLight;
 }
        public void Clear()
        {
            for (LinkNode node = m_Head; node != null; )
            {
                LinkNode nextNode = node.m_Next;

                node.m_Previous = null;
                node.m_Next = null;
                node.m_Key = null;
                node.m_Value = null;

                node = nextNode;
            }

            m_Head = null;
            m_Tail = null;

            m_Hashtable.Clear();
        }
Esempio n. 30
0
 public LinkNode(Termino t)
 {
     value = t;
     next  = null;
     prev  = null;
 }
        public void Remove(Object key)
        {
            LinkNode node = (LinkNode)m_Hashtable[key];

            if (node != null)
            {
                if (m_Head == node)
                {
                    m_Head = node.m_Next;
                }

                if (m_Tail == node)
                {
                    m_Tail = node.m_Previous;
                }

                node.Remove();

                m_Hashtable.Remove(key);
            }
        }
Esempio n. 32
0
        /**
         * Agrega el polinompio 'P' al polinomio 'this'.
         *
         * Luego de esta operacion, el polinomio 'this' debe contener la suma
         * de los dos polinomios.
         */
        public void Add(Polinomio P)
        {
            // TODO: Implementar
            // Complejidad esperada: O(N1 + N2) worst-case, donde N1 y N2 son las
            //                       cantidades de terminos en el polinomio 'this'
            //                       y P respectivamente
            // Restricciones:
            //  1) No se permite crear mas de N2 nuevos nodos
            //  2) En el polinomio resultante, debes mantener los terminos ordenados
            //     de mayor exponente a menor exponente
            //  3) El polinomio resultante no puede contener mas de un termino con
            //     el mismo exponente
            //  4) Si la suma arroja un coeficiente con valor 0, debes omitir dicho
            //     termino del resultado (a menos que el polinomio consiste solo
            //     del termino que es constante)
            // OJO: el polinomio P no debe modificarse
            // Valor: 5 puntos


            {
                LinkNode currentP = P.head;
                LinkNode current  = head;

                while (current != null && currentP != null)
                {
                    if (current.value.exponente < currentP.value.exponente)
                    {
                        LinkNode temp = currentP;
                        if (current == head)
                        {
                            currentP     = currentP.next;
                            current.prev = temp;
                            temp.next    = current;
                            head         = temp;
                        }
                        else
                        {
                            currentP          = currentP.next;
                            current.prev.next = temp;
                            temp.prev         = current.prev;
                            current.prev      = temp;
                            temp.next         = current;
                        }
                    }
                    else if (current.value.exponente > currentP.value.exponente)
                    {
                        LinkNode temp = current;
                        if (currentP == P.head)
                        {
                            current       = current.next;
                            currentP.prev = temp;
                            temp.next     = currentP;
                            head          = temp;
                        }
                        else
                        {
                            current            = current.next;
                            currentP.prev.next = temp;
                            temp.prev          = currentP.prev;
                            currentP.prev      = temp;
                            temp.next          = currentP;
                        }
                    }

                    else if (current.value.exponente == currentP.value.exponente)
                    {
                        int newvalue = current.value.coeficiente += currentP.value.coeficiente;
                        if (newvalue == 0)
                        {
                            if (current == head)
                            {
                                current.next.prev = null;
                                head     = current.next;
                                current  = current.next;
                                currentP = currentP.next;
                            }
                            else
                            {
                                current.prev.next = current.next;
                                current.next.prev = current.prev;
                                current           = current.next;
                                currentP          = currentP.next;
                            }
                        }


                        else
                        {
                            current.value.coeficiente = newvalue;
                            current  = current.next;
                            currentP = currentP.next;
                        }
                    }
                }
            }
        }
 public Enumerator(LinkedHashMap map)
 {
     m_Map = map;
     m_CurrentNode = null;
 }
Esempio n. 34
0
    private void RenderUrlText(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
    {
        LinkNode link = (LinkNode)tree_model.GetValue(iter, 0);

        (cell as CellRendererText).Text = link.Url;
    }
            public Boolean MoveNext()
            {
                if (m_CurrentNode == m_Map.m_Tail)
                {
                    return false;
                }

                if (m_CurrentNode == null)
                {
                    m_CurrentNode = m_Map.m_Head;

                    if (m_CurrentNode == null)
                    {
                        return false;
                    }
                }
                else
                {
                    m_CurrentNode = m_CurrentNode.m_Next;
                }

                return true;
            }
        public AssemblyExportForm(SldWorks SwApp, LinkNode node, ExportHelper exporter)
        {
            Application.ThreadException +=
                new ThreadExceptionEventHandler(ExceptionHandler);
            AppDomain.CurrentDomain.UnhandledException +=
                new UnhandledExceptionEventHandler(UnhandledException);
            InitializeComponent();
            swApp            = SwApp;
            BaseNode         = node;
            ActiveSWModel    = swApp.ActiveDoc;
            Exporter         = exporter;
            AutoUpdatingForm = false;

            jointBoxes = new Control[] {
                textBoxJointName, comboBoxAxis, comboBoxJointType,
                textBoxAxisX, textBoxAxisY, textBoxAxisZ,
                textBoxJointX, textBoxJointY, textBoxJointZ,
                textBoxJointPitch, textBoxJointRoll, textBoxJointYaw,
                textBoxLimitLower, textBoxLimitUpper, textBoxLimitEffort, textBoxLimitVelocity,
                textBoxDamping, textBoxFriction,
                textBoxCalibrationFalling, textBoxCalibrationRising,
                textBoxSoftLower, textBoxSoftUpper, textBoxKPosition, textBoxKVelocity
            };
            linkBoxes = new Control[] {
                textBoxInertialOriginX, textBoxInertialOriginY, textBoxInertialOriginZ,
                textBoxInertialOriginRoll, textBoxInertialOriginPitch, textBoxInertialOriginYaw,
                textBoxVisualOriginX, textBoxVisualOriginY, textBoxVisualOriginZ,
                textBoxVisualOriginRoll, textBoxVisualOriginPitch, textBoxVisualOriginYaw,
                textBoxIxx, textBoxIxy, textBoxIxz, textBoxIyy, textBoxIyz, textBoxIzz,
                textBoxMass,
                domainUpDownRed, domainUpDownGreen, domainUpDownBlue, domainUpDownAlpha,
                comboBoxMaterials,
                textBoxTexture
            };

            List <TextBox> numericTextBoxes = new List <TextBox>()
            {
                textBoxAxisX, textBoxAxisY, textBoxAxisZ,
                textBoxJointX, textBoxJointY, textBoxJointZ,
                textBoxJointPitch, textBoxJointRoll, textBoxJointYaw,
                textBoxLimitLower, textBoxLimitUpper, textBoxLimitEffort, textBoxLimitVelocity,
                textBoxDamping, textBoxFriction,
                textBoxCalibrationFalling, textBoxCalibrationRising,
                textBoxSoftLower, textBoxSoftUpper, textBoxKPosition, textBoxKVelocity,
                textBoxInertialOriginX, textBoxInertialOriginY, textBoxInertialOriginZ,
                textBoxInertialOriginRoll, textBoxInertialOriginPitch, textBoxInertialOriginYaw,
                textBoxVisualOriginX, textBoxVisualOriginY, textBoxVisualOriginZ,
                textBoxVisualOriginRoll, textBoxVisualOriginPitch, textBoxVisualOriginYaw,
                textBoxIxx, textBoxIxy, textBoxIxz, textBoxIyy, textBoxIyz, textBoxIzz,
                textBoxMass,
                textBoxMimicMultiplier, textBoxMimicOffset,
            };

            foreach (TextBox textBox in numericTextBoxes)
            {
                textBox.KeyPress += NumericalTextBoxKeyPress;
            }

            saveConfigurationAttributeDef = SwApp.DefineAttribute(Serialization.URDF_CONFIGURATION_SW_ATTRIBUTE_NAME);
            int Options = 0;

            saveConfigurationAttributeDef.AddParameter(
                "data", (int)swParamType_e.swParamTypeString, 0, Options);
            saveConfigurationAttributeDef.AddParameter(
                "name", (int)swParamType_e.swParamTypeString, 0, Options);
            saveConfigurationAttributeDef.AddParameter(
                "date", (int)swParamType_e.swParamTypeString, 0, Options);
            saveConfigurationAttributeDef.AddParameter(
                "exporterVersion", (int)swParamType_e.swParamTypeDouble, 1.0, Options);
            saveConfigurationAttributeDef.Register();
        }
 public void Reset()
 {
     m_CurrentNode = null;
 }
Esempio n. 38
0
 public LinkNode(int _key, int _val)
 {
     key  = _key;
     val  = _val;
     next = null;
 }
Esempio n. 39
0
 public void AttachLeft(LinkNode another)
 {
     this.Left = another;
     another.Right = this;
 }
 public void Dispose()
 {
     item = default(T2);
     prev = null;
     next = null;
 }
Esempio n. 41
0
	/**
	 * MaterialNode
	 *
	 * @param newMaterial
	 * @param nextlink
	 */
	public MaterialNode(Material newMaterial, LinkNode nextlink)
		: base(nextlink)
	{
		theMaterial = newMaterial;
	}
Esempio n. 42
0
 public virtual MarkdownNode VisitLink(LinkNode link) => link;
 /// <summary>
 /// 如果是链接模型,这里就是链接模型结束
 /// </summary>
 /// <param name="node"></param>
 public void OnLinkEnd(LinkNode node)
 {
     //对应出栈
     Debug.Print($"LinkEnd {node.NodeName}");
     m_TransformationStack.Pop();
 }
Esempio n. 44
0
 public RenderNodeAction OnLinkBegin(LinkNode node)
 {
     throw new NotImplementedException();
 }
Esempio n. 45
0
 public void Clear()
 {
     count = 0;
     top   = null;
 }
 public RenderNodeAction OnLinkBegin(LinkNode node)
 {
     transformationStack.Push(transformationStack.Peek().Multiply(node.GetTransform()));
     return(RenderNodeAction.Proceed);
 }
Esempio n. 47
0
 RenderNodeAction IExportContext.OnLinkBegin(LinkNode node)
 {
     MessageBox.Show("OnLinkBegin,HashCode:" + node.GetHashCode(), node.NodeName);
     return(RenderNodeAction.Proceed);
 }
Esempio n. 48
0
 public RenderNodeAction OnLinkBegin(LinkNode node)
 {
     Debug.WriteLine("  OnLinkBegin: " + node.NodeName + " Document: " + node.GetDocument().Title + ": Id: " + node.GetSymbolId().IntegerValue);
     _transformationStack.Push(CurrentTransform.Multiply(node.GetTransform()));
     return(RenderNodeAction.Proceed);
 }
Esempio n. 49
0
 void IExportContext.OnLinkEnd(LinkNode node)
 {
     MessageBox.Show("OnLinkEnd,HashCode:" + node.GetHashCode(), node.NodeName);
 }
Esempio n. 50
0
 /**
  * ObjNode
  *
  * @param newObj
  * @param nextlink
  */
 public ObjNode(ObjectType newObj, LinkNode nextlink)
     : base(nextlink)
 {
     theObject = newObj;
 }
Esempio n. 51
0
 public void OnLinkEnd(LinkNode node)
 {
     Debug.Print($"LinkEnd {node.NodeName}");
     _transformationStack.Pop();
     _documentStack.Pop();
 }
        // Determines how many nodes need to be built, and they are added to the current node
        private void CreateNewNodes(LinkNode CurrentlySelectedNode)
        {
            int nodesToBuild = (int)PMNumberBoxChildCount.Value - CurrentlySelectedNode.Nodes.Count;

            CreateNewNodes(CurrentlySelectedNode, nodesToBuild);
        }
 public RenderNodeAction OnLinkBegin(LinkNode inNode)
 {
     return 0;
 }