View Javadoc
1   /*
2    * Copyright 2009 Ange Optimization ApS
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package eu.simuline.octave.type;
17  
18  /**
19   * A function handle.
20   * <p>
21   * This does for some reason not work with octave 3.0, 
22   * but it works with octave 3.2.
23   */
24  public final class OctaveFunctionHandle implements OctaveObject {
25  
26      private final String function;
27  
28      /**
29       * @param function
30       *            A single line string like "@(x) x ** 2" or "@(a,b) a + b"
31       */
32      public OctaveFunctionHandle(final String function) {
33          this.function = function;
34      }
35  
36      @Override
37      public OctaveFunctionHandle shallowCopy() {
38          return new OctaveFunctionHandle(getFunction());
39      }
40  
41      /**
42       * @return the function
43       */
44      public String getFunction() {
45          return function;
46      }
47  
48  }