congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
PrimitiveValue.toString
Code IndexAdd Tabnine to your IDE (free)

How to use
toString
method
in
uk.co.real_logic.sbe.PrimitiveValue

Best Java code snippets using uk.co.real_logic.sbe.PrimitiveValue.toString (Showing top 20 results out of 315)

origin: real-logic/simple-binary-encoding

/**
 * Return double value for this PrimitiveValue.
 *
 * @return value expressed as a double
 * @throws IllegalStateException if not a double value representation
 */
public double doubleValue()
{
  if (representation != Representation.DOUBLE)
  {
    throw new IllegalStateException(
      "Not a double representation: representation=" + representation + " value=" + toString());
  }
  return doubleValue;
}
origin: real-logic/simple-binary-encoding

/**
 * Return byte array value for this PrimitiveValue.
 *
 * @return value expressed as a byte array
 * @throws IllegalStateException if not a byte array value representation
 */
public byte[] byteArrayValue()
{
  if (representation != Representation.BYTE_ARRAY)
  {
    throw new IllegalStateException(
      "Not a byte[] representation: representation=" + representation + " value=" + toString());
  }
  return byteArrayValue;
}
origin: real-logic/simple-binary-encoding

/**
 * Return long value for this PrimitiveValue
 *
 * @return value expressed as a long
 * @throws IllegalStateException if not a long value representation
 */
public long longValue()
{
  if (representation != Representation.LONG)
  {
    throw new IllegalStateException(
      "Not a long representation: representation=" + representation + " value=" + toString());
  }
  return longValue;
}
origin: real-logic/simple-binary-encoding

private CharSequence generateEnumValues(final List<Token> tokens)
{
  final StringBuilder sb = new StringBuilder();
  for (final Token token : tokens)
  {
    final Encoding encoding = token.encoding();
    final CharSequence constVal = generateLiteral(encoding.primitiveType(), encoding.constValue().toString());
    sb.append(generateTypeJavadoc(INDENT, token));
    sb.append(INDENT).append(token.name()).append('(').append(constVal).append("),\n\n");
  }
  final Token token = tokens.get(0);
  final Encoding encoding = token.encoding();
  final CharSequence nullVal = generateLiteral(
    encoding.primitiveType(), encoding.applicableNullValue().toString());
  if (shouldDecodeUnknownEnumValues)
  {
    sb.append(INDENT).append("/**\n");
    sb.append(INDENT).append(" * To be used to represent a not known value from a later version.\n");
    sb.append(INDENT).append(" */\n");
    sb.append(INDENT).append("SBE_UNKNOWN").append('(').append(nullVal).append("),\n\n");
  }
  sb.append(INDENT).append("/**\n");
  sb.append(INDENT).append(" * To be used to represent not present or null.\n");
  sb.append(INDENT).append(" */\n");
  sb.append(INDENT).append("NULL_VAL").append('(').append(nullVal).append(");\n\n");
  return sb;
}
origin: real-logic/simple-binary-encoding

private CharSequence generateChoices(final List<Token> tokens)
{
  final StringBuilder sb = new StringBuilder();
  for (final Token token : tokens)
  {
    if (token.signal() == Signal.CHOICE)
    {
      final String choiceName = toUpperFirstChar(token.applicableTypeName());
      final String choiceBitPosition = token.encoding().constValue().toString();
      final int choiceValue = (int)Math.pow(2, Integer.parseInt(choiceBitPosition));
      sb.append(String.format(INDENT + INDENT + "%s = %s,\n", choiceName, choiceValue));
    }
  }
  return sb;
}
origin: real-logic/simple-binary-encoding

return generateLiteral(primitiveType, encoding.applicableNullValue().toString());
origin: real-logic/simple-binary-encoding

return generateLiteral(primitiveType, encoding.applicableMinValue().toString());
origin: real-logic/simple-binary-encoding

private CharSequence generateFieldNotPresentCondition(
  final int sinceVersion, final Encoding encoding, final String indent)
{
  if (0 == sinceVersion)
  {
    return "";
  }
  return String.format(
    indent + "        if (m_actingVersion < %1$d)\n" +
    indent + "        {\n" +
    indent + "            return %2$s;\n" +
    indent + "        }\n\n",
    sinceVersion,
    generateLiteral(encoding.primitiveType(), encoding.applicableNullValue().toString()));
}
origin: real-logic/simple-binary-encoding

