MCPcopy Index your code
hub / github.com/OpenSourcePhysics/osp / FunctionTool

Class FunctionTool

src/org/opensourcephysics/tools/FunctionTool.java:61–1084  ·  view source on GitHub ↗

This tool allows users to create and manage editable Functions. OSP DataBuilder, DataToolTab.dataBuilder, FitBuilder Tracker ModelBuilder and TrackDataBuilder @author Douglas Brown

Source from the content-addressed store, hash-verified

59 * @author Douglas Brown
60 */
61@SuppressWarnings("serial")
62public class FunctionTool extends JDialog implements PropertyChangeListener {
63 // static fields
64
65 public static final String PROPERTY_FUNCTIONTOOL_PANEL = "panel";
66 public static final String PROPERTY_FUNCTIONTOOL_VISIBLE = "ft_visible";
67 public static final String PROPERTY_FUNCTIONTOOL_FUNCTION = "function";
68
69
70 public static class FTObject {
71
72 public Icon icon; //[0]
73 public String name; //[1]
74 public String displayName; //[2]
75 public Trackable track;
76
77 public FTObject(Icon icon, String name, String displayName) {
78 this.icon = icon;
79 this.name = name;
80 this.displayName = displayName;
81 }
82
83 public FTObject(Icon icon, Trackable track, String displayName) {
84 this.icon = icon;
85 this.track = track;
86 this.displayName = displayName;
87 }
88
89 @Override
90 public boolean equals(Object o) {
91 FTObject fto = (FTObject) o;
92 return fto != null
93 && (name == null ? fto.name == null : name.equals(fto.name))
94 && (track == null ? fto.track == null : track.equals(fto.track))
95 && (displayName == null ? fto.displayName == null : displayName.equals(fto.displayName))
96 && (icon == null ? fto.icon == null : icon.equals(fto.icon));
97 }
98
99 @Override
100 public String toString() {
101 return displayName;
102 }
103
104 }
105
106 public static String[] parserNames = new String[] { "e", "pi", "min", "mod", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
107 "sin", "cos", "abs", "log", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
108 "acos", "acosh", "ceil", "cosh", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
109 "asin", "asinh", "atan", "atanh", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
110 "exp", "frac", "floor", "int", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
111 "random", "round", "sign", "sinh", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
112 "step", "tanh", "atan2", "max", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
113 "sqrt", "sqr", "if", "tan" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ;
114 public static String[] parserOperators = new String[] { "!", ",", ".", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
115 "+", "-", "*", "/", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
116 "^", "=", ">", "<", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
117 "&", "|", "(", ")" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ;
118 // instance fields

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected