if (!drops[i])
count++;
}
+
+ public int[] buildSequence(Bindable _bindable) {
+ Annotation[][] annotations = _bindable.getArgAnnotations();
+ Class[] types = _bindable.getArgTypes();
+ String[] names = _bindable.getArgNames();
+ String name = _bindable.getSimpleName();
+ int len = annotations.length;
+ int ofs = 0;
+ bind.arg[] argtags = new bind.arg[len];
+ for(int i=0; i<names.length; i++)
+ for(Annotation a : annotations[i+ofs])
+ if (a instanceof bind.arg)
+ argtags[i+ofs] = (bind.arg)a;
+
+ int argTagged = 0;
+ boolean hasloc = types.length>0 && types[0]==Input.Region.class;
+ for(int i=0; i<argtags.length; i++) {
+ if (i==0 && types[0]==Input.Region.class) continue;
+ if (argtags[i] != null)
+ argTagged++;
+ }
+ int numNames = names.length;
+ if (hasloc) numNames--;
+
+ // FIXME: can be smarter here
+ if (argTagged==count) {
+ int[] ret = new int[argtags.length];
+ int j = 0;
+ for(int i=0; i<argtags.length; i++) {
+ if (i==0 && types[0]==Input.Region.class) continue;
+ if (argtags[i]==null) continue;
+ if (argtags[i].value().equals(""))
+ ret[i] = j++;
+ else {
+ ret[i] = -1;
+ for(int k=0; k<names.length; k++)
+ if (argtags[i].value().equals(names[k])){
+ ret[i] = k;
+ break;
+ }
+ if (ret[i]==-1) return null;
+ }
+ }
+ return ret;
+ } else if (numNames==count) {
+ int[] ret = new int[count];
+ for(int i=0; i<count; i++) ret[i] = i+(hasloc?1:0);
+ return ret;
+ } else {
+ return null;
+ }
+ }
+
}