本文整理汇总了C#中LinkedList类的典型用法代码示例。如果您正苦于以下问题:C# LinkedList类的具体用法?C# LinkedList怎么用?C# LinkedList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinkedList类属于命名空间,在下文中一共展示了LinkedList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetLastNode
public override LinkedListNode<Token> GetLastNode(LinkedList<Token> lToken, LinkedListNode<Token> current)
{
//Find the partner
if(current.Previous.Value.Type == TokenType.ROUND_BRANCE_OPEN)
return current.Previous.Value.Partner;
return current;
}
开发者ID:ninox92,项目名称:DP2-Compiler,代码行数:7,代码来源:CompiledCondition.cs
示例2: InterruptManager
/// <summary>
/// Initializes a new instance of the <see cref="InterruptManager"/> class.
/// </summary>
public InterruptManager()
{
interruptHandlers = new LinkedList<IHardwareDevice>[MaxInterrupts];
for (int i = 0; i < MaxInterrupts; i++)
interruptHandlers[i] = new LinkedList<IHardwareDevice>();
}
开发者ID:tea,项目名称:MOSA-Project,代码行数:10,代码来源:InterruptManager.cs
示例3: Main
static void Main(string[] args)
{
List<int> list = new List<int>
{
3,2,
}; // 3, 2
list.Add(5); // 3, 2, 5
list.Add(6); // 3, 2, 5, 6
list.Remove(5); // 3, 2, 6
Queue<int> queue = new Queue<int>();
queue.Enqueue(3);// 3
queue.Enqueue(8);// 3, 8
queue.Dequeue(); // 8
Stack<int> stack = new Stack<int>();
stack.Push(2); // 2
stack.Push(7); // 7, 2
stack.Push(8); // 8, 7, 2
stack.Pop(); // 7, 2
foreach (var i in stack)
{
Console.WriteLine(i);
}
LinkedList<int> linkedList = new LinkedList<int>();
linkedList.AddFirst(9); // 9
linkedList.AddAfter(linkedList.Find(9), 5); // 9, 5
linkedList.Remove(9); // 5
Console.Read();
}
开发者ID:HoussemDellai,项目名称:MTA361Codes,代码行数:34,代码来源:Program.cs
示例4: VirtualPrinter
public VirtualPrinter()
{
ana = new GCodeAnalyzer(true);
output = new LinkedList<string>();
extruderTemp[0] = extruderTemp[1] = extruderTemp[2] = 0;
extruderOut[0] = extruderOut[1] = extruderOut[2] = 0;
}
开发者ID:hohenstaufen,项目名称:Repetier-Host-for-3D-Replicator,代码行数:7,代码来源:VirtualPrinter.cs
示例5: EventDevelopment
public EventDevelopment(DevelopmentState a_backState, LinkedList<Event> a_events)
{
if (a_events == null)
{
throw new ArgumentNullException();
}
m_numOfAddedEvents = 0;
m_state = State.neutral;
m_backState = a_backState;
m_buttonList = new LinkedList<Button>();
m_guiList = new LinkedList<GuiObject>();
m_buttonsToAdd = new Stack<Button>();
m_buttonsToRemove = new Stack<Button>();
m_eventsToRemove = new Stack<Button>();
m_eventsToAdd = new Stack<Event>();
m_events = new Dictionary<Button, Event>();
m_effects = new Dictionary<Button, EventEffect>();
m_triggers = new Dictionary<Button, EventTrigger>();
m_stateButtons = new Stack<LinkedList<Button>>();
foreach (Event t_e in a_events)
{
addEvent(t_e);
}
}
开发者ID:Yuma-Shi,项目名称:GLhf,代码行数:26,代码来源:EventDevelopment.cs
示例6: Index
/// <summary>
/// Indexes the specified events.
/// </summary>
/// <param name="events">The events.</param>
/// <param name="predicateIndex">Index of the predicate.</param>
/// <returns></returns>
protected List<ComparableEvent> Index(LinkedList<Event> events, Dictionary<string, int> predicateIndex)
{
Dictionary<string, int> outcomeMap = new Dictionary<string, int>();
int numberOfEvents = events.Count;
int outcomeCount = 0;
List<ComparableEvent> eventsToCompare = new List<ComparableEvent>(numberOfEvents);
List<int> indexedContext = new List<int>();
for (int eventIndex = 0; eventIndex < numberOfEvents; eventIndex++)
{
Event ev = events.First.Value;
events.RemoveFirst();
string[] eventContext = ev.Context;
int outcomeId;
string outcome = ev.Outcome;
if (outcomeMap.ContainsKey(outcome))
{
outcomeId = outcomeMap[outcome];
}
else
{
outcomeId = outcomeCount++;
outcomeMap[outcome] = outcomeId;
}
UpdateIndexedContextList(indexedContext, predicateIndex, eventContext);
ProcessIndexedContextList(indexedContext, eventsToCompare, eventContext, outcomeId, outcome);
indexedContext.Clear();
}
OutcomeLabels = ToIndexedStringArray(outcomeMap);
PredicateLabels = ToIndexedStringArray(predicateIndex);
return eventsToCompare;
}
开发者ID:ronnyMakhuddin,项目名称:SharperNLP,代码行数:37,代码来源:OnePassDataIndexer.cs
示例7: GameState
public GameState()
: base()
{
m_champions = new Dictionary<string, Champion>();
m_guiList.AddLast(m_championInfo = new LinkedList<GuiObject>());
m_gameGui = new GUI();
}
开发者ID:Joxe,项目名称:TacticsRPG,代码行数:7,代码来源:GameState.cs
示例8: Parse
public override LogParseResult Parse()
{
LinkedList<LogParseResultEntry> result = new LinkedList<LogParseResultEntry>();
BlissHiveLogContainer blissHiveLogContainer = (BlissHiveLogContainer)this.container;
foreach( BlissHiveLogSurvivor survivor in blissHiveLogContainer.survivorContainer.survivors ){
for( int i = 0; i < survivor.inventories.Count - 1; i++ ){
BlissHiveLogInventory inv = survivor.inventories.ElementAt(i);
BlissHiveLogInventory nextInv = survivor.inventories.ElementAt(i + 1);
LinkedList<BlissHiveLogActivityItem> changedItems =
BlissHiveLogInventory.GetItemDifference(inv, nextInv);
changedItems = BlissHiveLogInventory.AddSurvivor(survivor, changedItems);
BlissHiveSurvivorActivityLogParseResultEntry change =
new BlissHiveSurvivorActivityLogParseResultEntry(nextInv.originalLogEntry);
change.changedItems = changedItems;
result.AddLast(change);
}
}
this.onParseProgressListeners = null;
return new LogParseResult(result);
}
开发者ID:Wotuu,项目名称:DayzServerLogParser,代码行数:27,代码来源:BlissHiveSurvivorActivityLogParser.cs
示例9: SumLists
public static LinkedList<int> SumLists(this LinkedList<int> number1, LinkedList<int> number2)
{
var node1 = number1.Last;
var node2 = number2.Last;
var result = new LinkedList<int>();
var carry = 0;
while (true)
{
if (node1 == null && node2 == null && carry == 0)
{
break;
}
var val1 = node1?.Value ?? 0;
var val2 = node2?.Value ?? 0;
var sum = val1 + val2 + carry;
carry = sum / 10;
result.AddFirst(sum%10);
node1 = node1?.Previous;
node2 = node2?.Previous;
}
return result;
}
开发者ID:evilz,项目名称:CtCI-6th-Edition-csharp,代码行数:26,代码来源:05.SumLists.cs
示例10: getConnectedSpotLights
public LinkedList<SpotLight> getConnectedSpotLights()
{
if (m_connectedToAll)
{
LinkedList<GameObject>[] t_allGO = Game.getInstance().getState().getObjectList();
LinkedList<SpotLight> t_ret = new LinkedList<SpotLight>();
foreach (LinkedList<GameObject> t_llgo in t_allGO)
{
if (t_llgo != null)
{
foreach (GameObject t_GO in t_llgo)
{
if (t_GO is SpotLight)
{
t_ret.AddLast((SpotLight)t_GO);
}
}
}
}
return t_ret;
}
else
{
return m_connectedSpotLights;
}
}
开发者ID:theKyuu,项目名称:GLhf,代码行数:26,代码来源:LampSwitch.cs
示例11: islemYap
/**
* Bu metot içerisinde String olarak gönderilen rakamlar
* ayrılır ve rakam olmayanlar aradan silinir.
* Daha sonra MergeSort çağırılarak bu rakamlar sıralanır
* ve sırasıyla ekrana yazılır.
*
* @param elements arka arkaya , ile ayrılmış rakamlar
*/
static void islemYap(String elements)
{
String[] elementArray = elements.Split(',');
int elementCount = elementArray.Length;
LinkedList<int> integerElements = new LinkedList<int>();
int forcounter = 0;
foreach (String element in elementArray)
{
try
{
integerElements.AddLast(int.Parse(element));
forcounter++;
}
catch (FormatException fe)
{
//Rakam olmayanları elemek için
}
}
int[] integerArray = integerElements.ToArray<int>();
//Elemanları sıralayalım
integerArray = MergeSort(integerArray);
foreach (int i in integerArray)
{
Console.WriteLine(i);
}
}
开发者ID:theaob,项目名称:SorterMaraton,代码行数:38,代码来源:Program.cs
示例12: DispatchManager
public DispatchManager(
object sender, // Agent reference for callbacks
Options options, WaterFlowManager incomingFlowManager,
IOWorker ioWorker,
LogCallback logCallback, LogEventArgs.LogLevel logLevel)
{
this.sender = sender;
this.incomingFlowManager = incomingFlowManager;
this.ioWorker = ioWorker;
this.logCallback = logCallback;
this.logLevel = logLevel;
messageQueue = new LinkedList<IncomingMessage>();
objectMap = new Dictionary<string, IncomingMessageHandler>();
anyObjectCallback = null;
int numOfThreads = options.dispatcherThreads;
dispatchers = new List<Thread>();
for (int i = 0; i != numOfThreads; ++i)
{
Thread th = new Thread((new Dispatcher(this)).run);
th.Name = "YAMI4 message dispatcher";
th.IsBackground = true;
th.Start();
dispatchers.Add(th);
}
}
开发者ID:morambro,项目名称:TrainProject,代码行数:31,代码来源:DispatchManager.cs
示例13: TokenStream
public TokenStream(IEnumerable<LexicToken> tokens)
{
if (tokens == null)
throw new ArgumentNullException("tokens");
this.tokens = new LinkedList<LexicToken>(tokens);
}
开发者ID:bashis,项目名称:MyGraphic,代码行数:7,代码来源:TokenStream.cs
示例14: CalculateTime
public static void CalculateTime(LinkedList<string> list, int k)
{
// Add
var startAdding = DateTime.Now;
string test = "Test string";
for (int i = 0; i < k; i++)
{
list.AddFirst(test);
}
var finishAdding = DateTime.Now;
Console.WriteLine("Addition time (" + k + " elements) : " + list.GetType() + " " + (finishAdding - startAdding));
// Search
var startSearch = DateTime.Now;
for (int i = 0; i < k; i++)
{
bool a = list.Equals(test);
}
var finishSearch = DateTime.Now;
Console.WriteLine("Search time (" + k + " elements) : " + list.GetType() + " " + (finishSearch - startSearch));
// Remove
k = 1000000;
var startRemoving = DateTime.Now;
for (int i = 0; i < k; i++)
{
list.Remove(test);
}
var finishRemoving = DateTime.Now;
Console.WriteLine("Removal time (" + k + " elements) : " + list.GetType() + " " + (finishRemoving - startRemoving) + "\n");
}
开发者ID:yuliapetrova,项目名称:CSharpTasks,代码行数:31,代码来源:Program.cs
示例15: GradingAssignmentForm
public GradingAssignmentForm()
{
InitializeComponent();
currentAssignment = null;
currentResponseList = null;
DeletedAdjustments = new LinkedList<int>();
}
开发者ID:Acedio,项目名称:GradersAssistant,代码行数:7,代码来源:GradingAssignmentForm.cs
示例16: Solution
public Solution()
{
Name = string.Empty;
BusinessObjectFiles = new LinkedList<string>();
BusinessObjects = new LinkedList<Node>();
}
开发者ID:Rugosh,项目名称:SolutionDocumentationGenerator,代码行数:7,代码来源:Solution.cs
示例17: Tester
// constructor with the test type and Assignment already set
public Tester(int type, int aID)
{
this.aID = aID;
this.type = type;
this.tested = 0;
this.reports = new LinkedList<Report>();
}
开发者ID:cweber-wou,项目名称:capstone,代码行数:8,代码来源:Tester.cs
示例18: MoveNext
public bool MoveNext()
{
if (personLinkedList == null) {
personLinkedList = new LinkedList<Person>();
personLinkedList.AddLast(new Person {personId = 1, personName = "xxx", personLocation = "chennai"} );
personLinkedList.AddLast(new Person {personId = 2, personName = "YYY", personLocation = "chennai"} );
personLinkedList.AddLast(new Person {personId = 3, personName = "ZZZ", personLocation = "chennai"} );
}
if (currentObj == null && personLinkedList.First != null)
{
currentObj = personLinkedList.First;
return true;
}
if ( currentObj.Next!=null)
{
currentObj = currentObj.Next;
return true;
}
else
{
return false;
}
}
开发者ID:ctsxamarintraining,项目名称:cts451892,代码行数:25,代码来源:Program.cs
示例19: Curve
public Curve(Molecule mol, Vector2 pos, Camera VectroCam = null)
{
_mol = mol;
_label = mol.getName();
_points = new LinkedList<Vector2>();
//_pts = new Vector2[_maxPoints];
_pts = new List<Vector2>();
_minY = 0;
_maxY = 0;
_color = new Color(UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f), UnityEngine.Random.Range(0f, 1f));
//_line = new VectorLine(mol.getName(), _pts, _color, null, 2.0f, LineType.Continuous, Joins.Weld);
_line = new VectorLine(mol.getName(), _pts, 2.0f, LineType.Continuous, Joins.Weld);
_line.color = _color;
_isEnabled = true;
_vectroCam = VectroCam;
// _pos = pos;
// _lines = new VectorLine[_maxPoints];
// _linesTypes = new _linesTypes[_maxPoints - 1];
VectorManager.useDraw3D = true;
if (_vectroCam != null)
//Vectrosity.VectorLine.SetCamera(_vectroCam);
Vectrosity.VectorLine.SetCamera3D(_vectroCam);
else
Logger.Log("No Camera set for the Graph Window.", Logger.Level.ERROR);
}
开发者ID:CyberCRI,项目名称:Hero.Coli,代码行数:27,代码来源:Curve.cs
示例20: GVDKarla
public GVDKarla(ObstacleGrid grid)
{
this.grid = grid;
open = new IntervalHeap<GridCellValue>();
ties = new LinkedList<GridCell>();
dist = new float[grid.NumColumns, grid.NumRows];
distNew = new float[grid.NumColumns, grid.NumRows];
parent = new GridCell[grid.NumColumns, grid.NumRows];
tie = new GridCell[grid.NumColumns, grid.NumRows];
obst = new int[grid.NumColumns, grid.NumRows];
valid = new HashSet<int>();
voro = new bool[grid.NumColumns, grid.NumRows];
for (int c = grid.NumColumns - 1; c >= 0; c--)
for (int r = grid.NumRows - 1; r >= 0; r--)
{
dist[c, r] = float.PositiveInfinity;
distNew[c, r] = float.PositiveInfinity;
parent[c, r] = GridCell.Unknown;
tie[c, r] = GridCell.Unknown;
obst[c, r] = -1;
voro[c, r] = false;
}
}
开发者ID:jgera,项目名称:AutonomousCar,代码行数:25,代码来源:GVDKarla.cs
注:本文中的LinkedList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论