update copyright
[fedora-idea.git] / java / java-impl / src / com / intellij / psi / controlFlow / ConditionalBranchingInstruction.java
blob9badea8fc49ded85869e1648a9ba8ba3149574a3
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.psi.controlFlow;
18 import com.intellij.openapi.diagnostic.Logger;
19 import com.intellij.psi.PsiExpression;
21 /**
22 * Author: msk
24 public abstract class ConditionalBranchingInstruction extends BranchingInstruction {
25 protected static final Logger LOG = Logger.getInstance("#com.intellij.psi.controlFlow.ConditionalGoToInstruction");
26 public final PsiExpression expression;
28 public ConditionalBranchingInstruction(int offset, final PsiExpression expression, Role role) {
29 super(offset, role);
30 this.expression = expression;
33 public int nNext() { return 2; }
35 public int getNext(int index, int no) {
36 switch (no) {
37 case 0: return offset;
38 case 1: return index + 1;
39 default:
40 LOG.assertTrue (false);
41 return -1;
45 public void accept(ControlFlowInstructionVisitor visitor, int offset, int nextOffset) {
46 visitor.visitConditionalBranchingInstruction(this, offset, nextOffset);