If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. SSH will work normally if you are using the VPN.

Commit 74adf510 authored by yannick legoc's avatar yannick legoc

Moved Property.ExpressionResult to expression package so that it is accessible to other classes

parent 21a5e672
package fr.ill.ics.core.expression;
import fr.ill.ics.nscclient.command.CommandZoneAccessor;
public class ExpressionResult {
public enum ExpressionStatus {VALID_CONSTANT, INVALID_CONSTANT, VALID_EXPRESSION, INVALID_EXPRESSION};
public enum ExpressionError {NO_ERROR, PARSER_ERROR, DISABLED_CONTROLLER_ERROR, ENUMERATED_VALUE_ERROR, UNDEFINED_VARIABLE_ERROR};
private ExpressionStatus status;
private ExpressionError error;
private String message;
public ExpressionResult(ExpressionStatus status, ExpressionError error, String message) {
this.status = status;
this.error = error;
this.message = message;
}
public static ExpressionError convertExpressionError(CommandZoneAccessor.ExpressionError result) {
if (result == CommandZoneAccessor.ExpressionError.PARSER_ERROR) {
return ExpressionError.PARSER_ERROR;
}
else if (result == CommandZoneAccessor.ExpressionError.ENUMERATED_VALUE_ERROR) {
return ExpressionError.ENUMERATED_VALUE_ERROR;
}
else if (result == CommandZoneAccessor.ExpressionError.DISABLED_CONTROLLER_ERROR) {
return ExpressionError.DISABLED_CONTROLLER_ERROR;
}
else if (result == CommandZoneAccessor.ExpressionError.UNDEFINED_VARIABLE_ERROR) {
return ExpressionError.UNDEFINED_VARIABLE_ERROR;
}
return ExpressionError.NO_ERROR;
}
public ExpressionResult(ExpressionStatus status) {
this.status = status;
}
public ExpressionStatus getStatus() {
return status;
}
public ExpressionError getError() {
return error;
}
public boolean isValid() {
return status == ExpressionStatus.VALID_CONSTANT || status == ExpressionStatus.VALID_EXPRESSION;
}
public String getMessage() {
return message;
}
}
package fr.ill.ics.core.expression;
/**
* Helper class for the getPropertyExpression method.
*/
public class GetExpressionResult extends ExpressionResult {
private String expression;
public GetExpressionResult(String expression, ExpressionStatus status, ExpressionError error, String message) {
super(status, error, message);
this.expression = expression;
}
public GetExpressionResult(String expression, ExpressionStatus status) {
super(status);
this.expression = expression;
}
public String getExpression() {
return expression;
}
}
......@@ -19,6 +19,9 @@
package fr.ill.ics.core.property;
import fr.ill.ics.bridge.events.ServerPropertyChangeEvent;
import fr.ill.ics.core.expression.ExpressionResult;
import fr.ill.ics.core.expression.ExpressionResult.ExpressionStatus;
import fr.ill.ics.core.expression.GetExpressionResult;
import fr.ill.ics.core.property.array.Array;
import fr.ill.ics.core.property.undo.AutoApplyArrayState;
import fr.ill.ics.core.property.undo.UndoArrayState;
......
......@@ -27,6 +27,10 @@ import java.util.Set;
import fr.ill.ics.bridge.StatusBarMessageSender;
import fr.ill.ics.bridge.events.ServerPropertyChangeEvent;
import fr.ill.ics.bridge.listeners.ServerPropertyChangeListener;
import fr.ill.ics.core.expression.ExpressionResult;
import fr.ill.ics.core.expression.ExpressionResult.ExpressionError;
import fr.ill.ics.core.expression.ExpressionResult.ExpressionStatus;
import fr.ill.ics.core.expression.GetExpressionResult;
import fr.ill.ics.core.property.condition.IPropertyCondition;
import fr.ill.ics.core.property.event.LockEvent;
import fr.ill.ics.core.property.event.PropertyVerifyListener;
......@@ -45,85 +49,6 @@ import fr.ill.ics.nscclient.notification.commandzone.ICommandBoxPropertyEventLis
import fr.ill.ics.util.ConfigManager;
public abstract class Property implements ServerPropertyChangeListener, ICommandBoxPropertyEventListener {
public enum ExpressionStatus {VALID_CONSTANT, INVALID_CONSTANT, VALID_EXPRESSION, INVALID_EXPRESSION};
public enum ExpressionError {NO_ERROR, PARSER_ERROR, DISABLED_CONTROLLER_ERROR, ENUMERATED_VALUE_ERROR, UNDEFINED_VARIABLE_ERROR};
/**
* Helper class for the checkPropertyExpression method.
*/
public static class ExpressionResult {
private ExpressionStatus status;
private ExpressionError error;
private String message;
public ExpressionResult(ExpressionStatus status, ExpressionError error, String message) {
this.status = status;
this.error = error;
this.message = message;
}
public static ExpressionError convertExpressionError(CommandZoneAccessor.ExpressionError result) {
if (result == CommandZoneAccessor.ExpressionError.PARSER_ERROR) {
return ExpressionError.PARSER_ERROR;
}
else if (result == CommandZoneAccessor.ExpressionError.ENUMERATED_VALUE_ERROR) {
return ExpressionError.ENUMERATED_VALUE_ERROR;
}
else if (result == CommandZoneAccessor.ExpressionError.DISABLED_CONTROLLER_ERROR) {
return ExpressionError.DISABLED_CONTROLLER_ERROR;
}
else if (result == CommandZoneAccessor.ExpressionError.UNDEFINED_VARIABLE_ERROR) {
return ExpressionError.UNDEFINED_VARIABLE_ERROR;
}
return ExpressionError.NO_ERROR;
}
public ExpressionResult(ExpressionStatus status) {
this.status = status;
}
public ExpressionStatus getStatus() {
return status;
}
public ExpressionError getError() {
return error;
}
public boolean isValid() {
return status == ExpressionStatus.VALID_CONSTANT || status == ExpressionStatus.VALID_EXPRESSION;
}
public String getMessage() {
return message;
}
}
/**
* Helper class for the getPropertyExpression method.
*/
public static class GetExpressionResult extends ExpressionResult {
private String expression;
public GetExpressionResult(String expression, ExpressionStatus status, ExpressionError error, String message) {
super(status, error, message);
this.expression = expression;
}
public GetExpressionResult(String expression, ExpressionStatus status) {
super(status);
this.expression = expression;
}
public String getExpression() {
return expression;
}
}
protected String serverId = "real";
private int databaseId = 0;
......
......@@ -18,6 +18,10 @@
package fr.ill.ics.core.property;
import fr.ill.ics.core.expression.ExpressionResult;
import fr.ill.ics.core.expression.ExpressionResult.ExpressionError;
import fr.ill.ics.core.expression.ExpressionResult.ExpressionStatus;
import fr.ill.ics.core.expression.GetExpressionResult;
import fr.ill.ics.nscclient.command.CommandZoneAccessor;
import fr.ill.ics.nscclient.command.CommandZoneAccessor.GetPropertyExpressionResult;
import fr.ill.ics.nscclient.dataprovider.DataAccessor;
......
......@@ -18,9 +18,9 @@
package fr.ill.ics.core.property.undo;
import fr.ill.ics.core.expression.ExpressionResult;
import fr.ill.ics.core.expression.ExpressionResult.ExpressionStatus;
import fr.ill.ics.core.property.Property;
import fr.ill.ics.core.property.Property.ExpressionResult;
import fr.ill.ics.core.property.Property.ExpressionStatus;
import fr.ill.ics.core.property.array.Array;
public class AutoApplyArrayState extends UndoArrayState {
......
......@@ -18,10 +18,9 @@
package fr.ill.ics.core.property.undo;
import fr.ill.ics.core.expression.ExpressionResult;
import fr.ill.ics.core.expression.GetExpressionResult;
import fr.ill.ics.core.property.Property;
import fr.ill.ics.core.property.Property.ExpressionResult;
import fr.ill.ics.core.property.Property.ExpressionStatus;
import fr.ill.ics.core.property.Property.GetExpressionResult;
/**
* Subclass of UndoState. Here all values are immediately passed to the server (setting) and
......
......@@ -18,10 +18,10 @@
package fr.ill.ics.core.property.undo;
import fr.ill.ics.core.expression.ExpressionResult.ExpressionStatus;
import fr.ill.ics.core.expression.GetExpressionResult;
import fr.ill.ics.core.property.ArrayProperty;
import fr.ill.ics.core.property.Property;
import fr.ill.ics.core.property.Property.ExpressionStatus;
import fr.ill.ics.core.property.Property.GetExpressionResult;
import fr.ill.ics.core.property.array.Array;
public abstract class UndoArrayState extends UndoState {
......
......@@ -18,11 +18,11 @@
package fr.ill.ics.core.property.undo;
import fr.ill.ics.core.expression.ExpressionResult;
import fr.ill.ics.core.expression.ExpressionResult.ExpressionError;
import fr.ill.ics.core.expression.ExpressionResult.ExpressionStatus;
import fr.ill.ics.core.expression.GetExpressionResult;
import fr.ill.ics.core.property.Property;
import fr.ill.ics.core.property.Property.ExpressionError;
import fr.ill.ics.core.property.Property.ExpressionResult;
import fr.ill.ics.core.property.Property.ExpressionStatus;
import fr.ill.ics.core.property.Property.GetExpressionResult;
/**
* Abstract class for State of undo of Property. Subsclassed as UndoableState and AutoApplyState.
......
......@@ -18,9 +18,9 @@
package fr.ill.ics.core.property.undo;
import fr.ill.ics.core.expression.ExpressionResult;
import fr.ill.ics.core.expression.ExpressionResult.ExpressionStatus;
import fr.ill.ics.core.property.Property;
import fr.ill.ics.core.property.Property.ExpressionResult;
import fr.ill.ics.core.property.Property.ExpressionStatus;
import fr.ill.ics.core.property.array.Array;
public class UndoableArrayState extends UndoArrayState {
......
......@@ -20,10 +20,10 @@ package fr.ill.ics.core.property.undo;
import java.util.LinkedList;
import fr.ill.ics.core.expression.ExpressionResult;
import fr.ill.ics.core.expression.ExpressionResult.ExpressionStatus;
import fr.ill.ics.core.expression.GetExpressionResult;
import fr.ill.ics.core.property.Property;
import fr.ill.ics.core.property.Property.ExpressionResult;
import fr.ill.ics.core.property.Property.ExpressionStatus;
import fr.ill.ics.core.property.Property.GetExpressionResult;
/**
* Implements undoable state of a property allowing changes to be stored locally
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment