Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package net.datenstrudel.bulbs.shared.domain.model.bulb;
  
This type is used in order to manage concurrent control of devices from different applications. There are two types, STANDARD and OVERRIDE. Usually commands are supposed to have STANDARD priority. In case a concurrent application likes to apply commands it sends the 1st command with OVERRIDE priority to put itself in charge. All subsequent commands shall be sent with STANDARD priority. This way it is made sure that different applications can control the same bulbs without clashing, due to only commands coming from the application that last sent with ovverride priority are actually executed. Commands are any classes of type DtoAbstractActuatorCmd

Author(s):
Thomas Wendzinski
 
 @ApiModel(value="Whether to override or not an existing actuation that might currently taking place")
 public class CommandPriority implements ValueObject<CommandPriority>{
 
     //~ Member(s) //////////////////////////////////////////////////////////////
     public static final int OVERRIDE = 0;
     public static final int STANDARD = 1;
 
 
     @ApiModelProperty(value = "Override or standard behavior", allowableValues = "0, 1")
     private final int priority;
 
     @ApiModelProperty(hidden = true)
     private Integer overrideTempMillis;
     
     //~ Construction ///////////////////////////////////////////////////////////
     private CommandPriority() {
         this. = 0;
     }
     public CommandPriority(int priorityint durationMillis) {
         if(priority != )throw new IllegalArgumentException(
                 "Priority '"+priority+"' not allowed for this constructor!");
         this. = priority;
         this. = durationMillis;
     }
     public CommandPriority(int priority) {
         this. = priority;
     }
     public static CommandPriority overrideTemporary(int durationMillis){
         CommandPriority res = new CommandPriority(durationMillis);
         return res;
     }
     public static CommandPriority standard(){
         return new CommandPriority();
     }
     public static CommandPriority override(){
         return new CommandPriority();
     }
     
     //~ Method(s) //////////////////////////////////////////////////////////////
     public int getPriority() {
         return ;
     }
     public Integer getOverrideTempMillis() {
         return ;
     }
 
     private void setOverrideTempMillis(Integer overrideTempMillis) {
         this. = overrideTempMillis;
     }
     
     //~ Private Artifact(s) ////////////////////////////////////////////////////
 
     @Override
     public boolean sameValueAs(CommandPriority other) {
         if(other == nullreturn false;
         if(this. != other.priority)return false;
         if(this. == null && other.overrideTempMillis != null)return false;
         if(this. != null && other.overrideTempMillis == null)return false;
         if(this. != other.overrideTempMillis )return false;
         return true;
     }
     @Override
     public int hashCode() {
         int hash = 5;
         hash = 73 * hash + this.;
         hash = 73 * hash + (this. != null ? this..hashCode() : 0);
         return hash;
     }
     @Override
     public boolean equals(Object obj) {
         if (obj == null) {
             return false;
         }
         if (getClass() != obj.getClass()) {
             return false;
         }
         final CommandPriority other = (CommandPriorityobj;
         return this.sameValueAs(other);
     }
     
    
New to GrepCode? Check out our FAQ X