Package gda.rcp.views

Interface ReservableControl

All Known Implementing Classes:
ReservedControl

public interface ReservableControl
This interface allows an object to reserve a resource for itself. Having multiple objects are competing for the same resource, this interface allows a controller to restrict some operations only to the object owning the resource. An example could be a controller exposing an instance of this interface so other objects can reserve the controller for them self. As the reservation is done using Object, can act simply as validator irrespective of the class type, and this is further stressed by the fact that the interface does not directly expose the object which reserved the resource.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isOwner(Object owner)
    Verify if an object is the actual owner.
    boolean
    Verify if this instance is actually reserved.
    boolean
    release(Object owner)
    Release the instance.
    boolean
    reserve(Object owner)
    Reserves the instance, setting the requesting object as owner.
  • Method Details

    • reserve

      boolean reserve(Object owner)
      Reserves the instance, setting the requesting object as owner. The operation fails if the instance is already reserved by another object or the requesting object is null
      Parameters:
      owner - the class requesting to reserve the resource
      Returns:
      true if the operation succeeded, false otherwise
    • release

      boolean release(Object owner)
      Release the instance. The operation fails if the requesting object is not the actual owner or the requesting object is null
      Parameters:
      owner - the class requesting to release the resource
      Returns:
      true if the operation succeeded, false otherwise
    • isOwner

      boolean isOwner(Object owner)
      Verify if an object is the actual owner.
      Parameters:
      owner - the class requesting the validation
      Returns:
      true if the requesting object is the same as the actual owner, false otherwise
    • isReserved

      boolean isReserved()
      Verify if this instance is actually reserved.
      Returns:
      true if reserved, false otherwise