001/**
002    Returns a new <code>GeomList</code> that can store a list of
003    <code>GeomElement</code> objects. The versions showing the array input actually take a
004    variable length argument list (vararg), so you can enter 
005    <code>newGeomList(geom1, geom2, geom3, geom4)</code>, etc.
006 
007    @method GeomList newGeomList()
008    @method GeomList newGeomList(String name)
009    @method GeomList newGeomList(Collection geomElements)
010    @method GeomList newGeomList(String name, Collection geomElements)
011    @method GeomList newGeomList(GeomElement geometry)
012    @method GeomList newGeomList(String name, GeomElement geometry)
013    @method GeomList newGeomList(GeomElement... geomVararg)
014    @method GeomList newGeomList(String name, GeomElement... geomVararg)
015 */
016package geomss.app.GeomSSCommands.creators;
017
018import bsh.*;
019import geomss.geom.GeomElement;
020import geomss.geom.GeomList;
021import java.util.Collection;
022
023public class newGeomList {
024
025    public static String usage() {
026        return "usage: newGeomList();, or newGeomList(geometry);, or newGeomList(geomVararg);";
027    }
028
029    /**
030     * Implement newGeomList() command.
031     */
032    public static GeomList invoke(Interpreter env, CallStack callstack) {
033        return GeomList.newInstance();
034    }
035
036    /**
037     * Implement newGeomList(String name) command.
038     */
039    public static GeomList invoke(Interpreter env, CallStack callstack, String name) {
040        return GeomList.newInstance(name);
041    }
042
043    /**
044     * Implement newGeomList(Collection geomElements) command.
045     */
046    public static GeomList invoke(Interpreter env, CallStack callstack, Collection geomElements) {
047        return GeomList.valueOf(null, geomElements);
048    }
049
050    /**
051     * Implement newGeomList(Collection geomElements) command.
052     */
053    public static GeomList invoke(Interpreter env, CallStack callstack,
054            String name, Collection geomElements) {
055        return GeomList.valueOf(name, geomElements);
056    }
057
058    /**
059     * Implement newGeomList(GeomElement... geometry) command.
060     */
061    public static GeomList invoke(Interpreter env, CallStack callstack,
062            GeomElement... geomVararg) {
063        return GeomList.valueOf(geomVararg);
064    }
065
066    /**
067     * Implement newGeomList(String name, GeomElement... geometry) command.
068     */
069    public static GeomList invoke(Interpreter env, CallStack callstack,
070            String name, GeomElement... geomVararg) {
071        return GeomList.valueOf(name, geomVararg);
072    }
073}