From: Aran Deltac Date: Sun, 19 Mar 2006 18:37:12 +0000 (+0000) Subject: Removeing Tree:: stuff since I didnt mean to check it in yet. X-Git-Tag: v0.07002~75^2~294 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bba8ca30ac7fdbe8d68f58f377af0f69de43868f;p=dbsrgits%2FDBIx-Class.git Removeing Tree:: stuff since I didnt mean to check it in yet. --- diff --git a/lib/DBIx/Class/Tree/AdjacencyList.pm b/lib/DBIx/Class/Tree/AdjacencyList.pm deleted file mode 100644 index e69de29..0000000 diff --git a/lib/DBIx/Class/Tree/NestedSet.pm b/lib/DBIx/Class/Tree/NestedSet.pm deleted file mode 100644 index d56d98c..0000000 --- a/lib/DBIx/Class/Tree/NestedSet.pm +++ /dev/null @@ -1,52 +0,0 @@ -package DBIx::Class::NestedSets; -use strict; -use warnings; - -use base qw( DBIx::Class ); - -__PACKAGE__->mk_classdata( 'nested_left_column' ); -__PACKAGE__->mk_classdata( 'nested_right_column' ); - -sub set_nested_columns { - my( $class, $left_column, $right_column ) = @_; - $class->nested_left_column( $left_column ); - $class->nested_right_column( $right_column ); -} - -sub append_child { - my( $parent, $child ) = @_; - - # Preload these since we will be useing them more than once. - my $right_column = $parent->nested_right_column(); - my $left_column = $parent->nested_left_column(); - my $parent_right = $parent->get($right_column); - my $child_extent = $child->extent(); - - # Find all nodes to the right of the parent, including the parent. - my $rs = $parent->search( { - $right_column => { '>=', $parent_right } - } ); - - # Shift all nodes to the right by the extent of the child. - $rs->update( - $right_column => { - $right_column => { '+', $child_extent } - } - ); - - # Pop the child in to the space that we opened up. - $child->set( - $left_column => $parent_right, - $right_column => ($parent_right + $child_extent) - 1, - ); -} - -sub extent { - my( $self ) = @_; - return ( - $self->get( $class->nested_right_column() ) - - $self->get( $class->nested_left_column() ) - ) + 1; -} - -1;