Skip to content

Commit d49c9da

Browse files
committed
Undoing.
1 parent a3dc481 commit d49c9da

File tree

1 file changed

+39
-38
lines changed

1 file changed

+39
-38
lines changed

NeuGen/src/org/neugen/backend/NGBackend.java

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
import org.neugen.datastructures.Net;
7777
import org.neugen.datastructures.Region;
7878
import org.neugen.datastructures.xml.XMLObject;
79+
import org.neugen.datastructures.xml.XMLNode;
7980
import org.neugen.gui.NeuGenConstants;
8081
import org.neugen.gui.NeuGenLib;
8182
import org.neugen.gui.NeuGenProject;
@@ -362,7 +363,7 @@ public void create_and_open_project(String projectPath, String sourceTemplate, S
362363
* @param currentRoot
363364
* @param projectDirPath
364365
*/
365-
private void save_param(TreeNode currentRoot, String projectDirPath) {
366+
private void save_param(XMLNode currentRoot, String projectDirPath) {
366367
save(currentRoot, projectDirPath, NeuGenConstants.PARAM);
367368
}
368369

@@ -371,7 +372,7 @@ private void save_param(TreeNode currentRoot, String projectDirPath) {
371372
* @param currentRoot
372373
* @param projectDirPath
373374
*/
374-
private void save_interna(TreeNode currentRoot, String projectDirPath) {
375+
private void save_interna(XMLNode currentRoot, String projectDirPath) {
375376
save(currentRoot, projectDirPath, NeuGenConstants.INTERNA);
376377
}
377378

@@ -391,7 +392,7 @@ public void save(Map<String, XMLObject> paramTrees, String projectDirPath) {
391392
* @param projectDirPath
392393
* @param param
393394
*/
394-
private void save(TreeNode currentRoot, String projectDirPath, String param) {
395+
private void save(XMLNode currentRoot, String projectDirPath, String param) {
395396
logger.info("leaf count: " + currentRoot.getLeafCount());
396397

397398
/**
@@ -579,23 +580,23 @@ public void modifyNPartsDensity(double density) {
579580
for (Map.Entry<String, XMLObject> entry : params.entrySet()) {
580581
XMLObject obj = entry.getValue();
581582

582-
Enumeration<TreeNode> childs = obj.children();
583+
Enumeration<XMLNode> childs = obj.children();
583584

584585
while (childs.hasMoreElements()) {
585-
TreeNode node = childs.nextElement();
586+
XMLNode node = childs.nextElement();
586587
if ("neuron".equals(node.toString())) {
587-
Enumeration<TreeNode> childs2 = node.children();
588+
Enumeration<XMLNode> childs2 = node.children();
588589
while (childs2.hasMoreElements()) {
589-
TreeNode node2 = childs2.nextElement();
590+
XMLNode node2 = childs2.nextElement();
590591
if ("axon".equals(node2.toString())) {
591-
Enumeration<TreeNode> childs3 = node2.children();
592+
Enumeration<XMLNode> childs3 = node2.children();
592593
while (childs3.hasMoreElements()) {
593-
TreeNode child4 = childs3.nextElement();
594+
XMLNode child4 = childs3.nextElement();
594595
if ("gen_0".equals(child4.toString())) {
595-
Enumeration<TreeNode> childs5 = child4.children();
596+
Enumeration<XMLNode> childs5 = child4.children();
596597

597598
while (childs5.hasMoreElements()) {
598-
TreeNode child6 = childs5.nextElement();
599+
XMLNode child6 = childs5.nextElement();
599600

600601
if ("nparts_density".equals(child6.getKey())) {
601602
System.err.println("child6 (before): " + child6.toString());
@@ -617,15 +618,15 @@ public void modifyNPartsDensity(double density) {
617618

618619
} else if ("dendrite".equals(node2.toString())) {
619620

620-
Enumeration<TreeNode> childs3 = node2.children();
621+
Enumeration<XMLNode> childs3 = node2.children();
621622
while (childs3.hasMoreElements()) {
622-
TreeNode child4 = childs3.nextElement();
623+
XMLNode child4 = childs3.nextElement();
623624
System.err.println("axon child: " + child4.toString());
624625
if ("gen_0".equals(child4.toString())) {
625-
Enumeration<TreeNode> childs5 = child4.children();
626+
Enumeration<XMLNode> childs5 = child4.children();
626627

627628
while (childs5.hasMoreElements()) {
628-
TreeNode child6 = childs5.nextElement();
629+
XMLNode child6 = childs5.nextElement();
629630

630631
if ("nparts_density".equals(child6.getKey())) {
631632
System.err.println("child6 (before): " + child6.toString());
@@ -663,15 +664,15 @@ public void modifySynapseDistance(double dist_synapse) {
663664
for (Map.Entry<String, XMLObject> entry : params.entrySet()) {
664665
XMLObject obj = entry.getValue();
665666
@SuppressWarnings("unchecked")
666-
Enumeration<TreeNode> childs = obj.children();
667+
Enumeration<XMLNode> childs = obj.children();
667668

668669
while (childs.hasMoreElements()) {
669-
TreeNode node = childs.nextElement();
670+
XMLNode node = childs.nextElement();
670671
if ("net".equals(node.toString())) {
671672
@SuppressWarnings("unchecked")
672-
Enumeration<TreeNode> childs2 = node.children();
673+
Enumeration<XMLNode> childs2 = node.children();
673674
while (childs2.hasMoreElements()) {
674-
TreeNode node2 = childs2.nextElement();
675+
XMLNode node2 = childs2.nextElement();
675676
if ("dist_synapse".equals(node2.getKey())) {
676677
node2.setValue(dist_synapse);
677678
}
@@ -693,15 +694,15 @@ public void adjustNetworkSize(int factor) {
693694
for (Map.Entry<String, XMLObject> entry : params.entrySet()) {
694695
XMLObject obj = entry.getValue();
695696
@SuppressWarnings("unchecked")
696-
Enumeration<TreeNode> childs = obj.children();
697+
Enumeration<XMLNode> childs = obj.children();
697698

698699
while (childs.hasMoreElements()) {
699-
TreeNode node = childs.nextElement();
700+
XMLNode node = childs.nextElement();
700701
if ("net".equals(node.toString())) {
701702
@SuppressWarnings("unchecked")
702-
Enumeration<TreeNode> childs2 = node.children();
703+
Enumeration<XMLNode> childs2 = node.children();
703704
while (childs2.hasMoreElements()) {
704-
TreeNode node2 = childs2.nextElement();
705+
XMLNode node2 = childs2.nextElement();
705706
if (! "dist_synapse".equals(node2.getKey())) {
706707
node2.setValue(Integer.parseInt(node2.getValue().toString()) * factor);
707708
}
@@ -769,14 +770,14 @@ private void adjust_cell_number_for_cell_type(String cellType, int numberOfCells
769770
for (Map.Entry<String, XMLObject> entry : params.entrySet()) {
770771
XMLObject obj = entry.getValue();
771772
@SuppressWarnings("unchecked")
772-
Enumeration<TreeNode> childs = obj.children();
773+
Enumeration<XMLNode> childs = obj.children();
773774
while (childs.hasMoreElements()) {
774-
TreeNode node = childs.nextElement();
775+
XMLNode node = childs.nextElement();
775776
if ("net".equals(node.toString())) {
776777
@SuppressWarnings("unchecked")
777-
Enumeration<TreeNode> childs2 = node.children();
778+
Enumeration<XMLNode> childs2 = node.children();
778779
while (childs2.hasMoreElements()) {
779-
TreeNode node2 = childs2.nextElement();
780+
XMLNode node2 = childs2.nextElement();
780781
if (cellType.equals(node2.getKey())) {
781782
node2.setValue(numberOfCells);
782783
}
@@ -853,10 +854,10 @@ private void modifyParameter(XMLObject paramTree, double param, String identifie
853854
}
854855

855856
ArrayList<String> pathes = new ArrayList<String>(Arrays.asList(identifier.split("/")));
856-
Enumeration<TreeNode> childs = paramTree.children();
857+
Enumeration<XMLNode> childs = paramTree.children();
857858

858859
while (childs.hasMoreElements()) {
859-
TreeNode node = childs.nextElement();
860+
XMLNode node = childs.nextElement();
860861
if (pathes.get(0).equals(node.getKey())) {
861862
modifyParameter_rec(node,
862863
param,
@@ -876,10 +877,10 @@ private void modifyParameter(XMLObject paramTree, double param, String identifie
876877
* @param identifier
877878
*/
878879
@SuppressWarnings("unchecked")
879-
private void modifyParameter_rec(TreeNode root, double param, ArrayList<String> identifier) {
880-
Enumeration<TreeNode> childs = root.children();
880+
private void modifyParameter_rec(XMLNode root, double param, ArrayList<String> identifier) {
881+
Enumeration<XMLNode> childs = root.children();
881882
while (childs.hasMoreElements()) {
882-
TreeNode node = childs.nextElement();
883+
XMLNode node = childs.nextElement();
883884
if (identifier.get(0).equals(node.getKey())) {
884885
if (identifier.size() == 1) {
885886
node.setValue(param);
@@ -903,15 +904,15 @@ private void modifyParameter_rec(TreeNode root, double param, ArrayList<String>
903904
* @param replacement
904905
*/
905906
@SuppressWarnings("unchecked")
906-
private void correct_siblings(TreeNode child, String identifier, double replacement) {
907-
/// only one child called siblings within childs of current TreeNode child
908-
Enumeration<TreeNode> childs = child.children();
909-
TreeNode sibling = childs.nextElement();
910-
Enumeration<TreeNode> childs_of_sibling = sibling.children();
907+
private void correct_siblings(XMLNode child, String identifier, double replacement) {
908+
/// only one child called siblings within childs of current XMLNode child
909+
Enumeration<XMLNode> childs = child.children();
910+
XMLNode sibling = childs.nextElement();
911+
Enumeration<XMLNode> childs_of_sibling = sibling.children();
911912

912913
while (childs_of_sibling.hasMoreElements()) {
913914
/// current child of current sibling's child
914-
TreeNode current_child = childs_of_sibling.nextElement();
915+
XMLNode current_child = childs_of_sibling.nextElement();
915916

916917
/// replace node's content
917918
if (identifier.equals(current_child.getKey())) {

0 commit comments

Comments
 (0)