123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- /*
- * Box2D.XNA port of Box2D:
- * Copyright (c) 2009 Brandon Furtwangler, Nathan Furtwangler
- *
- * Original source Box2D:
- * Copyright (c) 2006-2009 Erin Catto http://www.gphysics.com
- *
- * This software is provided 'as-is', without any express or implied
- * warranty. In no event will the authors be held liable for any damages
- * arising from the use of this software.
- * Permission is granted to anyone to use this software for any purpose,
- * including commercial applications, and to alter it and redistribute it
- * freely, subject to the following restrictions:
- * 1. The origin of this software must not be misrepresented; you must not
- * claim that you wrote the original software. If you use this software
- * in a product, an acknowledgment in the product documentation would be
- * appreciated but is not required.
- * 2. Altered source versions must be plainly marked as such, and must not be
- * misrepresented as being the original software.
- * 3. This notice may not be removed or altered from any source distribution.
- */
- using System;
- namespace Box2D.XNA
- {
- public struct FixedArray2<T>
- {
- public T this[int index]
- {
- get
- {
- switch (index)
- {
- case 0:
- return _value0;
- case 1:
- return _value1;
- default:
- throw new IndexOutOfRangeException();
- }
- }
- set
- {
- switch (index)
- {
- case 0:
- _value0 = value;
- break;
- case 1:
- _value1 = value;
- break;
- default:
- throw new IndexOutOfRangeException();
- }
- }
- }
- T _value0;
- T _value1;
- }
- public struct FixedArray3<T>
- {
- public T this[int index]
- {
- get
- {
- switch (index)
- {
- case 0:
- return _value0;
- case 1:
- return _value1;
- case 2:
- return _value2;
- default:
- throw new IndexOutOfRangeException();
- }
- }
- set
- {
- switch (index)
- {
- case 0:
- _value0 = value;
- break;
- case 1:
- _value1 = value;
- break;
- case 2:
- _value2 = value;
- break;
- default:
- throw new IndexOutOfRangeException();
- }
- }
- }
- T _value0;
- T _value1;
- T _value2;
- }
- public struct FixedArray4<T>
- {
- public T this[int index]
- {
- get
- {
- switch (index)
- {
- case 0:
- return _value0;
- case 1:
- return _value1;
- case 2:
- return _value2;
- case 3:
- return _value3;
- default:
- throw new IndexOutOfRangeException();
- }
- }
- set
- {
- switch (index)
- {
- case 0:
- _value0 = value;
- break;
- case 1:
- _value1 = value;
- break;
- case 2:
- _value2 = value;
- break;
- case 3:
- _value3 = value;
- break;
- default:
- throw new IndexOutOfRangeException();
- }
- }
- }
- T _value0;
- T _value1;
- T _value2;
- T _value3;
- }
- public struct FixedArray8<T>
- {
- public T this[int index]
- {
- get
- {
- switch (index)
- {
- case 0:
- return _value0;
- case 1:
- return _value1;
- case 2:
- return _value2;
- case 3:
- return _value3;
- case 4:
- return _value4;
- case 5:
- return _value5;
- case 6:
- return _value6;
- case 7:
- return _value7;
- default:
- throw new IndexOutOfRangeException();
- }
- }
- set
- {
- switch (index)
- {
- case 0:
- _value0 = value;
- break;
- case 1:
- _value1 = value;
- break;
- case 2:
- _value2 = value;
- break;
- case 3:
- _value3 = value;
- break;
- case 4:
- _value4 = value;
- break;
- case 5:
- _value5 = value;
- break;
- case 6:
- _value6 = value;
- break;
- case 7:
- _value7 = value;
- break;
- default:
- throw new IndexOutOfRangeException();
- }
- }
- }
- T _value0;
- T _value1;
- T _value2;
- T _value3;
- T _value4;
- T _value5;
- T _value6;
- T _value7;
- }
- }
|