minor fixes, moved to version 2.0.2
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/top-topics@133752 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0107f8843f
commit
7e601bef24
16
.classpath
16
.classpath
|
@ -1,19 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/top-topics-2.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/top-topics-2.0.2-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry including="**/*.java" kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/resources"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/top-topics-2.0.2-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
|
@ -30,5 +38,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/top-topics-2.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/top-topics-2.0.2-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/>
|
||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||
<property name="context-root" value="top-topics"/>
|
||||
</wb-module>
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlet.user.toptopics.2-0-2"
|
||||
date="2016-12-01">
|
||||
<Change>Minor fixes</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlet.user.toptopics.2-0-1"
|
||||
date="2016-10-01">
|
||||
<Change>Minor fixes</Change>
|
||||
|
|
9
pom.xml
9
pom.xml
|
@ -13,10 +13,10 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>top-topics</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.0.1-SNAPSHOT</version>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<name>Top Topics Portlet</name>
|
||||
<description>
|
||||
Top Topics Portle shows the top 10 topics in the scope where is deployed.
|
||||
Top Topics Portlet shows the top topics in the scope where is deployed.
|
||||
</description>
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</connection>
|
||||
|
@ -53,6 +53,7 @@
|
|||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-user</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
|
@ -75,19 +76,23 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>custom-portal-handler</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslcore</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>social-networking-library</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google</groupId>
|
||||
|
|
|
@ -4,10 +4,7 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
@ -22,7 +19,7 @@ import org.gcube.portal.databook.server.DBCassandraAstyanaxImpl;
|
|||
import org.gcube.portal.databook.server.DatabookStore;
|
||||
import org.gcube.portal.databook.shared.Feed;
|
||||
import org.gcube.portlets.user.topics.client.TopicService;
|
||||
import org.gcube.portlets.user.topics.shared.HashTagAndOccurrence;
|
||||
import org.gcube.portlets.user.topics.shared.HashTagOccAndWeight;
|
||||
import org.gcube.portlets.user.topics.shared.HashtagsWrapper;
|
||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||
|
@ -36,7 +33,9 @@ import org.slf4j.LoggerFactory;
|
|||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
|
||||
/**
|
||||
* TopicServiceImpl server side implementation for top-topics class
|
||||
* @author Massimiliano Assante, ISTI-CNR
|
||||
* @author Costantino Perciante, ISTI-CNR
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class TopicServiceImpl extends RemoteServiceServlet implements TopicService {
|
||||
|
@ -45,17 +44,20 @@ public class TopicServiceImpl extends RemoteServiceServlet implements TopicServi
|
|||
public static final String TEST_USER = "test.user";
|
||||
private static final String TEST_SCOPE = "/gcube/devsec/devVRE";
|
||||
private static final int WINDOW_SIZE_IN_MONTHS = 6; // it must not exceed 12
|
||||
private static final double FRESHNESS_FACTOR = 0.4;
|
||||
private static final double NORMALIZED_SCORE_FACTOR = 0.6;
|
||||
|
||||
/**
|
||||
* The Cassandra store interface
|
||||
*/
|
||||
private DatabookStore store;
|
||||
private GroupManager gm;
|
||||
private UserManager um;
|
||||
|
||||
/**
|
||||
* connect to cassandra at startup
|
||||
*/
|
||||
public void init() {
|
||||
store = new DBCassandraAstyanaxImpl();
|
||||
gm = new LiferayGroupManager();
|
||||
um = new LiferayUserManager();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,52 +96,40 @@ public class TopicServiceImpl extends RemoteServiceServlet implements TopicServi
|
|||
*/
|
||||
@Override
|
||||
public HashtagsWrapper getHashtags() {
|
||||
ArrayList<String> hashtagsChart = new ArrayList<String>();
|
||||
|
||||
ASLSession session = getASLSession();
|
||||
String userName = session.getUsername();
|
||||
String currentScope = session.getScope();
|
||||
boolean isInfrastructure = isInfrastructureScope();
|
||||
|
||||
//in case the portal is restarted and you have the social home open it will get test.user (no callback to set session info)
|
||||
//this check just return nothing if that happens
|
||||
if (userName.compareTo(TEST_USER) == 0) {
|
||||
logger.debug("Found " + userName + " returning nothing");
|
||||
return null;
|
||||
}
|
||||
|
||||
long timestampStart = System.currentTimeMillis();
|
||||
String currentScope = session.getScope();
|
||||
boolean isInfrastructure = isInfrastructureScope(currentScope);
|
||||
|
||||
// get the reference time
|
||||
Calendar referenceTime = Calendar.getInstance();
|
||||
int currentMonth = referenceTime.get(Calendar.MONTH); // jan = 0, ..... dec = 11
|
||||
referenceTime.set(Calendar.MONTH, currentMonth - WINDOW_SIZE_IN_MONTHS); // the year is automatically decreased if needed
|
||||
|
||||
// print it
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
logger.debug("Reference time for trending topics is " + format.format(referenceTime.getTime()));
|
||||
|
||||
ArrayList<HashTagOccAndWeight> toSort = new ArrayList<HashTagOccAndWeight>();
|
||||
ArrayList<String> hashtagsChart = new ArrayList<String>();
|
||||
Map<String, List<String>> hashtagsInVres = null;
|
||||
|
||||
try {
|
||||
|
||||
ArrayList<HashTagAndOccurrence> toSort = new ArrayList<HashTagAndOccurrence>();
|
||||
Map<String, Integer> hashtagsAndOccurrences = new HashMap<String, Integer>();
|
||||
|
||||
if (isInfrastructure) {
|
||||
|
||||
logger.debug("****** retrieving hashtags for user VREs and site");
|
||||
|
||||
// different vres could have a same hashtag, we need to merge them
|
||||
Map<String, Integer> hashtags = new HashMap<String, Integer>();
|
||||
|
||||
// we need a map for the couple <hashtag, vre in which it is present>
|
||||
// it is needed because later we need to retrieve the most recent feed among the ones
|
||||
// containing the hashtag itself
|
||||
Map<String, List<String>> hashtagsInVres = new HashMap<String, List<String>>();
|
||||
|
||||
GroupManager gm = new LiferayGroupManager();
|
||||
UserManager um = new LiferayUserManager();
|
||||
GCubeUser user = um.getUserByUsername(userName);
|
||||
|
||||
Set<GCubeGroup> vresInPortal = gm.listGroupsByUserAndSite(user.getUserId(), getThreadLocalRequest().getServerName());
|
||||
logger.debug("Contexts in this site are per user " + vresInPortal);
|
||||
|
||||
logger.debug("Contexts in this site per user are " + vresInPortal);
|
||||
List<String> contexts = new ArrayList<String>();
|
||||
|
||||
// get the scopes associated with such groups
|
||||
|
@ -147,91 +137,77 @@ public class TopicServiceImpl extends RemoteServiceServlet implements TopicServi
|
|||
contexts.add(gm.getInfrastructureScope(gCubeGroup.getGroupId()));
|
||||
}
|
||||
|
||||
hashtagsInVres = new HashMap<String, List<String>>();
|
||||
|
||||
for (String context : contexts) {
|
||||
Map<String, Integer> map = store.getVREHashtagsWithOccurrenceFilteredByTime(context, referenceTime.getTimeInMillis());
|
||||
|
||||
Map<String, Integer> hashtagsAndOccurrenceInScope = store.getVREHashtagsWithOccurrenceFilteredByTime(context, referenceTime.getTimeInMillis());
|
||||
|
||||
// merge the values if needed
|
||||
for (String hashtag : map.keySet()) {
|
||||
for (String hashtag : hashtagsAndOccurrenceInScope.keySet()) {
|
||||
|
||||
if(hashtags.containsKey(hashtag)){
|
||||
int newValue;
|
||||
List<String> vres = new ArrayList<String>();
|
||||
|
||||
int currentValue = hashtags.get(hashtag);
|
||||
int newValue = currentValue + map.get(hashtag);
|
||||
if(hashtagsAndOccurrences.containsKey(hashtag)){
|
||||
|
||||
// remove and re-add
|
||||
hashtags.remove(hashtag);
|
||||
hashtags.put(hashtag, newValue);
|
||||
|
||||
// get the current list of vres in which the hashtag is present and add this new one
|
||||
List<String> vres = hashtagsInVres.get(hashtag);
|
||||
vres.add(context);
|
||||
hashtagsInVres.put(hashtag, vres);
|
||||
newValue = hashtagsAndOccurrences.get(hashtag) + hashtagsAndOccurrenceInScope.get(hashtag);
|
||||
vres = hashtagsInVres.get(hashtag);
|
||||
|
||||
}else{
|
||||
|
||||
hashtags.put(hashtag, map.get(hashtag));
|
||||
newValue = hashtagsAndOccurrenceInScope.get(hashtag);
|
||||
|
||||
// put in the hashmap hashtagsInVres too
|
||||
List<String> vres = new ArrayList<String>();
|
||||
vres.add(context);
|
||||
hashtagsInVres.put(hashtag, vres);
|
||||
}
|
||||
|
||||
hashtagsAndOccurrences.put(hashtag, newValue);
|
||||
vres.add(context);
|
||||
hashtagsInVres.put(hashtag, vres);
|
||||
}
|
||||
}
|
||||
|
||||
// now we need to evaluate score for each element
|
||||
Map<String, Double> weights = evaluateWeight(hashtags, WINDOW_SIZE_IN_MONTHS, currentMonth, referenceTime, null, hashtagsInVres);
|
||||
|
||||
// at the end build the list
|
||||
for (String hashtag : hashtags.keySet()) {
|
||||
toSort.add(new HashTagAndOccurrence(hashtag, hashtags.get(hashtag), weights.get(hashtag)));
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
logger.debug("****** retrieving hashtags for scope " + currentScope);
|
||||
Map<String, Integer> hashtags = store.getVREHashtagsWithOccurrenceFilteredByTime(currentScope, referenceTime.getTimeInMillis());
|
||||
// now we need to evaluate the weight for each element
|
||||
Map<String, Double> weights = evaluateWeight(hashtags, WINDOW_SIZE_IN_MONTHS, currentMonth, referenceTime, currentScope, null);
|
||||
for (String hashtag : hashtags.keySet()) {
|
||||
toSort.add(new HashTagAndOccurrence(hashtag, hashtags.get(hashtag), weights.get(hashtag)));
|
||||
}
|
||||
hashtagsAndOccurrences = store.getVREHashtagsWithOccurrenceFilteredByTime(currentScope, referenceTime.getTimeInMillis());
|
||||
}
|
||||
|
||||
logger.debug("Number of topics retrieved is " + toSort.size());
|
||||
// now we need to evaluate score for each element
|
||||
Map<String, Double> weights = evaluateWeights(hashtagsAndOccurrences, WINDOW_SIZE_IN_MONTHS, currentMonth, referenceTime, currentScope, hashtagsInVres);
|
||||
|
||||
Collections.sort(toSort); // sort for weight
|
||||
// at the end build the list
|
||||
for (String hashtag : hashtagsAndOccurrences.keySet()) {
|
||||
toSort.add(new HashTagOccAndWeight(hashtag, hashtagsAndOccurrences.get(hashtag), weights.get(hashtag)));
|
||||
}
|
||||
|
||||
for (HashTagAndOccurrence wrapper : toSort) {
|
||||
// sort for weights
|
||||
Collections.sort(toSort);
|
||||
|
||||
// build the list of hashtags to display
|
||||
for (HashTagOccAndWeight wrapper : toSort) {
|
||||
logger.debug("Entry is " + wrapper.toString() + " with weight " + wrapper.getWeight());
|
||||
|
||||
String hashtag = wrapper.getHashtag();
|
||||
|
||||
String href="\"?"+
|
||||
new String(Base64.encodeBase64(GCubeSocialNetworking.HASHTAG_OID.getBytes()))+"="+
|
||||
new String(Base64.encodeBase64(hashtag.getBytes()))+"\"";
|
||||
String hashtagLink = "<a class=\"topiclink\" href=" + href + ">"+hashtag+"</a>";
|
||||
hashtagsChart.add(hashtagLink);
|
||||
}
|
||||
|
||||
return new HashtagsWrapper(isInfrastructure, hashtagsChart);
|
||||
}
|
||||
catch (Exception e) {
|
||||
logger.error("Error while retrieving hashtags ", e);
|
||||
return null;
|
||||
}
|
||||
|
||||
long timestampEnd = System.currentTimeMillis() - timestampStart;
|
||||
logger.debug("Overall time to retrieve hastags is " + timestampEnd + "ms");
|
||||
|
||||
return new HashtagsWrapper(isInfrastructure, hashtagsChart);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Evaluate the weight for each element as w = 0.6 * s + 0.4 * f
|
||||
* where s is the score: a normalized value given by counter_i / counter_max
|
||||
* f is the freshness: evaluated taking into account the most recent feed containing that hashtag into the window w (that is,
|
||||
* the period taken into account)
|
||||
* f is the freshness: evaluated taking into account the most recent feed containing that hashtag into the window w (that is, the period taken into account)
|
||||
* @param hashtags
|
||||
* @param hashtagsInVres (present if vreid is null)
|
||||
* @param window size
|
||||
|
@ -240,7 +216,13 @@ public class TopicServiceImpl extends RemoteServiceServlet implements TopicServi
|
|||
* @param vreid (present if hashtagsInVres is null)
|
||||
* @return a Map of weight for each hashtag
|
||||
*/
|
||||
private Map<String, Double> evaluateWeight(Map<String, Integer> hashtags, int windowSize, int currentMonth, Calendar referenceTime, String vreId, Map<String, List<String>> hashtagsInVres) {
|
||||
private Map<String, Double> evaluateWeights(
|
||||
Map<String, Integer> hashtags,
|
||||
int windowSize,
|
||||
int currentMonth,
|
||||
Calendar referenceTime,
|
||||
String vreId,
|
||||
Map<String, List<String>> hashtagsInVres) {
|
||||
|
||||
Map<String, Double> weights = new HashMap<String, Double>();
|
||||
|
||||
|
@ -261,17 +243,17 @@ public class TopicServiceImpl extends RemoteServiceServlet implements TopicServi
|
|||
}
|
||||
|
||||
// create the weight for each entry as:
|
||||
// w = 0.6 * normalized_score + 0.4 * freshness
|
||||
// w = NORMALIZED_SCORE_FACTOR * normalized_score + FRESHNESS_FACTOR * freshness
|
||||
// freshness is evaluated as (window_size - latest_feed_for_hashtag_in_window_month)/window_size
|
||||
for(Entry<String, Integer> entry : hashtags.entrySet()){
|
||||
|
||||
// first part of the weight
|
||||
double weight = 0.6 * normalized.get(entry.getKey());
|
||||
double weight = NORMALIZED_SCORE_FACTOR * normalized.get(entry.getKey());
|
||||
|
||||
List<Feed> mostRecentFeedForHashtag = null;
|
||||
|
||||
// we are in the simplest case.. the hashtag belongs (or the request comes) from a single vre
|
||||
if(vreId != null){
|
||||
if(hashtagsInVres == null){
|
||||
|
||||
try{
|
||||
|
||||
|
@ -329,58 +311,24 @@ public class TopicServiceImpl extends RemoteServiceServlet implements TopicServi
|
|||
" because the last feed has month " + monstRecentFeedForHashTagTime.get(Calendar.MONTH));
|
||||
|
||||
// update the weight
|
||||
weight += 0.4 * freshness;
|
||||
weight += FRESHNESS_FACTOR * freshness;
|
||||
|
||||
// put it into the hashmap
|
||||
weights.put(entry.getKey(), weight);
|
||||
}
|
||||
|
||||
// print sorted
|
||||
Map<String, Double> scoredListSorted = sortByWeight(weights);
|
||||
for(Entry<String, Double> entry : scoredListSorted.entrySet()){
|
||||
|
||||
logger.debug("[hashtag=" + entry.getKey() + " , weight=" + entry.getValue() + "]");
|
||||
}
|
||||
|
||||
return weights;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort a map by its values
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
private static <K, V extends Comparable<? super V>> Map<K, V>
|
||||
sortByWeight( Map<K, V> map )
|
||||
{
|
||||
List<Map.Entry<K, V>> list =
|
||||
new LinkedList<Map.Entry<K, V>>( map.entrySet() );
|
||||
Collections.sort( list, new Comparator<Map.Entry<K, V>>()
|
||||
{
|
||||
public int compare( Map.Entry<K, V> o1, Map.Entry<K, V> o2 )
|
||||
{
|
||||
return (o2.getValue()).compareTo( o1.getValue() );
|
||||
}
|
||||
});
|
||||
|
||||
Map<K, V> result = new LinkedHashMap<K, V>();
|
||||
for (Map.Entry<K, V> entry : list)
|
||||
{
|
||||
result.put( entry.getKey(), entry.getValue() );
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the scope is the whole infrastructure.
|
||||
* @return <code>true</code> if it is, <code>false</code> otherwise.
|
||||
*/
|
||||
private boolean isInfrastructureScope() {
|
||||
private boolean isInfrastructureScope(String currentScope) {
|
||||
boolean toReturn = false;
|
||||
try {
|
||||
GroupManager manager = new LiferayGroupManager();
|
||||
long groupId = manager.getGroupIdFromInfrastructureScope(getASLSession().getScope());
|
||||
toReturn = !manager.isVRE(groupId);
|
||||
long groupId = gm.getGroupIdFromInfrastructureScope(currentScope);
|
||||
toReturn = !gm.isVRE(groupId);
|
||||
return toReturn;
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
|
|
@ -4,16 +4,16 @@ package org.gcube.portlets.user.topics.shared;
|
|||
* Bean class for hashtag and its occurrence number
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class HashTagAndOccurrence implements Comparable<HashTagAndOccurrence>{
|
||||
public class HashTagOccAndWeight implements Comparable<HashTagOccAndWeight>{
|
||||
private String hashtag;
|
||||
private Integer occurrence;
|
||||
private double weight;
|
||||
public HashTagAndOccurrence(String hashtag, Integer occurrence) {
|
||||
public HashTagOccAndWeight(String hashtag, Integer occurrence) {
|
||||
super();
|
||||
this.hashtag = hashtag;
|
||||
this.occurrence = occurrence;
|
||||
}
|
||||
public HashTagAndOccurrence(String hashtag, Integer occurrence, double weight) {
|
||||
public HashTagOccAndWeight(String hashtag, Integer occurrence, double weight) {
|
||||
super();
|
||||
this.hashtag = hashtag;
|
||||
this.occurrence = occurrence;
|
||||
|
@ -44,7 +44,7 @@ public class HashTagAndOccurrence implements Comparable<HashTagAndOccurrence>{
|
|||
+ occurrence + ", weight=" + weight + "]";
|
||||
}
|
||||
@Override
|
||||
public int compareTo(HashTagAndOccurrence o) {
|
||||
public int compareTo(HashTagOccAndWeight o) {
|
||||
return Double.compare(o.getWeight(), this.weight);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue