/** * Interns an element into this instance. * * @param prototype {@code non-null;} the prototype to intern * @return {@code non-null;} the interned reference */ public synchronized ProtoIdItem intern(Prototype prototype) { if (prototype == null) { throw new NullPointerException("prototype == null"); } throwIfPrepared(); ProtoIdItem result = protoIds.get(prototype); if (result == null) { result = new ProtoIdItem(prototype); protoIds.put(prototype, result); } return result; }
/** * Gets the index of the given prototype, which must have * been added to this instance. * * @param prototype {@code non-null;} the prototype to look up * @return {@code >= 0;} the reference's index */ public int indexOf(Prototype prototype) { if (prototype == null) { throw new NullPointerException("prototype == null"); } throwIfNotPrepared(); ProtoIdItem item = protoIds.get(prototype); if (item == null) { throw new IllegalArgumentException("not found"); } return item.getIndex(); }
/** {@inheritDoc} */ @Override protected void orderItems() { int idx = 0; for (Object i : items()) { ((ProtoIdItem) i).setIndex(idx); idx++; } } }
/** * Creates the short-form of the given prototype. * * @param prototype {@code non-null;} the prototype * @return {@code non-null;} the short form */ private static CstString makeShortForm(Prototype prototype) { StdTypeList parameters = prototype.getParameterTypes(); int size = parameters.size(); StringBuilder sb = new StringBuilder(size + 1); sb.append(shortFormCharFor(prototype.getReturnType())); for (int i = 0; i < size; i++) { sb.append(shortFormCharFor(parameters.getType(i))); } return new CstString(sb.toString()); }
/** * Constructs an instance. * * @param prototype {@code non-null;} the constant for the prototype */ public ProtoIdItem(Prototype prototype) { if (prototype == null) { throw new NullPointerException("prototype == null"); } this.prototype = prototype; this.shortForm = makeShortForm(prototype); StdTypeList parameters = prototype.getParameterTypes(); this.parameterTypes = (parameters.size() == 0) ? null : new TypeListItem(parameters); }
out.annotate(0, indexString() + ' ' + sb.toString()); out.annotate(4, " shorty_idx: " + Hex.u4(shortyIdx) + " // " + shortForm.toQuoted());
/** * Creates the short-form of the given prototype. * * @param prototype {@code non-null;} the prototype * @return {@code non-null;} the short form */ private static CstString makeShortForm(Prototype prototype) { StdTypeList parameters = prototype.getParameterTypes(); int size = parameters.size(); StringBuilder sb = new StringBuilder(size + 1); sb.append(shortFormCharFor(prototype.getReturnType())); for (int i = 0; i < size; i++) { sb.append(shortFormCharFor(parameters.getType(i))); } return new CstString(sb.toString()); }
/** * Constructs an instance. * * @param prototype {@code non-null;} the constant for the prototype */ public ProtoIdItem(Prototype prototype) { if (prototype == null) { throw new NullPointerException("prototype == null"); } this.prototype = prototype; this.shortForm = makeShortForm(prototype); StdTypeList parameters = prototype.getParameterTypes(); this.parameterTypes = (parameters.size() == 0) ? null : new TypeListItem(parameters); }
out.annotate(0, indexString() + ' ' + sb.toString()); out.annotate(4, " shorty_idx: " + Hex.u4(shortyIdx) + " // " + shortForm.toQuoted());
/** {@inheritDoc} */ @Override protected void orderItems() { int idx = 0; for (Object i : items()) { ((ProtoIdItem) i).setIndex(idx); idx++; } } }
/** * Creates the short-form of the given prototype. * * @param prototype {@code non-null;} the prototype * @return {@code non-null;} the short form */ private static CstString makeShortForm(Prototype prototype) { StdTypeList parameters = prototype.getParameterTypes(); int size = parameters.size(); StringBuilder sb = new StringBuilder(size + 1); sb.append(shortFormCharFor(prototype.getReturnType())); for (int i = 0; i < size; i++) { sb.append(shortFormCharFor(parameters.getType(i))); } return new CstString(sb.toString()); }
/** * Constructs an instance. * * @param prototype {@code non-null;} the constant for the prototype */ public ProtoIdItem(Prototype prototype) { if (prototype == null) { throw new NullPointerException("prototype == null"); } this.prototype = prototype; this.shortForm = makeShortForm(prototype); StdTypeList parameters = prototype.getParameterTypes(); this.parameterTypes = (parameters.size() == 0) ? null : new TypeListItem(parameters); }
/** * Interns an element into this instance. * * @param prototype {@code non-null;} the prototype to intern * @return {@code non-null;} the interned reference */ public synchronized ProtoIdItem intern(Prototype prototype) { if (prototype == null) { throw new NullPointerException("prototype == null"); } throwIfPrepared(); ProtoIdItem result = protoIds.get(prototype); if (result == null) { result = new ProtoIdItem(prototype); protoIds.put(prototype, result); } return result; }
/** * Gets the index of the given prototype, which must have * been added to this instance. * * @param prototype {@code non-null;} the prototype to look up * @return {@code >= 0;} the reference's index */ public int indexOf(Prototype prototype) { if (prototype == null) { throw new NullPointerException("prototype == null"); } throwIfNotPrepared(); ProtoIdItem item = protoIds.get(prototype); if (item == null) { throw new IllegalArgumentException("not found"); } return item.getIndex(); }
out.annotate(0, indexString() + ' ' + sb.toString()); out.annotate(4, " shorty_idx: " + Hex.u4(shortyIdx) + " // " + shortForm.toQuoted());
/** {@inheritDoc} */ @Override protected void orderItems() { int idx = 0; for (Object i : items()) { ((ProtoIdItem) i).setIndex(idx); idx++; } } }
/** * Creates the short-form of the given prototype. * * @param prototype {@code non-null;} the prototype * @return {@code non-null;} the short form */ private static CstString makeShortForm(Prototype prototype) { StdTypeList parameters = prototype.getParameterTypes(); int size = parameters.size(); StringBuilder sb = new StringBuilder(size + 1); sb.append(shortFormCharFor(prototype.getReturnType())); for (int i = 0; i < size; i++) { sb.append(shortFormCharFor(parameters.getType(i))); } return new CstString(sb.toString()); }
/** * Constructs an instance. * * @param prototype {@code non-null;} the constant for the prototype */ public ProtoIdItem(Prototype prototype) { if (prototype == null) { throw new NullPointerException("prototype == null"); } this.prototype = prototype; this.shortForm = makeShortForm(prototype); StdTypeList parameters = prototype.getParameterTypes(); this.parameterTypes = (parameters.size() == 0) ? null : new TypeListItem(parameters); }
/** * Interns an element into this instance. * * @param prototype {@code non-null;} the prototype to intern * @return {@code non-null;} the interned reference */ public synchronized ProtoIdItem intern(Prototype prototype) { if (prototype == null) { throw new NullPointerException("prototype == null"); } throwIfPrepared(); ProtoIdItem result = protoIds.get(prototype); if (result == null) { result = new ProtoIdItem(prototype); protoIds.put(prototype, result); } return result; }
/** * Gets the index of the given prototype, which must have * been added to this instance. * * @param prototype {@code non-null;} the prototype to look up * @return {@code >= 0;} the reference's index */ public int indexOf(Prototype prototype) { if (prototype == null) { throw new NullPointerException("prototype == null"); } throwIfNotPrepared(); ProtoIdItem item = protoIds.get(prototype); if (item == null) { throw new IllegalArgumentException("not found"); } return item.getIndex(); }