private CharSequence generateFieldNotPresentCondition(
  final boolean inComposite, final int sinceVersion, final Encoding encoding, final String indent)
{
  if (inComposite || 0 == sinceVersion)
  {
    return "";
  }
  return String.format(
    indent + "        if (parentMessage.actingVersion < %d)\n" +
    indent + "        {\n" +
    indent + "            return %s;\n" +
    indent + "        }\n\n",
    sinceVersion,
    generateLiteral(encoding.primitiveType(), encoding.applicableNullValue().toString()));
}
origin: real-logic/simple-binary-encoding

private CharSequence generateEnumValues(final List<Token> tokens, final Token encodingToken)
{
  final StringBuilder sb = new StringBuilder();
  final Encoding encoding = encodingToken.encoding();
  sb.append(
    "    enum Value \n" +
    "    {\n");
  for (final Token token : tokens)
  {
    final CharSequence constVal = generateLiteral(
      token.encoding().primitiveType(), token.encoding().constValue().toString());
    sb.append("        ").append(token.name()).append(" = ").append(constVal).append(",\n");
  }
  sb.append(String.format(
    "        NULL_VALUE = %1$s",
    generateLiteral(encoding.primitiveType(), encoding.applicableNullValue().toString())));
  sb.append("\n    };\n\n");
  return sb;
}
origin: real-logic/simple-binary-encoding

private CharSequence generateFieldNotPresentCondition(
  final int sinceVersion,
  final Encoding encoding,
  final String indent)
{
  if (0 == sinceVersion)
  {
    return "";
  }
  final String literal;
  if (sinceVersion > 0)
  {
    literal = generateLiteral(encoding.primitiveType(), encoding.applicableNullValue().toString());
  }
  else
  {
    literal = "(byte)0";
  }
  return String.format(
    indent + INDENT + INDENT + "if (_actingVersion < %1$d) return %2$s;\n\n",
    sinceVersion,
    literal);
}
origin: real-logic/simple-binary-encoding

private static void generateEnum(final List<Token> enumTokens, final OutputManager outputManager)
  throws IOException
{
  final String originalEnumName = enumTokens.get(0).applicableTypeName();
  final String enumRustName = formatTypeName(originalEnumName);
  try (Writer writer = outputManager.createOutput("Enum " + enumRustName))
  {
    final List<Token> messageBody = getMessageBody(enumTokens);
    if (messageBody.isEmpty())
    {
      throw new IllegalArgumentException("No valid values provided for enum " + originalEnumName);
    }
    writer.append("#[derive(Clone,Copy,Debug,PartialEq,Eq,PartialOrd,Ord,Hash)]").append("\n");
    final String rustReprTypeName = rustTypeName(messageBody.get(0).encoding().primitiveType());
    writer.append(format("#[repr(%s)]",
      rustReprTypeName)).append("\n");
    writer.append("pub enum ").append(enumRustName).append(" {\n");
    for (final Token token : messageBody)
    {
      final Encoding encoding = token.encoding();
      final String literal = generateRustLiteral(encoding.primitiveType(), encoding.constValue().toString());
      indent(writer, 1).append(token.name())
        .append(" = ")
        .append(literal)
        .append(",\n");
    }
    writer.append("}\n");
  }
}
origin: real-logic/simple-binary-encoding

  token.encoding().constValue().toString(),
  token.name()));
"%s" +
"    }\n",
generateLiteral(primitiveType, tokens.get(0).encoding().applicableNullValue().toString()),
handleUnknownLogic));
origin: real-logic/simple-binary-encoding

