mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
stdlib: fix up documentation for new methods
Swift SVN r27510
This commit is contained in:
@@ -46,17 +46,22 @@ extension SequenceType {
|
||||
% # a Comparable requirement.
|
||||
% for preds in [ True, False ]:
|
||||
|
||||
%{
|
||||
if preds:
|
||||
orderingRequirement = """
|
||||
/// Requires: `isOrderedBefore` is a `strict weak ordering
|
||||
/// <http://en.wikipedia.org/wiki/Strict_weak_order#Strict_weak_orderings>`__
|
||||
/// over `self`."""
|
||||
else:
|
||||
orderingRequirement = ""
|
||||
}%
|
||||
|
||||
extension SequenceType ${"" if preds else "where Self.Generator.Element : Comparable"} {
|
||||
|
||||
/// Returns the minimum element in `self`.
|
||||
///
|
||||
/// Complexity: O(count(elements))
|
||||
% if preds:
|
||||
///
|
||||
/// Requires: `isOrderedBefore` is a `strict weak ordering
|
||||
/// <http://en.wikipedia.org/wiki/Strict_weak_order#Strict_weak_orderings>`__
|
||||
/// over `self`."""
|
||||
% end
|
||||
/// ${orderingRequirement}
|
||||
final public func _prext_minElement(
|
||||
% if preds:
|
||||
@noescape isOrderedBefore: (${GElement}, ${GElement}) -> Bool
|
||||
@@ -79,12 +84,7 @@ extension SequenceType ${"" if preds else "where Self.Generator.Element : Compar
|
||||
/// Returns the maximum element in `self`.
|
||||
///
|
||||
/// Complexity: O(count(elements))
|
||||
% if preds:
|
||||
///
|
||||
/// Requires: `isOrderedBefore` is a `strict weak ordering
|
||||
/// <http://en.wikipedia.org/wiki/Strict_weak_order#Strict_weak_orderings>`__
|
||||
/// over `self`."""
|
||||
% end
|
||||
/// ${orderingRequirement}
|
||||
final public func _prext_maxElement(
|
||||
% if preds:
|
||||
@noescape isOrderedBefore: (${GElement}, ${GElement}) -> Bool
|
||||
@@ -117,15 +117,19 @@ extension SequenceType ${"" if preds else "where Self.Generator.Element : Compar
|
||||
|
||||
extension SequenceType ${"" if preds else "where Self.Generator.Element : Equatable"} {
|
||||
|
||||
% if preds:
|
||||
%{
|
||||
if preds:
|
||||
comment = """
|
||||
/// Return true iff `s` begins with elements equivalent to those of
|
||||
/// `prefix`, using `isEquivalent` as the equivalence test.
|
||||
///
|
||||
/// Requires: `isEquivalent` is an `equivalence relation
|
||||
/// <http://en.wikipedia.org/wiki/Equivalence_relation>`_
|
||||
% else:
|
||||
/// Return true iff the the initial elements of `s` are equal to `prefix`.
|
||||
% end
|
||||
/// <http://en.wikipedia.org/wiki/Equivalence_relation>`_"""
|
||||
else:
|
||||
comment = """
|
||||
/// Return true iff the the initial elements of `s` are equal to `prefix`."""
|
||||
}%
|
||||
${comment}
|
||||
final public func _prext_startsWith<
|
||||
S : SequenceType where S.${GElement} == ${GElement}
|
||||
>(
|
||||
@@ -133,7 +137,7 @@ extension SequenceType ${"" if preds else "where Self.Generator.Element : Equata
|
||||
% if preds:
|
||||
@noescape isEquivalent: (${GElement}, ${GElement}) -> Bool
|
||||
% end
|
||||
) -> Bool {
|
||||
) -> Bool {
|
||||
var prefixGenerator = prefix.generate()
|
||||
for e0 in self {
|
||||
if let e1? = prefixGenerator.next() {
|
||||
@@ -161,16 +165,21 @@ extension SequenceType ${"" if preds else "where Self.Generator.Element : Equata
|
||||
|
||||
extension SequenceType ${"" if preds else "where Self.Generator.Element : Equatable"} {
|
||||
|
||||
% if preds:
|
||||
%{
|
||||
if preds:
|
||||
comment = """
|
||||
/// Return true iff `a1` and `a2` contain equivalent elements, using
|
||||
/// `isEquivalent` as the equivalence test.
|
||||
///
|
||||
/// Requires: `isEquivalent` is an `equivalence relation
|
||||
/// <http://en.wikipedia.org/wiki/Equivalence_relation>`_
|
||||
% else:
|
||||
/// <http://en.wikipedia.org/wiki/Equivalence_relation>`_"""
|
||||
else:
|
||||
comment = """
|
||||
/// Return `true` iff `self` and `s` contain the same elements in the
|
||||
/// same order.
|
||||
% end
|
||||
/// same order."""
|
||||
}%
|
||||
|
||||
${comment}
|
||||
final public func _prext_equalElements<
|
||||
S : SequenceType where S.${GElement} == ${GElement}
|
||||
>(
|
||||
@@ -211,18 +220,24 @@ extension SequenceType ${"" if preds else "where Self.Generator.Element : Equata
|
||||
% # Comparable requirement.
|
||||
% for preds in [ True, False ]:
|
||||
|
||||
% if preds:
|
||||
/// Return true iff `a1` precedes `a2` in a lexicographical ("dictionary")
|
||||
/// ordering, using `isOrderedBefore` as the comparison between elements.
|
||||
///
|
||||
/// Requires: isOrderedBefore` is a `strict weak ordering
|
||||
/// <http://en.wikipedia.org/wiki/Strict_weak_order#Strict_weak_orderings>`__
|
||||
/// over the elements of `a1` and `a2`.
|
||||
% else:
|
||||
/// Return true iff a1 precedes a2 in a lexicographical ("dictionary")
|
||||
/// ordering, using "<" as the comparison between elements.
|
||||
% end
|
||||
extension SequenceType ${"" if preds else "where Self.Generator.Element : Comparable"} {
|
||||
|
||||
%{
|
||||
if preds:
|
||||
comment = """
|
||||
/// Return true iff `a1` precedes `a2` in a lexicographical ("dictionary")
|
||||
/// ordering, using `isOrderedBefore` as the comparison between elements.
|
||||
///
|
||||
/// Requires: isOrderedBefore` is a `strict weak ordering
|
||||
/// <http://en.wikipedia.org/wiki/Strict_weak_order#Strict_weak_orderings>`__
|
||||
/// over the elements of `a1` and `a2`."""
|
||||
else:
|
||||
comment = """
|
||||
/// Return true iff a1 precedes a2 in a lexicographical ("dictionary")
|
||||
/// ordering, using "<" as the comparison between elements."""
|
||||
}%
|
||||
|
||||
${comment}
|
||||
final public func _prext_lexicographicalCompare<
|
||||
S : SequenceType where S.${GElement} == ${GElement}
|
||||
>(
|
||||
|
||||
Reference in New Issue
Block a user