/*
 * Copyright 2000-2009 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.intellij.codeInspection.ex;

import com.intellij.codeInspection.InspectionProfile;
import com.intellij.util.xmlb.annotations.MapAnnotation;
import com.intellij.util.xmlb.annotations.Property;

import java.util.HashMap;
import java.util.Map;

public class VisibleTreeStateComponent {
  @Property(surroundWithTag = false)
  @MapAnnotation(surroundWithTag=false, surroundKeyWithTag = false, surroundValueWithTag = false)
  public Map<String, VisibleTreeState> myProfileNameToState = new HashMap<>();

  public void copyFrom(VisibleTreeStateComponent state) {
    myProfileNameToState.clear();
    myProfileNameToState.putAll(state.myProfileNameToState);
  }

  public VisibleTreeState getVisibleTreeState(InspectionProfile profile) {
    VisibleTreeState state = myProfileNameToState.get(profile.getName());
    if (state == null) {
      state = new VisibleTreeState();
      myProfileNameToState.put(profile.getName(), state);
    }
    return state;
  }
}

@@ -594,17 +594,16 @@
 se.%0A */%0A
-%0A
 package 
@@ -632,17 +632,16 @@
 ction.ex
-;
 %0A%0Aimport
@@ -686,17 +686,16 @@
 nProfile
-;
 %0Aimport 
@@ -742,17 +742,16 @@
 notation
-;
 %0Aimport 
@@ -793,18 +793,16 @@
 Property
-;%0A
 %0Aimport 
@@ -815,47 +815,11 @@
 til.
-HashMap;%0Aimport java.util.Map;%0A%0Apublic 
+*%0A%0A
 clas
@@ -917,17 +917,19 @@
 dWithTag
-=
+ = 
 false, s
@@ -987,23 +987,49 @@
 alse)%0A  
-public 
+var myProfileNameToState: Mutable
 Map%3CStri
@@ -1054,42 +1054,17 @@
 te%3E 
-myProfileNameToState = new
+=
  HashMap
 %3C%3E()
@@ -1063,28 +1063,17 @@
 hMap
-%3C%3E
 ()
-;
 %0A%0A  
-public void
+fun
  cop
@@ -1078,16 +1078,23 @@
 opyFrom(
+state: 
 VisibleT
@@ -1110,22 +1110,16 @@
 omponent
- state
 ) %7B%0A    
@@ -1146,17 +1146,16 @@
 .clear()
-;
 %0A    myP
@@ -1210,17 +1210,16 @@
 ate)
-;
 %0A  %7D%0A%0A  
 publ
@@ -1218,31 +1218,11 @@
 %0A%0A  
-public VisibleTreeState
+fun
  get
@@ -1238,16 +1238,25 @@
 eeState(
+profile: 
 Inspecti
@@ -1268,23 +1268,44 @@
 file
- profile) %7B%0A   
+): VisibleTreeState %7B%0A    var state:
  Vis
@@ -1317,22 +1317,17 @@
 reeState
- state
+?
  = myPro
@@ -1345,21 +1345,17 @@
 tate
-.get(
+%5B
 profile.
 getN
@@ -1354,19 +1354,13 @@
 ile.
-getName());
+name%5D
 %0A   
@@ -1398,12 +1398,8 @@
 te =
- new
  Vis
@@ -1413,17 +1413,16 @@
 eState()
-;
 %0A      m
@@ -1457,25 +1457,20 @@
 ile.
-getN
+n
 ame
-()
 , state)
 ;%0A  
@@ -1465,17 +1465,16 @@
 , state)
-;
 %0A    %7D%0A 
@@ -1488,16 +1488,15 @@
 rn state
-;
 %0A  %7D%0A%7D%0A

convert VisibleTreeStateComponent to kotlin