01 /*
02 * Java Genetic Algorithm Library (jenetics-1.6.0).
03 * Copyright (c) 2007-2014 Franz Wilhelmstötter
04 *
05 * Licensed under the Apache License, Version 2.0 (the "License");
06 * you may not use this file except in compliance with the License.
07 * You may obtain a copy of the License at
08 *
09 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Author:
18 * Franz Wilhelmstötter (franz.wilhelmstoetter@gmx.at)
19 */
20 package org.jenetics.util;
21
22 import javolution.lang.Immutable;
23
24 /**
25 * Immutable, ordered, fixed sized sequence.
26 *
27 * @see MSeq
28 *
29 * @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
30 * @since 1.0
31 * @version 1.0 — <em>$Date: 2014-02-15 $</em>
32 */
33 public interface ISeq<T>
34 extends
35 Seq<T>,
36 Copyable<MSeq<T>>,
37 Immutable
38 {
39
40 @Override
41 public ISeq<T> subSeq(final int start, final int end);
42
43 @Override
44 public ISeq<T> subSeq(final int start);
45
46 @Override
47 public <B> ISeq<B> map(final Function<? super T, ? extends B> mapper);
48
49 /**
50 * <p>
51 * Helper method for up-casting an given immutable sequence. This allows you
52 * to assign this sequence to an sequence where the element type is a super
53 * type of {@code T}.
54 * </p>
55 * [code]
56 * ISeq<Double> da = new Array<Double>(0.0, 1.0, 2.0).toISeq();
57 * ISeq<Number> na = da.upcast(da);
58 * ISeq<Object> oa = na.upcast(na);
59 * [/code]
60 *
61 * @param seq the sequence to cast.
62 * @return the up-casted sequence.
63 *
64 * @deprecated Will be removed in the next version.
65 */
66 @Deprecated
67 public <A> ISeq<A> upcast(final ISeq<? extends A> seq);
68
69 /**
70 * Return a shallow copy of this sequence. The sequence elements are not
71 * cloned.
72 *
73 * @return a shallow copy of this sequence.
74 */
75 @Override
76 public MSeq<T> copy();
77
78 }
|