Input:
    public List<BpelProcess> markForDehydration(List<BpelProcess> runningProcesses) {
        ArrayList<BpelProcess> ripped = new ArrayList<BpelProcess>();
        if (_processMaxAge > 0) {
            long now = System.currentTimeMillis();
            for (BpelProcess process : runningProcesses) {
                if (now - process.getLastUsed() > _processMaxAge) {
                    ripped.add(process);
                }
            }
        }
        if (runningProcesses.size() - ripped.size() > _processMaxCount) {
            runningProcesses.removeAll(ripped);
            Collections.sort(runningProcesses, new Comparator<BpelProcess>() {
                public int compare(BpelProcess p1, BpelProcess p2) {
                    if (p1.getLastUsed() > p2.getLastUsed()) return 1;
                    if (p1.getLastUsed() < p2.getLastUsed()) return -1;
                    return 0;
                }
            });
            for (int m = _processMaxCount; m < runningProcesses.size(); m++) {
                ripped.add(runningProcesses.get(m));
            }
        }
        return ripped;
    }

Output:
    public List<BpelProcess> markForDehydration(List<BpelProcess> runningProcesses) {
        ArrayList<BpelProcess> ripped = new ArrayList<BpelProcess>();
        if (_processMaxAge > 0) {
            long now = System.currentTimeMillis();
            for (BpelProcess process : runningProcesses) {
                if (now - process.getLastUsed() > _processMaxAge) {
                    ripped.add(process);
                }
            }
        }
        if (runningProcesses.size() - ripped.size() > _processMaxCount) {
            runningProcesses.removeAll(ripped);
            Collections.sort(runningProcesses, new Comparator<BpelProcess>() {
                public int compare(BpelProcess p1, BpelProcess p2) {
                    if (p1.getLastUsed() > p2.getLastUsed()) return -1;
                    if (p1.getLastUsed() < p2.getLastUsed()) return 1;
                    return 0;
                }
            });
            for (int m = _processMaxCount; m < runningProcesses.size(); m++) {
                ripped.add(runningProcesses.get(m));
            }
        }
        return ripped;
    }


Input:
    private void goalie_movement() {
      int CAGE_RADIUS = 100;
      double ang = Util.datan2(getPuck(), GOAL_POSITION);
      ang = Util.clamp(-90,ang, 90);
      double heading = getTargetHeading();
      double newX = Util.clamp(GOAL_POSITION.getX() + 50, GOAL_POSITION.getX() + Math.cos(ang)*CAGE_RADIUS, 0);
      double newY = GOAL_POSITION.getY() + Math.sin(ang)*CAGE_RADIUS;
      if (newY > 0 && getPuck().getY() < 0) {
        newY = -newY;
      } else if (newY < 0 && getPuck().getY() > 0) {
        newY = -newY;
      }
      skate((int)newX, (int)newY, 100);
      turn(getPuck(), MAX_TURN_SPEED);
      setMessage(Double.toString(newX).substring(0,5) + " " + Double.toString(newY).substring(0, 5) + " " + Double.toString(ang));
    }

Output:
    private void goalie_movement() {
      int CAGE_RADIUS = 100;
      double ang = Util.datan2(getPuck(), GOAL_POSITION);
      ang = Util.clamp(-90,ang, 90);
      double heading = getTargetHeading();
      double newX = Util.clamp(GOAL_POSITION.getX() + 50, GOAL_POSITION.getX() + Math.cos(ang)*CAGE_RADIUS, 0);
      double newY = GOAL_POSITION.getY() + Math.sin(ang)*CAGE_RADIUS;
      if (newY > 0 && getPuck().getY() < 0) {
        newY = -newY;
      } else if (newY < 0 && getPuck().getY() > 0) {
        newY = -newY;
      }
      skate((int)newX, (int)newY, 100);
      turn(getPuck(), MAX_TURN_SPEED);
    }


Input:
    public void migrate()
        throws CvqException {
        for (DTO dto : (List<DTO>)HibernateUtil.getSession().createSQLQuery(
            "select r.requester_id as requesterId, r.home_folder_id as homeFolderId, r.creation_date as date, i.id as individualId from individual i, request r, history_entry he where r.id = he.request_id and i.id = he.object_id and property = 'homeFolder' and old_value is not null and new_value is null")
                .addScalar("requesterId").addScalar("homeFolderId").addScalar("date")
                .addScalar("individualId").setResultTransformer(Transformers.aliasToBean(DTO.class))
                .list()) {
            Individual i = userSearchService.getById(dto.individualId);
            HomeFolder homeFolder = userSearchService.getHomeFolderById(dto.homeFolderId);
            i.setHomeFolder(homeFolder);
            homeFolder.getIndividuals().add(i);
            i.setState(UserState.ARCHIVED);
            archived.add(i.getId());
            RequestAction fake = new RequestAction();
            fake.setDate(dto.date);
            fake.setAgentId(dto.requesterId);
            JsonObject payload = new JsonObject();
            payload.addProperty("state", UserState.ARCHIVED.toString());
            add(homeFolder, new UserAction(UserAction.Type.STATE_CHANGE, dto.individualId, payload), fake);
        }
        for (HomeFolder homeFolder : customDAO.all(HomeFolder.class)) {
            Set<Critere> criterias = new HashSet<Critere>();
            criterias.add(new Critere(Request.SEARCH_BY_HOME_FOLDER_ID, homeFolder.getId(), Critere.EQUALS));
            List<Request> requests = requestSearchService.get(criterias, null, null, 0, 0, true);
            Request first = requests.get(requests.size() - 1);
            if (homeFolder.isTemporary()) {
                List<RequestAction> actions = new ArrayList<RequestAction>(first.getActions());
                Collections.reverse(actions);
                for (RequestAction requestAction : actions) {
                    convert(requestAction);
                }
            } else {
                for (RequestAction requestAction :
                    (List<RequestAction>)HibernateUtil.getSession().createSQLQuery(
                        "select * from request_action where request_id in (select id from request where home_folder_id = :homeFolderId and specific_data_class='fr.cg95.cvq.business.request.ecitizen.HomeFolderModificationRequestData') or request_id = :firstId order by date asc")
                        .addEntity(RequestAction.class).setLong("homeFolderId", homeFolder.getId())
                        .setLong("firstId", first.getId()).list()) {
                    convert(requestAction);
                }
            }
        }
        HibernateUtil.getSession().flush();
        for (HomeFolder homeFolder : customDAO.all(HomeFolder.class)) {
            if (!customDAO.hasCreationAction(homeFolder.getId()))
                createFakeCreationAction(homeFolder, homeFolder.getId());
            for (Individual i : homeFolder.getIndividuals())
                if (!customDAO.hasCreationAction(i.getId()))
                    createFakeCreationAction(homeFolder, i.getId());
        }
        HibernateUtil.getSession().flush();
        for (Map.Entry<Long, Date> creationNotification : creationNotifications.entrySet()) {
            for (Long id : creationActions.get(creationNotification.getKey())) {
                UserAction action = (UserAction) customDAO.findById(UserAction.class, id);
                JsonObject payload = JSONUtils.deserialize(action.getData());
                payload.addProperty("notificationDate", creationNotification.getValue().toString());
                action.setData(new Gson().toJson(payload));
                customDAO.update(action);
            }
        }
        for (Long id : archived) {
            states.put(id, UserState.ARCHIVED);
        }
        for (Map.Entry<Long, UserState> state : states.entrySet()) {
            try {
                Individual i = userSearchService.getById(state.getKey());
                i.setState(state.getValue());
                customDAO.update(i);
            } catch (CvqObjectNotFoundException e) {
                HomeFolder homeFolder = userSearchService.getHomeFolderById(state.getKey());
                homeFolder.setState(state.getValue());
                customDAO.update(homeFolder);
            }
        }
        for (Adult external : customDAO.findBySimpleProperty(Adult.class, "homeFolder", null)) {
            HomeFolder homeFolder = null;
            for (IndividualRole role : (List<IndividualRole>) HibernateUtil.getSession()
                .createSQLQuery("select * from individual_role where owner_id = :id")
                .addEntity(IndividualRole.class).setLong("id", external.getId()).list()) {
                if (role.getHomeFolderId() != null) {
                    try {
                        homeFolder = userSearchService.getHomeFolderById(role.getHomeFolderId());
                    } catch (CvqObjectNotFoundException e) {
                    }
                } else if (role.getIndividualId() != null) {
                    try {
                        homeFolder = userSearchService.getById(role.getIndividualId()).getHomeFolder();
                    } catch (CvqObjectNotFoundException e) {
                    }
                }
                if (homeFolder != null) {
                    createFakeCreationAction(homeFolder, external.getId());
                    break;
                }
            }
        }
    }

Output:
    public void migrate()
        throws CvqException {
        for (DTO dto : (List<DTO>)HibernateUtil.getSession().createSQLQuery(
            "select r.requester_id as requesterId, r.home_folder_id as homeFolderId, r.creation_date as date, i.id as individualId from individual i, request r, history_entry he where r.id = he.request_id and i.id = he.object_id and property = 'homeFolder' and old_value is not null and new_value is null")
                .addScalar("requesterId").addScalar("homeFolderId").addScalar("date")
                .addScalar("individualId").setResultTransformer(Transformers.aliasToBean(DTO.class))
                .list()) {
            Individual i = userSearchService.getById(dto.individualId);
            HomeFolder homeFolder = userSearchService.getHomeFolderById(dto.homeFolderId);
            i.setHomeFolder(homeFolder);
            homeFolder.getIndividuals().add(i);
            i.setState(UserState.ARCHIVED);
            archived.add(i.getId());
            RequestAction fake = new RequestAction();
            fake.setDate(dto.date);
            fake.setAgentId(dto.requesterId);
            JsonObject payload = new JsonObject();
            payload.addProperty("state", UserState.ARCHIVED.toString());
            add(homeFolder, new UserAction(UserAction.Type.STATE_CHANGE, dto.individualId, payload), fake);
        }
        for (HomeFolder homeFolder : customDAO.all(HomeFolder.class)) {
            Set<Critere> criterias = new HashSet<Critere>();
            criterias.add(new Critere(Request.SEARCH_BY_HOME_FOLDER_ID, homeFolder.getId(), Critere.EQUALS));
            List<Request> requests = requestSearchService.get(criterias, Request.SEARCH_BY_CREATION_DATE, null, 0, 0, true);
            if (requests.isEmpty()) continue;
            Request first = requests.get(0);
            if (homeFolder.isTemporary()) {
                List<RequestAction> actions = new ArrayList<RequestAction>(first.getActions());
                Collections.reverse(actions);
                for (RequestAction requestAction : actions) {
                    convert(requestAction);
                }
            } else {
                for (RequestAction requestAction :
                    (List<RequestAction>)HibernateUtil.getSession().createSQLQuery(
                        "select * from request_action where request_id in (select id from request where home_folder_id = :homeFolderId and specific_data_class='fr.cg95.cvq.business.request.ecitizen.HomeFolderModificationRequestData') or request_id = :firstId order by date asc")
                        .addEntity(RequestAction.class).setLong("homeFolderId", homeFolder.getId())
                        .setLong("firstId", first.getId()).list()) {
                    convert(requestAction);
                }
            }
        }
        HibernateUtil.getSession().flush();
        for (HomeFolder homeFolder : customDAO.all(HomeFolder.class)) {
            if (!customDAO.hasCreationAction(homeFolder.getId()))
                createFakeCreationAction(homeFolder, homeFolder.getId());
            for (Individual i : homeFolder.getIndividuals())
                if (!customDAO.hasCreationAction(i.getId()))
                    createFakeCreationAction(homeFolder, i.getId());
        }
        HibernateUtil.getSession().flush();
        for (Map.Entry<Long, Date> creationNotification : creationNotifications.entrySet()) {
            for (Long id : creationActions.get(creationNotification.getKey())) {
                UserAction action = (UserAction) customDAO.findById(UserAction.class, id);
                JsonObject payload = JSONUtils.deserialize(action.getData());
                payload.addProperty("notificationDate", creationNotification.getValue().toString());
                action.setData(new Gson().toJson(payload));
                customDAO.update(action);
            }
        }
        for (Long id : archived) {
            states.put(id, UserState.ARCHIVED);
        }
        for (Map.Entry<Long, UserState> state : states.entrySet()) {
            try {
                Individual i = userSearchService.getById(state.getKey());
                i.setState(state.getValue());
                customDAO.update(i);
            } catch (CvqObjectNotFoundException e) {
                HomeFolder homeFolder = userSearchService.getHomeFolderById(state.getKey());
                homeFolder.setState(state.getValue());
                customDAO.update(homeFolder);
            }
        }
        for (Adult external : customDAO.findBySimpleProperty(Adult.class, "homeFolder", null)) {
            HomeFolder homeFolder = null;
            for (IndividualRole role : (List<IndividualRole>) HibernateUtil.getSession()
                .createSQLQuery("select * from individual_role where owner_id = :id")
                .addEntity(IndividualRole.class).setLong("id", external.getId()).list()) {
                if (role.getHomeFolderId() != null) {
                    try {
                        homeFolder = userSearchService.getHomeFolderById(role.getHomeFolderId());
                    } catch (CvqObjectNotFoundException e) {
                    }
                } else if (role.getIndividualId() != null) {
                    try {
                        homeFolder = userSearchService.getById(role.getIndividualId()).getHomeFolder();
                    } catch (CvqObjectNotFoundException e) {
                    }
                }
                if (homeFolder != null) {
                    createFakeCreationAction(homeFolder, external.getId());
                    break;
                }
            }
        }
    }


Input:
	public Object[][] getList()
	{
		int number = getNumberOfVehicles();
		int count = 0;
		Object[][] vehicleList = new Object[number][8];
		Connection conn = ConnectDB.initConn();
		try
		{
			Statement s = conn.createStatement();
			s.executeQuery("SELECT * FROM Customer");
			ResultSet rs = s.getResultSet();
			while(rs.next())
			{
				vehicleList[count][0] = rs.getString("vehicleID");
				vehicleList[count][1] = rs.getString("make");
				vehicleList[count][2] = rs.getString("model");
				vehicleList[count][3] = rs.getInt("odumeter");
				vehicleList[count][4] = rs.getInt("fuel");
				vehicleList[count][5] = rs.getInt("automatic");
				vehicleList[count][6] = rs.getInt("statusID");
				vehicleList[count][7] = rs.getInt("typeID");
				count++;
			}
			s.close();
		}
		catch (SQLException e)
		{
			e.printStackTrace();
		}
		finally
		{
			ConnectDB.closeConn(conn);
		}
		return vehicleList;
	}

Output:
	public Object[][] getList()
	{
		int number = getNumberOfVehicles();
		int count = 0;
		Object[][] vehicleList = new Object[number][8];
		Connection conn = ConnectDB.initConn();
		try
		{
			Statement s = conn.createStatement();
			s.executeQuery("SELECT * FROM Vehicle");
			ResultSet rs = s.getResultSet();
			while(rs.next())
			{
				vehicleList[count][0] = rs.getString("vehicleID");
				vehicleList[count][1] = rs.getString("make");
				vehicleList[count][2] = rs.getString("model");
				vehicleList[count][3] = rs.getInt("odumeter");
				vehicleList[count][4] = rs.getInt("fuel");
				vehicleList[count][5] = rs.getInt("automatic");
				vehicleList[count][6] = rs.getInt("statusID");
				vehicleList[count][7] = rs.getInt("typeID");
				count++;
			}
			s.close();
		}
		catch (SQLException e)
		{
			e.printStackTrace();
		}
		finally
		{
			ConnectDB.closeConn(conn);
		}
		return vehicleList;
	}


Input:
	private static void getExtensionClassesAndNames(Map exts, Set exts_names) {
		String version = GL11.glGetString(GL11.GL_VERSION);
		int majorEnd = version.indexOf('.');
		int minorEnd = version.indexOf('.', majorEnd + 1);
		int majorVersion = Integer.parseInt(version.substring(0, majorEnd));
		int minorVersion = Integer.parseInt(version.substring(majorEnd + 1, minorEnd));
		if ( majorVersion == 2 ) {
			addExtensionClass(exts, exts_names, "GL20", "OpenGL20");
			addExtensionClass(exts, exts_names, "GL15", "OpenGL15");
			addExtensionClass(exts, exts_names, "GL14", "OpenGL14");
			addExtensionClass(exts, exts_names, "GL13", "OpenGL13");
			addExtensionClass(exts, exts_names, "GL12", "OpenGL12");
		} else {
			switch ( minorVersion ) {
				case 5:
					addExtensionClass(exts, exts_names, "GL15", "OpenGL15");
				case 4:
					addExtensionClass(exts, exts_names, "GL14", "OpenGL14");
				case 3:
					addExtensionClass(exts, exts_names, "GL13", "OpenGL13");
				case 2:
					addExtensionClass(exts, exts_names, "GL12", "OpenGL12");
			}
		}
		addExtensionClass(exts, exts_names, "EXTTextureCompressionS3TC", "");
		String extensions_string = GL11.glGetString(GL11.GL_EXTENSIONS);
		StringTokenizer tokenizer = new StringTokenizer(extensions_string);
		while ( tokenizer.hasMoreTokens() ) {
			String extension_string = tokenizer.nextToken();
			StringBuffer converted_name = new StringBuffer();
			int gl_prefix_index = extension_string.indexOf("GL_");
			if ( gl_prefix_index == -1 )
				continue;
			if ( "GL_EXT_texture_compression_s3tc".equals(extension_string) ) {
				addExtensionClass(exts, exts_names, "EXTTextureCompressionS3TC", "GL_EXT_texture_compression_s3tc");
			} else if ( "GL_EXT_texture_lod_bias".equals(extension_string) ) {
				addExtensionClass(exts, exts_names, "EXTTextureLODBias", "GL_EXT_texture_lod_bias");
			} else if ( "GL_NV_texture_compression_vtc".equals(extension_string) ) {
				addExtensionClass(exts, exts_names, "NVTextureCompressionVTC", "GL_NV_texture_compression_vtc");
			} else {
				for ( int i = gl_prefix_index + 3; i < extension_string.length(); i++ ) {
					char c;
					if ( extension_string.charAt(i) == '_' ) {
						i++;
						c = Character.toUpperCase(extension_string.charAt(i));
					} else
						c = extension_string.charAt(i);
					converted_name.append(c);
				}
				addExtensionClass(exts, exts_names, converted_name.toString(), extension_string);
			}
		}
		addExtensionClass(exts, exts_names, "ARBBufferObject", null);
		addExtensionClass(exts, exts_names, "ARBProgram", null);
		addExtensionClass(exts, exts_names, "NVProgram", null);
	}

Output:
	private static void getExtensionClassesAndNames(Map exts, Set exts_names) {
		String version = GL11.glGetString(GL11.GL_VERSION);
		int majorEnd = version.indexOf('.');
		int minorEnd = -1;
		if (majorEnd != -1) {
			minorEnd = version.indexOf('.', majorEnd + 1);
		} else {
			majorEnd = version.length();
		}
		int majorVersion;
		if (majorEnd == 0) {
			throw new OpenGLException("Unable to determine GL version.");
		}
		majorVersion = Integer.parseInt(version.substring(0, majorEnd));
		int minorVersion;
		if (minorEnd == -1) {
			minorVersion = 0;
		} else {
			minorVersion = Integer.parseInt(version.substring(majorEnd + 1, minorEnd));
		}
		if ( majorVersion == 2 ) {
			addExtensionClass(exts, exts_names, "GL20", "OpenGL20");
			addExtensionClass(exts, exts_names, "GL15", "OpenGL15");
			addExtensionClass(exts, exts_names, "GL14", "OpenGL14");
			addExtensionClass(exts, exts_names, "GL13", "OpenGL13");
			addExtensionClass(exts, exts_names, "GL12", "OpenGL12");
		} else {
			switch ( minorVersion ) {
				case 5:
					addExtensionClass(exts, exts_names, "GL15", "OpenGL15");
				case 4:
					addExtensionClass(exts, exts_names, "GL14", "OpenGL14");
				case 3:
					addExtensionClass(exts, exts_names, "GL13", "OpenGL13");
				case 2:
					addExtensionClass(exts, exts_names, "GL12", "OpenGL12");
			}
		}
		addExtensionClass(exts, exts_names, "EXTTextureCompressionS3TC", "");
		String extensions_string = GL11.glGetString(GL11.GL_EXTENSIONS);
		StringTokenizer tokenizer = new StringTokenizer(extensions_string);
		while ( tokenizer.hasMoreTokens() ) {
			String extension_string = tokenizer.nextToken();
			StringBuffer converted_name = new StringBuffer();
			int gl_prefix_index = extension_string.indexOf("GL_");
			if ( gl_prefix_index == -1 )
				continue;
			if ( "GL_EXT_texture_compression_s3tc".equals(extension_string) ) {
				addExtensionClass(exts, exts_names, "EXTTextureCompressionS3TC", "GL_EXT_texture_compression_s3tc");
			} else if ( "GL_EXT_texture_lod_bias".equals(extension_string) ) {
				addExtensionClass(exts, exts_names, "EXTTextureLODBias", "GL_EXT_texture_lod_bias");
			} else if ( "GL_NV_texture_compression_vtc".equals(extension_string) ) {
				addExtensionClass(exts, exts_names, "NVTextureCompressionVTC", "GL_NV_texture_compression_vtc");
			} else {
				for ( int i = gl_prefix_index + 3; i < extension_string.length(); i++ ) {
					char c;
					if ( extension_string.charAt(i) == '_' ) {
						i++;
						c = Character.toUpperCase(extension_string.charAt(i));
					} else
						c = extension_string.charAt(i);
					converted_name.append(c);
				}
				addExtensionClass(exts, exts_names, converted_name.toString(), extension_string);
			}
		}
		addExtensionClass(exts, exts_names, "ARBBufferObject", null);
		addExtensionClass(exts, exts_names, "ARBProgram", null);
		addExtensionClass(exts, exts_names, "NVProgram", null);
	}


Input:
    public List<MinecraftJar> getJars() {
        File base = new File(getMinecraftDir(), "bin");
        List<MinecraftJar> jars = new ArrayList<MinecraftJar>();
        jars.add(new MinecraftJar(new File(base, "minecraft.jar")));
        File[] files = base.listFiles();
        Arrays.sort(files);
        if (files == null) {
            return jars;
        }
        for (File f : files) {
            String name = f.getName();
            if (name.matches("^[^\\/:;]+\\.jar$") && !name.equalsIgnoreCase("jinput.jar")
                    && !name.equalsIgnoreCase("lwjgl.jar")
                    && !name.equalsIgnoreCase("lwjgl_util.jar")
                    && !name.equalsIgnoreCase("minecraft.jar")) {
                jars.add(new MinecraftJar(f));
            }
        }
        return jars;
    }

Output:
    public List<MinecraftJar> getJars() {
        File base = new File(getMinecraftDir(), "bin");
        List<MinecraftJar> jars = new ArrayList<MinecraftJar>();
        jars.add(new MinecraftJar(new File(base, "minecraft.jar")));
        File[] files = base.listFiles();
        if (files == null) {
            return jars;
        }
        Arrays.sort(files);
        for (File f : files) {
            String name = f.getName();
            if (name.matches("^[^\\/:;]+\\.jar$") && !name.equalsIgnoreCase("jinput.jar")
                    && !name.equalsIgnoreCase("lwjgl.jar")
                    && !name.equalsIgnoreCase("lwjgl_util.jar")
                    && !name.equalsIgnoreCase("minecraft.jar")) {
                jars.add(new MinecraftJar(f));
            }
        }
        return jars;
    }


Input:
   public void keyPressed(KeyEvent e) {
      float cx, cy;
      switch (e.getKeyCode()) {
      case KeyEvent.VK_MINUS:
         cx = view.getCenterX();
         cy = view.getCenterY();
         view.setWidth((int)(view.getWidth() / 1.1));
         view.setHeight((int)(view.getHeight() / 1.1));
         view.setCenterPosition(cx, cy);
         break;
      case KeyEvent.VK_EQUALS:
         cx = view.getCenterX();
         cy = view.getCenterY();
         view.setWidth((int)(view.getWidth() * 1.1));
         view.setHeight((int)(view.getHeight() * 1.1));
         view.setCenterPosition(cx, cy);
         break;
      case KeyEvent.VK_1:
         loadModel("models/beagle/Bug Hunt Speeds.nlogo", "Bug Hunt Speeds");
         break;
      case KeyEvent.VK_2:
         loadModel("models/virus.nlogo", "Disease Model");
         break;
      case KeyEvent.VK_3:
         loadModel("models/fireflies.nlogo", "Fireflies");
         break;
      case KeyEvent.VK_4:
         loadModel("models/flocking.nlogo", "Flocking");
         break;
      case KeyEvent.VK_5:
         loadModel("models/traffic.nlogo", "Traffic");
         break;
      case KeyEvent.VK_6:
         loadModel("models/moths.nlogo", "Moths");
         break;
      case KeyEvent.VK_RIGHT:
         break;
      case KeyEvent.VK_LEFT:
         break;
      case KeyEvent.VK_UP:
         break;
      case KeyEvent.VK_DOWN:
         break;
      }
   }

Output:
   public void keyPressed(KeyEvent e) {
      float cx, cy;
      switch (e.getKeyCode()) {
      case KeyEvent.VK_MINUS:
         cx = view.getCenterX();
         cy = view.getCenterY();
         view.setWidth((int)(view.getWidth() / 1.1));
         view.setHeight((int)(view.getHeight() / 1.1));
         view.setCenterPosition(cx, cy);
         break;
      case KeyEvent.VK_EQUALS:
         cx = view.getCenterX();
         cy = view.getCenterY();
         view.setWidth((int)(view.getWidth() * 1.1));
         view.setHeight((int)(view.getHeight() * 1.1));
         view.setCenterPosition(cx, cy);
         break;
      case KeyEvent.VK_1:
         loadModel("models/beagle/Bug Hunt Speeds.nlogo", "Bug Hunt Speeds");
         break;
      case KeyEvent.VK_2:
         loadModel("models/beagle/Bug Hunt Camouflage.nlogo", "Bug Hunt Camouflage");
         break;
      case KeyEvent.VK_3:
         loadModel("models/fireflies.nlogo", "Fireflies");
         break;
      case KeyEvent.VK_4:
         loadModel("models/flocking.nlogo", "Flocking");
         break;
      case KeyEvent.VK_5:
         loadModel("models/traffic.nlogo", "Traffic");
         break;
      case KeyEvent.VK_6:
         loadModel("models/moths.nlogo", "Moths");
         break;
      case KeyEvent.VK_RIGHT:
         break;
      case KeyEvent.VK_LEFT:
         break;
      case KeyEvent.VK_UP:
         break;
      case KeyEvent.VK_DOWN:
         break;
      }
   }


