Simplified Code Of SearchResult Constructor
//DS420 Deserializer
import java.util.StringTokenizer;
public class SearchResult
{
/*
strying array to store the components to be used
str[0] = URL
str[1] = Title
str[2] = Description
str[3] = LastModified
str[4] = Language
str[5] = PageSize
str[6] = Rank
*/
String str[] = new String[7];
/*
default, parameterless constructor
*/
public SearchResult()
{
}
/*
constructor that takes one string and break the string to its components
*/
public SearchResult(String strToBeBroken)
{
Token(strToBeBroken);
}
/*
method to break down the string and store the components
called by SearchResult constructor
*/
public void Token (String strToBeTokened)
{
StringTokenizer m = new StringTokenizer(strToBeTokened);
for (int i = 0; i < 7; i++)
str[i] = m.nextToken();
}
/*get methods to get the brokend components
*/
public String getURL()
{
return str[0];
}
public String getTitle()
{
return str[1];
}
public String getDescription()
{
return str[2];
}
public String getLastModified()
{
return str[3];
}
public String getLanguage()
{
return str[4];
}
public String getPageSize()
{
return str[5];
}
public String getRank()
{
return str[6];
}
}
by Seunghyun Yoo