/** * Returns a new set with all changes that match to the given path. */ @JsonIgnore public static Set<ConstructChange> filter(Set<ConstructChange> _changes, String _path) { final Set<ConstructChange> changes = new HashSet<ConstructChange>(); for(ConstructChange change: _changes) { if(_path.equals("") || change.getRepoPath()==null || change.getRepoPath().startsWith(_path)) { changes.add(change); } } return changes; } }
all_contain_src = all_contain_src && change.getRepoPath()!=null && change.getRepoPath().indexOf("/src/")!=-1; idx = change.getRepoPath().indexOf("/src/"); if(idx!=-1) { paths.add(change.getRepoPath().substring(0, idx)); boolean all_contain_branches_or_trunk = true; for(ConstructChange change: _changes) all_contain_branches_or_trunk = all_contain_branches_or_trunk && change.getRepoPath()!=null && (change.getRepoPath().indexOf("/trunk/")!=-1 || change.getRepoPath().indexOf("/branches/")!=-1); if(all_contain_branches_or_trunk) { for(ConstructChange change: _changes) { idx_trunk = change.getRepoPath().indexOf("/trunk/"); idx_branches = change.getRepoPath().indexOf("/branches/"); if(idx_trunk!=-1 && idx_branches==-1) { paths.add(change.getRepoPath().substring(0, idx_trunk+7)); idx_slash = change.getRepoPath().indexOf("/", idx_branches + 10); if(idx_slash!=-1) { paths.add(change.getRepoPath().substring(0, idx_slash));
public ConstructFixContainmentCheck(ConstructId _c, JarAnalyzer _ja, ConstructChange _cc) { this.constructId = _c; this.ja = _ja; this.repo = _cc.getRepo(); this.repoPath = _cc.getRepoPath(); this.commit = _cc.getCommit(); }
public void addConstructChange(ConstructChange _construct_change) throws IllegalArgumentException { String path = _construct_change.getRepoPath(); if(path==null) { ArchiveFixContainmentCheck.log.warn("Construct change with commit [" + _construct_change.getCommit()+ "] has not path information"); path = ""; } //throw new IllegalArgumentException("Cannot analyze construct fix containment without path information"); OrderedCommitsForPath commits_per_path = this.commits.get(path); if(commits_per_path==null) { commits_per_path = new OrderedCommitsForPath(this.constructId, this.ja, path); this.commits.put(path, commits_per_path); } commits_per_path.addConstructChange(_construct_change); }/* old public void addConstructChange(ConstructChange _construct_change) throws IllegalArgumentException {
json.addProperty("repo", cc.getRepo()); json.addProperty("commit", cc.getCommit()); json.addProperty("repoPath", cc.getRepoPath()); json.add("constructId", gson.toJsonTree(cc.getConstructId())); jscommits.add(json);
if(this.isTestConstruct(cid) || this.isBelowTestDir(_construct_change.getRepoPath()) || this.isInTestClass(cid)){
if(cpa.getConstruct().equals(c.getConstructId().getQname()) && c.getRepoPath().contains(cpa.getPath()) && c.getConstructChangeType().toString().equals(cpa.getType())){ JsonObject thisCc = new JsonObject(); cc.addProperty("repo", c.getRepo()); cc.addProperty("commit", c.getCommit()); cc.addProperty("repoPath", c.getRepoPath()); JsonObject constructId = new JsonObject(); constructId.addProperty("lang", c.getConstructId().getLang().toString());
OrderedCCperConstructPath2 a = new OrderedCCperConstructPath2(cc.getConstructId(),cc.getRepoPath()); if(orderedQnamePerCC.contains(a)){ orderedQnamePerCC.get(orderedQnamePerCC.indexOf(a)).addConstructChange(cc);