-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathP6-SpOOtify.st
430 lines (306 loc) · 12.5 KB
/
P6-SpOOtify.st
1
Object subclass: #AlbumSpotify instanceVariableNames: 'titulo temas' classVariableNames: '' poolDictionaries: '' category: 'Practica6-SpOOtify'!!AlbumSpotify commentStamp: '<historical>' prior: 0!Please comment me using the following template inspired by Class Responsibility Collaborator (CRC) design:For the Class part: State a one line summary. For example, "I represent a paragraph of text".For the Responsibility part: Three sentences about my main responsibilities - what I do, what I know.For the Collaborators Part: State my main collaborators and one line about how I interact with them. Public API and Key Messages- message one - message two - (for bonus points) how to create instances. One simple example is simply gorgeous. Internal Representation and Key Implementation Points. Instance Variables temas: <Object> titulo: <Object> Implementation Points!!AlbumSpotify methodsFor: 'initialization' stamp: 'ema 5/11/2018 21:20'!initialize super initialize. temas := OrderedCollection new! !!AlbumSpotify methodsFor: 'accessing' stamp: 'ema 5/22/2018 08:15'!tituloComo: string ^ titulo includesSubstring: string! !!AlbumSpotify methodsFor: 'accessing' stamp: 'ema 5/11/2018 18:34'!agregarTema: unTema temas add: unTema! !!AlbumSpotify methodsFor: 'accessing' stamp: 'ema 5/11/2018 18:34'!temas ^ temas! !!AlbumSpotify methodsFor: 'accessing' stamp: 'ema 5/11/2018 18:33'!titulo: unTitle titulo:= unTitle ! !!AlbumSpotify methodsFor: 'accessing' stamp: 'ema 5/11/2018 21:25'!titulo ^ titulo! !!AlbumSpotify methodsFor: 'as yet unclassified' stamp: 'ema 5/22/2018 08:03'!buscarPorTitulo: string ^ temas select: [ :t | t tituloComo: string ]! !"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!AlbumSpotify class instanceVariableNames: ''!!AlbumSpotify class methodsFor: 'accessing' stamp: 'ema 5/11/2018 18:33'!titulo: unTitle ^ self new titulo: unTitle ! !Object subclass: #AutorSpotify instanceVariableNames: 'nombre albumes' classVariableNames: '' poolDictionaries: '' category: 'Practica6-SpOOtify'!!AutorSpotify commentStamp: '<historical>' prior: 0!Please comment me using the following template inspired by Class Responsibility Collaborator (CRC) design:For the Class part: State a one line summary. For example, "I represent a paragraph of text".For the Responsibility part: Three sentences about my main responsibilities - what I do, what I know.For the Collaborators Part: State my main collaborators and one line about how I interact with them. Public API and Key Messages- message one - message two - (for bonus points) how to create instances. One simple example is simply gorgeous. Internal Representation and Key Implementation Points. Instance Variables albumes: <Object> nombre: <Object> Implementation Points!!AutorSpotify methodsFor: 'accessing' stamp: 'ema 5/11/2018 18:36'!nombre: aName nombre := aName! !!AutorSpotify methodsFor: 'accessing' stamp: 'ema 5/11/2018 18:37'!agregarAlbum: album albumes add: album! !!AutorSpotify methodsFor: 'accessing' stamp: 'ema 5/11/2018 18:38'!initialize super initialize. albumes := OrderedCollection new! !!AutorSpotify methodsFor: 'accessing' stamp: 'ema 5/11/2018 18:36'!nombre ^ nombre! !!AutorSpotify methodsFor: 'as yet unclassified' stamp: 'ema 5/22/2018 08:12'!nombreComo: string ^ nombre includesSubstring: string! !!AutorSpotify methodsFor: 'as yet unclassified' stamp: 'ema 5/22/2018 08:24'!buscarPorTitulo: string | listaDeTemas | listaDeTemas := OrderedCollection new. (albumes collect: [ :album | album buscarPorTitulo: string ]) do: [ :lista | listaDeTemas addAll: lista ]. ^ listaDeTemas ! !!AutorSpotify methodsFor: 'as yet unclassified' stamp: 'ema 5/11/2018 21:41'!todosLosTemas | resultado | resultado := OrderedCollection new. (albumes collect: [ :a | a temas ]) do: [ :listaDeTemas | resultado addAll: listaDeTemas ]. ^ resultado! !!AutorSpotify methodsFor: 'as yet unclassified' stamp: 'ema 5/22/2018 08:13'!buscarPorAlbum: aString ^ albumes select: [ :a | a tituloComo: aString ]! !"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!AutorSpotify class instanceVariableNames: ''!!AutorSpotify class methodsFor: 'accessing' stamp: 'ema 5/11/2018 18:36'!nombre: aName ^ self new nombre: aName! !Object subclass: #SpOOtify instanceVariableNames: 'usuarios autores' classVariableNames: '' poolDictionaries: '' category: 'Practica6-SpOOtify'!!SpOOtify commentStamp: '<historical>' prior: 0!Please comment me using the following template inspired by Class Responsibility Collaborator (CRC) design:For the Class part: State a one line summary. For example, "I represent a paragraph of text".For the Responsibility part: Three sentences about my main responsibilities - what I do, what I know.For the Collaborators Part: State my main collaborators and one line about how I interact with them. Public API and Key Messages- message one - message two - (for bonus points) how to create instances. One simple example is simply gorgeous. Internal Representation and Key Implementation Points. Instance Variables autores: <Object> usuarios: <Object> Implementation Points!!SpOOtify methodsFor: 'as yet unclassified' stamp: 'ema 5/11/2018 19:46'!agregarAutor: autor autores add: autor! !!SpOOtify methodsFor: 'as yet unclassified' stamp: 'ema 5/11/2018 19:46'!agregarUsuario: user usuarios add: user! !!SpOOtify methodsFor: 'as yet unclassified' stamp: 'ema 5/22/2018 08:17'!buscarPorAutor: aString | listaDeTemas | listaDeTemas := OrderedCollection new. (autores select: [ :a | a nombreComo: aString ]) do: [ :a | listaDeTemas addAll: a todosLosTemas ]. ^ listaDeTemas ! !!SpOOtify methodsFor: 'as yet unclassified' stamp: 'ema 5/22/2018 08:28'!listasDeTemasConTituloComo: string ^ autores collect: [ :a | a buscarPorTitulo: string ]! !!SpOOtify methodsFor: 'as yet unclassified' stamp: 'ema 5/22/2018 08:28'!buscarPorTitulo: aString | listaDeTemas | listaDeTemas := OrderedCollection new. (self listasDeTemasConTituloComo: aString) do: [ :listaFiltrada | listaDeTemas addAll: listaFiltrada ]. ^ listaDeTemas! !!SpOOtify methodsFor: 'as yet unclassified' stamp: 'ema 5/22/2018 08:17'!buscarPorAlbum: aString | listaDeTemas | listaDeTemas := OrderedCollection new. (autores collect: [ :a | a buscarPorAlbum: aString ]) do: [ :listaDeAlbumes | listaDeAlbumes do: [ :a | listaDeTemas addAll: a temas ] ]. ^ listaDeTemas ! !!SpOOtify methodsFor: 'initialization' stamp: 'ema 5/11/2018 18:22'!initialize super initialize. usuarios := OrderedCollection new. autores := OrderedCollection new.! !Object subclass: #TemaSpotify instanceVariableNames: 'titulo' classVariableNames: '' poolDictionaries: '' category: 'Practica6-SpOOtify'!!TemaSpotify commentStamp: '<historical>' prior: 0!Please comment me using the following template inspired by Class Responsibility Collaborator (CRC) design:For the Class part: State a one line summary. For example, "I represent a paragraph of text".For the Responsibility part: Three sentences about my main responsibilities - what I do, what I know.For the Collaborators Part: State my main collaborators and one line about how I interact with them. Public API and Key Messages- message one - message two - (for bonus points) how to create instances. One simple example is simply gorgeous. Internal Representation and Key Implementation Points. Instance Variables titulo: <Object> Implementation Points!!TemaSpotify methodsFor: 'as yet unclassified' stamp: 'ema 5/22/2018 08:09'!tituloComo: string ^ titulo includesSubstring: string! !!TemaSpotify methodsFor: 'accessing' stamp: 'ema 5/11/2018 18:29'!titulo ^ titulo! !!TemaSpotify methodsFor: 'accessing' stamp: 'ema 5/11/2018 18:29'!titulo: anObject titulo := anObject! !"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!TemaSpotify class instanceVariableNames: ''!!TemaSpotify class methodsFor: 'as yet unclassified' stamp: 'ema 5/11/2018 18:29'!titulo: unTitulo ^ self new titulo: unTitulo! !TestCase subclass: #TestSpootify instanceVariableNames: 'spotify tema5 tema4 tema1 tema2 tema3 tema6 usuario1' classVariableNames: '' poolDictionaries: '' category: 'Practica6-SpOOtify'!!TestSpootify commentStamp: 'ema 5/11/2018 21:50' prior: 0!Please comment me using the following template inspired by Class Responsibility Collaborator (CRC) design:For the Class part: State a one line summary. For example, "I represent a paragraph of text".xFor the Responsibility part: Three sentences about my main responsibilities - what I do, what I know.For the Collaborators Part: State my main collaborators and one line about how I interact with them. Public API and Key Messages- message one - message two - (for bonus points) how to create instances. One simple example is simply gorgeous. Internal Representation and Key Implementation Points. Instance Variables spotify: <Object> tema1: <Object> tema2: <Object> tema3: <Object> tema4: <Object> tema5: <Object> tema6: <Object> usuario1: <Object> Implementation Points!!TestSpootify methodsFor: 'initialization' stamp: 'ema 5/11/2018 21:44'!setUp | albumDe123 albumDe456 autor1 autor2 usuario2 usuario3 usuario4 | tema1 := TemaSpotify titulo: 'Tema 1'. tema2 := TemaSpotify titulo: 'Tema 2'. tema3 := TemaSpotify titulo: 'Tema 3'. tema4 := TemaSpotify titulo: 'Tema 4'. tema5 := TemaSpotify titulo: 'Tema 5'. tema6 := TemaSpotify titulo: 'Tema 6'. albumDe123 := AlbumSpotify titulo: 'Album MenosDe4'. albumDe456 := AlbumSpotify titulo: 'Album MasDe3'. albumDe123 agregarTema: tema1. albumDe123 agregarTema: tema2. albumDe123 agregarTema: tema3. albumDe456 agregarTema: tema4. albumDe456 agregarTema: tema5. albumDe456 agregarTema: tema6. autor1 := AutorSpotify nombre: 'Pepe Bajos'. autor2 := AutorSpotify nombre: 'Juanito Altos'. autor1 agregarAlbum: albumDe123. autor2 agregarAlbum: albumDe456. spotify := SpOOtify new. spotify agregarAutor: autor1. spotify agregarAutor: autor2. usuario1 := UsuarioSpotify new. usuario2 := UsuarioSpotify new. usuario3 := UsuarioSpotify new. usuario4 := UsuarioSpotify new. spotify agregarUsuario: usuario1. spotify agregarUsuario: usuario2. spotify agregarUsuario: usuario3. spotify agregarUsuario: usuario4. usuario1 agregarTema: tema1. usuario1 agregarTema: tema2. usuario1 agregarTema: tema3. usuario2 agregarTema: tema2. usuario2 agregarTema: tema3. usuario3 agregarTema: tema6! !!TestSpootify methodsFor: 'tests' stamp: 'ema 5/11/2018 21:42'!testBusquedas self assert: ((spotify buscarPorTitulo: '5') includes: tema5). self deny: ((spotify buscarPorTitulo: '5') includes: tema4). self assert: ((spotify buscarPorAlbum: 'Mas') includes: tema5). self deny: ((spotify buscarPorAlbum: 'Mas') includes: tema1). self assert: ((spotify buscarPorAutor: 'Altos') includes: tema4). self deny: ((spotify buscarPorAutor: 'Bajos') includes: tema4)! !!TestSpootify methodsFor: 'tests' stamp: 'ema 5/11/2018 21:47'!testGestionDeTemas usuario1 agregarTema: tema1. self assert: (usuario1 mymusic includes: tema1). usuario1 borrarTema: tema1. self deny: (usuario1 mymusic includes: tema1)! !Object subclass: #UsuarioSpotify instanceVariableNames: 'mymusic' classVariableNames: '' poolDictionaries: '' category: 'Practica6-SpOOtify'!!UsuarioSpotify commentStamp: '<historical>' prior: 0!Please comment me using the following template inspired by Class Responsibility Collaborator (CRC) design:For the Class part: State a one line summary. For example, "I represent a paragraph of text".For the Responsibility part: Three sentences about my main responsibilities - what I do, what I know.For the Collaborators Part: State my main collaborators and one line about how I interact with them. Public API and Key Messages- message one - message two - (for bonus points) how to create instances. One simple example is simply gorgeous. Internal Representation and Key Implementation Points. Instance Variables mymusic: <Object> Implementation Points!!UsuarioSpotify methodsFor: 'as yet unclassified' stamp: 'ema 5/11/2018 18:24'!borrarTema: unTema mymusic remove: unTema! !!UsuarioSpotify methodsFor: 'as yet unclassified' stamp: 'ema 5/11/2018 18:24'!agregarTema: unTema mymusic add: unTema ! !!UsuarioSpotify methodsFor: 'accessing' stamp: 'ema 5/11/2018 21:46'!mymusic ^ mymusic ! !!UsuarioSpotify methodsFor: 'initialization' stamp: 'ema 5/11/2018 21:48'!initialize super initialize. mymusic := Set new! !