protected void check(Statement s, Problems problems) { if (s == null) { return; } // shorthand statements are ignored inside alt statements INamedNode curr = s; while (curr != null) { if (curr instanceof Alt_Statement || curr instanceof Call_Statement) { return; } curr = curr.getNameParent(); } StatementBlock sb = s.getMyStatementBlock(); if (sb == null) { return; } Definition d = sb.getMyDefinition(); if (d == null) { return; } // shorthand statements are marked in functions, test cases and altsteps that have a 'runs on' // clause if (d instanceof Def_Function && ((Def_Function) d).getRunsOnType(timestamp) != null) { problems.report(s.getLocation(), ERROR_MESSAGE_PREFIX + typename + ERROR_MESSAGE_SUFFIX); return; } if (d instanceof Def_Altstep || d instanceof Def_Testcase) { problems.report(s.getLocation(), ERROR_MESSAGE_PREFIX + typename + ERROR_MESSAGE_SUFFIX); } }
protected void check(final Identifier identifier, final String description, Problems problems) { String displayName = identifier.getDisplayName(); if (VISIBILITY_PATTERN.matcher(displayName).matches()) { String msg = MessageFormat.format(REPORT, description, displayName); problems.report(identifier.getLocation(), msg); } }
protected void check(IValue expression, Problems problems) { if (expression instanceof Expression_Value) { ExpressionVisitor visitor = new ExpressionVisitor(); expression.accept(visitor); if (visitor.getCount() > reportTooComplexExpressionSize) { String msg = MessageFormat.format(COMPLEXITY, visitor.getCount(), reportTooComplexExpressionSize); problems.report(expression.getLocation(), msg); } } }
public MongoFeed() throws IOException { // TODO Auto-generated constructor stub Properties prop = new Properties(); prop.load(new FileInputStream("/home/romil/config.properties")); MongoClient mongoClient = new MongoClient(prop.getProperty("dbip"), Integer.parseInt(prop.getProperty("dport"))); DB db = mongoClient.getDB(prop.getProperty("dbname")); Gson gson = new Gson(); DBCollection coll = db.getCollection("heatmap"); ArrayList<Stat> stats = new ArrayList<Stat>(); BufferedReader reader = new BufferedReader(new FileReader("murder.tsv")); String line = null; while ((line = reader.readLine()) != null) { Stat s1 = new Stat(); String[] sr = line.split("\t"); System.out.println(sr[0]); System.out.println(sr[1]); System.out.println(sr[2]); Location delhiLocation = new Location(); delhiLocation.setLocationName(sr[0].toLowerCase()); delhiLocation.setLatitude(Double.parseDouble(sr[1])); delhiLocation.setLongitude(Double.parseDouble(sr[2])); gson = new Gson(); s1.setLocation(delhiLocation); s1.setValue(100); stats.add(s1); } Problems problem = new Problems(); String prob = "Murder"; problem.setProblem(prob.toLowerCase()); problem.setStats(stats); DBObject obj11 = (DBObject) JSON.parse(gson.toJson(problem)); coll.insert(obj11); }
/** * Processing the node. * * <p>This method is called by the {@link Analyzer} during analysis. * * @param project the project to check with your code smell */ public final List<Marker> checkProject(IProject project) { Problems problems = new Problems(); process(project, problems); return problems.getMarkers(); }