@@ -107,6 +107,20 @@ private void loadSection(Model model, Config cfg, String sec) {
107107 }
108108 }
109109
110+ /*
111+ * Helper function for loadModel and loadModelFromText
112+ *
113+ * @param config the configuration parser
114+ */
115+ private void loadSections (Config cfg ) {
116+ loadSection (this , cfg , "r" );
117+ loadSection (this , cfg , "p" );
118+ loadSection (this , cfg , "e" );
119+ loadSection (this , cfg , "m" );
120+
121+ loadSection (this , cfg , "g" );
122+ }
123+
110124 /**
111125 * loadModel loads the model from model CONF file.
112126 *
@@ -115,12 +129,7 @@ private void loadSection(Model model, Config cfg, String sec) {
115129 public void loadModel (String path ) {
116130 Config cfg = Config .newConfig (path );
117131
118- loadSection (this , cfg , "r" );
119- loadSection (this , cfg , "p" );
120- loadSection (this , cfg , "e" );
121- loadSection (this , cfg , "m" );
122-
123- loadSection (this , cfg , "g" );
132+ loadSections (cfg );
124133 }
125134
126135 /**
@@ -131,12 +140,7 @@ public void loadModel(String path) {
131140 public void loadModelFromText (String text ) {
132141 Config cfg = Config .newConfigFromText (text );
133142
134- loadSection (this , cfg , "r" );
135- loadSection (this , cfg , "p" );
136- loadSection (this , cfg , "e" );
137- loadSection (this , cfg , "m" );
138-
139- loadSection (this , cfg , "g" );
143+ loadSections (cfg );
140144 }
141145
142146 /**
0 commit comments