jdk/src/share/classes/java/util/stream/StreamShape.java
author psandoz
Thu, 16 Jan 2014 18:20:31 +0100
changeset 22289 bb9c71b84919
parent 17163 6a5e9b4f27d2
permissions -rw-r--r--
8029452: Fork/Join task ForEachOps.ForEachOrderedTask clarifications and minor improvements Reviewed-by: mduigou, briangoetz
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17163
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
     1
/*
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
     2
 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
     4
 *
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    10
 *
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    15
 * accompanied this code).
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    16
 *
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    20
 *
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    23
 * questions.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    24
 */
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    25
package java.util.stream;
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    26
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    27
/**
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    28
 * An enum describing the known shape specializations for stream abstractions.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    29
 * Each will correspond to a specific subinterface of {@link BaseStream}
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    30
 * (e.g., {@code REFERENCE} corresponds to {@code Stream}, {@code INT_VALUE}
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    31
 * corresponds to {@code IntStream}).  Each may also correspond to
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    32
 * specializations of value-handling abstractions such as {@code Spliterator},
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    33
 * {@code Consumer}, etc.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    34
 *
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    35
 * @apiNote
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    36
 * This enum is used by implementations to determine compatibility between
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    37
 * streams and operations (i.e., if the output shape of a stream is compatible
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    38
 * with the input shape of the next operation).
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    39
 *
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    40
 * <p>Some APIs require you to specify both a generic type and a stream shape
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    41
 * for input or output elements, such as {@link TerminalOp} which has both
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    42
 * generic type parameters for its input types, and a getter for the
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    43
 * input shape.  When representing primitive streams in this way, the
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    44
 * generic type parameter should correspond to the wrapper type for that
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    45
 * primitive type.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    46
 *
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    47
 * @since 1.8
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    48
 */
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    49
enum StreamShape {
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    50
    /**
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    51
     * The shape specialization corresponding to {@code Stream} and elements
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    52
     * that are object references.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    53
     */
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    54
    REFERENCE,
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    55
    /**
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    56
     * The shape specialization corresponding to {@code IntStream} and elements
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    57
     * that are {@code int} values.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    58
     */
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    59
    INT_VALUE,
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    60
    /**
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    61
     * The shape specialization corresponding to {@code LongStream} and elements
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    62
     * that are {@code long} values.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    63
     */
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    64
    LONG_VALUE,
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    65
    /**
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    66
     * The shape specialization corresponding to {@code DoubleStream} and
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    67
     * elements that are {@code double} values.
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    68
     */
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    69
    DOUBLE_VALUE
6a5e9b4f27d2 8008670: Initial java.util.stream putback -- internal API classes
mduigou
parents:
diff changeset
    70
}