Beispiel #1
0
 @Restrict(UnitRole.DEFECTEDIT)
 public static void deleteComment(Long commentId) {
   DefectComment defectComment = DefectComment.find("id=?", commentId).first();
   if (defectComment == null) {
     Logger.error(Logger.LogType.TECHNICAL, "Could not find comment %s for deletion", commentId);
     notFound("Sorry, the selected comment could not be found. Please refresh the page");
   }
   try {
     defectComment.delete();
   } catch (Throwable t) {
     Logger.error(Logger.LogType.DB, "Error deleting comment %s", commentId);
     error("An error occurred while deleting the comment, please try again");
   }
   ok();
 }
Beispiel #2
0
 @Restrict(UnitRole.DEFECTDELETE)
 public static void deleteDefect(Long defectId) {
   Defect defect = Lookups.getDefect(defectId);
   if (defect == null) {
     Logger.error(Logger.LogType.TECHNICAL, "Could not find defect for deletion %s", defectId);
     notFound("Sorry, the selected defect could not be found. Please refresh the page");
   }
   try {
     defect.delete();
   } catch (Throwable t) {
     Logger.error(Logger.LogType.DB, "Error deleting defect %s", defectId);
     error(
         String.format(
             "An error occurred while deleting defect %s, please try again", defect.naturalId));
   }
   ok();
 }
Beispiel #3
0
  @Restrict(UnitRole.DEFECTCREATE)
  public static void createDefect(@Valid Defect defect) {
    defect.submittedBy = getConnectedUser();
    defect.account = getConnectedUserAccount();
    defect.project = getActiveProject();
    defect.status = DefectStatus.getDefaultDefectStatus();
    boolean created = defect.create();
    if (!created) {
      Logger.error(Logger.LogType.DB, "Error while creating defect");
      error("An error occurred while saving the defect, please try again");
    }

    // linking to test instance
    String runIdParam = params.get("runId");
    if (StringUtils.isNotEmpty(runIdParam)) {
      try {
        Long runId = Long.valueOf(runIdParam);
        if (runId != null) {
          Instance instance =
              Run.find("select r.instance from Run r where r.id = ?", runId).first();
          instance.defects.add(defect);
          try {
            instance.save();
          } catch (Throwable t) {
            Logger.error(
                Logger.LogType.DB,
                "Error while updating defect instance during linking to defefct %s",
                defect.getId());
            error(
                String.format(
                    "An error occurred while linking the newly created defect %s to test instance %s. Please try again.",
                    defect.naturalId, instance.naturalId));
          }
        }
      } catch (NumberFormatException nfe) {
        Logger.error(
            Logger.LogType.SECURITY,
            "Invalid value '%s' for runId parameter passed during defect creation",
            runIdParam);
        error();
      }
    }

    ok();
  }
  @Override
  public void transform(final CommonTree ast) {
    LOGGER.info("DatatypeInfoMapper.transform..." + ast);
    namespaceStack.clear();

    this.datatypeInfos = new ArrayList<DatatypeInfo>(ast.getChildCount());

    try {
      for (int i = 0; i < ast.getChildCount(); i++) {
        walk(ast.getChild(i), null);
      }
    } catch (RuntimeException e) {
      LOGGER.error(e);
      throw e;
    }

    LOGGER.info("DONE: " + references.size() + " loaded.");
  }
Beispiel #5
0
  @Restrict(UnitRole.DEFECTVIEW)
  public static void defectDetails(Long baseObjectId, String[] fields) {
    Defect defect = Lookups.getDefect(baseObjectId);
    if (defect == null) {
      Logger.error(Logger.LogType.TECHNICAL, "Could not find defect with ID %s", defect.id);
      notFound("Sorry, the selected defect could not be found. Please refresh the page");
    }

    renderFields(defect, fields);
  }
