Package org.biojava.utils.bytecode

# Class CodeUtils

java.lang.Object
org.biojava.utils.bytecode.CodeUtils

public class CodeUtils extends Object
Utility code for things you will frequently need.

This class provides common constants representing access modifiers and types. There are also some utility methods for munging data.

Author:
  Thomas Down, Matthew Pocock

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`ACC_ABSTRACT`
`static final int`
`ACC_FINAL`
`static final int`
`ACC_INTERFACE`
`static final int`
`ACC_NATIVE`
`static final int`
`ACC_PRIVATE`
`static final int`
`ACC_PROTECTED`
`static final int`
`ACC_PUBLIC`
`static final int`
`ACC_STATIC`
`static final int`
`ACC_STRICT`
`static final int`
`ACC_SUPER`
`static final int`
`ACC_SYNCHRONIZED`
`static final int`
`ACC_TRANSIENT`
`static final int`
`ACC_VOLATILE`
`static final CodeGenerator`
`DO_NOTHING`
`static final CodeClass[]`
`EMPTY_LIST`
`static final CodeClass`
`TYPE_BOOLEAN`
`static final CodeClass`
`TYPE_BYTE`
`static final CodeClass`
`TYPE_CHAR`
`static final CodeClass`
`TYPE_DOUBLE`
`static final CodeClass`
`TYPE_FLOAT`
`static final CodeClass`
`TYPE_INT`
`static final CodeClass`
`TYPE_LONG`
`static final CodeClass`
`TYPE_OBJECT`
`static final CodeClass`
`TYPE_SHORT`
`static final CodeClass`
`TYPE_VOID`

## Constructor Summary

Constructors
Constructor
Description
`CodeUtils()`

## Method Summary

Modifier and Type
Method
Description
`static String`
`classListToString(CodeClass[] classes)`
Format an array of classes as a comma-seperated list.
`static boolean`
`isFloatType(CodeClass cc)`
Returns true if the class is a floating point number.
`static boolean`
`isIntegerType(CodeClass cc)`
Returns true if the class is an integer number.
`static int`
`wordsForType(CodeClass cc)`
Number of words needed for local variables of this type.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### ACC_PUBLIC

public static final int ACC_PUBLIC

See Also:
  - Constant Field Values

### ACC_PRIVATE

public static final int ACC_PRIVATE

See Also:
  - Constant Field Values

### ACC_PROTECTED

public static final int ACC_PROTECTED

See Also:
  - Constant Field Values

### ACC_STATIC

public static final int ACC_STATIC

See Also:
  - Constant Field Values

### ACC_FINAL

public static final int ACC_FINAL

See Also:
  - Constant Field Values

### ACC_SUPER

public static final int ACC_SUPER

See Also:
  - Constant Field Values

### ACC_SYNCHRONIZED

public static final int ACC_SYNCHRONIZED

See Also:
  - Constant Field Values

### ACC_VOLATILE

public static final int ACC_VOLATILE

See Also:
  - Constant Field Values

### ACC_TRANSIENT

public static final int ACC_TRANSIENT

See Also:
  - Constant Field Values

### ACC_NATIVE

public static final int ACC_NATIVE

See Also:
  - Constant Field Values

### ACC_INTERFACE

public static final int ACC_INTERFACE

See Also:
  - Constant Field Values

### ACC_ABSTRACT

public static final int ACC_ABSTRACT

See Also:
  - Constant Field Values

### ACC_STRICT

public static final int ACC_STRICT

See Also:
  - Constant Field Values

### TYPE_VOID

public static final CodeClass TYPE_VOID

### TYPE_INT

public static final CodeClass TYPE_INT

### TYPE_FLOAT

public static final CodeClass TYPE_FLOAT

### TYPE_DOUBLE

public static final CodeClass TYPE_DOUBLE

### TYPE_LONG

public static final CodeClass TYPE_LONG

### TYPE_BYTE

public static final CodeClass TYPE_BYTE

### TYPE_SHORT

public static final CodeClass TYPE_SHORT

### TYPE_CHAR

public static final CodeClass TYPE_CHAR

### TYPE_BOOLEAN

public static final CodeClass TYPE_BOOLEAN

### TYPE_OBJECT

public static final CodeClass TYPE_OBJECT

### EMPTY_LIST

public static final CodeClass[] EMPTY_LIST

### DO_NOTHING

public static final CodeGenerator DO_NOTHING

## Constructor Details

### CodeUtils

public CodeUtils()

## Method Details

### classListToString

public static String classListToString(CodeClass[] classes)
Format an array of classes as a comma-seperated list.

The names of each class in classes will be seperated by a comma and a space and will use CodeClass.getName() to produce strings for each one. Their names will be present in the return value in the same order they are found in the classes array

Parameters:
  `classes` - the array of classes to format
Returns:
  a String containing the list of class names

### wordsForType

public static int wordsForType(CodeClass cc)
Number of words needed for local variables of this type.

Longs and doubles require 2 words (64 bits), where as everything else needs 1 word (32 bits). Void needs no words. This just hides that knowledge.

Parameters:
  `cc` - the CodeClass to check word size for
Returns:
  number of words needed for this type

### isFloatType

public static boolean isFloatType(CodeClass cc)
Returns true if the class is a floating point number.

Double and Float are floating point numbers. All other classes are not.

Parameters:
  `cc` - the class to check
Returns:
  true if the class can be used to represent floating point numbers

### isIntegerType

public static boolean isIntegerType(CodeClass cc)
Returns true if the class is an integer number.

All numeric types are integer (whole number) types, except for the floating point types. All other classes are not integer types.

Parameters:
  `cc` - the class to check
Returns:
  true if the class can be used to represent integer numbers