public static int calculateByteSize ( final int offset, final TypeDefinition typeDefinition ) { if ( typeDefinition == null ) { return 0; } int max = 0; for ( final Variable var : typeDefinition.getVariables () ) { if ( var.getType () == null ) { continue; } max = Math.max ( max, offset + var.getType ().getIndex () + var.getType ().getLength () ); for ( final Attribute attr : var.getAttributes () ) { if ( attr.getType () == null ) { continue; } max = Math.max ( max, offset + attr.getType ().getIndex () + attr.getType ().getLength () ); } } return max; }
public static int calculateByteSize ( final int offset, final TypeDefinition typeDefinition ) { if ( typeDefinition == null ) { return 0; } int max = 0; for ( final Variable var : typeDefinition.getVariables () ) { if ( var.getType () == null ) { continue; } max = Math.max ( max, offset + var.getType ().getIndex () + var.getType ().getLength () ); for ( final Attribute attr : var.getAttributes () ) { if ( attr.getType () == null ) { continue; } max = Math.max ( max, offset + attr.getType ().getIndex () + attr.getType ().getLength () ); } } return max; }