Skip to content
Snippets Groups Projects
Select Git revision
  • 4e3785000184b9dcb24e5c84fd74ac6975b129b7
  • master default protected
  • 551-init-broker-service-permissions
  • dev protected
  • release-1.10 protected
  • 549-test-oai-pmh
  • 545-saving-multiple-times-breaks-pid-metadata
  • release-1.9 protected
  • 499-standalone-compute-service-2
  • 539-load-tests
  • hotfix/helm-chart
  • luca_ba_new_interface
  • 534-bug-when-adding-access-to-user-that-is-not-registered-at-dashboard-service
  • release-1.8 protected
  • 533-integrate-semantic-recommendation
  • feature/openshift
  • 518-spark-doesn-t-map-the-headers-correct
  • 485-fixity-checks
  • 530-various-schema-problems-with-subsets
  • release-1.7 protected
  • fix/auth-service
  • v1.10.1 protected
  • v1.10.0-rc13 protected
  • v1.10.0-rc12 protected
  • v1.10.0-rc11 protected
  • v1.10.0-rc10 protected
  • v1.10.0-rc9 protected
  • v1.10.0-rc8 protected
  • v1.10.0-rc7 protected
  • v1.10.0-rc6 protected
  • v1.10.0-rc5 protected
  • v1.10.0-rc4 protected
  • v1.10.0-rc3 protected
  • v1.10.0-rc2 protected
  • v1.10.0rc1 protected
  • v1.10.0rc0 protected
  • v1.10.0 protected
  • v1.9.3 protected
  • v1.9.2 protected
  • v1.9.2-rc0 protected
  • v1.9.1 protected
41 results

SubsetToolbar.vue

Blame
  • path_tree.pm 2.06 KiB
    #!/usr/bin/perl
    
    package Util::path_tree;
    
    use strict;
    
    use Data::Dumper;
    
    sub new { bless { root => [], paths => [] }, shift; }
    
    sub add_path
    {
      my $self= shift;
      my $path= shift;
      my $data= shift;
      my $split_char= shift || '/';
    
      # print __LINE__, " add_path: path=[$path]\n";
      push (@{$self->{paths}} => $path);
    
      my @path= split($split_char, $path);
      # print __LINE__, " path: ", Dumper(\@path);
    
      my ($fc, $idx, $depth)= $self->find_xx(\@path, 1);
      $fc->[$idx]->[2]= $data;
      # print __LINE__,  " add_path: path=[$path] idx=[$idx] depth=[$depth] fc: ", Dumper($fc);
      ($fc, $idx, $depth);
    }
    
    sub get_paths
    {
      my $self= shift;
    
      (wantarray) ? @{$self->{paths}} : $self->{paths};
    }
    
    sub find_path
    {
      my $self= shift;
      my $path= shift;
      my $split_char= shift || '/';
    
      print __LINE__, " find_path: path=[$path]\n";
    
      my @path= split($split_char, $path);
      # print __LINE__, " path: ", Dumper(\@path);
    
      my ($fc, $idx, $depth)= $self->find_xx(\@path);
      # print __LINE__,  " find_path: path=[$path] idx=[$idx] depth=[$depth] fc: ", Dumper($fc);
      ($fc, $idx, $depth);
    }
    
    sub find_xx
    {
      my $self= shift;
      my $path= shift;
      my $insert= shift;
    
      my $cursor= $self->{root};
      my $idx= 0;
      my $last_cursor= $cursor;
      my $last_index= 0;
      my $depth= 0;
      PE: foreach my $pe (@$path)
      {
        $last_cursor= $cursor;
        # print __LINE__, " add_path: pe=[$pe] cursor: ", Dumper($cursor);
        # print __LINE__, " self: ", Dumper($self);
        my $c= @$cursor;
        # print __LINE__, " c=[$c]\n";