Prints the semantic shifts for all the words in the {@link
#wordToTemporalSemantics} map, using the {code dateString} for naming the
output file with the date of the last semantic partition.

@param dateString the date of the last semantic partition.
330331
private void printSemanticShifts(String dateString) throws IOException {

        LOGGER.fine("Writing semantic shifts for " + dateString);

        // Once we have all the vectors for each word in each sspace,
        // calculate how much the vector has changed.
        for (Map.Entry<String,SortedMap<Long,double[]>> e : 
                 wordToTemporalSemantics.entrySet()) {
            
            String word = e.getKey();
            SortedMap<Long,double[]> timeStampToSemantics = e.getValue();
            Iterator<Map.Entry<Long,double[]>> it = 
                timeStampToSemantics.entrySet().iterator();
            
            PrintWriter pw = new PrintWriter(new File(outputDir,
                word + "." + dateString + ".temporal-changes.txt"));            
            
            // Write the header so we can keep track of what all the columns
            // mean
            pw.println("#time\ttime-delay\tcosineSim\tcosineAngle\tEuclidean"+
                       "\tchange-in-magnitde\tmagnitde\tprev-magnitude");
            Map.Entry<Long,double[]> last = null;
            while (it.hasNext()) {
                Map.Entry<Long,double[]> cur = it.next();
                if (last != null) {
                    long timeDelay = cur.getKey() - last.getKey();
                    double euclideanDist = Similarity.
                            euclideanDistance(cur.getValue(), last.getValue());
                    double cosineSim = Similarity.
                        cosineSimilarity(cur.getValue(), last.getValue());
                    double cosineAngle = Math.acos(cosineSim);
                    
                    double oldMag = getMagnitude(last.getValue());
                    double newMag = getMagnitude(cur.getValue());
                    
                    pw.println(cur.getKey() + "\t" + timeDelay + "\t" + 
                               cosineSim + "\t" + cosineAngle + "\t" + 
                               euclideanDist + "\t" + (newMag - oldMag) + "\t" 
                               + newMag + "\t" + oldMag);
                }
                last = cur;
            }
            pw.close();
        }
    }
147663
function (formatString, mapping) {
    var len = formatString.length;
    var i = 0;
    var startIndex = -1;
    var lastChar = null;
    var currentChar = "";
    var resultString = "";

    for (; i < len; i++) {
      currentChar = formatString.charAt(i);

      if (lastChar === null || lastChar !== currentChar) {
        // change detected
        resultString = _appendMappedString(formatString, mapping, startIndex, i, resultString);

        startIndex = i;
      }

      lastChar = currentChar;
    }

    return _appendMappedString(formatString, mapping, startIndex, i, resultString);
  }
1090178
@Override
	public void writeString(String str) throws IOException {
		byte[] bytes = Utf8.getBytesFor(str);
		writeBytes(bytes, 0, bytes.length);
	}
1146944
public void setDate(Date date)
    {
        String dateString = "";
        if (date != null)
    		dateString = dateFormat.format(date);
        jTextField2.setText(dateString);
        jCalendarButton1.setTargetDate(date);
    }
74942
public static void writeStringOpt(DataOutput out, String str) 
      throws IOException{
    if (str == null) {
      WritableUtils.writeVInt(out, NULL_STRING_LENGTH);
      return;
    }
    final int len = str.length();
    TempArrays ta = UTF8.getArrays(len);
    byte[] rawBytes = ta.byteArray;
    char[] charArray = ta.charArray;
    str.getChars(0, len, charArray, 0);

    boolean ascii = true;
    for (int i = 0; i < len; i++) {
      if (charArray[i] > UTF8.MAX_ASCII_CODE) {
        ascii = false;
        break;
      }
      rawBytes[i] = (byte) charArray[i];
    }
    if(ascii) {
      WritableUtils.writeVInt(out, len);
      out.write(rawBytes, 0, len);
    } else {
      writeString(out, str);
    }
  }
746255
public static Calendar parse(String dateString) throws ValueFormatException
   {
      try
      {
         return ISO8601.parseEx(dateString);
      }
      catch (ParseException e)
      {
         throw new ValueFormatException("Can not parse date from [" + dateString + "]", e);
      }
      catch (NumberFormatException e)
      {
         throw new ValueFormatException("Can not parse date from [" + dateString + "]", e);
      }
   }
544819
public void setDateFormatString(String dateFormatString) {
		if (ignoreDatePatternChange) {
			return;
		}

		try {
			dateFormatter.applyPattern(dateFormatString);
		} catch (RuntimeException e) {
			dateFormatter = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.MEDIUM);
			dateFormatter.setLenient(false);
		}
		this.datePattern = dateFormatter.toPattern();
		setToolTipText(this.datePattern);
		setDate(date, false);
	}
