Code Search for Developers
 
 
  

List.cs from MASE: Agile Software Engineering at Krugle


Show List.cs syntax highlighted

using System;
using System.Drawing;
using Tao.Platform.Windows;
using Tao.OpenGl;
using System.Data;

namespace New_Study_Project
{
	
	public class List
	{
		/* Definitions of the Program */

		private ListNode firstNode;
		private ListNode lastNode;
		private int length;

		/* End of Definitions of the Program */
	
		public List() 
		{
			this.firstNode = null;
			this.lastNode = null;
		}
		


		/*******************************************************************/
		/* End of the head of this Object - now the user code stuff begins */
		/*******************************************************************/

		public List deepCopy()
		{
			List copyedList = new List();
			if(length == 0)
				return copyedList;
			ListNode currentNode = firstNode;
			for(int i=0; i<length; i++)
			{
				copyedList.InsertAtBack(currentNode.getControlPoint);
				currentNode = currentNode.Next;
			}
			return copyedList;
		}

		public void InsertAtBack(ControlPoint insertItem)
		{
			lock(this)
			{
				if(IsEmpty())
				{
					firstNode = lastNode = new ListNode(insertItem);
					firstNode.Previous = lastNode;
					firstNode.Next = lastNode;
					lastNode.Next = lastNode;
					lastNode.Previous = lastNode;
					this.length = this.length + 1;
				}
				else
				{
					ListNode exLastNode = lastNode;
					ListNode newLastNode = new ListNode(insertItem);
					firstNode.Previous = newLastNode;
					newLastNode.Next = firstNode;
					exLastNode.Next = newLastNode;
					newLastNode.Previous = exLastNode;
					lastNode = newLastNode;
					this.length = this.length + 1;
				}
			}
		}

		public void InsertBehind(ControlPoint currentPoint, ControlPoint insertItem)
		{
			
			ControlPoint point = currentPoint;
			ListNode currentNode = firstNode;
			while(currentNode.getControlPoint != point)
			{
				currentNode = currentNode.Next;
			
			}
			ListNode insertNode = new ListNode(insertItem, currentNode.Next, currentNode);
			currentNode.Next.Previous = insertNode;
			currentNode.Next = insertNode;
			if(lastNode == currentNode) lastNode = insertNode;
			ListNode indexNode = insertNode;
			while(indexNode != lastNode)
			{
				indexNode = indexNode.Next;
			}
			this.length = this.length + 1;
		}

		public ListNode searchPoint(ControlPoint point)
		{
			ListNode currentNode = this.firstNode;
			float length = this.length;
			for(int i = 0; i < length; i++)
			{
				if(currentNode.getControlPoint == point)
				{
					return currentNode;
				}
				else
				{
					currentNode = currentNode.Next;
				}
			}
			return null;
		}

		public void RemoveAll()
		{
			lock(this)
			{
				firstNode = null;
				lastNode = null;
				this.length = 0;
			}
		}


		
		/*******************************************************************/
		/*               some function for returning values                */
		/*******************************************************************/


		public ListNode LastNode
		{
			get
			{
				return this.lastNode;
			}
		}

		public ListNode FirstNode
		{
			get
			{
				return this.firstNode;
			}
		}

		public bool IsEmpty()
		{
			lock(this)
			{
				return this.firstNode == null;
			}
		}

		public int Length
		{
			get
			{
				return this.length;
			}
			set
			{
				this.length = value;
			}

		}
	

		
		/*******************************************************************/
		/*   -----------------------------------------------------------   */
		/*******************************************************************/


	}
}




See more files for this project here

MASE: Agile Software Engineering

The MASE project investigates methods to support the coordination and executable acceptance testing of software projects. Keywords: Agile methods, distributed teams, Extreme Programming. See http://ebe.cpsc.ucalgary.ca/ebe for more information.

Project homepage: http://sourceforge.net/projects/mase
Programming language(s): Java,XML
License: other

  ControlPoint.cs
  CustomTreeNode.cs
  CustomTreeView.cs
  Dashboard.cs
  Dashboard.resx
  EStoryForm.cs
  EStoryForm.resx
  IOSelectObject.cs
  InterfaceGrid.cs
  InterfaceObject.cs
  List.cs
  ListNode.cs
  LogFile.cs
  MenuForm.cs
  MenuForm.resx
  MoveAbleSpline.cs
  NonMoveAbleSpline.cs
  ObjectButton.cs
  Old_MoveAbleSpline.cs
  PenCalibration.cs
  PenCalibration.resx
  RNTObject.cs
  Spline.cs
  StartupScreen.cs
  StartupScreen.resx
  StorageButton.cs
  Study_Project.cs
  Study_Project.resx
  TabletUI.cs
  TabletUI.resx
  Workspace.cs
  Workspace.resx
  testCalibration.cs
  testCalibration.resx