Skip to content

Commit b33b081

Browse files
committed
Documentation
1 parent af51ee3 commit b33b081

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

stream/numbers.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,49 +130,134 @@ def average(self):
130130
return _sum / _count
131131

132132
def takeWhileSmallerThan(self, maximum):
133+
'''
134+
Returns a stream consisting of the longest prefix of elements taken from this stream that is smaller than the specified value
135+
136+
:return: self
137+
'''
133138
return self.takeWhile(lambda x: x < maximum)
134139

135140
def takeWhileSmallerOrEqualThan(self, maximum):
141+
'''
142+
Returns a stream consisting of the longest prefix of elements taken from this stream that is smaller or equal than the specified value
143+
144+
:return: self
145+
'''
136146
return self.takeWhile(lambda x: x <= maximum)
137147

138148
def takeWhileGreaterThan(self, minimum):
149+
'''
150+
Returns a stream consisting of the longest prefix of elements taken from this stream that is greater than the specified value
151+
152+
:return: self
153+
'''
139154
return self.takeWhile(lambda x: x > minimum)
140155

141156
def takeWhileGreaterOrEqualThan(self, minimum):
157+
'''
158+
Returns a stream consisting of the longest prefix of elements taken from this stream that is greater or equal than the specified value
159+
160+
:return: self
161+
'''
142162
return self.takeWhile(lambda x: x >= minimum)
143163

144164
def smallerThan(self, maximum):
165+
'''
166+
Returns a stream consisting of the elements of this stream that are smaller than the specified value
167+
168+
:param int maximum: the maximum value [exclusive]
169+
:return: self
170+
'''
145171
return self.filter(lambda x: x < maximum)
146172

147173
def smallerOrEqualThan(self, maximum):
174+
'''
175+
Returns a stream consisting of the elements of this stream that are smaller or equal than the specified value
176+
177+
:param int maximum: the maximum value [inclusive]
178+
:return: self
179+
'''
148180
return self.filter(lambda x: x <= maximum)
149181

150182
def greaterThan(self, minimum):
183+
'''
184+
Returns a stream consisting of the elements of this stream that are greater than the specified value
185+
186+
:param int minimum: the minimum value [exclusive]
187+
:return: self
188+
'''
151189
return self.filter(lambda x: x > minimum)
152190

153191
def greaterOrEqualThan(self, minimum):
192+
'''
193+
Returns a stream consisting of the elements of this stream that are greater than the specified value
194+
195+
:param int minimum: the minimum value [inclusive]
196+
:return: self
197+
'''
154198
return self.filter(lambda x: x >= minimum)
155199

156200
def multipleOf(self, number):
201+
'''
202+
Returns a stream consisting of the elements of this stream that are multiple of the specified value
203+
204+
:param int number: the value
205+
:return: self
206+
'''
157207
return self.filter(lambda x: x % number == 0)
158208

159209
def square(self):
210+
'''
211+
Returns a stream consisting of the square of the element of this stream
212+
213+
:return: self
214+
'''
160215
return self.pow(2)
161216

162217
def cube(self):
218+
'''
219+
Returns a stream consisting of the cube of the element of this stream
220+
221+
:return: self
222+
'''
163223
return self.pow(3)
164224

165225
def pow(self, power):
226+
'''
227+
Returns a stream consisting of the pow to the specified value of the element of this stream
228+
229+
:return: self
230+
'''
166231
return self.map(lambda x: x ** power)
167232

168233
def sqrt(self):
234+
'''
235+
Returns a stream consisting of the square root of the element of this stream
236+
237+
:return: self
238+
'''
169239
return self.map(math.sqrt)
170240

171241
def log(self):
242+
'''
243+
Returns a stream consisting of the log of the element of this stream
244+
245+
:return: self
246+
'''
172247
return self.map(math.log)
173248

174249
def sin(self):
250+
'''
251+
Returns a stream consisting of the sin of the element of this stream
252+
253+
:return: self
254+
'''
175255
return self.map(math.sin)
176256

177257
def cos(self):
258+
'''
259+
Returns a stream consisting of the cos of the element of this stream
260+
261+
:return: self
262+
'''
178263
return self.map(math.cos)

0 commit comments

Comments
 (0)