110462
public static Date stringTodate(String dateString, String format) throws ParseException {
        final DateFormat dateFormat = new SimpleDateFormat(format, Locale.US);
        return dateFormat.parse(dateString);
    }
1176914
public static String changeDate(String date, String dateOffset, String dateFormat, TestContext context) {
        return new ChangeDateFunction().execute(Arrays.asList(date, dateOffset, dateFormat), context);
    }
516003
public static DateTime parseDate(String dateString) {
		dateString = normalize(dateString);
		return parse(dateString, DatePattern.NORM_DATE_FORMAT);
	}
704142
public static String formatDateString(String dateString, String format1, String format2) {
        if (dateString == null) {
            return null;
        }
        java.text.SimpleDateFormat beforeFormat = new java.text.SimpleDateFormat(format1);
        java.text.SimpleDateFormat endFormat = new java.text.SimpleDateFormat(format2);
        try {
            return endFormat.format(beforeFormat.parse(dateString));
        } catch (ParseException e) {
            e.printStackTrace();
            return dateString;
        }
    }
677696
function _dateString() {
  var now=new Date();
  return util.format("%d_%d_%d:%d_%d_%d", 
                     now.getFullYear(),now.getMonth()+1,now.getDate(), 
                     now.getHours(), now.getMinutes(), now.getSeconds());
}
284686
public static String getDateString(String format, Date date) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date);
    }
285340
void dateFormat(DateFormat format, String... attributes) {
        convertWith(new DateToStringConverter(format), attributes);
        convertWith(new StringToSqlDateConverter(format), attributes);
    }
615291
public static LocalDate localDateFromString(String dateString) {
        try {
            return LocalDate.parse(dateString, DATE_FORMATTER);
        } catch (Exception e) {
            return null;
        }
    }
607342
public static void writeString(DataOutput out, String s) throws IOException {
    if (s != null) {
      Text text = new Text(s);
      byte[] buffer = text.getBytes();
      int len = text.getLength();
      writeVInt(out, len);
      out.write(buffer, 0, len);
    } else {
      writeVInt(out, -1);
    }
  }
827279
public static Date stringToDate(String dateString) {
        if (!"".equals(dateString) && dateString != null) {
            // ISO_DATE_FORMAT = "yyyyMMdd";
            if (dateString.trim().length() == 8) {
                return stringToDate(dateString, ISO_DATE_FORMAT, LENIENT_DATE);
            } else if (dateString.trim().length() == 10) {
                // ISO_EXPANDED_DATE_FORMAT = "yyyy-MM-dd";
                return stringToDate(dateString, ISO_EXPANDED_DATE_FORMAT,
                        LENIENT_DATE);
            } else if (dateString.trim().length() == 19) {
                // DATETIME_PATTERN = "yyyy-MM-dd hh:mm:ss";
                return stringToDate(dateString, DATETIME_PATTERN, LENIENT_DATE);
            } else if (dateString.trim().length() == 11) {
                // CHINESE_EXPANDED_DATE_FORMAT = "yyyy年MM月dd日";
                return stringToDate(dateString, CHINESE_EXPANDED_DATE_FORMAT,
                        LENIENT_DATE);
            }
        }
        return null;
    }