public double getActionTimeSpan(Topic topic, Consts.ActionType type, Consts.TopicType topicType) {
		HashMap<Long, List<Date>> actionCounter = new HashMap<Long, List<Date>>();
		for (int i = 0; i < topic.getBehaviors().size(); i++) {
			Long myId;
			if (topicType == Consts.TopicType.BRAND) {
				myId = topic.getBehaviors().get(i).getUid();
			} else {
				myId = topic.getBehaviors().get(i).getBrandID();
			}
			
			if (topic.getBehaviors().get(i).getType() == type) {
				if (actionCounter.containsKey(myId)) {
					actionCounter.get(myId).add(topic.getBehaviors().get(i).getVisitDatetime());
				} else {
					List<Date> dateList = new ArrayList<Date>();
					dateList.add(topic.getBehaviors().get(i).getVisitDatetime());
					actionCounter.put(myId, dateList);
				}
			}
		}
		
		double timeSpan = 0.0;
		Set<Long> set = actionCounter.keySet();
		Iterator<Long> it = set.iterator();
		int counter = 0;
		while (it.hasNext()) {
			counter++;
			double timeSpanSum = 0;
			int timeSpanNumber = 0;
			Long myId = (Long)it.next();
			List<Date> list = actionCounter.get(myId);
			Collections.sort(list);
			for (int i = 1; i < list.size(); i++) {
				timeSpanNumber++;
				timeSpanSum += (list.get(i).getTime() - list.get(i - 1).getTime()) / (24 * 60 * 60 * 1000);
			}
			
			if (timeSpanNumber != 0) {
				timeSpan += timeSpanSum / timeSpanNumber;				
			}
		}
		
		if (counter != 0) { 
			timeSpan /= counter;
		}
		return timeSpan;
	}