other = expLit.getValue(); Object converted = this.evaluate(null, other.getClass()); if (converted != null) {
/** * This method calls {@link #getValue()}. * * @deprecated use {@link #getValue()}. * */ public final Object getLiteral() { return getValue(); }
/** * This method calls {@link #getValue()}. * * @deprecated use {@link #getValue()}. * */ public final Object getLiteral() { return getValue(); }
@Override public void setValue(Object aValue) { this.value = null; this.expression = null; if (aValue instanceof LiteralExpressionImpl) { LiteralExpressionImpl literal = (LiteralExpressionImpl) aValue; if (literal.getValue() != null) { value = literal.toString(); } } else if ((aValue instanceof AttributeExpressionImpl) || (aValue instanceof FunctionExpressionImpl) || (aValue instanceof MathExpressionImpl)) { this.expression = (Expression) aValue; } else { if (aValue instanceof String) { value = ((String) aValue); } } }
/** * Accept. * * @param symbol the symbol * @return true, if successful */ @Override public boolean accept(GraphicalSymbol symbol) { if (symbol != null) { if (symbol instanceof MarkImpl) { MarkImpl marker = (MarkImpl) symbol; Expression expression = marker.getWellKnownName(); if (expression instanceof LiteralExpressionImpl) { LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression; Object value = lExpression.getValue(); if (value instanceof String) { String valueString = (String) value; if (valueString.startsWith(WKT_PREFIX)) { return true; } } } } } return false; }
/** * Gets the value from an expression. * * @param expression the expression * @return the value */ private static double getValue(Expression expression) { Object objValue = null; if (expression instanceof ConstantExpression) { objValue = ((ConstantExpression) expression).getValue(); } else if (expression instanceof LiteralExpressionImpl) { objValue = ((LiteralExpressionImpl) expression).getValue(); } if (objValue instanceof Double) { return ((Double) objValue).doubleValue(); } else if (objValue instanceof Long) { return ((Long) objValue).doubleValue(); } else if (objValue instanceof Integer) { return ((Integer) objValue).doubleValue(); } else if (objValue instanceof String) { return Double.parseDouble((String) objValue); } return 0.0; } }
/** * Creates the filter. * * @param parameterList the parameter list * @return the filter */ @Override public Filter createFilter(List<Expression> parameterList) { IsLessThenOrEqualToImpl filter = null; if ((parameterList == null) || (parameterList.size() < 2) || (parameterList.size() > 3)) { filter = new IsLessThanOrEqualToExtended(); } else { LiteralExpressionImpl matchCase = (LiteralExpressionImpl) parameterList.get(2); filter = new IsLessThanOrEqualToExtended( parameterList.get(0), parameterList.get(1), (Boolean) matchCase.getValue()); } return filter; }
/** * Creates the filter. * * @param parameterList the parameter list * @return the filter */ @Override public Filter createFilter(List<Expression> parameterList) { IsLessThenImpl filter = null; if ((parameterList == null) || (parameterList.size() < 2) || (parameterList.size() > 3)) { filter = new IsLessThanExtended(); } else { LiteralExpressionImpl matchCase = (LiteralExpressionImpl) parameterList.get(2); filter = new IsLessThanExtended( parameterList.get(0), parameterList.get(1), (Boolean) matchCase.getValue()); } return filter; }
/** * Creates the filter. * * @param parameterList the parameter list * @return the filter */ @Override public Filter createFilter(List<Expression> parameterList) { IsEqualsToImpl filter = null; if ((parameterList == null) || (parameterList.size() != 3)) { filter = new IsEqualToExtended(); } else { LiteralExpressionImpl matchCase = (LiteralExpressionImpl) parameterList.get(2); filter = new IsEqualToExtended( parameterList.get(0), parameterList.get(1), (Boolean) matchCase.getValue()); } return filter; }
/** * Creates the filter. * * @param parameterList the parameter list * @return the filter */ @Override public Filter createFilter(List<Expression> parameterList) { IsGreaterThanOrEqualToImpl filter = null; if ((parameterList == null) || (parameterList.size() < 2) || (parameterList.size() > 3)) { filter = new IsGreaterThanOrEqualToExtended(); } else { LiteralExpressionImpl matchCase = (LiteralExpressionImpl) parameterList.get(2); filter = new IsGreaterThanOrEqualToExtended( parameterList.get(0), parameterList.get(1), (Boolean) matchCase.getValue()); } return filter; }
/** * Creates the filter. * * @param parameterList the parameter list * @return the filter */ @Override public Filter createFilter(List<Expression> parameterList) { IsNotEqualToImpl filter = null; if ((parameterList == null) || (parameterList.size() != 3)) { filter = new IsNotEqualToExtended(); } else { LiteralExpressionImpl matchCase = (LiteralExpressionImpl) parameterList.get(2); filter = new IsNotEqualToExtended( parameterList.get(0), parameterList.get(1), (Boolean) matchCase.getValue()); } return filter; }
public static int getAttributeLength(AttributeDescriptor descriptor) { int fieldLength = 255; // String default List<Filter> filterList = descriptor.getType().getRestrictions(); for (Filter filter : filterList) { if (filter instanceof IsLessThenOrEqualToImpl) { IsLessThenOrEqualToImpl ite = (IsLessThenOrEqualToImpl) filter; LiteralExpressionImpl exp = (LiteralExpressionImpl) ite.getExpression2(); try { fieldLength = Integer.valueOf(exp.getValue().toString()); break; } catch (NumberFormatException e) { LOGGER.log(Level.WARNING, e.getMessage(), e); } } } return fieldLength; }
/** * Sets the environment variable. * * @param expression the new expression */ public void setEnvironmentVariable(Expression expression) { if (expression instanceof EnvFunction) { EnvFunction envFunction = (EnvFunction) expression; LiteralExpressionImpl literal = (LiteralExpressionImpl) envFunction.getParameters().get(0); envVarComboBox.setSelectedItem(literal.getValue()); } else if (expression instanceof LiteralExpressionImpl) { LiteralExpressionImpl literal = (LiteralExpressionImpl) expression; envVarComboBox.setSelectedItem(literal.getValue()); } else { ConsoleManager.getInstance() .error( this, Localisation.getString( DataSourceAttributePanel.class, "DataSourceAttributePanel.error1")); } }
/** * Gets the data type. * * @param envVarLiteral the env var literal * @return the data type */ /* * (non-Javadoc) * * @see com.sldeditor.filter.v2.envvar.EnvironmentManagerInterface#getDataType(org.opengis.filter.expression.Expression) */ @Override public Class<?> getDataType(Expression envVarLiteral) { if (envVarLiteral instanceof LiteralExpressionImpl) { LiteralExpressionImpl literal = (LiteralExpressionImpl) envVarLiteral; for (EnvVar envVar : envVarList) { if (envVar.getName().compareTo((String) literal.getValue()) == 0) { return envVar.getType(); } } } return Object.class; }
/** * Accept. * * @param symbol the symbol * @return true, if successful */ @Override public boolean accept(GraphicalSymbol symbol) { if (symbol instanceof MarkImpl) { MarkImpl marker = (MarkImpl) symbol; Expression expression = marker.getWellKnownName(); if (expression instanceof LiteralExpressionImpl) { LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression; Object value = lExpression.getValue(); if (value instanceof String) { String valueString = (String) value; if (valueString.startsWith(ArrowUtils.getArrowPrefix())) { return true; } } } } return false; }
/** * Accept. * * @param symbol the symbol * @return true, if successful */ @Override public boolean accept(GraphicalSymbol symbol) { if (symbol instanceof MarkImpl) { MarkImpl marker = (MarkImpl) symbol; Expression expression = marker.getWellKnownName(); if (expression instanceof LiteralExpressionImpl) { LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression; Object value = lExpression.getValue(); if (value instanceof String) { String valueString = (String) value; List<ValueComboBoxData> localSymbolList = getLocalSymbolList(); for (ValueComboBoxData data : localSymbolList) { if (data.getKey().compareTo(valueString) == 0) { return true; } } } } } return false; }
/** * Populate expression. * * @param objValue the obj value */ /* * (non-Javadoc) * * @see com.sldeditor.ui.detail.config.FieldConfigBase#populateExpression(java.lang.Object) */ @Override public void populateExpression(Object objValue) { String propertyName = null; if (objValue instanceof PropertyExistsFunction) { Expression e = ((PropertyExistsFunction) objValue).getParameters().get(0); propertyName = e.toString(); } else if (objValue instanceof AttributeExpressionImpl) { propertyName = ((AttributeExpressionImpl) objValue).getPropertyName(); } else if (objValue instanceof LiteralExpressionImpl) { propertyName = AttributeUtils.extract((String) ((LiteralExpressionImpl) objValue).getValue()); } populateField(propertyName); }
/** * Populate literal expression. * * @param expression the expression */ private void populateLiteralExpression(Expression expression) { LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression; Object objValue = lExpression.getValue(); if (objValue instanceof AttributeExpressionImpl) { expressionType = ExpressionTypeEnum.E_ATTRIBUTE; if (attributeSelectionPanel != null) { attributeSelectionPanel.setAttribute((AttributeExpressionImpl) objValue); } setCachedExpression((AttributeExpressionImpl) objValue); } else { expressionType = ExpressionTypeEnum.E_VALUE; populateExpression(objValue); valueUpdated(); } }
/** * Option selected. * * @param fieldPanelId the field panel id * @param selectedItem the selected item */ @Override public void optionSelected(Class<?> fieldPanelId, String selectedItem) { setSymbolTypeVisibility(fieldPanelId, selectedItem); selectedFillPanelId = fieldPanelId; FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.SIZE); if (fieldConfig.isEnabled()) { Expression expression = fieldConfig.getExpression(); if (expression instanceof LiteralExpressionImpl) { LiteralExpressionImpl l = (LiteralExpressionImpl) expression; Double d = (Double) l.getValue(); if (d <= 0.0) { fieldConfigVisitor.populateField( FieldIdEnum.SIZE, getFilterFactory().literal(1)); } } } dataHasChanged(); }
/** * Option selected. * * @param fieldPanelId the field panel id * @param selectedItem the selected item */ @Override public void optionSelected(Class<?> fieldPanelId, String selectedItem) { setSymbolTypeVisibility(fieldPanelId, selectedItem); selectedFillPanelId = fieldPanelId; FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.SIZE); if (fieldConfig.isEnabled()) { Expression expression = fieldConfig.getExpression(); if (expression instanceof LiteralExpressionImpl) { LiteralExpressionImpl l = (LiteralExpressionImpl) expression; Double d = (Double) l.getValue(); if (d <= 0.0) { fieldConfigVisitor.populateField( FieldIdEnum.SIZE, getFilterFactory().literal(1)); } } } dataHasChanged(); }