All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.qt.internal.EnumAttributes Maven / Gradle / Ivy

There is a newer version: 6.8.0
Show newest version
package io.qt.internal;

import io.qt.*;

/**
 * @hidden
 */
public final class EnumAttributes extends QFlags<@NonNull EnumFlags> implements Comparable<@NonNull EnumAttributes> {
    private static final long serialVersionUID = 0xe3a013cc176a692fL;
    static {
        QtJambi_LibraryUtilities.initialize();
    }

    /**
     * Creates a new EnumAttributes where the flags in args are set.
     * @param args enum entries
     */
    public EnumAttributes(@Nullable EnumFlags @NonNull... args){
        super(args);
    }

    /**
     * Creates a new EnumAttributes with given value.
     * @param value
     */
    public EnumAttributes(int value) {
        super(value);
    }

    /**
     * Combines this flags with enum entry.
     * @param e enum entry
     * @return new EnumAttributes
     */
    @Override
    public final @NonNull EnumAttributes combined(@StrictNonNull EnumFlags e){
        return new EnumAttributes(value() | e.value());
    }

    /**
     * Sets the flag e
     * @param e enum entry
     * @return this
     */
    public final @NonNull EnumAttributes setFlag(@Nullable EnumFlags e){
        return setFlag(e, true);
    }

    /**
     * Sets or clears the flag flag
     * @param e enum entry
     * @param on set (true) or clear (false)
     * @return this
     */
    public final @NonNull EnumAttributes setFlag(@Nullable EnumFlags e, boolean on){
        if (e!=null) {
            if (on) {
            	setValue(value() | e.value());
            }else {
        	    setValue(value() & ~e.value());
            }
        }
        return this;
    }

    /**
     * Returns an array of flag objects represented by this EnumAttributes.
     * @return array of enum entries
     */
    @Override
    public final @NonNull EnumFlags @NonNull[] flags(){
        return super.flags(EnumFlags.values());
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public final @NonNull EnumAttributes clone(){
        return new EnumAttributes(value());
    }

    /**
     * Compares this flag with the specified flag for order.
     * {@inheritDoc}
     */
    @Override
    public final int compareTo(@StrictNonNull EnumAttributes other){
        return Integer.compare(value(), other.value());
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy