Académique Documents
Professionnel Documents
Culture Documents
Applet;
import java.awt.Frame;
import java.awt.List;
import java.awt.*;
import java.net.*;
import java.util.*;
import java.awt.event.*;
import java.io.*;
//--------------------------------------------------------------------------------
----------------//
// HOW TO COMPILE THIS PROGRAM
//
// copyleft mark b springer 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009
//
// copyleft deacons folly software, 21 deeacons folly road , north harwich , ma. ,
02645 //
// Sun Sep 06 11:42:09 EDT 2009
//
// 1 GO TO http://java.sun.com
//
//
//
// 2 DOWNLOAD THE JDK IT IS FREE TOO
//
//
//
// 3 AFTER YOU INSTALL THE JDK TYPE javac skim_mail_k.java
//
//
//
// this will create skim_mail_k.class
//
//
//
// 4 RUN skim_mail_k.class , TYPE java skim_mail_k
//
//
//
//--------------------------------------------------------------------------------
----------------//
class skim_mail_k
{
//-------------------------------------//
// start extract_equal_slash function //
// give it 1 string //
// and the output appears in the lower //
// window //
//-------------------------------------//
public static void extract_equal_slash( String search_string)
{
int end_of_end = 0 ; int start_of_end = 0 ;
int list_pointer = 0 ; int i_Start_Of_Find = 0 ;
int i_End_Of_Find = 0 ;
String full_sentence = "";
String search_item = "=/" ;
int item_length = search_item.length() ;
int realend = search_string.length() ;
//---------------------------------------//
// end of data //
//---------------------------------------------------------------//
// loop is for number of characters in the item //
//---------------------------------------------------------------//
top:
for (start_of_end= end_of_end ; start_of_end < realend ; start_of_end++ )
{
if ( ( start_of_end+item_length )<= realend ) // enough string left to
check ??
{ // if yes is it a match ??
//-------------------------------//
// start comparison //
//-------------------------------//
if((search_string.substring( start_of_end ,
start_of_end+item_length ) ).equals( search_item ) )
{
//-------------------------------------------//
// remember where you found the start of it //
// plus the beginning =/ //
// WHICH WE DO NOT WANT //
//-------------------------------------------//
i_Start_Of_Find = start_of_end+item_length ;
//-------------------------------//
// no .... //
//-------------------------------//
if(i_Start_Of_Find<realend)
{
while( search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+1 ).equals( "." ) )
++i_Start_Of_Find;
}
//-------------------------------//
// and no slashes , either //
//-------------------------------//
if(i_Start_Of_Find<realend)
{
while( search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+1 ).equals( "/" ) )
++i_Start_Of_Find;
}
//-------------------------------//
// now start looking for the end //
//-------------------------------//
{
i_End_Of_Find = end_of_end ;
int i_length_Of_Input_List =
(skim_mail_k.l_Output_list).countItems();
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+4 )).compareTo("http") != 0
&& (search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).compareTo("www" ) != 0
) full_sentence = skim_mail_k.BASE_URL + "/";
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if ( (i_Start_Of_Find+4)<= realend )
{
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).equals("www") )
full_sentence = "http://";
}
//-------------------------------//
// we must add the find //
//-------------------------------//
full_sentence = full_sentence + search_string.substring( i_Start_Of_Find ,
i_End_Of_Find ) ;
//-------------------------------//
// first find is special case //
//-------------------------------//
if ( i_length_Of_Input_List == 0)
skim_mail_k.l_Output_list.addItem (full_sentence );
//-------------------------------//
// all other cases //
//-------------------------------//
if ( i_length_Of_Input_List > 0)
no_duplicate( full_sentence );
full_sentence = "";
continue top ;
}
}
}
}
}
}
} // END OF => for (y = i_End_Of_Find ;list_pointer< realend ; y++ )
//-------------------------------------//
//end of extract_equal_slash function //
//-------------------------------------//
//-------------------------------------//
// start extract_HREF=" function //
// give it 1 string //
// and the output appears in the lower //
// window //
//-------------------------------------//
{
int end_of_end = 0 ; int start_of_end = 0 ;
int list_pointer = 0 ; int i_Start_Of_Find = 0 ;
int i_End_Of_Find = 0 ;
String full_sentence = "";
String search_item = "HREF=\"" ;
int item_length = search_item.length() ;
int realend = search_string.length() ;
//---------------------------------------//
// end of data //
//---------------------------------------------------------------//
// loop is for number of characters in the item //
//---------------------------------------------------------------//
top:
for (start_of_end= end_of_end ; start_of_end < realend ; start_of_end++ )
{
if ( ( start_of_end+item_length )<= realend ) // enough string left to
check ??
{ // if yes is it a match ??
//-------------------------------//
// start comparison //
//-------------------------------//
if((search_string.substring( start_of_end ,
start_of_end+item_length ) ).equals( search_item ) )
{
//-------------------------------------------//
// remember where you found the start of it //
// plus the beginning HREF=" //
// WHICH WE DO NOT WANT //
//-------------------------------------------//
i_Start_Of_Find = start_of_end+item_length ;
//-------------------------------------------//
// delete previous directory commands //
// ie. ../ //
// WHICH WE DO NOT WANT //
//-------------------------------------------//
while ( (search_string.substring( i_Start_Of_Find , i_Start_Of_Find+1 ) ).equals(
"." ) )
i_Start_Of_Find++ ;
//-------------------------------------------//
// delete previous directory commands //
// ie. ../ //
// WHICH WE DO NOT WANT //
//-------------------------------------------//
while ( (search_string.substring( i_Start_Of_Find , i_Start_Of_Find+1 ) ).equals(
"/" ) )
i_Start_Of_Find++ ;
//----------------------------------------------//
// start loop to look for closing delimiter //
//----------------------------------------------//
for(end_of_end=i_Start_Of_Find; end_of_end<=realend; end_of_end++)//
start looking for the end of it
{
if ( (end_of_end+1)<= realend ) // enough string left to check ??
{
if( (search_string.substring( end_of_end , end_of_end+1 ) ).equals( "\"" )
|| (search_string.substring( end_of_end , end_of_end+1 ) ).equals( " " )
)
{
i_End_Of_Find = end_of_end ;
int i_length_Of_Input_List =
(skim_mail_k.l_Output_list).countItems();
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if ( (i_Start_Of_Find+5)<= realend )
{
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+4 )).compareTo("http") != 0
&& (search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).compareTo("www" ) != 0
) full_sentence = skim_mail_k.BASE_URL + "/";
}
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if ( (i_Start_Of_Find+4)<= realend )
{
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).equals("www") )
full_sentence = "http://";
}
//-------------------------------//
// we must add the find //
//-------------------------------//
full_sentence = full_sentence + search_string.substring( i_Start_Of_Find ,
i_End_Of_Find ) ;
//-------------------------------//
// first find is special case //
//-------------------------------//
if ( i_length_Of_Input_List == 0)
skim_mail_k.l_Output_list.addItem (full_sentence );
//-------------------------------//
// all other cases //
//-------------------------------//
if ( i_length_Of_Input_List > 0)
no_duplicate( full_sentence );
full_sentence = "";
continue top ;
}
}
}
}
}
}
} // END OF => for (y = i_End_Of_Find ;list_pointer< realend ; y++ )
//-------------------------------------//
//end of extract_HREF=" function //
//-------------------------------------//
// start extract_src=" function //
// give it 1 string //
// and the output appears in the lower //
// window //
//-------------------------------------//
{
int end_of_end = 0 ; int start_of_end = 0 ;
int list_pointer = 0 ; int i_Start_Of_Find = 0 ;
int i_End_Of_Find = 0 ;
String full_sentence = "";
String search_item = "src=\"" ;
int item_length = search_item.length() ;
int realend = search_string.length() ;
//---------------------------------------//
// end of data //
//---------------------------------------------------------------//
// loop is for number of characters in the item //
//---------------------------------------------------------------//
top:
for (start_of_end= end_of_end ; start_of_end < realend ; start_of_end++ )
{
if ( ( start_of_end+item_length )<= realend ) // enough string left to
check ??
{ // if yes is it a match ??
//-------------------------------//
// start comparison //
//-------------------------------//
if((search_string.substring( start_of_end ,
start_of_end+item_length ) ).equals( search_item ) )
{
//-------------------------------------------//
// remember where you found the start of it //
// plus the beginning HREF=" //
// WHICH WE DO NOT WANT //
//-------------------------------------------//
i_Start_Of_Find = start_of_end+item_length ;
//-------------------------------------------//
// delete previous directory commands //
// ie. ../ //
// WHICH WE DO NOT WANT //
//-------------------------------------------//
while ( (search_string.substring( i_Start_Of_Find , i_Start_Of_Find+1 ) ).equals(
"." ) )
i_Start_Of_Find++ ;
//-------------------------------------------//
// delete previous directory commands //
// ie. ../ //
// WHICH WE DO NOT WANT //
//-------------------------------------------//
while ( (search_string.substring( i_Start_Of_Find , i_Start_Of_Find+1 ) ).equals(
"/" ) )
i_Start_Of_Find++ ;
//----------------------------------------------//
// start loop to look for closing delimiter //
//----------------------------------------------//
for(end_of_end=i_Start_Of_Find; end_of_end<=realend; end_of_end++)//
start looking for the end of it
{
if ( (end_of_end+1)<= realend ) // enough string left to check ??
{
if( (search_string.substring( end_of_end , end_of_end+1 ) ).equals( "\"" )
|| (search_string.substring( end_of_end , end_of_end+1 ) ).equals( " " )
)
{
i_End_Of_Find = end_of_end ;
int i_length_Of_Input_List =
(skim_mail_k.l_Output_list).countItems();
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if ( (i_Start_Of_Find+5)<= realend )
{
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+4 )).compareTo("http") != 0
&& (search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).compareTo("www" ) != 0
) full_sentence = skim_mail_k.BASE_URL + "/";
}
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if ( (i_Start_Of_Find+4)<= realend )
{
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).equals("www") )
full_sentence = "http://";
}
//-------------------------------//
// we must add the find //
//-------------------------------//
full_sentence = full_sentence + search_string.substring( i_Start_Of_Find ,
i_End_Of_Find ) ;
//-------------------------------//
// first find is special case //
//-------------------------------//
if ( i_length_Of_Input_List == 0)
skim_mail_k.l_Output_list.addItem (full_sentence );
//-------------------------------//
// all other cases //
//-------------------------------//
if ( i_length_Of_Input_List > 0)
no_duplicate( full_sentence );
full_sentence = "";
continue top ;
}
}
}
}
}
}
} // END OF => for (y = i_End_Of_Find ;list_pointer< realend ; y++ )
//-------------------------------------//
//end of extract_src=" function //
//-------------------------------------//
//-------------------------------------//
// start extract_href function //
// give it 1 string //
// and the output appears in the lower //
// window //
//-------------------------------------//
public static void extract_href( String search_string)
{
int end_of_end = 0 ; int start_of_end = 0 ;
int list_pointer = 0 ; int i_Start_Of_Find = 0 ;
int i_End_Of_Find = 0 ;
String full_sentence = "";
String search_item = "href=\"" ;
int item_length = search_item.length() ;
int realend = search_string.length() ;
//---------------------------------------//
// end of data //
//---------------------------------------------------------------//
// loop is for number of characters in the item //
//---------------------------------------------------------------//
top:
for (start_of_end= end_of_end ; start_of_end < realend ; start_of_end++ )
{
if ( ( start_of_end+item_length )<= realend ) // enough string left to
check ??
{ // if yes is it a match ??
//-------------------------------//
// start comparison //
//-------------------------------//
if((search_string.substring( start_of_end ,
start_of_end+item_length ) ).equals( search_item ) )
{
//-------------------------------------------//
// remember where you found the start of it //
// plus the beginning HREF=" //
// WHICH WE DO NOT WANT //
//-------------------------------------------//
i_Start_Of_Find = start_of_end+item_length ;
//-------------------------------------------//
// delete previous directory commands //
// ie. ../ //
// WHICH WE DO NOT WANT //
//-------------------------------------------//
while ( (search_string.substring( i_Start_Of_Find , i_Start_Of_Find+1 ) ).equals(
"." ) )
i_Start_Of_Find++ ;
//-------------------------------------------//
// delete previous directory commands //
// ie. ../ //
// WHICH WE DO NOT WANT //
//-------------------------------------------//
while ( (search_string.substring( i_Start_Of_Find , i_Start_Of_Find+1 ) ).equals(
"/" ) )
i_Start_Of_Find++ ;
//----------------------------------------------//
// start loop to look for closing delimiter //
//----------------------------------------------//
for(end_of_end=i_Start_Of_Find; end_of_end<=realend; end_of_end++)//
start looking for the end of it
{
if ( (end_of_end+1)<= realend ) // enough string left to check ??
{
if( (search_string.substring( end_of_end , end_of_end+1 ) ).equals( "\"" )
|| (search_string.substring( end_of_end , end_of_end+1 ) ).equals( " " )
)
{
i_End_Of_Find = end_of_end ;
int i_length_Of_Input_List =
(skim_mail_k.l_Output_list).countItems();
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if ( (i_Start_Of_Find+4)<= realend )
{
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+4 )).compareTo("http") != 0
&& (search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).compareTo("www" ) != 0
) full_sentence = skim_mail_k.BASE_URL + "/";
}
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if ( (i_Start_Of_Find+4)<= realend )
{
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).equals("www") )
full_sentence = "http://";
}
//-------------------------------//
// we must add the find //
//-------------------------------//
full_sentence = full_sentence + search_string.substring( i_Start_Of_Find ,
i_End_Of_Find ) ;
//-------------------------------//
// first find is special case //
//-------------------------------//
if ( i_length_Of_Input_List == 0)
skim_mail_k.l_Output_list.addItem (full_sentence );
//-------------------------------//
// all other cases //
//-------------------------------//
if ( i_length_Of_Input_List > 0)
no_duplicate( full_sentence );
full_sentence = "";
continue top ;
}
}
}
}
}
}
} // END OF => for (y = i_End_Of_Find ;list_pointer< realend ; y++ )
//-------------------------------------//
//end of extract_HREF=" function //
//-------------------------------------//
//--------------------------------------------//
// start extract_equal_quote_slash function //
// give it 1 string //
// and the output appears in the lower //
// window //
//--------------------------------------------//
public static void extract_equal_quote_slash( String search_string)
{
int end_of_end = 0 ; int start_of_end = 0 ;
int list_pointer = 0 ; int i_Start_Of_Find = 0 ;
int i_End_Of_Find = 0 ;
String full_sentence = "";
String search_item = "=\"/" ;
int item_length = search_item.length() ;
int realend = search_string.length() ;
//---------------------------------------//
// end of data //
//---------------------------------------------------------------//
// loop is for number of characters in the item //
//---------------------------------------------------------------//
top:
for (start_of_end= end_of_end ; start_of_end < realend ; start_of_end++ )
{
if ( ( start_of_end+item_length )<= realend ) // enough string left to
check ??
{ // if yes is it a match ??
//-------------------------------//
// start comparison //
//-------------------------------//
if((search_string.substring( start_of_end ,
start_of_end+item_length ) ).equals( search_item ) )
{
//-------------------------------------------//
// remember where you found the start of it //
// plus the beginning HREF=" //
// WHICH WE DO NOT WANT //
//-------------------------------------------//
i_Start_Of_Find = start_of_end+item_length ;
//-------------------------------//
// no ../ //
//-------------------------------//
if(i_Start_Of_Find<realend)
{
while( search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+1 ).equals( "." ) )
++i_Start_Of_Find;
}
//-------------------------------//
// and no slashes , either //
//-------------------------------//
if(i_Start_Of_Find<realend)
{
while( search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+1 ).equals( "/" ) )
++i_Start_Of_Find;
}
//-------------------------------//
// now start looking for the end //
//-------------------------------//
for(end_of_end=i_Start_Of_Find; end_of_end<=realend; end_of_end++)//
start looking for the end of it
{
if ( (end_of_end+5)<= realend ) // enough string left to check ??
{
if( (search_string.substring( end_of_end , end_of_end+1 ) ).equals( "\"" )
|| (search_string.substring( end_of_end , end_of_end+1 ) ).equals( " " )
)
{
i_End_Of_Find = end_of_end ;
int i_length_Of_Input_List =
(skim_mail_k.l_Output_list).countItems();
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if ( (i_Start_Of_Find+5)<= realend )
{
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+4 )).compareTo("http") != 0
&& (search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).compareTo("www" ) != 0
) full_sentence = skim_mail_k.BASE_URL + "/";
}
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if ( (i_Start_Of_Find+4)<= realend )
{
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).equals("www") )
full_sentence = "http://";
}
//-------------------------------//
// we must add the find //
//-------------------------------//
full_sentence = full_sentence + search_string.substring( i_Start_Of_Find ,
i_End_Of_Find ) ;
//-------------------------------//
// first find is special case //
//-------------------------------//
if ( i_length_Of_Input_List == 0)
skim_mail_k.l_Output_list.addItem (full_sentence );
//-------------------------------//
// all other cases //
//-------------------------------//
if ( i_length_Of_Input_List > 0)
no_duplicate( full_sentence );
full_sentence = "";
continue top ;
}
}
}
}
}
}
} // END OF => for (y = i_End_Of_Find ;list_pointer< realend ; y++ )
//-------------------------------------------//
//end of extract_equal_quote_slash function //
//-------------------------------------------//
//-------------------------------------//
// start extract_http function //
// //
// give it 1 string //
// and the output appears in the lower //
// window //
//-------------------------------------//
{
int end_of_end = 0 ; int start_of_end = 0 ;
int list_pointer = 0 ; int i_Start_Of_Find = 0 ;
int i_End_Of_Find = 0 ;
//-------------------------------//
// cut off trailing slash //
//-------------------------------//
if( (search_string.substring( end_of_end-1 , end_of_end ) ).equals( "/" ) )
i_End_Of_Find-- ;
//-------------------------------//
// first find is special case //
//-------------------------------//
if ( i_length_Of_Input_List == 0)
skim_mail_k.l_Output_list.addItem ( search_string.substring( i_Start_Of_Find ,
i_End_Of_Find ));
//-------------------------------//
// all other cases //
//-------------------------------//
if ( i_length_Of_Input_List > 0)
no_duplicate( search_string.substring( i_Start_Of_Find , i_End_Of_Find
) );
//-------------------------------------//
// end of extract http function //
//-------------------------------------//
//-------------------------------------//
// start extract_www. function //
// give it 1 string //
// and the output appears in the lower //
// window //
//-------------------------------------//
{
int end_of_end = 0 ; int start_of_end = 0 ;
int list_pointer = 0 ; int i_Start_Of_Find = 0 ;
int i_End_Of_Find = 0 ;
String full_sentence = "";
String search_item = "www." ;
int item_length = search_item.length() ;
int realend = search_string.length() ;
//---------------------------------------//
// end of data //
//---------------------------------------------------------------//
// loop is for number of characters in the item //
//---------------------------------------------------------------//
top:
for (start_of_end= end_of_end ; start_of_end < realend ; start_of_end++ )
{
if ( ( start_of_end+item_length )<= realend ) // enough string left to
check ??
{ // if yes is it a match ??
//-------------------------------//
// start comparison //
//-------------------------------//
{
i_End_Of_Find = end_of_end ;
int i_length_Of_Input_List =
(skim_mail_k.l_Output_list).countItems();
//-------------------------------//
// cut off trailing slash //
//-------------------------------//
if( (search_string.substring( end_of_end-1 , end_of_end ) ).equals( "/" ) )
i_End_Of_Find-- ;
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if ( (i_Start_Of_Find+5)<= realend )
{
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+4 )).compareTo("http") != 0
&& (search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).compareTo("www" ) != 0
) full_sentence = skim_mail_k.BASE_URL + "/";
}
//-------------------------------//
// we must prefix the PARENT URL //
// only if a relative URL //
//-------------------------------//
if ( (i_Start_Of_Find+4)<= realend )
{
if((search_string.substring( i_Start_Of_Find ,
i_Start_Of_Find+3 )).equals("www") )
full_sentence = "http://";
}
//-------------------------------//
// we must add the find //
//-------------------------------//
full_sentence = full_sentence + search_string.substring( i_Start_Of_Find ,
i_End_Of_Find ) ;
//-------------------------------//
// first find is special case //
//-------------------------------//
if ( i_length_Of_Input_List == 0)
skim_mail_k.l_Output_list.addItem (full_sentence );
//-------------------------------//
// all other cases //
//-------------------------------//
if ( i_length_Of_Input_List > 0)
no_duplicate( full_sentence );
full_sentence = "";
continue top ;
}
}
}
}
}
}
} // END OF => for (y = i_End_Of_Find ;list_pointer< realend ; y++ )
//-------------------------------------//
// end of extract www. function //
//-------------------------------------//
//-------------------------------------//
// start extract_mailto function //
// give it 1 string //
// and the output appears in the lower //
// window //
//-------------------------------------//
{
int end_of_end = 0 ; int start_of_end = 0 ;
int list_pointer = 0 ; int i_Start_Of_Find = 0 ;
int i_End_Of_Find = 0 ;
{
i_End_Of_Find = end_of_end ;
int i_length_Of_Input_List =
(skim_mail_k.l_Upper_Window).countItems();
//-------------------------------//
// cut off trailing slash //
//-------------------------------//
if( (search_string.substring( end_of_end-1 , end_of_end ) ).equals( "/" ) )
i_End_Of_Find-- ;
//-------------------------------//
// first find is special case //
//-------------------------------//
if ( i_length_Of_Input_List == 0)
{
//-------------------------------//
// all other cases //
//-------------------------------//
if ( i_length_Of_Input_List > 0)
no_duplicate_mail( search_string.substring( i_Start_Of_Find ,
i_End_Of_Find ) );
continue top ;
}
}
}
}
}
}
} // END OF => for (y = i_End_Of_Find ;list_pointer< realend ; y++ )
//-------------------------------------//
// end of extract mailto function //
//-------------------------------------//
// start extract function //
// //
//-------------------------------------//
{
int depth = 0 ;
int i_length_Of_Input_List = 0;
int line_pointer= 0 ;
int i_length_Of_Output_List = 0 ;
int line_counter = 0 ;
skim_mail_k.geturl();
// t1.start();
//---------------------------------------//
// first get number of lines //
// in the file //
//---------------------------------------//
i_length_Of_Input_List = (skim_mail_k.l_Input_File_List).countItems();
//---------------------------------------//
// set up a loop to process each line //
//---------------------------------------//
for (line_pointer= 0 ;line_pointer < i_length_Of_Input_List; line_pointer++ )
{
//---------------------------------------//
// start getting lines from file //
//---------------------------------------//
String tmp = skim_mail_k.l_Input_File_List.getItem(line_pointer);
skim_mail_k.extract_www( tmp ) ;
skim_mail_k.extract_equal_slash( tmp ) ;
skim_mail_k.extract_equal_quote_slash( tmp );
skim_mail_k.extract_http( tmp );
skim_mail_k.extract_src( tmp );
skim_mail_k.extract_HREF( tmp );
skim_mail_k.extract_href( tmp );
}
//-------------------------------------//
// depth //
//-------------------------------------//
line_counter = 0 ;
//--------------------------------------------//
// update number of URL's beingSearched //
//--------------------------------------------//
(skim_mail_k.counter_field).setText( "getting link " + eachurl ) ;
skim_mail_k.geturl();
// t1.start();
//--------------------------------------------//
// update number of URL's beingSearched //
//--------------------------------------------//
address = "searching link " + eachurl ;
(skim_mail_k.counter_field).setText( address ) ;
//---------------------------------------//
// first get number of lines //
// in the file //
//---------------------------------------//
i_length_Of_Input_List = (skim_mail_k.l_Input_File_List).countItems();
//---------------------------------------//
// set up a loop to process each line //
// in the first URL !!!!!!!!!!!! //
//---------------------------------------//
//--------------------------------------------------------------//
// check for mail while we are here //
//--------------------------------------------------------------//
skim_mail_k.extract_mailto( tmp ) ;
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_www( tmp ) ;
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_equal_slash( tmp ) ;
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_equal_quote_slash( tmp );
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_http( tmp );
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_HREF( tmp );
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_href( tmp );
}
line_counter = new_end ;
new_end = (skim_mail_k.l_Output_list).countItems() ;
//--------------------------------------------//
// update number of URL's beingSearched //
//--------------------------------------------//
address = "searching link " + line_counter ;
(skim_mail_k.counter_field).setText( address ) ;
//---------------------------------------//
// report //
//---------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() > (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
(skim_mail_k.counter_field).setText( "Done getting links" ) ;
//-------------------------------------//
// end of extract function //
//-------------------------------------//
//--------------------------------------------//
// start of check for duplicate function //
//--------------------------------------------//
{
int string_size = line_To_Check.length();
//-----------------------------------------------//
// now check the URL aginst all //
// previous URL's to prevent duplication //
//-----------------------------------------------//
//top:
for (int list_pointer=0 ; list_pointer < i_length_Of_Input_List ; list_pointer++ )
{
string_size = line_To_Check.length();
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( string_size > 1)
{
if( (line_To_Check.substring((string_size-1),string_size)).equals(",") )
line_To_Check= line_To_Check.substring( 0 , (string_size-1) ) ;
string_size = line_To_Check.length();
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( string_size > 1)
{
if( (line_To_Check.substring((string_size-1),string_size)).equals("'") )
line_To_Check= line_To_Check.substring( 0 , (string_size-1) ) ;
string_size = line_To_Check.length();
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( string_size > 1)
{
if( (line_To_Check.substring((string_size-1),string_size)).equals("<") )
line_To_Check= line_To_Check.substring( 0 , (string_size-1) ) ;
string_size = line_To_Check.length();
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( string_size > 5)
{
if( (line_To_Check.substring((string_size-5),string_size)).equals("sprev") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( string_size > 4)
{
if( (line_To_Check.substring((string_size-4),string_size)).equals("prev") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( string_size > 4)
{
if( (line_To_Check.substring((string_size-4),string_size)).equals("next") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( string_size > 5)
{
if( (line_To_Check.substring((string_size-5),string_size)).equals("next5") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( string_size > 4)
{
if( (line_To_Check.substring((string_size-4),string_size)).equals("skip") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( string_size > 1)
{
if( (line_To_Check.substring((string_size-1),string_size)).equals(".") )
line_To_Check= line_To_Check.substring( 0 , (string_size-1) ) ;
string_size = line_To_Check.length();
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( string_size < 21 ) copy = true ;
//if( string_size > 95 ) copy = true ;
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("gif") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("mid") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 1)
{
if( (line_To_Check.substring( (string_size-1),string_size)).equals("(") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("dll") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 30)
{
if((line_To_Check.substring( 0 ,
30 )).equals("http://www.siliconinvestor.com") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 29)
{
if((line_To_Check.substring( 0 , 29 )).equals("http://redirect.click2net.com") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 34)
{
if( (line_To_Check.substring( 0 ,
34 )).equals("http://search3.go2net.com/crawler?") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 40)
{
if( (line_To_Check.substring( 0 , 40 )).equals("http://1travel.flifo.com/ae/cgi-
programs") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 30)
{
if( (line_To_Check.substring( 0 ,
30 )).equals("http://mc1.go2net.com/crawler?") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 21)
{
if( (line_To_Check.substring( 0 , 21 )).equals("http://www.uk.bol.com") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 21)
{
if( (line_To_Check.substring( 0 , 21 )).equals("http://www.go2net.com") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 28)
{
if( (line_To_Check.substring( 0 , 28 )).equals("http://info.netscape.com/fwd") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 30)
{
if( (line_To_Check.substring( 0 , 30 )).equals("http://cgi.weather.com/cgi-
bin") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 9)
{
if( (line_To_Check.substring( 0 , 7 )).compareTo("http://") != 0 )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("css") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 15)
{
if( (line_To_Check.substring( 0 , 15 )).equals("http://adcenter") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 14)
{
if( (line_To_Check.substring( 0 , 14 )).equals("http://clicks.") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 21)
{
if( (line_To_Check.substring( 0 , 21 )).equals("http://www.webmarket.") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 30)
{
if( (line_To_Check.substring( 0 ,
30 )).equals("http://www.zone.com/asp/script") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 16)
{
if( (line_To_Check.substring( 0 , 16 )).equals("http://adserver.") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 15)
{
if( (line_To_Check.substring( 0 , 15 )).equals("http://adfinity") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 18)
{
if( (line_To_Check.substring( 0 , 18 )).equals("http://www.mp3.com") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 14)
{
if( (line_To_Check.substring( 0 , 14 )).equals("http://adforce") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 30)
{
if( (line_To_Check.substring( 0 ,
30 )).equals("http://leader.linkexchange.com") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 25)
{
if( (line_To_Check.substring( 0 , 25 )).equals("http://ad.doubleclick.net") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 13)
{
if( (line_To_Check.substring( 0 , 13 )).equals("http://click.") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 21)
{
if( (line_To_Check.substring( 0 , 21 )).equals("http://ad.preferences") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 21)
{
if( (line_To_Check.substring( 0 , 21 )).equals("http://www.stocksite.") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 10)
{
if( (line_To_Check.substring( 0 , 10 )).equals("http://ad0") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("jpg") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("JPG") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("jpe") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("wav") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 4)
{
if( (line_To_Check.substring( (string_size-4),string_size)).equals("aiff") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("GIF") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("asp") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("exe") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("pdf") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("mov") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 2)
{
if( (line_To_Check.substring( (string_size-2),string_size)).equals("au") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 2)
{
if( (line_To_Check.substring( (string_size-2),string_size)).equals("rm") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 2)
{
if( (line_To_Check.substring( (string_size-2),string_size)).equals("ra") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("dtd") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("ent") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 4)
{
if( (line_To_Check.substring( (string_size-4),string_size)).equals("rdct") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 4)
{
if( (line_To_Check.substring( (string_size-4),string_size)).equals("icon") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 4)
{
if( (line_To_Check.substring( (string_size-4),string_size)).equals("logo") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 4)
{
if( (line_To_Check.substring( (string_size-4),string_size)).equals("jpeg") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 3)
{
if( (line_To_Check.substring( (string_size-3),string_size)).equals("dci") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
//if(string_size > 3)
//{
//if( (line_To_Check.substring( (string_size-3),string_size)).equals("cgi") == 0 )
// copy = true ;
//}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 1)
{
if( (line_To_Check.substring( (string_size-1),string_size)).equals("=") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 1)
{
if( (line_To_Check.substring( (string_size-1),string_size)).equals(";") )
copy = true ;
}
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if(string_size > 1)
{
if( (line_To_Check.substring((string_size-1),string_size)).equals("/") )
line_To_Check= line_To_Check.substring( 0 , (string_size-1) ) ;
//---------------------------------------------------//
// check for duplicate entry //
// //
//---------------------------------------------------//
if( (line_To_Check).equals(s_Input_List[ list_pointer ]) )
{ copy = true ; continue ; }
}
if ( copy == false )
skim_mail_k.l_Output_list.addItem ( line_To_Check ) ;
//---------------------------------------//
// update counter //
//---------------------------------------//
String update = "" + ( i_length_Of_Input_List ) ;
skim_mail_k.links_found.setText( update );
}
//--------------------------------------------//
// END of check for duplicate function //
//--------------------------------------------//
//---------------------------------------------//
// start of check for duplicate mail function //
//---------------------------------------------//
{
String[] s_Input_List ;//used as => (xray3.l_Screen_List).getItems();
s_Input_List = (skim_mail_k.l_Upper_Window).getItems();
int i_length_Of_Upper_Window = (skim_mail_k.l_Upper_Window).countItems();
boolean copy = false ;
//-----------------------------------------------//
// now check the URL aginst all //
// previous URL's to prevent duplication //
//-----------------------------------------------//
//---------------------------------------------------//
// check for illegal ends and types //
// //
//---------------------------------------------------//
if( line_To_Check.length() < 9) copy = true ;
for (int list_pointer=0 ; list_pointer < i_length_Of_Upper_Window ; list_pointer++
)
{ if( (line_To_Check).equals(s_Input_List[ list_pointer ]) )
copy = true ; continue ;//top;
}
if ( copy == false )
{
skim_mail_k.l_Upper_Window.addItem ( line_To_Check ) ;
//---------------------------------------//
// update counter //
//---------------------------------------//
String update = "" + (++skim_mail_k.emails ) ;
skim_mail_k.emails_found.setText( update );
}
//------------------------------------------------//
// END of check for duplicate email function //
//------------------------------------------------//
//-------------------------------------//
// start of geturlmail function //
//-------------------------------------//
try
{
url = new URL (tmpurl);
isIn = url.openStream ();
//--------------------------------------------//
// clean list of previous contents //
//--------------------------------------------//
skim_mail_k.l_Mail_Html_List.removeAll() ;
}
}
}
catch (Exception e)
{
}
}
//-------------------------------------//
// end of geturlmail function //
//-------------------------------------//
// start of get url function //
//-------------------------------------//
//--------------------------------------------//
// //
// now determine the base url //
//--------------------------------------------//
int url_length= tmpurl.length();
int here = 0 ;
try
{
url = new URL (tmpurl);
isIn = url.openStream ();
//--------------------------------------------//
// clean list of previous contents //
//--------------------------------------------//
skim_mail_k.l_Input_File_List.removeAll() ;
while ((iChar = isIn.read ()) != -1)
{
iCount++;
c = (char)( iChar );
{ skim_mail_k.l_Input_File_List.addItem( tmp);
tmp="";
}
}
}
catch (Exception e)
{
}
}
//-------------------------------------//
// end of get url function //
//-----------------------------------------------------------//
// define GLOBALS //
//-----------------------------------------------------------//
public static int MINIMUM_LINKS = 0 ;
public static List l_Input_File_List ;
public static List l_Upper_Window ;
public static List l_Output_list ;
public static List l_Mail_Html_List ;
public static List l_Lower_Window ;
public static TextField location_bar ;
public static TextField counter_field ;
public static String BASE_URL="" ;
//-----------------------------------------------------------//
// define GLOBAL text fields for user input and progress //
//-----------------------------------------------------------//
//-----------------------------------------------------------//
// END OF GLOBALS DEFINITION //
//-----------------------------------------------------------//
MyFrame mf;
//-----------------------------------------------------------//
// define labels for textfields under buttons //
//-----------------------------------------------------------//
Label lab_05 = new Label("links to find " , Label.RIGHT) ;
Label lab_06 = new Label("links " , Label.RIGHT) ;
Label lab_07 = new Label("emails " , Label.RIGHT) ;
Label lab_08 = new Label("topic " , Label.RIGHT) ;
//-----------------------------------------------------------//
// define labels //
// AND PROGRAM TITLE BAR //
//-----------------------------------------------------------//
Label lab_01 = new Label("") ;
Label lab_02 = new Label("") ;
Label lab_03 = new Label("") ;
Label lab_04 ;//= new Label("Extractor") ;
lab_01.setBackground( Color.lightGray) ;
lab_02.setBackground( Color.lightGray) ;
lab_03.setBackground( Color.lightGray) ;
lab_04 = new Label(" Skim mail(k) ") ;
lab_04.setFont( new Font ("TimesRoman" , Font.PLAIN , 25 ));
//-----------------------------------------------------------//
// //
// give the new frame a size mf.resize (600, 300); //
//-----------------------------------------------------------//
mf.resize (600, 450);
//------------------------------------------------------------------//
// declare the buttons //
// //
//Button button_01 , button_02 , button_03 , button_04 , button_05; //
//------------------------------------------------------------------//
Button button_01 , button_02 , button_03 , button_04 , button_05 ,
button_06;
Button button_07 , button_08 , button_09 , button_10 , button_11 ,
button_12;
//-----------------------------------------------------------//
// declare the outer most panel //
//-----------------------------------------------------------//
Panel p_Full_Screen = new Panel ();
//-----------------------------------------------------------//
// declare the outer most panel characteristics //
//-----------------------------------------------------------//
p_Full_Screen.setBackground( Color.lightGray) ;
p_Full_Screen.setFont( new Font ("TimesRoman" , Font.PLAIN , 15 ));
//------------------------------------------------------------//
// the outer most layout manager is border layout //
// north gets split horizontally for buttons and location bar //
// and padding //
//------------------------------------------------------------//
Panel p_Split_North = new Panel ();
//-----------------------------------------------------------//
// the uppermost horizontal split is split again //
// for five buttons //
// //
//-----------------------------------------------------------//
Panel p_Split_Top_North = new Panel ();
//-----------------------------------------------------------//
// the center of the outer most layout manager is //
// split into 2 horizontal pieces for l_Upper_Win //
// and l_Lower_Win //
//-----------------------------------------------------------//
Panel p_Split_Center = new Panel ();
//-----------------------------------------------------------//
// create the outer most panel //
//-----------------------------------------------------------//
p_Full_Screen.setLayout( new BorderLayout( 5 , 5 )) ;
//-----------------------------------------------------------//
// create the grid that splits north in 3 //
// as in north , center , south //
//-----------------------------------------------------------//
p_Split_North.setLayout( new BorderLayout( 5 , 5 )) ;
//-----------------------------------------------------------//
// create the grid that splits the top of the last grid //
// into eight horizontal pieces for the 8 buttons //
// and 4 textfields for data and four labels //
//-----------------------------------------------------------//
p_Split_Top_North.setLayout( new GridLayout( 2, 8 , 5 , 5 )) ;
//--------------------------------------------------------------------------//
// create the grid that splits the center of the outer most //
// layout manager into 2 horizontal pieces for l_Upper_Win //
//
// and l_Lower_Win //
//--------------------------------------------------------------------------//
p_Split_Center.setLayout( new GridLayout( 2 , 1 , 5 , 5 )) ;
//-----------------------------------------------------------//
// add the first button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( button_01 = new Button( "Extract URL" ) ) ;
//-----------------------------------------------------------//
// add the first button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( button_07 = new Button( "Extract topic" ) ) ;
//-----------------------------------------------------------//
// add the second button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( button_02 = new Button( "pause" ) ) ;
//-----------------------------------------------------------//
// add the third button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( button_03 = new Button( "resume") ) ;
//-----------------------------------------------------------//
// add the fourth button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( button_04 = new Button( "Help" ) ) ;
//-----------------------------------------------------------//
// add the fifth button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( button_05 = new Button( "Exit") ) ;
//-----------------------------------------------------------//
// add the sixth button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( button_05 = new Button( "About" ) ) ;
//-----------------------------------------------------------//
// add the sixth button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( button_08 = new Button( "" ) ) ;
//-----------------------------------------------------------//
// now we do the text boxes and labels //
//-----------------------------------------------------------//
//-----------------------------------------------------------//
// add the first labe. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( lab_05 ) ;
//-----------------------------------------------------------//
// add the second button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( skim_mail_k.link_limit ) ;
//-----------------------------------------------------------//
// add the first labe. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( lab_08 ) ;
//-----------------------------------------------------------//
// add the second button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( skim_mail_k.topic ) ;
//-----------------------------------------------------------//
// add the third button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( lab_06 ) ;
//-----------------------------------------------------------//
// add the fourth button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( skim_mail_k.links_found ) ;
//-----------------------------------------------------------//
// add the fifth button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( lab_07 ) ;
//-----------------------------------------------------------//
// add the sixth button. grids load left to right //
// top to bottom //
//-----------------------------------------------------------//
p_Split_Top_North.add( skim_mail_k.emails_found ) ;
//-----------------------------------------------------------//
// add the title bar to the uppermost panel //
// in the second border layout //
//-----------------------------------------------------------//
p_Split_North.add("North" ,lab_04 );
//-----------------------------------------------------------//
// add the buttons to the "center" panel of the second //
// border layout manager which subdivides //
// "North" in the outermost layout manager //
//-----------------------------------------------------------//
p_Split_North.add( "Center" ,p_Split_Top_North);
//-----------------------------------------------------------//
// add the location bar to lower split //
//-----------------------------------------------------------//
p_Split_North.add( "South" ,location_bar);
//-----------------------------------------------------------//
// add just filled grid to north in p_Full_Screen //
//-----------------------------------------------------------//
p_Full_Screen.add ("North", p_Split_North);
//-----------------------------------------------------------//
// add lists to p_Split_Center //
//-----------------------------------------------------------//
// p_Split_Center.add( l_Upper_Window ) ;
p_Split_Center.add( OUTPUT_AREA ) ;
//-----------------------------------------------------------//
// the following line makes the URL's invisible //
// by inserting an unused list into the layout manager //
//-----------------------------------------------------------//
// p_Split_Center.add( l_Lower_Window ) ;
//-----------------------------------------------------------//
// the following line makes the URL's visible //
// by inserting the output list into the layout manager //
//-----------------------------------------------------------//
p_Split_Center.add( l_Output_list ) ;
//-----------------------------------------------------------------//
// add just filled p_Split_Center to north in p_Full_Screen //
//-----------------------------------------------------------------//
p_Full_Screen.add ("Center", p_Split_Center);
//-----------------------------------------------------------//
// add labels to east , west and south in p_Full_Screen //
//-----------------------------------------------------------//
p_Full_Screen.add ("East" , lab_01);
p_Full_Screen.add ("West" , lab_02);
p_Full_Screen.add ("South", counter_field);
//-----------------------------------------------------------//
// add just filled p_Full_Screen to mf //
//-----------------------------------------------------------//
mf.add ( p_Full_Screen);
//-----------------------------------------------------------//
// show the frame //
//-----------------------------------------------------------//
mf.show ();
}
}
//-----------------------------------------------------------//
// END OF MAIN //
//-----------------------------------------------------------//
//-------------------------------------//
// start extract function //
// //
//-------------------------------------//
{
int depth = 0 ;
int i_length_Of_Input_List = 0;
int line_pointer= 0 ;
int i_length_Of_Output_List = 0 ;
int line_counter = 0 ;
skim_mail_k.geturl();
// t1.start();
//---------------------------------------//
// first get number of lines //
// in the file //
//---------------------------------------//
i_length_Of_Input_List = (skim_mail_k.l_Input_File_List).countItems();
//---------------------------------------//
// set up a loop to process each line //
//---------------------------------------//
for (line_pointer= 0 ;line_pointer < i_length_Of_Input_List; line_pointer++ )
{
//---------------------------------------//
// start getting lines from file //
//---------------------------------------//
String tmp = skim_mail_k.l_Input_File_List.getItem(line_pointer);
skim_mail_k.extract_www( tmp ) ;
skim_mail_k.extract_equal_slash( tmp ) ;
skim_mail_k.extract_equal_quote_slash( tmp );
skim_mail_k.extract_http( tmp );
skim_mail_k.extract_HREF( tmp );
skim_mail_k.extract_href( tmp );
}
//-------------------------------------//
// depth //
//-------------------------------------//
line_counter = 0 ;
//--------------------------------------------//
// update number of URL's beingSearched //
//--------------------------------------------//
(skim_mail_k.counter_field).setText( "getting link " + eachurl ) ;
skim_mail_k.geturl();
// t1.start();
//--------------------------------------------//
// update number of URL's beingSearched //
//--------------------------------------------//
address = "searching link " + eachurl ;
(skim_mail_k.counter_field).setText( address ) ;
//---------------------------------------//
// first get number of lines //
// in the file //
//---------------------------------------//
i_length_Of_Input_List = (skim_mail_k.l_Input_File_List).countItems();
//---------------------------------------//
// set up a loop to process each line //
// in the first URL !!!!!!!!!!!! //
//---------------------------------------//
//--------------------------------------------------------------//
// check for mail while we are here //
//--------------------------------------------------------------//
skim_mail_k.extract_mailto( tmp ) ;
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_www( tmp ) ;
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_equal_slash( tmp ) ;
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_equal_quote_slash( tmp );
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_http( tmp );
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_HREF( tmp );
//--------------------------------------------------------------//
// check after every extraction to see if the limit is exceeded //
//--------------------------------------------------------------//
if ( (skim_mail_k.l_Output_list).countItems() <= (new Integer
(skim_mail_k.link_limit.getText()) ).intValue())
skim_mail_k.extract_href( tmp );
}
line_counter = new_end ;
new_end = (skim_mail_k.l_Output_list).countItems() ;
//---------------------------------------//
// report //
//---------------------------------------//
//--------------------------------------------//
// update number of URL's beingSearched //
//--------------------------------------------//
address = "searching link " + ( depth + eachurl) ;
(skim_mail_k.counter_field).setText( address ) ;
if ( new_end > (new Integer (skim_mail_k.link_limit.getText()) ).intValue())
new_end = (new Integer (skim_mail_k.link_limit.getText()) ).intValue() ;
}
//-------------------------------------//
} // <== end of depth //
//-------------------------------------//
// setPriority( getPriority() +1 );
}
//---------------------------------------//
} // <== end of extract function //
//----------------------------------------//
//-----------------------------------------------------------//
// START OF CHECK BUTTONS //
//-----------------------------------------------------------//
{
//-------------------------------------//
// check if extract URL //
//-------------------------------------//
//--------------------------------------------//
// update //
//--------------------------------------------//
(skim_mail_k.counter_field).setText( "Start getting links" ) ;
//-------------------------------------------------//
// java does not care about the //
// parenthesis around the global. //
// I use them for clarity //
// gbg = (skim_mail_k.l_Output_list).getText() ; //
//-------------------------------------------------//
skim_mail_k.BASE_URL= (skim_mail_k.location_bar).getText() ;
skim_mail_k.geturl();
//--------------------------------------------//
// update //
//--------------------------------------------//
(skim_mail_k.counter_field).setText( "start extraction" ) ;
// skim_mail_k.extract();
skim_mail_k.t1.start();
}
//-------------------------------------//
// end of check if extract URL //
//-------------------------------------//
//-------------------------------------//
// check if extract TOPIC //
//-------------------------------------//
//--------------------------------------------//
// update //
//--------------------------------------------//
(skim_mail_k.counter_field).setText( "Start getting links" ) ;
//-------------------------------------------------//
// java does not care about the //
// parenthesis around the global. //
// I use them for clarity //
// gbg = (skim_mail_k.l_Output_list).getText() ; //
//-------------------------------------------------//
String tmp_topic = (new String (skim_mail_k.topic.getText()) );//.stringValue() ;
String tmp_topic2 = skim_mail_k.BEGINNING + tmp_topic + skim_mail_k.ENDING ;
(skim_mail_k.location_bar).setText( tmp_topic2 ) ;
skim_mail_k.BASE_URL= "";
skim_mail_k.geturl();
//--------------------------------------------//
// update //
//--------------------------------------------//
(skim_mail_k.counter_field).setText( "start extraction" ) ;
// skim_mail_k.extract();
skim_mail_k.t1.start();
}
//-------------------------------------//
// end of check if extract URL //
//-------------------------------------//
//-------------------------------------//
// start of resume //
//-------------------------------------//
if ("resume".equals (obj))
{ skim_mail_k.t1.resume() ;
}
//-------------------------------------//
// end of resume //
//-------------------------------------//
//-------------------------------------//
// start of pause //
//-------------------------------------//
if ("pause".equals (obj))
{ skim_mail_k.t1.suspend() ;
}
//-------------------------------------//
// end of pause //
//-------------------------------------//
//-------------------------------------//
// start of exit //
//-------------------------------------//
if ("Exit".equals (obj))
{ System.exit( 0) ;
}
//-------------------------------------//
// end of exit //
//-------------------------------------//
// check if About //
//-------------------------------------//
if ("About".equals (obj))
MyFrame mf ;
mf = new MyFrame() ;
MyDialog d;
MyWindow w;
Button btnOKDialog;
Button btnOKWindow;
//-------------------------------------//
// end of About //
//-------------------------------------//
// check if Help //
//-------------------------------------//
if ("Help".equals (obj))
{
MyFrame mf ;
mf = new MyFrame() ;
MyDialog d;
MyWindow w;
Button btnOKDialog;
Button btnOKWindow;
//-------------------------------------//
// END OF HELP //
//-------------------------------------//
return (true);
//-------------------------------------------------------------------//
} // <======== end of public boolean action (Event evt, Object obj ) //
//-------------------------------------------------------------------//
//-------------------------------------------------------------------//
// start of public boolean handleEvent (Event evt) //
//-------------------------------------------------------------------//
public boolean handleEvent (Event evt)
{
//-------------------------------------//
// start of list //
//-------------------------------------//
if (evt.id == Event.LIST_SELECT)
{
// skim_mail_k.select_Item( evt );
}
//-------------------------------------//
// end of list //
//-------------------------------------//
if (evt.id == Event.WINDOW_DESTROY)
{
System.exit (0);
}
return (super.handleEvent (evt));
}
//-------------------------------------------------------------------//
} // <======== end of public boolean handleEvent (Event evt) //
//-------------------------------------------------------------------//
//
//--------------------------------------------------------
//
switch (evt.id)
{
case Event.WINDOW_DESTROY: // Close from System Menu
this.dispose ();
break;
case Event.ACTION_EVENT:
if ("Click to close".equals (evt.arg)) // Dialog's OK Button
{
this.dispose ();
}
break;
}
return (super.handleEvent (evt));
}
}
//
//----------------------------
//
switch (evt.id)
{
case Event.WINDOW_DESTROY: // Close from System Menu
this.dispose ();
break;
case Event.ACTION_EVENT:
if ("Click to close".equals (evt.arg)) // Window's OK Button
{
this.dispose ();
}
break;
}
return (super.handleEvent (evt));
}
}