Add a name to ScriptGroup2.Builder.create method

The name is not used in any meaningful way yet, but would be used
to name the file for generated code for fused kernels in other
coming CLs.

A script group name cannot be null or empty, or longer than 100
characters. It can only contain letters, digits, '-', or '_'.

Change-Id: I95fdbf58e6689da91ca98c2057dfa1a803d3b27b
This commit is contained in:
Yang Ni
2015-04-06 16:58:57 -07:00
parent d1af38a478
commit ad6b44aaa1

View File

@@ -412,7 +412,11 @@ public class ScriptGroup2 extends BaseObj {
return addInvoke(invoke, args.toArray(), bindingMap);
}
public ScriptGroup2 create(Future... outputs) {
public ScriptGroup2 create(String name, Future... outputs) {
if (name == null || name.isEmpty() || name.length() > 100 ||
!name.equals(name.replaceAll("[^a-zA-Z0-9-]", "_"))) {
throw new RSIllegalArgumentException("invalid script group name");
}
ScriptGroup2 ret = new ScriptGroup2(mRS, mClosures, mInputs, outputs);
return ret;
}