Class LongStringEncoder

java.lang.Object
com.semedy.reasoner.symboltable.encoder.LongStringEncoder

public class LongStringEncoder extends Object
Util class for encoding long strings,
A long string gets an additional prefix
consisting of a hash code
Author:
angele
  • Constructor Details

    • LongStringEncoder

      public LongStringEncoder()
  • Method Details

    • encode

      public static String encode(String s, int maxLength)
      Encode a string, i.e. if string is longer than maxLength
      add hashcode at the beginning
      Parameters:
      s - , string
      maxLength - , if s is longer, encode it
      Returns:
    • encodeWithAphostrophe

      public static String encodeWithAphostrophe(String s, int maxLength)
      Encode a string, i.e. if string is longer than maxLength
      add hashcode at the beginning. Add apostrophes
      Parameters:
      s - , string
      maxLength - , if s is longer, encode it
      Returns:
    • decode

      public static String decode(String s, int maxLength)
      Decode string, i.e. throw prefix away
      Parameters:
      s - , string
      maxLength - , stirng is encoded only if longer
      Returns: