1
0
Fork 0

(svn r15092) -Fix [NoAI]: make the library internal class name consistant with their directory name

release/0.7
truebrain 2009-01-15 16:53:18 +00:00
parent 103cd2a5ed
commit 7eac17f5ea
6 changed files with 30 additions and 30 deletions

View File

@ -1,14 +1,14 @@
/* $Id$ */ /* $Id$ */
class BinaryHeap extends AILibrary { class Binary_Heap extends AILibrary {
function GetAuthor() { return "OpenTTD NoAI Developers Team"; } function GetAuthor() { return "OpenTTD NoAI Developers Team"; }
function GetName() { return "Binary Heap"; } function GetName() { return "Binary Heap"; }
function GetShortName() { return "QUBH"; } function GetShortName() { return "QUBH"; }
function GetDescription() { return "An implementation of a Binary Heap"; } function GetDescription() { return "An implementation of a Binary Heap"; }
function GetVersion() { return 1; } function GetVersion() { return 1; }
function GetDate() { return "2008-06-10"; } function GetDate() { return "2008-06-10"; }
function CreateInstance() { return "BinaryHeap"; } function CreateInstance() { return "Binary_Heap"; }
function GetCategory() { return "Queue"; } function GetCategory() { return "Queue"; }
} }
RegisterLibrary(BinaryHeap()); RegisterLibrary(Binary_Heap());

View File

@ -5,7 +5,7 @@
* Peek and Pop always return the current lowest value in the list. * Peek and Pop always return the current lowest value in the list.
* Sort is done on insertion and on deletion. * Sort is done on insertion and on deletion.
*/ */
class BinaryHeap class Binary_Heap
{ {
_queue = null; _queue = null;
_count = 0; _count = 0;
@ -55,7 +55,7 @@ class BinaryHeap
function Exists(item); function Exists(item);
}; };
function BinaryHeap::Insert(item, priority) function Binary_Heap::Insert(item, priority)
{ {
/* Append dummy entry */ /* Append dummy entry */
_queue.append(0); _queue.append(0);
@ -71,7 +71,7 @@ function BinaryHeap::Insert(item, priority)
return true; return true;
} }
function BinaryHeap::Pop() function Binary_Heap::Pop()
{ {
if (_count == 0) return null; if (_count == 0) return null;
@ -86,19 +86,19 @@ function BinaryHeap::Pop()
return node[0]; return node[0];
} }
function BinaryHeap::Peek() function Binary_Heap::Peek()
{ {
if (_count == 0) return null; if (_count == 0) return null;
return _queue[0][0]; return _queue[0][0];
} }
function BinaryHeap::Count() function Binary_Heap::Count()
{ {
return _count; return _count;
} }
function BinaryHeap::Exists(item) function Binary_Heap::Exists(item)
{ {
/* Brute-force find the item (there is no faster way, as we don't have the priority number) */ /* Brute-force find the item (there is no faster way, as we don't have the priority number) */
foreach (node in _queue) { foreach (node in _queue) {
@ -110,7 +110,7 @@ function BinaryHeap::Exists(item)
function BinaryHeap::_BubbleDown() function Binary_Heap::_BubbleDown()
{ {
if (_count == 0) return; if (_count == 0) return;

View File

@ -1,14 +1,14 @@
/* $Id$ */ /* $Id$ */
class FibonacciHeap extends AILibrary { class Fibonacci_Heap extends AILibrary {
function GetAuthor() { return "OpenTTD NoAI Developers Team"; } function GetAuthor() { return "OpenTTD NoAI Developers Team"; }
function GetName() { return "Fibonacci Heap"; } function GetName() { return "Fibonacci Heap"; }
function GetShortName() { return "QUFH"; } function GetShortName() { return "QUFH"; }
function GetDescription() { return "An implementation of a Fibonacci Heap"; } function GetDescription() { return "An implementation of a Fibonacci Heap"; }
function GetVersion() { return 1; } function GetVersion() { return 1; }
function GetDate() { return "2008-08-22"; } function GetDate() { return "2008-08-22"; }
function CreateInstance() { return "FibonacciHeap"; } function CreateInstance() { return "Fibonacci_Heap"; }
function GetCategory() { return "Queue"; } function GetCategory() { return "Queue"; }
} }
RegisterLibrary(FibonacciHeap()); RegisterLibrary(Fibonacci_Heap());

View File

@ -7,7 +7,7 @@
* Insert is implemented as a lazy insert, as it will simply add the new * Insert is implemented as a lazy insert, as it will simply add the new
* node to the root list. Sort is done on every Pop operation. * node to the root list. Sort is done on every Pop operation.
*/ */
class FibonacciHeap { class Fibonacci_Heap {
_min = null; _min = null;
_min_index = 0; _min_index = 0;
_min_priority = 0; _min_priority = 0;
@ -67,7 +67,7 @@ class FibonacciHeap {
function Exists(item); function Exists(item);
}; };
function FibonacciHeap::Insert(item, priority) { function Fibonacci_Heap::Insert(item, priority) {
/* Create a new node instance to add to the heap. */ /* Create a new node instance to add to the heap. */
local node = Node(); local node = Node();
/* Changing params is faster than using constructor values */ /* Changing params is faster than using constructor values */
@ -86,7 +86,7 @@ function FibonacciHeap::Insert(item, priority) {
_count++; _count++;
} }
function FibonacciHeap::Pop() { function Fibonacci_Heap::Pop() {
if (_count == 0) return null; if (_count == 0) return null;
@ -150,16 +150,16 @@ function FibonacciHeap::Pop() {
return z.item; return z.item;
} }
function FibonacciHeap::Peek() { function Fibonacci_Heap::Peek() {
if (_count == 0) return null; if (_count == 0) return null;
return _min.item; return _min.item;
} }
function FibonacciHeap::Count() { function Fibonacci_Heap::Count() {
return _count; return _count;
} }
function FibonacciHeap::Exists(item) { function Fibonacci_Heap::Exists(item) {
return ExistsIn(_root_list, item); return ExistsIn(_root_list, item);
} }
@ -169,7 +169,7 @@ function FibonacciHeap::Exists(item) {
* @param item The item to search for. * @param item The item to search for.
* @return True if the item is found, false otherwise. * @return True if the item is found, false otherwise.
*/ */
function FibonacciHeap::ExistsIn(list, item) { function Fibonacci_Heap::ExistsIn(list, item) {
foreach (val in list) { foreach (val in list) {
if (val.item == item) { if (val.item == item) {
@ -190,7 +190,7 @@ function FibonacciHeap::ExistsIn(list, item) {
/** /**
* Basic class the fibonacci heap is composed of. * Basic class the fibonacci heap is composed of.
*/ */
class FibonacciHeap.Node { class Fibonacci_Heap.Node {
degree = null; degree = null;
child = null; child = null;

View File

@ -1,14 +1,14 @@
/* $Id$ */ /* $Id$ */
class PriorityQueue extends AILibrary { class Priority_Queue extends AILibrary {
function GetAuthor() { return "OpenTTD NoAI Developers Team"; } function GetAuthor() { return "OpenTTD NoAI Developers Team"; }
function GetName() { return "Priority Queue"; } function GetName() { return "Priority Queue"; }
function GetShortName() { return "QUPQ"; } function GetShortName() { return "QUPQ"; }
function GetDescription() { return "An implementation of a Priority Queue"; } function GetDescription() { return "An implementation of a Priority Queue"; }
function GetVersion() { return 2; } function GetVersion() { return 2; }
function GetDate() { return "2008-06-10"; } function GetDate() { return "2008-06-10"; }
function CreateInstance() { return "PriorityQueue"; } function CreateInstance() { return "Priority_Queue"; }
function GetCategory() { return "Queue"; } function GetCategory() { return "Queue"; }
} }
RegisterLibrary(PriorityQueue()); RegisterLibrary(Priority_Queue());

View File

@ -5,7 +5,7 @@
* Peek and Pop always return the current lowest value in the list. * Peek and Pop always return the current lowest value in the list.
* Sort is done on insertion only. * Sort is done on insertion only.
*/ */
class PriorityQueue class Priority_Queue
{ {
_queue = null; _queue = null;
_count = 0; _count = 0;
@ -56,7 +56,7 @@ class PriorityQueue
function Exists(item); function Exists(item);
}; };
function PriorityQueue::Insert(item, priority) function Priority_Queue::Insert(item, priority)
{ {
/* Append dummy entry */ /* Append dummy entry */
_queue.append(0); _queue.append(0);
@ -82,7 +82,7 @@ function PriorityQueue::Insert(item, priority)
return true; return true;
} }
function PriorityQueue::Pop() function Priority_Queue::Pop()
{ {
if (_count == 0) return null; if (_count == 0) return null;
@ -92,19 +92,19 @@ function PriorityQueue::Pop()
return node[0]; return node[0];
} }
function PriorityQueue::Peek() function Priority_Queue::Peek()
{ {
if (_count == 0) return null; if (_count == 0) return null;
return _queue[_count - 1][0]; return _queue[_count - 1][0];
} }
function PriorityQueue::Count() function Priority_Queue::Count()
{ {
return _count; return _count;
} }
function PriorityQueue::Exists(item) function Priority_Queue::Exists(item)
{ {
/* Brute-force find the item (there is no faster way, as we don't have the priority number) */ /* Brute-force find the item (there is no faster way, as we don't have the priority number) */
foreach (node in _queue) { foreach (node in _queue) {