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