update copyright
[fedora-idea.git] / java / java-impl / src / com / intellij / codeInsight / guess / impl / DfaInstanceofValue.java
blob574fa5eeb92c485970b93e2a6f503a17e50fe795
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.codeInsight.guess.impl;
18 import com.intellij.codeInspection.dataFlow.value.DfaValue;
19 import com.intellij.codeInspection.dataFlow.value.DfaValueFactory;
20 import com.intellij.psi.PsiExpression;
21 import com.intellij.psi.PsiType;
22 import org.jetbrains.annotations.NotNull;
23 import org.jetbrains.annotations.Nullable;
25 /**
26 * @author peter
28 public class DfaInstanceofValue extends DfaValue {
29 private final PsiExpression myExpression;
30 private final PsiType myCastType;
31 private final boolean myNegated;
33 public DfaInstanceofValue(DfaValueFactory factory, PsiExpression expression, PsiType castType) {
34 this(factory, expression, castType, false);
37 public DfaInstanceofValue(DfaValueFactory factory, PsiExpression expression, PsiType castType, boolean negated) {
38 super(factory);
39 myExpression = expression;
40 myCastType = castType;
41 myNegated = negated;
44 @Nullable
45 public PsiExpression getExpression() {
46 return myExpression;
49 @NotNull
50 public PsiType getCastType() {
51 return myCastType;
54 public boolean isNegated() {
55 return myNegated;
58 @Override
59 public DfaValue createNegated() {
60 return new DfaInstanceofValue(myFactory, myExpression, myCastType, !myNegated);