Codota Logo
net.sergeych.tools
Code IndexAdd Codota to your IDE (free)

How to use net.sergeych.tools

Best Java code snippets using net.sergeych.tools (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: UniversaBlockchain/universa

static public DeferredResult inParallel(final TaskWithoutResult task) {
  return Do.inParallel(() -> {
    task.perform();
    return null;
  });
}
origin: UniversaBlockchain/universa

/**
 * waits until the operation is finished and return it's result on success, or throws an error on failure.
 *
 * @throws Error or {@link Failure} if operation fails
 */
public <T> T waitSuccess() throws Error, InterruptedException {
  join();
  if (isSuccess())
    return (T) result;
  if (result instanceof Exception)
    throw new Error((Exception) result);
  throw new Failure(result);
}
origin: UniversaBlockchain/universa

public <T> List<T> getList(String key, List<T> defaultValue) {
  Object x = get(key);
  if (x == null)
    return defaultValue;
  return Do.list(x);
}
origin: UniversaBlockchain/universa

public Binder getOrCreateBinder(String key) {
  checkNotFrozen();
  HashMap<String, Object> x = (HashMap<String, Object>) get(key);
  Binder b = null;
  if (x == null) {
    b = new Binder();
    put(key, b);
  } else
    b = (x instanceof Binder) ? (Binder) x : new Binder(x);
  return b;
}
origin: UniversaBlockchain/universa

public Binder getBinder(String key, Binder defaultValue) {
  HashMap<String, Object> x = (HashMap<String, Object>) get(key);
  Binder b = null;
  if (x instanceof Binder) {
    b = (Binder) x;
  } else if (x != null) {
    b = new Binder(x);
    if (frozen)
      b.freeze();
  }
  return b == null ? defaultValue : b;
}
origin: UniversaBlockchain/universa

Binder connect() {
  if (serverNonce == null)
    serverNonce = Do.randomBytes(48);
  return Binder.fromKeysValues(
      "server_nonce", serverNonce,
      "session_id", ""+sessionId
  );
}
origin: UniversaBlockchain/universa

public Binder getData() {
  if( data == null )
    data = new Binder();
  return data;
}
origin: UniversaBlockchain/universa

private Binder onPing(Binder params) {
  Binder result = Binder.fromKeysValues("ping", "pong");
  result.putAll(params);
  return result;
}
origin: UniversaBlockchain/universa

@Override
public Binder serialize(Object object, BiSerializer serializer) {
  ItemInfo ii = (ItemInfo)object;
  return Binder.fromKeysValues(
    "item_result", ii.itemResult,
    "item_id", ii.itemId,
    "errors", ii.errors
  );
}
origin: UniversaBlockchain/universa

public void setExtendedType(String extendedType) {
  this.extendedType = extendedType;
  if(definition != null)
    definition.set("extended_type", extendedType);
}
public String getExtendedType() {
origin: UniversaBlockchain/universa

/**
 * For unit-tests. Blocks until the node is initialized.
 *
 * @throws InterruptedException for unexpected interrupt
 */
public void waitReady() throws InterruptedException {
  eventReady.await();
}
origin: UniversaBlockchain/universa

  /**
   * @return coefficient of variation, e.g. σ/µ (where µ is the average value)
   */
  public double variation() {
    return stdev()/average();
  }
}
origin: UniversaBlockchain/universa

/**
 * Get collected report as JSON string
 *
 * @return
 */
public synchronized String reportJson() {
  return JsonTool.toJsonString(report());
}
origin: UniversaBlockchain/universa

public ResyncProcessor(HashId itemId, Consumer<ResyncingItem> onComplete) {
  this.itemId = itemId;
  if (onComplete != null)
    finishEvent.addConsumer(onComplete);
}
origin: UniversaBlockchain/universa

/**
 * Get several bytes from the queue (size can be any positive). Blocks until specified number of
 * bytes are written.
 */
public byte[] get(int size) {
  byte[] result = new byte[size];
  for (int i = 0; i < size; i++) {
    result[i] = (byte)get();
  }
  return result;
}
origin: UniversaBlockchain/universa

/**
 * Put all the bytes to the buffer. Blocks until the operation is completed.
 *
 * @param collection
 */
public void put(Iterable<T> collection) {
  for (T x : collection) {
    put(x);
  }
}
origin: UniversaBlockchain/universa

/**
 * Outputs newline on the console only (does nothing in quiet more).
 */
public void newLine() {
  console("\n");
}
origin: UniversaBlockchain/universa

/**
 * Creates {@link Binder} that will be returned to client after smart contract have been approved.
 * @return
 */
public Binder getExtraResultForApprove() {
  return new Binder();
}
origin: UniversaBlockchain/universa

@Override
public Binder serialize(BiSerializer s) {
  return Binder.fromKeysValues(
      "anonymousId", anonymousId
  );
}
origin: UniversaBlockchain/universa

  public Binder getData() {
    if (data == null)
      data = new Binder();
    return data;
  }
}
net.sergeych.tools

Most used classes

  • Do
    Created by sergeych on 15/02/16.
  • Binder
    Created by sergeych on 02/12/16.
  • AsyncEvent
    Asymchronous consumer-based event. Uses cached pool to invoke consumers. All the methods are thread-
  • Average
    Memory and calculation-effectiver way to calculate average and standard deviation over arbitrary num
  • BufferedLogger
    Navigable fast asynchronous buffered logger, thread safe. It's main features are: - it does not bloc
  • FilenameTool,
  • Reporter,
  • StopWatch,
  • ConsoleInterceptor,
  • JsonTool,
  • RunnableWithDynamicPeriod,
  • StreamConnector,
  • ByteRingBuffer,
  • DeferredResult$Error,
  • DeferredResult,
  • BufferedLogger$Entry,
  • BufferedLoggerTest,
  • ConsoleInterceptor$Block,
  • DeferredResult$Failure
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now