[subtitizing range] を測定するための、コンピューター・プログラム (ソースプログラム・リストあり)
Cognition of Number, Index, 数に関する認知, インデックス へ
-----
2024.4.8 presented in internet World Wide Web
2024.7.5 presented in [note] ( //note.com/runningWater/]
-----
----------
はじめに
下記のコンテンツにおいて、私は、
[3]と[4]の間に、数字の形に関する割れ目が存在する(数を表す記号 の世界において)
この割れ目は、心理学において論じられている、[subitizing range](瞬間認知可能範囲)に、関係があると思われる
ということを、記述した。
Between 3 and 4, there is a split, about shape of numeric character,( 3 と 4 の間に、数字の形に関する割れ目あり)
そこで、私は、自分の[subitizing range]を推測するために、ある、(コンピューター)プログラムを、作った。そのプログラムのソースリストの全てを、ここに、記述した。
----------
2. このプログラムが動作する様
ここに記述されている内容は、このようなコンピューター・プログラムを制作した、それを動かしたら、このような結果になった、というような事を、ただ、述べているに過ぎない。
以下の記述を読んだ人が、それを単に参考にする、というのであれば、問題は無いと、思われる。
しかし、記述されている内容に沿って、その人が、そこに記されているのと同様の制作や作業を行った際に、その制作、作業、コンピューターの作動の結果、使用されたコンピューター等、様々な方面において、何らかの問題が発生しない、という保証は、全くない。
その制作、作業、コンピューターの作動の結果、その人や、その人が所属している組織、その人が使用した様々な機器、インフラストラクチャー等の、身の上にどのような事が起ころうとも、私は一切、責任を負わない。
このプログラムは、Java言語を使って、記述されている。
(1) フェーズ 1
[Start class] が起動されると、下の図(Fig 2.1) のような画面が表示される。
(2) フェーズ 2
次に、[enter key]が押されると、画面の表示内容は、下図 (Fig. 2.2)のようになる。
(3) フェーズ 3
次に、[enter key]が押されると、画面の表示内容は、下図 (Fig. 2.3)のようになる。
更に、[enter key]が押されると、制御が、[フェーズ 2]に、戻される。
このような、
[フェーズ 2] --> [フェーズ 3] --> [フェーズ 2]
の過程が、20回、繰り返される。各過程ごとに、まちまちの個数の四角形が表示される。(乱数を使用して、その個数が決定される)。
各過程ごとに、[フェーズ 2]から[フェーズ 3]への移行に要した時間が、コンピューターによって測定され、記録されていく。この時間がすなわち、[subitizing に要した時間] なのだ。
(4) フェーズ 4
20回の過程が完了すると、画面の表示内容は、下図 (Fig. 2.4)のようになる。
そして、各過程ごとに記録された数値が、下記のように、[System.out.println]によって(画面上にではなく)、表示される。
1列目に表示されるのは、各過程の番号
2列目に表示されるのは、各過程において、画面上に表示された長方形の個数
3列目に表示されるのは、各過程において、subitizing に要した時間
と、なる。
=============================
Class : Process , Methode : do_showing_results_process
The results of the trial are as follows
=============================
current_trial_number , rondom_number_values , time_second_for_response
-----------------------------------------------
1 , 7 , 1.652
2 , 4 , 0.856
3 , 2 , 0.656
・・・・・・・・・・
----------
3. このプログラムのソースコードは、以下の通りである。
Java言語を使って、記述されている
----------
import java.util.Calendar ;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Color ;
import java.awt.Font ;
import javax.swing.JFrame;
import javax.swing.JPanel;
//====================================
public class Start {
static String cv_this_class_name = "Start" ;
//-----------------------------------------------------------------
public static void main ( String args[] ) {
Process.do_prepare_process ( ) ;
Process.do_measurement_process ( ) ;
Process.do_showing_results_process ( ) ;
}
}
//==============================================
class ContainParameters {
public static final int cv_max_trial_number = 20 ;
public static final int cv_max_value_of_desired_range = 7 ;
public static final int cv_width_of_DisplayImage = 700 ;
public static final int cv_height_of_DisplayImage = 800 ;
public static final int cv_margin_of_DisplayImage_Frame = 5 ;
public static final int cv_width_of_mark_display_area = 200 ;
public static final int cv_width_of_mark = 12 ;
public static final int cv_height_of_mark = 50 ;
public static final int cv_Color_background_R = 10 ;
public static final int cv_Color_background_G = 30 ;
public static final int cv_Color_background_B = 70 ;
public static final int cv_Color_display_text_R = 220 ;
public static final int cv_Color_display_text_G = 200 ;
public static final int cv_Color_display_text_B = 20 ;
public static final int cv_number_of_lines_display_text = 5 ;
public static final int cv_Color_mark_R = 220 ;
public static final int cv_Color_mark_G = 40 ;
public static final int cv_Color_mark_B = 140 ;
public static final int cv_height_of_message_one_line = 40 ;
}
//==============================================
class Process {
static String cv_this_class_name = "Process" ;
static float [ ] cv_array_time_second_for_response ;
static DisplayImage cv_ins_DisplayImage ;
//----------------------------------------------------------
public static void do_prepare_process ( ) {
String this_methode_name = "do_prepare_process" ;
System.out.println ( "=============================" ) ;
System.out.println ( "Start , Class : " + cv_this_class_name
+ " , Methode : " + this_methode_name ) ;
System.out.println ( "=============================" ) ;
AreaForTransferOfIinformation
.cv_array_rondom_number_values_for_each_trial
= new int [ ContainParameters.cv_max_trial_number ] ;
AreaForTransferOfIinformation
.cv_array_figure_set_location_begin_X
= new int [ ContainParameters.cv_max_trial_number ] ;
AreaForTransferOfIinformation
.cv_array_figure_set_location_Y
= new int [ ContainParameters.cv_max_trial_number ] ;
cv_array_time_second_for_response = new float [ ContainParameters.cv_max_trial_number ] ;
//--------------------------------------------------
for ( int i = 1 ; i <= ContainParameters.cv_max_trial_number ; i += 1 ) {
set_values_using_random_number ( i ) ;
}
//-----------------------------------------
//prepare for display image
AreaForTransferOfIinformation.cv_phase_of_display_image = 1 ;
AreaForTransferOfIinformation
.cv_array_display_message
= new String [
ContainParameters.cv_number_of_lines_display_text
] ;
AreaForTransferOfIinformation
.cv_array_display_message [ 1 - 1 ]
= "Trial "
+ ContainParameters.cv_max_trial_number
+ " rounds, will be done" ;
AreaForTransferOfIinformation
.cv_array_display_message [ 2 - 1 ]
= "Are you ready?" ;
AreaForTransferOfIinformation
.cv_array_display_message [ 3 - 1 ]
= "Push [enter] key" ;
AreaForTransferOfIinformation
.cv_array_display_message [ 4 - 1 ]
= " " ;
AreaForTransferOfIinformation
.cv_array_display_message [ 5 - 1 ]
= " " ;
cv_ins_DisplayImage = new DisplayImage ( ) ;
cv_ins_DisplayImage.do_repaint ( ) ;
WaitForPushEnterKey.wait_for_push_enter_key ( ) ;
//--------------------------------------------------
System.out.println ( "=============================" ) ;
System.out.println ( "End , Class : " + cv_this_class_name
+ " , Methode : " + this_methode_name ) ;
System.out.println ( "=============================" ) ;
}
//-------------------------------------------------------------------
private static void set_values_using_random_number (
int arg_order_number_of_trial ) {
//prepare random numbers ( set into array )
double random_number_from_0_to_1 ;
double random_number_double_for_desired_range ;
int random_number_in_desired_range = 0 ;
int w1 = 0 ;
//------ decide rondom_number_values_for_each_trial -------------------
random_number_from_0_to_1 = Math.random ( ) ;
random_number_double_for_desired_range
= 0.999
+
( ContainParameters.cv_max_value_of_desired_range
* random_number_from_0_to_1 ) ;
w1 = ( int ) random_number_double_for_desired_range ;
random_number_in_desired_range = w1 ;
if ( w1 <= 0 ) {
random_number_in_desired_range = 1 ;
}
if ( w1 > ContainParameters.cv_max_value_of_desired_range ) {
random_number_in_desired_range
= ContainParameters.cv_max_value_of_desired_range ;
}
//---------------------------------------
AreaForTransferOfIinformation
.cv_array_rondom_number_values_for_each_trial
[ arg_order_number_of_trial - 1 ]
= random_number_in_desired_range ;
//------ decide location x , y for display each mark -------------------------------
int from_x = 50 ;
int to_x = ( int ) ( ContainParameters.cv_width_of_DisplayImage * ( 2.0 / 3.0 ) ) ;
random_number_from_0_to_1 = Math.random ( ) ;
AreaForTransferOfIinformation
.cv_array_figure_set_location_begin_X
[ arg_order_number_of_trial - 1 ]
= from_x +
( int ) ( ( to_x - from_x ) * random_number_from_0_to_1 ) ;
//------------------------------------
int from_y = 50 ;
int to_y = ContainParameters.cv_height_of_DisplayImage / 2 ;
random_number_from_0_to_1 = Math.random ( ) ;
AreaForTransferOfIinformation
.cv_array_figure_set_location_Y
[ arg_order_number_of_trial - 1 ]
= from_y +
( int ) ( ( to_y - from_y ) * random_number_from_0_to_1 ) ;
}
//------------------------------------
public static void do_measurement_process ( ) {
int number_value_for_current_trial ;
for ( AreaForTransferOfIinformation
.cv_current_trial_number = 1
; AreaForTransferOfIinformation
.cv_current_trial_number
<= ContainParameters.cv_max_trial_number
; AreaForTransferOfIinformation
.cv_current_trial_number += 1 ) {
AreaForTransferOfIinformation
.cv_number_value_for_current_trial
= AreaForTransferOfIinformation
.cv_array_rondom_number_values_for_each_trial
[ AreaForTransferOfIinformation
.cv_current_trial_number - 1 ] ;
AreaForTransferOfIinformation.cv_phase_of_display_image = 2 ;
AreaForTransferOfIinformation
.cv_array_display_message [ 1 - 1 ]
= "As soon as possible, perform " ;
AreaForTransferOfIinformation
.cv_array_display_message [ 2 - 1 ]
= " the following sequence of actions," ;
AreaForTransferOfIinformation
.cv_array_display_message [ 3 - 1 ]
= " (1) Recognize the number of rectangles," ;
AreaForTransferOfIinformation
.cv_array_display_message [ 4 - 1 ]
= " (2) And, remember it into your brain," ;
AreaForTransferOfIinformation
.cv_array_display_message [ 5 - 1 ]
= " (3) And, Push [enter] key." ;
cv_ins_DisplayImage.do_repaint ( ) ;
wait_for_push_enter_key_for_tarminate_displaying_image (
AreaForTransferOfIinformation
.cv_current_trial_number ) ;
AreaForTransferOfIinformation.cv_phase_of_display_image = 3 ;
AreaForTransferOfIinformation
.cv_array_display_message [ 1 - 1 ]
= "Write the number ( of rectangles ) " ;
AreaForTransferOfIinformation
.cv_array_display_message [ 2 - 1 ]
= " you just memorized, on a paper," ;
AreaForTransferOfIinformation
.cv_array_display_message [ 3 - 1 ]
= "Next, Push [enter] key." ;
AreaForTransferOfIinformation
.cv_array_display_message [ 4 - 1 ]
= " " ;
AreaForTransferOfIinformation
.cv_array_display_message [ 5 - 1 ]
= " " ;
cv_ins_DisplayImage.do_repaint ( ) ;
//wait_for_push_key_for_starting_next_trial ( ) ;
WaitForPushEnterKey.wait_for_push_enter_key ( ) ;
}
}
//-------------------------------------------------------
private static void wait_for_push_enter_key_for_tarminate_displaying_image
( int arg_current_trial_number ) {
String this_methode_name = "wait_for_push_enter_key_for_tarminate_displaying_image" ;
System.out.println ( "=============================" ) ;
System.out.println ( "Start , Class : " + cv_this_class_name
+ " , Methode : " + this_methode_name ) ;
System.out.println ( "arg_current_trial_number = "
+ arg_current_trial_number ) ;
System.out.println ( "cv_number_value_for_current_trial = "
+ AreaForTransferOfIinformation.cv_number_value_for_current_trial ) ;
System.out.println ( "=============================" ) ;
Calendar ins_calendar_1 = Calendar.getInstance ( ) ;
WaitForPushEnterKey.wait_for_push_enter_key ( ) ;
Calendar ins_calendar_2 = Calendar.getInstance ( ) ;
cv_array_time_second_for_response [ arg_current_trial_number - 1 ]
= culculate_time_for_response (
ins_calendar_1.get ( Calendar.HOUR)
, ins_calendar_1.get ( Calendar.MINUTE )
, ins_calendar_1.get ( Calendar.SECOND )
, ins_calendar_1.get ( Calendar.MILLISECOND )
, ins_calendar_2.get ( Calendar.HOUR)
, ins_calendar_2.get ( Calendar.MINUTE )
, ins_calendar_2.get ( Calendar.SECOND )
, ins_calendar_2.get ( Calendar.MILLISECOND )
) ;
System.out.println ( "**********************************" ) ;
System.out.println ( "Class : " + cv_this_class_name
+ " , Methode : " + this_methode_name ) ;
System.out.println ( "**********************************" ) ;
System.out.println ( "ins_calendar_1 " ) ;
System.out.println ( "Year = " + ins_calendar_1.get ( Calendar.YEAR )
+ "Month = " + ins_calendar_1.get ( Calendar.MONTH )
+ "Date = " + ins_calendar_1.get ( Calendar.DATE)
+ "Hour = " + ins_calendar_1.get ( Calendar.HOUR)
+ "Minute = " + ins_calendar_1.get ( Calendar.MINUTE )
+ "Second = " + ins_calendar_1.get ( Calendar.SECOND )
+ "MilliSecond = " + ins_calendar_1.get ( Calendar.MILLISECOND )
) ;
System.out.println ( "--------------------------------------------" ) ;
System.out.println ( "ins_calendar_2 " ) ;
System.out.println ( "Year = " + ins_calendar_2.get ( Calendar.YEAR )
+ "Month = " + ins_calendar_2.get ( Calendar.MONTH )
+ "Date = " + ins_calendar_2.get ( Calendar.DATE)
+ "Hour = " + ins_calendar_2.get ( Calendar.HOUR)
+ "Minute = " + ins_calendar_2.get ( Calendar.MINUTE )
+ "Second = " + ins_calendar_2.get ( Calendar.SECOND )
+ "MilliSecond= " + ins_calendar_2.get ( Calendar.MILLISECOND )
) ;
System.out.println ( "--------------------------------------------" ) ;
System.out.println ( "cv_array_time_second_for_response [ arg_current_trial_number - 1 ] = "
+ cv_array_time_second_for_response [ arg_current_trial_number - 1 ] ) ;
System.out.println ( "=============================" ) ;
}
//--------------------------------------------------------
private static float culculate_time_for_response (
int arg_1_HOUR
, int arg_1_MINUTE
, int arg_1_SECOND
, int arg_1_MILLISECOND
, int arg_2_HOUR
, int arg_2_MINUTE
, int arg_2_SECOND
, int arg_2_MILLISECOND
) {
String this_methode_name = "culculate_time_for_response" ;
long time_1_minute = arg_1_HOUR * 60 + arg_1_MINUTE ;
long time_1_second = time_1_minute * 60 + arg_1_SECOND ;
long time_1_mili_second = time_1_second * 1000 + arg_1_MILLISECOND ;
long time_2_minute = arg_2_HOUR * 60 + arg_2_MINUTE ;
long time_2_second = time_2_minute * 60 + arg_2_SECOND ;
long time_2_mili_second = time_2_second * 1000 + arg_2_MILLISECOND ;
if ( time_2_mili_second <= time_1_mili_second ) {
System.out.println ( "===== Error !!!!!!!! ========================" ) ;
System.out.println ( " Class : " + cv_this_class_name
+ " , Methode : " + this_methode_name ) ;
System.out.println ( "time_2_mili_second <= time_1_mili_second" ) ;
System.out.println ( "time_1_mili_second = " + time_1_mili_second ) ;
System.out.println ( "arg_1 Hour, Minute, SSECOND, MILLISECOND = "
+ arg_1_HOUR + " , " + arg_1_MINUTE + " , " + arg_1_SECOND
+ " , " + arg_1_MILLISECOND ) ;
System.out.println ( "time_2_mili_second = " + time_2_mili_second ) ;
System.out.println ( "arg_2 Hour, Minute, SSECOND, MILLISECOND = "
+ arg_2_HOUR + " , " + arg_2_MINUTE + " , " + arg_2_SECOND
+ " , " + arg_2_MILLISECOND ) ;
System.out.println ( "=============================" ) ;
WaitForPushEnterKey.wait_for_push_enter_key ( ) ;
}
//--------------------------------------------- ;
long time_1_2_difference_mili_second = time_2_mili_second
- time_1_mili_second ;
float return_value = time_1_2_difference_mili_second / 1000.0f ;
return return_value ;
}
//-------------------------------------------------------------
public static void do_showing_results_process ( ) {
String this_methode_name = "do_showing_results_process" ;
AreaForTransferOfIinformation.cv_phase_of_display_image = 4 ;
AreaForTransferOfIinformation
.cv_array_display_message [ 1 - 1 ]
= "All Trials have been done" ;
AreaForTransferOfIinformation
.cv_array_display_message [ 2 - 1 ]
= " " ;
AreaForTransferOfIinformation
.cv_array_display_message [ 3 - 1 ]
= " " ;
AreaForTransferOfIinformation
.cv_array_display_message [ 4 - 1 ]
= " " ;
AreaForTransferOfIinformation
.cv_array_display_message [ 5 - 1 ]
= " " ;
cv_ins_DisplayImage.do_repaint ( ) ;
//---------------------------------------------------
System.out.println ( "=============================" ) ;
System.out.println ( "Class : " + cv_this_class_name
+ " , Methode : " + this_methode_name ) ;
System.out.println ( "The results of the trial are as follows" ) ;
System.out.println ( "=============================" ) ;
System.out.println ( "current_trial_number"
+ " , " + "rondom_number_values"
+ " , " + "time_second_for_response"
) ;
System.out.println ( "-----------------------------------------------" ) ;
for ( int current_trial_number = 1
; current_trial_number <= ContainParameters.cv_max_trial_number
; current_trial_number += 1 ) {
System.out.println ( current_trial_number
+ " , " + AreaForTransferOfIinformation
.cv_array_rondom_number_values_for_each_trial
[ current_trial_number - 1 ]
+ " , " + cv_array_time_second_for_response
[ current_trial_number - 1 ] ) ;
}
}
}
//==============================================
class AreaForTransferOfIinformation {
public static int cv_number_value_for_current_trial ;
public static int cv_current_trial_number ;
public static int [ ] cv_array_rondom_number_values_for_each_trial ;
public static int [ ] cv_array_figure_set_location_begin_X ;
public static int [ ] cv_array_figure_set_location_Y ;
public static int cv_phase_of_display_image ;
public static String [ ] cv_array_display_message ;
}
//==============================================
class DisplayImage {
private JFrame cv_ins_JFrame ;
private JPanelForDisplay cv_ins_JPaneForDisplay ;
//-------------------------------------------------
// constructer
//-------------------------------------------------
public DisplayImage ( ) {
cv_ins_JFrame = new JFrame ( "Display" ) ;
cv_ins_JFrame
.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE ) ;
cv_ins_JPanelForDisplay = new JPaneForDisplay ( ) ;
cv_ins_JFrame.add ( cv_ins_JPanelForDisplay ) ;
cv_ins_JFrame.pack();
cv_ins_JFrame.setSize (
( ContainParameters.cv_width_of_DisplayImage + 50 )
, ( ContainParameters.cv_height_of_DisplayImage + 100 )
) ;
cv_ins_JFrame.setVisible ( true ) ;
}
//-------------------------------------------------
public void do_repaint ( ) {
cv_ins_JPanelForDisplay
.repaint ( ) ;
}
//---------------------------------------------
}
//===============================
class JPanelForDisplay extends JPanel {
//-----------------------------------
public void paintComponent ( Graphics arg_ins_Graphics ) {
super.paintComponent ( arg_ins_Graphics ) ;
//---------- draw backgound area -------------
Color ins_Color_background = new Color (
ContainParameters.cv_Color_background_R
, ContainParameters.cv_Color_background_G
, ContainParameters.cv_Color_background_B ) ;
arg_ins_Graphics.setColor ( ins_Color_background ) ;
arg_ins_Graphics
.fillRect ( ContainParameters.cv_margin_of_DisplayImage_Frame
, ContainParameters.cv_margin_of_DisplayImage_Frame
, ContainParameters.cv_width_of_DisplayImage
, ContainParameters.cv_height_of_DisplayImage
) ;
//---------- display guide message ----------------------------------------
Color ins_Color_display_text = new Color (
ContainParameters.cv_Color_display_text_R
, ContainParameters.cv_Color_display_text_G
, ContainParameters.cv_Color_display_text_B ) ;
arg_ins_Graphics.setColor ( ins_Color_display_text ) ;
int font_size = ContainParameters.cv_height_of_message_one_line - 4 ;
Font ins_Font = new Font ( "Arial" , Font.PLAIN , font_size ) ;
arg_ins_Graphics.setFont ( ins_Font ) ;
int location_x = ContainParameters.cv_margin_of_DisplayImage_Frame ;
int location_y = 0 ;
for ( int row_of_display_message = 1
; row_of_display_message <=
ContainParameters.cv_number_of_lines_display_text
; row_of_display_message += 1 ) {
location_y = ( ( ContainParameters.cv_height_of_DisplayImage / 3 )
* 2 )
+
( ContainParameters.cv_height_of_message_one_line
* row_of_display_message
)
;
arg_ins_Graphics.drawString (
AreaForTransferOfIinformation
.cv_array_display_message [ row_of_display_message - 1 ]
, location_x , location_y ) ;
}
//----------------- draw marks ---------------
int figure_set_location_X = 0 ;
int figure_set_location_begin_X = 0 ;
int figure_set_location_Y = 0 ;
int interval_X = 0 ;
Color ins_Color_mark = new Color (
ContainParameters.cv_Color_mark_R
, ContainParameters.cv_Color_mark_G
, ContainParameters.cv_Color_mark_B ) ;
if ( AreaForTransferOfIinformation.cv_phase_of_display_image == 2 ) {
figure_set_location_begin_X
= AreaForTransferOfIinformation
.cv_array_figure_set_location_begin_X
[ AreaForTransferOfIinformation
.cv_current_trial_number - 1 ] ;
figure_set_location_Y
= AreaForTransferOfIinformation
.cv_array_figure_set_location_Y
[ AreaForTransferOfIinformation
.cv_current_trial_number - 1 ] ;
interval_X
= ContainParameters.cv_width_of_mark_display_area
/ ( AreaForTransferOfIinformation
.cv_number_value_for_current_trial
+ 1 ) ;
//---------------------------
arg_ins_Graphics.setColor ( ins_Color_mark ) ;
//---------------------------
for ( int order_number_of_mark = 1
; order_number_of_mark
<= AreaForTransferOfIinformation
.cv_number_value_for_current_trial
; order_number_of_mark += 1 ) {
figure_set_location_X = figure_set_location_begin_X
+ interval_X * order_number_of_mark ;
arg_ins_Graphics
.fillRect ( figure_set_location_X
, figure_set_location_Y
, ContainParameters.cv_width_of_mark
, ContainParameters.cv_height_of_mark
) ;
}
}
}
}
//==========================================
class WaitForPushEnterKey {
static String cv_this_class_name = "WaitForPushEnterKey " ;
public static void wait_for_push_enter_key ( ) {
String this_methode_name = "wait_for_push_enter_key" ;
System.out.println ( "=============================" ) ;
System.out.println ( " Class : " + cv_this_class_name
+ " , Methode : " + this_methode_name ) ;
System.out.println ( "************* push [ enter ] key ************" ) ;
System.out.println ( "=============================" ) ;
try {
//wait EntKey Push
char process_continue = 'Y' ;
int get_code = 0 ;
while ( process_continue =='Y' ) {
get_code = System.in.read ( ) ;
if ( get_code == 10 ) {
process_continue = 'N' ;
}
}
}
//------------------------------
catch ( java.io.IOException ex ) {
System.err.println ( "Class = " + cv_this_class_name
+ " , Methode = " + this_methode_name
+ " : IOEception"
) ;
}
//------------------------------
}
}
Cognition of Number, Index, 数に関する認知, インデックス へ