(61d00a474) v0.9.7.1

This commit is contained in:
Regalis
2020-03-04 13:04:10 +01:00
parent 3c50efa5c9
commit 3c09ebe02f
5086 changed files with 786063 additions and 295871 deletions
@@ -0,0 +1,69 @@
// Copyright (c) 2017 Kastellanos Nikolaos
using System;
using System.Collections;
using System.Collections.Generic;
namespace FarseerPhysics.Dynamics.Contacts
{
/// <summary>
/// Head of a circular doubly linked list.
/// </summary>
public class ContactListHead : Contact , IEnumerable<Contact>
{
internal ContactListHead(): base(null, 0, null, 0)
{
this.Prev = this;
this.Next = this;
}
IEnumerator<Contact> IEnumerable<Contact>.GetEnumerator()
{
return new ContactEnumerator(this);
}
IEnumerator IEnumerable.GetEnumerator()
{
return new ContactEnumerator(this);
}
#region Nested type: ContactEnumerator
private struct ContactEnumerator : IEnumerator<Contact>
{
private ContactListHead _head;
private Contact _current;
public Contact Current { get { return _current; } }
object IEnumerator.Current { get { return _current; } }
public ContactEnumerator(ContactListHead contact)
{
_head = contact;
_current = _head;
}
public void Reset()
{
_current = _head;
}
public bool MoveNext()
{
_current = _current.Next;
return (_current != _head);
}
public void Dispose()
{
_head = null;
_current = null;
}
}
#endregion
}
}