DOCUMENTATION

SYNOPSIS

Perl package: param_flow.pm 
AUTHOR: Juan Lorenzo
DATE: Aug 3 2017 

DESCRIPTION: 
V 0.1 Aug 3 2017

USED FOR: 

BASED ON:
 param_flow.pm
private hash_ref
w  for widgets

sub first_idx

first usable index is set to 0

sub get_num_good_values_aref

sub get_num_good_labels_aref

sub insert_selection

delete parameter names and values
of on one  selected item

sub delete_selection

delete parameter names and values
of on one  selected item

sub get_check_buttons_settings

my ($i,$j, $length); my @on_off; my @values_aref;

 		@values_aref 	= @{@{$param_flow->{_checkbuttons_aref2}}[$index]};
 		$length			= scalar @values_aref;

   		print("param_flow,get_check_buttons_settings: is @values_aref\n");

  		#for ($i=1,$j=0; $i < $length; $i=$i+2,$j++ ) {
  		for ($i=0; $i < $length; $i++ ) {
    		#$values[$j]  = $values_aref[$i]; 
    			#print("param_flow, get_check_buttons_settings :index $j values: $values[$j]\n");
     	if($values_aref[$i] eq $nu || ) {
     	  	$on_off[$i]     = $off;
		  	# print(" 1. param_flow, get_check_buttons_settings,$on_off[$i]\n");
     	}
     	else {
       		$on_off[$i]     = $on;
		    # print(" 2. param_flow, get_check_buttons_settings,$on_off[$i]\n");
     	}
     	# print("param_flow: get_check_buttons_settings :index $i setting $nu is: $on_off[$i]\n");
   		}

sub get_flow_index

get current program index 
 

sub get_flow_prog_names_aref

extract sequential program names in flow 

sub get_good_labels_aref2

sub get_good_values_aref2

sub get_names_aref

sub get_num_items

sub get_values_aref

sub get_flow_items_version_aref

o/p is array ref of the version of each program name

sub length

last item number (not last index) 
last item numberis equivalent to length

sub private_get_good_length4item

sub private_get_names_aref

sub private_get_values_aref

sub private_set_good_labels4item

my $num_items4flow = $param_flow->{_num_items4flow}; 

sub private_set_good_values4item

	Set good values privately for a single item (program name)
	within a flow

 	my $num_items4flow = $param_flow->{_num_items4flow}; 

sub set_flow_items_version_aref

i/p is array ref of the version of each program name

sub set_insert_start

move paramter names and values
of one selected item into another
space

sub set_insert_end

move paramter names and values
of one selected item into another
space

sub set_flow_index

select an item for which to extract data
     			print("param_flow, set flow_index, prog name is @{$param_flow->{_prog_names_aref}}[$index]\n");
 

sub set_names_aref

sub set_good_labels

select names with values

sub set_good_values

find good values for ALL programs in flow

sub set_good_labels4item

my $num_items4flow = $param_flow->{_num_items4flow}; 

sub set_good_values4item

 	my $num_items4flow = $param_flow->{_num_items4flow}; 
	work on finding good values for one item

sub set_values_aref

sub set_check_buttons_settings

set check_buttons by user from outside

sub stack_checkbuttons_aref2

array of arrays
One array if checkbuttons for each item
DB
#for (my $i=0; $i<=$index;$i++) {
  #print("param_flow,checkbuttons_aref,@{@{$param_flow->{_checkbuttons_aref2}}[$i]} index $i\n");
#}
   #print("param_flow, checkbuttons_aref2, num_items4checkbuttons $param_flow->{_num_items4checkbuttons}\n");

sub stack_flow_item

i/p is scalar ref to a program name
keep count and increment the number of items
encapsulate internal counters and array
from the array shared among the package subroutines 

count items at start in case we don't return to the subroutine
later
    print("param_flow, stack_flow_item @{$param_flow->{_prog_names_aref}}, num_items $param_flow->{_num_items}\n");
	 print("param_flow, stack_flow_item, index: $index\n");

sub stack_names_aref2

i/p array ref for values in a program
an array of arrays is created, one array for each item
DrBN
#  for (my $i=0; $i<=$index;$i++) {
   #print("param_flow,names_aref,@{@{$param_flow->{_names_aref2}}[$i]} item $i\n");
#  }
    #print("param_flow, names_aref2, num_items4names $param_flow->{_num_items4names}\n");

#print("param_flow,names_aref,$names[$index],item $index\n");

sub stack_values_aref2

i/p array ref for values in a program
an array of arrays is created, one array for each item

DB #for (my $i=0; $i<=$index;$i++) { # print("param_flow,values_aref2,@{@{$param_flow->{_values_aref2}}[$i]} index $i\n"); #} #print("param_flow,values_aref2,num_items=$param_flow->{_num_items}\n"); # print("param_flow,values_aref2, index $index\n");

sub view_data

Data viewer for debugging
  print("B4  delete: names are  $param_flow->{_names_aref2}\n");    # ref_Array
  print("B4  delete: names are  @{$param_flow->{_names_aref2}}\n");     # [ref_array0 ref_array1 .... 
  print("B4  delete: names are  @{$param_flow->{_names_aref2}}[0]\n");  # ref_array0

  print("B4  delete: names are  @{$param_flow->{_names_aref2}}[1]\n"); #ref_array1
    
  print("B4  delete: names are  @{@{$param_flow->{_names_aref2}}[0]}\n"); # all names in ref_array 0 
  print("B4  delete: names are  @{@{$param_flow->{_names_aref2}}[1]}[0]\n"); # first name  in ref_array 
  print("param_flow,view_data: list for each item\n");