forked from farfanoide/poo_I_2014
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRedSocial.st
208 lines (153 loc) · 5.12 KB
/
RedSocial.st
1
Object subclass: #User instanceVariableNames: 'name wall friends' classVariableNames: '' poolDictionaries: '' category: 'Practica5-1'!!User commentStamp: 'IvanKarl 11/13/2014 15:19' prior: 0!An User is a frigging user!!.Instance Variables friends: <Object> name: <Object> wall: <Object>friends - xxxxxname - xxxxxwall - xxxxx!!User methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:31'!addFriend: aUser "Agregar aUser a la lista de amigos" self friends add: aUser! !!User methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:40'!messages ^ self wall messages! !!User methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 17:33'!friendsToFriends: aString self friendsOfMyfriends do: [ :friend | friend newMessage: aString from: self ]! !!User methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:17'!name: aString name := aString! !!User methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 17:30'!post: aString "Publica un mensaje en muro" self wall post: (WallMessage text: aString from: self). self updateFriends: aString! !!User methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 16:40'!newMessage: aMessage from: aFriend "Los usuarios reciben este mensaje cuando el amigo indicado por el parámetro anotherUser publicó el mensaje aMessage en su propio muro" self addMessage: (WallMessage text:aMessage from:aFriend) ! !!User methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:31'!initialize friends := OrderedCollection new. wall := Wall new! !!User methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 17:30'!floodPost: aString "Publica un mensaje en muro" self wall post: (WallMessage text: aString from: self). self friendsToFriends: aString! !!User methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 16:10'!wall ^ wall! !!User methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:17'!name ^ name! !!User methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:53'!addMessage: aMessage self wall post: aMessage! !!User methodsFor: 'as yet unclassified' stamp: 'camila 11/6/2014 17:22'!friends ^friends! !!User methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 17:19'!friendsOfMyfriends ^ self friends flatCollectAsSet: [ :friend | friend friends ]! !!User methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 17:33'!updateFriends:aString self friends do: [ :friend| friend newMessage: aString from: self ]! !Object subclass: #Wall instanceVariableNames: 'messages' classVariableNames: '' poolDictionaries: '' category: 'Practica5-1'!!Wall commentStamp: 'IvanKarl 11/13/2014 15:19' prior: 0!A Wall is a place to leave messages .Instance Variables list: <Object>list - xxxxx!!Wall methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:21'!messages ^ messages! !!Wall methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 16:35'!initialize messages :=OrderedCollection new.! !!Wall methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:21'!list ^ self messages! !!Wall methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:47'!removeOldestMessage self removeMessage: self oldestMessage.! !!Wall methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 16:48'!oldestMessage ^ self messages first! !!Wall methodsFor: 'as yet unclassified' stamp: 'camila 11/6/2014 17:32'!numberOfMessages "Retorna la cantidad de mensajes posteados en el muro" ^ self list size! !!Wall methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:47'!removeMessage: aMessage "Elimina el mensaje del muro" self list remove: aMessage! !!Wall methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 17:13'!post: aMessage "Agrega un mensaje al muro" (self numberOfMessages = 10) ifTrue: [self removeOldestMessage]. self list add: aMessage! !Object subclass: #WallMessage instanceVariableNames: 'text date author' classVariableNames: '' poolDictionaries: '' category: 'Practica5-1'!!WallMessage commentStamp: 'IvanKarl 11/13/2014 17:41' prior: 0!A WallMessage is a place for user's messages.Instance Variables author: <Object> date: <Object> text: <Object>author - xxxxxdate - xxxxxtext - xxxxx!!WallMessage methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:34'!initialize date := Date today. ! !!WallMessage methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 16:15'!date: aDate date:=aDate! !!WallMessage methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 16:27'!author: aUser author := aUser! !!WallMessage methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 16:23'!text: aString text := aString! !!WallMessage methodsFor: 'as yet unclassified' stamp: 'camila 11/13/2014 16:15'!date ^ date! !"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!WallMessage class instanceVariableNames: ''!!WallMessage class commentStamp: '<historical>' prior: 0!!!WallMessage class methodsFor: 'as yet unclassified' stamp: 'IvanKarl 11/13/2014 15:34'!text: aString from: aUser ^ self new text: aString; author: aUser; yourself! !