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

javolution.lang.Realtime Maven / Gradle / Ivy

Go to download

Only the Java Core part of Javolution library, with slight modifications for use in MSFTBX.

The newest version!
/*
 * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
 * Copyright (C) 2012 - Javolution (http://javolution.org/)
 * All rights reserved.
 * 
 * Permission to use, copy, modify, and distribute this software is
 * freely granted, provided that this notice is preserved.
 */
package javolution.lang;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 

Indicates if an element has a bounded * * worst-case execution time. The {@link #limit limit} behavior * of the execution time with the input size may be specified (if no limit * specified the worst case execution time is assumed to be constant).

* * [code] * public class Equalities { * @Realtime(limit = UNKNOWN) * public static final Equality STANDARD = new StandardComparatorImpl(); * * @Realtime(limit = CONSTANT) * public static final Equality IDENTITY = new IdentityComparatorImpl(); * * @Realtime(limit = LINEAR) * public static final Equality ARRAY = new ArrayComparatorImpl(); * * @Realtime(limit = LINEAR) * public static final Equality LEXICAL = new LexicalComparatorImpl(); * }[/code] * *

Analysis tools / compilers may produce warnings if program elements * use or override elements with incompatible real-time characteristics.

* *

Note: For multi-cores systems, if a real-time element is {@link Parallelizable} * but not {@link Parallelizable#mutexFree() mutex-free}, response * time even for high priority threads may be unbounded due to * priority * inversion. This is no longer the case when running on real-time * VMs due to their support for priority inheritance.

* * @author Jean-Marie Dautelle * @version 6.0, July 21, 2013 * @see Real-Time Computing */ @Documented @Inherited @Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR }) @Retention(RetentionPolicy.RUNTIME) public @interface Realtime { /** * Indicates if this element has a bounded worst-case execution time * (default {@code true}). */ boolean value() default true; /** * Returns the limit behavior for the worst-case execution time * (default {@link Limit#CONSTANT}). */ Limit limit() default Limit.CONSTANT; /** * Provides additional information (default {@code ""}). */ String comment() default ""; /** * Identifies the limit behavior for the worst case execution time. */ public enum Limit { /** * The worst case execution time is constant. */ CONSTANT, /** * The worst case execution time is bounded in O(log(n)) * with n characteristic of the current size of the inputs. */ LOG_N, /** * The worst case execution time is bounded in O(n) * with n characteristic of the current size of the inputs. */ LINEAR, /** * The worst case execution time is bounded in O(n log(n)) * with n characteristic of the current size of the inputs. */ N_LOG_N, /** * The worst case execution time is bounded in O(n²) * with n characteristic of the current size of the inputs. */ N_SQUARE, /** * The limit behavior of the worst case execution time is unknown * or unspecified. */ UNKNOWN, } }