|
From: SVN by r. <sv...@ca...> - 2009-03-31 19:39:47
|
Author: roy
Date: 2009-03-31 21:39:40 +0200 (Tue, 31 Mar 2009)
New Revision: 399
Added:
src/main/java/nl/improved/sqlclient/util/Function.java
Log:
very initial stuff for fuction support
Added: src/main/java/nl/improved/sqlclient/util/Function.java
===================================================================
--- src/main/java/nl/improved/sqlclient/util/Function.java 2009-03-31 19:38:19 UTC (rev 398)
+++ src/main/java/nl/improved/sqlclient/util/Function.java 2009-03-31 19:39:40 UTC (rev 399)
@@ -0,0 +1,62 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package nl.improved.sqlclient.util;
+
+/**
+ *
+ * @author roy
+ */
+public class Function {
+ private FunctionArg[] types;
+ private String name;
+
+ public Function(String name, int... types) {
+ this.name = name;
+ this.types = new FunctionArg[types.length];
+ for (int i = 0; i < types.length; i++) {
+ this.types[i] = new FunctionArg(types[i]);
+ }
+ }
+
+ public Function(String name, FunctionArg... types) {
+ this.name = name;
+ this.types = types;
+ }
+
+
+ public int getArgumentCount() {
+ return types == null ? 0 : types.length;
+ }
+
+ public FunctionArg getArgumentType(int arg) {
+ return types[arg];
+ }
+
+ public boolean matches(CharSequence s) {
+ return s.length() > 0 && name.startsWith(s.toString());
+ }
+
+ public class FunctionArg {
+ private int type;
+ private String help;
+ public FunctionArg(int type) {
+ this.type = type;
+
+ }
+ public FunctionArg(int type, String help) {
+ this.type = type;
+ this.help = help;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+ }
+}
|