@Override public boolean equals(Object o) { ToolsImpl tools = (ToolsImpl) o; if (myEnabled != tools.myEnabled) return false; if (getTools().size() != tools.getTools().size()) return false; for (int i = 0; i < getTools().size(); i++) { final ScopeToolState state = getTools().get(i); final ScopeToolState toolState = tools.getTools().get(i); if (!state.equalTo(toolState)) { return false; } } return true; }
private void reduceConvertedScopes() { for (ToolsImpl tools : myTools.values()) { final ScopeToolState toolState = tools.getDefaultState(); final List<ScopeToolState> nonDefaultTools = tools.getNonDefaultTools(); if (nonDefaultTools != null) { boolean equal = true; boolean isEnabled = toolState.isEnabled(); for (ScopeToolState state : nonDefaultTools) { isEnabled |= state.isEnabled(); if (!state.equalTo(toolState)) { equal = false; } } tools.setEnabled(isEnabled); if (equal) { tools.removeAllScopes(); } } } }