Created
March 25, 2011 23:49
-
-
Save peterwmwong/887869 to your computer and use it in GitHub Desktop.
The author of this code will NEVER be For-given
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int writePhraseTree(PhraseTree tree, Connection conn) throws Exception { | |
int affectedRows = 0; | |
for (int z_i = 0; z_i < tree.getZoneCount(); z_i++) { | |
Zone z = tree.getZone(z_i); | |
affectedRows += writePhraseNodeType(z, conn); | |
for (int c_i = 0; c_i < z.getCategoryCount(); c_i++) { | |
Category c = z.getCategory(c_i); | |
affectedRows += writePhraseNodeType(c, conn); | |
for (int s_i = 0; s_i < c.getSubCategoryCount(); s_i++) { | |
SubCategory s = c.getSubCategory(s_i); | |
affectedRows += writePhraseNodeType(s, conn); | |
for (int gp_i = 0; gp_i < s.getGeneralPhraseCount(); gp_i++) { | |
GeneralPhrase gp = s.getGeneralPhrase(gp_i); | |
affectedRows += writePhraseNodeType(gp, conn); | |
for (int sp_i = 0; sp_i < gp.getSpecificPhraseCount(); sp_i++) { | |
SpecificPhrase sp = gp.getSpecificPhrase(sp_i); | |
affectedRows += writePhraseNodeType(sp, conn); | |
for (int l6_i = 0; l6_i < sp.getLevel_6_KeywordCount(); l6_i++) { | |
Level_6_Keyword l6 = sp.getLevel_6_Keyword(l6_i); | |
affectedRows += writePhraseNodeType(l6, conn); | |
for (int l7_i = 0; l7_i < l6.getLevel_7_KeywordCount(); l7_i++) { | |
Level_7_Keyword l7 = l6.getLevel_7_Keyword(l7_i); | |
affectedRows += writePhraseNodeType(l7, conn); | |
for (int l8_i = 0; l8_i < l7.getLevel_8_KeywordCount(); l8_i++) { | |
Level_8_Keyword l8 = l7.getLevel_8_Keyword(l8_i); | |
affectedRows += writePhraseNodeType(l8, conn); | |
for (int l9_i = 0; l9_i < l8.getLevel_9_KeywordCount(); l9_i++) { | |
Level_9_Keyword l9 = l8.getLevel_9_Keyword(l9_i); | |
affectedRows += writePhraseNodeType(l9, conn); | |
for (int l10_i = 0; l10_i < l9.getLevel_10_KeywordCount(); l10_i++) { | |
Level_10_Keyword l10 = l9.getLevel_10_Keyword(l10_i); | |
affectedRows += writePhraseNodeType(l10, conn); | |
/* WTF */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment