public static int calculateByteSize ( final TypeDefinition typeDefinition ) { return calculateByteSize ( 0, typeDefinition ); }
/** * 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 BitType bitType = (BitType)object; return getString ( "_UI_BitType_type" ) + " " + bitType.getIndex () + "." + bitType.getSubIndex (); //$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$ } }
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; }
/** * 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 ) ); }
private static boolean hasType ( final Set<TypeSystem> ctx, final TypeSystem typeSystem, final TypeDefinition type ) { if ( ctx.contains ( typeSystem ) ) { return false; } ctx.add ( typeSystem ); if ( typeSystem.getTypes ().contains ( type ) ) { return true; } for ( final TypeSystem include : typeSystem.getIncludes () ) { if ( hasType ( ctx, include, type ) ) { return true; } } return false; } }
/** * <!-- 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 */ public ByteOrder createByteOrderFromString ( EDataType eDataType, String initialValue ) { ByteOrder result = ByteOrder.get ( initialValue ); if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName () + "'" ); return result; }
/** * Test if a type system contains the type * * @param typeSystem * the type system * @param type * the type to look for * @return <code>true</code> if the type system provides the type, * <code>false</code> otherwise */ public static boolean hasType ( final TypeSystem typeSystem, final TypeDefinition type ) { final Set<TypeSystem> ctx = new HashSet<> (); return hasType ( ctx, typeSystem, 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; }
/** * 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 ) ); }
/** * 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 BitType bitType = (BitType)object; return getString ( "_UI_BitType_type" ) + " " + bitType.getIndex () + "." + bitType.getSubIndex (); //$NON-NLS-1$ //$NON-NLS-2$ }
private static boolean hasType ( final Set<TypeSystem> ctx, final TypeSystem typeSystem, final TypeDefinition type ) { if ( ctx.contains ( typeSystem ) ) { return false; } ctx.add ( typeSystem ); if ( typeSystem.getTypes ().contains ( type ) ) { return true; } for ( final TypeSystem include : typeSystem.getIncludes () ) { if ( hasType ( ctx, include, type ) ) { return true; } } return false; } }
public static int calculateByteSize ( final TypeDefinition typeDefinition ) { return calculateByteSize ( 0, typeDefinition ); }
/** * <!-- 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 */ public ByteOrder createByteOrderFromString ( EDataType eDataType, String initialValue ) { ByteOrder result = ByteOrder.get ( initialValue ); if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName () + "'" ); return result; }
/** * Test if a type system contains the type * * @param typeSystem * the type system * @param type * the type to look for * @return <code>true</code> if the type system provides the type, * <code>false</code> otherwise */ public static boolean hasType ( final TypeSystem typeSystem, final TypeDefinition type ) { final Set<TypeSystem> ctx = new HashSet<> (); return hasType ( ctx, typeSystem, type ); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public int getLength () { if ( this.type != null ) { return TypeHelper.calculateByteSize ( this.type ); } else { return 0; } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public int getLength () { if ( this.type != null ) { return TypeHelper.calculateByteSize ( this.type ); } else { return 0; } }