Input:
public void report(HttpServletRequest req, HttpServletResponse res, Throwable t)
	{
		String headInclude = (String) req.getAttribute("sakai.html.head");
		String bodyOnload = (String) req.getAttribute("sakai.html.body.onload");
		Time reportTime = TimeService.newTime();
		String time = reportTime.toStringLocalDate() + " "
				+ reportTime.toStringLocalTime24();
		String usageSessionId = UsageSessionService.getSessionId();
		String userId = SessionManager.getCurrentSessionUserId();
		String requestDisplay = requestDisplay(req);
		String placementDisplay = placementDisplay();
		String problem = throwableDisplay(t);
		String problemdigest = computeSha1(problem);
		String postAddr = ServerConfigurationService.getPortalUrl() + "/error-report";
		String requestURI = req.getRequestURI();
		if (bodyOnload == null)
		{
			bodyOnload = "";
		}
		else
		{
			bodyOnload = " onload=\"" + bodyOnload + "\"";
		}
		try
		{
			res.setContentType("text/html; charset=UTF-8");
			res.addDateHeader("Expires", System.currentTimeMillis()
					- (1000L * 60L * 60L * 24L * 365L));
			res.addDateHeader("Last-Modified", System.currentTimeMillis());
			res
					.addHeader("Cache-Control",
							"no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0");
			res.addHeader("Pragma", "no-cache");
			PrintWriter out = res.getWriter();
			out
					.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
			out
					.println("");
			if (headInclude != null)
			{
				out.println("");
				out.println(headInclude);
				out.println("");
			}
			out.println("");
			out.println("
");
			out.println("
" + rb.getString("bugreport.error") + "
");
			out.println("
" + rb.getString("bugreport.statement") + "

");
			out.println("
" + rb.getString("bugreport.sendtitle") + "
");
			out.println("
" + rb.getString("bugreport.sendinstructions") + "
");
			out.println("<form action=\"" + postAddr + "\" method=\"POST\">");
			out.println("<input type=\"hidden\" name=\"problem\" value=\"");
			out.println(FormattedText.escapeHtml(problem, false));
			out.println("\">");
			out.println("<input type=\"hidden\" name=\"problemRequest\" value=\"");
			out.println(FormattedText.escapeHtml(requestDisplay, false));
			out.println("\">");
			out.println("<input type=\"hidden\" name=\"problemPlacement\" value=\"");
			out.println(FormattedText.escapeHtml(placementDisplay, false));
			out.println("\">");
			out.println("<input type=\"hidden\" name=\"problemdigest\" value=\""
					+ FormattedText.escapeHtml(problemdigest, false) + "\">");
			out.println("<input type=\"hidden\" name=\"session\" value=\""
					+ FormattedText.escapeHtml(usageSessionId, false) + "\">");
			out.println("<input type=\"hidden\" name=\"user\" value=\""
					+ FormattedText.escapeHtml(userId, false) + "\">");
			out.println("<input type=\"hidden\" name=\"time\" value=\""
					+ FormattedText.escapeHtml(time, false) + "\">");
			out
					.println("
");
			out.println("
");
			out.println("
");
			out
					.println("<textarea rows=\"10\" cols=\"60\" name=\"comment\"></textarea>	");
			out.println("
");
			out.println("
");
			out.println("
");
			out.println("
");
			out.println("<input type=\"submit\" value=\""
					+ rb.getString("bugreport.sendsubmit") + "\">");
			out.println("
");
			out.println("</form>
");
			out.println("
" + rb.getString("bugreport.recoverytitle") + "
");
			out.println("
" + rb.getString("bugreport.recoveryinstructions") + "");
			out.println("

" + rb.getString("bugreport.recoveryinstructions1")
					+ "
");
			out.println("
" + rb.getString("bugreport.recoveryinstructions2")
					+ "
");
			out.println("
" + rb.getString("bugreport.recoveryinstructions3")
					+ "

");
			out.println("
" + rb.getString("bugreport.detailstitle") + "
");
			out.println("
" + rb.getString("bugreport.detailsnote") + "
");
			out.println("

");
			out.println(FormattedText.escapeHtml(problem, false));
			out.println();
			out.println(rb.getString("bugreport.user") + ": "
					+ FormattedText.escapeHtml(userId, false) + "\n");
			out.println(rb.getString("bugreport.usagesession") + ": "
					+ FormattedText.escapeHtml(usageSessionId, false) + "\n");
			out.println(rb.getString("bugreport.time") + ": "
					+ FormattedText.escapeHtml(time, false) + "\n");
			out.println("

");
			out.println("");
			out.println("");
			logAndMail(usageSessionId, userId, time, problem, problemdigest, requestURI,
					requestDisplay, placementDisplay, null);
		}
		catch (Throwable any)
		{
			M_log.warn(rb.getString("bugreport.troublereporting"), any);
		}
	}

Output:
	public void report(HttpServletRequest req, HttpServletResponse res, Throwable t)
	{
		String headInclude = (String) req.getAttribute("sakai.html.head");
		String bodyOnload = (String) req.getAttribute("sakai.html.body.onload");
		Time reportTime = TimeService.newTime();
		String time = reportTime.toStringLocalDate() + " "
				+ reportTime.toStringLocalTime24();
		String usageSessionId = UsageSessionService.getSessionId();
		String userId = SessionManager.getCurrentSessionUserId();
		String requestDisplay = requestDisplay(req);
		String placementDisplay = placementDisplay();
		String problem = throwableDisplay(t);
		String problemdigest = computeSha1(problem);
		String postAddr = ServerConfigurationService.getPortalUrl() + "/error-report";
		String requestURI = req.getRequestURI();
		if (bodyOnload == null)
		{
			bodyOnload = "";
		}
		else
		{
			bodyOnload = " onload=\"" + bodyOnload + "\"";
		}
		try
		{
			res.setContentType("text/html; charset=UTF-8");
			res.addDateHeader("Expires", System.currentTimeMillis()
					- (1000L * 60L * 60L * 24L * 365L));
			res.addDateHeader("Last-Modified", System.currentTimeMillis());
			res
					.addHeader("Cache-Control",
							"no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0");
			res.addHeader("Pragma", "no-cache");
			PrintWriter out = null;
			try {
				out = res.getWriter();
			} catch (Exception ex ) {
				out = new PrintWriter(res.getOutputStream());
			}
			out
					.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
			out
					.println("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">");
			if (headInclude != null)
			{
				out.println("<head>");
				out.println(headInclude);
				out.println("</head>");
			}
			out.println("<body" + bodyOnload + ">");
			out.println("<div class=\"portletBody\">");
			out.println("<h3>" + rb.getString("bugreport.error") + "</h3>");
			out.println("<p>" + rb.getString("bugreport.statement") + "<br /><br /></p>");
			out.println("<h4>" + rb.getString("bugreport.sendtitle") + "</h4>");
			out.println("<p>" + rb.getString("bugreport.sendinstructions") + "</p>");
			out.println("<form action=\"" + postAddr + "\" method=\"POST\">");
			out.println("<input type=\"hidden\" name=\"problem\" value=\"");
			out.println(FormattedText.escapeHtml(problem, false));
			out.println("\">");
			out.println("<input type=\"hidden\" name=\"problemRequest\" value=\"");
			out.println(FormattedText.escapeHtml(requestDisplay, false));
			out.println("\">");
			out.println("<input type=\"hidden\" name=\"problemPlacement\" value=\"");
			out.println(FormattedText.escapeHtml(placementDisplay, false));
			out.println("\">");
			out.println("<input type=\"hidden\" name=\"problemdigest\" value=\""
					+ FormattedText.escapeHtml(problemdigest, false) + "\">");
			out.println("<input type=\"hidden\" name=\"session\" value=\""
					+ FormattedText.escapeHtml(usageSessionId, false) + "\">");
			out.println("<input type=\"hidden\" name=\"user\" value=\""
					+ FormattedText.escapeHtml(userId, false) + "\">");
			out.println("<input type=\"hidden\" name=\"time\" value=\""
					+ FormattedText.escapeHtml(time, false) + "\">");
			out
					.println("<table class=\"itemSummary\" cellspacing=\"5\" cellpadding=\"5\">");
			out.println("<tbody>");
			out.println("<tr>");
			out
					.println("<td><textarea rows=\"10\" cols=\"60\" name=\"comment\"></textarea></td>");
			out.println("</tr>");
			out.println("</tbody>");
			out.println("</table>");
			out.println("<div class=\"act\">");
			out.println("<input type=\"submit\" value=\""
					+ rb.getString("bugreport.sendsubmit") + "\">");
			out.println("</div>");
			out.println("</form><br />");
			out.println("<h4>" + rb.getString("bugreport.recoverytitle") + "</h4>");
			out.println("<p>" + rb.getString("bugreport.recoveryinstructions") + "");
			out.println("<ul><li>" + rb.getString("bugreport.recoveryinstructions1")
					+ "</li>");
			out.println("<li>" + rb.getString("bugreport.recoveryinstructions2")
					+ "</li>");
			out.println("<li>" + rb.getString("bugreport.recoveryinstructions3")
					+ "</li></ul><br /><br /></p>");
			out.println("<h4>" + rb.getString("bugreport.detailstitle") + "</h4>");
			out.println("<p>" + rb.getString("bugreport.detailsnote") + "</p>");
			out.println("<p><pre>");
			out.println(FormattedText.escapeHtml(problem, false));
			out.println();
			out.println(rb.getString("bugreport.user") + ": "
					+ FormattedText.escapeHtml(userId, false) + "\n");
			out.println(rb.getString("bugreport.usagesession") + ": "
					+ FormattedText.escapeHtml(usageSessionId, false) + "\n");
			out.println(rb.getString("bugreport.time") + ": "
					+ FormattedText.escapeHtml(time, false) + "\n");
			out.println("</pre></p>");
			out.println("</body>");
			out.println("</html>");
			logAndMail(usageSessionId, userId, time, problem, problemdigest, requestURI,
					requestDisplay, placementDisplay, null);
		}
		catch (Throwable any)
		{
			M_log.warn(rb.getString("bugreport.troublereporting"), any);
		}
	}


Input:
	public void loadDatabase() {
		String DBType = getConfig().getString("database.type");
		Statement stmt;
		try {
			if(DBType.equalsIgnoreCase("mysql")) {
		    	conn = DatabaseSettings.getConnection(this);
		    	stmt = conn.createStatement();
				stmt.executeUpdate(getResourceContent("MySQL/blocklog_blocks.sql"));
				stmt.executeUpdate(getResourceContent("MySQL/blocklog_rollbacks.sql"));
				stmt.executeUpdate(getResourceContent("MySQL/blocklog_interactions.sql"));
			} else if(DBType.equalsIgnoreCase("sqlite")) {
			    conn = DatabaseSettings.getConnection(this);
			    stmt = conn.createStatement();
				stmt.executeUpdate(getResourceContent("SQLite/blocklog_blocks.sql"));
				stmt.executeUpdate(getResourceContent("SQLite/blocklog_rollbacks.sql"));
				stmt.executeUpdate(getResourceContent("SQLite/blocklog_interactions.sql"));
		    }
		} catch (SQLException e) {
			e.printStackTrace();
		}
		try {
			if(DBType.equalsIgnoreCase("mysql")) {
		    	conn = DatabaseSettings.getConnection(this);
		    	stmt = conn.createStatement();
		    	stmt.executeUpdate("ALTER TABLE `blocklog_blocks` ADD `datavalue` INT(11) NOT NULL AFTER `block_id`");
			} else if(DBType.equalsIgnoreCase("sqlite")) {
			    conn = DatabaseSettings.getConnection(this);
			    stmt = conn.createStatement();
			    stmt.executeUpdate("ALTER TABLE 'blocklog_blocks' ADD 'datavalue' INTEGER NOT NULL AFTER 'block_id'");
		    }
		} catch (SQLException e) {
		}
	}

Output:
	public void loadDatabase() {
		String DBType = getConfig().getString("database.type");
		Statement stmt;
		try {
			if(DBType.equalsIgnoreCase("mysql")) {
		    	conn = DatabaseSettings.getConnection(this);
		    	stmt = conn.createStatement();
				stmt.executeUpdate(getResourceContent("MySQL/blocklog_blocks.sql"));
				stmt.executeUpdate(getResourceContent("MySQL/blocklog_rollbacks.sql"));
				stmt.executeUpdate(getResourceContent("MySQL/blocklog_interactions.sql"));
			} else if(DBType.equalsIgnoreCase("sqlite")) {
			    conn = DatabaseSettings.getConnection(this);
			    stmt = conn.createStatement();
				stmt.executeUpdate(getResourceContent("SQLite/blocklog_blocks.sql"));
				stmt.executeUpdate(getResourceContent("SQLite/blocklog_rollbacks.sql"));
				stmt.executeUpdate(getResourceContent("SQLite/blocklog_interactions.sql"));
		    }
		} catch (SQLException e) {
			e.printStackTrace();
		}
		try {
			if(DBType.equalsIgnoreCase("mysql")) {
		    	conn = DatabaseSettings.getConnection(this);
		    	stmt = conn.createStatement();
		    	stmt.executeUpdate("ALTER TABLE `blocklog_blocks` ADD `datavalue` INT(11) NOT NULL AFTER `block_id`");
			} else if(DBType.equalsIgnoreCase("sqlite")) {
			    conn = DatabaseSettings.getConnection(this);
			    stmt = conn.createStatement();
			    stmt.executeUpdate("ALTER TABLE 'blocklog_blocks' ADD COLUMN 'datavalue' INTEGER NOT NULL DEFAULT '0'");
		    }
		} catch (SQLException e) {
		}
	}


Input:
	protected void execute()
	{
		Thread.currentThread().setName(getClass().getSimpleName() + "@" + mNode);
		Logging.warn(this, "Main loop started");
		mHRMTestAppRunning = true;
		try {
			Thread.sleep(10000);
		} catch (InterruptedException tExc) {
		}
		while((mHRMTestAppNeeded) & (!GLOBAL_ERROR)){
			mSource.clear();
			mDestination.clear();
			mDataRates.clear();
			int tSourceNodeNumber = 0;
			int tDestinationNodeNumber = 0;
			for(int i = 0; i < NUMBER_NODE_COMBINATIONS; i++){
				tSourceNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
				Logging.warn(this, "Selected source node: " + tSourceNodeNumber);
				tDestinationNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
				Logging.warn(this, "Selected destination node: " + tDestinationNodeNumber);
				while(tSourceNodeNumber == tDestinationNodeNumber){
					tDestinationNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
					Logging.warn(this, "Selected destination node: " + tDestinationNodeNumber);
				}
				mSource.add(mGlobalNodeList.get(tSourceNodeNumber));
				mDestination.add(mGlobalNodeList.get(tDestinationNodeNumber));
				mDataRates.add((int)(mRandom.nextFloat() * MAX_DATA_RATE_PER_CONNECTION));
			}
			tSourceNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
			tDestinationNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
			Logging.warn(this, "Selected REF destination node: " + tDestinationNodeNumber);
			while(tSourceNodeNumber == tDestinationNodeNumber){
				tDestinationNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
				Logging.warn(this, "Selected REF destination node: " + tDestinationNodeNumber);
			}
			mRefSource = mGlobalNodeList.get(tSourceNodeNumber);
			mRefDestination = mGlobalNodeList.get(tDestinationNodeNumber);
			Logging.warn(this, "########## Creating QoS connections now...");
			HRMController.ENFORCE_BE_ROUTING = false;
			createConnections();
			Logging.warn(this, "########## Waiting for QoS connections now...");
			try {
				Thread.sleep(2000);
			} catch (InterruptedException tExc) {
			}
			int tHRMConnectionsWithFulfilledQoS = countConnectionsWithFulfilledQoS();
			LinkedList<Double> tStoredUtilBasedOnHRM = new LinkedList<Double>();
			for(int i = 0; i < mCntBuss; i++){
				Bus tBus = mGlobalBusList.get(i);
				Logging.warn(this, tBus + " (HRM)=> " + tBus.getUtilization());
				tStoredUtilBasedOnHRM.add(tBus.getUtilization());
			}
			Logging.warn(this, "########## Destroying QoS connections now...");
			resetAllConnetions();
			if(!GLOBAL_ERROR){
				Logging.warn(this, "########## Creating BE connections now...");
				HRMController.ENFORCE_BE_ROUTING = true;
				createConnections();
				Logging.warn(this, "########## Waiting for BE connections now...");
				try {
					Thread.sleep(2000);
				} catch (InterruptedException tExc) {
				}
				int tBEConnectionsWithFulfilledQoS = countConnectionsWithFulfilledQoS();
				LinkedList<Double> tStoredUtilBasedOnBE = new LinkedList<Double>();
				for(int i = 0; i < mCntBuss; i++){
					Bus tBus = mGlobalBusList.get(i);
					Logging.warn(this, tBus + " (BE)=> " + tBus.getUtilization());
					tStoredUtilBasedOnBE.add(tBus.getUtilization());
				}
				Logging.warn(this, "   ..HRM connections with fulfilled QoS: " + tHRMConnectionsWithFulfilledQoS);
				Logging.warn(this, "   ..BE connections with fulfilled QoS: " + tBEConnectionsWithFulfilledQoS);
				Logging.warn(this, "   ..HRM REF connections with fulfilled QoS: " + mRefHRMConnections);
				Logging.warn(this, "   ..BE REF connections with fulfilled QoS: " + mRefBEConnections);
				if(mTurn == 1){
					try {
						mStatistic = Statistic.getInstance(mLocalNodeAS.getSimulation(), HRMTestApp.class, ";", false);
					} catch (Exception tExc) {
						Logging.err(this, "Can not write statistic log file", tExc);
					}
					if(mStatistic != null){
						Runtime.getRuntime().addShutdownHook(new Thread() {
							@Override
							public void run()
							{
								Logging.getInstance().warn(this, "Closing HRMController statistics log file");
								mStatistic.close();
							}
						});
					}
					LinkedList<String> tTableHeader = new LinkedList<String>();
					tTableHeader.add("Turn");
					tTableHeader.add("Good HRM routing");
					tTableHeader.add("Good BE routing");
					tTableHeader.add("-");
					tTableHeader.add("Ref source");
					tTableHeader.add("Ref destination");
					tTableHeader.add("Good HRM Ref routing");
					tTableHeader.add("Good BE Ref routing");
					tTableHeader.add("-");
					tTableHeader.add("BusCounter");
					for(int i = 0; i < mCntBuss; i++){
						tTableHeader.add("HRM_" + mGlobalBusList.get(i).getName());
					}
					for(int i = 0; i < mCntBuss; i++){
						tTableHeader.add("BE_" + mGlobalBusList.get(i).getName());
					}
					if(mStatistic != null){
						mStatistic.log(tTableHeader);
					}
				}
				LinkedList<String> tTableRow = new LinkedList<String>();
				tTableRow.add(Integer.toString(mTurn));
				tTableRow.add(Integer.toString(tHRMConnectionsWithFulfilledQoS));
				tTableRow.add(Integer.toString(tBEConnectionsWithFulfilledQoS));
				tTableRow.add("-");
				tTableRow.add(mRefSource.toString());
				tTableRow.add(mRefDestination.toString());
				tTableRow.add(Integer.toString(mRefHRMConnections));
				tTableRow.add(Integer.toString(mRefBEConnections));
				tTableRow.add("-");
				tTableRow.add(Integer.toString(mCntBuss));
				for(int i = 0; i < mCntBuss; i++){
					DecimalFormat tFormat = new DecimalFormat("0.#");
					String tUtilizationStr = tFormat.format(tStoredUtilBasedOnHRM.get(i));
					tTableRow.add(tUtilizationStr);
				}
				for(int i = 0; i < mCntBuss; i++){
					DecimalFormat tFormat = new DecimalFormat("0.#");
					String tUtilizationStr = tFormat.format(tStoredUtilBasedOnBE.get(i));
					tTableRow.add(tUtilizationStr);
				}
				if(mStatistic != null){
					mStatistic.log(tTableRow);
					Logging.log(this, ">>>>>>>>>> Writing statistics to file..");
					mStatistic.flush();
				}
			}
			Logging.warn(this, "########## Destroying BE connections now...");
			resetAllConnetions();
			mTurn++;
			if(mTurn >= NUMBER_MEASUREMENT_TURNS){
				Logging.warn(this, "########## END OF MEASUREMENTS #########");
				break;
			}
			if(GLOBAL_ERROR){
				Logging.err(this, "########## GLOBAL ERROR - END OF MEASUREMENTS #########");
				break;
			}
		}
		Logging.log(this, "Main loop finished");
		mHRMTestAppRunning = false;
	}

Output:
	protected void execute()
	{
		Thread.currentThread().setName(getClass().getSimpleName() + "@" + mNode);
		Logging.warn(this, "Main loop started");
		mHRMTestAppRunning = true;
		try {
			Thread.sleep(10000);
		} catch (InterruptedException tExc) {
		}
		while((mHRMTestAppNeeded) & (!GLOBAL_ERROR)){
			mSource.clear();
			mDestination.clear();
			mDataRates.clear();
			int tSourceNodeNumber = 0;
			int tDestinationNodeNumber = 0;
			for(int i = 0; i < NUMBER_NODE_COMBINATIONS; i++){
				tSourceNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
				Logging.warn(this, "Selected source node: " + tSourceNodeNumber);
				tDestinationNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
				Logging.warn(this, "Selected destination node: " + tDestinationNodeNumber);
				while(tSourceNodeNumber == tDestinationNodeNumber){
					tDestinationNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
					Logging.warn(this, "Selected destination node: " + tDestinationNodeNumber);
				}
				mSource.add(mGlobalNodeList.get(tSourceNodeNumber));
				mDestination.add(mGlobalNodeList.get(tDestinationNodeNumber));
				mDataRates.add((int)(mRandom.nextFloat() * MAX_DATA_RATE_PER_CONNECTION));
			}
			tSourceNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
			tDestinationNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
			Logging.warn(this, "Selected REF destination node: " + tDestinationNodeNumber);
			while(tSourceNodeNumber == tDestinationNodeNumber){
				tDestinationNodeNumber = (int)(mRandom.nextFloat() * mCntNodes);
				Logging.warn(this, "Selected REF destination node: " + tDestinationNodeNumber);
			}
			mRefSource = mGlobalNodeList.get(tSourceNodeNumber);
			mRefDestination = mGlobalNodeList.get(tDestinationNodeNumber);
			Logging.warn(this, "########## Creating QoS connections now...");
			HRMController.ENFORCE_BE_ROUTING = false;
			createConnections();
			Logging.warn(this, "########## Waiting for QoS connections now...");
			try {
				Thread.sleep(2000);
			} catch (InterruptedException tExc) {
			}
			int tHRMConnectionsWithFulfilledQoS = countConnectionsWithFulfilledQoS();
			LinkedList<Double> tStoredUtilBasedOnHRM = new LinkedList<Double>();
			for(int i = 0; i < mCntBuss; i++){
				Bus tBus = mGlobalBusList.get(i);
				Logging.warn(this, tBus + " (HRM)=> " + tBus.getUtilization());
				tStoredUtilBasedOnHRM.add(tBus.getUtilization());
			}
			Logging.warn(this, "########## Destroying QoS connections now...");
			resetAllConnetions();
			if(!GLOBAL_ERROR){
				Logging.warn(this, "########## Creating BE connections now...");
				HRMController.ENFORCE_BE_ROUTING = true;
				createConnections();
				Logging.warn(this, "########## Waiting for BE connections now...");
				try {
					Thread.sleep(2000);
				} catch (InterruptedException tExc) {
				}
				int tBEConnectionsWithFulfilledQoS = countConnectionsWithFulfilledQoS();
				LinkedList<Double> tStoredUtilBasedOnBE = new LinkedList<Double>();
				for(int i = 0; i < mCntBuss; i++){
					Bus tBus = mGlobalBusList.get(i);
					Logging.warn(this, tBus + " (BE)=> " + tBus.getUtilization());
					tStoredUtilBasedOnBE.add(tBus.getUtilization());
				}
				Logging.warn(this, "   ..HRM connections with fulfilled QoS: " + tHRMConnectionsWithFulfilledQoS);
				Logging.warn(this, "   ..BE connections with fulfilled QoS: " + tBEConnectionsWithFulfilledQoS);
				Logging.warn(this, "   ..HRM REF connections with fulfilled QoS: " + mRefHRMConnections);
				Logging.warn(this, "   ..BE REF connections with fulfilled QoS: " + mRefBEConnections);
				if(mTurn == 1){
					try {
						mStatistic = Statistic.getInstance(mLocalNodeAS.getSimulation(), HRMTestApp.class, ";", false);
					} catch (Exception tExc) {
						Logging.err(this, "Can not write statistic log file", tExc);
					}
					if(mStatistic != null){
						Runtime.getRuntime().addShutdownHook(new Thread() {
							@Override
							public void run()
							{
								Logging.getInstance().warn(this, "Closing HRMController statistics log file");
								mStatistic.close();
							}
						});
					}
					LinkedList<String> tTableHeader = new LinkedList<String>();
					tTableHeader.add("Turn");
					tTableHeader.add("Good HRM routing");
					tTableHeader.add("Good BE routing");
					tTableHeader.add("-");
					tTableHeader.add("Ref source");
					tTableHeader.add("Ref destination");
					tTableHeader.add("Good HRM Ref routing");
					tTableHeader.add("Good BE Ref routing");
					tTableHeader.add("-");
					tTableHeader.add("BusCounter");
					for(int i = 0; i < mCntBuss; i++){
						tTableHeader.add("HRM_" + mGlobalBusList.get(i).getName());
					}
					for(int i = 0; i < mCntBuss; i++){
						tTableHeader.add("BE_" + mGlobalBusList.get(i).getName());
					}
					if(mStatistic != null){
						mStatistic.log(tTableHeader);
					}
				}
				LinkedList<String> tTableRow = new LinkedList<String>();
				tTableRow.add(Integer.toString(mTurn));
				tTableRow.add(Integer.toString(tHRMConnectionsWithFulfilledQoS));
				tTableRow.add(Integer.toString(tBEConnectionsWithFulfilledQoS));
				tTableRow.add("-");
				tTableRow.add(mRefSource.toString());
				tTableRow.add(mRefDestination.toString());
				tTableRow.add(Integer.toString(mRefHRMConnections));
				tTableRow.add(Integer.toString(mRefBEConnections));
				tTableRow.add("-");
				tTableRow.add(Integer.toString(mCntBuss));
				for(int i = 0; i < mCntBuss; i++){
					DecimalFormat tFormat = new DecimalFormat("0.#");
					String tUtilizationStr = tFormat.format(tStoredUtilBasedOnHRM.get(i));
					tTableRow.add(tUtilizationStr);
				}
				for(int i = 0; i < mCntBuss; i++){
					DecimalFormat tFormat = new DecimalFormat("0.#");
					String tUtilizationStr = tFormat.format(tStoredUtilBasedOnBE.get(i));
					tTableRow.add(tUtilizationStr);
				}
				if(mStatistic != null){
					mStatistic.log(tTableRow);
					Logging.log(this, ">>>>>>>>>> Writing statistics to file..");
					mStatistic.flush();
				}
			}
			Logging.warn(this, "########## Destroying BE connections now...");
			resetAllConnetions();
			mTurn++;
			if(mTurn > NUMBER_MEASUREMENT_TURNS){
				Logging.warn(this, "########## END OF MEASUREMENTS #########");
				break;
			}
			if(GLOBAL_ERROR){
				Logging.err(this, "########## GLOBAL ERROR - END OF MEASUREMENTS #########");
				break;
			}
		}
		Logging.log(this, "Main loop finished");
		mHRMTestAppRunning = false;
	}


Input:
  private void readEntry(int ent) {
    try {
      int te = entry[ent] * 4;
      System.out.println("Entry 0 = "+te);
      byte[] gridHeader = new byte[256];
      fn.seek(te);
      fn.readFully(gridHeader);
      McIDASGridDirectory mgd = new McIDASGridDirectory(gridHeader);
      System.out.println("grid header ="+mgd.toString());
      CoordinateSystem c = mgd.getCoordinateSystem();
      int rows = mgd.getRows();
      int cols = mgd.getColumns();
      System.out.println("# rows & cols = "+rows+" "+cols);
      double scale = mgd.getParamScale();
      System.out.println("param scale = "+scale+" gridType="+mgd.getGridType());
      double[] data = new double[rows*cols];
      int n = 0;
      for (int nc=0; nc<cols; nc++) {
        for (int nr=0; nr<rows; nr++) {
         int temp = fn.readInt();
         data[(rows-nr-1)*cols + nc] =
           (temp == McIDASUtil.MCMISSING)
             ? Double.NaN
             : ( (double) temp) / scale ;
        }
      }
      gridH = new ArrayList();
      gridD = new ArrayList();
      gridH.add(mgd);
      gridD.add(data);
    } catch (Exception esc) {System.out.println(esc);}
  }

Output:
  private void readEntry(int ent) {
    try {
      int te = entry[ent] * 4;
      System.out.println("Entry 0 = "+te);
      byte[] gridHeader = new byte[256];
      fn.seek(te);
      fn.readFully(gridHeader);
      McIDASGridDirectory mgd = new McIDASGridDirectory(gridHeader);
      System.out.println("grid header ="+mgd.toString());
      CoordinateSystem c = mgd.getCoordinateSystem();
      int rows = mgd.getRows();
      int cols = mgd.getColumns();
      System.out.println("# rows & cols = "+rows+" "+cols);
      double scale = mgd.getParamScale();
      double[] data = new double[rows*cols];
      int n = 0;
      for (int nc=0; nc<cols; nc++) {
        for (int nr=0; nr<rows; nr++) {
         int temp = fn.readInt();
         data[(rows-nr-1)*cols + nc] =
           (temp == McIDASUtil.MCMISSING)
             ? Double.NaN
             : ( (double) temp) / scale ;
        }
      }
      gridH = new ArrayList();
      gridD = new ArrayList();
      gridH.add(mgd);
      gridD.add(data);
    } catch (Exception esc) {System.out.println(esc);}
  }


Input:
public static Name
fromAddress(byte [] addr) {
	if (addr.length != 4 && addr.length != 16)
		throw new IllegalArgumentException("array must contain " +
						   "4 or 16 elements");
	StringBuffer sb = new StringBuffer();
	if (addr.length == 4) {
		for (int i = addr.length - 1; i >= 0; i--) {
			sb.append(addr[i] & 0xFF);
			if (i > 0)
				sb.append(".");
		}
	} else {
		int [] nibbles = new int[2];
		for (int i = addr.length - 1; i >= 0; i--) {
			nibbles[0] = (addr[i] & 0xFF) >> 4;
			nibbles[1] = (addr[i] & 0xFF) & 0xF;
			for (int j = nibbles.length - 1; j >= 0; j--) {
				sb.append(nibbles[j]);
				if (i > 0 || j > 0)
					sb.append(".");
			}
		}
	}
	try {
		return Name.fromString(sb.toString(), inaddr4);
	}
	catch (TextParseException e) {
		throw new IllegalStateException("name cannot be invalid");
	}
}

Output:
public static Name
fromAddress(byte [] addr) {
	if (addr.length != 4 && addr.length != 16)
		throw new IllegalArgumentException("array must contain " +
						   "4 or 16 elements");
	StringBuffer sb = new StringBuffer();
	if (addr.length == 4) {
		for (int i = addr.length - 1; i >= 0; i--) {
			sb.append(addr[i] & 0xFF);
			if (i > 0)
				sb.append(".");
		}
	} else {
		int [] nibbles = new int[2];
		for (int i = addr.length - 1; i >= 0; i--) {
			nibbles[0] = (addr[i] & 0xFF) >> 4;
			nibbles[1] = (addr[i] & 0xFF) & 0xF;
			for (int j = nibbles.length - 1; j >= 0; j--) {
				sb.append(Integer.toHexString(nibbles[j]));
				if (i > 0 || j > 0)
					sb.append(".");
			}
		}
	}
	try {
		if (addr.length == 4)
			return Name.fromString(sb.toString(), inaddr4);
		else
			return Name.fromString(sb.toString(), inaddr6);
	}
	catch (TextParseException e) {
		throw new IllegalStateException("name cannot be invalid");
	}
}


Input:
	public boolean isDateValid(int year, int month, int day, int hour, int minute)
	{
		if(hour == 0)
			hour = 24;
		else if(hour == 24)
			hour = 0;
		String date = String.valueOf(year)+"-"+String.valueOf(month)+"-"+String.valueOf(day)+"-"+String.valueOf(hour)+"-"+String.valueOf(minute);
		System.out.println("input: "+date);
		String DATE_FORMAT = "yyyy-MM-dd-kk-mm";
	        try {
	            DateFormat df = new SimpleDateFormat(DATE_FORMAT);
	            df.setLenient(false);
	            Date d = df.parse(date);
	            System.out.println("interpreted as: " + df.format(d));
	            return true;
	        } catch (ParseException e) {
	        	System.out.println("INVALID DATE! hilsen TimeService");
	            return false;
	        }
	}

Output:
	public boolean isDateValid(int year, int month, int day, int hour, int minute)
	{
		if(hour == 0)
			hour = 24;
		else if(hour == 24)
			return false;
		String date = String.valueOf(year)+"-"+String.valueOf(month)+"-"+String.valueOf(day)+"-"+String.valueOf(hour)+"-"+String.valueOf(minute);
		System.out.println("input: "+date);
		String DATE_FORMAT = "yyyy-MM-dd-kk-mm";
	        try {
	            DateFormat df = new SimpleDateFormat(DATE_FORMAT);
	            df.setLenient(false);
	            Date d = df.parse(date);
	            System.out.println("interpreted as: " + df.format(d));
	            return true;
	        } catch (ParseException e) {
	        	System.out.println("INVALID DATE! hilsen TimeService");
	            return false;
	        }
	}


Input:
	public boolean onKey(View v, int keycode, KeyEvent event) {
		if (keycode == KeyEvent.KEYCODE_ENTER && event.getAction()==KeyEvent.ACTION_UP) {
			tabCompletingInProgress=false;
			runOnUiThread(messageSender);
			return true;
		} else if((keycode == KeyEvent.KEYCODE_TAB || keycode == KeyEvent.KEYCODE_SEARCH) && event.getAction() == KeyEvent.ACTION_DOWN) {
			if (!enableTabComplete || nickCache == null) return true;
			String txt = inputBox.getText().toString();
			if (tabCompletingInProgress == false) {
				int currentPos = inputBox.getSelectionStart()-1;
				int start = currentPos;
				while(start>0 && txt.charAt(start) != ' ') start--;
				if (start>0) start++;
				String prefix = txt.substring(start, currentPos+1).toLowerCase();
				if (prefix.length()<2) {
					return true;
				}
				Vector<String> matches = new Vector<String>();
				for(String possible: nickCache) {
					String temp = possible.toLowerCase().trim();
					if (temp.startsWith(prefix)) {
						matches.add(possible.trim());
					}
				}
				if (matches.size() == 0) return true;
				tabCompletingInProgress = true;
				tabCompleteMatches = matches;
				tabCompleteCurrentIndex = 0;
				tabCompleteWordStart = start;
				tabCompleteWordEnd = currentPos;
			} else {
				tabCompleteWordEnd = tabCompleteWordStart + tabCompleteMatches.get(tabCompleteCurrentIndex).length()-1;
				tabCompleteCurrentIndex = (tabCompleteCurrentIndex+1)%tabCompleteMatches.size();
			}
			String newtext = txt.substring(0, tabCompleteWordStart) + tabCompleteMatches.get(tabCompleteCurrentIndex) + txt.substring(tabCompleteWordEnd+1);
			tabCompleteWordEnd = tabCompleteWordStart + tabCompleteMatches.get(tabCompleteCurrentIndex).length();
			inputBox.setText(newtext);
			inputBox.setSelection(tabCompleteWordEnd);
			return true;
		} else if(KeyEvent.isModifierKey(keycode) || keycode == KeyEvent.KEYCODE_TAB || keycode == KeyEvent.KEYCODE_SEARCH) {
			return true;
		}
		tabCompletingInProgress = false;
		return false;
	}

Output:
	public boolean onKey(View v, int keycode, KeyEvent event) {
		if (keycode == KeyEvent.KEYCODE_ENTER && event.getAction()==KeyEvent.ACTION_UP) {
			tabCompletingInProgress=false;
			runOnUiThread(messageSender);
			return true;
		} else if((keycode == KeyEvent.KEYCODE_TAB || keycode == KeyEvent.KEYCODE_SEARCH) && event.getAction() == KeyEvent.ACTION_DOWN) {
			if (!enableTabComplete || nickCache == null) return true;
			String txt = inputBox.getText().toString();
			if (tabCompletingInProgress == false) {
				int currentPos = inputBox.getSelectionStart()-1;
				int start = currentPos;
				while(start>0 && txt.charAt(start) != ' ') start--;
				if (start>0) start++;
				String prefix = txt.substring(start, currentPos+1).toLowerCase();
				if (prefix.length()<2) {
					return true;
				}
				Vector<String> matches = new Vector<String>();
				for(String possible: nickCache) {
					String temp = possible.toLowerCase().trim();
					if (temp.startsWith(prefix)) {
						matches.add(possible.trim());
					}
				}
				if (matches.size() == 0) return true;
				tabCompletingInProgress = true;
				tabCompleteMatches = matches;
				tabCompleteCurrentIndex = 0;
				tabCompleteWordStart = start;
				tabCompleteWordEnd = currentPos;
			} else {
				tabCompleteWordEnd = tabCompleteWordStart + tabCompleteMatches.get(tabCompleteCurrentIndex).length()-1;
				tabCompleteCurrentIndex = (tabCompleteCurrentIndex+1)%tabCompleteMatches.size();
			}
			String newtext = txt.substring(0, tabCompleteWordStart) + tabCompleteMatches.get(tabCompleteCurrentIndex) + txt.substring(tabCompleteWordEnd+1);
			tabCompleteWordEnd = tabCompleteWordStart + tabCompleteMatches.get(tabCompleteCurrentIndex).length();
			inputBox.setText(newtext);
			inputBox.setSelection(tabCompleteWordEnd);
			return true;
		} else if(KeyEvent.isModifierKey(keycode) || keycode == KeyEvent.KEYCODE_TAB || keycode == KeyEvent.KEYCODE_SEARCH) {
			return false;
		}
		tabCompletingInProgress = false;
		return false;
	}


Input:
	private static IJavaSourceLocation getArchiveSourceLocation(IRuntimeClasspathEntry entry) {
		IResource resource = entry.getResource();
		if (resource == null) {
			IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
			try {
				IJavaProject[] jps = model.getJavaProjects();
				for (int i = 0; i < jps.length; i++) {
					IPackageFragmentRoot[] allRoots = jps[i].getPackageFragmentRoots();
					for (int j = 0; j < allRoots.length; j++) {
						IPackageFragmentRoot root = allRoots[j];
						if (root.isExternal() && root.getPath().equals(new Path(entry.getLocation()))) {
							if (isSourceAttachmentEqual(root, entry)) {
								return new PackageFragmentRootSourceLocation(root);
							}
						}
					}
				}
			} catch (JavaModelException e) {
				LaunchingPlugin.log(e);
			}
		} else {
			IProject project = resource.getProject();
			IJavaProject jp = JavaCore.create(project);
			try {
				if (jp.exists()) {
					IPackageFragmentRoot root = jp.getPackageFragmentRoot(resource);
					IPackageFragmentRoot[] allRoots = jp.getPackageFragmentRoots();
					for (int j = 0; j < allRoots.length; j++) {
						if (allRoots[j].equals(root)) {
							if (isSourceAttachmentEqual(root, entry)) {
								return new PackageFragmentRootSourceLocation(root);
							}
						}
					}
				}
				IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
				IJavaProject[] jps = model.getJavaProjects();
				for (int i = 0; i < jps.length; i++) {
					IPackageFragmentRoot[] allRoots = jps[i].getPackageFragmentRoots();
					for (int j = 0; j < allRoots.length; j++) {
						IPackageFragmentRoot root = allRoots[j];
						if (!root.isExternal() && root.getPath().equals(entry.getPath())) {
							if (isSourceAttachmentEqual(root, entry)) {
								return new PackageFragmentRootSourceLocation(root);
							}
						}
					}
				}
			} catch (JavaModelException e) {
				LaunchingPlugin.log(e);
			}
		}
		return null;
	}

Output:
	private static IJavaSourceLocation getArchiveSourceLocation(IRuntimeClasspathEntry entry) {
		IResource resource = entry.getResource();
		if (resource == null) {
			IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
			try {
				IJavaProject[] jps = model.getJavaProjects();
				for (int i = 0; i < jps.length; i++) {
					IPackageFragmentRoot[] allRoots = jps[i].getPackageFragmentRoots();
					for (int j = 0; j < allRoots.length; j++) {
						IPackageFragmentRoot root = allRoots[j];
						if (root.isExternal() && root.getPath().equals(new Path(entry.getLocation()))) {
							if (isSourceAttachmentEqual(root, entry)) {
								return new PackageFragmentRootSourceLocation(root);
							}
						}
					}
				}
			} catch (JavaModelException e) {
				LaunchingPlugin.log(e);
			}
		} else {
			IProject project = resource.getProject();
			IJavaProject jp = JavaCore.create(project);
			try {
				if (jp != null && jp.exists()) {
					IPackageFragmentRoot root = jp.getPackageFragmentRoot(resource);
					IPackageFragmentRoot[] allRoots = jp.getPackageFragmentRoots();
					for (int j = 0; j < allRoots.length; j++) {
						if (allRoots[j].equals(root)) {
							if (isSourceAttachmentEqual(root, entry)) {
								return new PackageFragmentRootSourceLocation(root);
							}
						}
					}
				}
				IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
				IJavaProject[] jps = model.getJavaProjects();
				for (int i = 0; i < jps.length; i++) {
					IPackageFragmentRoot[] allRoots = jps[i].getPackageFragmentRoots();
					for (int j = 0; j < allRoots.length; j++) {
						IPackageFragmentRoot root = allRoots[j];
						if (!root.isExternal() && root.getPath().equals(entry.getPath())) {
							if (isSourceAttachmentEqual(root, entry)) {
								return new PackageFragmentRootSourceLocation(root);
							}
						}
					}
				}
			} catch (JavaModelException e) {
				LaunchingPlugin.log(e);
			}
		}
		return null;
	}


Input:
	public void testLoadSettings() throws IOException, JDOMException{
		Properties settingsProps = SettingsLoader.loadSettingsFile();
		assertNotNull(settingsProps);
		assertNotNull(settingsProps.get("org.sagebionetworks.stack.configuration.url"));
		assertNotNull(settingsProps.get("org.sagebionetworks.stackEncryptionKey"));
	}

Output:
	public void testLoadSettings() throws IOException, JDOMException{
		Properties settingsProps = SettingsLoader.loadSettingsFile();
		assertNotNull(settingsProps);
	}


Input:
    protected void getRssDocument(final String uri)
            throws Exception {
        if (log.isDebugEnabled())
            log.debug("Starting getRssDocument()");
        RssCacheDao dao = new RssCacheDao();
        RssCacheTo rss;
        InputStreamReader ir;
        StringBuffer sbx = new StringBuffer();
        BufferedReader buff;
        final java.util.GregorianCalendar calendarg = new java.util.GregorianCalendar();
        rss = dao.view(uri);
        if (rss != null && rss.getUri() != null && rss.getUri().length() > 10) {
            if (log.isDebugEnabled())
                log.debug("Record found with uri: " + uri);
            DateTimeBean dt = rss.getLastUpdated();
            if (dt.getDay() != calendarg.get(java.util.Calendar.DATE)) {
                if (log.isDebugEnabled())
                    log.debug("getRssDocument() Day doesn't match: " + uri);
                u = new URL(uri);
                ir = new InputStreamReader(u.openStream(), "UTF-8");
                buff = new BufferedReader(ir);
                String input;
                while ((input = buff.readLine()) != null) {
                    sbx.append(StringUtil.replace(input, '\'', "\\\'"));
                }
                buff.close();
                rss.setContent(sbx.toString());
                dao.update(rss);
            } else {
                if (log.isDebugEnabled())
                    log.debug("Hit end.. no date change.");
            }
        } else {
            if (log.isDebugEnabled())
                log.debug("Fetch uri: " + uri);
            rss = new RssCacheTo();
            u = new URL(uri);
            ir = new InputStreamReader(u.openStream(), "UTF-8");
            buff = new BufferedReader(ir);
            String input;
            while ((input = buff.readLine()) != null) {
                sbx.append(StringUtil.replace(input, '\'', "\\\'"));
            }
            buff.close();
            log.debug(sbx.toString());
            try {
                rss.setUri(uri);
                rss.setInterval(24);
                rss.setContent(sbx.toString());
                dao.add(rss);
            } catch (java.lang.NullPointerException n) {
                if (log.isDebugEnabled())
                    log.debug("Null pointer exception creating/adding rss cache object to db.");
            }
        }
        if (log.isDebugEnabled())
            log.debug("getRssDocument() Retrieved uri from database: " + uri);
        log.debug(sbx.toString());
        StringReader sr = new StringReader(rss.getContent());
        org.xml.sax.InputSource saxy = new org.xml.sax.InputSource(sr);
        builder = factory.newDocumentBuilder();
        document = builder.parse(saxy);
        if (log.isDebugEnabled())
            log.debug("Hit end of getRssDocument() for " + uri);
    }

Output:
    protected void getRssDocument(final String uri)
            throws Exception {
        if (log.isDebugEnabled())
            log.debug("Starting getRssDocument()");
        RssCacheDao dao = new RssCacheDao();
        RssCacheTo rss;
        InputStreamReader ir;
        StringBuffer sbx = new StringBuffer();
        BufferedReader buff;
        final java.util.GregorianCalendar calendarg = new java.util.GregorianCalendar();
        rss = dao.view(uri);
        if (rss != null && rss.getUri() != null && rss.getUri().length() > 10) {
            if (log.isDebugEnabled())
                log.debug("Record found with uri: " + uri);
            DateTimeBean dt = rss.getLastUpdated();
            if (dt.getDay() != calendarg.get(java.util.Calendar.DATE)) {
                if (log.isDebugEnabled())
                    log.debug("getRssDocument() Day doesn't match: " + uri);
                u = new URL(uri);
                ir = new InputStreamReader(u.openStream(), "UTF-8");
                buff = new BufferedReader(ir);
                String input;
                while ((input = buff.readLine()) != null) {
                    sbx.append(StringUtil.replace(input, '\'', "\\\'"));
                }
                buff.close();
                rss.setContent(sbx.toString().trim());
                if (rss.getContent().startsWith("<rss"))
                    rss.setContent("<?xml version=\"1.0\"?>\n");
                dao.update(rss);
            } else {
                if (log.isDebugEnabled())
                    log.debug("Hit end.. no date change.");
            }
        } else {
            if (log.isDebugEnabled())
                log.debug("Fetch uri: " + uri);
            rss = new RssCacheTo();
            u = new URL(uri);
            ir = new InputStreamReader(u.openStream(), "UTF-8");
            buff = new BufferedReader(ir);
            String input;
            while ((input = buff.readLine()) != null) {
                sbx.append(StringUtil.replace(input, '\'', "\\\'"));
            }
            buff.close();
            log.debug(sbx.toString());
            try {
                rss.setUri(uri);
                rss.setInterval(24);
                rss.setContent(sbx.toString().trim());
                if (rss.getContent().startsWith("<rss"))
                    rss.setContent("<?xml version=\"1.0\"?>\n");
                dao.add(rss);
            } catch (java.lang.NullPointerException n) {
                if (log.isDebugEnabled())
                    log.debug("Null pointer exception creating/adding rss cache object to db.");
            }
        }
        if (log.isDebugEnabled())
            log.debug("getRssDocument() Retrieved uri from database: " + uri);
        log.debug(sbx.toString());
        StringReader sr = new StringReader(rss.getContent());
        org.xml.sax.InputSource saxy = new org.xml.sax.InputSource(sr);
        builder = factory.newDocumentBuilder();
        document = builder.parse(saxy);
        if (log.isDebugEnabled())
            log.debug("Hit end of getRssDocument() for " + uri);
    }


Input:
	public static String format(Object o, String format) {
		if (o == null) { return ""; }
		if (o instanceof Date) {
			DateFormat df = decode(format, Context.getDateFormat(), new SimpleDateFormat(format));
			return df.format((Date)o);
		}
		if (o instanceof Map) {
			return toString((Map)o, nvl(format, ","));
		}
		if (o instanceof Collection) {
			return OpenmrsUtil.join((Collection)o, nvl(format, ","));
		}
		if (o instanceof Object[]) {
			return toString(nvl(format, ","), (Object[])o);
		}
		if (o instanceof Number) {
			if (notNull(format)) {
				NumberFormat nf = NumberFormat.getInstance();
				nf.setGroupingUsed(false);
				return nf.format((Number)o);
			}
		}
		if (o instanceof OpenmrsMetadata) {
			String name = ((OpenmrsMetadata) o).getName();
			if (name == null) {
				if (o instanceof ProgramWorkflow) {
					name = ((ProgramWorkflow)o).getConcept().getDisplayString();
				}
				else if (o instanceof ProgramWorkflowState) {
					name = ((ProgramWorkflowState)o).getConcept().getDisplayString();
				}
			}
			return name;
		}
		if (o instanceof OpenmrsData) {
			if (ObjectUtil.notNull(format)) {
				String[] formatSplit = format.split("\\|");
				String ret = formatSplit[0];
				try {
					int startIndex = ret.indexOf("{");
					int endIndex = ret.indexOf("}", startIndex+1);
					while (startIndex != -1 && endIndex != -1) {
						String propertyName = format.substring(startIndex+1, endIndex);
						Object replacement = ReflectionUtil.getPropertyValue(o, propertyName);
						String newFormat = (replacement != null && formatSplit.length > 1 ? formatSplit[1] : null);
						replacement = ObjectUtil.format(replacement, newFormat);
						ret = ret.replace("{"+propertyName+"}", nvlStr(replacement, ""));
						startIndex = ret.indexOf("{");
						endIndex = ret.indexOf("}", startIndex+1);
					}
					return ret;
				}
				catch (Exception e) {
					log.warn("Unable to get property using converter with format: " + format, e);
				}
			}
		}
		return o.toString();
	}

Output:
	public static String format(Object o, String format) {
		if (o == null) { return ""; }
		if (o instanceof Date) {
			DateFormat df = decode(format, Context.getDateFormat(), new SimpleDateFormat(format));
			return df.format((Date)o);
		}
		if (o instanceof Map) {
			return toString((Map)o, nvl(format, ","));
		}
		if (o instanceof Collection) {
			return OpenmrsUtil.join((Collection)o, nvl(format, ","));
		}
		if (o instanceof Object[]) {
			return toString(nvl(format, ","), (Object[])o);
		}
		if (o instanceof Number) {
			if (notNull(format)) {
				NumberFormat nf = NumberFormat.getInstance();
				nf.setGroupingUsed(false);
				return nf.format((Number)o);
			}
		}
		if (o instanceof OpenmrsMetadata) {
			String name = ((OpenmrsMetadata) o).getName();
			if (name == null) {
				if (o instanceof ProgramWorkflow) {
					name = ((ProgramWorkflow)o).getConcept().getDisplayString();
				}
				else if (o instanceof ProgramWorkflowState) {
					name = ((ProgramWorkflowState)o).getConcept().getDisplayString();
				}
			}
			return name;
		}
		if (o instanceof OpenmrsData) {
			if (ObjectUtil.notNull(format)) {
				String[] formatSplit = format.split("\\|");
				String ret = formatSplit[0];
				try {
					int startIndex = ret.indexOf("{");
					int endIndex = ret.indexOf("}", startIndex+1);
					while (startIndex != -1 && endIndex != -1) {
						String propertyName = ret.substring(startIndex+1, endIndex);
						Object replacement = ReflectionUtil.getPropertyValue(o, propertyName);
						String newFormat = (replacement != null && formatSplit.length > 1 ? formatSplit[1] : null);
						replacement = ObjectUtil.format(replacement, newFormat);
						ret = ret.replace("{"+propertyName+"}", nvlStr(replacement, ""));
						startIndex = ret.indexOf("{");
						endIndex = ret.indexOf("}", startIndex+1);
					}
					return ret;
				}
				catch (Exception e) {
					log.warn("Unable to get property using converter with format: " + format, e);
				}
			}
		}
		return o.toString();
	}


Input:
	public boolean answer()
	{
		_console.println(FormattedConsole.OutputLevel.HEADING, "----" + _id + "----");
		List<Directive> loadList = getLoadModuleList();
		for (Directive directive : loadList)
		{
			String[] arguments = directive.getValue().trim().split("( |\t)*");
			if(arguments == null || arguments.length < 2)
			{
				continue;
			}
			if(arguments[0].equals("security2_module"))
			{
				Directive modSec = directive;
				_console.printAnswer(_level, true, "ModSecurity is being loaded:");
				_console.println(_level, modSec.getLinenumber() + ": " + modSec.getName() + " " + modSec.getValue());
				return true;
			}
		}
		String[] modList = getCompiledIntoModulesList();
		for (String str : modList)
		{
			if(str.matches("( |\t)*mod_security.c"))
			{
				_console.printAnswer(_level, true, "ModSecurity is compiled into the httpd binary.");
				return true;
			}
		}
		_console.printAnswer(_level, false, "ModSecurity seems not to be loaded.");
		return false;
	}

Output:
	public boolean answer()
	{
		_console.println(FormattedConsole.OutputLevel.HEADING, "----" + _id + "----");
		List<Directive> loadList = getLoadModuleList();
		for (Directive directive : loadList)
		{
			String[] arguments = directive.getValue().trim().split("[ \t]+");
			if(arguments == null || arguments.length < 2)
			{
				continue;
			}
			if(arguments[0].equals("security2_module"))
			{
				Directive modSec = directive;
				_console.printAnswer(_level, true, "ModSecurity is being loaded:");
				_console.println(_level, modSec.getLinenumber() + ": " + modSec.getName() + " " + modSec.getValue());
				return true;
			}
		}
		String[] modList = getCompiledIntoModulesList();
		for (String str : modList)
		{
			if(str.matches("( |\t)*mod_security.c"))
			{
				_console.printAnswer(_level, true, "ModSecurity is compiled into the httpd binary.");
				return true;
			}
		}
		_console.printAnswer(_level, false, "ModSecurity seems not to be loaded.");
		return false;
	}


Input:
	public void addDeclareAnnotationRelationship(ISourceLocation sourceLocation, String typename,Method method) {
	  if (!AsmManager.isCreatingModel()) return;
	  String pkg  = null;
	  String type = typename;
	  int packageSeparator = typename.lastIndexOf(".");
	  if (packageSeparator!=-1) {
	 	pkg = typename.substring(0,packageSeparator);
	  	type = typename.substring(packageSeparator+1);
	  }
	  IProgramElement typeElem = AsmManager.getDefault().getHierarchy().findElementForType(pkg,type);
	  if (typeElem == null) return;
	  StringBuffer parmString = new StringBuffer("(");
	  Type[] args = method.getArgumentTypes();
	  for (int i = 0; i < args.length; i++) {
			Type type2 = args[i];
			String s = Utility.signatureToString(type2.getSignature());
			if (s.lastIndexOf(".")!=-1) s =s.substring(s.lastIndexOf(".")+1);
			parmString.append(s);
			if ((i+1)<args.length) parmString.append(",");
	  }
	  parmString.append(")");
	  IProgramElement methodElem = null;
	  if (method.getName().startsWith("<init>")) {
	  	methodElem = AsmManager.getDefault().getHierarchy().findElementForSignature(typeElem,IProgramElement.Kind.CONSTRUCTOR,type+parmString);
	  } else {
	  	methodElem = AsmManager.getDefault().getHierarchy().findElementForSignature(typeElem,IProgramElement.Kind.METHOD,method.getName()+parmString);
	  }
	  if (methodElem == null) return;
	  try {
	    String sourceHandle =
            AsmManager.getDefault().getHandleProvider().createHandleIdentifier(sourceLocation.getSourceFile(),sourceLocation.getLine(),
		 	sourceLocation.getColumn(),sourceLocation.getOffset());
	    String targetHandle = methodElem.getHandleIdentifier();
	    IRelationshipMap mapper = AsmManager.getDefault().getRelationshipMap();
		if (sourceHandle != null && targetHandle != null) {
				IRelationship foreward = mapper.get(sourceHandle, IRelationship.Kind.DECLARE_INTER_TYPE, ANNOTATES,false,true);
				foreward.addTarget(targetHandle);
				IRelationship back = mapper.get(targetHandle, IRelationship.Kind.DECLARE_INTER_TYPE, ANNOTATED_BY,false,true);
				back.addTarget(sourceHandle);
		}
        } catch (Throwable t) {
          t.printStackTrace();
        }
	}

Output:
	public void addDeclareAnnotationRelationship(ISourceLocation sourceLocation, String typename,Method method) {
	  if (!AsmManager.isCreatingModel()) return;
	  String pkg  = null;
	  String type = typename;
	  int packageSeparator = typename.lastIndexOf(".");
	  if (packageSeparator!=-1) {
	 	pkg = typename.substring(0,packageSeparator);
	  	type = typename.substring(packageSeparator+1);
	  }
	  IProgramElement typeElem = AsmManager.getDefault().getHierarchy().findElementForType(pkg,type);
	  if (typeElem == null) return;
	  StringBuffer parmString = new StringBuffer("(");
	  Type[] args = method.getArgumentTypes();
	  for (int i = 0; i < args.length; i++) {
			Type type2 = args[i];
			String s = Utility.signatureToString(type2.getSignature());
			if (s.lastIndexOf(".")!=-1) s =s.substring(s.lastIndexOf(".")+1);
			parmString.append(s);
			if ((i+1)<args.length) parmString.append(",");
	  }
	  parmString.append(")");
	  IProgramElement methodElem = null;
	  if (method.getName().startsWith("<init>")) {
	  	methodElem = AsmManager.getDefault().getHierarchy().findElementForSignature(typeElem,IProgramElement.Kind.CONSTRUCTOR,type+parmString);
		if (methodElem == null && args.length==0) methodElem = typeElem;
	  } else {
	  	methodElem = AsmManager.getDefault().getHierarchy().findElementForSignature(typeElem,IProgramElement.Kind.METHOD,method.getName()+parmString);
	  }
	  if (methodElem == null) return;
	  try {
	    String sourceHandle =
            AsmManager.getDefault().getHandleProvider().createHandleIdentifier(sourceLocation.getSourceFile(),sourceLocation.getLine(),
		 	sourceLocation.getColumn(),sourceLocation.getOffset());
	    String targetHandle = methodElem.getHandleIdentifier();
	    IRelationshipMap mapper = AsmManager.getDefault().getRelationshipMap();
		if (sourceHandle != null && targetHandle != null) {
				IRelationship foreward = mapper.get(sourceHandle, IRelationship.Kind.DECLARE_INTER_TYPE, ANNOTATES,false,true);
				foreward.addTarget(targetHandle);
				IRelationship back = mapper.get(targetHandle, IRelationship.Kind.DECLARE_INTER_TYPE, ANNOTATED_BY,false,true);
				back.addTarget(sourceHandle);
		}
        } catch (Throwable t) {
          t.printStackTrace();
        }
	}


Input:
    public SlippyMapChooserWindow(BBoxLatLonPanel bboxlatlonpanel, TileProviderIf tileProvider, String tileDirectory)
    {
        super("Slippy Map Chooser");
        setSize(400, 400);
        map = new SlippyMapChooser(bboxlatlonpanel, tileProvider, tileDirectory);
        setLayout(new BorderLayout());
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        add(map, BorderLayout.CENTER);
    }

Output:
    public SlippyMapChooserWindow(BBoxLatLonPanel bboxlatlonpanel, TileProviderIf tileProvider, String tileDirectory)
    {
        super("Slippy Map Chooser");
        setSize(400, 400);
        map = new SlippyMapChooser(bboxlatlonpanel, tileDirectory, tileProvider);
        setLayout(new BorderLayout());
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        add(map, BorderLayout.CENTER);
    }


Input:
    public OpenJPAEntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo pui, Map m) {
        PersistenceProductDerivation pd = new PersistenceProductDerivation();
        try {
            Object poolValue = Configurations.removeProperty(EMF_POOL, m);
            ConfigurationProvider cp = pd.load(pui, m);
            if (cp == null)
                return null;
            Exception transformerException = null;
            String ctOpts = (String) Configurations.getProperty(CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
            try {
                pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
                    pui.getNewTempClassLoader(), newConfigurationImpl()));
            } catch (Exception e) {
                transformerException = e;
            }
            if (!Configurations.containsProperty(BrokerValue.KEY, cp.getProperties())) {
                cp.addProperty("openjpa." + BrokerValue.KEY, getDefaultBrokerAlias());
            }
            BrokerFactory factory = getBrokerFactory(cp, poolValue, pui.getClassLoader());
            if (transformerException != null) {
                Log log = factory.getConfiguration().getLog(OpenJPAConfiguration.LOG_RUNTIME);
                if (log.isTraceEnabled()) {
                    log.warn(_loc.get("transformer-registration-error-ex", pui), transformerException);
                } else {
                    log.warn(_loc.get("transformer-registration-error", pui));
                }
            }
            OpenJPAConfiguration conf = factory.getConfiguration();
            _log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
            loadValidator(_log, conf);
            Options o = Configurations.parseProperties(Configurations.getProperties("openjpa.MetaDataRepository"));
            if(o.getBooleanProperty("Preload")){
                conf.getAbstractBrokerFactoryInstance().preload();
            }
            return JPAFacadeHelper.toEntityManagerFactory(factory);
        } catch (Exception e) {
            throw PersistenceExceptions.toPersistenceException(e);
        }
    }

Output:
    public OpenJPAEntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo pui, Map m) {
        PersistenceProductDerivation pd = new PersistenceProductDerivation();
        try {
            Object poolValue = Configurations.removeProperty(EMF_POOL, m);
            ConfigurationProvider cp = pd.load(pui, m);
            if (cp == null)
                return null;
            Exception transformerException = null;
            String ctOpts = (String) Configurations.getProperty(CLASS_TRANSFORMER_OPTIONS, pui.getProperties());
            try {
                pui.addTransformer(new ClassTransformerImpl(cp, ctOpts,
                    pui.getNewTempClassLoader(), newConfigurationImpl()));
            } catch (Exception e) {
                transformerException = e;
            }
            if (!Configurations.containsProperty(BrokerValue.KEY, cp.getProperties())) {
                cp.addProperty("openjpa." + BrokerValue.KEY, getDefaultBrokerAlias());
            }
            BrokerFactory factory = getBrokerFactory(cp, poolValue, pui.getClassLoader());
            if (transformerException != null) {
                Log log = factory.getConfiguration().getLog(OpenJPAConfiguration.LOG_RUNTIME);
                if (log.isTraceEnabled()) {
                    log.warn(_loc.get("transformer-registration-error-ex", pui), transformerException);
                } else {
                    log.warn(_loc.get("transformer-registration-error", pui));
                }
            }
            OpenJPAConfiguration conf = factory.getConfiguration();
            _log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
            loadValidator(_log, conf);
            Options o = Configurations.parseProperties(Configurations.getProperties("openjpa.MetaDataRepository"));
            if(o.getBooleanProperty("Preload")){
                conf.getMetaDataRepositoryInstance().preload();
            }
            return JPAFacadeHelper.toEntityManagerFactory(factory);
        } catch (Exception e) {
            throw PersistenceExceptions.toPersistenceException(e);
        }
    }


Input:
    private String processRequest(String requestJson) throws IOException {
        checkNotNull(requestJson);
        this.nodeStdin.println(requestJson);
        String resultJson = null;
        do {
            String line = this.nodeStdout.readLine();
            if (line.startsWith("DEBUG")) {
                System.out.println(line);
            } else if (line.startsWith("ERROR")) {
                line = line.substring(7, line.length());
                line = line.replaceAll("\\\\n", "\n");
                line = line.replaceAll("    ", "\t");
                throw new RuntimeException("The following request caused an error to be thrown:" + LINE_SEPARATOR
                        + requestJson + LINE_SEPARATOR
                        + line);
            } else {
                resultJson = line;
            }
        } while (resultJson == null);
        return resultJson;
    }

Output:
    private String processRequest(String requestJson) throws IOException {
        checkNotNull(requestJson);
        this.nodeStdin.println(requestJson);
        String resultJson = null;
        do {
            String line = this.nodeStdout.readLine();
            if (line.startsWith("DEBUG")) {
                System.out.println(line);
            } else if (line.startsWith("ERROR")) {
                line = line.substring(7, line.length());
                line = line.replaceAll("\\\\n", LINE_SEPARATOR);
                line = line.replaceAll("    ", "\t");
                throw new RuntimeException("The following request caused an error to be thrown:" + LINE_SEPARATOR
                        + requestJson + LINE_SEPARATOR
                        + line);
            } else {
                resultJson = line;
            }
        } while (resultJson == null);
        return resultJson;
    }


Input:
    public void execute() throws MojoExecutionException, MojoFailureException {
        Embedder embedder = newEmbedder();
        getLog().info("Running stories using embedder "+embedder);
		embedder.runAsEmbeddables(classNames());
    }

Output:
    public void execute() throws MojoExecutionException, MojoFailureException {
        Embedder embedder = newEmbedder();
        getLog().info("Running stories using embedder "+embedder);
        try {
            embedder.runAsEmbeddables(classNames());
        } catch( Embedder.RunningEmbeddablesFailed e) {
            throw new MojoFailureException("JBehave Story Failures",e);
        }
    }