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