| 1 | package Perl::Structure::LinkedList::Node; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use Perl::Types; | ||
| 5 | our $VERSION = 0.001_100; | ||
| 6 | |||
| 7 | package Perl::Structure::LinkedList::NodeReference; | ||
| 8 | #use parent qw(Perl::Structure Perl::Type::Modifier::Reference); # NEED UPGRADE, CORRELATION #rp023: Inline::CPP support for multiple inheritance | ||
| 9 | use parent qw(Perl::Type::Modifier::Reference); | ||
| 10 | #use Perl::Structure; | ||
| 11 | use Perl::Type::Modifier::Reference; | ||
| 12 | |||
| 13 | # must include here because we do not inherit data types | ||
| 14 | use Perl::Type::Integer; | ||
| 15 | use Perl::Type::String; | ||
| 16 | use Perl::Type::Unknown; | ||
| 17 | #use RPerl::CodeBlock::Subroutine::Method; # NEED UPDATE, RPERL REFACTOR | ||
| 18 | |||
| 19 | our hashref $properties = | ||
| 20 | { | ||
| 21 | data => my unknown $TYPED_data = undef, | ||
| 22 | next => my Perl::Structure::LinkedList::NodeReference $TYPED_next = undef | ||
| 23 | }; | ||
| 24 | |||
| 25 | sub DUMPER { | ||
| 26 | { my string $RETURN_TYPE }; | ||
| 27 | (my Perl::Structure::LinkedList::NodeReference $node) = @ARG; | ||
| 28 | my string $dumped = '['; | ||
| 29 | my integer $is_first = 1; | ||
| 30 | |||
| 31 | while (defined($node)) | ||
| 32 | { | ||
| 33 | if ($is_first) { $is_first = 0; } | ||
| 34 | else { $dumped .= ', '; } | ||
| 35 | # TODO: handle non-scalartype linked list elements | ||
| 36 | $dumped .= $node->{data}; | ||
| 37 | $node = $node->{next}; | ||
| 38 | } | ||
| 39 | |||
| 40 | $dumped .= ']'; | ||
| 41 | return $dumped; | ||
| 42 | } | ||
| 43 | |||
| 44 | # ref to (linked list node) | ||
| 45 | # DEV NOTE: for naming conventions, see DEV NOTE in same code section of LinkedList.pm | ||
| 46 | package # hide from PAUSE indexing | ||
| 47 | linkedlistnoderef; | ||
| 48 | use parent qw(Perl::Structure::LinkedList::NodeReference); | ||
| 49 | use Perl::Structure::LinkedList::Node; | ||
| 50 | our $properties = $properties; | ||
| 51 | |||
| 52 | 1; # end of class |