001    /*
002     * Copyright 2010-2015 JetBrains s.r.o.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.jetbrains.kotlin.cfg;
018    
019    import com.google.common.collect.Sets;
020    import org.jetbrains.kotlin.psi.KtElement;
021    
022    import java.util.Collections;
023    import java.util.Set;
024    
025    public class BreakableBlockInfo extends BlockInfo {
026        private final KtElement element;
027        private final Label entryPoint;
028        private final Label exitPoint;
029        private final Set<Label> referablePoints = Sets.newHashSet();
030    
031        public BreakableBlockInfo(KtElement element, Label entryPoint, Label exitPoint) {
032            this.element = element;
033            this.entryPoint = entryPoint;
034            this.exitPoint = exitPoint;
035            markReferablePoints(entryPoint, exitPoint);
036        }
037    
038        protected void markReferablePoints(Label... labels) {
039            Collections.addAll(referablePoints, labels);
040        }
041    
042        public KtElement getElement() {
043            return element;
044        }
045    
046        public Label getEntryPoint() {
047            return entryPoint;
048        }
049    
050        public Label getExitPoint() {
051            return exitPoint;
052        }
053    
054        public Set<Label> getReferablePoints() {
055            return referablePoints;
056        }
057    }