There are 80 code examples for java.util.Map.

The API names are highlighted below. You can use suckoo button to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.

Project Name: codecover Package: org.codecover.eclipse

Source Code: InstrumentableItemsManager.java (Click to view .java file)

Method Code:
vote
like

private void saveInstrumentableItems(XMLMemento memento){
  for (  Map.Entry<IJavaProject,Map<IPackageFragment,Set<ICompilationUnit>>> entry : this.markedJavaElements.entrySet()) {
    Map<IPackageFragment,Set<ICompilationUnit>> subMap=entry.getValue();
    IJavaProject javaProject=entry.getKey();
    if (subMap.isEmpty() || !javaProject.exists()) {
      continue;
    }
    IMemento projectNode=memento.createChild(TAG_I_JAVA_PROJECT);
    projectNode.putString(TAG_INFO,getIJavaElementInfo(javaProject));
    for (    Map.Entry<IPackageFragment,Set<ICompilationUnit>> subEntry : subMap.entrySet()) {
      Set<ICompilationUnit> set=subEntry.getValue();
      IPackageFragment packageFragment=subEntry.getKey();
      if (set.isEmpty() || !packageFragment.exists()) {
        continue;
      }
      IMemento packageNode=projectNode.createChild(TAG_I_PACKAGE_FRAGMENT);
      packageNode.putString(TAG_INFO,getIJavaElementInfo(packageFragment));
      for (      ICompilationUnit compilationUnit : set) {
        if (!compilationUnit.exists()) {
          continue;
        }
        IMemento compilationUnitNode=packageNode.createChild(TAG_I_COMPILATION_UNIT);
        compilationUnitNode.putString(TAG_INFO,getIJavaElementInfo(compilationUnit));
      }
    }
  }
}
 

Project Name: codecover Package: org.codecover.eclipse

Source Code: InstrumentableItemsManager.java (Click to view .java file)

Method Code:
vote
like

private void saveInstrumentableItems(XMLMemento memento){
  for (  Map.Entry<IJavaProject,Map<IPackageFragment,Set<ICompilationUnit>>> entry : this.markedJavaElements.entrySet()) {
    Map<IPackageFragment,Set<ICompilationUnit>> subMap=entry.getValue();
    IJavaProject javaProject=entry.getKey();
    if (subMap.isEmpty() || !javaProject.exists()) {
      continue;
    }
    IMemento projectNode=memento.createChild(TAG_I_JAVA_PROJECT);
    projectNode.putString(TAG_INFO,getIJavaElementInfo(javaProject));
    for (    Map.Entry<IPackageFragment,Set<ICompilationUnit>> subEntry : subMap.entrySet()) {
      Set<ICompilationUnit> set=subEntry.getValue();
      IPackageFragment packageFragment=subEntry.getKey();
      if (set.isEmpty() || !packageFragment.exists()) {
        continue;
      }
      IMemento packageNode=projectNode.createChild(TAG_I_PACKAGE_FRAGMENT);
      packageNode.putString(TAG_INFO,getIJavaElementInfo(packageFragment));
      for (      ICompilationUnit compilationUnit : set) {
        if (!compilationUnit.exists()) {
          continue;
        }
        IMemento compilationUnitNode=packageNode.createChild(TAG_I_COMPILATION_UNIT);
        compilationUnitNode.putString(TAG_INFO,getIJavaElementInfo(compilationUnit));
      }
    }
  }
}
 

Project Name: codecover Package: org.codecover.eclipse.actions

Source Code: UseForCoverageMeasurementActionDelegate.java (Click to view .java file)

Method Code:
vote
like

private Map<IPackageFragment,Set<ICompilationUnit>> getChildren(IPackageFragment element){
  Map<IPackageFragment,Set<ICompilationUnit>> elements=new HashMap<IPackageFragment,Set<ICompilationUnit>>();
  Set<IPackageFragment> packageFragments=new HashSet<IPackageFragment>();
  packageFragments.add(element);
  final String packageName=element.getElementName();
  try {
    if (element.getParent() instanceof IPackageFragmentRoot) {
      IPackageFragmentRoot parent=(IPackageFragmentRoot)element.getParent();
      for (      IJavaElement javaElement : parent.getChildren()) {
        if (javaElement instanceof IPackageFragment) {
          IPackageFragment packageFragment=(IPackageFragment)javaElement;
          String fragmentName=packageFragment.getElementName();
          if (fragmentName.startsWith(packageName)) {
            packageFragments.add(packageFragment);
          }
        }
      }
    }
    for (    IPackageFragment packageFragment : packageFragments) {
      Set<ICompilationUnit> compilationUnits=new HashSet<ICompilationUnit>();
      elements.put(packageFragment,compilationUnits);
      for (      ICompilationUnit compilationUnit : packageFragment.getCompilationUnits()) {
        compilationUnits.add(compilationUnit);
      }
    }
  }
 catch (  JavaModelException e) {
    CodeCoverPlugin.getDefault().getLogger().fatal("A JavaModelException occured",e);
  }
  return elements;
}
 

Project Name: codecover Package: org.codecover.eclipse.tscmanager

