added just a few lines of code

This commit is contained in:
hyunghwan.chung 2018-05-09 16:43:58 +00:00
parent bc93856b35
commit ff5e5aa23f
2 changed files with 33 additions and 3 deletions

View File

@ -37,6 +37,29 @@ class Collection(Object)
self do: [ :el | if (block value: el) { ^el } ]. self do: [ :el | if (block value: el) { ^el } ].
^exception_block value. ^exception_block value.
} }
(* ------------------- TODO -------------------------------
method add: object
{
self subclassResponsibility: #add:.
}
method select: condition_block
{
| coll |
coll := self class new: self basicSize.
self do: [ :el | if (condition_block value: el) { coll add: el } ].
^coll
}
method reject: condition_block
{
| coll |
coll := self class new: self basicSize.
self do: [ :el | if (condition_block value: el) { } else { coll add: el } ].
^coll
}
*)
} }
## ------------------------------------------------------------------------------- ## -------------------------------------------------------------------------------

View File

@ -1,9 +1,16 @@
###include 'Moo.moo'. ###include 'Moo.moo'.
#include 'Socket.moo'. #include 'Socket.moo'.
class HttpServerSocket(ServerSocket) class HttpServerSocket(ServerSocket)
{ {
method(#class) initialize
{
self onEvent: #accepted do: [
].
###self addEventListener: self.
}
} }
class HttpServer(Object) class HttpServer(Object)
@ -22,14 +29,14 @@ class HttpServer(Object)
if (laddr class == Array) if (laddr class == Array)
{ {
laddr do: [:addr | laddr do: [:addr |
sck := ServerSocket family: (addr family) type: Socket.Type.STREAM. sck := HttpServerSocket family: (addr family) type: Socket.Type.STREAM.
self.server_sockets addLast: sck. self.server_sockets addLast: sck.
sck bind: addr. sck bind: addr.
]. ].
} }
else else
{ {
sck := ServerSocket family: (laddr family) type: Socket.Type.STREAM. sck := HttpServerSocket family: (laddr family) type: Socket.Type.STREAM.
self.server_sockets addLast: sck. self.server_sockets addLast: sck.
sck bind: laddr. sck bind: laddr.
}. }.