From 4c8f483860a7d5e016e257178bc43fdd9d963eb5 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 26 Dec 2016 16:57:39 +0300 Subject: [PATCH] cleanup --- .../src/com/intellij/util/graph/DFSTBuilder.java | 13 ++++++++----- .../util/src/com/intellij/util/graph/Graph.java | 3 +++ .../src/com/intellij/util/graph/GraphGenerator.java | 5 ++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/platform/util/src/com/intellij/util/graph/DFSTBuilder.java b/platform/util/src/com/intellij/util/graph/DFSTBuilder.java index 1b3b22d7e277..073ab2b74532 100644 --- a/platform/util/src/com/intellij/util/graph/DFSTBuilder.java +++ b/platform/util/src/com/intellij/util/graph/DFSTBuilder.java @@ -255,17 +255,20 @@ public class DFSTBuilder { if (componentSizes.isEmpty()) return Collections.emptyList(); return new MyCollection>(componentSizes.size()) { + @NotNull @Override public Iterator> iterator() { return new MyIterator>(componentSizes.size()) { - private int offset = 0; + private int offset; @Override protected Collection get(int i) { - final int cSize = componentSizes.get(i), cOffset = offset; + final int cSize = componentSizes.get(i); + final int cOffset = offset; if (cSize == 0) return Collections.emptyList(); offset += cSize; return new MyCollection(cSize) { + @NotNull @Override public Iterator iterator() { return new MyIterator(cSize) { @@ -282,7 +285,7 @@ public class DFSTBuilder { }; } - private static abstract class MyCollection extends AbstractCollection { + private abstract static class MyCollection extends AbstractCollection { private final int size; protected MyCollection(int size) { @@ -295,9 +298,9 @@ public class DFSTBuilder { } } - private static abstract class MyIterator implements Iterator { + private abstract static class MyIterator implements Iterator { private final int size; - private int i = 0; + private int i; protected MyIterator(int size) { this.size = size; diff --git a/platform/util/src/com/intellij/util/graph/Graph.java b/platform/util/src/com/intellij/util/graph/Graph.java index aab996994600..c97876a33795 100644 --- a/platform/util/src/com/intellij/util/graph/Graph.java +++ b/platform/util/src/com/intellij/util/graph/Graph.java @@ -22,9 +22,12 @@ import java.util.Iterator; * @author dsl */ public interface Graph extends InboundSemiGraph, OutboundSemiGraph { + @Override Collection getNodes(); + @Override Iterator getIn(Node n); + @Override Iterator getOut(Node n); } \ No newline at end of file diff --git a/platform/util/src/com/intellij/util/graph/GraphGenerator.java b/platform/util/src/com/intellij/util/graph/GraphGenerator.java index a7315975ebc9..c2b44d463f47 100644 --- a/platform/util/src/com/intellij/util/graph/GraphGenerator.java +++ b/platform/util/src/com/intellij/util/graph/GraphGenerator.java @@ -15,12 +15,15 @@ */ package com.intellij.util.graph; +import org.jetbrains.annotations.NotNull; + import java.util.*; /** * @author dsl */ public class GraphGenerator implements Graph { + @NotNull public static Graph generate(InboundSemiGraph graph) { return new GraphGenerator(graph); } @@ -28,7 +31,7 @@ public class GraphGenerator implements Graph { private final InboundSemiGraph myGraph; private final Map> myOuts; - private GraphGenerator(InboundSemiGraph graph) { + private GraphGenerator(@NotNull InboundSemiGraph graph) { myGraph = graph; myOuts = new LinkedHashMap>(); buildOuts();