當前位置: 首頁>>代碼示例>>Java>>正文


Java DfaValue.createNegated方法代碼示例

本文整理匯總了Java中com.intellij.codeInspection.dataFlow.value.DfaValue.createNegated方法的典型用法代碼示例。如果您正苦於以下問題:Java DfaValue.createNegated方法的具體用法?Java DfaValue.createNegated怎麽用?Java DfaValue.createNegated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.codeInspection.dataFlow.value.DfaValue的用法示例。


在下文中一共展示了DfaValue.createNegated方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visitNot

import com.intellij.codeInspection.dataFlow.value.DfaValue; //導入方法依賴的package包/類
public DfaInstructionState[] visitNot(NotInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) {
  DfaValue dfaValue = memState.pop();

  dfaValue = dfaValue.createNegated();
  memState.push(dfaValue);
  return nextInstruction(instruction, runner, memState);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:InstructionVisitor.java

示例2: visitNot

import com.intellij.codeInspection.dataFlow.value.DfaValue; //導入方法依賴的package包/類
public DfaInstructionState[] visitNot(NotInstruction instruction, DataFlowRunner runner, DfaMemoryState memState)
{
	DfaValue dfaValue = memState.pop();

	dfaValue = dfaValue.createNegated();
	memState.push(dfaValue);
	return nextInstruction(instruction, runner, memState);
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:9,代碼來源:InstructionVisitor.java

示例3: visitConditionalGoto

import com.intellij.codeInspection.dataFlow.value.DfaValue; //導入方法依賴的package包/類
public DfaInstructionState[] visitConditionalGoto(ConditionalGotoInstruction instruction, DataFlowRunner runner, DfaMemoryState memState) {
  DfaValue cond = memState.pop();

  DfaValue condTrue;
  DfaValue condFalse;

  if (instruction.isNegated()) {
    condFalse = cond;
    condTrue = cond.createNegated();
  } else {
    condTrue = cond;
    condFalse = cond.createNegated();
  }

  if (condTrue == runner.getFactory().getConstFactory().getTrue()) {
    markBranchReachable(instruction, true);
    return new DfaInstructionState[] {new DfaInstructionState(runner.getInstruction(instruction.getOffset()), memState)};
  }

  if (condFalse == runner.getFactory().getConstFactory().getTrue()) {
    markBranchReachable(instruction, false);
    return nextInstruction(instruction, runner, memState);
  }

  ArrayList<DfaInstructionState> result = new ArrayList<DfaInstructionState>();

  DfaMemoryState thenState = memState.createCopy();
  DfaMemoryState elseState = memState.createCopy();

  if (thenState.applyCondition(condTrue)) {
    result.add(new DfaInstructionState(runner.getInstruction(instruction.getOffset()), thenState));
    markBranchReachable(instruction, true);
  }

  if (elseState.applyCondition(condFalse)) {
    result.add(new DfaInstructionState(runner.getInstruction(instruction.getIndex() + 1), elseState));
    markBranchReachable(instruction, false);
  }

  return result.toArray(new DfaInstructionState[result.size()]);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:42,代碼來源:InstructionVisitor.java

示例4: visitConditionalGoto

import com.intellij.codeInspection.dataFlow.value.DfaValue; //導入方法依賴的package包/類
public DfaInstructionState[] visitConditionalGoto(ConditionalGotoInstruction instruction, DataFlowRunner runner, DfaMemoryState memState)
{
	DfaValue cond = memState.pop();

	DfaValue condTrue;
	DfaValue condFalse;

	if(instruction.isNegated())
	{
		condFalse = cond;
		condTrue = cond.createNegated();
	}
	else
	{
		condTrue = cond;
		condFalse = cond.createNegated();
	}

	if(condTrue == runner.getFactory().getConstFactory().getTrue())
	{
		markBranchReachable(instruction, true);
		return new DfaInstructionState[]{new DfaInstructionState(runner.getInstruction(instruction.getOffset()), memState)};
	}

	if(condFalse == runner.getFactory().getConstFactory().getTrue())
	{
		markBranchReachable(instruction, false);
		return nextInstruction(instruction, runner, memState);
	}

	ArrayList<DfaInstructionState> result = new ArrayList<>();

	DfaMemoryState thenState = memState.createCopy();
	DfaMemoryState elseState = memState.createCopy();

	if(thenState.applyCondition(condTrue))
	{
		result.add(new DfaInstructionState(runner.getInstruction(instruction.getOffset()), thenState));
		markBranchReachable(instruction, true);
	}

	if(elseState.applyCondition(condFalse))
	{
		result.add(new DfaInstructionState(runner.getInstruction(instruction.getIndex() + 1), elseState));
		markBranchReachable(instruction, false);
	}

	return result.toArray(new DfaInstructionState[result.size()]);
}
 
開發者ID:consulo,項目名稱:consulo-java,代碼行數:50,代碼來源:InstructionVisitor.java


注:本文中的com.intellij.codeInspection.dataFlow.value.DfaValue.createNegated方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。