}
private Resource resourceOrProject(Resource resource) {
- return (resource != null ? resource : project);
+ return resource!=null ? resource : project;
}
}
DecoratorContext decorateResource(Resource resource, Collection<Decorator> decorators, boolean executeDecorators) {
List<DecoratorContext> childrenContexts = Lists.newArrayList();
for (Resource child : index.getChildren(resource)) {
- boolean isModule = (child instanceof Project);
+ boolean isModule = child instanceof Project;
DefaultDecoratorContext childContext = (DefaultDecoratorContext) decorateResource(child, decorators, !isModule);
childrenContexts.add(childContext.setReadOnly(true));
}
private void enableCurrentSnapshot() {
Snapshot previousLastSnapshot = resourcePersister.getLastSnapshot(snapshot, false);
- boolean isLast = (previousLastSnapshot == null || previousLastSnapshot.getCreatedAt().before(snapshot.getCreatedAt()));
+ boolean isLast = previousLastSnapshot == null || previousLastSnapshot.getCreatedAt().before(snapshot.getCreatedAt());
setFlags(snapshot, isLast, Snapshot.STATUS_PROCESSED);
logSuccess(LoggerFactory.getLogger(getClass()));
}
query.setParameter("last", last);
query.setParameter("rootId", snapshot.getId());
query.setParameter("path", snapshot.getPath() + snapshot.getId() + ".%");
- query.setParameter("pathRootId", (snapshot.getRootId() == null ? snapshot.getId() : snapshot.getRootId()));
+ query.setParameter("pathRootId", snapshot.getRootId()==null ? snapshot.getId() : snapshot.getRootId());
query.executeUpdate();
session.commit();
public File getFileFromBuildDirectory(String filename) {
File file = new File(getBuildDir(), filename);
- return (file.exists() ? file : null);
+ return file.exists() ? file : null;
}
public Resource toResource(File file) {
if (relativePath == null) {
return null;
}
- return (file.isFile() ? new org.sonar.api.resources.File(relativePath.path()) : new org.sonar.api.resources.Directory(relativePath.path()));
+ return file.isFile() ? new org.sonar.api.resources.File(relativePath.path()) : new org.sonar.api.resources.Directory(relativePath.path());
}
public List<InputFile> mainFiles(String... langs) {
}
public String toHtml(Reader code, HtmlOptions options) {
- HtmlOptions opts = (options == null ? HtmlOptions.DEFAULT : options);
+ HtmlOptions opts = options == null ? HtmlOptions.DEFAULT : options;
return new HtmlRenderer(opts).render(code, tokenizers);
}
public boolean match(int endFlag) {
literalValue.append((char) endFlag);
- return (code.lastChar() == firstChar && evenNumberOfBackSlashBeforeDelimiter() && literalValue.length() > 1);
+ return code.lastChar()==firstChar && evenNumberOfBackSlashBeforeDelimiter() && literalValue.length()>1;
}
private boolean evenNumberOfBackSlashBeforeDelimiter() {
public ComponentVertex getComponent(String key) {
Vertex vertex = GraphUtil.single(getUnderlyingGraph().getVertices("key", key));
- return (vertex != null ? wrapComponent(vertex) : null);
+ return vertex != null ? wrapComponent(vertex) : null;
}
public ComponentVertex addComponent(Resource resource, @Nullable Snapshot snapshot) {
ActiveDashboardMapper mapper = session.getMapper(ActiveDashboardMapper.class);
try {
Integer max = mapper.selectMaxOrderIndexForNullUser();
- return (max != null ? max.intValue() : 0);
+ return max != null ? max.intValue() : 0;
} finally {
session.close();
}
return files;
}
- public String getPluginFilename() {
- return (!files.isEmpty() ? files.get(0).getFilename() : null);
- }
-
@Override
public boolean equals(Object o) {
if (this == o) {
return CollectionUtils.select(getMetricsByName().values(), new Predicate() {
public boolean evaluate(Object o) {
Metric m = (Metric) o;
- return (m.getEnabled() && m.getOrigin() != Metric.Origin.JAV);
+ return m.getEnabled() && m.getOrigin() != Metric.Origin.JAV;
}
});
}
public String toHexString() {
StringBuilder hex = new StringBuilder(2 * bytes.length);
for (byte b : bytes) {
- hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt((b & 0x0F)));
+ hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt(b & 0x0F));
}
return hex.toString();
}
Map<String, String> map = KeyValueFormat.parse(measure.getData());
for (Map.Entry<String, String> entry : map.entrySet()) {
String key = entry.getKey();
- int value = (StringUtils.isBlank(entry.getValue()) ? 0 : Integer.parseInt(entry.getValue()));
+ int value = StringUtils.isBlank(entry.getValue()) ? 0 : Integer.parseInt(entry.getValue());
if (NumberUtils.isNumber(key)) {
add(NumberUtils.toInt(key), value);
} else {
if (measure != null) {
result = measure.getVariation(periodIndex);
}
- return (result != null ? result : defaultValue);
+ return result != null ? result : defaultValue;
}
public static Long getVariationAsLong(Measure measure, int periodIndex) {
}
static boolean isType(Object extension, Class<? extends Extension> extensionClass) {
- Class clazz = (extension instanceof Class ? (Class) extension : extension.getClass());
+ Class clazz = extension instanceof Class ? (Class) extension : extension.getClass();
return extensionClass.isAssignableFrom(clazz);
}
}