예제 #1
0
 @Benchmark
 long OmmFind(int reps) {
   long dummy = 0;
   for (int i = 0; i < reps; ++i) {
     final OMMFieldList fieldlist = (OMMFieldList) msg.getPayload();
     dummy |=
         fieldlist.find(biddef.getFieldId()).getData(biddef.getOMMType()).toString().hashCode();
     dummy |=
         fieldlist.find(askdef.getFieldId()).getData(askdef.getOMMType()).toString().hashCode();
   }
   return dummy;
 }
예제 #2
0
 @Benchmark
 long OmmIterate(int reps) {
   long dummy = 0;
   String bid, ask;
   for (int i = 0; i < reps; ++i) {
     bid = ask = null;
     for (Iterator<?> it = ((OMMIterable) msg.getPayload()).iterator(); it.hasNext(); ) {
       final OMMFieldEntry field = (OMMFieldEntry) it.next();
       if (biddef.getFieldId() == field.getFieldId())
         bid = field.getData(biddef.getOMMType()).toString();
       else if (askdef.getFieldId() == field.getFieldId())
         ask = field.getData(askdef.getOMMType()).toString();
       if (null != bid && null != ask) break;
     }
     dummy |= bid.hashCode();
     dummy |= ask.hashCode();
   }
   return dummy;
 }
예제 #3
0
 private static final void parseEntry(OMMEntry entry, PrintStream ps, int tabLevel) {
   try {
     switch (entry.getType()) {
       case OMMTypes.FIELD_ENTRY:
         {
           OMMFieldEntry fe = (OMMFieldEntry) entry;
           if (CURRENT_DICTIONARY != null) {
             FidDef fiddef = CURRENT_DICTIONARY.getFidDef(fe.getFieldId());
             if (fiddef != null) {
               dumpFieldEntryHeader(fe, fiddef, ps, tabLevel);
               OMMData data = null;
               if (fe.getDataType() == OMMTypes.UNKNOWN) data = fe.getData(fiddef.getOMMType());
               else
                 // defined data already has type
                 data = fe.getData();
               if (data.getType() == OMMTypes.ENUM) {
                 ps.print(
                     CURRENT_DICTIONARY.expandedValueFor(
                         fiddef.getFieldId(), ((OMMEnum) data).getValue()));
                 ps.print(" (");
                 ps.print(data);
                 ps.println(")");
               } else parseData(data, ps, tabLevel);
             } else {
               ps.println(
                   "Received field id: " + fe.getFieldId() + " - Not defined in dictionary");
             }
           } else {
             dumpFieldEntryHeader(fe, null, ps, tabLevel);
             if (fe.getDataType() == OMMTypes.UNKNOWN) {
               OMMDataBuffer data = (OMMDataBuffer) fe.getData();
               ps.println(HexDump.toHexString(data.getBytes(), false));
             } else
             // defined data already has type
             {
               OMMData data = fe.getData();
               parseData(data, ps, tabLevel);
             }
           }
           ps.flush();
         }
         break;
       case OMMTypes.ELEMENT_ENTRY:
         dumpElementEntryHeader((OMMElementEntry) entry, ps, tabLevel);
         parseData(entry.getData(), ps, tabLevel);
         break;
       case OMMTypes.MAP_ENTRY:
         dumpMapEntryHeader((OMMMapEntry) entry, ps, tabLevel);
         if ((((OMMMapEntry) entry).getAction() != OMMMapEntry.Action.DELETE)
             && entry.getDataType() != OMMTypes.NO_DATA) parseData(entry.getData(), ps, tabLevel);
         break;
       case OMMTypes.VECTOR_ENTRY:
         dumpVectorEntryHeader((OMMVectorEntry) entry, ps, tabLevel);
         if ((((OMMVectorEntry) entry).getAction() != OMMVectorEntry.Action.DELETE)
             && (((OMMVectorEntry) entry).getAction() != OMMVectorEntry.Action.CLEAR))
           parseData(entry.getData(), ps, tabLevel);
         break;
       case OMMTypes.FILTER_ENTRY:
         dumpFilterEntryHeader((OMMFilterEntry) entry, ps, tabLevel);
         if (((OMMFilterEntry) entry).getAction() != OMMFilterEntry.Action.CLEAR)
           parseData(entry.getData(), ps, tabLevel);
         break;
       default:
         dumpEntryHeader(entry, ps, tabLevel);
         parseData(entry.getData(), ps, tabLevel);
         break;
     }
   } catch (OMMException e) {
     ps.println("ERROR Invalid data: " + e.getMessage());
   }
 }