X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.document.server%2Fsrc%2Forg%2Fsimantics%2Fdocument%2Fserver%2Fbean%2FCommand.java;h=eabb2afdd3110f90db2504719e889ffde59dc890;hp=1b4a5a68e9933f41fbd2336707915124b9eb4342;hb=e4ffdffae875e518a4eb070b8bda6ead1a9843d3;hpb=969bd23cab98a79ca9101af33334000879fb60c5 diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/bean/Command.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/bean/Command.java index 1b4a5a68e..eabb2afdd 100644 --- a/bundles/org.simantics.document.server/src/org/simantics/document/server/bean/Command.java +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/bean/Command.java @@ -1,101 +1,115 @@ -package org.simantics.document.server.bean; - -import org.simantics.databoard.util.Bean; -import org.simantics.document.server.io.CommandContext; -import org.simantics.document.server.io.ICommand; - -public class Command implements ICommand { - - public String targetId; - public String trigger; - public String command; - public CommandContext constants; - - public Command() {} - - public Command(String targetId, String trigger, String command, CommandContext constants) { - this.targetId = targetId; - this.trigger = trigger; - this.command = command; - this.constants = constants; - } - - public String getTrigger() { - return trigger; - } - - public String getTargetId() { - return targetId; - } - - public String getCommand() { - return command; - } - - @Override - public CommandContext getConstants() { - return constants; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("\n"); - sb.append(targetId); - sb.append("\n"); - sb.append(trigger); - sb.append("\n"); - sb.append(command); - sb.append("\n"); - sb.append(constants); - sb.append("\n"); - return sb.toString(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((command == null) ? 0 : command.hashCode()); - result = prime * result - + ((constants == null) ? 0 : constants.hashCode()); - result = prime * result - + ((targetId == null) ? 0 : targetId.hashCode()); - result = prime * result + ((trigger == null) ? 0 : trigger.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Command other = (Command) obj; - if (command == null) { - if (other.command != null) - return false; - } else if (!command.equals(other.command)) - return false; - if (constants == null) { - if (other.constants != null) - return false; - } else if (!constants.equals(other.constants)) - return false; - if (targetId == null) { - if (other.targetId != null) - return false; - } else if (!targetId.equals(other.targetId)) - return false; - if (trigger == null) { - if (other.trigger != null) - return false; - } else if (!trigger.equals(other.trigger)) - return false; - return true; - } - - -} +/******************************************************************************* + * Copyright (c) 2019 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Semantum Oy - initial API and implementation + *******************************************************************************/ +package org.simantics.document.server.bean; + +import org.simantics.document.server.io.CommandContext; +import org.simantics.document.server.io.ICommand; + +public class Command implements ICommand { + + public String targetId; + public String trigger; + public String command; + public CommandContext constants; + + public Command() {} + + public Command(String command) { + this.command = command; + } + + public Command(String targetId, String trigger, String command, CommandContext constants) { + this.targetId = targetId; + this.trigger = trigger; + this.command = command; + this.constants = constants; + } + + public String getTrigger() { + return trigger; + } + + public String getTargetId() { + return targetId; + } + + public String getCommand() { + return command; + } + + @Override + public CommandContext getConstants() { + return constants; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("\n"); + sb.append(targetId); + sb.append("\n"); + sb.append(trigger); + sb.append("\n"); + sb.append(command); + sb.append("\n"); + sb.append(constants); + sb.append("\n"); + return sb.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((command == null) ? 0 : command.hashCode()); + result = prime * result + + ((constants == null) ? 0 : constants.hashCode()); + result = prime * result + + ((targetId == null) ? 0 : targetId.hashCode()); + result = prime * result + ((trigger == null) ? 0 : trigger.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Command other = (Command) obj; + if (command == null) { + if (other.command != null) + return false; + } else if (!command.equals(other.command)) + return false; + if (constants == null) { + if (other.constants != null) + return false; + } else if (!constants.equals(other.constants)) + return false; + if (targetId == null) { + if (other.targetId != null) + return false; + } else if (!targetId.equals(other.targetId)) + return false; + if (trigger == null) { + if (other.trigger != null) + return false; + } else if (!trigger.equals(other.trigger)) + return false; + return true; + } + + +}