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; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ScalarType getType () { if ( type != null && type.eIsProxy () ) { InternalEObject oldType = (InternalEObject)type; type = (ScalarType)eResolveProxy ( oldType ); if ( type != oldType ) { InternalEObject newType = (InternalEObject)type; NotificationChain msgs = oldType.eInverseRemove ( this, EOPPOSITE_FEATURE_BASE - MemoryPackage.ATTRIBUTE__TYPE, null, null ); if ( newType.eInternalContainer () == null ) { msgs = newType.eInverseAdd ( this, EOPPOSITE_FEATURE_BASE - MemoryPackage.ATTRIBUTE__TYPE, null, msgs ); } if ( msgs != null ) msgs.dispatch (); if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, MemoryPackage.ATTRIBUTE__TYPE, oldType, type ) ); } } return type; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ScalarType getType () { if ( type != null && type.eIsProxy () ) { InternalEObject oldType = (InternalEObject)type; type = (ScalarType)eResolveProxy ( oldType ); if ( type != oldType ) { InternalEObject newType = (InternalEObject)type; NotificationChain msgs = oldType.eInverseRemove ( this, EOPPOSITE_FEATURE_BASE - MemoryPackage.ATTRIBUTE__TYPE, null, null ); if ( newType.eInternalContainer () == null ) { msgs = newType.eInverseAdd ( this, EOPPOSITE_FEATURE_BASE - MemoryPackage.ATTRIBUTE__TYPE, null, msgs ); } if ( msgs != null ) msgs.dispatch (); if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, MemoryPackage.ATTRIBUTE__TYPE, oldType, type ) ); } } return type; }
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; }