Skip to content
Snippets Groups Projects
Commit bb86ddf6 authored by ismcarb's avatar ismcarb
Browse files

Clase nueva del pdf

parent 8c6e048b
No related branches found
No related tags found
No related merge requests found
......@@ -4,15 +4,22 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="0c5e7f40-d6e0-4cdf-8175-c288dac24af5" name="Changes" comment="l">
<change afterPath="$PROJECT_DIR$/src/sdis/utils/MultiMap.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Main.java" beforeDir="false" />
<list default="true" id="0c5e7f40-d6e0-4cdf-8175-c288dac24af5" name="Changes" comment="Copias">
<change afterPath="$PROJECT_DIR$/src/spotify/media/Media.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_BRANCH_BY_REPOSITORY">
<map>
......@@ -30,23 +37,35 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"git-widget-placeholder": "master",
"kotlin-language-version-configured": "true",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"project.structure.last.edited": "Modules",
"project.structure.proportion": "0.0",
"project.structure.side.proportion": "0.0",
"vue.rearranger.settings.migration": "true"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;master&quot;,
&quot;kotlin-language-version-configured&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/ismael/IdeaProjects/practicasdis2/src/sdis/spotify/client/unit&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;project.structure.last.edited&quot;: &quot;Modules&quot;,
&quot;project.structure.proportion&quot;: &quot;0.0&quot;,
&quot;project.structure.side.proportion&quot;: &quot;0.0&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}]]></component>
}</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/sdis/spotify/client/unit" />
<recent name="$PROJECT_DIR$/src/sdis/spotify/client" />
<recent name="$PROJECT_DIR$/src/sdis/spotify/common" />
<recent name="$PROJECT_DIR$/src/sdis/spotify/server" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="sdis.utils" />
</key>
</component>
<component name="SharedIndexes">
<attachedChunks>
<set>
......@@ -63,7 +82,8 @@
<option name="presentableId" value="Default" />
<updated>1715700916232</updated>
<workItem from="1715700917299" duration="37000" />
<workItem from="1715700981339" duration="692000" />
<workItem from="1715700981339" duration="801000" />
<workItem from="1716049349162" duration="71000" />
</task>
<task id="LOCAL-00001" summary="l">
<option name="closed" value="true" />
......@@ -73,14 +93,34 @@
<option name="project" value="LOCAL" />
<updated>1715701180778</updated>
</task>
<option name="localTasksCounter" value="2" />
<task id="LOCAL-00002" summary="Copias">
<option name="closed" value="true" />
<created>1715701766747</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1715701766747</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="l" />
<option name="LAST_COMMIT_MESSAGE" value="l" />
<MESSAGE value="Copias" />
<option name="LAST_COMMIT_MESSAGE" value="Copias" />
</component>
</project>
\ No newline at end of file
package spotify.media;
import javax.swing.*;
import java.awt.*;
import java.io.Serializable;
import java.util.ArrayList;
public class Media implements Serializable {
private String name;
private String internalName;
private int likes;
private boolean adultContent;
private ArrayList<String> comments;
private double score;
private int numVotes;
private ImageIcon cover;
public Media(String name) {
this.name = name;
this.internalName = name.trim().replaceAll("[^a-zA-Z0-9]+", "_").toLowerCase();
this.likes = 0;
this.adultContent = false;
this.comments = new ArrayList<>();
this.score = 0;
this.numVotes = 0;
this.cover = null;
}
public String getName(){ return this.name; }
public String getInternalName(){ return this.internalName; }
public int getLikes() { return this.likes; }
public boolean isAdultContent() {return this.adultContent; }
public ArrayList<String> getComments() {return this.comments; }
public double getScore() { return this.score; }
public ImageIcon getCover() { return this.cover; }
public void addLike() { this.likes++; }
public void tagAdultContent(boolean flag) { this.adultContent = flag; }
public void addComment(String comment) { this.comments.add(comment); }
public void addScore(double sc) { score = ( (score * numVotes) + sc) / (++numVotes); }
public void setCover(ImageIcon img) { this.cover = img; }
public String toString() {
showCover();
String msg = "\n\n© "+this.name+(this.adultContent ? " [+18]" : " [AP (all public)]")+".";
msg += "\n \u2606"+" "+Math.round(this.score*100)/100.0+" ("+this.numVotes+" votes)";
msg += "\n \uD83D\uDC4D"+" "+this.likes;
msg += "\n "+this.comments.size()+" comments found on this media:";
for(int i=0; i<this.comments.size(); i++) msg += " \n #"+i+": "+this.comments.get(i)+".";
return msg;
}
public void showCover() {
if (cover == null) return;
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
frame.add((new JPanel()).add(new JLabel(getCover())));
frame.pack();
frame.setVisible(true);
}
public void loadCover(String path) {
setCover(new ImageIcon(Toolkit.getDefaultToolkit().createImage(path)));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment