[LIB-5] Site sources of snooker-score-api
[snooker-score-api.git] / src / site / apt / examples / use-sort-in-collections.apt.vm
diff --git a/src/site/apt/examples/use-sort-in-collections.apt.vm b/src/site/apt/examples/use-sort-in-collections.apt.vm
new file mode 100644 (file)
index 0000000..ec7f9b3
--- /dev/null
@@ -0,0 +1,89 @@
+ ------
+ Using sorting of received data
+ ------
+ Dmitry Samoshin aka gotty
+ ------
+ 2017-01-27
+ ------
+
+~~ Copyright (c) 2017. Developed by Hedgecode.
+~~
+~~ Licensed under the Apache License, Version 2.0 (the "License");
+~~ you may not use this file except in compliance with the License.
+~~ You may obtain a copy of the License at
+~~
+~~   http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing, software
+~~ distributed under the License is distributed on an "AS IS" BASIS,
+~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~~ See the License for the specific language governing permissions and
+~~ limitations under the License.
+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+
+Using sorting of received data
+
+  The data obtained from the API methods calls of the main interface of the library,
+  in most cases, represent collection classes (<<<Players>>>, <<<Events>>>, <<<Matches>>>) 
+  which can be sorted by certain parameters for convenience of further use in client applications.
+
+  The types of possible sorts for specific collection classes are listed below.
+
+===
+
+  <<<Players>>> - entity class which contains a selection of players on certain parameters.\
+  This class provides two types of sorting:
+
+  <<1.>> Sorting players by name.
+
+  <<2.>> Sorting players by age, both in descending order and in ascending order.
+
+  Java code that shows all the above sorting methods is presented below:
+
++-------
+Players players = Snooker.API().getPlayers(...);
+...
+players.sortByName();
+...
+players.sortByAge();
+players.sortByAgeDesc();
+...
++-------
+
+===
+
+  <<<Events>>> - entity class which contains a selection of tournaments for certain parameters.
+
+  Java code that shows the sorting of tournaments by date is presented below:
+
++-------
+Events events = Snooker.API().getSeasonEvents((...);
+...
+events.sortByDate();
+...
++-------
+
+===
+
+  <<<Matches>>> - entity class which contains a selection of matches for certain parameters.\
+  This class provides two types of sorting:
+
+  <<1.>> Sorting matches by number.\
+  This sorting type will be useful when the selection contains all the matches of a single tournament.
+
+  <<2.>> Sorting matches by tournament.\
+  This sorting type will be useful when the selection contains all the matches
+  of an individual player for the season in different tournaments.
+
+  Java code that shows all the above sorting methods is presented below:
+
++-------
+Matches matches = Snooker.API().getEventMatches((...);
+...
+matches.sortByNumber();
+...
+matches.sortByEvent();
+...
++-------