Jode 1.90-CVS
Build Aug 6, 2004

net.sf.jode.flow
Class CaseBlock

java.lang.Object
  extended bynet.sf.jode.flow.StructuredBlock
      extended bynet.sf.jode.flow.CaseBlock

public class CaseBlock
extends StructuredBlock

This block represents a case instruction. A case instruction is a part of a switch construction and may have a subpart or not (for multiple case directly after each other.

Author:
Jochen Hoenicke

Constructor Summary
CaseBlock(boolean isDef)
           
CaseBlock(int value)
           
 
Method Summary
 void checkConsistent()
           
 void dumpInstruction(TabbedPrintWriter writer)
          Print the instruction expressing this structured block.
 StructuredBlock[] getSubBlocks()
          Returns all sub block of this structured block.
 boolean jumpMayBeChanged()
          Determines if there is a sub block, that flows through to the end of this block.
 boolean replaceSubBlock(StructuredBlock oldBlock, StructuredBlock newBlock)
          Replaces the given sub block with a new block.
protected  boolean wantBraces()
          Tells if we want braces around this case.
 
Methods inherited from class net.sf.jode.flow.StructuredBlock
appendBlock, contains, copyJump, doTransformations, dumpSource, fillInGenSet, flowMayBeChanged, getDeclarables, getNextBlock, getNextBlock, getNextFlowBlock, getNextFlowBlock, isEmpty, isSingleExit, makeDeclaration, mapStackToLocal, moveJump, needsBraces, prependBlock, propagateUsage, removeBlock, removeJump, removeOnetimeLocals, removePush, replace, setFlowBlock, setJump, setSuccessors, simplify, swapJump, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CaseBlock

public CaseBlock(int value)

CaseBlock

public CaseBlock(boolean isDef)
Method Detail

checkConsistent

public void checkConsistent()
Overrides:
checkConsistent in class StructuredBlock

replaceSubBlock

public boolean replaceSubBlock(StructuredBlock oldBlock,
                               StructuredBlock newBlock)
Replaces the given sub block with a new block.

Overrides:
replaceSubBlock in class StructuredBlock
Parameters:
oldBlock - the old sub block.
newBlock - the new sub block.
Returns:
false, if oldBlock wasn't a direct sub block.

wantBraces

protected boolean wantBraces()
Tells if we want braces around this case. We only need braces if there is a declaration on the first level (list of sequential blocks).


getSubBlocks

public StructuredBlock[] getSubBlocks()
Returns all sub block of this structured block.

Overrides:
getSubBlocks in class StructuredBlock

dumpInstruction

public void dumpInstruction(TabbedPrintWriter writer)
                     throws java.io.IOException
Description copied from class: StructuredBlock
Print the instruction expressing this structured block.

Specified by:
dumpInstruction in class StructuredBlock
Parameters:
writer - The tabbed print writer, where we print to.
Throws:
java.io.IOException

jumpMayBeChanged

public boolean jumpMayBeChanged()
Determines if there is a sub block, that flows through to the end of this block. If this returns true, you know that jump is null.

Overrides:
jumpMayBeChanged in class StructuredBlock
Returns:
true, if the jump may be safely changed.

Jode 1.90-CVS
Build Aug 6, 2004

Copyright © 1998-2004 by Jochen Hoenicke.