Add indexes for the given shape
@param shape the shape ot convert to indexes
@return the indexes for the given shape
8361
public static INDArrayIndex[] indexesFor(long... shape) {
        INDArrayIndex[] ret = new INDArrayIndex[shape.length];
        for (int i = 0; i < shape.length; i++) {
            ret[i] = NDArrayIndex.point(shape[i]);
        }

        return ret;
    }
224533
public void addVerticesToSet(Set<VertexType> set) {
        // Add the vertex for this object
        set.add(this.m_vertex);

        // Add vertices for all children
        Iterator<SearchTree<VertexType>> i = childIterator();
        while (i.hasNext()) {
            SearchTree<VertexType> child = i.next();
            child.addVerticesToSet(set);
        }
    }
704933
final void attachShapeToColorMap(final Shape<?> shape)
    {
        if (null != shape)
        {
            String color = shape.getColorKey();

            if (null != color)
            {
                m_shape_color_map.remove(color);

                shape.setColorKey(null);
            }
            int count = 0;

            do
            {
                count++;

                color = m_c_rotor.next();
            }
            while ((m_shape_color_map.get(color) != null) && (count <= ColorKeyRotor.COLOR_SPACE_MAXIMUM));

            if (count > ColorKeyRotor.COLOR_SPACE_MAXIMUM)
            {
                throw new IllegalArgumentException("Exhausted color space " + count);
            }
            m_shape_color_map.put(color, shape);

            shape.setColorKey(color);
        }
    }
524428
private static int index(Object o) {
        Integer i = TYPE_INDICES.get(o);
        if (i == null) {
            synchronized (TYPE_INDICES) {
                // check that another thread did not already update the index
                i = TYPE_INDICES.get(o);
                if (i != null)
                    return i;
                else {
                    int j = TYPE_INDICES.size();
                    TYPE_INDICES.put(o, j);
                    TYPES.add(o);
                    return j;
                }
            }
        }
        return i;
    }
123593
@SuppressWarnings("unchecked")
    static <T> Node<T> emptyNode(StreamShape shape) {
        switch (shape) {
            case REFERENCE:    return (Node<T>) EMPTY_NODE;
            case INT_VALUE:    return (Node<T>) EMPTY_INT_NODE;
            case LONG_VALUE:   return (Node<T>) EMPTY_LONG_NODE;
            case DOUBLE_VALUE: return (Node<T>) EMPTY_DOUBLE_NODE;
            default:
                throw new IllegalStateException("Unknown shape " + shape);
        }
    }
1002745
public void add(ShapeMarkers shapeMarkers) {
        for (Marker marker : shapeMarkers.getMarkers()) {
            add(marker, shapeMarkers);
        }
    }
69048
@TimerJ
    public TableMetadataBuilder addIndex(IndexMetadata indexMetadata) {
        indexes.put(indexMetadata.getName(), indexMetadata);
        return this;
    }
1106282
public static List<Long> indexes(final MutableBitSet bits) {
        List<Long> indexes = new ArrayList<>((int) bits.cardinality());
        
        for (long i = bits.nextSetBit(0); i >= 0; i = bits.nextSetBit(i + 1)) {
            indexes.add(i);
        }
        
        return indexes;
    }
1022255
public void addSegDict(Collection<String> al) {
		for(String s: al){
			addDict(s);
		}
		createIndex();
	}
669573
public static INDArrayIndex[] adjustIndices(int[] originalShape, INDArrayIndex... indexes) {
        if (Shape.isVector(originalShape) && indexes.length == 1)
            return indexes;

        if (indexes.length < originalShape.length)
            indexes = fillIn(originalShape, indexes);
        if (indexes.length > originalShape.length) {
            INDArrayIndex[] ret = new INDArrayIndex[originalShape.length];
            System.arraycopy(indexes, 0, ret, 0, originalShape.length);
            return ret;
        }

        if (indexes.length == originalShape.length)
            return indexes;
        for (int i = 0; i < indexes.length; i++) {
            if (indexes[i].end() >= originalShape[i] || indexes[i] instanceof NDArrayIndexAll)
                indexes[i] = NDArrayIndex.interval(0, originalShape[i] - 1);
        }

        return indexes;
    }
1351864
public String getJavaDataType(Map<String, Shape> shapes, String shapeName) {
        return getJavaDataType(shapes, shapeName, null);
    }
652408
public ListBuilder<T> addAll(int index, Collection<? extends T> items) {
        list.addAll(index, items);
        return this;
    }
1125826
public static final void draw(Shape shape) {
        Texture t = TextureImpl.getLastBind();
        TextureImpl.bindNone();
        
        float points[] = shape.getPoints();
        
        LSR.start();
        for(int i=0;i<points.length;i+=2) {
        	LSR.vertex(points[i], points[i + 1]);
        }
        
        if (shape.closed()) {
        	LSR.vertex(points[0], points[1]);
        }
        
        LSR.end();
        
        if (t == null) {
        	TextureImpl.bindNone();
        } else {
        	t.bind();
        }
    }
1186095
public static INDArray generate(long[] shape, Values values) {
        return generate(shape, Nd4j.order(), values);
    }
504231
public static <T> ImmutableMap<T, Integer> indexMap(Iterable<? extends T> items) {
    final ImmutableMap.Builder<T, Integer> ret = ImmutableMap.builder();
    int idx = 0;
    for (final T item : items) {
      ret.put(item, idx++);
    }
    return ret.build();
  }
531460
public static final void fill(final Shape shape, final ShapeFill fill) {
        if (!validFill(shape)) {
    		return;
    	}
        
        Texture t = TextureImpl.getLastBind();
        TextureImpl.bindNone();

        final float center[] = shape.getCenter();
        fill(shape, new PointCallback() {
			public float[] preRenderPoint(Shape shape, float x, float y) {
	            fill.colorAt(shape, x, y).bind();
	            Vector2f offset = fill.getOffsetAt(shape, x, y);
	            
	            return new float[] {offset.x + x,offset.y + y};
			}
    	});
        
        if (t == null) {
        	TextureImpl.bindNone();
        } else {
        	t.bind();
        }
    }
1135614
def index_to_coords(index, shape):
    ''''''
    coords = []
    for i in xrange(1, len(shape)):
        divisor = int(np.product(shape[i:]))
        value = index // divisor
        coords.append(value)
        index -= value * divisor
    coords.append(index)
    return tuple(coords)