code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public @NotNull ListAssert contains(@Nullable Object o, @NotNull Index index) { checkNotNull(index); isNotNull().isNotEmpty(); int indexValue = index.value(); int listSize = actualGroupSize(); if (indexValue < 0 || indexValue >= listSize) { failIndexOutOfBounds(indexValue); } Object actualElement = actual.get(indexValue); if (!areEqual(actualElement, o)) { failElementNotFound(o, actualElement, indexValue); } return this; } }
public class class_name { public @NotNull ListAssert contains(@Nullable Object o, @NotNull Index index) { checkNotNull(index); isNotNull().isNotEmpty(); int indexValue = index.value(); int listSize = actualGroupSize(); if (indexValue < 0 || indexValue >= listSize) { failIndexOutOfBounds(indexValue); // depends on control dependency: [if], data = [none] } Object actualElement = actual.get(indexValue); if (!areEqual(actualElement, o)) { failElementNotFound(o, actualElement, indexValue); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { @SuppressWarnings("rawtypes") public Map hgetAll(Object key) { Jedis jedis = getJedis(); try { Map<byte[], byte[]> data = jedis.hgetAll(keyToBytes(key)); Map<Object, Object> result = new HashMap<Object, Object>(); for (Entry<byte[], byte[]> e : data.entrySet()) result.put(fieldFromBytes(e.getKey()), valueFromBytes(e.getValue())); return result; } finally {close(jedis);} } }
public class class_name { @SuppressWarnings("rawtypes") public Map hgetAll(Object key) { Jedis jedis = getJedis(); try { Map<byte[], byte[]> data = jedis.hgetAll(keyToBytes(key)); Map<Object, Object> result = new HashMap<Object, Object>(); for (Entry<byte[], byte[]> e : data.entrySet()) result.put(fieldFromBytes(e.getKey()), valueFromBytes(e.getValue())); return result; // depends on control dependency: [try], data = [none] } finally {close(jedis);} } }
public class class_name { @Requires("pathName != null") @Ensures("result != null") public static String getRelativeName(String pathName) { int lastSep = pathName.lastIndexOf('.'); if (lastSep == -1) { return pathName; } else { return pathName.substring(lastSep + 1); } } }
public class class_name { @Requires("pathName != null") @Ensures("result != null") public static String getRelativeName(String pathName) { int lastSep = pathName.lastIndexOf('.'); if (lastSep == -1) { return pathName; // depends on control dependency: [if], data = [none] } else { return pathName.substring(lastSep + 1); // depends on control dependency: [if], data = [(lastSep] } } }
public class class_name { public Result<V,E> get(K key) { CacheEntry entry = map.get(key); if(entry == null) { return null; } else { return entry.getResult(); } } }
public class class_name { public Result<V,E> get(K key) { CacheEntry entry = map.get(key); if(entry == null) { return null; // depends on control dependency: [if], data = [none] } else { return entry.getResult(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void tableSwitch(final int[] keys, final TableSwitchGenerator generator) { float density; if (keys.length == 0) { density = 0; } else { density = (float) keys.length / (keys[keys.length - 1] - keys[0] + 1); } tableSwitch(keys, generator, density >= 0.5f); } }
public class class_name { public void tableSwitch(final int[] keys, final TableSwitchGenerator generator) { float density; if (keys.length == 0) { density = 0; // depends on control dependency: [if], data = [none] } else { density = (float) keys.length / (keys[keys.length - 1] - keys[0] + 1); // depends on control dependency: [if], data = [none] } tableSwitch(keys, generator, density >= 0.5f); } }
public class class_name { static SearchBuilder fromJson(String json) { try { return JsonSerializer.fromString(json, SearchBuilderLegacy.class).builder; } catch (IOException e) { throw new IndexException(e, "Unparseable JSON search: {}", json); } } }
public class class_name { static SearchBuilder fromJson(String json) { try { return JsonSerializer.fromString(json, SearchBuilderLegacy.class).builder; // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IndexException(e, "Unparseable JSON search: {}", json); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Observable<ServiceResponse<Page<PublicIPAddressInner>>> listVirtualMachineScaleSetPublicIPAddressesNextWithServiceResponseAsync(final String nextPageLink) { return listVirtualMachineScaleSetPublicIPAddressesNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<PublicIPAddressInner>>, Observable<ServiceResponse<Page<PublicIPAddressInner>>>>() { @Override public Observable<ServiceResponse<Page<PublicIPAddressInner>>> call(ServiceResponse<Page<PublicIPAddressInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listVirtualMachineScaleSetPublicIPAddressesNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<PublicIPAddressInner>>> listVirtualMachineScaleSetPublicIPAddressesNextWithServiceResponseAsync(final String nextPageLink) { return listVirtualMachineScaleSetPublicIPAddressesNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<PublicIPAddressInner>>, Observable<ServiceResponse<Page<PublicIPAddressInner>>>>() { @Override public Observable<ServiceResponse<Page<PublicIPAddressInner>>> call(ServiceResponse<Page<PublicIPAddressInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listVirtualMachineScaleSetPublicIPAddressesNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public static ListenableFuture<SnapshotCompletionInterest.SnapshotCompletionEvent> watchSnapshot(final String nonce) { final SettableFuture<SnapshotCompletionInterest.SnapshotCompletionEvent> result = SettableFuture.create(); SnapshotCompletionInterest interest = new SnapshotCompletionInterest() { @Override public CountDownLatch snapshotCompleted(SnapshotCompletionEvent event) { if (event.nonce.equals(nonce) && event.didSucceed) { VoltDB.instance().getSnapshotCompletionMonitor().removeInterest(this); result.set(event); } return null; } }; VoltDB.instance().getSnapshotCompletionMonitor().addInterest(interest); return result; } }
public class class_name { public static ListenableFuture<SnapshotCompletionInterest.SnapshotCompletionEvent> watchSnapshot(final String nonce) { final SettableFuture<SnapshotCompletionInterest.SnapshotCompletionEvent> result = SettableFuture.create(); SnapshotCompletionInterest interest = new SnapshotCompletionInterest() { @Override public CountDownLatch snapshotCompleted(SnapshotCompletionEvent event) { if (event.nonce.equals(nonce) && event.didSucceed) { VoltDB.instance().getSnapshotCompletionMonitor().removeInterest(this); // depends on control dependency: [if], data = [none] result.set(event); // depends on control dependency: [if], data = [none] } return null; } }; VoltDB.instance().getSnapshotCompletionMonitor().addInterest(interest); return result; } }
public class class_name { public void execute(final Collection<T> targets, final ForceExecuteCallback<T> callback) throws SQLException { Collection<SQLException> exceptions = new LinkedList<>(); for (T each : targets) { try { callback.execute(each); } catch (final SQLException ex) { exceptions.add(ex); } } throwSQLExceptionIfNecessary(exceptions); } }
public class class_name { public void execute(final Collection<T> targets, final ForceExecuteCallback<T> callback) throws SQLException { Collection<SQLException> exceptions = new LinkedList<>(); for (T each : targets) { try { callback.execute(each); // depends on control dependency: [try], data = [none] } catch (final SQLException ex) { exceptions.add(ex); } // depends on control dependency: [catch], data = [none] } throwSQLExceptionIfNecessary(exceptions); } }
public class class_name { protected void customizePortAddress(Message message) { String address = null; PortComponentRefInfo portInfo = null; if (null != wsrInfo) { QName portQName = getPortQName(message); if (null != portQName) { portInfo = wsrInfo.getPortComponentRefInfo(portQName); address = (null != portInfo && null != portInfo.getAddress()) ? portInfo.getAddress() : wsrInfo.getDefaultPortAddress(); } } if (null != address) { //change the endpoint address if there is a valid one. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "The endpoint address is overriden by " + address); } message.put(Message.ENDPOINT_ADDRESS, address); } } }
public class class_name { protected void customizePortAddress(Message message) { String address = null; PortComponentRefInfo portInfo = null; if (null != wsrInfo) { QName portQName = getPortQName(message); if (null != portQName) { portInfo = wsrInfo.getPortComponentRefInfo(portQName); // depends on control dependency: [if], data = [portQName)] address = (null != portInfo && null != portInfo.getAddress()) ? portInfo.getAddress() : wsrInfo.getDefaultPortAddress(); // depends on control dependency: [if], data = [(null] } } if (null != address) { //change the endpoint address if there is a valid one. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "The endpoint address is overriden by " + address); // depends on control dependency: [if], data = [none] } message.put(Message.ENDPOINT_ADDRESS, address); // depends on control dependency: [if], data = [address)] } } }
public class class_name { public boolean visitTree(VisitContext context, VisitCallback callback) { try { pushComponentToEL(context.getFacesContext(), this); if (!isVisitable(context)) { return false; } VisitResult res = context.invokeVisitCallback(this, callback); switch (res) { //we are done nothing has to be processed anymore case COMPLETE: return true; case REJECT: return false; //accept default: if (getFacetCount() > 0) { for (UIComponent facet : getFacets().values()) { if (facet.visitTree(context, callback)) { return true; } } } int childCount = getChildCount(); if (childCount > 0) { for (int i = 0; i < childCount; i++) { UIComponent child = getChildren().get(i); if (child.visitTree(context, callback)) { return true; } } } return false; } } finally { //all components must call popComponentFromEl after visiting is finished popComponentFromEL(context.getFacesContext()); } } }
public class class_name { public boolean visitTree(VisitContext context, VisitCallback callback) { try { pushComponentToEL(context.getFacesContext(), this); // depends on control dependency: [try], data = [none] if (!isVisitable(context)) { return false; // depends on control dependency: [if], data = [none] } VisitResult res = context.invokeVisitCallback(this, callback); switch (res) { //we are done nothing has to be processed anymore case COMPLETE: return true; case REJECT: return false; //accept default: if (getFacetCount() > 0) { for (UIComponent facet : getFacets().values()) { if (facet.visitTree(context, callback)) { return true; // depends on control dependency: [if], data = [none] } } } int childCount = getChildCount(); if (childCount > 0) { for (int i = 0; i < childCount; i++) { UIComponent child = getChildren().get(i); if (child.visitTree(context, callback)) { return true; // depends on control dependency: [if], data = [none] } } } return false; } } finally { //all components must call popComponentFromEl after visiting is finished popComponentFromEL(context.getFacesContext()); } } }
public class class_name { static boolean load(Map<String, String> storage, boolean reverse, String... pathArray) { StringDictionary dictionary = new StringDictionary("="); for (String path : pathArray) { if (!dictionary.load(path)) return false; } if (reverse) dictionary = dictionary.reverse(); Set<Map.Entry<String, String>> entrySet = dictionary.entrySet(); for (Map.Entry<String, String> entry : entrySet) { storage.put(entry.getKey(), entry.getValue()); } return true; } }
public class class_name { static boolean load(Map<String, String> storage, boolean reverse, String... pathArray) { StringDictionary dictionary = new StringDictionary("="); for (String path : pathArray) { if (!dictionary.load(path)) return false; } if (reverse) dictionary = dictionary.reverse(); Set<Map.Entry<String, String>> entrySet = dictionary.entrySet(); for (Map.Entry<String, String> entry : entrySet) { storage.put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry] } return true; } }
public class class_name { private int defaultThreadID() { long tid = Thread.currentThread().getId(); if (tid < MIN_SEQUENTIAL_THREAD_ID) { return (int) tid; } else { Integer id = threadIds.get(); if (id == null) { id = nextThreadId.getAndIncrement(); threadIds.set(id); } return id; } } }
public class class_name { private int defaultThreadID() { long tid = Thread.currentThread().getId(); if (tid < MIN_SEQUENTIAL_THREAD_ID) { return (int) tid; // depends on control dependency: [if], data = [none] } else { Integer id = threadIds.get(); if (id == null) { id = nextThreadId.getAndIncrement(); // depends on control dependency: [if], data = [none] threadIds.set(id); // depends on control dependency: [if], data = [(id] } return id; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void setExpectedAnswers(ArrayList<String> realms) { if (answers == null) { return; } for (String realm : realms) { try { answers.put(realm, ""); } catch (JSONException t) { logger.error("setExpectedAnswers failed with exception: " + t.getLocalizedMessage(), t); } } } }
public class class_name { private void setExpectedAnswers(ArrayList<String> realms) { if (answers == null) { return; // depends on control dependency: [if], data = [none] } for (String realm : realms) { try { answers.put(realm, ""); // depends on control dependency: [try], data = [none] } catch (JSONException t) { logger.error("setExpectedAnswers failed with exception: " + t.getLocalizedMessage(), t); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public ConnectionsList withConnections(String... connections) { if (this.connections == null) { setConnections(new java.util.ArrayList<String>(connections.length)); } for (String ele : connections) { this.connections.add(ele); } return this; } }
public class class_name { public ConnectionsList withConnections(String... connections) { if (this.connections == null) { setConnections(new java.util.ArrayList<String>(connections.length)); // depends on control dependency: [if], data = [none] } for (String ele : connections) { this.connections.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public String readDMR() throws DapException { try { if(state != State.INITIAL) throw new DapException("Attempt to read DMR twice"); byte[] dmr8 = null; if(requestmode == RequestMode.DMR) { // The whole buffer is the dmr; // but we do not know the length ByteArrayOutputStream baos = new ByteArrayOutputStream(); int c; while((c = input.read()) >= 0) { baos.write(c); } baos.close(); dmr8 = baos.toByteArray(); } else if(requestmode == RequestMode.DAP) { // Pull in the DMR chunk header if(!readHeader(input)) throw new DapException("Malformed chunk count"); // Read the DMR databuffer dmr8 = new byte[this.chunksize]; int red = read(dmr8, 0, this.chunksize); if(red < this.chunksize) throw new DapException("Short chunk"); } else assert false : "Internal error"; // Convert DMR to a string String dmr = new String(dmr8, DapUtil.UTF8); // Clean it up dmr = dmr.trim(); // Make sure it has trailing \r\n" if(dmr.endsWith("\r\n")) { // do nothing } else if(dmr.endsWith("\n")) dmr = dmr.substring(0,dmr.length()-2) + "\r\n"; else dmr = dmr + "\r\n"; // Figure out the endian-ness of the response this.remoteorder = (flags & DapUtil.CHUNK_LITTLE_ENDIAN) == 0 ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN; this.nochecksum = (flags & DapUtil.CHUNK_NOCHECKSUM) != 0; // Set the state if((flags & DapUtil.CHUNK_ERROR) != 0) state = State.ERROR; else if((flags & DapUtil.CHUNK_END) != 0) state = State.END; else state = State.DATA; return dmr; //return the DMR } catch (IOException ioe) { throw new DapException(ioe.getMessage()); } } }
public class class_name { public String readDMR() throws DapException { try { if(state != State.INITIAL) throw new DapException("Attempt to read DMR twice"); byte[] dmr8 = null; if(requestmode == RequestMode.DMR) { // The whole buffer is the dmr; // but we do not know the length ByteArrayOutputStream baos = new ByteArrayOutputStream(); int c; while((c = input.read()) >= 0) { baos.write(c); // depends on control dependency: [while], data = [none] } baos.close(); dmr8 = baos.toByteArray(); } else if(requestmode == RequestMode.DAP) { // Pull in the DMR chunk header if(!readHeader(input)) throw new DapException("Malformed chunk count"); // Read the DMR databuffer dmr8 = new byte[this.chunksize]; int red = read(dmr8, 0, this.chunksize); if(red < this.chunksize) throw new DapException("Short chunk"); } else assert false : "Internal error"; // Convert DMR to a string String dmr = new String(dmr8, DapUtil.UTF8); // Clean it up dmr = dmr.trim(); // Make sure it has trailing \r\n" if(dmr.endsWith("\r\n")) { // do nothing } else if(dmr.endsWith("\n")) dmr = dmr.substring(0,dmr.length()-2) + "\r\n"; else dmr = dmr + "\r\n"; // Figure out the endian-ness of the response this.remoteorder = (flags & DapUtil.CHUNK_LITTLE_ENDIAN) == 0 ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN; this.nochecksum = (flags & DapUtil.CHUNK_NOCHECKSUM) != 0; // Set the state if((flags & DapUtil.CHUNK_ERROR) != 0) state = State.ERROR; else if((flags & DapUtil.CHUNK_END) != 0) state = State.END; else state = State.DATA; return dmr; //return the DMR } catch (IOException ioe) { throw new DapException(ioe.getMessage()); } } }
public class class_name { public Registration getRegistration (Class type) { if (type == null) throw new IllegalArgumentException("type cannot be null."); Registration registration = classResolver.getRegistration(type); if (registration == null) { if (Proxy.isProxyClass(type)) { // If a Proxy class, treat it like an InvocationHandler because the concrete class for a proxy is generated. registration = getRegistration(InvocationHandler.class); } else if (!type.isEnum() && Enum.class.isAssignableFrom(type) && type != Enum.class) { // This handles an enum value that is an inner class, eg: enum A {b{}} registration = getRegistration(type.getEnclosingClass()); } else if (EnumSet.class.isAssignableFrom(type)) registration = classResolver.getRegistration(EnumSet.class); else if (isClosure(type)) // registration = classResolver.getRegistration(ClosureSerializer.Closure.class); if (registration == null) { if (registrationRequired) throw new IllegalArgumentException(unregisteredClassMessage(type)); if (WARN && warnUnregisteredClasses) warn(unregisteredClassMessage(type)); registration = classResolver.registerImplicit(type); } } return registration; } }
public class class_name { public Registration getRegistration (Class type) { if (type == null) throw new IllegalArgumentException("type cannot be null."); Registration registration = classResolver.getRegistration(type); if (registration == null) { if (Proxy.isProxyClass(type)) { // If a Proxy class, treat it like an InvocationHandler because the concrete class for a proxy is generated. registration = getRegistration(InvocationHandler.class); // depends on control dependency: [if], data = [none] } else if (!type.isEnum() && Enum.class.isAssignableFrom(type) && type != Enum.class) { // This handles an enum value that is an inner class, eg: enum A {b{}} registration = getRegistration(type.getEnclosingClass()); // depends on control dependency: [if], data = [none] } else if (EnumSet.class.isAssignableFrom(type)) registration = classResolver.getRegistration(EnumSet.class); else if (isClosure(type)) // registration = classResolver.getRegistration(ClosureSerializer.Closure.class); if (registration == null) { if (registrationRequired) throw new IllegalArgumentException(unregisteredClassMessage(type)); if (WARN && warnUnregisteredClasses) warn(unregisteredClassMessage(type)); registration = classResolver.registerImplicit(type); // depends on control dependency: [if], data = [none] } } return registration; } }
public class class_name { void open(int groupSize) { try { close(); ConsumerConfig config = consumerConfig; if (groupSize != config.getGroupSize()) { config = new ConsumerConfig(consumerConfig.getGroupId(), consumerConfig.getInstanceId(), groupSize, consumerConfig.getDequeueStrategy(), consumerConfig.getHashKey()); } if (queueName.isQueue()) { QueueConsumer queueConsumer = dataFabricFacade.createConsumer(queueName, config, numGroups); consumerConfig = queueConsumer.getConfig(); consumer = queueConsumer; } } catch (Exception e) { throw Throwables.propagate(e); } } }
public class class_name { void open(int groupSize) { try { close(); // depends on control dependency: [try], data = [none] ConsumerConfig config = consumerConfig; if (groupSize != config.getGroupSize()) { config = new ConsumerConfig(consumerConfig.getGroupId(), consumerConfig.getInstanceId(), groupSize, consumerConfig.getDequeueStrategy(), consumerConfig.getHashKey()); // depends on control dependency: [if], data = [none] } if (queueName.isQueue()) { QueueConsumer queueConsumer = dataFabricFacade.createConsumer(queueName, config, numGroups); consumerConfig = queueConsumer.getConfig(); // depends on control dependency: [if], data = [none] consumer = queueConsumer; // depends on control dependency: [if], data = [none] } } catch (Exception e) { throw Throwables.propagate(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public String[] getDeviceStateArray() { final String[] array = new String[deviceStateMap.size()]; int i = 0; for (final Map.Entry<String, DevState> deviceStateEntry : deviceStateMap.entrySet()) { final String deviceName = deviceStateEntry.getKey(); final DevState deviceState = deviceStateEntry.getValue(); array[i++] = deviceName + " - " + StateUtilities.getNameForState(deviceState); } return array; } }
public class class_name { public String[] getDeviceStateArray() { final String[] array = new String[deviceStateMap.size()]; int i = 0; for (final Map.Entry<String, DevState> deviceStateEntry : deviceStateMap.entrySet()) { final String deviceName = deviceStateEntry.getKey(); final DevState deviceState = deviceStateEntry.getValue(); array[i++] = deviceName + " - " + StateUtilities.getNameForState(deviceState); // depends on control dependency: [for], data = [none] } return array; } }
public class class_name { private static boolean canBulkLoad(AsyncCacheLoader<?, ?> loader) { try { Class<?> defaultLoaderClass = AsyncCacheLoader.class; if (loader instanceof CacheLoader<?, ?>) { defaultLoaderClass = CacheLoader.class; Method classLoadAll = loader.getClass().getMethod("loadAll", Iterable.class); Method defaultLoadAll = CacheLoader.class.getMethod("loadAll", Iterable.class); if (!classLoadAll.equals(defaultLoadAll)) { return true; } } Method classAsyncLoadAll = loader.getClass().getMethod( "asyncLoadAll", Iterable.class, Executor.class); Method defaultAsyncLoadAll = defaultLoaderClass.getMethod( "asyncLoadAll", Iterable.class, Executor.class); return !classAsyncLoadAll.equals(defaultAsyncLoadAll); } catch (NoSuchMethodException | SecurityException e) { logger.log(Level.WARNING, "Cannot determine if CacheLoader can bulk load", e); return false; } } }
public class class_name { private static boolean canBulkLoad(AsyncCacheLoader<?, ?> loader) { try { Class<?> defaultLoaderClass = AsyncCacheLoader.class; if (loader instanceof CacheLoader<?, ?>) { defaultLoaderClass = CacheLoader.class; // depends on control dependency: [if], data = [none] Method classLoadAll = loader.getClass().getMethod("loadAll", Iterable.class); Method defaultLoadAll = CacheLoader.class.getMethod("loadAll", Iterable.class); if (!classLoadAll.equals(defaultLoadAll)) { return true; // depends on control dependency: [if], data = [none] } } Method classAsyncLoadAll = loader.getClass().getMethod( "asyncLoadAll", Iterable.class, Executor.class); Method defaultAsyncLoadAll = defaultLoaderClass.getMethod( "asyncLoadAll", Iterable.class, Executor.class); return !classAsyncLoadAll.equals(defaultAsyncLoadAll); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException | SecurityException e) { logger.log(Level.WARNING, "Cannot determine if CacheLoader can bulk load", e); return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public Object visitEqualityExpression(ExcellentParser.EqualityExpressionContext ctx) { Pair<Object, Object> args = Conversions.toSame(visit(ctx.expression(0)), visit(ctx.expression(1)), m_evalContext); boolean equal; if (args.getLeft() instanceof String) { // string equality is case-insensitive equal = ((String) args.getLeft()).equalsIgnoreCase((String) args.getRight()); } else if (args.getLeft() instanceof BigDecimal) { // compareTo doesn't take scale into account equal = ((BigDecimal) args.getLeft()).compareTo((BigDecimal) args.getRight()) == 0; } else { equal = args.getLeft().equals(args.getRight()); } return ctx.EQ() != null ? equal : !equal; } }
public class class_name { @Override public Object visitEqualityExpression(ExcellentParser.EqualityExpressionContext ctx) { Pair<Object, Object> args = Conversions.toSame(visit(ctx.expression(0)), visit(ctx.expression(1)), m_evalContext); boolean equal; if (args.getLeft() instanceof String) { // string equality is case-insensitive equal = ((String) args.getLeft()).equalsIgnoreCase((String) args.getRight()); // depends on control dependency: [if], data = [none] } else if (args.getLeft() instanceof BigDecimal) { // compareTo doesn't take scale into account equal = ((BigDecimal) args.getLeft()).compareTo((BigDecimal) args.getRight()) == 0; // depends on control dependency: [if], data = [none] } else { equal = args.getLeft().equals(args.getRight()); // depends on control dependency: [if], data = [none] } return ctx.EQ() != null ? equal : !equal; } }
public class class_name { private void addDict(String word, String... poses){ if(word.length() > MAX_LEN) MAX_LEN = word.length(); if(word.length() < MIN_LEN) MIN_LEN = word.length(); if(poses==null||poses.length==0){ if(!dp.containsKey(word)) dp.put(word, null); return; } for(int j = 0; j < poses.length; j++) { dp.put(word, poses[j]); } } }
public class class_name { private void addDict(String word, String... poses){ if(word.length() > MAX_LEN) MAX_LEN = word.length(); if(word.length() < MIN_LEN) MIN_LEN = word.length(); if(poses==null||poses.length==0){ if(!dp.containsKey(word)) dp.put(word, null); return; // depends on control dependency: [if], data = [none] } for(int j = 0; j < poses.length; j++) { dp.put(word, poses[j]); // depends on control dependency: [for], data = [j] } } }
public class class_name { public static String displayNameFor(@Nonnull Job<?, ?> job) { GithubProjectProperty ghProp = job.getProperty(GithubProjectProperty.class); if (ghProp != null && isNotBlank(ghProp.getDisplayName())) { return ghProp.getDisplayName(); } return job.getFullName(); } }
public class class_name { public static String displayNameFor(@Nonnull Job<?, ?> job) { GithubProjectProperty ghProp = job.getProperty(GithubProjectProperty.class); if (ghProp != null && isNotBlank(ghProp.getDisplayName())) { return ghProp.getDisplayName(); // depends on control dependency: [if], data = [none] } return job.getFullName(); } }
public class class_name { private char readEscapeCharacter() { if (pos == limit && !fillBuffer(1)) { throw syntaxError("Unterminated escape sequence"); } char escaped = buffer[pos++]; switch (escaped) { case 'u': if (pos + 4 > limit && !fillBuffer(4)) { throw syntaxError("Unterminated escape sequence"); } // Equivalent to Integer.parseInt(stringPool.get(buffer, pos, 4), 16); char result = 0; for (int i = pos, end = i + 4; i < end; i++) { char c = buffer[i]; result <<= 4; if (c >= '0' && c <= '9') { result += (c - '0'); } else if (c >= 'a' && c <= 'f') { result += (c - 'a' + 10); } else if (c >= 'A' && c <= 'F') { result += (c - 'A' + 10); } else { throw new NumberFormatException("\\u" + new String(buffer, pos, 4)); } } pos += 4; return result; case 't': return '\t'; case 'b': return '\b'; case 'n': return '\n'; case 'r': return '\r'; case 'f': return '\f'; case '\n': lineNumber++; lineStart = pos; // fall-through case '\'': case '"': case '\\': default: return escaped; } } }
public class class_name { private char readEscapeCharacter() { if (pos == limit && !fillBuffer(1)) { throw syntaxError("Unterminated escape sequence"); } char escaped = buffer[pos++]; switch (escaped) { case 'u': if (pos + 4 > limit && !fillBuffer(4)) { throw syntaxError("Unterminated escape sequence"); } // Equivalent to Integer.parseInt(stringPool.get(buffer, pos, 4), 16); char result = 0; for (int i = pos, end = i + 4; i < end; i++) { char c = buffer[i]; result <<= 4; // depends on control dependency: [for], data = [none] if (c >= '0' && c <= '9') { result += (c - '0'); // depends on control dependency: [if], data = [(c] } else if (c >= 'a' && c <= 'f') { result += (c - 'a' + 10); // depends on control dependency: [if], data = [(c] } else if (c >= 'A' && c <= 'F') { result += (c - 'A' + 10); // depends on control dependency: [if], data = [(c] } else { throw new NumberFormatException("\\u" + new String(buffer, pos, 4)); } } pos += 4; return result; case 't': return '\t'; case 'b': return '\b'; case 'n': return '\n'; case 'r': return '\r'; case 'f': return '\f'; case '\n': lineNumber++; lineStart = pos; // fall-through case '\'': case '"': case '\\': default: return escaped; } } }
public class class_name { public Element createOrUpdateSingleChild(Element parent, String type) { Element result = null; if (parent.getElementsByTagName(type).getLength() == 0) { switch (namespace) { case HTML: result = Dom.createElementNS(Dom.NS_HTML, type); break; case SVG: result = Dom.createElementNS(Dom.NS_SVG, type); break; case VML: result = Dom.createElementNS(Dom.NS_VML, type); break; } parent.appendChild(result); return result; } else { return (Element) (parent.getElementsByTagName(type).getItem(0)); } } }
public class class_name { public Element createOrUpdateSingleChild(Element parent, String type) { Element result = null; if (parent.getElementsByTagName(type).getLength() == 0) { switch (namespace) { case HTML: result = Dom.createElementNS(Dom.NS_HTML, type); break; case SVG: result = Dom.createElementNS(Dom.NS_SVG, type); break; case VML: result = Dom.createElementNS(Dom.NS_VML, type); break; } parent.appendChild(result); // depends on control dependency: [if], data = [none] return result; // depends on control dependency: [if], data = [none] } else { return (Element) (parent.getElementsByTagName(type).getItem(0)); // depends on control dependency: [if], data = [0)] } } }
public class class_name { public static String removeAllEmojis(String emojiText) { for (Emoji emoji : EmojiManager.data()) { emojiText = emojiText.replace(emoji.getEmoji(), ""); } return emojiText; } }
public class class_name { public static String removeAllEmojis(String emojiText) { for (Emoji emoji : EmojiManager.data()) { emojiText = emojiText.replace(emoji.getEmoji(), ""); // depends on control dependency: [for], data = [emoji] } return emojiText; } }
public class class_name { public void generateStub(Element element) { try { getClassBuilder(element) .buildStubClass() .build() .writeTo(filer); } catch (Exception ex) { messager.printMessage(Diagnostic.Kind.WARNING, "Error while generating Stub " + ex.getMessage()); } } }
public class class_name { public void generateStub(Element element) { try { getClassBuilder(element) .buildStubClass() .build() .writeTo(filer); // depends on control dependency: [try], data = [none] } catch (Exception ex) { messager.printMessage(Diagnostic.Kind.WARNING, "Error while generating Stub " + ex.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void update() { if (done) { return; } int processed = AL10.alGetSourcei(source, AL10.AL_BUFFERS_PROCESSED); while (processed > 0) { unqueued.clear(); AL10.alSourceUnqueueBuffers(source, unqueued); if (stream(unqueued.get(0))) { AL10.alSourceQueueBuffers(source, unqueued); } else { remainingBufferCount--; if (remainingBufferCount == 0) { done = true; } } processed--; } int state = AL10.alGetSourcei(source, AL10.AL_SOURCE_STATE); if (state != AL10.AL_PLAYING) { AL10.alSourcePlay(source); } } }
public class class_name { public void update() { if (done) { return; // depends on control dependency: [if], data = [none] } int processed = AL10.alGetSourcei(source, AL10.AL_BUFFERS_PROCESSED); while (processed > 0) { unqueued.clear(); // depends on control dependency: [while], data = [none] AL10.alSourceUnqueueBuffers(source, unqueued); // depends on control dependency: [while], data = [none] if (stream(unqueued.get(0))) { AL10.alSourceQueueBuffers(source, unqueued); // depends on control dependency: [if], data = [none] } else { remainingBufferCount--; // depends on control dependency: [if], data = [none] if (remainingBufferCount == 0) { done = true; // depends on control dependency: [if], data = [none] } } processed--; // depends on control dependency: [while], data = [none] } int state = AL10.alGetSourcei(source, AL10.AL_SOURCE_STATE); if (state != AL10.AL_PLAYING) { AL10.alSourcePlay(source); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static final TypeCategory getTypeCategory(Type type) { if (type instanceof GenericObjectType) { return ((GenericObjectType) type).getTypeCategory(); } if (type instanceof ObjectType || type instanceof NullType) { return TypeCategory.PLAIN_OBJECT_TYPE; } if (type instanceof ArrayType) { return TypeCategory.ARRAY_TYPE; } throw new IllegalArgumentException("Not a reference type: " + type); } }
public class class_name { public static final TypeCategory getTypeCategory(Type type) { if (type instanceof GenericObjectType) { return ((GenericObjectType) type).getTypeCategory(); // depends on control dependency: [if], data = [none] } if (type instanceof ObjectType || type instanceof NullType) { return TypeCategory.PLAIN_OBJECT_TYPE; // depends on control dependency: [if], data = [none] } if (type instanceof ArrayType) { return TypeCategory.ARRAY_TYPE; // depends on control dependency: [if], data = [none] } throw new IllegalArgumentException("Not a reference type: " + type); } }
public class class_name { public final void enumBodyDeclarations() throws RecognitionException { int enumBodyDeclarations_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 15) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:334:5: ( ';' ( classBodyDeclaration )* ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:334:7: ';' ( classBodyDeclaration )* { match(input,52,FOLLOW_52_in_enumBodyDeclarations521); if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:334:11: ( classBodyDeclaration )* loop26: while (true) { int alt26=2; int LA26_0 = input.LA(1); if ( (LA26_0==ENUM||LA26_0==Identifier||(LA26_0 >= 52 && LA26_0 <= 53)||LA26_0==58||LA26_0==63||LA26_0==65||LA26_0==67||(LA26_0 >= 71 && LA26_0 <= 72)||LA26_0==77||LA26_0==83||LA26_0==85||(LA26_0 >= 92 && LA26_0 <= 94)||LA26_0==96||(LA26_0 >= 100 && LA26_0 <= 102)||(LA26_0 >= 105 && LA26_0 <= 107)||LA26_0==110||LA26_0==114||(LA26_0 >= 118 && LA26_0 <= 119)||LA26_0==121) ) { alt26=1; } switch (alt26) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:334:12: classBodyDeclaration { pushFollow(FOLLOW_classBodyDeclaration_in_enumBodyDeclarations524); classBodyDeclaration(); state._fsp--; if (state.failed) return; } break; default : break loop26; } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 15, enumBodyDeclarations_StartIndex); } } } }
public class class_name { public final void enumBodyDeclarations() throws RecognitionException { int enumBodyDeclarations_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 15) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:334:5: ( ';' ( classBodyDeclaration )* ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:334:7: ';' ( classBodyDeclaration )* { match(input,52,FOLLOW_52_in_enumBodyDeclarations521); if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:334:11: ( classBodyDeclaration )* loop26: while (true) { int alt26=2; int LA26_0 = input.LA(1); if ( (LA26_0==ENUM||LA26_0==Identifier||(LA26_0 >= 52 && LA26_0 <= 53)||LA26_0==58||LA26_0==63||LA26_0==65||LA26_0==67||(LA26_0 >= 71 && LA26_0 <= 72)||LA26_0==77||LA26_0==83||LA26_0==85||(LA26_0 >= 92 && LA26_0 <= 94)||LA26_0==96||(LA26_0 >= 100 && LA26_0 <= 102)||(LA26_0 >= 105 && LA26_0 <= 107)||LA26_0==110||LA26_0==114||(LA26_0 >= 118 && LA26_0 <= 119)||LA26_0==121) ) { alt26=1; // depends on control dependency: [if], data = [none] } switch (alt26) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:334:12: classBodyDeclaration { pushFollow(FOLLOW_classBodyDeclaration_in_enumBodyDeclarations524); classBodyDeclaration(); state._fsp--; if (state.failed) return; } break; default : break loop26; } } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 15, enumBodyDeclarations_StartIndex); } // depends on control dependency: [if], data = [none] } } }
public class class_name { public void clear() { if (mObjects.isEmpty()) { return; } synchronized (mLock) { final int size = getItemCount(); mObjects.clear(); notifyItemRangeRemoved(0, size); } } }
public class class_name { public void clear() { if (mObjects.isEmpty()) { return; // depends on control dependency: [if], data = [none] } synchronized (mLock) { final int size = getItemCount(); mObjects.clear(); notifyItemRangeRemoved(0, size); } } }
public class class_name { public static ValueMatcher build(String value, ValueParser parser) { if (isMatchAllStr(value)) { //兼容Quartz的"?"表达式,不会出现互斥情况,与"*"作用相同 return new AlwaysTrueValueMatcher(); } List<Integer> values = parseArray(value, parser); if (values.size() == 0) { throw new CronException("Invalid field: [{}]", value); } if (parser instanceof DayOfMonthValueParser) { //考虑每月的天数不同,且存在闰年情况,日匹配单独使用 return new DayOfMonthValueMatcher(values); }else if(parser instanceof YearValueParser){ //考虑年数字太大,不适合boolean数组,单独使用列表遍历匹配 return new YearValueMatcher(values); }else { return new BoolArrayValueMatcher(values); } } }
public class class_name { public static ValueMatcher build(String value, ValueParser parser) { if (isMatchAllStr(value)) { //兼容Quartz的"?"表达式,不会出现互斥情况,与"*"作用相同 return new AlwaysTrueValueMatcher(); // depends on control dependency: [if], data = [none] } List<Integer> values = parseArray(value, parser); if (values.size() == 0) { throw new CronException("Invalid field: [{}]", value); } if (parser instanceof DayOfMonthValueParser) { //考虑每月的天数不同,且存在闰年情况,日匹配单独使用 return new DayOfMonthValueMatcher(values); // depends on control dependency: [if], data = [none] }else if(parser instanceof YearValueParser){ //考虑年数字太大,不适合boolean数组,单独使用列表遍历匹配 return new YearValueMatcher(values); // depends on control dependency: [if], data = [none] }else { return new BoolArrayValueMatcher(values); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void recover(TimerTaskData taskData) { TimerTask task = timerTaskFactory.newTimerTask(taskData); if(task != null) { if (logger.isDebugEnabled()) { logger.debug("Recovering task with id "+taskData.getTaskID()); } task.beforeRecover(); // on recovery the task will already be in the cache so we don't check for it // or an IllegalStateException will be thrown schedule(task, false); } } }
public class class_name { private void recover(TimerTaskData taskData) { TimerTask task = timerTaskFactory.newTimerTask(taskData); if(task != null) { if (logger.isDebugEnabled()) { logger.debug("Recovering task with id "+taskData.getTaskID()); // depends on control dependency: [if], data = [none] } task.beforeRecover(); // depends on control dependency: [if], data = [none] // on recovery the task will already be in the cache so we don't check for it // or an IllegalStateException will be thrown schedule(task, false); // depends on control dependency: [if], data = [(task] } } }
public class class_name { public static String getDescription(Class<?> comp, Locale loc) { Description descr = (Description) comp.getAnnotation(Description.class); if (descr != null) { String lang = loc.getLanguage(); Method[] m = descr.getClass().getMethods(); for (Method method : m) { // System.out.println(method); if (method.getName().equals(lang)) { try { String d = (String) method.invoke(descr, (Object[]) null); if (d != null && !d.isEmpty()) { return d; } } catch (Exception ex) { ex.printStackTrace(); } } } return descr.value(); } return null; } }
public class class_name { public static String getDescription(Class<?> comp, Locale loc) { Description descr = (Description) comp.getAnnotation(Description.class); if (descr != null) { String lang = loc.getLanguage(); Method[] m = descr.getClass().getMethods(); for (Method method : m) { // System.out.println(method); if (method.getName().equals(lang)) { try { String d = (String) method.invoke(descr, (Object[]) null); if (d != null && !d.isEmpty()) { return d; // depends on control dependency: [if], data = [none] } } catch (Exception ex) { ex.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } return descr.value(); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { private static String replaceOperators(String spel) { if (StringUtils.isBlank(spel)) { return spel; } return spel.replaceAll("==", " = ") .replaceAll("&&", " and ") .replaceAll("\\|\\|", " or "); } }
public class class_name { private static String replaceOperators(String spel) { if (StringUtils.isBlank(spel)) { return spel; // depends on control dependency: [if], data = [none] } return spel.replaceAll("==", " = ") .replaceAll("&&", " and ") .replaceAll("\\|\\|", " or "); } }
public class class_name { public synchronized int addColumn(Vector col) { DoubleVector column = Vectors.asDouble(col); if (isFinished) throw new IllegalStateException( "Cannot add columns to a MatrixBuilder that is finished"); if (column instanceof SparseVector) { SparseVector s = (SparseVector)column; for (int r : s.getNonZeroIndices()) { // NB: Matlab sparse format is in [row col val] format // // NOTE: Matlab indices start at 1, not 0, so update all the // column and column values to be Matlab formatted. addEntry(r + 1, curColumn + 1, column.get(r)); } } else { for (int r = 0; r < column.length(); ++r) { double d = column.get(r); if (d != 0d) { // NOTE: Matlab indices start at 1, not 0, so update all // the row and column values to be Matlab formatted. addEntry(r + 1, curColumn + 1, d); } } } return ++curColumn; } }
public class class_name { public synchronized int addColumn(Vector col) { DoubleVector column = Vectors.asDouble(col); if (isFinished) throw new IllegalStateException( "Cannot add columns to a MatrixBuilder that is finished"); if (column instanceof SparseVector) { SparseVector s = (SparseVector)column; for (int r : s.getNonZeroIndices()) { // NB: Matlab sparse format is in [row col val] format // // NOTE: Matlab indices start at 1, not 0, so update all the // column and column values to be Matlab formatted. addEntry(r + 1, curColumn + 1, column.get(r)); // depends on control dependency: [for], data = [r] } } else { for (int r = 0; r < column.length(); ++r) { double d = column.get(r); if (d != 0d) { // NOTE: Matlab indices start at 1, not 0, so update all // the row and column values to be Matlab formatted. addEntry(r + 1, curColumn + 1, d); // depends on control dependency: [if], data = [none] } } } return ++curColumn; } }
public class class_name { private int getYearIfAny(StatementDocument document, String propertyId) { TimeValue date = document.findStatementTimeValue(propertyId); if (date != null && date.getPrecision() >= TimeValue.PREC_YEAR) { return (int) date.getYear(); } else { return Integer.MIN_VALUE; } } }
public class class_name { private int getYearIfAny(StatementDocument document, String propertyId) { TimeValue date = document.findStatementTimeValue(propertyId); if (date != null && date.getPrecision() >= TimeValue.PREC_YEAR) { return (int) date.getYear(); // depends on control dependency: [if], data = [none] } else { return Integer.MIN_VALUE; // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean add(WeightedDirectedTypedEdge<T> e) { if (e.from() == rootVertex) { Set<WeightedDirectedTypedEdge<T>> edges = outEdges.get(e.to()); if (edges.contains(e)) return false; // We can't rely on the edge's equality method since that uses the // edge weight, so we'll have to iterate over the edges to see if we // have one that matches the type, and if so replace it with the // different weight if (!edges.isEmpty()) { Iterator<WeightedDirectedTypedEdge<T>> iter = edges.iterator(); WeightedDirectedTypedEdge<T> existing = null; while (iter.hasNext()) { WeightedDirectedTypedEdge<T> n = iter.next(); if (n.to() == e.to() && n.edgeType().equals(e.edgeType())) { existing = n; break; } } if (existing == null) { outEdges.put(e.to(), e); return true; } // Check if has the same weight; else if (e.weight() != existing.weight()) { outEdges.remove(e.to(), existing); outEdges.put(e.to(), e); return true; } else return false; } else return outEdges.put(e.to(), e); } else if (e.to() == rootVertex) { Set<WeightedDirectedTypedEdge<T>> edges = inEdges.get(e.from()); if (edges.contains(e)) return false; // We can't rely on the edge's equality method since that uses the // edge weight, so we'll have to iterate over the edges to see if we // have one that matches the type, and if so replace it with the // different weight if (!edges.isEmpty()) { Iterator<WeightedDirectedTypedEdge<T>> iter = edges.iterator(); WeightedDirectedTypedEdge<T> existing = null; while (iter.hasNext()) { WeightedDirectedTypedEdge<T> n = iter.next(); if (n.from() == e.from() && n.edgeType().equals(e.edgeType())) { existing = n; break; } } if (existing == null) { inEdges.put(e.from(), e); return true; } // Check if has the same weight; else if (e.weight() != existing.weight()) { inEdges.remove(e.from(), existing); inEdges.put(e.from(), e); return true; } return false; } else return inEdges.put(e.from(), e); } return false; } }
public class class_name { public boolean add(WeightedDirectedTypedEdge<T> e) { if (e.from() == rootVertex) { Set<WeightedDirectedTypedEdge<T>> edges = outEdges.get(e.to()); if (edges.contains(e)) return false; // We can't rely on the edge's equality method since that uses the // edge weight, so we'll have to iterate over the edges to see if we // have one that matches the type, and if so replace it with the // different weight if (!edges.isEmpty()) { Iterator<WeightedDirectedTypedEdge<T>> iter = edges.iterator(); WeightedDirectedTypedEdge<T> existing = null; while (iter.hasNext()) { WeightedDirectedTypedEdge<T> n = iter.next(); if (n.to() == e.to() && n.edgeType().equals(e.edgeType())) { existing = n; // depends on control dependency: [if], data = [none] break; } } if (existing == null) { outEdges.put(e.to(), e); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } // Check if has the same weight; else if (e.weight() != existing.weight()) { outEdges.remove(e.to(), existing); // depends on control dependency: [if], data = [none] outEdges.put(e.to(), e); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else return false; } else return outEdges.put(e.to(), e); } else if (e.to() == rootVertex) { Set<WeightedDirectedTypedEdge<T>> edges = inEdges.get(e.from()); if (edges.contains(e)) return false; // We can't rely on the edge's equality method since that uses the // edge weight, so we'll have to iterate over the edges to see if we // have one that matches the type, and if so replace it with the // different weight if (!edges.isEmpty()) { Iterator<WeightedDirectedTypedEdge<T>> iter = edges.iterator(); WeightedDirectedTypedEdge<T> existing = null; while (iter.hasNext()) { WeightedDirectedTypedEdge<T> n = iter.next(); if (n.from() == e.from() && n.edgeType().equals(e.edgeType())) { existing = n; // depends on control dependency: [if], data = [none] break; } } if (existing == null) { inEdges.put(e.from(), e); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } // Check if has the same weight; else if (e.weight() != existing.weight()) { inEdges.remove(e.from(), existing); // depends on control dependency: [if], data = [none] inEdges.put(e.from(), e); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; // depends on control dependency: [if], data = [none] } else return inEdges.put(e.from(), e); } return false; } }
public class class_name { public Object getFirst(String name) { Object value = get(name); if (value instanceof Collection<?>) { @SuppressWarnings("unchecked") Collection<Object> collectionValue = (Collection<Object>) value; Iterator<Object> iterator = collectionValue.iterator(); return iterator.hasNext() ? iterator.next() : null; } return value; } }
public class class_name { public Object getFirst(String name) { Object value = get(name); if (value instanceof Collection<?>) { @SuppressWarnings("unchecked") Collection<Object> collectionValue = (Collection<Object>) value; Iterator<Object> iterator = collectionValue.iterator(); return iterator.hasNext() ? iterator.next() : null; // depends on control dependency: [if], data = [)] } return value; } }
public class class_name { public static synchronized void getConnectionListener(String poolName, Object mcp, Object cl, boolean pooled, boolean interleaving, Throwable callstack) { if (!interleaving) { if (pooled) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_CONNECTION_LISTENER, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } else { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_CONNECTION_LISTENER_NEW, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } } else { if (pooled) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } else { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER_NEW, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } } } }
public class class_name { public static synchronized void getConnectionListener(String poolName, Object mcp, Object cl, boolean pooled, boolean interleaving, Throwable callstack) { if (!interleaving) { if (pooled) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_CONNECTION_LISTENER, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); // depends on control dependency: [if], data = [none] } else { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_CONNECTION_LISTENER_NEW, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); // depends on control dependency: [if], data = [none] } } else { if (pooled) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); // depends on control dependency: [if], data = [none] } else { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER_NEW, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @Override public void componentMetaDataCreated(MetaDataEvent<ComponentMetaData> event) { JaccService js = jaccService.getService(); if (js != null) { MetaData metaData = event.getMetaData(); if (metaData instanceof BeanMetaData) { BeanMetaData bmd = (BeanMetaData) metaData; js.propagateEJBRoles(bmd.j2eeName.getApplication(), bmd.j2eeName.getModule(), bmd.enterpriseBeanName, bmd.ivRoleLinkMap, JaccUtil.convertMethodInfoList(JaccUtil.mergeMethodInfos(bmd))); } } } }
public class class_name { @Override public void componentMetaDataCreated(MetaDataEvent<ComponentMetaData> event) { JaccService js = jaccService.getService(); if (js != null) { MetaData metaData = event.getMetaData(); if (metaData instanceof BeanMetaData) { BeanMetaData bmd = (BeanMetaData) metaData; js.propagateEJBRoles(bmd.j2eeName.getApplication(), bmd.j2eeName.getModule(), bmd.enterpriseBeanName, bmd.ivRoleLinkMap, JaccUtil.convertMethodInfoList(JaccUtil.mergeMethodInfos(bmd))); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static base_responses update(nitro_service client, nsip resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nsip updateresources[] = new nsip[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nsip(); updateresources[i].ipaddress = resources[i].ipaddress; updateresources[i].td = resources[i].td; updateresources[i].netmask = resources[i].netmask; updateresources[i].arp = resources[i].arp; updateresources[i].icmp = resources[i].icmp; updateresources[i].vserver = resources[i].vserver; updateresources[i].telnet = resources[i].telnet; updateresources[i].ftp = resources[i].ftp; updateresources[i].gui = resources[i].gui; updateresources[i].ssh = resources[i].ssh; updateresources[i].snmp = resources[i].snmp; updateresources[i].mgmtaccess = resources[i].mgmtaccess; updateresources[i].restrictaccess = resources[i].restrictaccess; updateresources[i].dynamicrouting = resources[i].dynamicrouting; updateresources[i].ospf = resources[i].ospf; updateresources[i].bgp = resources[i].bgp; updateresources[i].rip = resources[i].rip; updateresources[i].hostroute = resources[i].hostroute; updateresources[i].hostrtgw = resources[i].hostrtgw; updateresources[i].metric = resources[i].metric; updateresources[i].vserverrhilevel = resources[i].vserverrhilevel; updateresources[i].ospflsatype = resources[i].ospflsatype; updateresources[i].ospfarea = resources[i].ospfarea; updateresources[i].vrid = resources[i].vrid; updateresources[i].icmpresponse = resources[i].icmpresponse; updateresources[i].arpresponse = resources[i].arpresponse; } result = update_bulk_request(client, updateresources); } return result; } }
public class class_name { public static base_responses update(nitro_service client, nsip resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nsip updateresources[] = new nsip[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nsip(); // depends on control dependency: [for], data = [i] updateresources[i].ipaddress = resources[i].ipaddress; // depends on control dependency: [for], data = [i] updateresources[i].td = resources[i].td; // depends on control dependency: [for], data = [i] updateresources[i].netmask = resources[i].netmask; // depends on control dependency: [for], data = [i] updateresources[i].arp = resources[i].arp; // depends on control dependency: [for], data = [i] updateresources[i].icmp = resources[i].icmp; // depends on control dependency: [for], data = [i] updateresources[i].vserver = resources[i].vserver; // depends on control dependency: [for], data = [i] updateresources[i].telnet = resources[i].telnet; // depends on control dependency: [for], data = [i] updateresources[i].ftp = resources[i].ftp; // depends on control dependency: [for], data = [i] updateresources[i].gui = resources[i].gui; // depends on control dependency: [for], data = [i] updateresources[i].ssh = resources[i].ssh; // depends on control dependency: [for], data = [i] updateresources[i].snmp = resources[i].snmp; // depends on control dependency: [for], data = [i] updateresources[i].mgmtaccess = resources[i].mgmtaccess; // depends on control dependency: [for], data = [i] updateresources[i].restrictaccess = resources[i].restrictaccess; // depends on control dependency: [for], data = [i] updateresources[i].dynamicrouting = resources[i].dynamicrouting; // depends on control dependency: [for], data = [i] updateresources[i].ospf = resources[i].ospf; // depends on control dependency: [for], data = [i] updateresources[i].bgp = resources[i].bgp; // depends on control dependency: [for], data = [i] updateresources[i].rip = resources[i].rip; // depends on control dependency: [for], data = [i] updateresources[i].hostroute = resources[i].hostroute; // depends on control dependency: [for], data = [i] updateresources[i].hostrtgw = resources[i].hostrtgw; // depends on control dependency: [for], data = [i] updateresources[i].metric = resources[i].metric; // depends on control dependency: [for], data = [i] updateresources[i].vserverrhilevel = resources[i].vserverrhilevel; // depends on control dependency: [for], data = [i] updateresources[i].ospflsatype = resources[i].ospflsatype; // depends on control dependency: [for], data = [i] updateresources[i].ospfarea = resources[i].ospfarea; // depends on control dependency: [for], data = [i] updateresources[i].vrid = resources[i].vrid; // depends on control dependency: [for], data = [i] updateresources[i].icmpresponse = resources[i].icmpresponse; // depends on control dependency: [for], data = [i] updateresources[i].arpresponse = resources[i].arpresponse; // depends on control dependency: [for], data = [i] } result = update_bulk_request(client, updateresources); } return result; } }
public class class_name { public Object getProperty(String property) { /** @todo we should check if we have the property with the metaClass instead of try/catch */ try { return super.getProperty(property); } catch (MissingPropertyException e) { return getVariable(property); } } }
public class class_name { public Object getProperty(String property) { /** @todo we should check if we have the property with the metaClass instead of try/catch */ try { return super.getProperty(property); // depends on control dependency: [try], data = [none] } catch (MissingPropertyException e) { return getVariable(property); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public String getName() { if(name==null) { String temp = get("iv-user"); if(temp==null)return null; StringBuilder sb = new StringBuilder(); int at = temp.indexOf('@'); if(at<0) { sb.append(temp); } else { sb.append(temp.substring(0, at)); } if(temp.endsWith("@uverse.com"))sb.append("@uverse.tguard.att.com"); else if(temp.endsWith("@att.com"))sb.append("@com.tguard.att.com"); else if(temp.endsWith("@att.net"))sb.append("@net.tguard.att.com"); else sb.append("@tguard.att.com"); name = sb.toString(); } return name; } }
public class class_name { public String getName() { if(name==null) { String temp = get("iv-user"); if(temp==null)return null; StringBuilder sb = new StringBuilder(); int at = temp.indexOf('@'); if(at<0) { sb.append(temp); // depends on control dependency: [if], data = [none] } else { sb.append(temp.substring(0, at)); // depends on control dependency: [if], data = [none] } if(temp.endsWith("@uverse.com"))sb.append("@uverse.tguard.att.com"); else if(temp.endsWith("@att.com"))sb.append("@com.tguard.att.com"); else if(temp.endsWith("@att.net"))sb.append("@net.tguard.att.com"); else sb.append("@tguard.att.com"); name = sb.toString(); } return name; } }
public class class_name { public static int getTwoWordFreq(Term from, Term to) { if (from.item().bigramEntryMap == null) { return 0; } Integer freq = from.item().bigramEntryMap.get(to.item().getIndex()); if (freq == null) { return 0; } else { return freq; } } }
public class class_name { public static int getTwoWordFreq(Term from, Term to) { if (from.item().bigramEntryMap == null) { return 0; // depends on control dependency: [if], data = [none] } Integer freq = from.item().bigramEntryMap.get(to.item().getIndex()); if (freq == null) { return 0; // depends on control dependency: [if], data = [none] } else { return freq; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void setBackRouteHeader(byte[] data) { // here in data is whole message, we want first 5 bytes! int thisPointCode = Mtp3.dpc(data, 1); int remotePointCode = Mtp3.opc(data, 1); int sls = Mtp3.sls(data, 1); int si = Mtp3.si(data); int ssi = Mtp3.ssi(data); // this.mtp3Header = new byte[5]; MTPUtility.writeRoutingLabel(mtp3Header, si, ssi, sls, remotePointCode, thisPointCode); if (logger.isInfoEnabled()) { logger.info("DPC[" + remotePointCode + "] OPC[" + thisPointCode + "] SLS[" + sls + "] SI[" + si + "] SSI[" + ssi + "] Label" + Arrays.toString(mtp3Header)); } } }
public class class_name { public void setBackRouteHeader(byte[] data) { // here in data is whole message, we want first 5 bytes! int thisPointCode = Mtp3.dpc(data, 1); int remotePointCode = Mtp3.opc(data, 1); int sls = Mtp3.sls(data, 1); int si = Mtp3.si(data); int ssi = Mtp3.ssi(data); // this.mtp3Header = new byte[5]; MTPUtility.writeRoutingLabel(mtp3Header, si, ssi, sls, remotePointCode, thisPointCode); if (logger.isInfoEnabled()) { logger.info("DPC[" + remotePointCode + "] OPC[" + thisPointCode + "] SLS[" + sls + "] SI[" + si + "] SSI[" + ssi + "] Label" + Arrays.toString(mtp3Header)); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Then("^the element on index '(\\d+?)' has '(.+?)' as text$") public void assertSeleniumTextOnElementPresent(Integer index, String text) { assertThat(commonspec.getPreviousWebElements()).as("There are less found elements than required") .hasAtLeast(index); String elementText = commonspec.getPreviousWebElements().getPreviousWebElements().get(index).getText().replace("\n", " ").replace("\r", " "); if (!elementText.startsWith("regex:")) { //We are verifying that a web element contains a string assertThat(elementText.matches("(.*)" + text + "(.*)")).isTrue(); } else { //We are verifying that a web element contains a regex assertThat(elementText.matches(text.substring(text.indexOf("regex:") + 6, text.length()))).isTrue(); } } }
public class class_name { @Then("^the element on index '(\\d+?)' has '(.+?)' as text$") public void assertSeleniumTextOnElementPresent(Integer index, String text) { assertThat(commonspec.getPreviousWebElements()).as("There are less found elements than required") .hasAtLeast(index); String elementText = commonspec.getPreviousWebElements().getPreviousWebElements().get(index).getText().replace("\n", " ").replace("\r", " "); if (!elementText.startsWith("regex:")) { //We are verifying that a web element contains a string assertThat(elementText.matches("(.*)" + text + "(.*)")).isTrue(); // depends on control dependency: [if], data = [none] } else { //We are verifying that a web element contains a regex assertThat(elementText.matches(text.substring(text.indexOf("regex:") + 6, text.length()))).isTrue(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void appendEncoded(StringBuilder builder, String s, Charset charset, boolean isPartiallyEncoded) { if (s == null) { throw new NullPointerException("s == null"); } int escapeStart = -1; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || isRetained(c) || (c == '%' && isPartiallyEncoded)) { if (escapeStart != -1) { appendHex(builder, s.substring(escapeStart, i), charset); escapeStart = -1; } if (c == '%' && isPartiallyEncoded) { // this is an encoded 3-character sequence like "%20" builder.append(s, i, Math.min(i + 3, s.length())); i += 2; } else if (c == ' ') { builder.append('+'); } else { builder.append(c); } } else if (escapeStart == -1) { escapeStart = i; } } if (escapeStart != -1) { appendHex(builder, s.substring(escapeStart, s.length()), charset); } } }
public class class_name { private void appendEncoded(StringBuilder builder, String s, Charset charset, boolean isPartiallyEncoded) { if (s == null) { throw new NullPointerException("s == null"); } int escapeStart = -1; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || isRetained(c) || (c == '%' && isPartiallyEncoded)) { if (escapeStart != -1) { appendHex(builder, s.substring(escapeStart, i), charset); // depends on control dependency: [if], data = [(escapeStart] escapeStart = -1; // depends on control dependency: [if], data = [none] } if (c == '%' && isPartiallyEncoded) { // this is an encoded 3-character sequence like "%20" builder.append(s, i, Math.min(i + 3, s.length())); // depends on control dependency: [if], data = [none] i += 2; // depends on control dependency: [if], data = [none] } else if (c == ' ') { builder.append('+'); // depends on control dependency: [if], data = [none] } else { builder.append(c); // depends on control dependency: [if], data = [(c] } } else if (escapeStart == -1) { escapeStart = i; // depends on control dependency: [if], data = [none] } } if (escapeStart != -1) { appendHex(builder, s.substring(escapeStart, s.length()), charset); // depends on control dependency: [if], data = [(escapeStart] } } }
public class class_name { public void marshall(SchemaAttributeType schemaAttributeType, ProtocolMarshaller protocolMarshaller) { if (schemaAttributeType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(schemaAttributeType.getName(), NAME_BINDING); protocolMarshaller.marshall(schemaAttributeType.getAttributeDataType(), ATTRIBUTEDATATYPE_BINDING); protocolMarshaller.marshall(schemaAttributeType.getDeveloperOnlyAttribute(), DEVELOPERONLYATTRIBUTE_BINDING); protocolMarshaller.marshall(schemaAttributeType.getMutable(), MUTABLE_BINDING); protocolMarshaller.marshall(schemaAttributeType.getRequired(), REQUIRED_BINDING); protocolMarshaller.marshall(schemaAttributeType.getNumberAttributeConstraints(), NUMBERATTRIBUTECONSTRAINTS_BINDING); protocolMarshaller.marshall(schemaAttributeType.getStringAttributeConstraints(), STRINGATTRIBUTECONSTRAINTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SchemaAttributeType schemaAttributeType, ProtocolMarshaller protocolMarshaller) { if (schemaAttributeType == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(schemaAttributeType.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(schemaAttributeType.getAttributeDataType(), ATTRIBUTEDATATYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(schemaAttributeType.getDeveloperOnlyAttribute(), DEVELOPERONLYATTRIBUTE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(schemaAttributeType.getMutable(), MUTABLE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(schemaAttributeType.getRequired(), REQUIRED_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(schemaAttributeType.getNumberAttributeConstraints(), NUMBERATTRIBUTECONSTRAINTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(schemaAttributeType.getStringAttributeConstraints(), STRINGATTRIBUTECONSTRAINTS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public CountDownLatch broadcastOperation(final BroadcastOpFactory of, final Collection<MemcachedNode> nodes) { final CountDownLatch latch = new CountDownLatch(nodes.size()); for (MemcachedNode node : nodes) { getLogger().debug("broadcast Operation: node = " + node); Operation op = of.newOp(node, latch); op.initialize(); node.addOp(op); op.setHandlingNode(node); addedQueue.offer(node); metrics.markMeter(OVERALL_REQUEST_METRIC); } Selector s = selector.wakeup(); assert s == selector : "Wakeup returned the wrong selector."; return latch; } }
public class class_name { public CountDownLatch broadcastOperation(final BroadcastOpFactory of, final Collection<MemcachedNode> nodes) { final CountDownLatch latch = new CountDownLatch(nodes.size()); for (MemcachedNode node : nodes) { getLogger().debug("broadcast Operation: node = " + node); // depends on control dependency: [for], data = [node] Operation op = of.newOp(node, latch); op.initialize(); // depends on control dependency: [for], data = [none] node.addOp(op); // depends on control dependency: [for], data = [node] op.setHandlingNode(node); // depends on control dependency: [for], data = [node] addedQueue.offer(node); // depends on control dependency: [for], data = [node] metrics.markMeter(OVERALL_REQUEST_METRIC); // depends on control dependency: [for], data = [none] } Selector s = selector.wakeup(); assert s == selector : "Wakeup returned the wrong selector."; return latch; } }
public class class_name { public EClass getGSLJ() { if (gsljEClass == null) { gsljEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(487); } return gsljEClass; } }
public class class_name { public EClass getGSLJ() { if (gsljEClass == null) { gsljEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(487); // depends on control dependency: [if], data = [none] } return gsljEClass; } }
public class class_name { public IIsotope[] getIsotopes(int elem) { if (isotopes[elem] == null) return EMPTY_ISOTOPE_ARRAY; List<IIsotope> list = new ArrayList<>(); for (IIsotope isotope : isotopes[elem]) { list.add(clone(isotope)); } return list.toArray(new IIsotope[0]); } }
public class class_name { public IIsotope[] getIsotopes(int elem) { if (isotopes[elem] == null) return EMPTY_ISOTOPE_ARRAY; List<IIsotope> list = new ArrayList<>(); for (IIsotope isotope : isotopes[elem]) { list.add(clone(isotope)); // depends on control dependency: [for], data = [isotope] } return list.toArray(new IIsotope[0]); } }
public class class_name { public void setEnabled(boolean enabled) { super.setEnabled(enabled); for (short i = 0; i < days.length; i++) { if (days[i] != null) { days[i].setEnabled(enabled); } } for (short i = 0; i < weeks.length; i++) { if (weeks[i] != null) { weeks[i].setEnabled(enabled); } } } }
public class class_name { public void setEnabled(boolean enabled) { super.setEnabled(enabled); for (short i = 0; i < days.length; i++) { if (days[i] != null) { days[i].setEnabled(enabled); // depends on control dependency: [if], data = [none] } } for (short i = 0; i < weeks.length; i++) { if (weeks[i] != null) { weeks[i].setEnabled(enabled); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static String resolveAuthBearerToken(final HttpServletRequest request) { String header = request.getHeader(HEADER_AUTHORIZATION); if (header == null) { return null; } int ndx = header.indexOf("Bearer "); if (ndx == -1) { return null; } return header.substring(ndx + 7).trim(); } }
public class class_name { public static String resolveAuthBearerToken(final HttpServletRequest request) { String header = request.getHeader(HEADER_AUTHORIZATION); if (header == null) { return null; // depends on control dependency: [if], data = [none] } int ndx = header.indexOf("Bearer "); if (ndx == -1) { return null; // depends on control dependency: [if], data = [none] } return header.substring(ndx + 7).trim(); } }
public class class_name { protected List<RedisFuture<Void>> resubscribe() { List<RedisFuture<Void>> result = new ArrayList<>(); if (endpoint.hasChannelSubscriptions()) { result.add(async().subscribe(toArray(endpoint.getChannels()))); } if (endpoint.hasPatternSubscriptions()) { result.add(async().psubscribe(toArray(endpoint.getPatterns()))); } return result; } }
public class class_name { protected List<RedisFuture<Void>> resubscribe() { List<RedisFuture<Void>> result = new ArrayList<>(); if (endpoint.hasChannelSubscriptions()) { result.add(async().subscribe(toArray(endpoint.getChannels()))); // depends on control dependency: [if], data = [none] } if (endpoint.hasPatternSubscriptions()) { result.add(async().psubscribe(toArray(endpoint.getPatterns()))); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static HttpHandler getNext(HttpServerExchange httpServerExchange) { String chainId = httpServerExchange.getAttachment(CHAIN_ID); List<HttpHandler> handlersForId = handlerListById.get(chainId); Integer nextIndex = httpServerExchange.getAttachment(CHAIN_SEQ); // Check if we've reached the end of the chain. if (nextIndex < handlersForId.size()) { httpServerExchange.putAttachment(CHAIN_SEQ, nextIndex + 1); return handlersForId.get(nextIndex); } return null; } }
public class class_name { public static HttpHandler getNext(HttpServerExchange httpServerExchange) { String chainId = httpServerExchange.getAttachment(CHAIN_ID); List<HttpHandler> handlersForId = handlerListById.get(chainId); Integer nextIndex = httpServerExchange.getAttachment(CHAIN_SEQ); // Check if we've reached the end of the chain. if (nextIndex < handlersForId.size()) { httpServerExchange.putAttachment(CHAIN_SEQ, nextIndex + 1); // depends on control dependency: [if], data = [none] return handlersForId.get(nextIndex); // depends on control dependency: [if], data = [(nextIndex] } return null; } }
public class class_name { public void marshall(ResourceIdentifier resourceIdentifier, ProtocolMarshaller protocolMarshaller) { if (resourceIdentifier == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourceIdentifier.getResourceArn(), RESOURCEARN_BINDING); protocolMarshaller.marshall(resourceIdentifier.getResourceType(), RESOURCETYPE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ResourceIdentifier resourceIdentifier, ProtocolMarshaller protocolMarshaller) { if (resourceIdentifier == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourceIdentifier.getResourceArn(), RESOURCEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourceIdentifier.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { static void constructAvgHitsGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults, JSONObject scenarioGraphData) { Map<Integer, WholeRunResult> avgHitsPerSec = scenarioResults.getValue().getAverageHitsPerSecondResults(); JSONObject avgHitsPerSecGraphSet = extractWholeRunSlaResult(avgHitsPerSec, "Hits/Sec"); if (!avgHitsPerSecGraphSet.getJSONArray(LABELS).isEmpty()) { avgHitsPerSecGraphSet.put(TITLE, "Average Hits per Second"); avgHitsPerSecGraphSet.put(X_AXIS_TITLE, "Build number"); avgHitsPerSecGraphSet.put(Y_AXIS_TITLE, "Hits"); avgHitsPerSecGraphSet.put(DESCRIPTION, "Displays the number of hits made on the Web server by Vusers " + "during each second of the load test. This graph helps you evaluate the amount of load " + "Vusers" + " " + "generate, in terms of the number of hits."); scenarioGraphData.put("avgHitsPerSec", avgHitsPerSecGraphSet); } } }
public class class_name { static void constructAvgHitsGraph(Map.Entry<String, LrProjectScenarioResults> scenarioResults, JSONObject scenarioGraphData) { Map<Integer, WholeRunResult> avgHitsPerSec = scenarioResults.getValue().getAverageHitsPerSecondResults(); JSONObject avgHitsPerSecGraphSet = extractWholeRunSlaResult(avgHitsPerSec, "Hits/Sec"); if (!avgHitsPerSecGraphSet.getJSONArray(LABELS).isEmpty()) { avgHitsPerSecGraphSet.put(TITLE, "Average Hits per Second"); // depends on control dependency: [if], data = [none] avgHitsPerSecGraphSet.put(X_AXIS_TITLE, "Build number"); // depends on control dependency: [if], data = [none] avgHitsPerSecGraphSet.put(Y_AXIS_TITLE, "Hits"); // depends on control dependency: [if], data = [none] avgHitsPerSecGraphSet.put(DESCRIPTION, "Displays the number of hits made on the Web server by Vusers " + "during each second of the load test. This graph helps you evaluate the amount of load " + "Vusers" + " " + "generate, in terms of the number of hits."); // depends on control dependency: [if], data = [none] scenarioGraphData.put("avgHitsPerSec", avgHitsPerSecGraphSet); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void createSearchResultsCache() { final String METHODNAME = "createSearchResultsCache"; if (iSearchResultsCacheEnabled) { if (FactoryManager.getCacheUtil().isCacheAvailable()) { iSearchResultsCache = FactoryManager.getCacheUtil().initialize("SearchResultsCache", iSearchResultsCacheSize, iSearchResultsCacheSize, iSearchResultsCacheTimeOut); if (iSearchResultsCache != null) { if (tc.isDebugEnabled()) { StringBuilder strBuf = new StringBuilder(METHODNAME); strBuf.append(" \nSearch Results Cache: ").append(iSearchResultsCacheName).append(" is enabled:\n"); strBuf.append("\tCacheSize: ").append(iSearchResultsCacheSize).append("\n"); strBuf.append("\tCacheTimeOut: ").append(iSearchResultsCacheTimeOut).append("\n"); strBuf.append("\tCacheResultSizeLimit: ").append(iSearchResultSizeLmit).append("\n"); Tr.debug(tc, strBuf.toString()); } } } } } }
public class class_name { private void createSearchResultsCache() { final String METHODNAME = "createSearchResultsCache"; if (iSearchResultsCacheEnabled) { if (FactoryManager.getCacheUtil().isCacheAvailable()) { iSearchResultsCache = FactoryManager.getCacheUtil().initialize("SearchResultsCache", iSearchResultsCacheSize, iSearchResultsCacheSize, iSearchResultsCacheTimeOut); // depends on control dependency: [if], data = [none] if (iSearchResultsCache != null) { if (tc.isDebugEnabled()) { StringBuilder strBuf = new StringBuilder(METHODNAME); strBuf.append(" \nSearch Results Cache: ").append(iSearchResultsCacheName).append(" is enabled:\n"); // depends on control dependency: [if], data = [none] strBuf.append("\tCacheSize: ").append(iSearchResultsCacheSize).append("\n"); // depends on control dependency: [if], data = [none] strBuf.append("\tCacheTimeOut: ").append(iSearchResultsCacheTimeOut).append("\n"); // depends on control dependency: [if], data = [none] strBuf.append("\tCacheResultSizeLimit: ").append(iSearchResultSizeLmit).append("\n"); // depends on control dependency: [if], data = [none] Tr.debug(tc, strBuf.toString()); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { public static JavaType findRootType(JavaType contentType) { if (contentType.hasGenericTypes()) { return findRootType(contentType.containedType(0)); } else { return contentType; } } }
public class class_name { public static JavaType findRootType(JavaType contentType) { if (contentType.hasGenericTypes()) { return findRootType(contentType.containedType(0)); // depends on control dependency: [if], data = [none] } else { return contentType; // depends on control dependency: [if], data = [none] } } }
public class class_name { public CommandAndIPAddress getCommandAndIPAddress() { CommandAndIPAddress command = null; synchronized(this) { if (commandQueue.size() > 0) { command = commandQueue.remove(0); } } return command; } }
public class class_name { public CommandAndIPAddress getCommandAndIPAddress() { CommandAndIPAddress command = null; synchronized(this) { if (commandQueue.size() > 0) { command = commandQueue.remove(0); // depends on control dependency: [if], data = [0)] } } return command; } }
public class class_name { public final void mOR() throws RecognitionException { try { int _type = OR; int _channel = DEFAULT_TOKEN_CHANNEL; // druidG.g:632:5: ( ( 'OR' | 'or' ) ) // druidG.g:632:7: ( 'OR' | 'or' ) { // druidG.g:632:7: ( 'OR' | 'or' ) int alt21=2; int LA21_0 = input.LA(1); if ( (LA21_0=='O') ) { alt21=1; } else if ( (LA21_0=='o') ) { alt21=2; } else { NoViableAltException nvae = new NoViableAltException("", 21, 0, input); throw nvae; } switch (alt21) { case 1 : // druidG.g:632:8: 'OR' { match("OR"); } break; case 2 : // druidG.g:632:13: 'or' { match("or"); } break; } } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } }
public class class_name { public final void mOR() throws RecognitionException { try { int _type = OR; int _channel = DEFAULT_TOKEN_CHANNEL; // druidG.g:632:5: ( ( 'OR' | 'or' ) ) // druidG.g:632:7: ( 'OR' | 'or' ) { // druidG.g:632:7: ( 'OR' | 'or' ) int alt21=2; int LA21_0 = input.LA(1); if ( (LA21_0=='O') ) { alt21=1; // depends on control dependency: [if], data = [none] } else if ( (LA21_0=='o') ) { alt21=2; // depends on control dependency: [if], data = [none] } else { NoViableAltException nvae = new NoViableAltException("", 21, 0, input); throw nvae; } switch (alt21) { case 1 : // druidG.g:632:8: 'OR' { match("OR"); } break; case 2 : // druidG.g:632:13: 'or' { match("or"); } break; } } state.type = _type; state.channel = _channel; } finally { // do for sure before leaving } } }
public class class_name { public static void modify(FedoraAPIMMTOM APIM, Uploader UPLOADER, FedoraAPIAMTOM APIA, String directivesFilePath, String logFilePath, boolean isValidateOnly) { InputStream in = null; BatchModifyParser bmp = null; BatchModifyValidator bmv = null; long st = System.currentTimeMillis(); long et = 0; try { in = new FileInputStream(directivesFilePath); if (isValidateOnly) { openLog(logFilePath, "validate-modify-directives"); bmv = new BatchModifyValidator(in, s_log); } else { openLog(logFilePath, "modify-batch"); bmp = new BatchModifyParser(UPLOADER, APIM, APIA, in, s_log); } } catch (Exception e) { System.out.println(e.getClass().getName() + " - " + (e.getMessage() == null ? "(no detail provided)" : e .getMessage())); } finally { try { if (in != null) { in.close(); } if (s_log != null) { et = System.currentTimeMillis(); if (bmp != null) { if (bmp.getFailedCount() == -1) { System.out .println("\n\n" + bmp.getSucceededCount() + " modify directives successfully processed.\n" + "Parser error encountered.\n" + "An unknown number of modify directives were not processed.\n" + "See log file for details of those directives processed before the error.\n" + "Time elapsed: " + getDuration(et - st)); s_log.println(" <summary>"); s_log .println(" " + StreamUtility .enc(bmp .getSucceededCount() + " modify directives successfully processed.\n" + " Parser error encountered.\n" + " An unknown number of modify directives were not processed.\n" + " Time elapsed: " + getDuration(et - st))); s_log.println(" </summary>"); } else { System.out .println("\n\n" + bmp.getSucceededCount() + " modify directives successfully processed.\n" + bmp.getFailedCount() + " modify directives failed.\n" + "See log file for details.\n" + "Time elapsed: " + getDuration(et - st)); s_log.println(" <summary>"); s_log .println(" " + StreamUtility .enc(bmp .getSucceededCount() + " modify directives successfully processed.\n " + bmp .getFailedCount() + " modify directives failed.\n" + " Time elapsed: " + getDuration(et - st))); s_log.println(" </summary>"); } } else if (bmv != null) { et = System.currentTimeMillis(); if (bmv.isValid()) { System.out .println("Modify Directives File in \n" + directivesFilePath + "\n is Valid !" + "\nTime elapsed: " + getDuration(et - st)); s_log.println(" <summary>"); s_log.println(" Modify Directives File: \n " + directivesFilePath + "\n is Valid !" + "\n Time elapsed: " + getDuration(et - st)); s_log.println(" </summary>"); } else { System.out .println(bmv.getErrorCount() + " XML validation Errors found in Modify Directives file.\n" + "See log file for details.\n" + "Time elapsed: " + getDuration(et - st)); s_log.println(" <summary>"); s_log .println(" " + StreamUtility .enc(bmv.getErrorCount() + " XML validation Errors found in Modify Directives file.\n" + " See log file for details.\n" + " Time elapsed: " + getDuration(et - st))); s_log.println(" </summary>"); } } closeLog(); System.out.println("A detailed log file was created at\n" + logFilePath + "\n\n"); } } catch (Exception e) { System.out.println(e.getClass().getName() + " - " + (e.getMessage() == null ? "(no detail provided)" : e .getMessage())); } } } }
public class class_name { public static void modify(FedoraAPIMMTOM APIM, Uploader UPLOADER, FedoraAPIAMTOM APIA, String directivesFilePath, String logFilePath, boolean isValidateOnly) { InputStream in = null; BatchModifyParser bmp = null; BatchModifyValidator bmv = null; long st = System.currentTimeMillis(); long et = 0; try { in = new FileInputStream(directivesFilePath); // depends on control dependency: [try], data = [none] if (isValidateOnly) { openLog(logFilePath, "validate-modify-directives"); // depends on control dependency: [if], data = [none] bmv = new BatchModifyValidator(in, s_log); // depends on control dependency: [if], data = [none] } else { openLog(logFilePath, "modify-batch"); // depends on control dependency: [if], data = [none] bmp = new BatchModifyParser(UPLOADER, APIM, APIA, in, s_log); // depends on control dependency: [if], data = [none] } } catch (Exception e) { System.out.println(e.getClass().getName() + " - " + (e.getMessage() == null ? "(no detail provided)" : e .getMessage())); } finally { // depends on control dependency: [catch], data = [none] try { if (in != null) { in.close(); // depends on control dependency: [if], data = [none] } if (s_log != null) { et = System.currentTimeMillis(); // depends on control dependency: [if], data = [none] if (bmp != null) { if (bmp.getFailedCount() == -1) { System.out .println("\n\n" + bmp.getSucceededCount() + " modify directives successfully processed.\n" + "Parser error encountered.\n" + "An unknown number of modify directives were not processed.\n" + "See log file for details of those directives processed before the error.\n" + "Time elapsed: " + getDuration(et - st)); // depends on control dependency: [if], data = [none] s_log.println(" <summary>"); s_log .println(" " + StreamUtility .enc(bmp .getSucceededCount() + " modify directives successfully processed.\n" + " Parser error encountered.\n" + " An unknown number of modify directives were not processed.\n" + " Time elapsed: " + getDuration(et - st))); // depends on control dependency: [if], data = [none] s_log.println(" </summary>"); // depends on control dependency: [if], data = [none] } else { System.out .println("\n\n" + bmp.getSucceededCount() + " modify directives successfully processed.\n" + bmp.getFailedCount() + " modify directives failed.\n" + "See log file for details.\n" + "Time elapsed: " + getDuration(et - st)); // depends on control dependency: [if], data = [none] s_log.println(" <summary>"); s_log .println(" " + StreamUtility .enc(bmp .getSucceededCount() + " modify directives successfully processed.\n " + bmp .getFailedCount() + " modify directives failed.\n" + " Time elapsed: " + getDuration(et - st))); // depends on control dependency: [if], data = [none] s_log.println(" </summary>"); // depends on control dependency: [if], data = [none] } } else if (bmv != null) { et = System.currentTimeMillis(); // depends on control dependency: [if], data = [none] if (bmv.isValid()) { System.out .println("Modify Directives File in \n" + directivesFilePath + "\n is Valid !" + "\nTime elapsed: " + getDuration(et - st)); // depends on control dependency: [if], data = [none] s_log.println(" <summary>"); s_log.println(" Modify Directives File: \n " + directivesFilePath + "\n is Valid !" + "\n Time elapsed: " + getDuration(et - st)); // depends on control dependency: [if], data = [none] s_log.println(" </summary>"); // depends on control dependency: [if], data = [none] } else { System.out .println(bmv.getErrorCount() + " XML validation Errors found in Modify Directives file.\n" + "See log file for details.\n" + "Time elapsed: " + getDuration(et - st)); // depends on control dependency: [if], data = [none] s_log.println(" <summary>"); s_log .println(" " + StreamUtility .enc(bmv.getErrorCount() + " XML validation Errors found in Modify Directives file.\n" + " See log file for details.\n" + " Time elapsed: " + getDuration(et - st))); // depends on control dependency: [if], data = [none] s_log.println(" </summary>"); // depends on control dependency: [if], data = [none] } } closeLog(); // depends on control dependency: [if], data = [none] System.out.println("A detailed log file was created at\n" + logFilePath + "\n\n"); // depends on control dependency: [if], data = [none] } } catch (Exception e) { System.out.println(e.getClass().getName() + " - " + (e.getMessage() == null ? "(no detail provided)" : e .getMessage())); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") public <S extends io.sarl.lang.core.Space> S getOrCreateSpaceWithSpec(SpaceID spaceID, Class<? extends SpaceSpecification<S>> spec, Object... creationParams) { synchronized (getSpaceRepositoryMutex()) { final Collection<SpaceID> ispaces = this.spacesBySpec.get(spec); final S firstSpace; if (ispaces == null || ispaces.isEmpty()) { firstSpace = createSpaceInstance(spec, spaceID, true, creationParams); } else { firstSpace = (S) this.spaces.get(ispaces.iterator().next()); } assert firstSpace != null; return firstSpace; } } }
public class class_name { @SuppressWarnings("unchecked") public <S extends io.sarl.lang.core.Space> S getOrCreateSpaceWithSpec(SpaceID spaceID, Class<? extends SpaceSpecification<S>> spec, Object... creationParams) { synchronized (getSpaceRepositoryMutex()) { final Collection<SpaceID> ispaces = this.spacesBySpec.get(spec); final S firstSpace; if (ispaces == null || ispaces.isEmpty()) { firstSpace = createSpaceInstance(spec, spaceID, true, creationParams); // depends on control dependency: [if], data = [none] } else { firstSpace = (S) this.spaces.get(ispaces.iterator().next()); // depends on control dependency: [if], data = [(ispaces] } assert firstSpace != null; return firstSpace; } } }
public class class_name { @SuppressWarnings("unchecked") public int compare(Subject a, Subject b) { int result = 0; Set<Attribute> setA = new TreeSet<Attribute>(ATTRIBUTE_COMPARATOR); setA.addAll(a.getAttributesAsList()); Set<Attribute> setB = new TreeSet<Attribute>(ATTRIBUTE_COMPARATOR); setB.addAll(b.getAttributesAsList()); Iterator<Attribute> iterA = setA.iterator(); Iterator<Attribute> iterB = setB.iterator(); while (iterA.hasNext() && iterB.hasNext()) { Attribute attrA = iterA.next(); Attribute attrB = iterB.next(); result = ATTRIBUTE_COMPARATOR.compare(attrA, attrB); if (result != 0) { return result; } } result = setA.size() - setB.size(); return result; } }
public class class_name { @SuppressWarnings("unchecked") public int compare(Subject a, Subject b) { int result = 0; Set<Attribute> setA = new TreeSet<Attribute>(ATTRIBUTE_COMPARATOR); setA.addAll(a.getAttributesAsList()); Set<Attribute> setB = new TreeSet<Attribute>(ATTRIBUTE_COMPARATOR); setB.addAll(b.getAttributesAsList()); Iterator<Attribute> iterA = setA.iterator(); Iterator<Attribute> iterB = setB.iterator(); while (iterA.hasNext() && iterB.hasNext()) { Attribute attrA = iterA.next(); Attribute attrB = iterB.next(); result = ATTRIBUTE_COMPARATOR.compare(attrA, attrB); // depends on control dependency: [while], data = [none] if (result != 0) { return result; // depends on control dependency: [if], data = [none] } } result = setA.size() - setB.size(); return result; } }
public class class_name { @Override protected void handleTransliterate(Replaceable text, Position offsets, boolean isIncremental) { // start and limit of the input range int start = offsets.start; int limit = offsets.limit; if(start >= limit) { return; } /* * Normalize as short chunks at a time as possible even in * bulk mode, so that styled text is minimally disrupted. * In incremental mode, a chunk that ends with offsets.limit * must not be normalized. * * If it was known that the input text is not styled, then * a bulk mode normalization could be used. * (For details, see the comment in the C++ version.) */ StringBuilder segment = new StringBuilder(); StringBuilder normalized = new StringBuilder(); int c = text.char32At(start); do { int prev = start; // Skip at least one character so we make progress. // c holds the character at start. segment.setLength(0); do { segment.appendCodePoint(c); start += Character.charCount(c); } while(start < limit && !norm2.hasBoundaryBefore(c = text.char32At(start))); if(start == limit && isIncremental && !norm2.hasBoundaryAfter(c)) { // stop in incremental mode when we reach the input limit // in case there are additional characters that could change the // normalization result start=prev; break; } norm2.normalize(segment, normalized); if(!Normalizer2Impl.UTF16Plus.equal(segment, normalized)) { // replace the input chunk with its normalized form text.replace(prev, start, normalized.toString()); // update all necessary indexes accordingly int delta = normalized.length() - (start - prev); start += delta; limit += delta; } } while(start < limit); offsets.start = start; offsets.contextLimit += limit - offsets.limit; offsets.limit = limit; } }
public class class_name { @Override protected void handleTransliterate(Replaceable text, Position offsets, boolean isIncremental) { // start and limit of the input range int start = offsets.start; int limit = offsets.limit; if(start >= limit) { return; // depends on control dependency: [if], data = [none] } /* * Normalize as short chunks at a time as possible even in * bulk mode, so that styled text is minimally disrupted. * In incremental mode, a chunk that ends with offsets.limit * must not be normalized. * * If it was known that the input text is not styled, then * a bulk mode normalization could be used. * (For details, see the comment in the C++ version.) */ StringBuilder segment = new StringBuilder(); StringBuilder normalized = new StringBuilder(); int c = text.char32At(start); do { int prev = start; // Skip at least one character so we make progress. // c holds the character at start. segment.setLength(0); do { segment.appendCodePoint(c); start += Character.charCount(c); } while(start < limit && !norm2.hasBoundaryBefore(c = text.char32At(start))); if(start == limit && isIncremental && !norm2.hasBoundaryAfter(c)) { // stop in incremental mode when we reach the input limit // in case there are additional characters that could change the // normalization result start=prev; // depends on control dependency: [if], data = [none] break; } norm2.normalize(segment, normalized); if(!Normalizer2Impl.UTF16Plus.equal(segment, normalized)) { // replace the input chunk with its normalized form text.replace(prev, start, normalized.toString()); // depends on control dependency: [if], data = [none] // update all necessary indexes accordingly int delta = normalized.length() - (start - prev); start += delta; // depends on control dependency: [if], data = [none] limit += delta; // depends on control dependency: [if], data = [none] } } while(start < limit); offsets.start = start; offsets.contextLimit += limit - offsets.limit; offsets.limit = limit; } }
public class class_name { void logPoolState(String... prefix) { if (logger.isDebugEnabled()) { logger.debug("{} - {}stats (total={}, active={}, idle={}, waiting={})", poolName, (prefix.length > 0 ? prefix[0] : ""), getTotalConnections(), getActiveConnections(), getIdleConnections(), getThreadsAwaitingConnection()); } } }
public class class_name { void logPoolState(String... prefix) { if (logger.isDebugEnabled()) { logger.debug("{} - {}stats (total={}, active={}, idle={}, waiting={})", poolName, (prefix.length > 0 ? prefix[0] : ""), getTotalConnections(), getActiveConnections(), getIdleConnections(), getThreadsAwaitingConnection()); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") public <T> T getValue(final String key) { T val = (T) map.get(key); if (val instanceof Map) { return (T) new JsonObject((Map) val); } if (val instanceof List) { return (T) new JsonArray((List) val); } return val; } }
public class class_name { @SuppressWarnings("unchecked") public <T> T getValue(final String key) { T val = (T) map.get(key); if (val instanceof Map) { return (T) new JsonObject((Map) val); // depends on control dependency: [if], data = [none] } if (val instanceof List) { return (T) new JsonArray((List) val); // depends on control dependency: [if], data = [none] } return val; } }
public class class_name { private Iterator<Record> readBatch(final DeltaPlacement placement, final Collection<Key> keys, final ReadConsistency consistency) { checkNotNull(keys, "keys"); // Convert the keys to ByteBuffer Cassandra row keys List<Map.Entry<ByteBuffer, Key>> rowKeys = Lists.newArrayListWithCapacity(keys.size()); for (Key key : keys) { AstyanaxTable table = (AstyanaxTable) key.getTable(); AstyanaxStorage storage = table.getReadStorage(); rowKeys.add(Maps.immutableEntry(storage.getRowKey(key.getKey()), key)); } // Sort the keys by their byte array encoding to get some locality w/queries. Collections.sort(rowKeys, Ordering.natural().onResultOf(entry -> entry.getKey())); // Group them into batches. Cassandra may have to seek each row so prefer smaller batches. List<List<Map.Entry<ByteBuffer, Key>>> batches = Lists.partition(rowKeys, _driverConfig.getMaxRandomRowsBatchSize()); // This algorithm is arranged such that rows are return in pages with size _fetchSize. The rows are grouped // into row groups by common row key. The first RECORD_CACHE_SIZE rows are cached for the row group // and any remaining rows are cached using soft references. This places an upper bound on the memory // requirements needed while iterating. If at any time a soft reference is lost C* is re-queried to // fetch the missing columns. return Iterators.concat(Iterators.transform(batches.iterator(), rowKeySubset -> { Timer.Context timerCtx = _readBatchTimer.time(); try { return rowQuery(rowKeySubset, consistency, placement); } finally { timerCtx.stop(); } })); } }
public class class_name { private Iterator<Record> readBatch(final DeltaPlacement placement, final Collection<Key> keys, final ReadConsistency consistency) { checkNotNull(keys, "keys"); // Convert the keys to ByteBuffer Cassandra row keys List<Map.Entry<ByteBuffer, Key>> rowKeys = Lists.newArrayListWithCapacity(keys.size()); for (Key key : keys) { AstyanaxTable table = (AstyanaxTable) key.getTable(); AstyanaxStorage storage = table.getReadStorage(); rowKeys.add(Maps.immutableEntry(storage.getRowKey(key.getKey()), key)); // depends on control dependency: [for], data = [key] } // Sort the keys by their byte array encoding to get some locality w/queries. Collections.sort(rowKeys, Ordering.natural().onResultOf(entry -> entry.getKey())); // Group them into batches. Cassandra may have to seek each row so prefer smaller batches. List<List<Map.Entry<ByteBuffer, Key>>> batches = Lists.partition(rowKeys, _driverConfig.getMaxRandomRowsBatchSize()); // This algorithm is arranged such that rows are return in pages with size _fetchSize. The rows are grouped // into row groups by common row key. The first RECORD_CACHE_SIZE rows are cached for the row group // and any remaining rows are cached using soft references. This places an upper bound on the memory // requirements needed while iterating. If at any time a soft reference is lost C* is re-queried to // fetch the missing columns. return Iterators.concat(Iterators.transform(batches.iterator(), rowKeySubset -> { Timer.Context timerCtx = _readBatchTimer.time(); try { return rowQuery(rowKeySubset, consistency, placement); } finally { timerCtx.stop(); } })); } }
public class class_name { private void removeMsg(final AppMsg appMsg) { clearMsg(appMsg); final View view = appMsg.getView(); ViewGroup parent = ((ViewGroup) view.getParent()); if (parent != null) { appMsg.mOutAnimation.setAnimationListener(new OutAnimationListener(appMsg)); view.clearAnimation(); view.startAnimation(appMsg.mOutAnimation); } Message msg = obtainMessage(MESSAGE_DISPLAY); sendMessage(msg); } }
public class class_name { private void removeMsg(final AppMsg appMsg) { clearMsg(appMsg); final View view = appMsg.getView(); ViewGroup parent = ((ViewGroup) view.getParent()); if (parent != null) { appMsg.mOutAnimation.setAnimationListener(new OutAnimationListener(appMsg)); // depends on control dependency: [if], data = [none] view.clearAnimation(); // depends on control dependency: [if], data = [none] view.startAnimation(appMsg.mOutAnimation); // depends on control dependency: [if], data = [none] } Message msg = obtainMessage(MESSAGE_DISPLAY); sendMessage(msg); } }
public class class_name { public static ArrayDBIDs[] randomSplit(DBIDs oids, int p, Random random) { // Fast, and we're single-threaded here anyway. random = random != null ? random : new FastNonThreadsafeRandom(); ArrayModifiableDBIDs ids = newArray(oids); final int size = ids.size(); ArrayDBIDs[] split = new ArrayDBIDs[p]; // Shuffle for(int i = 1; i < size; i++) { ids.swap(i - 1, i + random.nextInt(size - i)); } final int minsize = size / p, // Floor. extra = size % p; // Remainder for(int beg = 0, part = 0; part < p; part++) { // First partitions are smaller, last partitions are larger. final int psize = minsize + ((part < extra) ? 1 : 0); split[part] = ids.slice(beg, beg + psize); beg += psize; } return split; } }
public class class_name { public static ArrayDBIDs[] randomSplit(DBIDs oids, int p, Random random) { // Fast, and we're single-threaded here anyway. random = random != null ? random : new FastNonThreadsafeRandom(); ArrayModifiableDBIDs ids = newArray(oids); final int size = ids.size(); ArrayDBIDs[] split = new ArrayDBIDs[p]; // Shuffle for(int i = 1; i < size; i++) { ids.swap(i - 1, i + random.nextInt(size - i)); // depends on control dependency: [for], data = [i] } final int minsize = size / p, // Floor. extra = size % p; // Remainder for(int beg = 0, part = 0; part < p; part++) { // First partitions are smaller, last partitions are larger. final int psize = minsize + ((part < extra) ? 1 : 0); split[part] = ids.slice(beg, beg + psize); // depends on control dependency: [for], data = [beg] beg += psize; // depends on control dependency: [for], data = [beg] } return split; } }
public class class_name { public SkillDetails withSkillTypes(String... skillTypes) { if (this.skillTypes == null) { setSkillTypes(new java.util.ArrayList<String>(skillTypes.length)); } for (String ele : skillTypes) { this.skillTypes.add(ele); } return this; } }
public class class_name { public SkillDetails withSkillTypes(String... skillTypes) { if (this.skillTypes == null) { setSkillTypes(new java.util.ArrayList<String>(skillTypes.length)); // depends on control dependency: [if], data = [none] } for (String ele : skillTypes) { this.skillTypes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public Object put(String key, Short value) { if (value == null) { stateMap.put(key, Type.NULL); } else { stateMap.put(key, Type.LONG); } return super.put(key, value); } }
public class class_name { public Object put(String key, Short value) { if (value == null) { stateMap.put(key, Type.NULL); // depends on control dependency: [if], data = [none] } else { stateMap.put(key, Type.LONG); // depends on control dependency: [if], data = [none] } return super.put(key, value); } }
public class class_name { private void sendEmptyRequest(String path, String method) throws DatastoreEmulatorException { HttpURLConnection connection = null; try { URL url = new URL(this.host + path); connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod(method); connection.getOutputStream().close(); if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) { throw new DatastoreEmulatorException( String.format( "%s request to %s returned HTTP status %s", method, path, connection.getResponseCode())); } } catch (IOException e) { throw new DatastoreEmulatorException( String.format("Exception connecting to emulator on %s request to %s", method, path), e); } finally { if (connection != null) { connection.disconnect(); } } } }
public class class_name { private void sendEmptyRequest(String path, String method) throws DatastoreEmulatorException { HttpURLConnection connection = null; try { URL url = new URL(this.host + path); connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod(method); connection.getOutputStream().close(); if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) { throw new DatastoreEmulatorException( String.format( "%s request to %s returned HTTP status %s", method, path, connection.getResponseCode())); } } catch (IOException e) { throw new DatastoreEmulatorException( String.format("Exception connecting to emulator on %s request to %s", method, path), e); } finally { if (connection != null) { connection.disconnect(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @CheckResult @NonNull public static PowerAdapter concat(@NonNull PowerAdapter... adapters) { checkNotNull(adapters, "adapters"); if (adapters.length == 0) { return EMPTY; } if (adapters.length == 1) { return adapters[0]; } return new ConcatAdapterBuilder().addAll(adapters).build(); } }
public class class_name { @CheckResult @NonNull public static PowerAdapter concat(@NonNull PowerAdapter... adapters) { checkNotNull(adapters, "adapters"); if (adapters.length == 0) { return EMPTY; // depends on control dependency: [if], data = [none] } if (adapters.length == 1) { return adapters[0]; // depends on control dependency: [if], data = [none] } return new ConcatAdapterBuilder().addAll(adapters).build(); } }
public class class_name { public void marshall(DeleteUserRequest deleteUserRequest, ProtocolMarshaller protocolMarshaller) { if (deleteUserRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteUserRequest.getOrganizationId(), ORGANIZATIONID_BINDING); protocolMarshaller.marshall(deleteUserRequest.getUserId(), USERID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteUserRequest deleteUserRequest, ProtocolMarshaller protocolMarshaller) { if (deleteUserRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteUserRequest.getOrganizationId(), ORGANIZATIONID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteUserRequest.getUserId(), USERID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void read_lock( Key<Job> job_key ) { if( _key != null ) { Log.debug("shared-read-lock "+_key+" by job "+job_key); new ReadLock(job_key).invoke(_key); } } }
public class class_name { public void read_lock( Key<Job> job_key ) { if( _key != null ) { Log.debug("shared-read-lock "+_key+" by job "+job_key); // depends on control dependency: [if], data = [none] new ReadLock(job_key).invoke(_key); // depends on control dependency: [if], data = [none] } } }
public class class_name { public ElementBase realize(ElementBase parent) { if (!deleted && real == null) { real = getDefinition().createElement(parent, null, false); } else if (deleted && real != null) { real.remove(true); real = null; } return real; } }
public class class_name { public ElementBase realize(ElementBase parent) { if (!deleted && real == null) { real = getDefinition().createElement(parent, null, false); // depends on control dependency: [if], data = [none] } else if (deleted && real != null) { real.remove(true); // depends on control dependency: [if], data = [none] real = null; // depends on control dependency: [if], data = [none] } return real; } }
public class class_name { @Override public List<E> subList(int fromIndex, int toIndex) { final ReentrantLock lock = this.lock; lock.lock(); try { Object[] elements = getArray(); int len = elements.length; if (fromIndex < 0 || toIndex > len || fromIndex > toIndex) throw new IndexOutOfBoundsException(); return new COWSubList<E>(this, fromIndex, toIndex); } finally { lock.unlock(); } } }
public class class_name { @Override public List<E> subList(int fromIndex, int toIndex) { final ReentrantLock lock = this.lock; lock.lock(); try { Object[] elements = getArray(); int len = elements.length; if (fromIndex < 0 || toIndex > len || fromIndex > toIndex) throw new IndexOutOfBoundsException(); return new COWSubList<E>(this, fromIndex, toIndex); // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } } }
public class class_name { private static List<String> dedup(List<String> encoded, Map<String, Integer> nameToLastIndex) { boolean[] isLastInstance = new boolean[encoded.size()]; for (int idx : nameToLastIndex.values()) { isLastInstance[idx] = true; } List<String> dedupd = new ArrayList<String>(nameToLastIndex.size()); for (int i = 0, n = encoded.size(); i < n; i++) { if (isLastInstance[i]) { dedupd.add(encoded.get(i)); } } return dedupd; } }
public class class_name { private static List<String> dedup(List<String> encoded, Map<String, Integer> nameToLastIndex) { boolean[] isLastInstance = new boolean[encoded.size()]; for (int idx : nameToLastIndex.values()) { isLastInstance[idx] = true; // depends on control dependency: [for], data = [idx] } List<String> dedupd = new ArrayList<String>(nameToLastIndex.size()); for (int i = 0, n = encoded.size(); i < n; i++) { if (isLastInstance[i]) { dedupd.add(encoded.get(i)); // depends on control dependency: [if], data = [none] } } return dedupd; } }
public class class_name { public static RoleBean unmarshallRole(Map<String, Object> source) { if (source == null) { return null; } RoleBean bean = new RoleBean(); bean.setId(asString(source.get("id"))); bean.setName(asString(source.get("name"))); bean.setDescription(asString(source.get("description"))); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setCreatedOn(asDate(source.get("createdOn"))); bean.setAutoGrant(asBoolean(source.get("autoGrant"))); @SuppressWarnings("unchecked") List<Object> permissions = (List<Object>) source.get("permissions"); if (permissions != null && !permissions.isEmpty()) { bean.setPermissions(new HashSet<>()); for (Object permission : permissions) { bean.getPermissions().add(asEnum(permission, PermissionType.class)); } } postMarshall(bean); return bean; } }
public class class_name { public static RoleBean unmarshallRole(Map<String, Object> source) { if (source == null) { return null; // depends on control dependency: [if], data = [none] } RoleBean bean = new RoleBean(); bean.setId(asString(source.get("id"))); bean.setName(asString(source.get("name"))); bean.setDescription(asString(source.get("description"))); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setCreatedOn(asDate(source.get("createdOn"))); bean.setAutoGrant(asBoolean(source.get("autoGrant"))); @SuppressWarnings("unchecked") List<Object> permissions = (List<Object>) source.get("permissions"); if (permissions != null && !permissions.isEmpty()) { bean.setPermissions(new HashSet<>()); // depends on control dependency: [if], data = [none] for (Object permission : permissions) { bean.getPermissions().add(asEnum(permission, PermissionType.class)); // depends on control dependency: [for], data = [permission] } } postMarshall(bean); return bean; } }
public class class_name { public static String rset(String input, int width) { String result; // result to return StringBuilder pad = new StringBuilder(); if (input == null) { for (int i = 0; i < width - 1; i++) { pad.append(' '); // put blanks into buffer } result = " " + pad; // one short to use + overload } else { if (input.length() >= width) { result = input.substring(0, width); // when input is too long, truncate } else { int padLength = width - input.length(); // number of blanks to add for (int i = 0; i < padLength; i++) { pad.append(' '); // actually put blanks into buffer } result = pad + input; // concatenate } } return result; } }
public class class_name { public static String rset(String input, int width) { String result; // result to return StringBuilder pad = new StringBuilder(); if (input == null) { for (int i = 0; i < width - 1; i++) { pad.append(' '); // put blanks into buffer // depends on control dependency: [for], data = [none] } result = " " + pad; // one short to use + overload // depends on control dependency: [if], data = [none] } else { if (input.length() >= width) { result = input.substring(0, width); // when input is too long, truncate // depends on control dependency: [if], data = [none] } else { int padLength = width - input.length(); // number of blanks to add for (int i = 0; i < padLength; i++) { pad.append(' '); // actually put blanks into buffer // depends on control dependency: [for], data = [none] } result = pad + input; // concatenate // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { Duration addDays(final int amount) { Duration duration; if (amount < 0) { duration = getDatatypeFactory().newDuration(false, 0, 0, Math.abs(amount), 0, 0, 0); } else { duration = getDatatypeFactory().newDuration(true, 0, 0, amount, 0, 0, 0); } return duration; } }
public class class_name { Duration addDays(final int amount) { Duration duration; if (amount < 0) { duration = getDatatypeFactory().newDuration(false, 0, 0, Math.abs(amount), 0, 0, 0); // depends on control dependency: [if], data = [(amount] } else { duration = getDatatypeFactory().newDuration(true, 0, 0, amount, 0, 0, 0); // depends on control dependency: [if], data = [0)] } return duration; } }
public class class_name { public void Divide(double scalar) { if (scalar == 0) { try { throw new ArithmeticException("Can not divide by zero."); } catch (Exception e) { e.printStackTrace(); } } this.real /= scalar; this.imaginary /= scalar; } }
public class class_name { public void Divide(double scalar) { if (scalar == 0) { try { throw new ArithmeticException("Can not divide by zero."); } catch (Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } this.real /= scalar; this.imaginary /= scalar; } }
public class class_name { public static int getLoadReg(DismantleBytecode dbc, int seen) { if ((seen == Const.ALOAD) || (seen == Const.ILOAD) || (seen == Const.LLOAD) || (seen == Const.FLOAD) || (seen == Const.DLOAD)) { return dbc.getRegisterOperand(); } if (OpcodeUtils.isILoad(seen)) { return seen - Const.ILOAD_0; } else if (OpcodeUtils.isLLoad(seen)) { return seen - Const.LLOAD_0; } else if (OpcodeUtils.isFLoad(seen)) { return seen - Const.FLOAD_0; } else if (OpcodeUtils.isDLoad(seen)) { return seen - Const.DLOAD_0; } else if (OpcodeUtils.isALoad(seen)) { return seen - Const.ALOAD_0; } return -1; } }
public class class_name { public static int getLoadReg(DismantleBytecode dbc, int seen) { if ((seen == Const.ALOAD) || (seen == Const.ILOAD) || (seen == Const.LLOAD) || (seen == Const.FLOAD) || (seen == Const.DLOAD)) { return dbc.getRegisterOperand(); // depends on control dependency: [if], data = [none] } if (OpcodeUtils.isILoad(seen)) { return seen - Const.ILOAD_0; // depends on control dependency: [if], data = [none] } else if (OpcodeUtils.isLLoad(seen)) { return seen - Const.LLOAD_0; // depends on control dependency: [if], data = [none] } else if (OpcodeUtils.isFLoad(seen)) { return seen - Const.FLOAD_0; // depends on control dependency: [if], data = [none] } else if (OpcodeUtils.isDLoad(seen)) { return seen - Const.DLOAD_0; // depends on control dependency: [if], data = [none] } else if (OpcodeUtils.isALoad(seen)) { return seen - Const.ALOAD_0; // depends on control dependency: [if], data = [none] } return -1; } }
public class class_name { private void computePartialChunkCrc(long blkoff, long ckoff, int bytesPerChecksum, DataChecksum checksum) throws IOException { // find offset of the beginning of partial chunk. // int sizePartialChunk = (int) (blkoff % bytesPerChecksum); int checksumSize = checksum.getChecksumSize(); blkoff = blkoff - sizePartialChunk; LOG.info("computePartialChunkCrc sizePartialChunk " + sizePartialChunk + " block " + block + " offset in block " + blkoff + " offset in metafile " + ckoff); // create an input stream from the block file // and read in partial crc chunk into temporary buffer // byte[] buf = new byte[sizePartialChunk]; byte[] crcbuf = new byte[checksumSize]; FileInputStream dataIn = null, metaIn = null; try { DatanodeBlockInfo info = datanode.data.getDatanodeBlockInfo(namespaceId, block); if (info == null) { throw new IOException("Block " + block + " does not exist in volumeMap."); } File blockFile = info.getDataFileToRead(); if (blockFile == null) { blockFile = info.getBlockDataFile().getTmpFile(namespaceId, block); } RandomAccessFile blockInFile = new RandomAccessFile(blockFile, "r"); if (blkoff > 0) { blockInFile.seek(blkoff); } File metaFile = getMetaFile(blockFile, block); RandomAccessFile metaInFile = new RandomAccessFile(metaFile, "r"); if (ckoff > 0) { metaInFile.seek(ckoff); } dataIn = new FileInputStream(blockInFile.getFD()); metaIn = new FileInputStream(metaInFile.getFD()); IOUtils.readFully(dataIn, buf, 0, sizePartialChunk); // open meta file and read in crc value computer earlier IOUtils.readFully(metaIn, crcbuf, 0, crcbuf.length); } finally { if (dataIn != null) { dataIn.close(); } if (metaIn != null) { metaIn.close(); } } // compute crc of partial chunk from data read in the block file. Checksum partialCrc = new NativeCrc32(); partialCrc.update(buf, 0, sizePartialChunk); LOG.info("Read in partial CRC chunk from disk for block " + block); // paranoia! verify that the pre-computed crc matches what we // recalculated just now if (partialCrc.getValue() != FSInputChecker.checksum2long(crcbuf)) { String msg = "Partial CRC " + partialCrc.getValue() + " does not match value computed the " + " last time file was closed " + FSInputChecker.checksum2long(crcbuf); throw new IOException(msg); } // LOG.debug("Partial CRC matches 0x" + // Long.toHexString(partialCrc.getValue())); partialCrcInt = (int) partialCrc.getValue(); } }
public class class_name { private void computePartialChunkCrc(long blkoff, long ckoff, int bytesPerChecksum, DataChecksum checksum) throws IOException { // find offset of the beginning of partial chunk. // int sizePartialChunk = (int) (blkoff % bytesPerChecksum); int checksumSize = checksum.getChecksumSize(); blkoff = blkoff - sizePartialChunk; LOG.info("computePartialChunkCrc sizePartialChunk " + sizePartialChunk + " block " + block + " offset in block " + blkoff + " offset in metafile " + ckoff); // create an input stream from the block file // and read in partial crc chunk into temporary buffer // byte[] buf = new byte[sizePartialChunk]; byte[] crcbuf = new byte[checksumSize]; FileInputStream dataIn = null, metaIn = null; try { DatanodeBlockInfo info = datanode.data.getDatanodeBlockInfo(namespaceId, block); if (info == null) { throw new IOException("Block " + block + " does not exist in volumeMap."); } File blockFile = info.getDataFileToRead(); if (blockFile == null) { blockFile = info.getBlockDataFile().getTmpFile(namespaceId, block); // depends on control dependency: [if], data = [none] } RandomAccessFile blockInFile = new RandomAccessFile(blockFile, "r"); if (blkoff > 0) { blockInFile.seek(blkoff); // depends on control dependency: [if], data = [(blkoff] } File metaFile = getMetaFile(blockFile, block); RandomAccessFile metaInFile = new RandomAccessFile(metaFile, "r"); if (ckoff > 0) { metaInFile.seek(ckoff); // depends on control dependency: [if], data = [(ckoff] } dataIn = new FileInputStream(blockInFile.getFD()); metaIn = new FileInputStream(metaInFile.getFD()); IOUtils.readFully(dataIn, buf, 0, sizePartialChunk); // open meta file and read in crc value computer earlier IOUtils.readFully(metaIn, crcbuf, 0, crcbuf.length); } finally { if (dataIn != null) { dataIn.close(); // depends on control dependency: [if], data = [none] } if (metaIn != null) { metaIn.close(); // depends on control dependency: [if], data = [none] } } // compute crc of partial chunk from data read in the block file. Checksum partialCrc = new NativeCrc32(); partialCrc.update(buf, 0, sizePartialChunk); LOG.info("Read in partial CRC chunk from disk for block " + block); // paranoia! verify that the pre-computed crc matches what we // recalculated just now if (partialCrc.getValue() != FSInputChecker.checksum2long(crcbuf)) { String msg = "Partial CRC " + partialCrc.getValue() + " does not match value computed the " + " last time file was closed " + FSInputChecker.checksum2long(crcbuf); throw new IOException(msg); } // LOG.debug("Partial CRC matches 0x" + // Long.toHexString(partialCrc.getValue())); partialCrcInt = (int) partialCrc.getValue(); } }
public class class_name { public void marshall(MergeDeveloperIdentitiesRequest mergeDeveloperIdentitiesRequest, ProtocolMarshaller protocolMarshaller) { if (mergeDeveloperIdentitiesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(mergeDeveloperIdentitiesRequest.getSourceUserIdentifier(), SOURCEUSERIDENTIFIER_BINDING); protocolMarshaller.marshall(mergeDeveloperIdentitiesRequest.getDestinationUserIdentifier(), DESTINATIONUSERIDENTIFIER_BINDING); protocolMarshaller.marshall(mergeDeveloperIdentitiesRequest.getDeveloperProviderName(), DEVELOPERPROVIDERNAME_BINDING); protocolMarshaller.marshall(mergeDeveloperIdentitiesRequest.getIdentityPoolId(), IDENTITYPOOLID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(MergeDeveloperIdentitiesRequest mergeDeveloperIdentitiesRequest, ProtocolMarshaller protocolMarshaller) { if (mergeDeveloperIdentitiesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(mergeDeveloperIdentitiesRequest.getSourceUserIdentifier(), SOURCEUSERIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(mergeDeveloperIdentitiesRequest.getDestinationUserIdentifier(), DESTINATIONUSERIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(mergeDeveloperIdentitiesRequest.getDeveloperProviderName(), DEVELOPERPROVIDERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(mergeDeveloperIdentitiesRequest.getIdentityPoolId(), IDENTITYPOOLID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private String alignINClause(String in) { String paramIn = in; final int indexLowerIn = paramIn.indexOf(IN_LOWER); final int indexLowerInWithParentheses = paramIn.indexOf(IN_LOWER_P); final int indexUpperIn = paramIn.indexOf(IN_UPPER); final int indexUpperInWithParentheses = paramIn.indexOf(IN_UPPER_P); // find first occurrence of in clause. final int indexIn = findMinIfNot(indexUpperInWithParentheses, findMinIfNot(indexUpperIn, findMinIfNot(indexLowerIn, indexLowerInWithParentheses, NO_INDEX), NO_INDEX), NO_INDEX ); if (indexIn > NO_INDEX && (indexIn == indexLowerInWithParentheses || indexIn == indexUpperInWithParentheses)) { // 3 is the size of param in ending with a parentheses. // add SPLIT_EXPRESSION paramIn = paramIn.substring(0, indexIn + 3) + SPLIT_EXPRESSION + paramIn.substring(indexIn + 3); } String sql = paramIn; if (indexIn != NO_INDEX) { final int indexOpen = paramIn.indexOf('(', indexIn); final int indexClose = paramIn.indexOf(')', indexOpen); String sub = paramIn.substring(indexOpen, indexClose + 1); sub = sub.replaceAll(" ", ""); sql = paramIn.substring(0, indexOpen) + sub + alignINClause(paramIn.substring(indexClose + 1)); } return sql; } }
public class class_name { private String alignINClause(String in) { String paramIn = in; final int indexLowerIn = paramIn.indexOf(IN_LOWER); final int indexLowerInWithParentheses = paramIn.indexOf(IN_LOWER_P); final int indexUpperIn = paramIn.indexOf(IN_UPPER); final int indexUpperInWithParentheses = paramIn.indexOf(IN_UPPER_P); // find first occurrence of in clause. final int indexIn = findMinIfNot(indexUpperInWithParentheses, findMinIfNot(indexUpperIn, findMinIfNot(indexLowerIn, indexLowerInWithParentheses, NO_INDEX), NO_INDEX), NO_INDEX ); if (indexIn > NO_INDEX && (indexIn == indexLowerInWithParentheses || indexIn == indexUpperInWithParentheses)) { // 3 is the size of param in ending with a parentheses. // add SPLIT_EXPRESSION paramIn = paramIn.substring(0, indexIn + 3) + SPLIT_EXPRESSION + paramIn.substring(indexIn + 3); // depends on control dependency: [if], data = [none] } String sql = paramIn; if (indexIn != NO_INDEX) { final int indexOpen = paramIn.indexOf('(', indexIn); final int indexClose = paramIn.indexOf(')', indexOpen); String sub = paramIn.substring(indexOpen, indexClose + 1); sub = sub.replaceAll(" ", ""); // depends on control dependency: [if], data = [none] sql = paramIn.substring(0, indexOpen) + sub + alignINClause(paramIn.substring(indexClose + 1)); // depends on control dependency: [if], data = [none] } return sql; } }
public class class_name { @Override public List<ScopNode> getTree(ScopDomain domain){ ScopNode node = getScopNode(domain.getSunid()); List<ScopNode> tree = new ArrayList<ScopNode>(); while (node != null){ //System.out.println("This node: sunid:" + node.getSunid() ); //System.out.println(getScopDescriptionBySunid(node.getSunid())); node = getScopNode(node.getParentSunid()); if ( node != null) tree.add(node); } Collections.reverse(tree); return tree; } }
public class class_name { @Override public List<ScopNode> getTree(ScopDomain domain){ ScopNode node = getScopNode(domain.getSunid()); List<ScopNode> tree = new ArrayList<ScopNode>(); while (node != null){ //System.out.println("This node: sunid:" + node.getSunid() ); //System.out.println(getScopDescriptionBySunid(node.getSunid())); node = getScopNode(node.getParentSunid()); // depends on control dependency: [while], data = [(node] if ( node != null) tree.add(node); } Collections.reverse(tree); return tree; } }
public class class_name { public ServiceCall<Void> deleteAudio(DeleteAudioOptions deleteAudioOptions) { Validator.notNull(deleteAudioOptions, "deleteAudioOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations", "audio" }; String[] pathParameters = { deleteAudioOptions.customizationId(), deleteAudioOptions.audioName() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteAudio"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); return createServiceCall(builder.build(), ResponseConverterUtils.getVoid()); } }
public class class_name { public ServiceCall<Void> deleteAudio(DeleteAudioOptions deleteAudioOptions) { Validator.notNull(deleteAudioOptions, "deleteAudioOptions cannot be null"); String[] pathSegments = { "v1/acoustic_customizations", "audio" }; String[] pathParameters = { deleteAudioOptions.customizationId(), deleteAudioOptions.audioName() }; RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters)); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "deleteAudio"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } builder.header("Accept", "application/json"); return createServiceCall(builder.build(), ResponseConverterUtils.getVoid()); } }
public class class_name { public @CheckForNull XClass getXClass(ClassDescriptor classDescriptor) { try { IAnalysisCache analysisCache = Global.getAnalysisCache(); return analysisCache.getClassAnalysis(XClass.class, classDescriptor); } catch (CheckedAnalysisException e) { return null; } } }
public class class_name { public @CheckForNull XClass getXClass(ClassDescriptor classDescriptor) { try { IAnalysisCache analysisCache = Global.getAnalysisCache(); return analysisCache.getClassAnalysis(XClass.class, classDescriptor); // depends on control dependency: [try], data = [none] } catch (CheckedAnalysisException e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public <T1, T2> void op(BinaryOp op, Local<T1> target, Local<T1> a, Local<T2> b) { Rop rop = op.rop(StdTypeList.make(a.type.ropType, b.type.ropType)); RegisterSpecList sources = RegisterSpecList.make(a.spec(), b.spec()); if (rop.getBranchingness() == BRANCH_NONE) { addInstruction(new PlainInsn(rop, sourcePosition, target.spec(), sources)); } else { addInstruction(new ThrowingInsn(rop, sourcePosition, sources, catches)); moveResult(target, true); } } }
public class class_name { public <T1, T2> void op(BinaryOp op, Local<T1> target, Local<T1> a, Local<T2> b) { Rop rop = op.rop(StdTypeList.make(a.type.ropType, b.type.ropType)); RegisterSpecList sources = RegisterSpecList.make(a.spec(), b.spec()); if (rop.getBranchingness() == BRANCH_NONE) { addInstruction(new PlainInsn(rop, sourcePosition, target.spec(), sources)); // depends on control dependency: [if], data = [none] } else { addInstruction(new ThrowingInsn(rop, sourcePosition, sources, catches)); // depends on control dependency: [if], data = [none] moveResult(target, true); // depends on control dependency: [if], data = [none] } } }
public class class_name { public BigMoney minusRetainScale(BigDecimal amountToSubtract, RoundingMode roundingMode) { MoneyUtils.checkNotNull(amountToSubtract, "Amount must not be null"); if (amountToSubtract.compareTo(BigDecimal.ZERO) == 0) { return this; } BigDecimal newAmount = amount.subtract(amountToSubtract); newAmount = newAmount.setScale(getScale(), roundingMode); return BigMoney.of(currency, newAmount); } }
public class class_name { public BigMoney minusRetainScale(BigDecimal amountToSubtract, RoundingMode roundingMode) { MoneyUtils.checkNotNull(amountToSubtract, "Amount must not be null"); if (amountToSubtract.compareTo(BigDecimal.ZERO) == 0) { return this; // depends on control dependency: [if], data = [none] } BigDecimal newAmount = amount.subtract(amountToSubtract); newAmount = newAmount.setScale(getScale(), roundingMode); return BigMoney.of(currency, newAmount); } }
public class class_name { protected Promise disconnect() { if (client == null) { status.set(STATUS_DISCONNECTED); return Promise.resolve(); } status.set(STATUS_DISCONNECTING); return client.disconnect().then(ok -> { status.set(STATUS_DISCONNECTED); }).catchError(cause -> { logger.error("Unable to disconnect Redis server!", cause); return Promise.resolve(); }); } }
public class class_name { protected Promise disconnect() { if (client == null) { status.set(STATUS_DISCONNECTED); // depends on control dependency: [if], data = [none] return Promise.resolve(); // depends on control dependency: [if], data = [none] } status.set(STATUS_DISCONNECTING); return client.disconnect().then(ok -> { status.set(STATUS_DISCONNECTED); }).catchError(cause -> { logger.error("Unable to disconnect Redis server!", cause); return Promise.resolve(); }); } }
public class class_name { private static OWLValueObject buildFromClasAndCollection(OWLModel model, OWLURIClass uriClass, Collection collection) throws NotYetImplementedException, OWLTranslationException { OWLList<OWLIndividual> owlList = ObjectOWLSTranslator.owlListFromOWLModel(model); Object[] collectionAsArray = collection.toArray(); for (int i = collectionAsArray.length - 1; i >= 0; i--) { try { owlList = owlList.cons(model.createIndividual( uriClass.getURI(), new URI(ObjectOWLSTranslator.beanToJenaResource(model, collectionAsArray[i]).getURI()))); } catch (URISyntaxException ex) { throw new OWLTranslationException("translating to Jena: ", ex); } } return new OWLValueObject( model, uriClass, owlList); } }
public class class_name { private static OWLValueObject buildFromClasAndCollection(OWLModel model, OWLURIClass uriClass, Collection collection) throws NotYetImplementedException, OWLTranslationException { OWLList<OWLIndividual> owlList = ObjectOWLSTranslator.owlListFromOWLModel(model); Object[] collectionAsArray = collection.toArray(); for (int i = collectionAsArray.length - 1; i >= 0; i--) { try { owlList = owlList.cons(model.createIndividual( uriClass.getURI(), new URI(ObjectOWLSTranslator.beanToJenaResource(model, collectionAsArray[i]).getURI()))); // depends on control dependency: [try], data = [none] } catch (URISyntaxException ex) { throw new OWLTranslationException("translating to Jena: ", ex); } // depends on control dependency: [catch], data = [none] } return new OWLValueObject( model, uriClass, owlList); } }
public class class_name { @Override public final void reset(final long mNodeKey) { super.reset(mNodeKey); if (mParentAxis != null) { mParentAxis.reset(mNodeKey); } if (mChildAxis != null) { mChildAxis.reset(mNodeKey); } mIsFirst = true; } }
public class class_name { @Override public final void reset(final long mNodeKey) { super.reset(mNodeKey); if (mParentAxis != null) { mParentAxis.reset(mNodeKey); // depends on control dependency: [if], data = [none] } if (mChildAxis != null) { mChildAxis.reset(mNodeKey); // depends on control dependency: [if], data = [none] } mIsFirst = true; } }
public class class_name { public LocaleEncodingMappingType<LocaleEncodingMappingListType<T>> getOrCreateLocaleEncodingMapping() { List<Node> nodeList = childNode.get("locale-encoding-mapping"); if (nodeList != null && nodeList.size() > 0) { return new LocaleEncodingMappingTypeImpl<LocaleEncodingMappingListType<T>>(this, "locale-encoding-mapping", childNode, nodeList.get(0)); } return createLocaleEncodingMapping(); } }
public class class_name { public LocaleEncodingMappingType<LocaleEncodingMappingListType<T>> getOrCreateLocaleEncodingMapping() { List<Node> nodeList = childNode.get("locale-encoding-mapping"); if (nodeList != null && nodeList.size() > 0) { return new LocaleEncodingMappingTypeImpl<LocaleEncodingMappingListType<T>>(this, "locale-encoding-mapping", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none] } return createLocaleEncodingMapping(); } }
public class class_name { public Array convertNestedVariable(ucar.nc2.Variable v, List<Range> section, DodsV dataV, boolean flatten) throws IOException, DAP2Exception { Array data = convertTopVariable(v, section, dataV); if (flatten) { ArrayStructure as = (ArrayStructure) data; // make list of names List<String> names = new ArrayList<>(); Variable nested = v; while (nested.isMemberOfStructure()) { names.add( 0, nested.getShortName()); nested = nested.getParentStructure(); } StructureMembers.Member m = findNested(as, names, v.getShortName()); Array mdata = m.getDataArray(); if (mdata instanceof ArraySequenceNested) { // gotta unroll ArraySequenceNested arraySeq = (ArraySequenceNested) mdata; return arraySeq.flatten(); } return mdata; } return data; } }
public class class_name { public Array convertNestedVariable(ucar.nc2.Variable v, List<Range> section, DodsV dataV, boolean flatten) throws IOException, DAP2Exception { Array data = convertTopVariable(v, section, dataV); if (flatten) { ArrayStructure as = (ArrayStructure) data; // make list of names List<String> names = new ArrayList<>(); Variable nested = v; while (nested.isMemberOfStructure()) { names.add( 0, nested.getShortName()); // depends on control dependency: [while], data = [none] nested = nested.getParentStructure(); // depends on control dependency: [while], data = [none] } StructureMembers.Member m = findNested(as, names, v.getShortName()); Array mdata = m.getDataArray(); if (mdata instanceof ArraySequenceNested) { // gotta unroll ArraySequenceNested arraySeq = (ArraySequenceNested) mdata; return arraySeq.flatten(); // depends on control dependency: [if], data = [none] } return mdata; } return data; } }
public class class_name { public List<AutoScalingPolicy> getTriggeredPolicies() { List<AutoScalingPolicy> triggeredPolicies = new ArrayList<>(); for (AutoScalingPolicy policy : group.getScalingPolicies()) { List<TimePoint<Double>> metricValues = getMetricValues(policy.getMetricName()); int triggerCount = 0; int triggerThreshold = 3; int inspectCount = 0; if (metricValues != null && metricValues.size() > 2) { List<TimePoint<Double>> reverse = new ArrayList<>(metricValues); Collections.reverse(reverse); for (TimePoint<Double> p : reverse) { ComparisonOperation op = ComparisonOperation.fromSymbol(policy.getMetricComparison()); if (op.compare(p.getValue(), Double.valueOf(policy.getMetricThreshold()))) { triggerCount++; } inspectCount++; if (inspectCount >= 3) { break; } } if (triggerCount >= triggerThreshold) { triggeredPolicies.add(policy); } } } return triggeredPolicies; } }
public class class_name { public List<AutoScalingPolicy> getTriggeredPolicies() { List<AutoScalingPolicy> triggeredPolicies = new ArrayList<>(); for (AutoScalingPolicy policy : group.getScalingPolicies()) { List<TimePoint<Double>> metricValues = getMetricValues(policy.getMetricName()); int triggerCount = 0; int triggerThreshold = 3; int inspectCount = 0; if (metricValues != null && metricValues.size() > 2) { List<TimePoint<Double>> reverse = new ArrayList<>(metricValues); Collections.reverse(reverse); // depends on control dependency: [if], data = [none] for (TimePoint<Double> p : reverse) { ComparisonOperation op = ComparisonOperation.fromSymbol(policy.getMetricComparison()); if (op.compare(p.getValue(), Double.valueOf(policy.getMetricThreshold()))) { triggerCount++; // depends on control dependency: [if], data = [none] } inspectCount++; // depends on control dependency: [for], data = [p] if (inspectCount >= 3) { break; } } if (triggerCount >= triggerThreshold) { triggeredPolicies.add(policy); // depends on control dependency: [if], data = [none] } } } return triggeredPolicies; } }
public class class_name { public List<Item> deleteAllSelectedItems() { List<Item> deletedItems = new ArrayList<>(); final List<Integer> positions = new ArrayList<>(); mFastAdapter.recursive(new AdapterPredicate<Item>() { @Override public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, Item item, int position) { if (item.isSelected()) { //if it's a subitem remove it from the parent if (item instanceof ISubItem) { //a sub item which is not in the list can be instantly deleted IExpandable parent = (IExpandable) ((ISubItem) item).getParent(); //parent should not be null, but check in any case.. if (parent != null) { parent.getSubItems().remove(item); } } if (position != -1) { //a normal displayed item can only be deleted afterwards positions.add(position); } } return false; } }, false); //we have to re-fetch the selections array again and again as the position will change after one item is deleted for (int i = positions.size() - 1; i >= 0; i--) { FastAdapter.RelativeInfo<Item> ri = mFastAdapter.getRelativeInfo(positions.get(i)); if (ri.item != null && ri.item.isSelected()) { //double verify if (ri.adapter != null && ri.adapter instanceof IItemAdapter) { ((IItemAdapter) ri.adapter).remove(positions.get(i)); } } } return deletedItems; } }
public class class_name { public List<Item> deleteAllSelectedItems() { List<Item> deletedItems = new ArrayList<>(); final List<Integer> positions = new ArrayList<>(); mFastAdapter.recursive(new AdapterPredicate<Item>() { @Override public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, Item item, int position) { if (item.isSelected()) { //if it's a subitem remove it from the parent if (item instanceof ISubItem) { //a sub item which is not in the list can be instantly deleted IExpandable parent = (IExpandable) ((ISubItem) item).getParent(); //parent should not be null, but check in any case.. if (parent != null) { parent.getSubItems().remove(item); // depends on control dependency: [if], data = [none] } } if (position != -1) { //a normal displayed item can only be deleted afterwards positions.add(position); // depends on control dependency: [if], data = [(position] } } return false; } }, false); //we have to re-fetch the selections array again and again as the position will change after one item is deleted for (int i = positions.size() - 1; i >= 0; i--) { FastAdapter.RelativeInfo<Item> ri = mFastAdapter.getRelativeInfo(positions.get(i)); if (ri.item != null && ri.item.isSelected()) { //double verify if (ri.adapter != null && ri.adapter instanceof IItemAdapter) { ((IItemAdapter) ri.adapter).remove(positions.get(i)); // depends on control dependency: [if], data = [none] } } } return deletedItems; } }