public Problem(IProblem problem, int stringSize, float optValue, double sigmaK) {
   this.problem = problem;
   Problem.n = stringSize;
   Problem.optimumValue = optValue;
   Problem.sigma = Math.sqrt((double) (sigmaK * stringSize));
   Problem.problemName = (sigma == 0) ? problem.toString() : "NOISY-" + problem.toString();
 }
예제 #2
0
 private void addMarkers(
     Collection<IProblem> items, String markerType, IFile file, IProgressMonitor monitor)
     throws CoreException {
   if (CollectionsUtil.isEmpty(items)) {
     return;
   }
   SubMonitor sub = SubMonitor.convert(monitor, items.size() * 2);
   for (IProblem item : items) {
     IMarker marker = file.createMarker(markerType);
     sub.worked(1);
     marker.setAttributes(item.createMarkerAttributes());
     sub.worked(1);
   }
   sub.done();
 }
 private void addMarker(BuildContext context, IProblem problem) throws CoreException {
   IMarker marker = context.getFile().createMarker(IAptanaModelMarker.PROBLEM_MARKER);
   Map<String, Object> attributes = new HashMap<String, Object>();
   attributes.put(IMarker.CHAR_START, problem.startOffset());
   attributes.put(IMarker.CHAR_END, problem.endOffset());
   attributes.put(IMarker.MESSAGE, problem.getMessage());
   attributes.put(IMarker.SEVERITY, problem.getSeverity());
   if (problem.lineNumber() > 0) attributes.put(IMarker.LINE_NUMBER, problem.lineNumber());
   attributes.put(IAptanaModelMarker.ID, problem.getId());
   marker.setAttributes(attributes);
 }