/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public String encode () { return String.format ( "UDT:%s:%s", this.index, this.type.getName () ); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public TypeDefinition getType () { if ( type != null && type.eIsProxy () ) { InternalEObject oldType = (InternalEObject)type; type = (TypeDefinition)eResolveProxy ( oldType ); if ( type != oldType ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, DavePackage.DAVE_BLOCK_DEFINITION__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; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public TypeDefinition getType () { if ( type != null && type.eIsProxy () ) { InternalEObject oldType = (InternalEObject)type; type = (TypeDefinition)eResolveProxy ( oldType ); if ( type != oldType ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, MemoryPackage.USER_DEFINED_TYPE__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; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TypeDefinition getType () { if ( type != null && type.eIsProxy () ) { InternalEObject oldType = (InternalEObject)type; type = (TypeDefinition)eResolveProxy ( oldType ); if ( type != oldType ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, DavePackage.DAVE_REQUEST_BLOCK__TYPE, oldType, type ) ); } } return type; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public String encode () { return String.format ( "UDT:%s:%s", this.index, this.type.getName () ); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public TypeDefinition getType () { if ( type != null && type.eIsProxy () ) { InternalEObject oldType = (InternalEObject)type; type = (TypeDefinition)eResolveProxy ( oldType ); if ( type != oldType ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, MemoryPackage.USER_DEFINED_TYPE__TYPE, oldType, type ) ); } } return type; }
/** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public String getText ( final Object object ) { final TypeDefinition typeDef = (TypeDefinition)object; final String label = typeDef.getName (); final String str = label == null || label.length () == 0 ? getString ( "_UI_TypeDefinition_type" ) : //$NON-NLS-1$ getString ( "_UI_TypeDefinition_type" ) + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ return String.format ( "%s (length: %s)", str, TypeHelper.calculateByteSize ( typeDef ) ); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public TypeDefinition getType () { if ( type != null && type.eIsProxy () ) { InternalEObject oldType = (InternalEObject)type; type = (TypeDefinition)eResolveProxy ( oldType ); if ( type != oldType ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, ModbusPackage.MODBUS_BLOCK__TYPE, oldType, type ) ); } } return type; }
/** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ @Override public String getText ( final Object object ) { final TypeDefinition typeDef = (TypeDefinition)object; final String label = typeDef.getName (); final String str = label == null || label.length () == 0 ? getString ( "_UI_TypeDefinition_type" ) : //$NON-NLS-1$ getString ( "_UI_TypeDefinition_type" ) + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ return String.format ( "%s (length: %s)", str, TypeHelper.calculateByteSize ( typeDef ) ); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public TypeDefinition getType () { if ( type != null && type.eIsProxy () ) { InternalEObject oldType = (InternalEObject)type; type = (TypeDefinition)eResolveProxy ( oldType ); if ( type != oldType ) { if ( eNotificationRequired () ) eNotify ( new ENotificationImpl ( this, Notification.RESOLVE, ModbusPackage.MODBUS_BLOCK__TYPE, oldType, type ) ); } } return type; }
/** * This returns the label styled text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public Object getStyledText ( final Object object ) { final StyledString styledLabel = new StyledString (); final TypeDefinition typeDef = (TypeDefinition)object; final String label = typeDef.getName (); styledLabel.append ( getString ( "_UI_TypeDefinition_type" ), StyledString.Style.QUALIFIER_STYLER ); if ( label != null && !label.isEmpty () ) { styledLabel.append ( " " + label ); styledLabel.append ( String.format ( "(%s)", TypeHelper.calculateByteSize ( typeDef ) ), StyledString.Style.COUNTER_STYLER ); } return styledLabel; }
/** * This returns the label styled text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public Object getStyledText ( final Object object ) { final StyledString styledLabel = new StyledString (); final TypeDefinition typeDef = (TypeDefinition)object; final String label = typeDef.getName (); styledLabel.append ( getString ( "_UI_TypeDefinition_type" ), StyledString.Style.QUALIFIER_STYLER ); if ( label != null && !label.isEmpty () ) { styledLabel.append ( " " + label ); styledLabel.append ( String.format ( "(%s)", TypeHelper.calculateByteSize ( typeDef ) ), StyledString.Style.COUNTER_STYLER ); } return styledLabel; }
/** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public String getText ( final Object object ) { final UserDefinedType userDefinedType = (UserDefinedType)object; if ( userDefinedType.getType () != null ) { return getString ( "_UI_UserDefinedType_type" ) + " " + userDefinedType.getType ().getName () + " @ " + userDefinedType.getIndex (); //$NON-NLS-1$ //$NON-NLS-2$ } else { return getString ( "_UI_UserDefinedType_type" ) + " <undefiend> @ " + userDefinedType.getIndex (); //$NON-NLS-1$ //$NON-NLS-2$ } }
/** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public String getText ( final Object object ) { final UserDefinedType userDefinedType = (UserDefinedType)object; if ( userDefinedType.getType () != null ) { return getString ( "_UI_UserDefinedType_type" ) + " " + userDefinedType.getType ().getName () + " @ " + userDefinedType.getIndex (); //$NON-NLS-1$ //$NON-NLS-2$ } else { return getString ( "_UI_UserDefinedType_type" ) + " <undefiend> @ " + userDefinedType.getIndex (); //$NON-NLS-1$ //$NON-NLS-2$ } }