Create a sequence of nodes that returns the supplied single batch of nodes.

@param sequence the node keys to be returned; if null, an {@link #emptySequence empty instance} is returned
@return the sequence of nodes; never null
516296
public static NodeSequence withBatch( final Batch sequence ) {
        if (sequence == null) return emptySequence(1);
        return new NodeSequence() {
            private boolean done = false;

            @Override
            public int width() {
                return sequence.width();
            }

            @Override
            public long getRowCount() {
                return sequence.rowCount();
            }

            @Override
            public boolean isEmpty() {
                return sequence.isEmpty();
            }

            @Override
            public Batch nextBatch() {
                if (done) return null;
                done = true;
                return sequence;
            }

            @Override
            public void close() {
            }

            @Override
            public String toString() {
                return "(sequence-with-batch width=" + width() + " " + sequence + " )";
            }
        };
    }
1216017
public <T> List<T> reorder( List<T> sequence)
    {
    int elementCount = sequence.size();
    if( elementCount > 1)
      {
      List<T> elements = new ArrayList<T>( sequence);
      sequence.clear();

      for( ; elementCount > 0; elementCount--)
        {
        sequence.add( elements.remove( generator_.nextInt( elementCount)));
        }
      }

    return sequence;
    }
629589
public <T> Iterator<T> reorder( Iterator<T> sequence)
    {
    return reorder( IteratorUtils.toList( sequence)).iterator();
    }
1295567
public static <S extends Seq<S>> S concatenate(S... sequences) {
        if (sequences.length == 0)
            throw new IllegalArgumentException("Zero arguments");

        if (sequences.length == 1)
            return sequences[0];

        int size = 0;
        for (S s : sequences)
            size += s.size();

        SeqBuilder<S> builder = sequences[0].getBuilder().ensureCapacity(size);

        for (S s : sequences)
            builder.append(s);

        return builder.createAndDestroy();
    }
956265
public List<List<Writable>> executeSequence(List<List<Writable>> inputSequence) {
        return executeSequenceToSequence(inputSequence);
    }
757703
public static <T> Sequence<T> sort(final Sequence<T> sequence, final Comparator<T> comparator)
  {
    List<T> seqList = sequence.toList();
    Collections.sort(seqList, comparator);
    return simple(seqList);
  }
239260
public static Map<FastaSequence,Range[]> getDisorder(List<FastaSequence> sequences) {
		Map<FastaSequence,Range[]> disorderRanges = new TreeMap<FastaSequence,Range[]>();
		for(FastaSequence fs: sequences) {
			disorderRanges.put(fs, getDisorder(fs));
		}
		return disorderRanges;
	}
367779
public static <T> List<T> reorderIf( RandSeq randSeq, List<T> sequence)
    {
    return randSeq==null? sequence : randSeq.reorder( sequence);
    }
864681
public static Matcher<MultiResult> sequence(final Matcher<?>... matchers) {
        checkNotEmpty(matchers);
        return new Matcher<MultiResult>() {
            @Override
            public MultiResult matches(String input, boolean isEof) {
                int matchCount = 0;
                Result[] results = new Result[matchers.length];
                Arrays.fill(results, failure(input, false));
                int beginIndex = 0;
                for (int i = 0; i < matchers.length; i++) {
                    Result result = matchers[i].matches(input.substring(beginIndex), isEof);
                    if (result.isSuccessful()) {
                        beginIndex += result.end();
                        results[i] = result;
                        if (++matchCount == matchers.length) {
                            String group = result.group();
                            Result finalResult = new SimpleResult(
                                    true,
                                    input,
                                    input.substring(0, beginIndex - group.length()),
                                    group,
                                    result.canStopMatching());
                            return new MultiResultImpl(finalResult, Arrays.asList(results));
                        }
                    } else {
                        break;
                    }
                }
                final List<Result> resultList = Arrays.asList(results);
                boolean canStopMatching = MultiResultImpl.canStopMatching(resultList);
                return new MultiResultImpl(failure(input, canStopMatching), resultList);
            }

            @Override
            public String toString() {
                return String.format("sequence(%s)", MultiMatcher.matchersToString(matchers));
            }
        };
    }
178997
public static int[] sequence(int start, int end) {
    if(start >= end) {
      return EMPTY_INTS;
    }
    int[] ret = new int[end - start];
    for(int j = 0; start < end; start++, j++) {
      ret[j] = start;
    }
    return ret;
  }
94140
@SafeVarargs
    public static <T> Iterable<T> sequence( final Iterable<? extends T>... iterables ) {
        return new Iterable<T>() {
            public Iterator<T> iterator() {
                return new FlattenIterator<T,Iterable<? extends T>>(ImmutableList.copyOf(iterables)) {
                    protected Iterator<T> expand(Iterable<? extends T> iterable) {
                        return Iterators.<T>cast(iterable).iterator();
                    }
                };
            }
        };
    }
52099
@Override
    public C.Sequence<T> prepend(C.Sequence<? extends T> seq) {
        if (seq instanceof C.List) {
            return prependList((C.List<T>) seq);
        }
        if (isLazy()) {
            return new CompositeSeq<T>(seq, this);
        }
        return unLazyPrepend(seq);
    }
1147905
public Callable<ResponderResult> createSequence(final Responder responder, final ResultHandler resultHandler) {
        return new Sequence<>(this, this.chainResponder(responder, resultHandler));
    }
814378
public List<SequenceGenerator<OrmDescriptor>> getAllSequenceGenerator()
   {
      List<SequenceGenerator<OrmDescriptor>> list = new ArrayList<SequenceGenerator<OrmDescriptor>>();
      List<Node> nodeList = model.get("sequence-generator");
      for(Node node: nodeList)
      {
         SequenceGenerator<OrmDescriptor>  type = new SequenceGeneratorImpl<OrmDescriptor>(this, "sequence-generator", model, node);
         list.add(type);
      }
      return list;
   }
996359
@Override
    public StrBuilder append(final CharSequence seq) {
        if (seq == null) {
            return appendNull();
        }
        return append(seq.toString());
    }
847227
public static Sequence createSequence(final org.biojava.bio.seq.Sequence sequence) {
        checkNotNull(sequence);

        Sequence s = new Sequence();
        if (!DNATools.getDNA().equals(sequence.getAlphabet())) {
            throw new IllegalArgumentException("alphabet must be DNA");
        }
        s.setValue(sequence.seqString());
        return s;
    }
184687
@Override
    public <T> EntitySequence getSequence(TableDefinition tableDef, Iterable<T> collection, List<String> fields) {
        return getSequence(tableDef, collection, fields, null);
    }