Beispiel #6
0
 @Restrict(UnitRole.DEFECTEDIT)
 public static void updateDefect(@Valid Defect defect) {
   Defect d = Lookups.getDefect(defect.getId());
   if (d == null) {
     Logger.error(Logger.LogType.TECHNICAL, "Could not find defect with ID %s", defect.getId());
     notFound("Sorry, the selected defect could not be found. Please refresh the page");
   }
   d.name = defect.name;
   d.description = defect.description;
   d.assignedTo = defect.assignedTo;
   d.status = defect.status;
   try {
     d.save();
   } catch (Throwable t) {
     Logger.error(Logger.LogType.DB, "Error updating defect");
     error("An error occurred while saving the defect, please try again.");
   }
   ok();
 }
Beispiel #7
0
 @Restrict(UnitRole.DEFECTVIEW)
 public static void defectDescription(Long defectId) {
   Defect defect = Lookups.getDefect(defectId);
   if (defect == null) {
     Logger.error(Logger.LogType.TECHNICAL, "Could not find defect with ID %s", defectId);
     notFound("Sorry, the selected defect could not be found. Please refresh the page");
   }
   JsonObject jsonObject = new JsonObject();
   jsonObject.addProperty("defectTitle", defect.name);
   jsonObject.addProperty(
       "defectAssignedTo", defect.assignedTo == null ? "" : defect.assignedTo.toString());
   jsonObject.addProperty(
       "defectSubmittedBy", defect.submittedBy == null ? "" : defect.submittedBy.toString());
   jsonObject.addProperty("defectStatus", defect.status == null ? "" : defect.status.toString());
   jsonObject.addProperty(
       "defectCreated", defect.created == null ? "" : defect.created.toString());
   jsonObject.addProperty("defectTags", defect.tags == null ? "" : defect.tags.toString());
   jsonObject.addProperty(
       "defectDescription", defect.description == null ? "" : defect.description);
   renderJSON(jsonObject.toString());
 }
  @Override
  public void update(GameContainer gameContainer, StateBasedGame stateBasedGame, int delta)
      throws SlickException {

    Input in = gameContainer.getInput();

    if (in.isKeyPressed(Input.KEY_C)) {
      clear();
    }

    gameContainer.setMaximumLogicUpdateInterval(updateInterval);

    if (in.isMousePressed(Input.MOUSE_LEFT_BUTTON)) {
      float x1 = in.getMouseX() / ratio;
      float y1 = in.getMouseY() / ratio;
      if (start == null) {
        start = new Cell((int) x1, (int) y1, ratio, false);
        start.start = true;
        cells[start.gridPosX][start.gridPosY].start = true;
        cellStack.add(cells[start.gridPosX][start.gridPosY]);
      } else if (goal == null) {
        goal = new Cell((int) x1, (int) y1, ratio, false);
        cells[goal.gridPosX][goal.gridPosY].goal = true;
      } else {
        changeCellAtPosition((int) x1, (int) y1);
      }

      if (start != null && goal != null) {
        this.wall = cells[(int) x1][(int) y1].wall;
      }
    }

    if (in.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
      if (start != null && goal != null) {
        mousePressing = true;
        float x1 = in.getMouseX() / ratio;
        float y1 = in.getMouseY() / ratio;
        cells[(int) x1][(int) y1].wall = this.wall;
      }
    } else {
      mousePressing = false;
    }

    if (in.isKeyPressed(Input.KEY_ENTER)) {
      if (mazeSolved && displayingMaze) {
        clear();
        createGraph();
        maze = true;
      } else if (!maze) {
        this.search = true;
      }
    }

    if (in.isKeyPressed(Input.KEY_M) && !maze) {
      createGraph();
      maze = true;
      this.logger.initWriter();
    }

    if (in.isKeyPressed(Input.KEY_S)) {
      clear();
      for (int i = 0; i < cells.length; i++) {
        for (int j = 0; j < cells.length; j++) {
          Random random = new Random();
          if (random.nextInt(3) == 0) {
            cells[i][j].wall = true;
          }
        }
      }
      setDefaultStartAndEnd(true);
    }

    if (in.isKeyPressed(Input.KEY_ADD)) {
      if (updateInterval > 1) {
        updateInterval -= 1;
      }
    }
    if (in.isKeyPressed(Input.KEY_SUBTRACT)) {
      if (updateInterval < 20) {
        updateInterval += 1;
      }
    }

    if (in.isKeyPressed(Input.KEY_P)) {
      if (!gameContainer.isPaused()) {
        gameContainer.pause();
      } else {
        gameContainer.resume();
      }
    }

    if (in.isKeyPressed(Input.KEY_D)) {
      this.diagonal = !this.diagonal;
    }

    if (in.isKeyPressed(Input.KEY_ESCAPE)) {
      stateBasedGame.enterState(1);
    }

    if (in.isKeyPressed(Input.KEY_A)) {
      AnalyzeLog.analyzeBacktracks(AnalyzeLog.FIRST);
    }

    if (in.isKeyPressed(Input.KEY_I)) {
      this.createImage();
    }

    if (this.search) {
      if (start == null || goal == null) {
        this.search = false;
      } else {
        if (ButtonStates.DFSState) {
          if (solvingVisited.size() < 1) {
            solvingVisited.add(cells[start.gridPosX][start.gridPosY]);
            cells[start.gridPosX][start.gridPosY].solvingVisited = true;
            currentDFSCell = cells[start.gridPosX][start.gridPosY];
          } else {
            for (int x = 0; x < CELLS; x++) {
              for (int y = 0; y < CELLS; y++) {
                cells[x][y].dfsCheckNeighbors();
              }
            }
            if (currentDFSCell.goal) {
              this.search = false;
              this.drawWay = true;
              this.end = currentDFSCell;
              getPath(false, null);
              if (displayingMaze) {
                mazeSolved = true;
              }
              foundSolution = true;
            } else {
              if (solvingVisited.size() != (CELLS * CELLS)) {
                ArrayList<Cell> currentNeighbors = new ArrayList<>();
                if (currentDFSCell.dfsNorth != null
                    && !currentDFSCell.dfsNorth.solvingVisited
                    && !currentDFSCell.dfsNorth.wall) {
                  currentNeighbors.add(currentDFSCell.dfsNorth);
                } else if (currentDFSCell.dfsEast != null
                    && !currentDFSCell.dfsEast.solvingVisited
                    && !currentDFSCell.dfsEast.wall) {
                  currentNeighbors.add(currentDFSCell.dfsEast);
                } else if (currentDFSCell.dfsSouth != null
                    && !currentDFSCell.dfsSouth.solvingVisited
                    && !currentDFSCell.dfsSouth.wall) {
                  currentNeighbors.add(currentDFSCell.dfsSouth);
                } else if (currentDFSCell.dfsWest != null
                    && !currentDFSCell.dfsWest.solvingVisited
                    && !currentDFSCell.dfsWest.wall) {
                  currentNeighbors.add(currentDFSCell.dfsWest);
                } else {;
                }
                if (currentNeighbors.size() > 0) {
                  Cell neighbor = currentNeighbors.get(0);
                  neighbor.solvingPrevious = currentDFSCell;
                  neighbor.solvingVisited = true;
                  currentDFSCell = neighbor;
                } else {
                  dfsBacktracked.add(currentDFSCell);
                  dfsBacktracked.add(currentDFSCell.solvingPrevious);
                  currentDFSCell = currentDFSCell.solvingPrevious;
                }
              }
            }
          }
        } else if (ButtonStates.AStarState) {

        } else if (ButtonStates.BFSState) {
          if (solvingVisited.size() < 1) {
            solvingVisited.add(cells[start.gridPosX][start.gridPosY]);
            cells[start.gridPosX][start.gridPosY].solvingVisited = true;
            cellStack.add(cells[start.gridPosX][start.gridPosY]);
          } else {
            if (!cellStack.isEmpty()) {
              Cell current = (Cell) cellStack.remove();
              Cell child;
              if (current.goal) {
                this.end = current;
                this.drawWay = true;
                this.search = false;
                getPath(false, null);
                if (displayingMaze) {
                  mazeSolved = true;
                }
                foundSolution = true;
              } else {
                while ((child = getUnvisitedChildCell(current)) != null) {
                  child.solvingVisited = true;
                  child.solvingPrevious = current;
                  solvingVisited.add(child);
                  cellStack.add(child);
                  current.solvingCheckNeighbors(diagonal);
                  getPath(true, child);
                }
              }
            }
          }
        } else {
          try {
            throw new NoSolvingAlgorithmSelectedException();
          } catch (Exception e) {
            e.printStackTrace();
          }
        }
      }
    }
    if (this.maze) {
      if (this.logger.used) {
        this.logger.createNewLogFile();
        this.logger.initWriter();
        this.logger.used = false;
      }
      if (cells.length != 0) {
        logger.writeInLog("Checking neighbors");
        for (int i = 0; i < CELLS; i++) {
          for (int j = 0; j < CELLS; j++) {
            cells[i][j].genCheckNeighbors();
          }
        }

        if (genVisited.size() < 1) {
          genVisited.add(cells[1][1]);
          currentGenCell = cells[1][1];
          currentGenCell.genVisited = true;
          logger.writeInLog("Adding Cell X1 and Y1 to visited Cells");
        }
        if (genVisited.size() != totalCells) {
          ArrayList<Cell> currentNeighbors = new ArrayList<>();
          if (currentGenCell.north != null
              && !currentGenCell.north.genVisited
              && currentGenCell.north.allWallsIntact) {
            currentNeighbors.add(currentGenCell.north);
            logger.writeInLog(
                "Adding north cell to neighbors at: "
                    + currentGenCell.north.gridPosX
                    + "; "
                    + currentGenCell.north.gridPosY);
          }
          if (currentGenCell.east != null
              && !currentGenCell.east.genVisited
              && currentGenCell.east.allWallsIntact) {
            currentNeighbors.add(currentGenCell.east);
            logger.writeInLog(
                "Adding east cell to neighbors at: "
                    + currentGenCell.east.gridPosX
                    + "; "
                    + currentGenCell.east.gridPosY);
          }
          if (currentGenCell.south != null
              && !currentGenCell.south.genVisited
              && currentGenCell.south.allWallsIntact) {
            currentNeighbors.add(currentGenCell.south);
            logger.writeInLog(
                "Adding south cell to neighbors at: "
                    + currentGenCell.south.gridPosX
                    + "; "
                    + currentGenCell.south.gridPosY);
          }
          if (currentGenCell.west != null
              && !currentGenCell.west.genVisited
              && currentGenCell.west.allWallsIntact) {
            currentNeighbors.add(currentGenCell.west);
            logger.writeInLog(
                "Adding west cell to neighbors at: "
                    + currentGenCell.west.gridPosX
                    + "; "
                    + currentGenCell.west.gridPosY);
          }

          if (currentNeighbors.size() > 0) {
            Random random = new Random();
            int randomValue = random.nextInt(currentNeighbors.size());
            logger.writeInLog("Generated random number: " + randomValue);
            Cell neighbor = currentNeighbors.get(randomValue);
            logger.writeInLog("Picked neighbor: " + neighbor.gridPosX + "; " + neighbor.gridPosY);
            neighbor.genVisited = true;

            int wallX = 0;
            int wallY = 0;

            // break wall
            if (neighbor.gridPosX > currentGenCell.gridPosX) {
              wallX = currentGenCell.gridPosX + 1;
            } else if (neighbor.gridPosX < currentGenCell.gridPosX) {
              wallX = currentGenCell.gridPosX - 1;
            } else {
              wallX = currentGenCell.gridPosX;
            }

            if (neighbor.gridPosY > currentGenCell.gridPosY) {
              wallY = currentGenCell.gridPosY + 1;
            } else if (neighbor.gridPosY < currentGenCell.gridPosY) {
              wallY = currentGenCell.gridPosY - 1;
            } else {
              wallY = currentGenCell.gridPosY;
            }

            cells[wallX][wallY].wall = false;
            cells[wallX][wallY].genVisited = true;
            logger.writeInLog("Breaking wall at: " + wallX + "; " + wallY);
            genVisited.add(cells[wallX][wallY]);
            neighbor.genBacktrack = currentGenCell;
            logger.writeInLog(
                "Set current cell to backtrack cell at: "
                    + currentGenCell.gridPosX
                    + "; "
                    + currentGenCell.gridPosY);
            currentGenCell = neighbor;

          } else {
            currentGenCell = currentGenCell.genBacktrack;
            logger.writeInLog(
                "Backtracking at: "
                    + currentGenCell.genBacktrack.gridPosX
                    + "; "
                    + currentGenCell.genBacktrack.gridPosY);
          }
        } else {
          currentGenCell = null;
          this.maze = false;
          setDefaultStartAndEnd(true);
          displayingMaze = true;
          if ((this.search = !this.search) == true) {
            if (this.startSearch == false) {
              this.search = false;
              createImage();
            }
          }
          logger.writeInLog("Done Maze, closing logger.");
          logger.closeWriter();
          if (this.automaticallyGenerateMazes && (generatedMazes < mazesToGenerate)) {
            generatedMazes += 1;
            clear();
            createGraph();
            this.maze = true;
          } else if (this.logger.stepList.size() != 0) {
            this.logger.printStepList();
          } else {;
          }
        }
      }
    }
    char[][] copyOfLevel = new char[CELLS][CELLS];
    for (int x = 0; x < cells.length; x++) {
      for (int y = 0; y < cells.length; y++) {
        if (cells[x][y].wall) {
          copyOfLevel[x][y] = 'W';
        } else if (!cells[x][y].wall) {
          copyOfLevel[x][y] = 'D';
        } else if (cells[x][y].start) {
          copyOfLevel[x][y] = 'S';
        } else if (cells[x][y].goal) {
          copyOfLevel[x][y] = 'G';
        } else {
          copyOfLevel[x][y] = 'D';
        }
      }
    }
    Level.update(copyOfLevel);
  }
 private void dbgMsg(String pMsg) {
   Logger.dbg("ArrayListRowFactory" + pMsg);
 }
  @SuppressWarnings("unchecked")
  private Object walk(final Tree node, final DatatypeInfo parent) {
    // an optional node that is not present in the current context, is null
    if (node == null) {
      return null;
    }

    DatatypeInfo newParent = parent;
    CommonTree commonTreeNode = (CommonTree) node;
    Tree modifiers;

    switch (node.getType()) {
        // case CsRewriteRulesParser.ATTRIBUTE:
        // System.out.println("ATTRIBUTE");
        // break;
      case CSharp4AST.NAMESPACE:
        CommonTree qid =
            (CommonTree) commonTreeNode.getFirstChildWithType(CSharp4AST.QUALIFIED_IDENTIFIER);

        Collection<String> namespaces = TreeHelper.treeListToStringList(qid.getChildren());
        namespaceStack.addAll(namespaces);

        walk(
            commonTreeNode.getFirstChildWithType(CSharp4AST.NAMESPACE_MEMBER_DECLARATIONS), parent);

        for (int i = 0; i < qid.getChildren().size(); i++) namespaceStack.removeLast();
        return null;
      case CSharp4AST.QUALIFIED_IDENTIFIER:
      case CSharp4AST.EXTERN_ALIAS_DIRECTIVES:
      case CSharp4AST.USING_DIRECTIVES:
      case CSharp4AST.NAMESPACE_MEMBER_DECLARATIONS:
      case CSharp4AST.ATTRIBUTES:
      case CSharp4AST.CLASS_MEMBER_DECLARATIONS:
      case CSharp4AST.INTERFACE_MEMBER_DECLARATIONS:
      case CSharp4AST.ENUM_MEMBER_DECLARATIONS:
      case CSharp4AST.STRUCT_MEMBER_DECLARATIONS:
      case CSharp4AST.CONST:
        for (int i = 0; i < commonTreeNode.getChildCount(); i++) {
          walk(commonTreeNode.getChild(i), parent);
        }
        return null;
      case CSharp4AST.CLASS:
        newParent = new DatatypeInfo("class");
        newParent.setNamespace(namespaceStack);
        datatypeInfos.add(newParent);

        String className =
            walk(
                commonTreeNode.getFirstChildWithType(CSharp4AST.IDENTIFIER),
                newParent,
                String.class);
        newParent.setName(className);

        LOGGER.fine("class: " + className);

        // modifiers
        modifiers = commonTreeNode.getFirstChildWithType(CSharp4AST.MODIFIERS);
        if (modifiers != null) {
          List<String> modifierNames =
              TreeHelper.treeListToStringList(((CommonTree) modifiers).getChildren());
          if (modifierNames.contains(ABSTRACT)) {
            newParent.setIsAbstract(Boolean.TRUE);
          }
        }

        setFullPath(parent, newParent);

        // must be invoked after setFullPath
        walk(commonTreeNode.getFirstChildWithType(CSharp4AST.CLASS_MEMBER_DECLARATIONS), newParent);

        addToReferences(newParent);
        return newParent;
      case CSharp4AST.INTERFACE:
        newParent = new DatatypeInfo("interface");
        newParent.setNamespace(namespaceStack);
        datatypeInfos.add(newParent);

        String interfaceName =
            walk(
                commonTreeNode.getFirstChildWithType(CSharp4AST.IDENTIFIER),
                newParent,
                String.class);
        newParent.setName(interfaceName);

        LOGGER.fine("interface: " + interfaceName);

        // transform(commonTreeNode.getFirstChildWithType(CSharp4AST.IMPLEMENTS),
        // newParent,
        // false);

        // modifiers
        modifiers = commonTreeNode.getFirstChildWithType(CSharp4AST.MODIFIERS);
        if (modifiers != null) {
          List<String> modifierNames =
              TreeHelper.treeListToStringList(((CommonTree) modifiers).getChildren());
          if (modifierNames.contains(ABSTRACT)) {
            newParent.setIsAbstract(Boolean.TRUE);
          }
        }

        setFullPath(parent, newParent);

        // must be invoked after setFullPath
        walk(
            commonTreeNode.getFirstChildWithType(CSharp4AST.INTERFACE_MEMBER_DECLARATIONS),
            newParent);

        addToReferences(newParent);
        return newParent;
      case CSharp4AST.ENUM:
        newParent = new DatatypeInfo("enum");
        newParent.setNamespace(namespaceStack);
        datatypeInfos.add(newParent);

        String enumName =
            walk(
                commonTreeNode.getFirstChildWithType(CSharp4AST.IDENTIFIER),
                newParent,
                String.class);
        newParent.setName(enumName);

        LOGGER.fine("enum: " + enumName);

        // modifiers
        modifiers = commonTreeNode.getFirstChildWithType(CSharp4AST.MODIFIERS);
        if (modifiers != null) {
          for (int i = 0; i < modifiers.getChildCount(); i++) {
            Tree modTree = modifiers.getChild(i);
            String modName = modTree.getText();

            if (ABSTRACT.equals(modName)) {
              newParent.setIsAbstract(Boolean.TRUE);
            }
          }
        }

        setFullPath(parent, newParent);

        // must be invoked after setFullPath
        walk(commonTreeNode.getFirstChildWithType(CSharp4AST.ENUM_MEMBER_DECLARATIONS), newParent);

        addToReferences(newParent);
        return newParent;
      case CSharp4AST.STRUCT:
        newParent = new DatatypeInfo("struct");
        newParent.setNamespace(namespaceStack);
        datatypeInfos.add(newParent);

        String structName =
            walk(
                commonTreeNode.getFirstChildWithType(CSharp4AST.IDENTIFIER),
                newParent,
                String.class);
        newParent.setName(structName);

        // IMPLEMENTS

        setFullPath(parent, newParent);

        walk(
            commonTreeNode.getFirstChildWithType(CSharp4AST.STRUCT_MEMBER_DECLARATIONS), newParent);

        addToReferences(newParent);

        LOGGER.fine("struct: " + newParent);
        return newParent;
      case CSharp4AST.DELEGATE:
        // see http://msdn.microsoft.com/de-de/library/900fyy8e%28v=vs.80%29.aspx
        newParent = new DatatypeInfo("delegate");
        newParent.setNamespace(namespaceStack);

        String delegateName =
            walk(
                commonTreeNode.getFirstChildWithType(CSharp4AST.IDENTIFIER),
                newParent,
                String.class);
        newParent.setName(delegateName);

        // TODO handle signature and generics

        setFullPath(parent, newParent);

        addToReferences(newParent);

        LOGGER.fine("delegate: " + newParent);
        break;
      case CSharp4AST.METHOD_DECL:
        MethodInfo methodInfo = new MethodInfo(parent);

        String returnType =
            walk(commonTreeNode.getFirstChildWithType(CSharp4AST.TYPE), parent, String.class);
        String methodName =
            walk(
                commonTreeNode.getFirstChildWithType(CSharp4AST.MEMBER_NAME), parent, String.class);
        List<ParameterInfo> formalParameters =
            walk(
                commonTreeNode.getFirstChildWithType(CSharp4AST.FORMAL_PARAMETER_LIST),
                parent,
                List.class);

        LOGGER.fine("method: " + methodName);

        methodInfo.setName(methodName);
        methodInfo.setReturnType(returnType);
        if (formalParameters != null) methodInfo.getParameters().addAll(formalParameters);
        parent.addMethodInfo(methodInfo);

        addToReferences(methodInfo);
        return methodInfo;
      case CSharp4AST.MEMBER_NAME:
        String typeName =
            walk(
                commonTreeNode.getFirstChildWithType(CSharp4AST.NAMESPACE_OR_TYPE_NAME),
                parent,
                String.class);
        return typeName;
      case CSharp4AST.FORMAL_PARAMETER_LIST:
        List<ParameterInfo> parameters = new LinkedList<ParameterInfo>();
        for (int i = 0; i < commonTreeNode.getChildCount(); i++) {
          Tree child = commonTreeNode.getChild(i);
          ParameterInfo parameter = walk(child, parent, ParameterInfo.class);
          parameters.add(parameter);
        }
        return parameters;
      case CSharp4AST.FIXED_PARAMETER:
        String fixedParamName =
            walk(commonTreeNode.getFirstChildWithType(CSharp4AST.IDENTIFIER), parent, String.class);

        String fixedParamType =
            walk(commonTreeNode.getFirstChildWithType(CSharp4AST.TYPE), parent, String.class);
        if (fixedParamType != null) { // if not __arglist
          fixedParamType = KeyStringHelper.normalize(fixedParamType);
        } else {
          fixedParamType = fixedParamName;
        }

        return new ParameterInfo(fixedParamType, fixedParamName);
      case CSharp4AST.PARAMETER_ARRAY:
        String paramArrayName =
            walk(commonTreeNode.getFirstChildWithType(CSharp4AST.IDENTIFIER), parent, String.class);

        String paramArrayType =
            walk(commonTreeNode.getFirstChildWithType(CSharp4AST.TYPE), parent, String.class);
        paramArrayType = KeyStringHelper.normalize(paramArrayType);

        return new ParameterInfo(paramArrayType, paramArrayName);
      case CSharp4AST.FIELD_DECL:
        // do not process children of type TYPE
        for (int i = 0; i < commonTreeNode.getChildCount(); i++) {
          Tree child = commonTreeNode.getChild(i);
          if (child.getType() == CSharp4AST.VARIABLE_DECLARATOR) {
            walk(child, parent);
          }
        }
        break;
      case CSharp4AST.PROPERTY_DECL:
        FieldInfo propertyInfo = new FieldInfo(parent);

        String propertyName =
            walk(
                commonTreeNode.getFirstChildWithType(CSharp4AST.MEMBER_NAME), parent, String.class);
        if (propertyName != null) propertyInfo.setName(propertyName);

        String propertyType =
            walk(commonTreeNode.getFirstChildWithType(CSharp4AST.TYPE), parent, String.class);
        propertyInfo.setType(propertyType);

        parent.addFieldInfo(propertyInfo);

        addToReferences(propertyInfo);
        LOGGER.fine("LOAD PROPERTY: " + propertyInfo.getName());
        return propertyInfo;
      case CSharp4AST.VARIABLE_DECLARATOR:
        FieldInfo fieldInfo = new FieldInfo(parent);

        String fieldName =
            walk(commonTreeNode.getFirstChildWithType(CSharp4AST.IDENTIFIER), parent, String.class);
        if (fieldName != null) fieldInfo.setName(fieldName);

        String variableType =
            walk(commonTreeNode.getFirstChildWithType(CSharp4AST.TYPE), parent, String.class);
        fieldInfo.setType(variableType);

        parent.addFieldInfo(fieldInfo);

        addToReferences(fieldInfo);
        return fieldInfo;
      case CSharp4AST.ENUM_MEMBER_DECLARATION:
        LOGGER.warning("UNSUPPORTED: enum member declarations are not yet supported.");
        break;
      case CSharp4AST.TYPE:
        StringBuilder builder = new StringBuilder();
        Tree baseTypeNode = commonTreeNode.getChild(0);

        switch (baseTypeNode.getType()) {
          case CSharp4AST.NAMESPACE_OR_TYPE_NAME:
            String qualifiedBaseType = walk(baseTypeNode, parent, String.class);
            builder.append(qualifiedBaseType);
            break;
          default: // OBJECT, STRING, VOID, IDENTIFIER(dynamic), and primitive
            // types
            builder.append(baseTypeNode.getText());
            break;
        }

        for (int i = 1; i < commonTreeNode.getChildCount(); i++) {
          Tree typeExtension = commonTreeNode.getChild(i);
          // INTERR, rank_specifier, STAR
          switch (typeExtension.getType()) {
            case CSharp4AST.INTERR:
              LOGGER.warning("UNSUPPORTED: INTERR is not yet supported");
              break;
            case CSharp4AST.RANK_SPECIFIER:
              builder.append("[");
              int numCommas = typeExtension.getChildCount();
              do {
                builder.append(",");
              } while (numCommas-- > 0);
              builder.append("]");
              break;
            case CSharp4AST.STAR:
              builder.append("*");
              break;
            default:
              break;
          }
        }

        return builder.toString();
      case CSharp4AST.NAMESPACE_OR_TYPE_NAME:
        builder = new StringBuilder();

        String nsIdentifier =
            walk(commonTreeNode.getFirstChildWithType(CSharp4AST.IDENTIFIER), parent, String.class);
        if (nsIdentifier != null) builder.append(nsIdentifier);

        List<String> qualified_alias_member =
            walk(
                commonTreeNode.getFirstChildWithType(CSharp4AST.QUALIFIED_ALIAS_MEMBER),
                parent,
                List.class);
        if (qualified_alias_member != null) {
          for (String qam : qualified_alias_member) {
            builder.append(".");
            builder.append(qam);
          }
        }

        for (int i = 1; i < node.getChildCount(); i++) {
          CommonTree child = (CommonTree) node.getChild(i);
          if (child.getType() == CSharp4AST.NAMESPACE_OR_TYPE_PART) {
            String nsPart =
                walk(child.getFirstChildWithType(CSharp4AST.IDENTIFIER), parent, String.class);
            builder.append(".");
            builder.append(nsPart);
          }
        }
        return builder.toString();
      case CSharp4AST.IDENTIFIER:
        return node.getText();
      default:
        return null;
    }
    return null;
  }