Source Code: TSContainerSaveQueue.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Performs the pending save (if there is any) of a test session container. There won't be any retries if
 * the saving fails (the save is removed from the queue in any case, success or failure). Locking of
 * <code>TSContainerManager</code> must be done by the calling context.
 * @param tscInfo the <code>TSContainerInfo</code>-representation of the test session container to save
 * @throws TSCFileCreateException (see {@link TSContainerStorage#saveTSContainer(TestSessionContainer,TSContainerInfo,boolean,IProgressMonitor)}
 * @throws FileSaveException (see {@link TSContainerStorage#saveTSContainer(TestSessionContainer,TSContainerInfo,boolean,IProgressMonitor)}
 */
void saveQueued(TSContainerInfo tscInfo,IProgressMonitor monitor) throws TSCFileCreateException, FileSaveException, OutOfMemoryError {
  TestSessionContainer tsc;
  final int monitorScale=1000;
  monitor=(monitor != null) ? monitor : new NullProgressMonitor();
  try {
    monitor.beginTask(MONITOR_SAVING_QUEUED_TEST_SESSION_CONTAINER,1 * monitorScale);
    if (tscInfo == null || (tsc=this.queue.get(tscInfo)) == null) {
      monitor.worked(1 * monitorScale);
      return;
    }
    logger.debug("Performing queued save: " + tscInfo.getFile().getFullPath().toString());
    this.tscStorage.saveTSContainer(tsc,tscInfo,false,new SubProgressMonitor(monitor,1 * monitorScale));
  }
  finally {
    monitor.done();
  }
}
 

Project Name: codecover Package: org.codecover.eclipse.tscmanager

Source Code: ActiveTestCasesSaveParticipant.java (Click to view .java file)

Method Code:
vote
like

/** 
 * This method saves which test cases are currently active and which test session container is currently
 * active. Not only the active test cases of the currently active test session container are saved but also
 * the active test cases of all other known test session containers.
 * <p>
 * A write lock of the <code>TSContainerManager</code> is acquired during the execution of this method.
 * @param context the save context
 * @throws IOException if the save failed
 */
private void saveAllActiveTestCases(ISaveContext context) throws CoreException {
  String saveFileName=ActiveTestCasesStorage.ACTIVE_TEST_CASES_SAVE_FILENAME + Integer.toString(context.getSaveNumber());
  File saveFile=CodeCoverPlugin.getDefault().getStateLocation().append(saveFileName).toFile();
  FileWriter writer;
  XMLMemento rootMemento=XMLMemento.createWriteRoot(ActiveTestCasesStorage.ACTIVE_TEST_CASES_MEMENTO_ROOT);
  ActiveTSContainerInfo activeTSCInfo;
  List<TSContainerInfo> tscInfos;
  Map<String,List<TestCaseInfo>> bufferedTestCases;
synchronized (this.tscManager.getWriteLock()) {
    activeTSCInfo=this.tscManager.getActiveTSContainer();
    tscInfos=this.tscManager.getTestSessionContainers();
    bufferedTestCases=this.testCasesStorage.getBufferedActiveTestCases();
  }
  ActiveTestCasesStorage.storeActiveTestSessionContainer(activeTSCInfo,rootMemento);
  ActiveTestCasesStorage.storeAllActiveTestCases(tscInfos,bufferedTestCases,rootMemento);
  try {
    writer=new FileWriter(saveFile);
    rootMemento.save(writer);
  }
 catch (  IOException e) {
    throw new CoreException(new Status(IStatus.ERROR,CodeCoverPlugin.PLUGIN_ID,IStatus.OK,"Error while saving active test cases",e));
  }
  try {
    writer.close();
  }
 catch (  IOException e) {
    throw new CoreException(new Status(IStatus.ERROR,CodeCoverPlugin.PLUGIN_ID,IStatus.OK,"Error while saving active test cases",e));
  }
  context.map(new Path(ActiveTestCasesStorage.ACTIVE_TEST_CASES_SAVE_FILENAME),new Path(saveFileName));
}
 

Project Name: codecover Package: org.codecover.eclipse.tscmanager

Source Code: ActiveTestCasesStorage.java (Click to view .java file)

Method Code:
vote
like

/** 
 * This method stores in the given memento which test cases of the given test session containers are active.
 * <p>
 * The active test cases of the given test session containers mustn't change during the execution of this
 * method. Thus it is recommended to pass immutable copies as the parameters.
 * </p>
 * @param tscInfos the test session containers which active test cases are to be stored
 * @param rootMemento the memento
 */
static void storeAllActiveTestCases(List<TSContainerInfo> tscInfos,Map<String,List<TestCaseInfo>> bufTCs,IMemento rootMemento){
  IMemento curTSCMemento;
  List<String> storedTestSessions=new LinkedList<String>();
  List<TestCaseInfo> curActiveTestCases;
  for (  TSContainerInfo tscInfo : tscInfos) {
    if (tscInfo.getActiveTestCases().isEmpty()) {
      continue;
    }
    storedTestSessions.clear();
    curTSCMemento=rootMemento.createChild(ACTIVE_TEST_CASES_MEMENTO_TSC,tscInfo.getPath().toPortableString());
    for (    TestCaseInfo tcInfo : tscInfo.getActiveTestCases()) {
      if (!storedTestSessions.contains(tcInfo.getTestSessionName())) {
        storeTestSession(tcInfo.getTestSessionName(),tscInfo.getActiveTestCases(),curTSCMemento);
        storedTestSessions.add(tcInfo.getTestSessionName());
      }
    }
  }
  for (  String tscPath : bufTCs.keySet()) {
    storedTestSessions.clear();
    curTSCMemento=rootMemento.createChild(ACTIVE_TEST_CASES_MEMENTO_TSC,tscPath);
    curActiveTestCases=bufTCs.get(tscPath);
    for (    TestCaseInfo tcInfo : curActiveTestCases) {
      if (!storedTestSessions.contains(tcInfo.getTestSessionName())) {
        storeTestSession(tcInfo.getTestSessionName(),curActiveTestCases,curTSCMemento);
        storedTestSessions.add(tcInfo.getTestSessionName());
      }
    }
  }
}
 

Project Name: codecover Package: org.codecover.eclipse.utils.recommendationgenerator

Source Code: RecommendationGenerator.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Gewichtung geändert, neu berechnen, aber die invoke()-Methoden nicht aufrufen.
 */
public void weightChanged(){
  this.sortedList=new ArrayList<UncoveredBranch>(200);
  for (  UncoveredBranch ub : this.baseRecommendationListCreator.getUncoveredBranches()) {
    ub.score=0.0;
    StringBuilder infoMsg=new StringBuilder();
    for (    ErrorDataSource eds : this.errorDataSources) {
      infoMsg.append("EDS: " + eds.getName() + "\n");
      Double score=0.0d;
      if (ub.resource != null) {
        for (        ErrorIndicator ei : eds.getErrorIndicators()) {
          double t=ei.getValueFor(ub.resource);
          score+=t;
          if (t > 0.0)           infoMsg.append("EI-file: " + ei.getName() + ": "+ t+ "\n");
        }
        for (int line=ub.lineFrom; line < ub.lineTo; line++) {
          for (          ErrorIndicator ei : eds.getErrorIndicators()) {
            double t=ei.getValueFor(ub.resource,line) * eds.getWeight();
            score+=t;
            if (t > 0.0)             infoMsg.append("EI-line: " + ei.getName() + " line:"+ line+ ": "+ t+ "\n");
          }
        }
      }
      for (      ErrorIndicator ei : eds.getErrorIndicators()) {
        double t=ei.getValueFor(ub);
        score+=t;
        if (t > 0.0)         infoMsg.append("EI-branch: " + ei.getName() + ": "+ t+ "\n");
      }
      ub.sourceScore.put(eds,score);
      ub.score+=score;
      ub.info=infoMsg.toString();
    }
    this.sortedList.add(ub);
  }
  Collections.sort(this.sortedList,this.weightSorter);
  filter(this.sortedList);
}
 

Project Name: codecover Package: org.codecover.eclipse.utils.recommendationgenerator

Source Code: LineNumberDeterminator.java (Click to view .java file)

Method Code:
vote
like

public static int getLineNumber(IResource resource,int offset){
  System.out.println("getLineNumbers " + resource.getName() + " "+ offset);
  Position p=new Position(resource,offset);
  if (offsetLineNumberMap.containsKey(p)) {
    return offsetLineNumberMap.get(p);
  }
  IFile iFile=wsRoot.getFile(resource.getFullPath());
  String portableString=iFile.getLocation().toPortableString();
  File file=new File(portableString);
  FileInputStream fis;
  try {
    fis=new FileInputStream(file);
    int n=0;
    int line=1;
    while ((n=fis.read()) != -1) {
      char c=(char)n;
      System.out.println(c);
      if (c == Character.LINE_SEPARATOR) {
        line++;
      }
    }
    fis.close();
    offsetLineNumberMap.put(p,line);
    return line;
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
  return -1;
}
 

Project Name: codecover Package: org.codecover.eclipse.utils.recommendationgenerator

Source Code: LineNumberDeterminator.java (Click to view .java file)

Method Code:
vote
like

public static List<Integer> getLineNumbers(IResource resource,int offsetStart,int offsetEnd){
  long a=new Date().getTime();
  List<Integer> ret=new ArrayList<Integer>();
  List<Integer> lineBreakPositions;
  if (lineBreakPositionMap.containsKey(resource)) {
    lineBreakPositions=lineBreakPositionMap.get(resource);
  }
 else {
    lineBreakPositions=new ArrayList<Integer>();
    IFile iFile=wsRoot.getFile(resource.getFullPath());
    String portableString=iFile.getLocation().toPortableString();
    File file=new File(portableString);
    FileInputStream fis;
    try {
      fis=new FileInputStream(file);
      int n=0;
      int count=0;
      while ((n=fis.read()) != -1) {
        count++;
        if (n == 10) {
          lineBreakPositions.add(count);
        }
      }
      fis.close();
    }
 catch (    FileNotFoundException e) {
      e.printStackTrace();
    }
catch (    IOException e) {
      e.printStackTrace();
    }
    lineBreakPositionMap.put(resource,lineBreakPositions);
  }
  int beginline=1;
  int endline=1;
  for (  Integer lineBreakPosition : lineBreakPositions) {
    if (lineBreakPosition < offsetStart) {
      beginline++;
    }
    if (lineBreakPosition < offsetEnd) {
      endline++;
    }
  }
  for (int i=beginline; i <= endline; i++) {
    ret.add(i);
  }
  return ret;
}
 

Project Name: codecover Package: org.codecover.eclipse.utils.recommendationgenerator

Source Code: ErrorIndicator.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Returns the error-probability
 */
public Double getValueFor(IResource path){
  if (this.mode == ErrorIndicatorMode.OFF) {
    return 0.0;
  }
  if (path == null) {
    return 0.0d;
  }
  Double d=fileErrorProbabilityMap.get(path);
  if (d == null) {
    return 0.0d;
  }
  return d;
}
 

Project Name: codecover Package: org.codecover.eclipse.utils.recommendationgenerator

Source Code: ErrorIndicator.java (Click to view .java file)

Method Code:
vote
like

public Double getValueFor(IResource resource,int line){
  Double d=fileLineErrorProbabilityMap.get(new LineInFile(resource,line));
  return d == null ? 0.0 : d;
}
 

Project Name: codecover Package: org.codecover.eclipse.utils.recommendationgenerator

Source Code: ErrorIndicator.java (Click to view .java file)

Method Code:
vote
like

public Double getValueFor(UncoveredBranch ub){
  Double d=branchErrorProbabilityMap.get(ub);
  return d == null ? 0.0 : d;
}
 

Project Name: codecover Package: org.codecover.eclipse.utils.recommendationgenerator.datacollectors

Source Code: SVNInfoCache.java (Click to view .java file)

Method Code:
vote
like

public static Long getFirstRevision(IResource resource){
  if (firstRevisionCache.containsKey(resource)) {
    return firstRevisionCache.get(resource);
  }
  ISVNRemoteResource remoteResource=getRemoteResource(resource);
  try {
    ISVNLogMessage[] messages=remoteResource.getLogMessages(SVNRevision.BASE,SVNRevision.START,SVNRevision.COMMITTED,true,false,100,true);
    if (messages != null && messages.length > 0) {
      messages[0].getDate();
      Number revision=messages[0].getRevision();
      System.out.println("Erste Revision von Datei " + resource.getName() + " ist "+ revision.getNumber());
      firstRevisionCache.put(resource,revision.getNumber());
      return revision.getNumber();
    }
  }
 catch (  TeamException e) {
    e.printStackTrace();
  }
  return null;
}
 

Project Name: codecover Package: org.codecover.eclipse.views

Source Code: TestSessionsView.java (Click to view .java file)

Method Code:
vote
like

private void removeExpandedElements(TSContainerInfo tscInfo){
  this.expandedElements.remove(tscInfo);
}
 

Project Name: codecover Package: org.codecover.eclipse.views

Source Code: BooleanAnalyzer.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Evaluates the given {@link RootTerm} and its {@link BooleanTerm}s under
 * the given assignment, by traversing the expression tree. The cells are
 * filled with their data during that traversing.
 * @param rootTermthe {@link RootTerm}, the {@link BooleanTerm} belongs to.
 * @param booleanTermthe {@link BooleanTerm}, that is currently evaluated.
 * @param assignmentthe {@link BooleanAssignment}, that is used to evaluate.
 * @param cellsthe {@link Map} of {@link CellObject}s, that is filled.
 * @param coveringAssignmentsthe {@link Map} of those {@link BooleanAssignment}s, that
 * cover a given {@link BasicBooleanTerm}.
 * @return The {@link BooleanResult} of the evaluation of the given{@link BooleanTerm}.
 */
private final BooleanResult evaluateTerm(RootTerm rootTerm,BooleanTerm booleanTerm,BooleanAssignment assignment,Map<BooleanTerm,CellObject> cells,Map<BasicBooleanTerm,Set<BooleanAssignment>> coveringAssignments){
  if (booleanTerm instanceof BasicBooleanTerm) {
    int position=rootTerm.getPositionOfTerm((BasicBooleanTerm)booleanTerm);
    BooleanResult booleanResult=assignment.getResults().get(position);
    Color coveredColor=null;
    if (coveringAssignments.get(booleanTerm).contains(assignment)) {
      coveredColor=getCoveredBackground();
    }
    cells.put(booleanTerm,new CellObject(getStringFromBooleanResult(booleanResult),null,coveredColor));
    termResults.put(booleanTerm,booleanResult);
    return booleanResult;
  }
 else   if (booleanTerm instanceof OperatorTerm) {
    OperatorTerm operatorTerm=(OperatorTerm)booleanTerm;
    List<BooleanResult> operatorResults=new LinkedList<BooleanResult>();
    for (    BooleanTerm subTerms : operatorTerm.getOperands()) {
      BooleanResult result=evaluateTerm(rootTerm,subTerms,assignment,cells,coveringAssignments);
      operatorResults.add(result);
    }
    BooleanAssignment operatorAssignment=new BooleanAssignment(operatorResults);
    Boolean result=((OperatorTerm)booleanTerm).getOperator().getPossibleAssignments().get(operatorAssignment);
    BooleanResult booleanResult;
    if (result == null) {
      booleanResult=BooleanResult.NOT_EVALUATED;
    }
 else {
      booleanResult=result ? BooleanResult.TRUE : BooleanResult.FALSE;
    }
    cells.put(booleanTerm,new CellObject(getStringFromBooleanResult(booleanResult),getOperatorForeground(),null));
    termResults.put(booleanTerm,booleanResult);
    return booleanResult;
  }
  return BooleanResult.NOT_EVALUATED;
}
 

Project Name: codecover Package: org.codecover.eclipse.views

Source Code: BooleanAnalyzer.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Evaluates the given {@link RootTerm} and its {@link BooleanTerm}s under
 * the given assignment, by traversing the expression tree. The cells are
 * filled with their data during that traversing.
 * @param rootTermthe {@link RootTerm}, the {@link BooleanTerm} belongs to.
 * @param booleanTermthe {@link BooleanTerm}, that is currently evaluated.
 * @param assignmentthe {@link BooleanAssignment}, that is used to evaluate.
 * @param cellsthe {@link Map} of {@link CellObject}s, that is filled.
 * @param coveringAssignmentsthe {@link Map} of those {@link BooleanAssignment}s, that
 * cover a given {@link BasicBooleanTerm}.
 * @return The {@link BooleanResult} of the evaluation of the given{@link BooleanTerm}.
 */
private final BooleanResult evaluateTerm(RootTerm rootTerm,BooleanTerm booleanTerm,BooleanAssignment assignment,Map<BooleanTerm,CellObject> cells,Map<BasicBooleanTerm,Set<BooleanAssignment>> coveringAssignments){
  if (booleanTerm instanceof BasicBooleanTerm) {
    int position=rootTerm.getPositionOfTerm((BasicBooleanTerm)booleanTerm);
    BooleanResult booleanResult=assignment.getResults().get(position);
    Color coveredColor=null;
    if (coveringAssignments.get(booleanTerm).contains(assignment)) {
      coveredColor=getCoveredBackground();
    }
    cells.put(booleanTerm,new CellObject(getStringFromBooleanResult(booleanResult),null,coveredColor));
    termResults.put(booleanTerm,booleanResult);
    return booleanResult;
  }
 else   if (booleanTerm instanceof OperatorTerm) {
    OperatorTerm operatorTerm=(OperatorTerm)booleanTerm;
    List<BooleanResult> operatorResults=new LinkedList<BooleanResult>();
    for (    BooleanTerm subTerms : operatorTerm.getOperands()) {
      BooleanResult result=evaluateTerm(rootTerm,subTerms,assignment,cells,coveringAssignments);
      operatorResults.add(result);
    }
    BooleanAssignment operatorAssignment=new BooleanAssignment(operatorResults);
    Boolean result=((OperatorTerm)booleanTerm).getOperator().getPossibleAssignments().get(operatorAssignment);
    BooleanResult booleanResult;
    if (result == null) {
      booleanResult=BooleanResult.NOT_EVALUATED;
    }
 else {
      booleanResult=result ? BooleanResult.TRUE : BooleanResult.FALSE;
    }
    cells.put(booleanTerm,new CellObject(getStringFromBooleanResult(booleanResult),getOperatorForeground(),null));
    termResults.put(booleanTerm,booleanResult);
    return booleanResult;
  }
  return BooleanResult.NOT_EVALUATED;
}
 

Project Name: codecover Package: org.codecover.eclipse.views

Source Code: BooleanAnalyzer.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Constructor
 * @param cells
 * @param resultCell
 * @param testCaseCell
 */
public RowObject(Map<BooleanTerm,CellObject> cells,CellObject resultCell,CellObject testCaseCell){
  this.cells=new HashMap<BooleanTerm,CellObject>(cells);
  this.resultCell=resultCell;
  this.testCaseCell=testCaseCell;
}
 

Project Name: codecover Package: org.codecover.eclipse.views

Source Code: RecViewViewLabelProvider.java (Click to view .java file)

Method Code:
vote
like

public String getColumnText(Object obj,int index){
  DecimalFormat df=new DecimalFormat("0.#");
  UncoveredBranch branch=((UncoveredBranch)obj);
  Double double1=null;
switch (index) {
case 0:
    return branch.m_methode;
case 1:
  return branch.m_branchInfo.m_statementText.replaceAll("\t"," ").replaceAll("\n"," ").replaceAll("\r"," ").replaceAll("  "," ");
case 2:
return branch.m_branchInfo.m_type.getNiceName();
case 3:
double1=branch.score;
if (double1 == null) return "";
return df.format(double1);
case 4:
double1=branch.sourceScore.get(this.recommendationsView.recommendationGenerator.getCodeErrorDataSource());
if (double1 == null) return "";
return df.format(double1);
case 5:
double1=branch.sourceScore.get(this.recommendationsView.recommendationGenerator.getVersionErrorDataSource());
if (double1 == null) return "";
return df.format(double1);
case 6:
double1=branch.sourceScore.get(this.recommendationsView.recommendationGenerator.getCcErrorDataSource());
if (double1 == null) return "";
return df.format(double1);
case 7:
double1=branch.sourceScore.get(this.recommendationsView.recommendationGenerator.getExpertErrorDataSource());
if (double1 == null) return "";
return df.format(double1);
case 8:
double1=branch.sourceScore.get(this.recommendationsView.recommendationGenerator.getProcessDataSource());
if (double1 == null) return "";
return df.format(double1);
case 9:
double1=branch.sourceScore.get(this.recommendationsView.recommendationGenerator.getQualityErrorDataSource());
if (double1 == null) return "";
return df.format(double1);
case 10:
return branch.m_branchInfo.m_amountLines + "";
case 11:
return branch.m_testCaseList.size() + "";
default :
return getText(obj);
}
}
 

Project Name: codecover Package: org.codecover.eclipse.views

Source Code: ManualRedundancyView.java (Click to view .java file)

Method Code:
vote
like

private void restoreExpandedElements(ActiveTSContainerInfo activeTSCInfo){
  Object[] tscExpElems;
  if (activeTSCInfo != null) {
    tscExpElems=fetchTestSessions(this.expandedElements.get(activeTSCInfo),activeTSCInfo.getTestSessionContainer());
    if (tscExpElems != null) {
      this.viewer.setExpandedElements(tscExpElems);
    }
  }
}
 

Project Name: codecover Package: org.codecover.eclipse.views

Source Code: CoverageView.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Gets the actions for the given {@link Type}
 * @param rootTypethe given {@link Type}
 * @return the actions.
 */
public Action getGroupByAction(Type rootType){
  return this.actions.get(rootType);
}
 

Project Name: codecover Package: org.codecover.eclipse.views

Source Code: CoverageView.java (Click to view .java file)

Method Code:
vote
like

private void removeExpandedElements(TSContainerInfo tscInfo){
synchronized (this.updateLock) {
    this.expandedHLevIDs.remove(tscInfo);
  }
}
 

Project Name: codecover-instrumentation Package: org.codecover.instrumentation

Source Code: InstrumenterDescriptor.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Creates a Map with default values for all registered{@link InstrumenterDirective}s.<br>
 * <br>
 * For all {@link #instrumenterDirectives}, the {@link InstrumenterDirective#getDefaultValue()}is called. If the value is not <code>null</code>, the value is stored
 * in a Map.
 * @return A Map with default values for all {@link InstrumenterDirective}s.
 */
public Map<String,Object> getDefaultDirectiveValues(){
  Map<String,Object> directiveValues=new HashMap<String,Object>();
  for (  Entry<String,InstrumenterDirective> directiveEntry : this.instrumenterDirectives.entrySet()) {
    Object defaultValue=directiveEntry.getValue().getDefaultValue();
    if (defaultValue != null) {
      directiveValues.put(directiveEntry.getKey(),defaultValue);
    }
  }
  return directiveValues;
}
 

Project Name: codecover-instrumentation Package: org.codecover.instrumentation

Source Code: InstrumenterDescriptor.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Creates a Map with default values for all registered{@link InstrumenterDirective}s.<br>
 * <br>
 * For all {@link #instrumenterDirectives}, the {@link InstrumenterDirective#getDefaultValue()}is called. If the value is not <code>null</code>, the value is stored
 * in a Map.
 * @return A Map with default values for all {@link InstrumenterDirective}s.
 */
public Map<String,Object> getDefaultDirectiveValues(){
  Map<String,Object> directiveValues=new HashMap<String,Object>();
  for (  Entry<String,InstrumenterDirective> directiveEntry : this.instrumenterDirectives.entrySet()) {
    Object defaultValue=directiveEntry.getValue().getDefaultValue();
    if (defaultValue != null) {
      directiveValues.put(directiveEntry.getKey(),defaultValue);
    }
  }
  return directiveValues;
}
 

Project Name: codecover-instrumentation Package: org.codecover.instrumentation.booleanterms

Source Code: InstrBooleanOperator.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Constructs an operator with two operands.<br>
 * <br>
 * The {@link #partsOfOperator} is created using the image as a separator:<br>
 * <code>%s image %s</code>
 * @param nameThe name of the operator.
 * @param imageThe image of the operator.
 * @param possibleAssignmentsA {@link Map} with possible assignments and results for this
 * operator. See {@link BooleanOperator}.
 * @return The constructed {@link InstrBooleanOperator}.
 */
public static InstrBooleanOperator getTwoArgumentOperator(String name,String image,Map<BooleanAssignment,Boolean> possibleAssignments){
  String[] parts={""," " + image + " ",""};
  InstrBooleanOperator newOp=new InstrBooleanOperator(name,parts,possibleAssignments);
  return newOp;
}
 

Project Name: codecover-instrumentation Package: org.codecover.instrumentation.measurement

Source Code: CoverageResultLogReader.java (Click to view .java file)

Method Code:
vote
like

private static Map<CoverableItem,BooleanAssignmentMap> createAssignmentMaps(Map<CoverableItem,Map<BooleanAssignment,Long>> data){
  final Map<CoverableItem,BooleanAssignmentMap> result;
  result=new HashMap<CoverableItem,BooleanAssignmentMap>();
  for (  Map.Entry<CoverableItem,Map<BooleanAssignment,Long>> entry : data.entrySet()) {
    if (entry.getValue().size() == 0) {
    }
 else {
      final BooleanAssignment firstAssignment=entry.getValue().keySet().iterator().next();
      result.put(entry.getKey(),new BooleanAssignmentMap(firstAssignment.getLength(),entry.getValue()));
    }
  }
  return result;
}
 

Project Name: codecover-instrumentation Package: org.codecover.instrumentation.measurement

Source Code: CoverageResultLogReader.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Saves the given counter value under the given id. The current id prefix
 * is added to the id.
 * <p>
 * If the counter carries the prefix of a counter used for the{@link ConditionCoverage}, the assignment encoded in the id is extracted
 * and saved in the test case data.
 * @param counterIDthe id of the counter
 * @param counterValuethe value of the counter
 */
public void passCounter(String counterID,long counterValue){
  String prefix=(this.currentCounterIdPrefix == null ? "" : this.currentCounterIdPrefix);
  if (counterID.startsWith(ConditionCoverage.ID_PREFIX)) {
    String rootTermIdSubstring=counterID.substring(0,counterID.indexOf(MeasurementConstants.ID_ASSIGNMENT_SEPERATOR));
    String assignmentSubstring=counterID.substring(counterID.indexOf(MeasurementConstants.ID_ASSIGNMENT_SEPERATOR) + 1);
    CoverableItem coverableItem=this.builder.createCoverableItem(prefix,rootTermIdSubstring);
    Map<BooleanAssignment,Long> subMap=this.currentTestCaseAssignments.get(coverableItem);
    if (subMap == null) {
      subMap=new HashMap<BooleanAssignment,Long>();
    }
    BooleanAssignment currentAssignment=getBooleanAssignmentFromString(assignmentSubstring);
    if (counterValue == 0) {
    }
 else {
      subMap.put(currentAssignment,Long.valueOf(counterValue));
    }
    this.currentTestCaseAssignments.put(coverableItem,subMap);
  }
 else {
    CoverableItem coverableItem=this.builder.createCoverableItem(prefix,counterID);
    Long currentValue=this.currentTestCaseCoverageData.get(coverableItem);
    if (currentValue == null) {
      currentValue=new Long(0);
    }
    Long newValue=Long.valueOf(currentValue.longValue() + counterValue);
    this.currentTestCaseCoverageData.put(coverableItem,newValue);
  }
}
 

Project Name: codecover-instrumentation Package: org.codecover.instrumentation.measurement

Source Code: CoverageResultLogReader.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Saves the given counter value under the given id. The current id prefix
 * is added to the id.
 * <p>
 * If the counter carries the prefix of a counter used for the{@link ConditionCoverage}, the assignment encoded in the id is extracted
 * and saved in the test case data.
 * @param counterIDthe id of the counter
 * @param counterValuethe value of the counter
 */
public void passCounter(String counterID,long counterValue){
  String prefix=(this.currentCounterIdPrefix == null ? "" : this.currentCounterIdPrefix);
  if (counterID.startsWith(ConditionCoverage.ID_PREFIX)) {
    String rootTermIdSubstring=counterID.substring(0,counterID.indexOf(MeasurementConstants.ID_ASSIGNMENT_SEPERATOR));
    String assignmentSubstring=counterID.substring(counterID.indexOf(MeasurementConstants.ID_ASSIGNMENT_SEPERATOR) + 1);
    CoverableItem coverableItem=this.builder.createCoverableItem(prefix,rootTermIdSubstring);
    Map<BooleanAssignment,Long> subMap=this.currentTestCaseAssignments.get(coverableItem);
    if (subMap == null) {
      subMap=new HashMap<BooleanAssignment,Long>();
    }
    BooleanAssignment currentAssignment=getBooleanAssignmentFromString(assignmentSubstring);
    if (counterValue == 0) {
    }
 else {
      subMap.put(currentAssignment,Long.valueOf(counterValue));
    }
    this.currentTestCaseAssignments.put(coverableItem,subMap);
  }
 else {
    CoverableItem coverableItem=this.builder.createCoverableItem(prefix,counterID);
    Long currentValue=this.currentTestCaseCoverageData.get(coverableItem);
    if (currentValue == null) {
      currentValue=new Long(0);
    }
    Long newValue=Long.valueOf(currentValue.longValue() + counterValue);
    this.currentTestCaseCoverageData.put(coverableItem,newValue);
  }
}
 

Project Name: codecover-instrumentation Package: org.codecover.instrumentation.measurement

Source Code: CoverageResultLogReader.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Saves the given counter value under the given id. The current id prefix
 * is added to the id.
 * <p>
 * If the counter carries the prefix of a counter used for the{@link ConditionCoverage}, the assignment encoded in the id is extracted
 * and saved in the test case data.
 * @param counterIDthe id of the counter
 * @param counterValuethe value of the counter
 */
public void passCounter(String counterID,long counterValue){
  String prefix=(this.currentCounterIdPrefix == null ? "" : this.currentCounterIdPrefix);
  if (counterID.startsWith(ConditionCoverage.ID_PREFIX)) {
    String rootTermIdSubstring=counterID.substring(0,counterID.indexOf(MeasurementConstants.ID_ASSIGNMENT_SEPERATOR));
    String assignmentSubstring=counterID.substring(counterID.indexOf(MeasurementConstants.ID_ASSIGNMENT_SEPERATOR) + 1);
    CoverableItem coverableItem=this.builder.createCoverableItem(prefix,rootTermIdSubstring);
    Map<BooleanAssignment,Long> subMap=this.currentTestCaseAssignments.get(coverableItem);
    if (subMap == null) {
      subMap=new HashMap<BooleanAssignment,Long>();
    }
    BooleanAssignment currentAssignment=getBooleanAssignmentFromString(assignmentSubstring);
    if (counterValue == 0) {
    }
 else {
      subMap.put(currentAssignment,Long.valueOf(counterValue));
    }
    this.currentTestCaseAssignments.put(coverableItem,subMap);
  }
 else {
    CoverableItem coverableItem=this.builder.createCoverableItem(prefix,counterID);
    Long currentValue=this.currentTestCaseCoverageData.get(coverableItem);
    if (currentValue == null) {
      currentValue=new Long(0);
    }
    Long newValue=Long.valueOf(currentValue.longValue() + counterValue);
    this.currentTestCaseCoverageData.put(coverableItem,newValue);
  }
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: MASTBuilder.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Creates and returns an instance of a {@link BooleanOperator} containing
 * the given data.
 * @param aritythe arity of the {@link BooleanOperator}
 * @param possibleAssignmentsthe complete list of assignments, that can occur during
 * execution
 * @param namethe name of the {@link BooleanOperator}
 * @return the created {@link BooleanOperator}
 */
public BooleanOperator createBooleanOperator(int arity,Map<BooleanAssignment,Boolean> possibleAssignments,String name){
  BooleanOperator booleanOperator=Internal.createBooleanOperator(arity,possibleAssignments,name,this.logger);
  return booleanOperator;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: AbstractMetaDataProvider.java (Click to view .java file)

Method Code:
vote
like

Set<Map.Entry<String,Object>> getMetaDataMapEntries(){
synchronized (this.metaData) {
    return CollectionUtil.copy(this.metaData.entrySet());
  }
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_DOM.java (Click to view .java file)

Method Code:
vote
like

@Override protected void startElement(String elementName,Map<String,String> attributes) throws SAXException {
  Element element=getXMLDocument().createElementNS(NAMESPACE_TEST_SESSION_CONTAINER,elementName);
  for (  Map.Entry<String,String> entry : attributes.entrySet()) {
    String attributeName=entry.getKey();
    String attributeValue=entry.getValue();
    if (attributeName == null) {
      throw new NullPointerException("attributeName == null");
    }
    if (attributeValue == null) {
      throw new NullPointerException("attributeValue == null");
    }
    element.setAttribute(attributeName,attributeValue);
  }
  this.elementStack.push(element);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestSessionContainer.java (Click to view .java file)

Method Code:
vote
like

/** 
 * @return a map for all {@link RootTerm}s appearing in the code from the
 * RootTerm CoverableItem IDs to the RootTerms.
 */
public Map<CoverableItem,RootTerm> getRootTerms(){
  return this.rootTerms;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestSessionContainer.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Merges a collection of {@link TestCase}s into one single {@link TestCase} with a given new name and new
 * comment. All coverage data and assignment data the test cases contained is combined. The original{@link TestCase}s remain untouched.
 * <p>
 * All the test cases must have the same test session. The resulting test case will be in this test
 * session.
 * <p>
 * No meta data will carried over into the new test case.
 * @param testCasesthe given collection of test cases to be merged. This collection may not be empty.
 * @param newNamethe name of the merged test case
 * @param newCommentthe comment of the merged test case
 * @return the merged {@link TestCase}
 * @throws MergeException
 */
public TestCase mergeTestCases(Collection<TestCase> testCases,String newName,String newComment) throws MergeException {
  if (newName == null) {
    throw new NullPointerException("newName == null");
  }
  if (newComment == null) {
    throw new NullPointerException("newComment == null");
  }
  TestSession testSessionOfFirst=testCases.iterator().next().getTestSession();
  for (  TestCase testCase : testCases) {
    if (!testCase.getTestSession().equals(testSessionOfFirst)) {
      throw new MergeException("test sessions do not match: " + testCase.getTestSession() + " vs. "+ testSessionOfFirst);
    }
  }
  Pair<Map<CoverableItem,Long>,Map<CoverableItem,BooleanAssignmentMap>> mergedCoverage=TestCase.mergeTestCasesCoverage(testCases);
  TestCase newTestCase=testSessionOfFirst.createTestCase(newName,newComment,new Date(),mergedCoverage.first,mergedCoverage.second);
  return newTestCase;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestSessionContainer.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Merges a collection of {@link TestCase}s into one single {@link TestCase} with a given new name and new
 * comment. All coverage data and assignment data the test cases contained is combined. The original{@link TestCase}s remain untouched.
 * <p>
 * All the test cases must have the same test session. The resulting test case will be in this test
 * session.
 * <p>
 * No meta data will carried over into the new test case.
 * @param testCasesthe given collection of test cases to be merged. This collection may not be empty.
 * @param newNamethe name of the merged test case
 * @param newCommentthe comment of the merged test case
 * @return the merged {@link TestCase}
 * @throws MergeException
 */
public TestCase mergeTestCases(Collection<TestCase> testCases,String newName,String newComment) throws MergeException {
  if (newName == null) {
    throw new NullPointerException("newName == null");
  }
  if (newComment == null) {
    throw new NullPointerException("newComment == null");
  }
  TestSession testSessionOfFirst=testCases.iterator().next().getTestSession();
  for (  TestCase testCase : testCases) {
    if (!testCase.getTestSession().equals(testSessionOfFirst)) {
      throw new MergeException("test sessions do not match: " + testCase.getTestSession() + " vs. "+ testSessionOfFirst);
    }
  }
  Pair<Map<CoverableItem,Long>,Map<CoverableItem,BooleanAssignmentMap>> mergedCoverage=TestCase.mergeTestCasesCoverage(testCases);
  TestCase newTestCase=testSessionOfFirst.createTestCase(newName,newComment,new Date(),mergedCoverage.first,mergedCoverage.second);
  return newTestCase;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestSessionContainer.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Gets the parent of the given {@link HierarchyLevel} <br>
 * FIXME: What should be returned, when the topLevel is given?
 * @param hierarchyLevelthe {@link HierarchyLevel}, whose parent is desired
 * @return the parent of the {@link HierarchyLevel}
 * @throws IllegalArgumentExceptionwhen the given {@link HierarchyLevel} was not part of this{@link TestSessionContainer}
 */
public HierarchyLevel getParentOfHierarchyLevel(HierarchyLevel hierarchyLevel){
  if (hierarchyLevel == null) {
    throw new NullPointerException("hierarchyLevel == null");
  }
  if (this.parentMap == null) {
    final Map<HierarchyLevel,HierarchyLevel> newParentMap=new HashMap<HierarchyLevel,HierarchyLevel>();
    this.code.accept(new HierarchyLevel.DefaultVisitor(){
      @Override public void visit(      HierarchyLevel hierarchyLevel){
        for (        HierarchyLevel childLevel : hierarchyLevel.getChildren()) {
          newParentMap.put(childLevel,hierarchyLevel);
        }
      }
    }
,null,null,null,null,null,null,null,null);
    this.parentMap=newParentMap;
  }
  HierarchyLevel parentHierarchyLevel=this.parentMap.get(hierarchyLevel);
  if (parentHierarchyLevel == null && !hierarchyLevel.equals(getCode())) {
    throw new IllegalArgumentException("The given HierarchyLevel " + "is not part of this TestSessionContainer");
  }
  return parentHierarchyLevel;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestCase.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Associates a given object as metadata with a given {@link MetaDataObject}under a given key
 * @param namethe key used to retrieve the object
 * @param metaDataObjectthe {@link MetaDataObject} the metadata is associated with
 * @return the retrieved object or <code>null</code>, if no object was
 * associated with the given {@link MetaDataObject} under the given
 * key.
 */
public Object getObjectMetaData(String name,MetaDataObject metaDataObject){
  if (name == null) {
    throw new NullPointerException("name == null");
  }
  if (metaDataObject == null) {
    throw new NullPointerException("metaDataObject == null");
  }
  final long id=Internal.getMetaDataId(metaDataObject.getMetaData());
synchronized (this.objectMetaData) {
    Map<Long,Object> map=this.objectMetaData.get(name);
    if (map == null) {
      return null;
    }
    return map.get(id);
  }
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestCase.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Returns the assignments of the given term which occured during the run of
 * this testcase and the result of the expression under each assignment.
 * @param termthe RootTerm of whom to get the assignments
 * @return a Map containing all the assignments as well as the resulting
 * boolean value
 */
public Map<BooleanAssignment,Boolean> getAssignments(RootTerm term){
  if (term == null) {
    throw new NullPointerException("term == null");
  }
  Map<BooleanAssignment,Boolean> result;
synchronized (this.cachedAssignments) {
    result=this.cachedAssignments.get(term);
  }
  if (result == null) {
    result=new HashMap<BooleanAssignment,Boolean>();
    for (    BooleanAssignment booleanAssignment : getAssignmentsCount(term).getData().keySet()) {
      Boolean assignmentResult=term.getAssignmentResult(booleanAssignment);
      if (assignmentResult == null) {
      }
 else {
        result.put(booleanAssignment,assignmentResult);
      }
    }
    result=Collections.unmodifiableMap(result);
synchronized (this.cachedAssignments) {
      this.cachedAssignments.put(term,result);
    }
  }
  return result;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestCase.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Returns the assignments of the given term which occured during the run of
 * this testcase and the result of the expression under each assignment.
 * @param termthe RootTerm of whom to get the assignments
 * @return a Map containing all the assignments as well as the resulting
 * boolean value
 */
public Map<BooleanAssignment,Boolean> getAssignments(RootTerm term){
  if (term == null) {
    throw new NullPointerException("term == null");
  }
  Map<BooleanAssignment,Boolean> result;
synchronized (this.cachedAssignments) {
    result=this.cachedAssignments.get(term);
  }
  if (result == null) {
    result=new HashMap<BooleanAssignment,Boolean>();
    for (    BooleanAssignment booleanAssignment : getAssignmentsCount(term).getData().keySet()) {
      Boolean assignmentResult=term.getAssignmentResult(booleanAssignment);
      if (assignmentResult == null) {
      }
 else {
        result.put(booleanAssignment,assignmentResult);
      }
    }
    result=Collections.unmodifiableMap(result);
synchronized (this.cachedAssignments) {
      this.cachedAssignments.put(term,result);
    }
  }
  return result;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestCase.java (Click to view .java file)

Method Code:
vote
like

Map<String,Map<Long,Object>> getObjectMetaDataMapEntries(){
synchronized (this.objectMetaData) {
    return CollectionUtil.copy(this.objectMetaData);
  }
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestCase.java (Click to view .java file)

Method Code:
vote
like

public int compare(TestCase o1,TestCase o2){
  return IntComparator.compare(o2.coverageData.size() + o2.assignments.size(),o1.coverageData.size() + o1.assignments.size());
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestCase.java (Click to view .java file)

Method Code:
vote
like

public int compare(TestCase o1,TestCase o2){
  return IntComparator.compare(o2.coverageData.size() + o2.assignments.size(),o1.coverageData.size() + o1.assignments.size());
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestSession.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Creates a test case and adds it to this test session.
 * @param namethe name of the test case
 * @param commentthe comment associated with this test case
 * @param datethe date this test case was created
 * @param coverageDatathe measured coverage associated with this test case
 * @param assignmentsthe measured assignments of the conditions contained in the
 * root terms of the MAST
 * @return the created test session
 */
public TestCase createTestCase(String name,String comment,Date date,Map<CoverableItem,Long> coverageData,Map<CoverableItem,BooleanAssignmentMap> assignments){
  if (name == null) {
    throw new NullPointerException("name == null");
  }
  if (comment == null) {
    throw new NullPointerException("comment == null");
  }
  if (date == null) {
    throw new NullPointerException("date == null");
  }
  if (coverageData == null) {
    throw new NullPointerException("coverageData == null");
  }
  if (assignments == null) {
    throw new NullPointerException("assignments == null");
  }
  final TestCase testCase;
synchronized (this.lock) {
    assertNotDeleting();
    String newName=NameReoccurenceHelper.escapeName(getTestCaseNames(),name);
    testCase=new TestCase(this,date,coverageData,assignments,newName,comment);
    this.testCases.add(testCase);
  }
  testCase.notifyChangeListener(ChangeType.ADD);
  notifyChangeListener(ChangeType.CHANGE);
  return testCase;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: TestSession.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Creates a test case and adds it to this test session.
 * @param namethe name of the test case
 * @param commentthe comment associated with this test case
 * @param datethe date this test case was created
 * @param coverageDatathe measured coverage associated with this test case
 * @param assignmentsthe measured assignments of the conditions contained in the
 * root terms of the MAST
 * @return the created test session
 */
public TestCase createTestCase(String name,String comment,Date date,Map<CoverableItem,Long> coverageData,Map<CoverableItem,BooleanAssignmentMap> assignments){
  if (name == null) {
    throw new NullPointerException("name == null");
  }
  if (comment == null) {
    throw new NullPointerException("comment == null");
  }
  if (date == null) {
    throw new NullPointerException("date == null");
  }
  if (coverageData == null) {
    throw new NullPointerException("coverageData == null");
  }
  if (assignments == null) {
    throw new NullPointerException("assignments == null");
  }
  final TestCase testCase;
synchronized (this.lock) {
    assertNotDeleting();
    String newName=NameReoccurenceHelper.escapeName(getTestCaseNames(),name);
    testCase=new TestCase(this,date,coverageData,assignments,newName,comment);
    this.testCases.add(testCase);
  }
  testCase.notifyChangeListener(ChangeType.ADD);
  notifyChangeListener(ChangeType.CHANGE);
  return testCase;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Starts element for a map of {@link RootTerm}s to another map of{@link BooleanAssignment}s and {@link Boolean}s
 * @param assignmentsMapthe map to be saved
 * @throws SAXException
 */
private void createAssignmentListElement(Map<CoverableItem,BooleanAssignmentMap> assignmentsMap) throws SAXException {
  if (assignmentsMap == null) {
    throw new NullPointerException("assignmentsMapEntries == null");
  }
  startElement(ELEMENT_ASSIGNMENT_LIST,getEmptyAttributes());
  Map<String,Map<String,BooleanAssignmentMap>> convertedEntry=convertMap(assignmentsMap);
  for (  Entry<String,Map<String,BooleanAssignmentMap>> entry : convertedEntry.entrySet()) {
    createAssignmentPrefixElement(entry.getKey(),entry.getValue());
  }
  endElement(ELEMENT_ASSIGNMENT_LIST);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Starts element for a map of {@link RootTerm}s to another map of{@link BooleanAssignment}s and {@link Boolean}s
 * @param assignmentsMapthe map to be saved
 * @throws SAXException
 */
private void createAssignmentListElement(Map<CoverableItem,BooleanAssignmentMap> assignmentsMap) throws SAXException {
  if (assignmentsMap == null) {
    throw new NullPointerException("assignmentsMapEntries == null");
  }
  startElement(ELEMENT_ASSIGNMENT_LIST,getEmptyAttributes());
  Map<String,Map<String,BooleanAssignmentMap>> convertedEntry=convertMap(assignmentsMap);
  for (  Entry<String,Map<String,BooleanAssignmentMap>> entry : convertedEntry.entrySet()) {
    createAssignmentPrefixElement(entry.getKey(),entry.getValue());
  }
  endElement(ELEMENT_ASSIGNMENT_LIST);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

private void createAssignmentPrefixElement(String prefix,Map<String,BooleanAssignmentMap> map) throws SAXException {
  Map<String,String> atts=getNewAttributes();
  atts.put(ROOT_TERM_COVERABLE_ITEM_PREFIX,prefix);
  startElement(ELEMENT_ASSIGNMENT_PREFIX,atts);
  for (  Map.Entry<String,BooleanAssignmentMap> entry : map.entrySet()) {
    String rootTermId=entry.getKey();
    Map<String,String> subAtts=getNewAttributes();
    subAtts.put(ROOT_TERM_COVERABLE_ITEM_ID,rootTermId);
    subAtts.put(LENGTH,Integer.toString(entry.getValue().getLength()));
    createBooleanAssignmentLongMapListElement(ELEMENT_ASSIGNMENT_LIST_ENTRY,entry.getValue().getData().entrySet(),subAtts);
  }
  endElement(ELEMENT_ASSIGNMENT_PREFIX);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Starts element for the list of coverage counters.
 * @param coverageDatathe given set containing the id and the value of the counter
 * @throws SAXException
 */
private void createCoverageListElement(Map<CoverableItem,Long> coverageData) throws SAXException {
  if (coverageData == null) {
    throw new NullPointerException("coverageData == null");
  }
  startElement(ELEMENT_COVERAGE_LIST,getEmptyAttributes());
  Map<String,Map<String,Long>> convertedMap=convertMap(coverageData);
  for (  Map.Entry<String,Map<String,Long>> entry : convertedMap.entrySet()) {
    createCoveragePrefixElement(entry.getKey(),entry.getValue());
  }
  endElement(ELEMENT_COVERAGE_LIST);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Starts element for the list of coverage counters.
 * @param coverageDatathe given set containing the id and the value of the counter
 * @throws SAXException
 */
private void createCoverageListElement(Map<CoverableItem,Long> coverageData) throws SAXException {
  if (coverageData == null) {
    throw new NullPointerException("coverageData == null");
  }
  startElement(ELEMENT_COVERAGE_LIST,getEmptyAttributes());
  Map<String,Map<String,Long>> convertedMap=convertMap(coverageData);
  for (  Map.Entry<String,Map<String,Long>> entry : convertedMap.entrySet()) {
    createCoveragePrefixElement(entry.getKey(),entry.getValue());
  }
  endElement(ELEMENT_COVERAGE_LIST);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Starts element for the prefix of a {@link CoverableItem} and appends all
 * the counters with the given prefix to the element.
 * @param prefixthe prefix
 * @param mapthe map holding the counter ids and the counter values.
 * @throws SAXException
 */
private void createCoveragePrefixElement(String prefix,Map<String,Long> map) throws SAXException {
  Map<String,String> atts=getNewAttributes();
  atts.put(COVERABLE_ITEM_PREFIX,prefix);
  startElement(ELEMENT_COVERAGE_PREFIX,atts);
  for (  Entry<String,Long> entry : map.entrySet()) {
    if (entry.getValue().longValue() != 0L) {
      createCoverageElement(entry.getKey(),entry.getValue());
    }
  }
  endElement(ELEMENT_COVERAGE_PREFIX);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Starts element for lists of {@link MetaData} associated with{@link MetaDataObject}s
 * @param objectMetaDataMapthe map containing the name, with which the {@link MetaData}is mapped, as well as a reference to the{@link MetaDataObject} the {@link MetaData} is associated
 * with.
 * @throws SAXException
 */
private void createObjectMetaDataListElement(Map<String,Map<Long,Object>> objectMetaDataMap) throws SAXException {
  if (objectMetaDataMap == null) {
    throw new NullPointerException("objectMetaDataMapEntries == null");
  }
  startElement(ELEMENT_OBJECT_META_DATA_LIST,getEmptyAttributes());
  for (  Entry<String,Map<Long,Object>> entry : objectMetaDataMap.entrySet()) {
    for (    Map.Entry<Long,Object> subEntry : entry.getValue().entrySet()) {
      if (subEntry != null) {
        createObjectMetaDataListEntryElement(entry.getKey(),this.metaDataObjectIdMap.get(subEntry.getKey()),subEntry.getValue());
      }
    }
  }
  endElement(ELEMENT_OBJECT_META_DATA_LIST);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Starts element for a list of{@link HierarchyLevelType HierarchyLevelTypes}
 * @param setthe Set containing the{@link HierarchyLevelType HierarchyLevelTypes}
 * @throws SAXException
 */
private void createHierarchyLevelTypeListElement(Set<HierarchyLevelType> set) throws SAXException {
  if (set == null) {
    throw new NullPointerException("map == null");
  }
  startElement(ELEMENT_HIERARCHY_LEVEL_TYPE_LIST,getEmptyAttributes());
  for (  HierarchyLevelType entry : set) {
    String id=generateID();
    this.hierarchyLevelTypeIdMap.put(entry,id);
    createHierarchyLevelTypeElement(entry,id);
  }
  endElement(ELEMENT_HIERARCHY_LEVEL_TYPE_LIST);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Starts element for {@link RootTerm}s
 * @param rootTermthe given element of the mast
 * @throws SAXException
 */
private void createRootTermElement(RootTerm rootTerm) throws SAXException {
  if (rootTerm == null) {
    throw new NullPointerException("rootTerm == null");
  }
  String internalId=storeMetaDataObject(rootTerm);
  this.rootTermIdMap.put(rootTerm,internalId);
  Map<String,String> attributes=getNewAttributes();
  attributes.put(INTERNAL_ID,internalId);
  attributes.put(COVERABLE_ITEM_ID,rootTerm.getCoverableItem().getId());
  attributes.put(COVERABLE_ITEM_PREFIX,rootTerm.getCoverableItem().getPrefix());
  startElement(ELEMENT_ROOT_TERM,attributes);
  createBooleanTermElement(rootTerm.getTerm());
  endElement(ELEMENT_ROOT_TERM);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Starts element for a list of {@link BooleanOperator BooleanOperators}
 * @param setthe set of {@link BooleanOperator BooleanOperators}
 * @throws SAXException
 */
private void createBooleanOperatorListElement(Set<BooleanOperator> set) throws SAXException {
  startElement(ELEMENT_BOOLEAN_OPERATOR_LIST,getEmptyAttributes());
  for (  BooleanOperator entry : set) {
    String id=generateID();
    this.operatorIdMap.put(entry,id);
    createBooleanOperatorElement(entry,id);
  }
  endElement(ELEMENT_BOOLEAN_OPERATOR_LIST);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Starts element for a list of {@link SourceFile}s
 * @param filesthe list of {@link SourceFile}s
 * @throws SAXException
 */
private void createSourceFileListElement(List<SourceFile> files) throws SAXException {
  startElement(ELEMENT_SOURCE_FILE_LIST,getEmptyAttributes());
  for (  SourceFile sourceFile : files) {
    String sourceFileId=generateID();
    this.sourceFileIdMap.put(sourceFile,sourceFileId);
    createSourceFileElement(sourceFile,sourceFileId);
  }
  endElement(ELEMENT_SOURCE_FILE_LIST);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Converts a map of {@link CoverableItem}s and a generic other object A,
 * into a Map<String,Map<String,A>>, with the first String being the
 * prefix of the {@link CoverableItem} and the second one, the id of the{@link CoverableItem}.
 * @param<A>
 * the type of the generic part of the map
 * @param dataToConvertthe map to convert
 * @return the converted map.
 */
protected static <A>Map<String,Map<String,A>> convertMap(Map<CoverableItem,A> dataToConvert){
  final Map<String,Map<String,A>> map=new TreeMap<String,Map<String,A>>();
  for (  Map.Entry<CoverableItem,A> entry : dataToConvert.entrySet()) {
    final String prefix=entry.getKey().getPrefix();
    final String id=entry.getKey().getId();
    final A data=entry.getValue();
    Map<String,A> subMap=map.get(prefix);
    if (subMap == null) {
      subMap=new TreeMap<String,A>();
      map.put(prefix,subMap);
    }
    subMap.put(id,data);
  }
  return map;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Converts a map of {@link CoverableItem}s and a generic other object A,
 * into a Map<String,Map<String,A>>, with the first String being the
 * prefix of the {@link CoverableItem} and the second one, the id of the{@link CoverableItem}.
 * @param<A>
 * the type of the generic part of the map
 * @param dataToConvertthe map to convert
 * @return the converted map.
 */
protected static <A>Map<String,Map<String,A>> convertMap(Map<CoverableItem,A> dataToConvert){
  final Map<String,Map<String,A>> map=new TreeMap<String,Map<String,A>>();
  for (  Map.Entry<CoverableItem,A> entry : dataToConvert.entrySet()) {
    final String prefix=entry.getKey().getPrefix();
    final String id=entry.getKey().getId();
    final A data=entry.getValue();
    Map<String,A> subMap=map.get(prefix);
    if (subMap == null) {
      subMap=new TreeMap<String,A>();
      map.put(prefix,subMap);
    }
    subMap.put(id,data);
  }
  return map;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Converts a map of {@link CoverableItem}s and a generic other object A,
 * into a Map<String,Map<String,A>>, with the first String being the
 * prefix of the {@link CoverableItem} and the second one, the id of the{@link CoverableItem}.
 * @param<A>
 * the type of the generic part of the map
 * @param dataToConvertthe map to convert
 * @return the converted map.
 */
protected static <A>Map<String,Map<String,A>> convertMap(Map<CoverableItem,A> dataToConvert){
  final Map<String,Map<String,A>> map=new TreeMap<String,Map<String,A>>();
  for (  Map.Entry<CoverableItem,A> entry : dataToConvert.entrySet()) {
    final String prefix=entry.getKey().getPrefix();
    final String id=entry.getKey().getId();
    final A data=entry.getValue();
    Map<String,A> subMap=map.get(prefix);
    if (subMap == null) {
      subMap=new TreeMap<String,A>();
      map.put(prefix,subMap);
    }
    subMap.put(id,data);
  }
  return map;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_Base.java (Click to view .java file)

Method Code:
vote
like

private String storeMetaDataObject(MetaDataObject dataObject){
  String internalId=generateID();
  this.metaDataObjectIdMap.put(Internal.getMetaDataId(dataObject.getMetaData()),internalId);
  return internalId;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLReader1_0_SAX.java (Click to view .java file)

Method Code:
vote
like

/** 
 * @param attributes
 */
protected void handleStartElementHierarchyLevelType(Attributes attributes){
  String internalId=attributes.getValue(INTERNAL_ID);
  String englishName=attributes.getValue(ENGLISH_NAME);
  String internalName=attributes.getValue(INTERNAL_NAME);
  HierarchyLevelType hierarchyLevelType=this.builder.createHierarchyLevelType(englishName,internalName);
  this.idHierarchyLevelTypeMap.put(internalId,hierarchyLevelType);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLReader1_0_SAX.java (Click to view .java file)

Method Code:
vote
like

/** 
 * @param attributes
 */
protected void handleStartElementSourceFile(Attributes attributes){
  String content=attributes.getValue(CONTENT);
  String filename=attributes.getValue(FILENAME);
  String internalId=attributes.getValue(INTERNAL_ID);
  SourceFile sourceFile=this.builder.createSourceFile(filename,content);
  this.tscStore.sourceFiles.add(sourceFile);
  this.idSourceFileMap.put(internalId,sourceFile);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLReader1_0_SAX.java (Click to view .java file)

Method Code:
vote
like

protected void handleEndElementBooleanOperator(){
  BooleanOperator booleanOperator=this.builder.createBooleanOperator(this.booleanOperatorStore.arity,this.booleanOperatorStore.assignmentsMap,this.booleanOperatorStore.name);
  this.idBooleanOperatorMap.put(this.booleanOperatorStore.internalId,booleanOperator);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLReader1_0_SAX.java (Click to view .java file)

Method Code:
vote
like

protected void handleEndElementBooleanOperator(){
  BooleanOperator booleanOperator=this.builder.createBooleanOperator(this.booleanOperatorStore.arity,this.booleanOperatorStore.assignmentsMap,this.booleanOperatorStore.name);
  this.idBooleanOperatorMap.put(this.booleanOperatorStore.internalId,booleanOperator);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLReader1_0_SAX.java (Click to view .java file)

Method Code:
vote
like

protected void handleEndElementQuestionMarkOperator(){
  QuestionMarkOperatorStore store=this.questionMarkOperatorStoreStack.pop();
  QuestionMarkOperatorExpression expr1=new QuestionMarkOperatorExpression(this.questionMarkOperatorExpression1.locationList,this.questionMarkOperatorExpression1.coverableItem);
  QuestionMarkOperatorExpression expr2=new QuestionMarkOperatorExpression(this.questionMarkOperatorExpression2.locationList,this.questionMarkOperatorExpression2.coverableItem);
  QuestionMarkOperator questionMarkOperator=new QuestionMarkOperator(store.locationList,store.coverableItem,expr1,expr2);
  questionMarkOperators.add(questionMarkOperator);
  this.idQuestionMarkOperatorMap.put(store.internalId,questionMarkOperator);
  this.idMetaDataObjectMap.put(store.internalId,questionMarkOperator);
  this.currentLocationReciever.pop();
  this.questionMarkOperatorExpression1=null;
  this.questionMarkOperatorExpression2=null;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLReader1_0_SAX.java (Click to view .java file)

Method Code:
vote
like

protected void handleEndElementRootTerm(){
  RootTermStore termStore=this.rootTermStoreStack.pop();
  RootTerm rootTerm=this.builder.createRootTerm(termStore.term,termStore.coverableItem);
  this.currentLocationReciever.pop();
  String currentReciever=this.currentLocationReciever.peek();
  if (currentReciever.equals(ELEMENT_CONDITIONAL_STATEMENT)) {
    ConditionalStatementStore store=this.conditionalStatementStoreStack.peek();
    store.terms.add(rootTerm);
  }
 else   if (currentReciever.equals(ELEMENT_LOOPING_STATEMENT)) {
    LoopStatementStore store=this.loopStatementStoreStack.peek();
    store.terms.add(rootTerm);
  }
 else   if (currentReciever.equals(ELEMENT_BASIC_STATEMENT)) {
    BasicStatementStore store=this.basicStatementStore;
    store.terms.add(rootTerm);
  }
  this.idMetaDataObjectMap.put(termStore.internalId,rootTerm);
  this.idRootTermMap.put(termStore.internalId,rootTerm);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLReader1_0_SAX.java (Click to view .java file)

Method Code:
vote
like

protected void handleEndElementBasicBooleanTerm(){
  BasicBooleanTermStore termStore=this.basicBooleanTermStoreStack.pop();
  BasicBooleanTerm basicTerm=this.builder.createBasicBooleanTerm(termStore.locationList);
  this.currentLocationReciever.pop();
  if (this.operatorTermStoreStack.isEmpty()) {
    RootTermStore rootTermStore=this.rootTermStoreStack.peek();
    rootTermStore.term=basicTerm;
  }
 else {
    OperatorTermStore parentStore=this.operatorTermStoreStack.peek();
    parentStore.operands.add(basicTerm);
  }
  this.idMetaDataObjectMap.put(termStore.internalId,basicTerm);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLReader1_0_SAX.java (Click to view .java file)

Method Code:
vote
like

protected void handleEndElementTestCase(){
  TestCase testCase=this.currentTestSession.createTestCase(this.currentTestCaseStore.name,this.currentTestCaseStore.comment,this.currentTestCaseStore.date,this.currentTestCaseStore.coverageData,this.currentTestCaseStore.assignments);
  for (  ObjectMetaDataListEntryStore store : this.objectMetaDataStack) {
    testCase.setObjectMetaData(store.name,store.metaDataObject,store.metadata);
  }
  this.objectMetaDataStack.clear();
  for (  MetaDataListEntryStore store : this.metaDataStack) {
    testCase.setMetaData(store.name,store.metadata);
  }
  this.metaDataStack.clear();
  this.currentTestCaseStore=null;
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLReader1_0_SAX.java (Click to view .java file)

Method Code:
vote
like

protected void handleEndElementAssignmentsListEntry(){
  AssignmentsListEntryStore store=this.currentAssignmentsListEntryStore;
  BooleanAssignmentMap map=new BooleanAssignmentMap(store.length,store.possibleAssignments);
  this.currentTestCaseStore.assignments.put(store.coverableItem,map);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLReader1_0_SAX.java (Click to view .java file)

Method Code:
vote
like

protected void handleEndElementAssignmentsListEntry(){
  AssignmentsListEntryStore store=this.currentAssignmentsListEntryStore;
  BooleanAssignmentMap map=new BooleanAssignmentMap(store.length,store.possibleAssignments);
  this.currentTestCaseStore.assignments.put(store.coverableItem,map);
}
 

Project Name: codecover-model Package: org.codecover.model

Source Code: XMLWriter1_0_SAX.java (Click to view .java file)

Method Code:
vote
like

@Override protected void startElement(String elementName,Map<String,String> attributes) throws SAXException {
  AttributesImpl atts=new AttributesImpl();
  for (  Map.Entry<String,String> entry : attributes.entrySet()) {
    String attributeName=entry.getKey();
    String attributeValue=entry.getValue();
    if (attributeName == null) {
      throw new NullPointerException("attributeName == null");
    }
    if (attributeValue == null) {
      throw new NullPointerException("attributeValue == null");
    }
    atts.addAttribute(NAMESPACE_TEST_SESSION_CONTAINER,attributeName,attributeName,"CDATA",attributeValue);
  }
  getContentHandler().startElement(NAMESPACE_TEST_SESSION_CONTAINER,elementName,elementName,atts);
}
 

Project Name: codecover-model Package: org.codecover.model.extensions

Source Code: PluginManager.java (Click to view .java file)

Method Code:
vote
like

public Set<PluginHandle> getPluginHandles(){
  final Set<PluginHandle> result=new HashSet<PluginHandle>();
synchronized (lock) {
    for (    TreeMap<Integer,LoadedPlugin> map : loadedPlugins.values()) {
      for (      LoadedPlugin plugin : map.values()) {
        final PluginHandle handle=plugin.handle;
        if (handle != null) {
          result.add(handle);
        }
      }
    }
  }
  return Collections.unmodifiableSet(result);
}
 

Project Name: codecover-model Package: org.codecover.model.extensions

Source Code: AbstractPlugin.java (Click to view .java file)

Method Code:
vote
like

public <T>Extension<T> getExtensionByName(Class<T> interfaceType,String name){
  final Map<String,Extension<?>> map=extensionMap.get(interfaceType);
  if (map == null) {
    return null;
  }
  final Extension<?> result=map.get(name);
  if (result == null) {
    return null;
  }
 else {
    return cast(interfaceType,result);
  }
}
 

Project Name: codecover-model Package: org.codecover.model.extensions

Source Code: AbstractPlugin.java (Click to view .java file)

Method Code:
vote
like

public <T>Extension<T> getExtensionByName(Class<T> interfaceType,String name){
  final Map<String,Extension<?>> map=extensionMap.get(interfaceType);
  if (map == null) {
    return null;
  }
  final Extension<?> result=map.get(name);
  if (result == null) {
    return null;
  }
 else {
    return cast(interfaceType,result);
  }
}
 

Project Name: codecover-model Package: org.codecover.model.extensions

Source Code: PluginUtils.java (Click to view .java file)

Method Code:
vote
like

public File resolve(String name,int majorVersion) throws PluginLoadException {
  final Pair<Integer,String> pair=nameIndex.get(Pair.create(name,majorVersion));
  if (pair == null) {
    throw new PluginLoadException("Cannot find plugin with name " + name + " and major version "+ majorVersion);
  }
  filesToLoad.remove(pair.second);
  return new File(directory,pair.second);
}
 

Project Name: codecover-model Package: org.codecover.model.mast

Source Code: RootTerm.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Für Auswertungen ggf. ganz nützlich: die Anzahl der Einzelterme
 * @return
 */
public int getAmountBasicBooleanTerms(){
  return this.termMap.size();
}
 

Project Name: codecover-model Package: org.codecover.model.mast

Source Code: RootTerm.java (Click to view .java file)

Method Code:
vote
like

/** 
 * returns the BasicBooleanTerm at the specified position in the RootTerm or
 * throws an IllegalArgumentException in case the position is out of bounds
 * @param positionthe position of the BasicBooleanTerm
 * @return the BasicBooleanTerm at the specified position
 */
public BasicBooleanTerm getTermAtPosition(int position){
  if (!this.posMap.containsKey(position)) {
    throw new IllegalArgumentException("position out of bounds");
  }
  return this.posMap.get(position);
}
 

Project Name: codecover-model Package: org.codecover.model.mast

Source Code: BooleanOperator.java (Click to view .java file)

Method Code:
vote
like

/** 
 * returns the decision table for the operator
 * Example: {[TRUE, FALSE]=false, [FALSE, NOT_EVALUATED]=false, [TRUE, TRUE]=true}
 * @return the possibleAssignments
 */
public Map<BooleanAssignment,Boolean> getPossibleAssignments(){
  return this.possibleAssignments;
}
 

Project Name: codecover-model Package: org.codecover.model.mast

Source Code: Internal.java (Click to view .java file)

Method Code:
vote
like

/** 
 * Creates and returns an instance of a {@link BooleanOperator} containing
 * the given data.
 * @param aritythe arity of the {@link BooleanOperator}
 * @param possibleAssignmentsthe complete list of assignments, that can occur during
 * execution
 * @param namethe name of the {@link BooleanOperator}
 * @param loggerthe logger to be used
 * @return the created {@link BooleanOperator}
 */
public static BooleanOperator createBooleanOperator(int arity,Map<BooleanAssignment,Boolean> possibleAssignments,String name,Logger logger){
  BooleanOperator booleanOperator=new BooleanOperator(arity,possibleAssignments,name);
  return booleanOperator;
}
 

Project Name: codecover-model Package: org.codecover.model.mast

Source Code: HierarchyLevel.java (Click to view .java file)

Method Code:
vote
like

@Override protected void addData(final Map<HierarchyLevel,HierarchyLevel> map){
  accept(new DefaultVisitor(){
    @Override public void visit(    HierarchyLevel hierarchyLevel){
      for (      HierarchyLevel child : hierarchyLevel.getChildren()) {
        map.put(child,hierarchyLevel);
      }
    }
  }
,null,null,null,null,null,null,null,null);
}
 

Project Name: codecover-model Package: org.codecover.model.mast

Source Code: HierarchyLevel.java (Click to view .java file)

Method Code:
vote
like

@Override public void visit(HierarchyLevel hierarchyLevel){
  for (  HierarchyLevel child : hierarchyLevel.getChildren()) {
    map.put(child,hierarchyLevel);
  }
}
 

Project Name: codecover-model Package: org.codecover.model.mast

Source Code: HierarchyLevel.java (Click to view .java file)

Method Code:
vote
like

@Override protected void addData(final Map<StatementSequence,Object> map){
  accept(new DefaultVisitor(){
    @Override public void visit(    HierarchyLevel hierarchyLevel){
      for (      StatementSequence sequence : hierarchyLevel.getSequences()) {
        map.put(sequence,hierarchyLevel);
      }
    }
  }
,null,new Statement.DefaultVisitor(){
    @Override public void visit(    LoopingStatement statement){
      map.put(statement.getBody(),statement);
    }
    @Override public void visit(    Branch branch){
      map.put(branch.getSequence(),branch);
    }
  }
,null,null,null,null,null,null);
}