method2testcases stringlengths 118 6.63k |
|---|
### Question:
RunInstancesOptions extends BaseEC2RequestOptions { public RunInstancesOptions withUserData(byte[] unencodedData) { int length = checkNotNull(unencodedData, "unencodedData").length; checkArgument(length > 0, "userData cannot be empty"); checkArgument(length <= 16 * 1024, "userData cannot be larger than 16... |
### Question:
RunInstancesOptions extends BaseEC2RequestOptions { public RunInstancesOptions asType(String type) { formParameters.put("InstanceType", checkNotNull(type, "type")); return this; } RunInstancesOptions withKeyName(String keyName); RunInstancesOptions withSecurityGroups(String... securityGroups); RunInstanc... |
### Question:
RunInstancesOptions extends BaseEC2RequestOptions { public RunInstancesOptions withKernelId(String kernelId) { formParameters.put("KernelId", checkNotNull(kernelId, "kernelId")); return this; } RunInstancesOptions withKeyName(String keyName); RunInstancesOptions withSecurityGroups(String... securityGroup... |
### Question:
RunInstancesOptions extends BaseEC2RequestOptions { public RunInstancesOptions withRamdisk(String ramDiskId) { formParameters.put("RamdiskId", checkNotNull(ramDiskId, "ramDiskId")); return this; } RunInstancesOptions withKeyName(String keyName); RunInstancesOptions withSecurityGroups(String... securityGr... |
### Question:
DigitalOcean2TemplateOptions extends TemplateOptions implements Cloneable { public DigitalOcean2TemplateOptions sshKeyIds(Iterable<Integer> sshKeyIds) { this.sshKeyIds = ImmutableSet.copyOf(checkNotNull(sshKeyIds, "sshKeyIds cannot be null")); return this; } DigitalOcean2TemplateOptions privateNetworking... |
### Question:
RunInstancesOptions extends BaseEC2RequestOptions { public RunInstancesOptions withClientToken(String clientToken) { formParameters.put("ClientToken", checkNotNull(clientToken, "clientToken")); return this; } RunInstancesOptions withKeyName(String keyName); RunInstancesOptions withSecurityGroups(String..... |
### Question:
DigitalOcean2TemplateOptions extends TemplateOptions implements Cloneable { public DigitalOcean2TemplateOptions privateNetworking(boolean privateNetworking) { this.privateNetworking = privateNetworking; return this; } DigitalOcean2TemplateOptions privateNetworking(boolean privateNetworking); DigitalOcean... |
### Question:
Car { private Car() { if (servoCommand == null) { Environment env = Config.getEnvironment(); String servo_CommandConfig="servoblaster"; try { servo_CommandConfig = env.getString(Config.SERVO_COMMAND); } catch (Exception e) { ErrorHandler.getInstance().handle(e); } switch (servo_CommandConfig) { case "adaf... |
### Question:
Configuration { public Configuration(String graphFilePath, boolean readInis) { this.graphFilePath = graphFilePath; setGraph(TinkerGraph.open()); File graphFile = getGraphFile(); if (readInis) { fromIni(); write(); } else { if (graphFile.exists()) { read(graphFile); } } } Configuration(String graphFilePath... |
### Question:
Environment { private Environment() { runningOnRaspberryPi = isPi(); } private Environment(); Environment(String propFilePath); static String readFirstLine(File file); static String osRelease(); boolean isPi(); static Environment getInstance(); boolean runningOnRaspberryPi(); Properties getProperties();... |
### Question:
Environment { public List<String> getMyIpAddresses() { try { return Collections.list(NetworkInterface.getNetworkInterfaces()).stream() .map(iface -> Collections.list(iface.getInetAddresses())) .flatMap(Collection::stream).map(InetAddress::getHostAddress) .collect(Collectors.toList()); } catch (SocketExcep... |
### Question:
Environment { public static void mock() { Environment.from("../rc-drivecontrol/src/test/resources/dukes/dukes.ini"); } private Environment(); Environment(String propFilePath); static String readFirstLine(File file); static String osRelease(); boolean isPi(); static Environment getInstance(); boolean run... |
### Question:
ClusterStarter { public void deployVerticles(AbstractVerticle... verticles) throws Exception { DeploymentOptions deploymentOptions = this.getDeployMentOptions(true); if (vertx == null) { this.clusteredVertx(resultHandler -> { vertx = resultHandler.result(); if (vertx == null) { ErrorHandler.getInstance().... |
### Question:
ErrorHandler { public static String getStackTraceText(Throwable th) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); th.printStackTrace(pw); String exceptionText = sw.toString(); return exceptionText; } static String getStackTraceText(Throwable th); }### Answer:
@Test public... |
### Question:
ROI { public ROI(String name,double rx, double ry, double rw, double rh) { this.name=name; this.rx = rx; this.ry = ry; this.rw = rw; this.rh = rh; } ROI(String name,double rx, double ry, double rw, double rh); Rect roiRect(Size base); Mat region(Mat image); String toString(); }### Answer:
@Test public vo... |
### Question:
StraightLaneNavigator extends TinkerPopDatabase implements Navigator { public StraightLaneNavigator() { this(DEFAULT_TIME_WINDOW); } StraightLaneNavigator(); StraightLaneNavigator(int timeWindow); DukesVerticle getSender(); void setSender(DukesVerticle sender); Vertex addToGraph(LaneDetectionResult ldr);... |
### Question:
StraightLaneNavigator extends TinkerPopDatabase implements Navigator { @Override public JsonObject getNavigationInstruction(LaneDetectionResult ldr) { JsonObject message = null; if (this.emergencyStopActivated) return message; setTime(ldr); Vertex ldrVertex=addToGraph(ldr); boolean showDebug = true; analy... |
### Question:
WatchDog extends DukesVerticle { public WatchDog(Car car) throws Exception { super(Characters.FLASH); this.car = car; Environment env = Config.getEnvironment(); HEARTBEAT_INTERVAL_MS=env.getInteger(Config.WATCHDOG_HEARTBEAT_INTERVAL_MS); MAX_MISSED_BEATS=env.getInteger(Config.WATCHDOG_MAX_MISSED_BEATS); }... |
### Question:
Car { public Steering getSteering() { return steering; } private Car(); void configure(Engine engine, Steering steering, Led led); void setPowerOn(); void setPowerOff(); boolean powerIsOn(); void stop(); void turn(ServoPosition position); void drive(ServoPosition speed); Engine getEngine(); Steering getS... |
### Question:
Car { public Led getLed() { return led; } private Car(); void configure(Engine engine, Steering steering, Led led); void setPowerOn(); void setPowerOff(); boolean powerIsOn(); void stop(); void turn(ServoPosition position); void drive(ServoPosition speed); Engine getEngine(); Steering getSteering(); Led ... |
### Question:
ImageFetcher { public ImageFetcher(String source) { this.source = source; } ImageFetcher(String source); double getFps(); void setFps(double fps); int getFrameIndex(); boolean isStaticImage(); void setStaticImage(boolean staticImage); boolean open(); void close(); long waitForNextFrame(); Image fetch(); I... |
### Question:
ImageFetcher { public Observable<Image> toObservable() { Observable<Image> observable = Observable .create(new ObservableOnSubscribe<Image>() { @Override public void subscribe(ObservableEmitter<Image> observableEmitter) throws Exception { hasNext=true; while (hasNext && !isClosed()) { final Image image = ... |
### Question:
RemoteCar extends DukesVerticle { public RemoteCar() { super(Characters.GENERAL_LEE); } RemoteCar(); @Override void start(); void parseArguments(String[] args); void mainInstance(String... args); static void main(String... args); @Option(name = "-ph", aliases = { "--publichost" }, usage = "hostname") Stri... |
### Question:
RemoteCar extends DukesVerticle { public static void main(String... args) { RemoteCar remoteCar = new RemoteCar(); remoteCar.mainInstance(args); } RemoteCar(); @Override void start(); void parseArguments(String[] args); void mainInstance(String... args); static void main(String... args); @Option(name = "-... |
### Question:
PerspectiveShift implements UnaryOperator<Mat> { @Override public Mat apply(Mat srcImage) { Mat destImage = new Mat(); Imgproc.warpPerspective(srcImage, destImage, perspectiveTransform, srcImage.size()); return destImage; } PerspectiveShift(Polygon imagePolygon, Polygon worldPolygon); @Override Mat apply(... |
### Question:
RSAKeyPair { public static RSAKeyPair fromExponents(byte[] e, byte[] p, byte[] q) { final BigInteger eInt = BigIntegers.fromUnsignedByteArray(e), pInt = BigIntegers.fromUnsignedByteArray(p), qInt = BigIntegers.fromUnsignedByteArray(q), nInt = pInt.multiply(qInt), mInt = pInt.subtract(BigInteger.ONE).multi... |
### Question:
RSAOAEPPublicKey extends AbstractPublicKey { @NonNull @Override public Map<String, Object> toHash() throws IllegalStateException { if (state == null) { throw new IllegalStateException(); } else { return Collections.unmodifiableMap(new HashMap<String, Object>() {{ put("n", BigIntegers.asUnsignedByteArray(s... |
### Question:
ItemCache { final void cleanUp() { Instant now = Instant.now(); records.values().forEach(r->r.checkExpiration(now)); } ItemCache(Duration maxAge); void shutdown(); @Nullable Approvable get(HashId itemId); @Nullable ItemResult getResult(HashId itemId); void put(Approvable item, ItemResult result); void upd... |
### Question:
ConsoleInterceptor { public static String copyOut(Block block) throws Exception { final ByteArrayOutputStream bos = new ByteArrayOutputStream(); final PrintStream printStream = new PrintStream(bos, true); PrintStream oldStream = System.out; PrintStream oldErr = System.err; System.setOut(printStream); Syst... |
### Question:
Binder extends HashMap<String, Object> implements Serializable { public boolean isFrozen() { return frozen; } Binder(Map copyFrom); Binder(); Binder(Object... keyValuePairs); static Binder fromKeysValues(Object... args); boolean isFrozen(); Double getDouble(String key); String getStringOrThrow(String ke... |
### Question:
Binder extends HashMap<String, Object> implements Serializable { @Deprecated public int getInt(String key) { return getIntOrThrow(key); } Binder(Map copyFrom); Binder(); Binder(Object... keyValuePairs); static Binder fromKeysValues(Object... args); boolean isFrozen(); Double getDouble(String key); Strin... |
### Question:
AbstractKey implements Bindable, KeyMatcher { public byte[] fingerprint() { throw new RuntimeException("this key does not support fingerprints"); } byte[] encrypt(byte[] plain); byte[] decrypt(byte[] plain); byte[] sign(InputStream input, HashType hashType); byte[] sign(byte[] input, HashType hashType); ... |
### Question:
Average { public double average() { if (n < 1) throw new IllegalStateException("too few samples"); return sum / n; } synchronized long update(double value); double average(); double stdev2(); double stdev(); long length(); double correctedStdev(); @Override String toString(); double variation(); }### An... |
### Question:
RunnableWithDynamicPeriod implements Runnable { public void restart() { waitsCount = 0; if (future != null) future.cancel(true); run(); } RunnableWithDynamicPeriod(Runnable lambda, List<Integer> periods, ScheduledExecutorService es); @Override void run(); void cancel(boolean b); void restart(); }### Answ... |
### Question:
RunnableWithDynamicPeriod implements Runnable { public void cancel(boolean b) { synchronized (cancelled) { cancelled.set(true); } } RunnableWithDynamicPeriod(Runnable lambda, List<Integer> periods, ScheduledExecutorService es); @Override void run(); void cancel(boolean b); void restart(); }### Answer:
@T... |
### Question:
BufferedLogger implements AutoCloseable { public List<Entry> slice(long id, int maxEntries) { List<Entry> copy = getCopy(); Entry start = new Entry(id); int fromIndex = Collections.binarySearch(copy, start); if (maxEntries > 0) fromIndex++; if (fromIndex < 0) fromIndex = 0; int toIndex = fromIndex + maxEn... |
### Question:
BufferedLogger implements AutoCloseable { public @NonNull Entry log(String message) { Entry entry = new Entry(message); queue.add(entry); return entry; } BufferedLogger(int maxEntries); void e(String s); void flush(); boolean flush(long millis); PrintStream printTo(PrintStream ps, boolean printTimestamp);... |
### Question:
Do { public static String snakeToCamelCase(String snakeString) { StringBuilder b = new StringBuilder(); for(String s: snakeString.split("_") ) { if(s.length() > 0 ) { b.append(Character.toUpperCase(s.charAt(0))); b.append(s.substring(1, s.length()).toLowerCase()); } } return b.toString(); } static byte[]... |
### Question:
Do { public static <T> T sample(Collection source) { int size = source.size(); if (size <= 0) return null; int i = Do.randomInt(size); if (source instanceof List && source instanceof RandomAccess) return (T) ((List) source).get(i); else return (T) source.toArray()[i]; } static byte[] read(String fileName... |
### Question:
Do { public static int randomInt(int max) { return getRng().nextInt(max); } static byte[] read(String fileName); static byte[] read(InputStream inputStream); static String readToString(InputStream inputStream); static A checkSame(A oldValue, B newValue, Runnable onChanged); static T sample(Collection sou... |
### Question:
DeferredResult { public DeferredResult success(Handler handler) { synchronized (successHandlers) { successHandlers.add(handler); } if (done && success) invokeSuccess(); return this; } DeferredResult success(Handler handler); DeferredResult failure(Handler handler); DeferredResult done(Handler handler); v... |
### Question:
AsyncEvent { public void fire(T result) { synchronized (mutex) { this.result = result; fired = true; for (Consumer<T> consumer : consumers) pool.execute(() -> consumer.accept(result)); consumers.clear(); mutex.notifyAll(); } } AsyncEvent<T> addConsumer(Consumer<T> consumer); void fire(T result); boolean ... |
### Question:
AbstractKey implements Bindable, KeyMatcher { public boolean matchAnonymousId(@NonNull byte[] packedId) throws IOException { assert (packedId.length == 64); HMAC hmac = new HMAC(fingerprint()); hmac.update(packedId, 0, 32); byte[] idDigest = Arrays.copyOfRange(packedId, 32, 64); return Arrays.equals(hmac.... |
### Question:
BossConnector extends BasicConnector implements Connector { @Override public void send(Map<String, Object> data) throws IOException { if( closed.get() ) throw new IOException("connection closed"); bossOut.write(data); } BossConnector(InputStream in, OutputStream out); @Override void send(Map<String, Objec... |
### Question:
JsonConnector extends BasicConnector implements Connector { @Override public void send(Map<String, Object> data) throws IOException { if (closed.get()) throw new IOException("connection closed"); out.write((toJsonString(data) + "\n").getBytes()); } JsonConnector(InputStream in, OutputStream out); @Overrid... |
### Question:
BiMapper { public @NonNull <T> T serialize(Object x, BiSerializer serializer) { if (x instanceof String || x instanceof Number || x instanceof Boolean || x == null) return (T) x; Class<?> klass = x.getClass(); if (klass.isArray() && !(klass.getComponentType() == byte.class)) { x = Arrays.asList((Object[])... |
### Question:
Informer { public void post(Object event) { int result; int processedCount = invokeCollection(weakInvocations, event); processedCount += invokeCollection(strongInvocations, event); if (processedCount == 0 && !(event instanceof LostEvent)) { post(new LostEvent(event)); } } Informer(); Informer(ExceptionLi... |
### Question:
Informer { public void postAfter(final Object event, final long millis) { new Thread(new Runnable() { @Override public void run() { try { Thread.currentThread().sleep(millis); post(event); } catch (InterruptedException e) { } } }).start(); } Informer(); Informer(ExceptionListener listener); void post(Obj... |
### Question:
Informer { public void registerWeak(Object subscriber) { register(subscriber, true); } Informer(); Informer(ExceptionListener listener); void post(Object event); void postAfter(final Object event, final long millis); void registerWeak(Object subscriber); void registerStrong(Object subscriber); boolean un... |
### Question:
Informer { public void registerStrong(Object subscriber) { register(subscriber, false); } Informer(); Informer(ExceptionListener listener); void post(Object event); void postAfter(final Object event, final long millis); void registerWeak(Object subscriber); void registerStrong(Object subscriber); boolean... |
### Question:
Informer { public boolean unregister(Object subscriber) { boolean found = (weakInvocations.remove(subscriber) != null); found = found || (strongInvocations.remove(subscriber) != null); return found; } Informer(); Informer(ExceptionListener listener); void post(Object event); void postAfter(final Object e... |
### Question:
Safe58 { public static String encode(byte[] input) { if (input.length == 0) { return ""; } input = copyOfRange(input, 0, input.length); int zeroCount = 0; while (zeroCount < input.length && input[zeroCount] == 0) { ++zeroCount; } byte[] temp = new byte[input.length * 2]; int j = temp.length; int startAt =... |
### Question:
KeyAddress implements KeyMatcher { @Override public boolean isMatchingKey(AbstractKey key) { KeyAddress other = new KeyAddress(key, 0, _isLong); if (other.keyMask != keyMask) return false; if (!Arrays.equals(keyDigest, other.keyDigest)) return false; return true; } KeyAddress(); KeyAddress(AbstractKey ke... |
### Question:
Safe58 { public static byte[] decode(String input) { return decode(input,false); } static String encode(byte[] input); static byte[] decode(String input); static byte[] decode(String input, boolean strict); }### Answer:
@Test public void decode() { byte[] ok = Safe58.decode("Helloworld"); assertArrayEqu... |
### Question:
CLIMain { private static void exportPublicKeys(Contract contract, String roleName, String fileName, boolean base64) throws IOException { if (fileName == null) { if (testMode && testRootPath != null) { fileName = testRootPath + "Universa_" + roleName + "_public_key"; } else { fileName = "Universa_" + roleN... |
### Question:
CLIMain { public static Contract downloadContract(String url) { report("downloading from " + url); return null; } static void main(String[] args); static PrivateKey getPrivateKey(); static BasicHttpClientSession getSession(int nodeNumber); static void breakSession(int nodeNumber); static void clearSessio... |
### Question:
KeyInfo { public AbstractKey unpackKey(byte[] data) throws EncryptionError { switch (algorythm) { case RSAPublic: return new PublicKey(data, this); case RSAPrivate: return new PrivateKey(data, this); case AES256: return new SymmetricKey(data, this); } throw new EncryptionError("can't unpack key: " + this)... |
### Question:
CLIMain { public static Parcel revokeContract(Contract contract, Contract u, int amount, Set<PrivateKey> uKeys, boolean withTestPayment, PrivateKey... key) throws IOException { report("keys num: " + key.length); Contract tc = ContractsService.createRevocation(contract, key); Parcel parcel = prepareForRegi... |
### Question:
Syntex1 extends Digest { @Override public int getLength() { return 36; } @Override int getLength(); }### Answer:
@Test public void testBasics() throws Exception { Syntex1 s = new Syntex1(); s.update("Hello world"); byte[] d1 = s.digest(); assertEquals(36, s.getLength()); byte[] d2 = new Syntex1().digest... |
### Question:
PrivateKey extends AbstractKey { public byte[] pack() { @NonNull final Map<String, Object> params = privateKey.toHash(); return Boss.dumpToArray(new Object[]{ TYPE_PRIVATE, params.get("e"), params.get("p"), params.get("q") }); } PrivateKey(byte[] packedBinaryKey, KeyInfo info); PrivateKey(byte[] packedBi... |
### Question:
RSAOAEPPrivateKey extends AbstractPrivateKey { @Override public byte[] decrypt(byte[] ciphertext) throws EncryptionError { if (state == null) { throw new IllegalStateException(); } else { try { return state.decryptor.processBlock(ciphertext, 0, ciphertext.length); } catch (InvalidCipherTextException e) { ... |
### Question:
PBKDF2 { public static byte[] derive(Class<? extends Digest> hash, String password, byte[] salt, int c, int dkLen) { return new PBKDF2(hash, password, salt, c, dkLen).compute(); } private PBKDF2(Class<? extends Digest> hashClass,
String password,
byte[] salt,
... |
### Question:
KeyRing implements Capsule.KeySource, Bindable { @Override @NonNull public Collection<AbstractKey> findKey(KeyInfo keyInfo) { final ArrayList<AbstractKey> result = new ArrayList<>(); for( AbstractKey k: keys) { final KeyInfo ki = k.info(); if( ki.matchType(keyInfo) ) { if( ki.matchTag(keyInfo) ) result.ad... |
### Question:
SymmetricKey extends AbstractKey implements Serializable, Hashable { public byte[] etaEncrypt(byte[] data) throws EncryptionError { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { final EtaEncryptingStream s = etaEncryptStream(bos); s.write(data); s.end(); return bos.toByteArray(); } catch ... |
### Question:
SymmetricKey extends AbstractKey implements Serializable, Hashable { public static byte[] xor(byte[] src, int value) { byte[] result = new byte[src.length]; for (int i = 0; i < src.length; i++) result[i] = (byte) ((src[i] ^ value) & 0xFF); return result; } SymmetricKey(); SymmetricKey(byte[] key); Symme... |
### Question:
Decimal extends Number implements Comparable<Number> { public Decimal[] divideAndRemainder(BigDecimal divisor) { BigDecimal[] result = value.divideAndRemainder(divisor); return new Decimal[]{new Decimal(result[0]), new Decimal(result[1])}; } Decimal(); Decimal(String stringValue); Decimal(long longValue... |
### Question:
Decimal extends Number implements Comparable<Number> { public Decimal ulp() { return new Decimal(value.ulp()); } Decimal(); Decimal(String stringValue); Decimal(long longValue); Decimal(BigDecimal bigDecimalValue); @Override int intValue(); @Override long longValue(); @Override float floatValue(); @Ove... |
### Question:
SimpleRole extends Role { public SimpleRole cloneAs(String name,Contract contract) { SimpleRole r = new SimpleRole(name,contract); keyRecords.values().forEach(kr -> r.addKeyRecord(kr)); anonymousIds.forEach(aid -> r.anonymousIds.add(aid)); keyAddresses.forEach(keyAddr -> r.keyAddresses.add(keyAddr)); retu... |
### Question:
RSAOAEPPrivateKey extends AbstractPrivateKey { @Override public AbstractPublicKey getPublicKey() throws IllegalStateException { if (state == null) { throw new IllegalStateException(); } else { return state.publicKey; } } RSAOAEPPrivateKey(); RSAOAEPPrivateKey(byte[] e, byte[] p, byte[] q, HashType oaepH... |
### Question:
SimpleRole extends Role { @Override @Nullable KeyAddress getSimpleAddress(boolean ignoreRefs) { if(!ignoreRefs && (requiredAnyReferences.size() > 0 || requiredAllReferences.size() > 0)) return null; if(anonymousIds.size() == 0 && keyRecords.size() + keyAddresses.size() == 1) { if(keyRecords.size() == 1) {... |
### Question:
RoleLink extends Role { @Override public <T extends Role> T resolve() { return resolve(true); } private RoleLink(); RoleLink(String name,Contract contract); @Deprecated RoleLink(String name); RoleLink(String name, Contract contract, String roleName); @Deprecated RoleLink(String name, String roleName)... |
### Question:
RoleLink extends Role { @Override public Binder serialize(BiSerializer s) { return super.serialize(s).putAll( "name", getName(), "target_name", roleName ); } private RoleLink(); RoleLink(String name,Contract contract); @Deprecated RoleLink(String name); RoleLink(String name, Contract contract, String ... |
### Question:
RoleLink extends Role { @Override @Nullable KeyAddress getSimpleAddress(boolean ignoreRefs) { Role r = resolve(ignoreRefs); if (r != null && r != this) return r.getSimpleAddress(ignoreRefs); return null; } private RoleLink(); RoleLink(String name,Contract contract); @Deprecated RoleLink(String name); ... |
### Question:
ListRole extends Role { public void setMode(Mode newMode) { if (newMode != Mode.QUORUM) this.mode = newMode; else throw new IllegalArgumentException("Only ANY or ALL of the modes should be set."); } ListRole(); ListRole(String name,Contract contract); @Deprecated ListRole(String name); ListRole(String ... |
### Question:
ListRole extends Role { @Override @Nullable KeyAddress getSimpleAddress(boolean ignoreRefs) { if(!ignoreRefs && (requiredAnyReferences.size() > 0 || requiredAllReferences.size() > 0)) return null; if(roles.size() == 1 && (mode != Mode.QUORUM || quorumSize == 1)) { return roles.iterator().next().getSimpleA... |
### Question:
TransactionPack implements BiSerializable { public static TransactionPack unpack(byte[] packOrContractBytes, boolean allowNonTransactions) throws IOException { Object x = Boss.load(packOrContractBytes); if (x instanceof TransactionPack) { return (TransactionPack) x; } if (!allowNonTransactions) throw new ... |
### Question:
TransactionPack implements BiSerializable { public void setContract(Contract c) { if (contract != null) throw new IllegalArgumentException("the contract is already added"); contract = c; packedBinary = null; extractAllSubItemsAndReferenced(c); c.setTransactionPack(this); for (PrivateKey key : c.getKeysToS... |
### Question:
RSAOAEPPrivateKey extends AbstractPrivateKey { @Override public byte[] sign(InputStream input, HashType hashType, @Nullable byte[] salt) throws IllegalStateException, IOException { if (state == null) { throw new IllegalStateException(); } else { final Digest primaryDigest = hashType.makeDigest(); final PS... |
### Question:
SplitJoinPermission extends Permission { @Override public void deserialize(Binder data, BiDeserializer deserializer) { super.deserialize(data, deserializer); initFromParams(); } SplitJoinPermission(Role role, Binder params); private SplitJoinPermission(); @Override void deserialize(Binder data, BiDeseria... |
### Question:
RSAOAEPPrivateKey extends AbstractPrivateKey { @NonNull @Override public Map<String, Object> toHash() throws IllegalStateException { if (state == null) { throw new IllegalStateException(); } else { return Collections.unmodifiableMap(new HashMap<String, Object>() {{ put("e", BigIntegers.asUnsignedByteArray... |
### Question:
Permission implements BiSerializable, Comparable<Permission> { public void setId(@NonNull String id) { if( this.id != null && !this.id.equals(id) ) throw new IllegalStateException("permission id is already set"); this.id = id; } protected Permission(); protected Permission(String name, Role role); prote... |
### Question:
ExtendedSignature { static public byte[] sign(PrivateKey key, byte[] data) { return sign(key, data, true); } Bytes getKeyId(); ZonedDateTime getCreatedAt(); PublicKey getPublicKey(); static byte[] sign(PrivateKey key, byte[] data); static byte[] sign(PrivateKey key, byte[] data, boolean savePublicKey); s... |
### Question:
UnikeyFactory { @Nullable static RSAOAEPPrivateKey rsaOaepPKFromUnikey(@NonNull byte[] bytes) { assert bytes != null; try { final ArrayList unpackedFromBoss = Boss.load(bytes); assert ((Integer) unpackedFromBoss.get(0)) == 0; final byte[] e = ((Bytes) unpackedFromBoss.get(1)).toArray(), p = ((Bytes) unpac... |
### Question:
ExtendedSignature { public static PublicKey extractPublicKey(byte[] signature) { Binder src = Boss.unpack(signature); PublicKey publicKey = null; byte[] exts = src.getBinaryOrThrow("exts"); Binder b = Boss.unpack(exts); try { byte[] publicKeyBytes = b.getBinaryOrThrow("pub_key"); publicKey = new PublicKey... |
### Question:
UnikeyFactory { @NonNull static byte[] toUnikey(@NonNull RSAOAEPPrivateKey privateKey) { assert privateKey != null; return privateKey.pack(); } @Nullable static PrivateKey fromUnikey(@NonNull byte[] bytes); @NonNull static byte[] toUnikey(@NonNull PrivateKey privateKey); }### Answer:
@Test public void t... |
### Question:
RSAOAEPDigestFactory { public static Digest cloneDigest(Digest digest) { try { return digest.getClass().newInstance(); } catch (InstantiationException | IllegalAccessException exc) { exc.printStackTrace(); return digest; } } @Nullable static Digest getDigestByName(String digestName); static Digest cloneD... |
### Question:
RSAOAEPPublicKey extends AbstractPublicKey { @NonNull @Override public byte[] encrypt(byte[] plaintext) throws EncryptionError, IllegalStateException { if (state == null) { throw new IllegalStateException(); } else { try { return state.encryptor.processBlock(plaintext, 0, plaintext.length); } catch (Inval... |
### Question:
StandaloneBean { public String returnMessage() { return message; } String returnMessage(); }### Answer:
@Test public void testReturnMessage() throws Exception { logger.info("Testing standalone.ejb.StandaloneBean.returnMessage()"); StandaloneBean instance = (StandaloneBean) ctx.lookup("java:global/classe... |
### Question:
ProductTypeRefinerDocProc extends DocumentProcessor { @Override public Progress process(Processing processing) { for (DocumentOperation op : processing.getDocumentOperations()) { if (op instanceof DocumentPut) { DocumentPut put = (DocumentPut) op; Document document = put.getDocument(); if (document.getDat... |
### Question:
SubqueriesSearcher extends Searcher { public Result search(Query query, Execution execution) { Result result = execution.search(query); execution.fill(result); for (Hit hit : result.hits().asList()) { if (hit.isMeta()) continue; simplifySubqueriesFor("target", hit); hit.removeField("summaryfeatures"); } r... |
### Question:
ProductTypeTokenizerDocProc extends DocumentProcessor { @Override public Progress process(Processing processing) { for (DocumentOperation op : processing.getDocumentOperations()) { if (op instanceof DocumentPut) { DocumentPut put = (DocumentPut) op; Document document = put.getDocument(); if (document.getD... |
### Question:
MetalSearcher extends Searcher { @Override public Result search(Query query, Execution execution) { QueryTree tree = query.getModel().getQueryTree(); if (isMetalQuery(tree)) { OrItem orItem = new OrItem(); orItem.addItem(tree.getRoot()); orItem.addItem(new WordItem("metal", "album")); tree.setRoot(orItem)... |
### Question:
EquivSearcher extends Searcher { @Override public Result search(Query query, Execution execution) { query.trace("Before equivize:" + query.toDetailString(), false, 6); QueryTree tree = query.getModel().getQueryTree(); Item rootItem = tree.getRoot(); rootItem = equivize(rootItem); tree.setRoot(rootItem); q... |
### Question:
ExampleProcessor extends Processor { @SuppressWarnings("unchecked") @Override public Response process(Request request, Execution execution) { request.properties().set("foo", "bar"); Response response = execution.process(request); response.data().add(new StringData(request, message)); return response; } @I... |
### Question:
Out implements SubTraversal<Element, Vertex> { @SuppressWarnings("PMD.ShortMethodName") public static Out of(org.apache.tinkerpop.gremlin.object.structure.Element element) { return of(org.apache.tinkerpop.gremlin.object.reflect.Label.of(element)); } @SuppressWarnings("PMD.ShortMethodName") static Out of(... |
### Question:
Classes { public static boolean isSet(Object object) { return object != null && isSet(object.getClass()); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); static boolean isEdge(Object object); static boolean isEd... |
### Question:
Classes { public static boolean isCollection(Object object) { return object != null && isCollection(object.getClass()); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); static boolean isEdge(Object object); stati... |
### Question:
Classes { public static boolean isFunctional(Class<?> type) { return is(type, Function.class); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); static boolean isEdge(Object object); static boolean isEdge(Class<?>... |
### Question:
Classes { @SuppressWarnings({"PMD.ShortMethodName"}) public static boolean is(Class<?> type, Object that) { return that != null && is(type, that.getClass()); } private Classes(); static boolean isElement(Class<?> type); static boolean isVertex(Object object); static boolean isVertex(Class<?> type); stati... |
### Question:
Label { @SuppressWarnings("PMD.ShortMethodName") public static String of(Element element) { return of(element.getClass()); } private Label(); @SuppressWarnings("PMD.ShortMethodName") static String of(Element element); @SuppressWarnings("PMD.ShortMethodName") static String of(Class<? extends Element> elem... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.