001/**
002    Returns a new <code>TriangleList</code> that can store a list of
003    <code>Triangle</code> objects. The versions showing the array input actually take a
004    variable length argument list (vararg), so you can enter 
005    <code>newTriList(tri1, tri2, tri3, tri4)</code>, etc.
006 
007    @method TriangleList newTriList()
008    @method TriangleList newTriList(String name)
009    @method TriangleList newTriList(Collection triangles)
010    @method TriangleList newTriList(String name, Collection triangles)
011    @method TriangleList newTriList(GeomTriangle triangle)
012    @method TriangleList newTriList(String name, GeomTriangle triangle)
013    @method TriangleList newTriList(GeomTriangle... triVararg)
014    @method TriangleList newTriList(String name, GeomTriangle... triVararg)
015    @method TriangleList newTriList(List vertices, int[] vertIndexes)
016 */
017package geomss.app.GeomSSCommands.creators;
018
019import bsh.*;
020import geomss.geom.GeomTriangle;
021import geomss.geom.TriangleList;
022import java.util.Collection;
023import java.util.List;
024
025public class newTriList {
026
027    public static String usage() {
028        return "usage: newTriList();, or newTriList(triangles);, or newTriList(triVararg);";
029    }
030
031    /**
032     * Implement newTriList() command.
033     */
034    public static TriangleList invoke(Interpreter env, CallStack callstack) {
035        return TriangleList.newInstance();
036    }
037
038    /**
039     * Implement newTriList(String name) command.
040     */
041    public static TriangleList invoke(Interpreter env, CallStack callstack, String name) {
042        return TriangleList.newInstance(name);
043    }
044
045    /**
046     * Implement newTriList(Collection triangles) command.
047     */
048    public static TriangleList invoke(Interpreter env, CallStack callstack, Collection triangles) {
049        return TriangleList.valueOf(null, triangles);
050    }
051
052    /**
053     * Implement newTriList(Collection triangles) command.
054     */
055    public static TriangleList invoke(Interpreter env, CallStack callstack,
056            String name, Collection triangles) {
057        return TriangleList.valueOf(name, triangles);
058    }
059
060    /**
061     * Implement newTriList(GeomTriangle... triangles) command.
062     */
063    public static TriangleList invoke(Interpreter env, CallStack callstack,
064            GeomTriangle... triVararg) {
065        return TriangleList.valueOf(triVararg);
066    }
067
068    /**
069     * Implement newTriList(String name, GeomTriangle... triangles) command.
070     */
071    public static TriangleList invoke(Interpreter env, CallStack callstack,
072            String name, GeomTriangle... triVararg) {
073        return TriangleList.valueOf(name, triVararg);
074    }
075
076    /**
077     * TriangleList newTriList(List vertices, int[] vertIndexes) command.
078     */
079    public static TriangleList invoke(Interpreter env, CallStack callstack,
080            List vertices, int[] vertIndexes) {
081        return TriangleList.valueOf(vertices, vertIndexes);
082    }
083}