private static CharSequence generateEnumLookupMethod(final List<Token> tokens, final Token encodingToken)
{
  final String enumName = formatClassName(encodingToken.applicableTypeName());
  final StringBuilder sb = new StringBuilder();
  sb.append(String.format(
    "    static %1$s::Value get(const %2$s value)\n" +
    "    {\n" +
    "        switch (value)\n" +
    "        {\n",
    enumName,
    cppTypeName(tokens.get(0).encoding().primitiveType())));
  for (final Token token : tokens)
  {
    sb.append(String.format(
      "            case %1$s: return %2$s;\n",
      token.encoding().constValue().toString(),
      token.name()));
  }
  sb.append(String.format(
    "            case %1$s: return NULL_VALUE;\n" +
    "        }\n\n" +
    "        throw std::runtime_error(\"unknown value for enum %2$s [E103]\");\n" +
    "    }\n",
    encodingToken.encoding().applicableNullValue().toString(),
    enumName));
  return sb;
}
origin: real-logic/simple-binary-encoding

if (fieldToken.isConstantEncoding())
  final String refValue = fieldToken.encoding().constValue().toString();
  final int indexOfDot = refValue.indexOf('.');
  value = -1 == indexOfDot ? refValue : refValue.substring(indexOfDot + 1);
origin: real-logic/simple-binary-encoding

private CharSequence generatePrimitiveFieldMetaData(
  final String propertyName,
  final Token token,
  final String indent)
{
  final PrimitiveType primitiveType = token.encoding().primitiveType();
  final String typeName = cSharpTypeName(primitiveType);
  return String.format(
    "\n" +
    indent + "public const %1$s %2$sNullValue = %3$s;\n" +
    indent + "public const %1$s %2$sMinValue = %4$s;\n" +
    indent + "public const %1$s %2$sMaxValue = %5$s;\n",
    typeName,
    toUpperFirstChar(propertyName),
    generateLiteral(primitiveType, token.encoding().applicableNullValue().toString()),
    generateLiteral(primitiveType, token.encoding().applicableMinValue().toString()),
    generateLiteral(primitiveType, token.encoding().applicableMaxValue().toString()));
}
origin: real-logic/simple-binary-encoding

return constOrNotPresentValue.toString();
origin: real-logic/simple-binary-encoding

return generateLiteral(primitiveType, encoding.applicableNullValue().toString());
origin: real-logic/simple-binary-encoding

private CharSequence generateChoiceDecoders(final List<Token> tokens)
{
  return concatTokens(
    tokens,
    Signal.CHOICE,
    (token) ->
    {
      final String choiceName = formatPropertyName(token.name());
      final Encoding encoding = token.encoding();
      final String choiceBitIndex = encoding.constValue().toString();
      final String byteOrderStr = byteOrderString(encoding);
      final PrimitiveType primitiveType = encoding.primitiveType();
      final String argType = bitsetArgType(primitiveType);
      return String.format("\n" +
        "%1$s" +
        "    public boolean %2$s()\n" +
        "    {\n" +
        "        return %3$s;\n" +
        "    }\n\n" +
        "    public static boolean %2$s(final %4$s value)\n" +
        "    {\n" +
        "        return %5$s;\n" +
        "    }\n",
        generateOptionDecodeJavadoc(INDENT, token),
        choiceName,
        generateChoiceGet(primitiveType, choiceBitIndex, byteOrderStr),
        argType,
        generateStaticChoiceGet(primitiveType, choiceBitIndex));
    });
}
origin: real-logic/simple-binary-encoding

final String choiceBitIndex = encoding.constValue().toString();
final String byteOrderStr = byteOrderString(encoding);
final PrimitiveType primitiveType = encoding.primitiveType();
uk.co.real_logic.sbePrimitiveValuetoString

Javadoc

Return String representation of this object

Popular methods of PrimitiveValue

  • longValue
    Return long value for this PrimitiveValue
  • parse
    Parse constant value string and set representation based on type
  • size
    Return encodedLength for this PrimitiveValue for serialization purposes.
  • <init>
    Construct and fill in value as a byte array.
  • byteArrayValue
    Return byte array value for this PrimitiveValue given a particular type
  • doubleValue
    Return double value for this PrimitiveValue.
  • representation
    Get the Representation of the value.
  • characterEncoding
    The character encoding of the byte array representation.

Popular in Java

  • Reading from database using SQL prepared statement
  • runOnUiThread (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • startActivity (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • JButton (javax.swing)
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now