<commit_before>############################################################################
## 
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 
## All rights reserved. 
## Contact: Nokia Corporation (<EMAIL>) 
## 
## This file is part of Testability Driver. 
## 
## If you have questions regarding the use of this file, please contact 
## Nokia at <EMAIL> . 
## 
## This library is free software; you can redistribute it and/or 
## modify it under the terms of the GNU Lesser General Public 
## License version 2.1 as published by the Free Software Foundation 
## and appearing in the file LICENSE.LGPL included in the packaging 
## of this file. 
## 
############################################################################

module MobyCommand

  class Application < MobyCommand::CommandData
  
=begin
    attr_reader( 
    
      :command_type,
      :application_name,
      :application_uid,
      :sut,
      :application_arguments,
      :events_to_listen,
      :signals_to_listen,
      :working_directory,
      :flags,
      :start_command,

      :refresh_arguments,
      :attribute_csv_string

      
			:_arguments,
			:_environment,
			:_working_directory,
			:_events_to_listen,
			:_start_command,
			:_application_uid,
			:_application_name,
			:_command,
			:_application_name,
			:_application_uid,
			:_flags,
			:_attribute_csv_string,
			:_signals_to_listen,
      :_sut,
      :_refresh_args
    
    )
=end

    attr_reader :command_arguments
  
    # TODO: document me
    def initialize( command, arguments = {} )
        
      arguments.check_type Hash, "wrong argument type $1 for #{ self.class } arguments (expected $2)"  

      # default values
      arguments.default = nil

      @command_arguments = arguments
  
			self.command( command )
			
      # store values from arguments 
			self.name( arguments[ :application_name ] )
			self.uid( arguments[ :application_uid ] )
			self.sut( arguments[ :sut ] )
			self.arguments( arguments[ :arguments ] )
			self.events_to_listen( arguments[ :events_to_listen ] )
			self.signals_to_listen( arguments[ :signals_to_listen ] )
			self.environment( arguments[ :environment ] )
			self.working_directory( arguments[ :working_directory ] )
			self.flags( arguments[ :flags ] )
			self.start_command( arguments[ :start_command ] )
	    self.refresh_args( arguments[ :refresh_arguments ] )
			self.attribute_filter( arguments[ :attribute_filter ] )

			self
    
    end

		# Store the args for possible future use
		def refresh_args(refresh_args={})
		  @_refresh_args = refresh_args
		end
		
		def get_refresh_args
		  @_refresh_args<commit_msg>tdriver#commands/application.rb: minor changes to application command class<commit_after>############################################################################
## 
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 
## All rights reserved. 
## Contact: Nokia Corporation (<EMAIL>) 
## 
## This file is part of Testability Driver. 
## 
## If you have questions regarding the use of this file, please contact 
## Nokia at <EMAIL> . 
## 
## This library is free software; you can redistribute it and/or 
## modify it under the terms of the GNU Lesser General Public 
## License version 2.1 as published by the Free Software Foundation 
## and appearing in the file LICENSE.LGPL included in the packaging 
## of this file. 
## 
############################################################################

module MobyCommand

  class Application < MobyCommand::CommandData
  
=begin
    attr_reader( 
    
      :command_type,
      :application_name,
      :application_uid,
      :sut,
      :application_arguments,
      :events_to_listen,
      :signals_to_listen,
      :working_directory,
      :flags,
      :start_command,

      :refresh_arguments,
      :attribute_csv_string

      
			:_arguments,
			:_environment,
			:_working_directory,
			:_events_to_listen,
			:_start_command,
			:_application_uid,
			:_application_name,
			:_command,
			:_application_name,
			:_application_uid,
			:_flags,
			:_attribute_csv_string,
			:_signals_to_listen,
      :_sut,
      :_refresh_args
    
    )
=end

    attr_reader :command_arguments
  
    # TODO: document me
    def initialize( command, arguments = {} )
        
      arguments.check_type Hash, "wrong argument type $1 for #{ self.class } arguments (expected $2)"  

      # default values
      arguments.default = nil

      @command_arguments = arguments

      @_command = command

      @_application_name = nil
      @_application_uid = nil
      @_sut = nil
      @_arguments = nil
      @_events_to_listen = nil
      @_signals_to_listen = nil
      @_environment = nil
      @_working_directory = nil
      @_flags = nil
      @_start_command = nil
      @_refresh_args = nil
      @_attribute_csv_string = nil

=begin			
      # store values from arguments 
			self.name( arguments[ :application_name ] )
			self.uid( arguments[ :application_uid ] )
			self.sut( arguments[ :sut ] )
			self.arguments( arguments[ :arguments ] )
			self.events_to_listen( arguments[ :events_to_listen ] )
			self.signals_to_listen( arguments[ :signals_to_listen ] )
			self.environment( arguments[ :environment ] )
			self.working_directory( arguments[ :working_directory ] )
			self.flags( arguments[ :flags ] )
			self.start_command( arguments[ :start_command ] )
	    self.refresh_args( arguments[ :refresh_arguments ] )
			self.attribute_filter( arguments[ :attribute_filter ] )
=end
      
      # store values from arguments - call setter method only when required			
			arguments.each_pair{ | key, value |
			
			  # skip if value is nil (default)   
			  next if value.nil?
			
			  case key
			  
			    when :application_name
			      name( value )
			      
			    when :application_uid
      			uid( value )

          when :sut
      			sut( value )
			    
			    when :arguments
			      arguments( value )
			    
			    when :events_to_listen
            events_to_listen( value )

			    when :signals_to_listen
			      signals_to_listen( value )

			    when :environment
            environment( value )

			    when :working_directory
			      working_directory( value )
			       			    
			    when :flags
			      flags( value )

			    when :start_command
      			start_command( value ) 

			    when :refresh_arguments
            refresh_args( value )

			    when :attribute_filter
            attribute_filter( value )

        else

          # show warning/exception?        
			    			    			  
			  end
			
			}
			
			self
    
    end

		# Store the args for possible future use
		def refresh_args(refresh_args={})
		  @_refresh_args = refresh_args
		end
		
		def get_refresh_args
		  @_refresh_args
{'fraction_non_alphanumeric': 0.12433471318746304, 'fraction_numerical': 0.002365464222353637, 'mean_word_length': 2.7793296089385473, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6883790', 'n_tokens_mistral': 2194, 'n_tokens_neox': 1888, 'n_words': 511}