/// <summary> Create a new path with a starting path. New elements /// can be added with <CODE>add</CODE>. /// /// </summary> /// <param name="adapter">where the 1-Wire path is based /// </param> /// <param name="currentPath">starting value of this 1-Wire path /// /// </param> /// <seealso cref="add(OneWireContainer, int) add"> /// </seealso> public OWPath(DSPortAdapter adapter, OWPath currentOWPath) { this.adapter = adapter; elements = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(2)); copy(currentOWPath); }
/// <summary> /// Create a new path with a starting path. New elements /// can be added with <CODE>add</CODE>. /// </summary> /// <param name="adapter"> where the 1-Wire path is based </param> /// <param name="currentPath"> starting value of this 1-Wire path /// </param> /// <seealso cref= #add(OneWireContainer, int) add </seealso> public OWPath(DSPortAdapter adapter, OWPath currentOWPath) { this.adapter = adapter; elements = new List <OWPathElement>(2); copy(currentOWPath); }
/// <summary> /// Copy the elements from the provided 1-Wire path into this 1-Wire path. /// </summary> /// <param name="currentOWPath"> path to copy from </param> public virtual void copy(OWPath currentOWPath) { elements.Clear(); if (currentOWPath != null) { // enumerature through elements in current path for (IEnumerator path_enum = currentOWPath.AllOWPathElements; path_enum.MoveNext();) { // cast the enum as a OWPathElements and add to vector elements.Add((OWPathElement)path_enum.Current); } } }
/// <summary> Copy the elements from the provided 1-Wire path into this 1-Wire path. /// /// </summary> /// <param name="currentOWPath">path to copy from /// </param> public virtual void copy(OWPath currentOWPath) { elements.Clear(); if (currentOWPath != null) { // enumerature through elements in current path //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationhasMoreElements'" for (System.Collections.IEnumerator path_enum = currentOWPath.AllOWPathElements; path_enum.MoveNext();) { // cast the enum as a OWPathElements and add to vector //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilEnumerationnextElement'" elements.Add((OWPathElement)path_enum.Current); } } }
/// <summary> Compare this 1-Wire path with another. /// /// </summary> /// <param name="compareOWPath">1-Wire path to compare to /// /// </param> /// <returns> <CODE> true </CODE> if the 1-Wire paths are the same /// </returns> public bool equals(OWPath compareOWPath) { return(this.ToString().Equals(compareOWPath.ToString())); }