Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.impl / src / main / java / org / gvsig / expressionevaluator / impl / function / dataaccess / SetRowTagFunction.java @ 44858

History | View | Annotate | Download (2.33 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2020 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.expressionevaluator.impl.function.dataaccess;
25

    
26
import java.util.Objects;
27
import org.apache.commons.lang3.Range;
28
import org.gvsig.expressionevaluator.Codes;
29
import org.gvsig.expressionevaluator.ExpressionRuntimeException;
30
import org.gvsig.expressionevaluator.Interpreter;
31
import org.gvsig.expressionevaluator.impl.DALFunctions;
32
import static org.gvsig.expressionevaluator.impl.function.programming.FileFunction.NAME;
33
import org.gvsig.fmap.dal.DataManager;
34
import org.gvsig.fmap.dal.feature.Feature;
35

    
36
/**
37
 *
38
 * @author jjdelcerro
39
 */
40
public class SetRowTagFunction extends AbstractFeatureFunction {
41

    
42
  public SetRowTagFunction() {
43
    super(DALFunctions.SYMBOLTABLE_NAME,
44
            DataManager.FUNCTION_SET_ROW_TAG,
45
            Range.is(1),
46
            "Assign a value associated with a label of the current row. This value is not persistent.",
47
            DataManager.FUNCTION_SET_ROW_TAG+"({{name}}, value)",
48
            null,
49
            "Object",
50
            false
51
    );
52
  }
53

    
54
  @Override
55
  public boolean allowConstantFolding() {
56
    return false;
57
  }
58

    
59
  @Override
60
  public boolean useArgumentsInsteadObjects() {
61
    return false;
62
  }
63
  
64
  @Override
65
  public Object call(Interpreter interpreter, Object[] args) throws Exception {
66
    Feature f = this.current_row(interpreter);
67
    if( f!=null ) {
68
      String name = getStr(args,0);
69
      f.setExtraValue(name, args[0]);
70
    }
71
    return args[0];
72
  }
73
}