[LON-CAPA-cvs] cvs: newloncapa /types Queue.pm Stack.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 08 Apr 2003 15:36:11 -0000


albertel		Tue Apr  8 11:36:11 2003 EDT

  Modified files:              
    /newloncapa/types	Queue.pm Stack.pm 
  Log:
  - making the pod documentation acutally work (Yes you need all of the blank lines)
  
  
Index: newloncapa/types/Queue.pm
diff -u newloncapa/types/Queue.pm:1.1.1.1 newloncapa/types/Queue.pm:1.2
--- newloncapa/types/Queue.pm:1.1.1.1	Wed Feb 26 20:28:12 2003
+++ newloncapa/types/Queue.pm	Tue Apr  8 11:36:11 2003
@@ -1,21 +1,29 @@
 #
 #  Implement a simple queue in terms of a list.
 #
+
 =pod
+
 =head1 Queue
-    An object oriented implementation of a queue data structure.
-    queues are first in last out data structures.
+
+An object oriented implementation of a queue data structure.  queues
+are first in last out data structures.
 
 =head1 Member functions:
+
 =cut
 
 package Queue;
 
 
 =pod
+
 =head2 new 
+
   Construct a new queue.
+
 =cut
+
 sub new {
     my $class = shift;		# Class name to bless into.
     my $self  = [];		# Our data is a reference to an anon. array.
@@ -26,9 +34,13 @@
 }
 
 =pod
+
 =head2 enqueue
+
    Add an element to the tail of the queue.
+
 =cut
+
 sub enqueue {
     my $self = shift;		# Get object reference.
     my $item = shift;		# Get the item to enqueue...
@@ -36,9 +48,15 @@
 
 
 }
-=head 2 dequeue
+
+=pod
+
+=head2 dequeue
+
    Remove an element from the front of the queue.
+
 =cut
+
 sub dequeue {
     my $self = shift;		# Get object reference....
     return shift @$self;		# Remove from the front of the queue.
@@ -46,12 +64,17 @@
 
 
 1;
+
+=pod
+
 =head1 Theory
-  The queue is implemented as an array... enqueue is a thinly disguised
-  push, and dequeue is a thinly disguised shift.  This is probably quite 
-  in efficient for large queues, but should be fine for reasonably sized
-  queues.
 
-  Note that since Perl is a dynamically typed language, queues can contain
-  objects of any data type and can even be heterogenously typed.
+The queue is implemented as an array... enqueue is a thinly disguised
+push, and dequeue is a thinly disguised shift.  This is probably quite
+in efficient for large queues, but should be fine for reasonably sized
+queues.
+
+Note that since Perl is a dynamically typed language, queues can
+contain objects of any data type and can even be heterogenously typed.
+
 =cut
Index: newloncapa/types/Stack.pm
diff -u newloncapa/types/Stack.pm:1.1.1.1 newloncapa/types/Stack.pm:1.2
--- newloncapa/types/Stack.pm:1.1.1.1	Wed Feb 26 20:28:12 2003
+++ newloncapa/types/Stack.pm	Tue Apr  8 11:36:11 2003
@@ -5,22 +5,26 @@
 =pod
 
 =head1 Stack 
-    An object oriented implementation of a Stack data structure.  Stacks are
-    first in last out data structures.   
+
+An object oriented implementation of a Stack data structure.
+Stacks are first in last out data structures.
 
 =head1 Member functions:
+
 =cut
 
 package Stack;
 
 =pod
+
 =head2 new  
-    Creates a new instance of a stack.
 
+    Creates a new instance of a stack. 
+  
     my $stack = Stack->new();
 
-
 =cut
+
 sub new {
     my $class = shift;		# Class name.
     my $self  = [];		# Create an empty list to represent the stack.
@@ -29,25 +33,33 @@
 }
 
 =pod
+
 =head2 push
+
     takes an item and pushes it onto the back end of the stack.
 
     my $stack = Stack->new();
     $stack->push(something);
 
 =cut
+
 sub push {
     my $self = shift;		# Gets the list...
     my $item = shift;		# The item to push.
     push(@$self,$item);
 }
+
 =pod
+
 =head2 pop
+
     Returns the item at the top of the stack: does a pop.
 
     my object = Stack->new();
     my $item = object->pop();
+
 =cut
+
 sub pop {
     my $self = shift;
     return pop(@$self);
@@ -55,11 +67,15 @@
 
 
 1;
+
 =pod
-head1 Internal implementation details
-  Stacks are implemented as lists.  Thus a stack is a thinly disguised
-  list with push and pop wrappers.  Since PERL is a dynamically typed language,
-  stacks can contain any data type ... including a heterogenous collection of
-  types.
+
+=head1 Internal implementation details
+
+Stacks are implemented as lists.  Thus a stack is a thinly disguised
+list with push and pop wrappers.  Since PERL is a dynamically typed
+language, stacks can contain any data type ... including a
+heterogenous collection of types.
 
 =cut
+