code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void setConstantTypesClassesWhiteList(final List<Class> constantTypesWhiteList) {
List<String> values = new LinkedList<String>();
for (Class aClass : constantTypesWhiteList) {
values.add(aClass.getName());
}
setConstantTypesWhiteList(values);
} } | public class class_name {
public void setConstantTypesClassesWhiteList(final List<Class> constantTypesWhiteList) {
List<String> values = new LinkedList<String>();
for (Class aClass : constantTypesWhiteList) {
values.add(aClass.getName()); // depends on control dependency: [for], data = [aClass]
}
setConstantTypesWhiteList(values);
} } |
public class class_name {
public String getArrayClassName(Class<?> clazz) {
if (clazz.isArray()) {
return getArrayClassName(clazz.getComponentType()) + "[]";
}
return clazz.getName();
} } | public class class_name {
public String getArrayClassName(Class<?> clazz) {
if (clazz.isArray()) {
return getArrayClassName(clazz.getComponentType()) + "[]"; // depends on control dependency: [if], data = [none]
}
return clazz.getName();
} } |
public class class_name {
public static void loadDict(String... path) throws LoadModelException {
for(String file:path){
dict.addFile(file);
}
setDict();
} } | public class class_name {
public static void loadDict(String... path) throws LoadModelException {
for(String file:path){
dict.addFile(file);
// depends on control dependency: [for], data = [file]
}
setDict();
} } |
public class class_name {
public static Type[] getTypeArguments(Field property)
{
Type type = property.getGenericType();
if (type instanceof ParameterizedType)
{
return ((ParameterizedType) type).getActualTypeArguments();
}
return null;
} } | public class class_name {
public static Type[] getTypeArguments(Field property)
{
Type type = property.getGenericType();
if (type instanceof ParameterizedType)
{
return ((ParameterizedType) type).getActualTypeArguments();
// depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public long numArcs() {
if(CACHING && (cachedNumArcs != -1)) {
return cachedNumArcs;
}
long numArcs = 0;
for(Vertex v : vertices()) {
numArcs += getForwardNavigator().next(v).size();
}
if(CACHING) {
cachedNumArcs = numArcs;
}
return numArcs;
} } | public class class_name {
public long numArcs() {
if(CACHING && (cachedNumArcs != -1)) {
return cachedNumArcs; // depends on control dependency: [if], data = [none]
}
long numArcs = 0;
for(Vertex v : vertices()) {
numArcs += getForwardNavigator().next(v).size(); // depends on control dependency: [for], data = [v]
}
if(CACHING) {
cachedNumArcs = numArcs; // depends on control dependency: [if], data = [none]
}
return numArcs;
} } |
public class class_name {
public ReferSubscriber refer(String refereeUri, SipURI referToUri, String eventId, long timeout,
String viaNonProxyRoute, String body, String contentType, String contentSubType,
ArrayList<String> additionalHeaders, ArrayList<String> replaceHeaders) {
try {
return refer(refereeUri, referToUri, eventId, timeout, viaNonProxyRoute,
toHeader(additionalHeaders, contentType, contentSubType), toHeader(replaceHeaders), body);
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(SipSession.EXCEPTION_ENCOUNTERED);
return null;
}
} } | public class class_name {
public ReferSubscriber refer(String refereeUri, SipURI referToUri, String eventId, long timeout,
String viaNonProxyRoute, String body, String contentType, String contentSubType,
ArrayList<String> additionalHeaders, ArrayList<String> replaceHeaders) {
try {
return refer(refereeUri, referToUri, eventId, timeout, viaNonProxyRoute,
toHeader(additionalHeaders, contentType, contentSubType), toHeader(replaceHeaders), body); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(SipSession.EXCEPTION_ENCOUNTERED);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <E> Distribution<E> getDistributionFromPartiallySpecifiedCounter(Counter<E> c, int numKeys){
Distribution<E> d;
double total = c.totalCount();
if (total >= 1.0){
d = getDistribution(c);
d.numberOfKeys = numKeys;
} else {
d = new Distribution<E>();
d.numberOfKeys = numKeys;
d.counter = c;
d.reservedMass = 1.0 - total;
}
return d;
} } | public class class_name {
public static <E> Distribution<E> getDistributionFromPartiallySpecifiedCounter(Counter<E> c, int numKeys){
Distribution<E> d;
double total = c.totalCount();
if (total >= 1.0){
d = getDistribution(c);
// depends on control dependency: [if], data = [none]
d.numberOfKeys = numKeys;
// depends on control dependency: [if], data = [none]
} else {
d = new Distribution<E>();
// depends on control dependency: [if], data = [none]
d.numberOfKeys = numKeys;
// depends on control dependency: [if], data = [none]
d.counter = c;
// depends on control dependency: [if], data = [none]
d.reservedMass = 1.0 - total;
// depends on control dependency: [if], data = [none]
}
return d;
} } |
public class class_name {
public void writeToFile(final String filePath, final String toWrite,
final boolean overwrite, final String fileEncoding)
throws IOException {
File file = new File(filePath);
if (!file.exists()) {
boolean created = file.createNewFile();
LOG.info("File successfully created: " + created);
}
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(file, overwrite), fileEncoding));
writer.write(toWrite);
writer.flush();
} finally {
if (writer != null) {
writer.close();
}
}
} } | public class class_name {
public void writeToFile(final String filePath, final String toWrite,
final boolean overwrite, final String fileEncoding)
throws IOException {
File file = new File(filePath);
if (!file.exists()) {
boolean created = file.createNewFile();
LOG.info("File successfully created: " + created);
}
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(file, overwrite), fileEncoding));
writer.write(toWrite);
writer.flush();
} finally {
if (writer != null) {
writer.close(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected Set<CrawlerURL> fetchNextLevelLinks(Map<Future<HTMLPageResponse>, CrawlerURL> responses,
Set<CrawlerURL> allUrls, Set<HTMLPageResponse> nonWorkingUrls,
Set<HTMLPageResponse> verifiedUrls, String host, String onlyOnPath, String notOnPath) {
final Set<CrawlerURL> nextLevel = new LinkedHashSet<CrawlerURL>();
final Iterator<Entry<Future<HTMLPageResponse>, CrawlerURL>> it = responses.entrySet().iterator();
while (it.hasNext()) {
final Entry<Future<HTMLPageResponse>, CrawlerURL> entry = it.next();
try {
final HTMLPageResponse response = entry.getKey().get();
if (HttpStatus.SC_OK == response.getResponseCode()
&& response.getResponseType().indexOf("html") > 0) {
// we know that this links work
verifiedUrls.add(response);
final Set<CrawlerURL> allLinks = parser.get(response);
for (CrawlerURL link : allLinks) {
// only add if it is the same host
if (host.equals(link.getHost()) && link.getUrl().contains(onlyOnPath)
&& (notOnPath.equals("") ? true : (!link.getUrl().contains(notOnPath)))) {
if (!allUrls.contains(link)) {
nextLevel.add(link);
allUrls.add(link);
}
}
}
} else if (HttpStatus.SC_OK != response.getResponseCode() || StatusCode.SC_SERVER_REDIRECT_TO_NEW_DOMAIN.getCode() == response.getResponseCode()) {
allUrls.remove(entry.getValue());
nonWorkingUrls.add(response);
} else {
// it is of another content type than HTML or if it redirected to another domain
allUrls.remove(entry.getValue());
}
} catch (InterruptedException e) {
nonWorkingUrls.add(new HTMLPageResponse(entry.getValue(),
StatusCode.SC_SERVER_RESPONSE_UNKNOWN.getCode(),
Collections.<String, String>emptyMap(), "", "", 0, "", -1));
} catch (ExecutionException e) {
nonWorkingUrls.add(new HTMLPageResponse(entry.getValue(),
StatusCode.SC_SERVER_RESPONSE_UNKNOWN.getCode(),
Collections.<String, String>emptyMap(), "", "", 0, "", -1));
}
}
return nextLevel;
} } | public class class_name {
protected Set<CrawlerURL> fetchNextLevelLinks(Map<Future<HTMLPageResponse>, CrawlerURL> responses,
Set<CrawlerURL> allUrls, Set<HTMLPageResponse> nonWorkingUrls,
Set<HTMLPageResponse> verifiedUrls, String host, String onlyOnPath, String notOnPath) {
final Set<CrawlerURL> nextLevel = new LinkedHashSet<CrawlerURL>();
final Iterator<Entry<Future<HTMLPageResponse>, CrawlerURL>> it = responses.entrySet().iterator();
while (it.hasNext()) {
final Entry<Future<HTMLPageResponse>, CrawlerURL> entry = it.next();
try {
final HTMLPageResponse response = entry.getKey().get();
if (HttpStatus.SC_OK == response.getResponseCode()
&& response.getResponseType().indexOf("html") > 0) {
// we know that this links work
verifiedUrls.add(response); // depends on control dependency: [if], data = [none]
final Set<CrawlerURL> allLinks = parser.get(response);
for (CrawlerURL link : allLinks) {
// only add if it is the same host
if (host.equals(link.getHost()) && link.getUrl().contains(onlyOnPath)
&& (notOnPath.equals("") ? true : (!link.getUrl().contains(notOnPath)))) {
if (!allUrls.contains(link)) {
nextLevel.add(link); // depends on control dependency: [if], data = [none]
allUrls.add(link); // depends on control dependency: [if], data = [none]
}
}
}
} else if (HttpStatus.SC_OK != response.getResponseCode() || StatusCode.SC_SERVER_REDIRECT_TO_NEW_DOMAIN.getCode() == response.getResponseCode()) {
allUrls.remove(entry.getValue()); // depends on control dependency: [if], data = [none]
nonWorkingUrls.add(response); // depends on control dependency: [if], data = [none]
} else {
// it is of another content type than HTML or if it redirected to another domain
allUrls.remove(entry.getValue()); // depends on control dependency: [if], data = [none]
}
} catch (InterruptedException e) {
nonWorkingUrls.add(new HTMLPageResponse(entry.getValue(),
StatusCode.SC_SERVER_RESPONSE_UNKNOWN.getCode(),
Collections.<String, String>emptyMap(), "", "", 0, "", -1));
} catch (ExecutionException e) { // depends on control dependency: [catch], data = [none]
nonWorkingUrls.add(new HTMLPageResponse(entry.getValue(),
StatusCode.SC_SERVER_RESPONSE_UNKNOWN.getCode(),
Collections.<String, String>emptyMap(), "", "", 0, "", -1));
} // depends on control dependency: [catch], data = [none]
}
return nextLevel;
} } |
public class class_name {
protected void removeDecorationWidget(Widget widget, int width) {
if ((widget != null) && m_decorationWidgets.remove(widget)) {
m_decorationWidth -= width;
initContent();
}
} } | public class class_name {
protected void removeDecorationWidget(Widget widget, int width) {
if ((widget != null) && m_decorationWidgets.remove(widget)) {
m_decorationWidth -= width; // depends on control dependency: [if], data = [none]
initContent(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public UtilizationByTime withGroups(ReservationUtilizationGroup... groups) {
if (this.groups == null) {
setGroups(new java.util.ArrayList<ReservationUtilizationGroup>(groups.length));
}
for (ReservationUtilizationGroup ele : groups) {
this.groups.add(ele);
}
return this;
} } | public class class_name {
public UtilizationByTime withGroups(ReservationUtilizationGroup... groups) {
if (this.groups == null) {
setGroups(new java.util.ArrayList<ReservationUtilizationGroup>(groups.length)); // depends on control dependency: [if], data = [none]
}
for (ReservationUtilizationGroup ele : groups) {
this.groups.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Trivial // traced by caller
static <U> CompletableFuture<U> failedFuture(Throwable x, Executor executor) {
if (JAVA8) {
CompletableFuture<U> failedFuture = new CompletableFuture<U>();
failedFuture.completeExceptionally(x);
return new ManagedCompletableFuture<U>(failedFuture, executor, null);
} else {
ManagedCompletableFuture<U> future = new ManagedCompletableFuture<U>(executor, null);
future.super_completeExceptionally(x);
return future;
}
} } | public class class_name {
@Trivial // traced by caller
static <U> CompletableFuture<U> failedFuture(Throwable x, Executor executor) {
if (JAVA8) {
CompletableFuture<U> failedFuture = new CompletableFuture<U>();
failedFuture.completeExceptionally(x); // depends on control dependency: [if], data = [none]
return new ManagedCompletableFuture<U>(failedFuture, executor, null); // depends on control dependency: [if], data = [none]
} else {
ManagedCompletableFuture<U> future = new ManagedCompletableFuture<U>(executor, null);
future.super_completeExceptionally(x); // depends on control dependency: [if], data = [none]
return future; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Override
public <T> T execute() {
User sfsUser = CommandUtil.getSfsUser(agent, api);
if(sfsUser == null) return null;
try {
AgentClassUnwrapper unwrapper = context.getUserAgentClass(agent.getClass())
.getUnwrapper();
List<UserVariable> variables = new UserAgentSerializer().serialize(unwrapper, agent);
List<UserVariable> answer = variables;
if(includedVars.size() > 0)
answer = getVariables(variables, includedVars);
answer.removeAll(getVariables(answer, excludedVars));
//update user variables on server and notify to client
if(toClient) api.setUserVariables(sfsUser, answer);
// only update user variables on server
else sfsUser.setVariables(answer);
}
catch (SFSVariableException e) {
throw new IllegalStateException(e);
}
return (T)agent;
} } | public class class_name {
@SuppressWarnings("unchecked")
@Override
public <T> T execute() {
User sfsUser = CommandUtil.getSfsUser(agent, api);
if(sfsUser == null) return null;
try {
AgentClassUnwrapper unwrapper = context.getUserAgentClass(agent.getClass())
.getUnwrapper();
List<UserVariable> variables = new UserAgentSerializer().serialize(unwrapper, agent);
List<UserVariable> answer = variables;
if(includedVars.size() > 0)
answer = getVariables(variables, includedVars);
answer.removeAll(getVariables(answer, excludedVars)); // depends on control dependency: [try], data = [none]
//update user variables on server and notify to client
if(toClient) api.setUserVariables(sfsUser, answer);
// only update user variables on server
else sfsUser.setVariables(answer);
}
catch (SFSVariableException e) {
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
return (T)agent;
} } |
public class class_name {
@UsedByGeneratedCode
protected Object preDestroy(BeanResolutionContext resolutionContext, BeanContext context, Object bean) {
DefaultBeanContext defaultContext = (DefaultBeanContext) context;
for (int i = 0; i < methodInjectionPoints.size(); i++) {
MethodInjectionPoint methodInjectionPoint = methodInjectionPoints.get(i);
if (methodInjectionPoint.isPreDestroyMethod() && methodInjectionPoint.requiresReflection()) {
injectBeanMethod(resolutionContext, defaultContext, i, bean);
}
}
if (bean instanceof LifeCycle) {
bean = ((LifeCycle) bean).stop();
}
return bean;
} } | public class class_name {
@UsedByGeneratedCode
protected Object preDestroy(BeanResolutionContext resolutionContext, BeanContext context, Object bean) {
DefaultBeanContext defaultContext = (DefaultBeanContext) context;
for (int i = 0; i < methodInjectionPoints.size(); i++) {
MethodInjectionPoint methodInjectionPoint = methodInjectionPoints.get(i);
if (methodInjectionPoint.isPreDestroyMethod() && methodInjectionPoint.requiresReflection()) {
injectBeanMethod(resolutionContext, defaultContext, i, bean); // depends on control dependency: [if], data = [none]
}
}
if (bean instanceof LifeCycle) {
bean = ((LifeCycle) bean).stop(); // depends on control dependency: [if], data = [none]
}
return bean;
} } |
public class class_name {
@Override
protected void reserveInternal(int newCapacity) {
int oldCapacity = (nulls == 0L) ? 0 : capacity;
if (isArray() || type instanceof MapType) {
this.lengthData =
Platform.reallocateMemory(lengthData, oldCapacity * 4L, newCapacity * 4L);
this.offsetData =
Platform.reallocateMemory(offsetData, oldCapacity * 4L, newCapacity * 4L);
} else if (type instanceof ByteType || type instanceof BooleanType) {
this.data = Platform.reallocateMemory(data, oldCapacity, newCapacity);
} else if (type instanceof ShortType) {
this.data = Platform.reallocateMemory(data, oldCapacity * 2L, newCapacity * 2L);
} else if (type instanceof IntegerType || type instanceof FloatType ||
type instanceof DateType || DecimalType.is32BitDecimalType(type)) {
this.data = Platform.reallocateMemory(data, oldCapacity * 4L, newCapacity * 4L);
} else if (type instanceof LongType || type instanceof DoubleType ||
DecimalType.is64BitDecimalType(type) || type instanceof TimestampType) {
this.data = Platform.reallocateMemory(data, oldCapacity * 8L, newCapacity * 8L);
} else if (childColumns != null) {
// Nothing to store.
} else {
throw new RuntimeException("Unhandled " + type);
}
this.nulls = Platform.reallocateMemory(nulls, oldCapacity, newCapacity);
Platform.setMemory(nulls + oldCapacity, (byte)0, newCapacity - oldCapacity);
capacity = newCapacity;
} } | public class class_name {
@Override
protected void reserveInternal(int newCapacity) {
int oldCapacity = (nulls == 0L) ? 0 : capacity;
if (isArray() || type instanceof MapType) {
this.lengthData =
Platform.reallocateMemory(lengthData, oldCapacity * 4L, newCapacity * 4L); // depends on control dependency: [if], data = [none]
this.offsetData =
Platform.reallocateMemory(offsetData, oldCapacity * 4L, newCapacity * 4L); // depends on control dependency: [if], data = [none]
} else if (type instanceof ByteType || type instanceof BooleanType) {
this.data = Platform.reallocateMemory(data, oldCapacity, newCapacity); // depends on control dependency: [if], data = [none]
} else if (type instanceof ShortType) {
this.data = Platform.reallocateMemory(data, oldCapacity * 2L, newCapacity * 2L); // depends on control dependency: [if], data = [none]
} else if (type instanceof IntegerType || type instanceof FloatType ||
type instanceof DateType || DecimalType.is32BitDecimalType(type)) {
this.data = Platform.reallocateMemory(data, oldCapacity * 4L, newCapacity * 4L); // depends on control dependency: [if], data = [none]
} else if (type instanceof LongType || type instanceof DoubleType ||
DecimalType.is64BitDecimalType(type) || type instanceof TimestampType) {
this.data = Platform.reallocateMemory(data, oldCapacity * 8L, newCapacity * 8L); // depends on control dependency: [if], data = [none]
} else if (childColumns != null) {
// Nothing to store.
} else {
throw new RuntimeException("Unhandled " + type);
}
this.nulls = Platform.reallocateMemory(nulls, oldCapacity, newCapacity);
Platform.setMemory(nulls + oldCapacity, (byte)0, newCapacity - oldCapacity);
capacity = newCapacity;
} } |
public class class_name {
public Boolean loadPreferenceAsBoolean(String key, Boolean defaultValue) {
Boolean value = defaultValue;
if (hasPreference(key)) {
value = getSharedPreferences().getBoolean(key, false);
}
logLoad(key, value);
return value;
} } | public class class_name {
public Boolean loadPreferenceAsBoolean(String key, Boolean defaultValue) {
Boolean value = defaultValue;
if (hasPreference(key)) {
value = getSharedPreferences().getBoolean(key, false); // depends on control dependency: [if], data = [none]
}
logLoad(key, value);
return value;
} } |
public class class_name {
private void pad4() {
int padSize = currentPos % 4;
for (int i = 0; i < padSize; i++) {
output[currentPos++] = 0;
realSize++;
}
} } | public class class_name {
private void pad4() {
int padSize = currentPos % 4;
for (int i = 0; i < padSize; i++) {
output[currentPos++] = 0; // depends on control dependency: [for], data = [none]
realSize++; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
static ArrayList decode(ArrayList l) {
for (int i = 0; i < l.size(); i++) {
if (l.get(i) instanceof NamedList) {
l.set(i, decode((NamedList) l.get(i)));
} else if (l.get(i) instanceof ArrayList) {
l.set(i, decode((ArrayList) l.get(i)));
}
}
return l;
} } | public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
static ArrayList decode(ArrayList l) {
for (int i = 0; i < l.size(); i++) {
if (l.get(i) instanceof NamedList) {
l.set(i, decode((NamedList) l.get(i))); // depends on control dependency: [if], data = [none]
} else if (l.get(i) instanceof ArrayList) {
l.set(i, decode((ArrayList) l.get(i))); // depends on control dependency: [if], data = [none]
}
}
return l;
} } |
public class class_name {
public Coin getBalanceForServer(Sha256Hash id) {
Coin balance = Coin.ZERO;
lock.lock();
try {
Set<StoredClientChannel> setChannels = mapChannels.get(id);
for (StoredClientChannel channel : setChannels) {
synchronized (channel) {
if (channel.close != null) continue;
balance = balance.add(channel.valueToMe);
}
}
return balance;
} finally {
lock.unlock();
}
} } | public class class_name {
public Coin getBalanceForServer(Sha256Hash id) {
Coin balance = Coin.ZERO;
lock.lock();
try {
Set<StoredClientChannel> setChannels = mapChannels.get(id);
for (StoredClientChannel channel : setChannels) {
synchronized (channel) { // depends on control dependency: [for], data = [channel]
if (channel.close != null) continue;
balance = balance.add(channel.valueToMe);
}
}
return balance; // depends on control dependency: [try], data = [none]
} finally {
lock.unlock();
}
} } |
public class class_name {
public E getById(String id) {
if (id == null) {
for (E element : this) {
if (element != null && element.getId() == null) {
return element;
}
}
} else {
for (E element : this) {
if (element != null && id.equals(element.getId())) {
return element;
}
}
}
return null;
} } | public class class_name {
public E getById(String id) {
if (id == null) {
for (E element : this) {
if (element != null && element.getId() == null) {
return element; // depends on control dependency: [if], data = [none]
}
}
} else {
for (E element : this) {
if (element != null && id.equals(element.getId())) {
return element; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public synchronized void addCommand(final CommandImpl command) throws DevFailed {
CommandImpl result = null;
for (final CommandImpl cmd : commandList) {
if (command.getName().equalsIgnoreCase(cmd.getName())) {
result = command;
break;
}
}
if (result == null) {
commandList.add(command);
// set default polling configuration
if (cmdPollRingDepth.containsKey(command.getName().toLowerCase(Locale.ENGLISH))) {
command.setPollRingDepth(cmdPollRingDepth.get(command.getName().toLowerCase(Locale.ENGLISH)));
} else {
command.setPollRingDepth(pollRingDepth);
}
}
} } | public class class_name {
public synchronized void addCommand(final CommandImpl command) throws DevFailed {
CommandImpl result = null;
for (final CommandImpl cmd : commandList) {
if (command.getName().equalsIgnoreCase(cmd.getName())) {
result = command; // depends on control dependency: [if], data = [none]
break;
}
}
if (result == null) {
commandList.add(command);
// set default polling configuration
if (cmdPollRingDepth.containsKey(command.getName().toLowerCase(Locale.ENGLISH))) {
command.setPollRingDepth(cmdPollRingDepth.get(command.getName().toLowerCase(Locale.ENGLISH)));
} else {
command.setPollRingDepth(pollRingDepth);
}
}
} } |
public class class_name {
public static String formatFallback(final String pattern, final Object... arguments) {
StringBuilder sb = new StringBuilder(pattern);
for (Object argument : arguments) {
sb.append(", ");
sb.append(argument);
}
return sb.toString();
} } | public class class_name {
public static String formatFallback(final String pattern, final Object... arguments) {
StringBuilder sb = new StringBuilder(pattern);
for (Object argument : arguments) {
sb.append(", "); // depends on control dependency: [for], data = [none]
sb.append(argument); // depends on control dependency: [for], data = [argument]
}
return sb.toString();
} } |
public class class_name {
public static Map<String, Method> getAllCucumberMethods(Class<?> clazz) {
final Map<String, Method> result = new HashMap<>();
final CucumberOptions co = clazz.getAnnotation(CucumberOptions.class);
final Set<Class<?>> classes = getClasses(co.glue());
classes.add(BrowserSteps.class);
for (final Class<?> c : classes) {
final Method[] methods = c.getDeclaredMethods();
for (final Method method : methods) {
for (final Annotation stepAnnotation : method.getAnnotations()) {
if (stepAnnotation.annotationType().isAnnotationPresent(StepDefAnnotation.class)) {
result.put(stepAnnotation.toString(), method);
}
}
}
}
return result;
} } | public class class_name {
public static Map<String, Method> getAllCucumberMethods(Class<?> clazz) {
final Map<String, Method> result = new HashMap<>();
final CucumberOptions co = clazz.getAnnotation(CucumberOptions.class);
final Set<Class<?>> classes = getClasses(co.glue());
classes.add(BrowserSteps.class);
for (final Class<?> c : classes) {
final Method[] methods = c.getDeclaredMethods();
for (final Method method : methods) {
for (final Annotation stepAnnotation : method.getAnnotations()) {
if (stepAnnotation.annotationType().isAnnotationPresent(StepDefAnnotation.class)) {
result.put(stepAnnotation.toString(), method);
// depends on control dependency: [if], data = [none]
}
}
}
}
return result;
} } |
public class class_name {
@Override
protected void changeItemLinkUrl(String itemUrl) {
try {
JspWriter out = getJsp().getJspContext().getOut();
if (getCms().existsResource(itemUrl)) {
try {
writePointerLink(getCms().readResource(itemUrl));
out.print(buildJsonItemObject(getCms().readResource(itemUrl)));
} catch (CmsException e) {
// can not happen in theory, because we used existsResource() before...
}
} else {
out.print(RETURNVALUE_NONE);
}
} catch (IOException e) {
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e);
}
}
} } | public class class_name {
@Override
protected void changeItemLinkUrl(String itemUrl) {
try {
JspWriter out = getJsp().getJspContext().getOut();
if (getCms().existsResource(itemUrl)) {
try {
writePointerLink(getCms().readResource(itemUrl)); // depends on control dependency: [try], data = [none]
out.print(buildJsonItemObject(getCms().readResource(itemUrl))); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
// can not happen in theory, because we used existsResource() before...
} // depends on control dependency: [catch], data = [none]
} else {
out.print(RETURNVALUE_NONE); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private BigInteger bigForBytes(byte[] bytes, int sigbytes)
{
byte[] b;
if (sigbytes != bytes.length)
{
b = new byte[sigbytes];
System.arraycopy(bytes, 0, b, 0, bytes.length);
} else
b = bytes;
return new BigInteger(1, b);
} } | public class class_name {
private BigInteger bigForBytes(byte[] bytes, int sigbytes)
{
byte[] b;
if (sigbytes != bytes.length)
{
b = new byte[sigbytes]; // depends on control dependency: [if], data = [none]
System.arraycopy(bytes, 0, b, 0, bytes.length); // depends on control dependency: [if], data = [bytes.length)]
} else
b = bytes;
return new BigInteger(1, b);
} } |
public class class_name {
public long getElapsedArtifactTransformTime() {
long result = 0;
for (FragmentedOperation transform : transforms.values()) {
result += transform.getElapsedTime();
}
return result;
} } | public class class_name {
public long getElapsedArtifactTransformTime() {
long result = 0;
for (FragmentedOperation transform : transforms.values()) {
result += transform.getElapsedTime(); // depends on control dependency: [for], data = [transform]
}
return result;
} } |
public class class_name {
@Override
protected FlinkKafkaProducer.KafkaTransactionState beginTransaction() throws FlinkKafkaException {
switch (semantic) {
case EXACTLY_ONCE:
FlinkKafkaInternalProducer<byte[], byte[]> producer = createTransactionalProducer();
producer.beginTransaction();
return new FlinkKafkaProducer.KafkaTransactionState(producer.getTransactionalId(), producer);
case AT_LEAST_ONCE:
case NONE:
// Do not create new producer on each beginTransaction() if it is not necessary
final FlinkKafkaProducer.KafkaTransactionState currentTransaction = currentTransaction();
if (currentTransaction != null && currentTransaction.producer != null) {
return new FlinkKafkaProducer.KafkaTransactionState(currentTransaction.producer);
}
return new FlinkKafkaProducer.KafkaTransactionState(initNonTransactionalProducer(true));
default:
throw new UnsupportedOperationException("Not implemented semantic");
}
} } | public class class_name {
@Override
protected FlinkKafkaProducer.KafkaTransactionState beginTransaction() throws FlinkKafkaException {
switch (semantic) {
case EXACTLY_ONCE:
FlinkKafkaInternalProducer<byte[], byte[]> producer = createTransactionalProducer();
producer.beginTransaction();
return new FlinkKafkaProducer.KafkaTransactionState(producer.getTransactionalId(), producer);
case AT_LEAST_ONCE:
case NONE:
// Do not create new producer on each beginTransaction() if it is not necessary
final FlinkKafkaProducer.KafkaTransactionState currentTransaction = currentTransaction();
if (currentTransaction != null && currentTransaction.producer != null) {
return new FlinkKafkaProducer.KafkaTransactionState(currentTransaction.producer); // depends on control dependency: [if], data = [(currentTransaction]
}
return new FlinkKafkaProducer.KafkaTransactionState(initNonTransactionalProducer(true));
default:
throw new UnsupportedOperationException("Not implemented semantic");
}
} } |
public class class_name {
public static int getIntegerInitParameter(ExternalContext context, String[] names, int defaultValue)
{
if (names == null)
{
throw new NullPointerException();
}
String param = null;
for (String name : names)
{
if (name == null)
{
throw new NullPointerException();
}
param = getStringInitParameter(context, name);
if (param != null)
{
break;
}
}
if (param == null)
{
return defaultValue;
}
else
{
return Integer.parseInt(param.toLowerCase());
}
} } | public class class_name {
public static int getIntegerInitParameter(ExternalContext context, String[] names, int defaultValue)
{
if (names == null)
{
throw new NullPointerException();
}
String param = null;
for (String name : names)
{
if (name == null)
{
throw new NullPointerException();
}
param = getStringInitParameter(context, name); // depends on control dependency: [for], data = [name]
if (param != null)
{
break;
}
}
if (param == null)
{
return defaultValue; // depends on control dependency: [if], data = [none]
}
else
{
return Integer.parseInt(param.toLowerCase()); // depends on control dependency: [if], data = [(param]
}
} } |
public class class_name {
public static BooleanSupplier softenBooleanSupplier(final CheckedBooleanSupplier s) {
return () -> {
try {
return s.getAsBoolean();
} catch (final Throwable e) {
throw throwSoftenedException(e);
}
};
} } | public class class_name {
public static BooleanSupplier softenBooleanSupplier(final CheckedBooleanSupplier s) {
return () -> {
try {
return s.getAsBoolean(); // depends on control dependency: [try], data = [none]
} catch (final Throwable e) {
throw throwSoftenedException(e);
} // depends on control dependency: [catch], data = [none]
};
} } |
public class class_name {
public static List<List<List<Integer>>> getOptAlnAsList(AFPChain afpChain) {
int[][][] optAln = afpChain.getOptAln();
int[] optLen = afpChain.getOptLen();
List<List<List<Integer>>> blocks = new ArrayList<List<List<Integer>>>(afpChain.getBlockNum());
for(int blockNum=0;blockNum<afpChain.getBlockNum();blockNum++) {
//TODO could improve speed an memory by wrapping the arrays with
// an unmodifiable list, similar to Arrays.asList(...) but with the
// correct size parameter.
List<Integer> align1 = new ArrayList<Integer>(optLen[blockNum]);
List<Integer> align2 = new ArrayList<Integer>(optLen[blockNum]);
for(int pos=0;pos<optLen[blockNum];pos++) {
align1.add(optAln[blockNum][0][pos]);
align2.add(optAln[blockNum][1][pos]);
}
List<List<Integer>> block = new ArrayList<List<Integer>>(2);
block.add(align1);
block.add(align2);
blocks.add(block);
}
return blocks;
} } | public class class_name {
public static List<List<List<Integer>>> getOptAlnAsList(AFPChain afpChain) {
int[][][] optAln = afpChain.getOptAln();
int[] optLen = afpChain.getOptLen();
List<List<List<Integer>>> blocks = new ArrayList<List<List<Integer>>>(afpChain.getBlockNum());
for(int blockNum=0;blockNum<afpChain.getBlockNum();blockNum++) {
//TODO could improve speed an memory by wrapping the arrays with
// an unmodifiable list, similar to Arrays.asList(...) but with the
// correct size parameter.
List<Integer> align1 = new ArrayList<Integer>(optLen[blockNum]);
List<Integer> align2 = new ArrayList<Integer>(optLen[blockNum]);
for(int pos=0;pos<optLen[blockNum];pos++) {
align1.add(optAln[blockNum][0][pos]); // depends on control dependency: [for], data = [pos]
align2.add(optAln[blockNum][1][pos]); // depends on control dependency: [for], data = [pos]
}
List<List<Integer>> block = new ArrayList<List<Integer>>(2);
block.add(align1); // depends on control dependency: [for], data = [none]
block.add(align2); // depends on control dependency: [for], data = [none]
blocks.add(block); // depends on control dependency: [for], data = [none]
}
return blocks;
} } |
public class class_name {
private void trimZeros()
{
// loop over ALL_ZEROS_LITERAL words
int w;
do {
w = words[lastWordIndex];
if (w == ConciseSetUtils.ALL_ZEROS_LITERAL) {
lastWordIndex--;
} else if (isZeroSequence(w)) {
if (simulateWAH || isSequenceWithNoBits(w)) {
lastWordIndex--;
} else {
// convert the sequence in a 1-bit literal word
words[lastWordIndex] = getLiteral(w);
return;
}
} else {
// one sequence or literal
return;
}
if (lastWordIndex < 0) {
reset();
return;
}
} while (true);
} } | public class class_name {
private void trimZeros()
{
// loop over ALL_ZEROS_LITERAL words
int w;
do {
w = words[lastWordIndex];
if (w == ConciseSetUtils.ALL_ZEROS_LITERAL) {
lastWordIndex--;
// depends on control dependency: [if], data = [none]
} else if (isZeroSequence(w)) {
if (simulateWAH || isSequenceWithNoBits(w)) {
lastWordIndex--;
// depends on control dependency: [if], data = [none]
} else {
// convert the sequence in a 1-bit literal word
words[lastWordIndex] = getLiteral(w);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
} else {
// one sequence or literal
return;
// depends on control dependency: [if], data = [none]
}
if (lastWordIndex < 0) {
reset();
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
} while (true);
} } |
public class class_name {
private void obtainDividerDecoration() {
int dividerColor;
try {
dividerColor = ThemeUtil.getColor(getActivity(), R.attr.dividerColor);
} catch (NotFoundException e) {
dividerColor =
ContextCompat.getColor(getActivity(), R.color.preference_divider_color_light);
}
this.dividerDecoration.setDividerColor(dividerColor);
this.dividerDecoration.setDividerHeight(DisplayUtil.dpToPixels(getActivity(), 1));
} } | public class class_name {
private void obtainDividerDecoration() {
int dividerColor;
try {
dividerColor = ThemeUtil.getColor(getActivity(), R.attr.dividerColor); // depends on control dependency: [try], data = [none]
} catch (NotFoundException e) {
dividerColor =
ContextCompat.getColor(getActivity(), R.color.preference_divider_color_light);
} // depends on control dependency: [catch], data = [none]
this.dividerDecoration.setDividerColor(dividerColor);
this.dividerDecoration.setDividerHeight(DisplayUtil.dpToPixels(getActivity(), 1));
} } |
public class class_name {
public static SSLContext sslContext(AbstractConfig config, String key) {
final String trustManagerFactoryType = config.getString(key);
try {
return SSLContext.getInstance(trustManagerFactoryType);
} catch (NoSuchAlgorithmException e) {
ConfigException exception = new ConfigException(
key,
trustManagerFactoryType,
"Unknown Algorithm."
);
exception.initCause(e);
throw exception;
}
} } | public class class_name {
public static SSLContext sslContext(AbstractConfig config, String key) {
final String trustManagerFactoryType = config.getString(key);
try {
return SSLContext.getInstance(trustManagerFactoryType); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
ConfigException exception = new ConfigException(
key,
trustManagerFactoryType,
"Unknown Algorithm."
);
exception.initCause(e);
throw exception;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void idle(final int milliseconds) {
long startTime = System.currentTimeMillis();
while((System.currentTimeMillis() - startTime) < milliseconds)
try {
Thread.sleep(Math.max(1, milliseconds - (System.currentTimeMillis() - startTime)));
}
catch(InterruptedException e) {
}
} } | public class class_name {
public void idle(final int milliseconds) {
long startTime = System.currentTimeMillis();
while((System.currentTimeMillis() - startTime) < milliseconds)
try {
Thread.sleep(Math.max(1, milliseconds - (System.currentTimeMillis() - startTime))); // depends on control dependency: [try], data = [none]
}
catch(InterruptedException e) {
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected boolean clearSpecial(DatabaseConnection connection, Logger logger) {
NestedConnection currentSaved = specialConnection.get();
boolean cleared = false;
if (connection == null) {
// ignored
} else if (currentSaved == null) {
logger.error("no connection has been saved when clear() called");
} else if (currentSaved.connection == connection) {
if (currentSaved.decrementAndGet() == 0) {
// we only clear the connection if nested counter is 0
specialConnection.set(null);
}
cleared = true;
} else {
logger.error("connection saved {} is not the one being cleared {}", currentSaved.connection, connection);
}
// release should then be called after clear
return cleared;
} } | public class class_name {
protected boolean clearSpecial(DatabaseConnection connection, Logger logger) {
NestedConnection currentSaved = specialConnection.get();
boolean cleared = false;
if (connection == null) {
// ignored
} else if (currentSaved == null) {
logger.error("no connection has been saved when clear() called"); // depends on control dependency: [if], data = [none]
} else if (currentSaved.connection == connection) {
if (currentSaved.decrementAndGet() == 0) {
// we only clear the connection if nested counter is 0
specialConnection.set(null); // depends on control dependency: [if], data = [none]
}
cleared = true; // depends on control dependency: [if], data = [none]
} else {
logger.error("connection saved {} is not the one being cleared {}", currentSaved.connection, connection); // depends on control dependency: [if], data = [connection)]
}
// release should then be called after clear
return cleared;
} } |
public class class_name {
public TableRuntimeContext nextTable(int threadNumber) throws InterruptedException {
synchronized (partitionStateLock) {
acquireTableAsNeeded(threadNumber);
final TableRuntimeContext partition = getOwnedTablesQueue().pollFirst();
if (partition != null) {
offerToOwnedTablesQueue(partition, threadNumber);
}
return partition;
}
} } | public class class_name {
public TableRuntimeContext nextTable(int threadNumber) throws InterruptedException {
synchronized (partitionStateLock) {
acquireTableAsNeeded(threadNumber);
final TableRuntimeContext partition = getOwnedTablesQueue().pollFirst();
if (partition != null) {
offerToOwnedTablesQueue(partition, threadNumber); // depends on control dependency: [if], data = [(partition]
}
return partition;
}
} } |
public class class_name {
public Boolean isSchedulerPaused() {
try {
return this.scheduler.isInStandbyMode();
} catch (SchedulerException e) {
logger.error("error retrieveing scheduler condition", e);
}
return null;
} } | public class class_name {
public Boolean isSchedulerPaused() {
try {
return this.scheduler.isInStandbyMode(); // depends on control dependency: [try], data = [none]
} catch (SchedulerException e) {
logger.error("error retrieveing scheduler condition", e);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public java.util.List<WorkspaceConnectionStatus> getWorkspacesConnectionStatus() {
if (workspacesConnectionStatus == null) {
workspacesConnectionStatus = new com.amazonaws.internal.SdkInternalList<WorkspaceConnectionStatus>();
}
return workspacesConnectionStatus;
} } | public class class_name {
public java.util.List<WorkspaceConnectionStatus> getWorkspacesConnectionStatus() {
if (workspacesConnectionStatus == null) {
workspacesConnectionStatus = new com.amazonaws.internal.SdkInternalList<WorkspaceConnectionStatus>(); // depends on control dependency: [if], data = [none]
}
return workspacesConnectionStatus;
} } |
public class class_name {
private String intern(final String str) {
if (str == null) {
return null;
}
final String interned = stringInternMap.putIfAbsent(str, str);
if (interned != null) {
return interned;
}
return str;
} } | public class class_name {
private String intern(final String str) {
if (str == null) {
return null; // depends on control dependency: [if], data = [none]
}
final String interned = stringInternMap.putIfAbsent(str, str);
if (interned != null) {
return interned; // depends on control dependency: [if], data = [none]
}
return str;
} } |
public class class_name {
private static void initIfNeeded()
{
if (!INITIALIZED)
{
synchronized (JCRAPIAspect.class)
{
if (!INITIALIZED)
{
ExoContainer container = ExoContainerContext.getTopContainer();
JCRAPIAspectConfig config = null;
if (container != null)
{
config = (JCRAPIAspectConfig)container.getComponentInstanceOfType(JCRAPIAspectConfig.class);
}
if (config == null)
{
TARGET_INTERFACES = new Class<?>[]{};
LOG.warn("No interface to monitor could be found");
}
else
{
TARGET_INTERFACES = config.getTargetInterfaces();
for (Class<?> c : TARGET_INTERFACES)
{
Statistics global = new Statistics(null, "global");
Map<String, Statistics> statistics = new TreeMap<String, Statistics>();
Method[] methods = c.getMethods();
for (Method m : methods)
{
String name = getStatisticsName(m);
statistics.put(name, new Statistics(global, name));
}
JCRStatisticsManager.registerStatistics(c.getSimpleName(), global, statistics);
ALL_STATISTICS.put(c.getSimpleName(), statistics);
}
}
INITIALIZED = true;
}
}
}
} } | public class class_name {
private static void initIfNeeded()
{
if (!INITIALIZED)
{
synchronized (JCRAPIAspect.class) // depends on control dependency: [if], data = [none]
{
if (!INITIALIZED)
{
ExoContainer container = ExoContainerContext.getTopContainer();
JCRAPIAspectConfig config = null;
if (container != null)
{
config = (JCRAPIAspectConfig)container.getComponentInstanceOfType(JCRAPIAspectConfig.class); // depends on control dependency: [if], data = [none]
}
if (config == null)
{
TARGET_INTERFACES = new Class<?>[]{}; // depends on control dependency: [if], data = [none]
LOG.warn("No interface to monitor could be found"); // depends on control dependency: [if], data = [none]
}
else
{
TARGET_INTERFACES = config.getTargetInterfaces(); // depends on control dependency: [if], data = [none]
for (Class<?> c : TARGET_INTERFACES)
{
Statistics global = new Statistics(null, "global");
Map<String, Statistics> statistics = new TreeMap<String, Statistics>();
Method[] methods = c.getMethods();
for (Method m : methods)
{
String name = getStatisticsName(m);
statistics.put(name, new Statistics(global, name)); // depends on control dependency: [for], data = [m]
}
JCRStatisticsManager.registerStatistics(c.getSimpleName(), global, statistics); // depends on control dependency: [for], data = [c]
ALL_STATISTICS.put(c.getSimpleName(), statistics); // depends on control dependency: [for], data = [c]
}
}
INITIALIZED = true; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public static void setDefaultExecutor(Executor executor) {
Class<?> c = null;
Field field = null;
try {
c = Class.forName("android.os.AsyncTask");
field = c.getDeclaredField("sDefaultExecutor");
field.setAccessible(true);
field.set(null, executor);
field.setAccessible(false);
} catch (IllegalArgumentException e) {
e.printStackTrace();
Log.e("IllegalArgumentException", e);
} catch (ClassNotFoundException e) {
e.printStackTrace();
Log.e("ClassNotFoundException", e);
} catch (NoSuchFieldException e) {
e.printStackTrace();
Log.e("NoSuchFieldException", e);
} catch (IllegalAccessException e) {
e.printStackTrace();
Log.e("IllegalAccessException", e);
}
} } | public class class_name {
public static void setDefaultExecutor(Executor executor) {
Class<?> c = null;
Field field = null;
try {
c = Class.forName("android.os.AsyncTask"); // depends on control dependency: [try], data = [none]
field = c.getDeclaredField("sDefaultExecutor"); // depends on control dependency: [try], data = [none]
field.setAccessible(true); // depends on control dependency: [try], data = [none]
field.set(null, executor); // depends on control dependency: [try], data = [none]
field.setAccessible(false); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
e.printStackTrace();
Log.e("IllegalArgumentException", e);
} catch (ClassNotFoundException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
Log.e("ClassNotFoundException", e);
} catch (NoSuchFieldException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
Log.e("NoSuchFieldException", e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
Log.e("IllegalAccessException", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void fillMapWithTemplateData(String textForTemplateExtraction,
TemplateFilter filterToApply, int id,
Map<String, Set<Integer>> mapToFill)
{
Set<String> names = getTemplateNames(textForTemplateExtraction);
// Update the map with template values for current page
for (String name : names) {
// filter templates - only use templates from a provided
// whitelist
if (filterToApply.acceptTemplate(name)) {
// Create records for TEMPLATE->PAGES/REVISION map
if (mapToFill.containsKey(name)) {
// add the page id to the set for the current template
Set<Integer> pIdList = mapToFill.remove(name);
pIdList.add(id);
mapToFill.put(name, pIdList);
}
else {
// add new list with page id of current page
Set<Integer> newIdList = new HashSet<Integer>();
newIdList.add(id);
mapToFill.put(name, newIdList);
}
}
}
} } | public class class_name {
private void fillMapWithTemplateData(String textForTemplateExtraction,
TemplateFilter filterToApply, int id,
Map<String, Set<Integer>> mapToFill)
{
Set<String> names = getTemplateNames(textForTemplateExtraction);
// Update the map with template values for current page
for (String name : names) {
// filter templates - only use templates from a provided
// whitelist
if (filterToApply.acceptTemplate(name)) {
// Create records for TEMPLATE->PAGES/REVISION map
if (mapToFill.containsKey(name)) {
// add the page id to the set for the current template
Set<Integer> pIdList = mapToFill.remove(name);
pIdList.add(id); // depends on control dependency: [if], data = [none]
mapToFill.put(name, pIdList); // depends on control dependency: [if], data = [none]
}
else {
// add new list with page id of current page
Set<Integer> newIdList = new HashSet<Integer>();
newIdList.add(id); // depends on control dependency: [if], data = [none]
mapToFill.put(name, newIdList); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public Observable<ServiceResponse<Void>> registerWithServiceResponseAsync(String userName) {
if (userName == null) {
throw new IllegalArgumentException("Parameter userName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final String registrationCode = null;
RegisterPayload registerPayload = new RegisterPayload();
registerPayload.withRegistrationCode(null);
return service.register(userName, this.client.apiVersion(), this.client.acceptLanguage(), registerPayload, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = registerDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Void>> registerWithServiceResponseAsync(String userName) {
if (userName == null) {
throw new IllegalArgumentException("Parameter userName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final String registrationCode = null;
RegisterPayload registerPayload = new RegisterPayload();
registerPayload.withRegistrationCode(null);
return service.register(userName, this.client.apiVersion(), this.client.acceptLanguage(), registerPayload, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = registerDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
@NotNull
private String getFQName(@NotNull final String localName, Object... params) {
final StringBuilder builder = new StringBuilder();
builder.append(storeName);
builder.append('.');
builder.append(localName);
for (final Object param : params) {
builder.append('#');
builder.append(param);
}
//noinspection ConstantConditions
return StringInterner.intern(builder.toString());
} } | public class class_name {
@NotNull
private String getFQName(@NotNull final String localName, Object... params) {
final StringBuilder builder = new StringBuilder();
builder.append(storeName);
builder.append('.');
builder.append(localName);
for (final Object param : params) {
builder.append('#'); // depends on control dependency: [for], data = [none]
builder.append(param); // depends on control dependency: [for], data = [param]
}
//noinspection ConstantConditions
return StringInterner.intern(builder.toString());
} } |
public class class_name {
private void renderClass(ClassDoc doc, DocletRenderer renderer) {
//handle the various parts of the Class doc
renderer.renderDoc(doc);
for (MemberDoc member : doc.fields()) {
renderer.renderDoc(member);
}
for (MemberDoc member : doc.constructors()) {
renderer.renderDoc(member);
}
for (MemberDoc member : doc.methods()) {
renderer.renderDoc(member);
}
for (MemberDoc member : doc.enumConstants()) {
renderer.renderDoc(member);
}
if (doc instanceof AnnotationTypeDoc) {
for (MemberDoc member : ((AnnotationTypeDoc)doc).elements()) {
renderer.renderDoc(member);
}
}
} } | public class class_name {
private void renderClass(ClassDoc doc, DocletRenderer renderer) {
//handle the various parts of the Class doc
renderer.renderDoc(doc);
for (MemberDoc member : doc.fields()) {
renderer.renderDoc(member); // depends on control dependency: [for], data = [member]
}
for (MemberDoc member : doc.constructors()) {
renderer.renderDoc(member); // depends on control dependency: [for], data = [member]
}
for (MemberDoc member : doc.methods()) {
renderer.renderDoc(member); // depends on control dependency: [for], data = [member]
}
for (MemberDoc member : doc.enumConstants()) {
renderer.renderDoc(member); // depends on control dependency: [for], data = [member]
}
if (doc instanceof AnnotationTypeDoc) {
for (MemberDoc member : ((AnnotationTypeDoc)doc).elements()) {
renderer.renderDoc(member); // depends on control dependency: [for], data = [member]
}
}
} } |
public class class_name {
@Override
public void setBackReference( String referenceName, Object reference, T[] value, JsonDeserializationContext ctx ) {
if ( null != value && value.length > 0 ) {
for ( T val : value ) {
deserializer.setBackReference( referenceName, reference, val, ctx );
}
}
} } | public class class_name {
@Override
public void setBackReference( String referenceName, Object reference, T[] value, JsonDeserializationContext ctx ) {
if ( null != value && value.length > 0 ) {
for ( T val : value ) {
deserializer.setBackReference( referenceName, reference, val, ctx ); // depends on control dependency: [for], data = [val]
}
}
} } |
public class class_name {
private static void mergeWordsWithOldDic() {
List<String> sources = new ArrayList<>();
sources.add("target/dic.txt");
sources.add("src/main/resources/dic.txt");
String target = "src/main/resources/dic.txt";
try {
DictionaryTools.merge(sources, target);
} catch (IOException ex) {
LOGGER.info("和现有词典合并失败:", ex);
}
} } | public class class_name {
private static void mergeWordsWithOldDic() {
List<String> sources = new ArrayList<>();
sources.add("target/dic.txt");
sources.add("src/main/resources/dic.txt");
String target = "src/main/resources/dic.txt";
try {
DictionaryTools.merge(sources, target); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
LOGGER.info("和现有词典合并失败:", ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public boolean checkScaling(final DoubleMatrix2D AOriginal, final DoubleMatrix1D U, final DoubleMatrix1D V){
int c = AOriginal.columns();
int r = AOriginal.rows();
final double[] maxValueHolder = new double[]{-Double.MAX_VALUE};
IntIntDoubleFunction myFunct = new IntIntDoubleFunction() {
@Override
public double apply(int i, int j, double pij) {
maxValueHolder[0] = Math.max(maxValueHolder[0], Math.abs(pij));
return pij;
}
};
DoubleMatrix2D AScaled = ColtUtils.diagonalMatrixMult(U, AOriginal, V);
//view A row by row
boolean isOk = true;
for (int i = 0; isOk && i < r; i++) {
maxValueHolder[0] = -Double.MAX_VALUE;
DoubleMatrix2D P = AScaled.viewPart(i, 0, 1, c);
P.forEachNonZero(myFunct);
isOk = Math.abs(1. - maxValueHolder[0]) < eps;
}
//view A col by col
for (int j = 0; isOk && j < c; j++) {
maxValueHolder[0] = -Double.MAX_VALUE;
DoubleMatrix2D P = AScaled.viewPart(0, j, r, 1);
P.forEachNonZero(myFunct);
isOk = Math.abs(1. - maxValueHolder[0]) < eps;
}
return isOk;
} } | public class class_name {
@Override
public boolean checkScaling(final DoubleMatrix2D AOriginal, final DoubleMatrix1D U, final DoubleMatrix1D V){
int c = AOriginal.columns();
int r = AOriginal.rows();
final double[] maxValueHolder = new double[]{-Double.MAX_VALUE};
IntIntDoubleFunction myFunct = new IntIntDoubleFunction() {
@Override
public double apply(int i, int j, double pij) {
maxValueHolder[0] = Math.max(maxValueHolder[0], Math.abs(pij));
return pij;
}
};
DoubleMatrix2D AScaled = ColtUtils.diagonalMatrixMult(U, AOriginal, V);
//view A row by row
boolean isOk = true;
for (int i = 0; isOk && i < r; i++) {
maxValueHolder[0] = -Double.MAX_VALUE;
// depends on control dependency: [for], data = [none]
DoubleMatrix2D P = AScaled.viewPart(i, 0, 1, c);
P.forEachNonZero(myFunct);
// depends on control dependency: [for], data = [none]
isOk = Math.abs(1. - maxValueHolder[0]) < eps;
// depends on control dependency: [for], data = [none]
}
//view A col by col
for (int j = 0; isOk && j < c; j++) {
maxValueHolder[0] = -Double.MAX_VALUE;
// depends on control dependency: [for], data = [none]
DoubleMatrix2D P = AScaled.viewPart(0, j, r, 1);
P.forEachNonZero(myFunct);
// depends on control dependency: [for], data = [none]
isOk = Math.abs(1. - maxValueHolder[0]) < eps;
// depends on control dependency: [for], data = [none]
}
return isOk;
} } |
public class class_name {
public void setTagsToRemove(java.util.Collection<String> tagsToRemove) {
if (tagsToRemove == null) {
this.tagsToRemove = null;
return;
}
this.tagsToRemove = new java.util.ArrayList<String>(tagsToRemove);
} } | public class class_name {
public void setTagsToRemove(java.util.Collection<String> tagsToRemove) {
if (tagsToRemove == null) {
this.tagsToRemove = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.tagsToRemove = new java.util.ArrayList<String>(tagsToRemove);
} } |
public class class_name {
public void setUseBrowserBasedHttpAuthentication(String value) {
m_useBrowserBasedHttpAuthentication = Boolean.valueOf(value).booleanValue();
if (!m_useBrowserBasedHttpAuthentication && !value.equalsIgnoreCase(Boolean.FALSE.toString())) {
if (value.equalsIgnoreCase(AUTHENTICATION_BASIC)) {
m_useBrowserBasedHttpAuthentication = true;
} else {
m_browserBasedAuthenticationMechanism = value;
m_useBrowserBasedHttpAuthentication = false;
}
}
} } | public class class_name {
public void setUseBrowserBasedHttpAuthentication(String value) {
m_useBrowserBasedHttpAuthentication = Boolean.valueOf(value).booleanValue();
if (!m_useBrowserBasedHttpAuthentication && !value.equalsIgnoreCase(Boolean.FALSE.toString())) {
if (value.equalsIgnoreCase(AUTHENTICATION_BASIC)) {
m_useBrowserBasedHttpAuthentication = true; // depends on control dependency: [if], data = [none]
} else {
m_browserBasedAuthenticationMechanism = value; // depends on control dependency: [if], data = [none]
m_useBrowserBasedHttpAuthentication = false; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void initFolderTree(boolean showInvisible) throws CmsException {
CmsObject cms = A_CmsUI.getCmsObject();
m_treeContainer.removeAllItems();
try {
CmsResource siteRoot = cms.readResource("/", FOLDERS);
addTreeItem(cms, siteRoot, null, false, m_treeContainer);
} catch (CmsException e) {
if (showInvisible) {
CmsResource siteRoot = cms.readResource("/", CmsResourceFilter.IGNORE_EXPIRATION);
addTreeItem(cms, siteRoot, null, true, m_treeContainer);
} else {
throw e;
}
}
} } | public class class_name {
private void initFolderTree(boolean showInvisible) throws CmsException {
CmsObject cms = A_CmsUI.getCmsObject();
m_treeContainer.removeAllItems();
try {
CmsResource siteRoot = cms.readResource("/", FOLDERS);
addTreeItem(cms, siteRoot, null, false, m_treeContainer);
} catch (CmsException e) {
if (showInvisible) {
CmsResource siteRoot = cms.readResource("/", CmsResourceFilter.IGNORE_EXPIRATION);
addTreeItem(cms, siteRoot, null, true, m_treeContainer); // depends on control dependency: [if], data = [none]
} else {
throw e;
}
}
} } |
public class class_name {
public void forward(MessageEnvelope envelope) {
List<FbBot> bots = FbBotMillContext.getInstance().getRegisteredBots();
for (FbBot b : bots) {
b.processMessage(envelope);
}
} } | public class class_name {
public void forward(MessageEnvelope envelope) {
List<FbBot> bots = FbBotMillContext.getInstance().getRegisteredBots();
for (FbBot b : bots) {
b.processMessage(envelope); // depends on control dependency: [for], data = [b]
}
} } |
public class class_name {
private <T> T resolveSchedulerBean(Class<T> schedulerType) {
try {
return resolveSchedulerBeanByType(schedulerType);
} catch (NoUniqueBeanDefinitionException ex) { // multiple beans available, use name
return resolveSchedulerBeanByName(schedulerType);
} catch (NoSuchBeanDefinitionException ex2) {
return null;
}
} } | public class class_name {
private <T> T resolveSchedulerBean(Class<T> schedulerType) {
try {
return resolveSchedulerBeanByType(schedulerType); // depends on control dependency: [try], data = [none]
} catch (NoUniqueBeanDefinitionException ex) { // multiple beans available, use name
return resolveSchedulerBeanByName(schedulerType);
} catch (NoSuchBeanDefinitionException ex2) { // depends on control dependency: [catch], data = [none]
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(UpdateSubscriptionDefinitionRequest updateSubscriptionDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (updateSubscriptionDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateSubscriptionDefinitionRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(updateSubscriptionDefinitionRequest.getSubscriptionDefinitionId(), SUBSCRIPTIONDEFINITIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateSubscriptionDefinitionRequest updateSubscriptionDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (updateSubscriptionDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateSubscriptionDefinitionRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSubscriptionDefinitionRequest.getSubscriptionDefinitionId(), SUBSCRIPTIONDEFINITIONID_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 static void setPersistentMenu(List<Button> buttons) {
if (buttons == null || buttons.isEmpty() || buttons.size() > 5) {
logger.error("FbBotMill validation error: Persistent Menu Buttons can't be null or empty and must be less than 5!");
return;
}
CallToActionsRequest request = new CallToActionsRequest(
ThreadState.EXISTING_THREAD, buttons);
FbBotMillNetworkController.postThreadSetting(request);
} } | public class class_name {
public static void setPersistentMenu(List<Button> buttons) {
if (buttons == null || buttons.isEmpty() || buttons.size() > 5) {
logger.error("FbBotMill validation error: Persistent Menu Buttons can't be null or empty and must be less than 5!"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
CallToActionsRequest request = new CallToActionsRequest(
ThreadState.EXISTING_THREAD, buttons);
FbBotMillNetworkController.postThreadSetting(request);
} } |
public class class_name {
protected String[] resolveBeanNamesForType(final Class type) {
String[] beanNames = beanCollections.get(type);
if (beanNames != null) {
return beanNames;
}
ArrayList<String> list = new ArrayList<>();
for (Map.Entry<String, BeanDefinition> entry : beans.entrySet()) {
BeanDefinition beanDefinition = entry.getValue();
if (ClassUtil.isTypeOf(beanDefinition.type, type)) {
String beanName = entry.getKey();
list.add(beanName);
}
}
if (list.isEmpty()) {
beanNames = StringPool.EMPTY_ARRAY;
} else {
beanNames = list.toArray(new String[0]);
}
beanCollections.put(type, beanNames);
return beanNames;
} } | public class class_name {
protected String[] resolveBeanNamesForType(final Class type) {
String[] beanNames = beanCollections.get(type);
if (beanNames != null) {
return beanNames; // depends on control dependency: [if], data = [none]
}
ArrayList<String> list = new ArrayList<>();
for (Map.Entry<String, BeanDefinition> entry : beans.entrySet()) {
BeanDefinition beanDefinition = entry.getValue();
if (ClassUtil.isTypeOf(beanDefinition.type, type)) {
String beanName = entry.getKey();
list.add(beanName); // depends on control dependency: [if], data = [none]
}
}
if (list.isEmpty()) {
beanNames = StringPool.EMPTY_ARRAY; // depends on control dependency: [if], data = [none]
} else {
beanNames = list.toArray(new String[0]); // depends on control dependency: [if], data = [none]
}
beanCollections.put(type, beanNames);
return beanNames;
} } |
public class class_name {
public RolloverDescription initialize(
final String currentActiveFile, final boolean append) {
long n = System.currentTimeMillis();
nextCheck = ((n / 1000) + 1) * 1000;
StringBuffer buf = new StringBuffer();
formatFileName(new Date(n), buf);
lastFileName = buf.toString();
//
// RollingPolicyBase.activeFileName duplicates RollingFileAppender.file
// and should be removed.
//
if (activeFileName != null) {
return new RolloverDescriptionImpl(activeFileName, append, null, null);
} else if (currentActiveFile != null) {
return new RolloverDescriptionImpl(
currentActiveFile, append, null, null);
} else {
return new RolloverDescriptionImpl(
lastFileName.substring(0, lastFileName.length() - suffixLength), append,
null, null);
}
} } | public class class_name {
public RolloverDescription initialize(
final String currentActiveFile, final boolean append) {
long n = System.currentTimeMillis();
nextCheck = ((n / 1000) + 1) * 1000;
StringBuffer buf = new StringBuffer();
formatFileName(new Date(n), buf);
lastFileName = buf.toString();
//
// RollingPolicyBase.activeFileName duplicates RollingFileAppender.file
// and should be removed.
//
if (activeFileName != null) {
return new RolloverDescriptionImpl(activeFileName, append, null, null); // depends on control dependency: [if], data = [(activeFileName]
} else if (currentActiveFile != null) {
return new RolloverDescriptionImpl(
currentActiveFile, append, null, null); // depends on control dependency: [if], data = [none]
} else {
return new RolloverDescriptionImpl(
lastFileName.substring(0, lastFileName.length() - suffixLength), append,
null, null); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void main(String[] args) {
CollectionValuedMap<Integer, Integer> originalMap = new CollectionValuedMap<Integer, Integer>();
/*
for (int i=0; i<4; i++) {
for (int j=0; j<4; j++) {
originalMap.add(new Integer(i), new Integer(j));
}
}
originalMap.remove(new Integer(2));
System.out.println("Map: ");
System.out.println(originalMap);
System.exit(0);
*/
Random r = new Random();
for (int i = 0; i < 800; i++) {
Integer rInt1 = Integer.valueOf(r.nextInt(400));
Integer rInt2 = Integer.valueOf(r.nextInt(400));
originalMap.add(rInt1, rInt2);
System.out.println("Adding " + rInt1 + ' ' + rInt2);
}
CollectionValuedMap<Integer, Integer> originalCopyMap = new CollectionValuedMap<Integer, Integer>(originalMap);
CollectionValuedMap<Integer, Integer> deltaCopyMap = new CollectionValuedMap<Integer, Integer>(originalMap);
CollectionValuedMap<Integer, Integer> deltaMap = new DeltaCollectionValuedMap<Integer, Integer>(originalMap);
// now make a lot of changes to deltaMap;
// add and change some stuff
for (int i = 0; i < 400; i++) {
Integer rInt1 = Integer.valueOf(r.nextInt(400));
Integer rInt2 = Integer.valueOf(r.nextInt(400) + 1000);
deltaMap.add(rInt1, rInt2);
deltaCopyMap.add(rInt1, rInt2);
System.out.println("Adding " + rInt1 + ' ' + rInt2);
}
// remove some stuff
for (int i = 0; i < 400; i++) {
Integer rInt1 = Integer.valueOf(r.nextInt(1400));
Integer rInt2 = Integer.valueOf(r.nextInt(1400));
deltaMap.removeMapping(rInt1, rInt2);
deltaCopyMap.removeMapping(rInt1, rInt2);
System.out.println("Removing " + rInt1 + ' ' + rInt2);
}
System.out.println("original: " + originalMap);
System.out.println("copy: " + deltaCopyMap);
System.out.println("delta: " + deltaMap);
System.out.println("Original preserved? " + originalCopyMap.equals(originalMap));
System.out.println("Delta accurate? " + deltaMap.equals(deltaCopyMap));
} } | public class class_name {
public static void main(String[] args) {
CollectionValuedMap<Integer, Integer> originalMap = new CollectionValuedMap<Integer, Integer>();
/*
for (int i=0; i<4; i++) {
for (int j=0; j<4; j++) {
originalMap.add(new Integer(i), new Integer(j));
}
}
originalMap.remove(new Integer(2));
System.out.println("Map: ");
System.out.println(originalMap);
System.exit(0);
*/
Random r = new Random();
for (int i = 0; i < 800; i++) {
Integer rInt1 = Integer.valueOf(r.nextInt(400));
Integer rInt2 = Integer.valueOf(r.nextInt(400));
originalMap.add(rInt1, rInt2);
// depends on control dependency: [for], data = [none]
System.out.println("Adding " + rInt1 + ' ' + rInt2);
// depends on control dependency: [for], data = [none]
}
CollectionValuedMap<Integer, Integer> originalCopyMap = new CollectionValuedMap<Integer, Integer>(originalMap);
CollectionValuedMap<Integer, Integer> deltaCopyMap = new CollectionValuedMap<Integer, Integer>(originalMap);
CollectionValuedMap<Integer, Integer> deltaMap = new DeltaCollectionValuedMap<Integer, Integer>(originalMap);
// now make a lot of changes to deltaMap;
// add and change some stuff
for (int i = 0; i < 400; i++) {
Integer rInt1 = Integer.valueOf(r.nextInt(400));
Integer rInt2 = Integer.valueOf(r.nextInt(400) + 1000);
deltaMap.add(rInt1, rInt2);
// depends on control dependency: [for], data = [none]
deltaCopyMap.add(rInt1, rInt2);
// depends on control dependency: [for], data = [none]
System.out.println("Adding " + rInt1 + ' ' + rInt2);
// depends on control dependency: [for], data = [none]
}
// remove some stuff
for (int i = 0; i < 400; i++) {
Integer rInt1 = Integer.valueOf(r.nextInt(1400));
Integer rInt2 = Integer.valueOf(r.nextInt(1400));
deltaMap.removeMapping(rInt1, rInt2);
// depends on control dependency: [for], data = [none]
deltaCopyMap.removeMapping(rInt1, rInt2);
// depends on control dependency: [for], data = [none]
System.out.println("Removing " + rInt1 + ' ' + rInt2);
// depends on control dependency: [for], data = [none]
}
System.out.println("original: " + originalMap);
System.out.println("copy: " + deltaCopyMap);
System.out.println("delta: " + deltaMap);
System.out.println("Original preserved? " + originalCopyMap.equals(originalMap));
System.out.println("Delta accurate? " + deltaMap.equals(deltaCopyMap));
} } |
public class class_name {
public void finish() {
if (gcs.size() == 1)
return;
if (gcs.size() == 2) {
List hcs = getHorizCoordSys();
GridDefRecord.compare((GridDefRecord) hcs.get(0), (GridDefRecord) hcs.get(1));
}
} } | public class class_name {
public void finish() {
if (gcs.size() == 1)
return;
if (gcs.size() == 2) {
List hcs = getHorizCoordSys();
GridDefRecord.compare((GridDefRecord) hcs.get(0), (GridDefRecord) hcs.get(1)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void printViolations(Violations violations, PrintWriter out) {
out.println("Violations found:");
if (violations.hasViolations()) {
for (Violation violation : violations.asList()) {
out.println(" - " + violation);
}
} else {
out.println(" - No violations found.");
}
} } | public class class_name {
private void printViolations(Violations violations, PrintWriter out) {
out.println("Violations found:");
if (violations.hasViolations()) {
for (Violation violation : violations.asList()) {
out.println(" - " + violation); // depends on control dependency: [for], data = [violation]
}
} else {
out.println(" - No violations found."); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean addTitle(String title) {
try {
return add(new Meta(Element.TITLE, title));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} } | public class class_name {
public boolean addTitle(String title) {
try {
return add(new Meta(Element.TITLE, title)); // depends on control dependency: [try], data = [none]
} catch (DocumentException de) {
throw new ExceptionConverter(de);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setInstanceInfos(java.util.Collection<InstanceInfo> instanceInfos) {
if (instanceInfos == null) {
this.instanceInfos = null;
return;
}
this.instanceInfos = new com.amazonaws.internal.SdkInternalList<InstanceInfo>(instanceInfos);
} } | public class class_name {
public void setInstanceInfos(java.util.Collection<InstanceInfo> instanceInfos) {
if (instanceInfos == null) {
this.instanceInfos = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.instanceInfos = new com.amazonaws.internal.SdkInternalList<InstanceInfo>(instanceInfos);
} } |
public class class_name {
private static String printCommentTree(CommentTreeElement c, int level) {
// Initialize empty buffer
StringBuilder builder = new StringBuilder();
// Add tabulation
for (int i = 0; i < level; i++) {
builder.append("\t");
}
// Comment string
builder.append(c.toString());
builder.append("\n");
// Iterate over children
if (c instanceof Comment) {
for (CommentTreeElement child : ((Comment) c).getReplies()) {
builder.append(printCommentTree(child, level + 1));
}
}
// Return the buffer
return builder.toString();
} } | public class class_name {
private static String printCommentTree(CommentTreeElement c, int level) {
// Initialize empty buffer
StringBuilder builder = new StringBuilder();
// Add tabulation
for (int i = 0; i < level; i++) {
builder.append("\t"); // depends on control dependency: [for], data = [none]
}
// Comment string
builder.append(c.toString());
builder.append("\n");
// Iterate over children
if (c instanceof Comment) {
for (CommentTreeElement child : ((Comment) c).getReplies()) {
builder.append(printCommentTree(child, level + 1)); // depends on control dependency: [for], data = [child]
}
}
// Return the buffer
return builder.toString();
} } |
public class class_name {
private static long getTimeFromRunner(
MetricRegistry metrics,
String runnerMetricName
) {
// First get number of total runners from the runtime gauge
RuntimeStats runtimeStats = (RuntimeStats) ((Gauge)getMetric(metrics, "RuntimeStatsGauge.gauge", MetricType.GAUGE)).getValue();
long totalRunners = runtimeStats.getTotalRunners();
long currentTime = System.currentTimeMillis();
long maxTime = 0;
// Then iterate over all runners and find the biggest time difference
for(int runnerId = 0; runnerId < totalRunners; runnerId++) {
Map<String, Object> runnerMetrics = (Map<String, Object>) ((Gauge)getMetric(metrics, "runner." + runnerId, MetricType.GAUGE)).getValue();
// Get current value
long value = (long) runnerMetrics.getOrDefault(runnerMetricName, 0L);
// Zero means that the runner is not in use at all and thus calculating running time makes no sense
if(value == 0) {
continue;
}
long runTime = currentTime - value;
if(maxTime < runTime) {
maxTime = runTime;
}
}
return maxTime;
} } | public class class_name {
private static long getTimeFromRunner(
MetricRegistry metrics,
String runnerMetricName
) {
// First get number of total runners from the runtime gauge
RuntimeStats runtimeStats = (RuntimeStats) ((Gauge)getMetric(metrics, "RuntimeStatsGauge.gauge", MetricType.GAUGE)).getValue();
long totalRunners = runtimeStats.getTotalRunners();
long currentTime = System.currentTimeMillis();
long maxTime = 0;
// Then iterate over all runners and find the biggest time difference
for(int runnerId = 0; runnerId < totalRunners; runnerId++) {
Map<String, Object> runnerMetrics = (Map<String, Object>) ((Gauge)getMetric(metrics, "runner." + runnerId, MetricType.GAUGE)).getValue();
// Get current value
long value = (long) runnerMetrics.getOrDefault(runnerMetricName, 0L);
// Zero means that the runner is not in use at all and thus calculating running time makes no sense
if(value == 0) {
continue;
}
long runTime = currentTime - value;
if(maxTime < runTime) {
maxTime = runTime; // depends on control dependency: [if], data = [none]
}
}
return maxTime;
} } |
public class class_name {
protected void openNewDialog(String id) {
CmsBasicDialog dialog = null;
String caption = "";
if (id.equals(ID_GROUP)) {
dialog = new CmsGroupEditDialog(m_cms, m_window, m_ou, m_app);
caption = CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_GROUP_0);
}
if (id.equals(ID_OU)) {
dialog = new CmsOUEditDialog(m_cms, m_window, m_ou, m_app);
caption = CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_OU_0);
}
if (id.equals(ID_USER)) {
dialog = new CmsUserEditDialog(m_cms, m_window, m_ou, m_app);
caption = CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_USER_0);
}
if (dialog != null) {
m_window.setContent(dialog);
m_window.setCaption(caption);
m_window.center();
}
} } | public class class_name {
protected void openNewDialog(String id) {
CmsBasicDialog dialog = null;
String caption = "";
if (id.equals(ID_GROUP)) {
dialog = new CmsGroupEditDialog(m_cms, m_window, m_ou, m_app); // depends on control dependency: [if], data = [none]
caption = CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_GROUP_0); // depends on control dependency: [if], data = [none]
}
if (id.equals(ID_OU)) {
dialog = new CmsOUEditDialog(m_cms, m_window, m_ou, m_app); // depends on control dependency: [if], data = [none]
caption = CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_OU_0); // depends on control dependency: [if], data = [none]
}
if (id.equals(ID_USER)) {
dialog = new CmsUserEditDialog(m_cms, m_window, m_ou, m_app); // depends on control dependency: [if], data = [none]
caption = CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_ADD_USER_0); // depends on control dependency: [if], data = [none]
}
if (dialog != null) {
m_window.setContent(dialog); // depends on control dependency: [if], data = [(dialog]
m_window.setCaption(caption); // depends on control dependency: [if], data = [none]
m_window.center(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(AddressConfiguration addressConfiguration, ProtocolMarshaller protocolMarshaller) {
if (addressConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(addressConfiguration.getBodyOverride(), BODYOVERRIDE_BINDING);
protocolMarshaller.marshall(addressConfiguration.getChannelType(), CHANNELTYPE_BINDING);
protocolMarshaller.marshall(addressConfiguration.getContext(), CONTEXT_BINDING);
protocolMarshaller.marshall(addressConfiguration.getRawContent(), RAWCONTENT_BINDING);
protocolMarshaller.marshall(addressConfiguration.getSubstitutions(), SUBSTITUTIONS_BINDING);
protocolMarshaller.marshall(addressConfiguration.getTitleOverride(), TITLEOVERRIDE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AddressConfiguration addressConfiguration, ProtocolMarshaller protocolMarshaller) {
if (addressConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(addressConfiguration.getBodyOverride(), BODYOVERRIDE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(addressConfiguration.getChannelType(), CHANNELTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(addressConfiguration.getContext(), CONTEXT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(addressConfiguration.getRawContent(), RAWCONTENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(addressConfiguration.getSubstitutions(), SUBSTITUTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(addressConfiguration.getTitleOverride(), TITLEOVERRIDE_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 FrameNeededResult isFrameNeededForRendering(int index) {
AnimatedDrawableFrameInfo frameInfo = mAnimatedDrawableBackend.getFrameInfo(index);
DisposalMethod disposalMethod = frameInfo.disposalMethod;
if (disposalMethod == DisposalMethod.DISPOSE_DO_NOT) {
// Need this frame so keep going.
return FrameNeededResult.REQUIRED;
} else if (disposalMethod == DisposalMethod.DISPOSE_TO_BACKGROUND) {
if (isFullFrame(frameInfo)) {
// The frame covered the whole image and we're disposing to background,
// so we don't even need to draw this frame.
return FrameNeededResult.NOT_REQUIRED;
} else {
// We need to draw the image. Then erase the part the previous frame covered.
// So keep going.
return FrameNeededResult.REQUIRED;
}
} else if (disposalMethod == DisposalMethod.DISPOSE_TO_PREVIOUS) {
return FrameNeededResult.SKIP;
} else {
return FrameNeededResult.ABORT;
}
} } | public class class_name {
private FrameNeededResult isFrameNeededForRendering(int index) {
AnimatedDrawableFrameInfo frameInfo = mAnimatedDrawableBackend.getFrameInfo(index);
DisposalMethod disposalMethod = frameInfo.disposalMethod;
if (disposalMethod == DisposalMethod.DISPOSE_DO_NOT) {
// Need this frame so keep going.
return FrameNeededResult.REQUIRED; // depends on control dependency: [if], data = [none]
} else if (disposalMethod == DisposalMethod.DISPOSE_TO_BACKGROUND) {
if (isFullFrame(frameInfo)) {
// The frame covered the whole image and we're disposing to background,
// so we don't even need to draw this frame.
return FrameNeededResult.NOT_REQUIRED; // depends on control dependency: [if], data = [none]
} else {
// We need to draw the image. Then erase the part the previous frame covered.
// So keep going.
return FrameNeededResult.REQUIRED; // depends on control dependency: [if], data = [none]
}
} else if (disposalMethod == DisposalMethod.DISPOSE_TO_PREVIOUS) {
return FrameNeededResult.SKIP; // depends on control dependency: [if], data = [none]
} else {
return FrameNeededResult.ABORT; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public EEnum getIfcCurrencyEnum() {
if (ifcCurrencyEnumEEnum == null) {
ifcCurrencyEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(805);
}
return ifcCurrencyEnumEEnum;
} } | public class class_name {
public EEnum getIfcCurrencyEnum() {
if (ifcCurrencyEnumEEnum == null) {
ifcCurrencyEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(805);
// depends on control dependency: [if], data = [none]
}
return ifcCurrencyEnumEEnum;
} } |
public class class_name {
public void clientConnected(IDbgpSession session)
{
final IDbgpSessionInfo info = session.getInfo();
if (info != null)
{
final IDbgpThreadAcceptor acceptor = (IDbgpThreadAcceptor) acceptors.get(info.getIdeKey());
if (acceptor != null)
{
acceptor.acceptDbgpThread(session, new NullProgressMonitor());
} else
{
session.requestTermination();
}
}
} } | public class class_name {
public void clientConnected(IDbgpSession session)
{
final IDbgpSessionInfo info = session.getInfo();
if (info != null)
{
final IDbgpThreadAcceptor acceptor = (IDbgpThreadAcceptor) acceptors.get(info.getIdeKey());
if (acceptor != null)
{
acceptor.acceptDbgpThread(session, new NullProgressMonitor()); // depends on control dependency: [if], data = [none]
} else
{
session.requestTermination(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public <RET extends ORecord> RET save(ORecord iRecord, String iClusterName, final OPERATION_MODE iMode, boolean iForceCreate,
final ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback) {
checkOpenness();
if (iRecord instanceof OVertex) {
iRecord = iRecord.getRecord();
}
if (iRecord instanceof OEdge) {
if (((OEdge) iRecord).isLightweight()) {
iRecord = ((OEdge) iRecord).getFrom();
} else {
iRecord = iRecord.getRecord();
}
}
ODirtyManager dirtyManager = ORecordInternal.getDirtyManager(iRecord);
if (iRecord instanceof OElement && dirtyManager != null && dirtyManager.getReferences() != null && !dirtyManager.getReferences()
.isEmpty()) {
if ((((OElement) iRecord).isVertex() || ((OElement) iRecord).isEdge()) && !getTransaction().isActive() && inHook.isEmpty()) {
return saveGraph(iRecord, iClusterName, iMode, iForceCreate, iRecordCreatedCallback, iRecordUpdatedCallback);
}
}
return saveInternal(iRecord, iClusterName, iMode, iForceCreate, iRecordCreatedCallback, iRecordUpdatedCallback);
} } | public class class_name {
@Override
public <RET extends ORecord> RET save(ORecord iRecord, String iClusterName, final OPERATION_MODE iMode, boolean iForceCreate,
final ORecordCallback<? extends Number> iRecordCreatedCallback, ORecordCallback<Integer> iRecordUpdatedCallback) {
checkOpenness();
if (iRecord instanceof OVertex) {
iRecord = iRecord.getRecord(); // depends on control dependency: [if], data = [none]
}
if (iRecord instanceof OEdge) {
if (((OEdge) iRecord).isLightweight()) {
iRecord = ((OEdge) iRecord).getFrom(); // depends on control dependency: [if], data = [none]
} else {
iRecord = iRecord.getRecord(); // depends on control dependency: [if], data = [none]
}
}
ODirtyManager dirtyManager = ORecordInternal.getDirtyManager(iRecord);
if (iRecord instanceof OElement && dirtyManager != null && dirtyManager.getReferences() != null && !dirtyManager.getReferences()
.isEmpty()) {
if ((((OElement) iRecord).isVertex() || ((OElement) iRecord).isEdge()) && !getTransaction().isActive() && inHook.isEmpty()) {
return saveGraph(iRecord, iClusterName, iMode, iForceCreate, iRecordCreatedCallback, iRecordUpdatedCallback); // depends on control dependency: [if], data = [none]
}
}
return saveInternal(iRecord, iClusterName, iMode, iForceCreate, iRecordCreatedCallback, iRecordUpdatedCallback);
} } |
public class class_name {
public void setDiskSnapshots(java.util.Collection<DiskSnapshot> diskSnapshots) {
if (diskSnapshots == null) {
this.diskSnapshots = null;
return;
}
this.diskSnapshots = new java.util.ArrayList<DiskSnapshot>(diskSnapshots);
} } | public class class_name {
public void setDiskSnapshots(java.util.Collection<DiskSnapshot> diskSnapshots) {
if (diskSnapshots == null) {
this.diskSnapshots = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.diskSnapshots = new java.util.ArrayList<DiskSnapshot>(diskSnapshots);
} } |
public class class_name {
public boolean loadFallback() {
try {
if (fallbackLocation == null) {
Logger.getLogger(getClass().getName()).warning("No fallback resource for " + this +
", loadFallback not supported.");
return false;
}
load(fallbackLocation, true);
clearCache();
return true;
} catch (Exception e) {
LOG.log(Level.SEVERE, "Failed to load fallback resource: " + fallbackLocation, e);
}
return false;
} } | public class class_name {
public boolean loadFallback() {
try {
if (fallbackLocation == null) {
Logger.getLogger(getClass().getName()).warning("No fallback resource for " + this +
", loadFallback not supported."); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
load(fallbackLocation, true); // depends on control dependency: [try], data = [none]
clearCache(); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.log(Level.SEVERE, "Failed to load fallback resource: " + fallbackLocation, e);
} // depends on control dependency: [catch], data = [none]
return false;
} } |
public class class_name {
public void intern() {
symbol = symbol.intern();
if (leftChild != null) {
leftChild.intern();
}
if (rightChild != null) {
rightChild.intern();
}
} } | public class class_name {
public void intern() {
symbol = symbol.intern();
if (leftChild != null) {
leftChild.intern(); // depends on control dependency: [if], data = [none]
}
if (rightChild != null) {
rightChild.intern(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <T> Optional<Constructor<T>> findConstructor(Class<T> type, Class... argTypes) {
try {
return Optional.of(type.getDeclaredConstructor(argTypes));
} catch (NoSuchMethodException e) {
return Optional.empty();
}
} } | public class class_name {
public static <T> Optional<Constructor<T>> findConstructor(Class<T> type, Class... argTypes) {
try {
return Optional.of(type.getDeclaredConstructor(argTypes)); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
return Optional.empty();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void processAllExitProbeExtensions(Event event, RequestContext requestContext) {
List<ProbeExtension> probeExtnList = RequestProbeService.getProbeExtensions();
for (int i = 0; i < probeExtnList.size(); i ++) {
ProbeExtension probeExtension = probeExtnList.get(i);
try{
// Exit enabled??
if (probeExtension.invokeForEventExit()) {
// To be sampled ??
if (requestContext.getRequestId().getSequenceNumber() % probeExtension.getRequestSampleRate() == 0) {
if (event == requestContext.getRootEvent() && probeExtension.invokeForRootEventsOnly() == true
&& (probeExtension.invokeForEventTypes() == null || probeExtension.invokeForEventTypes().contains(event.getType()))) {
probeExtension.processExitEvent(event, requestContext);
}
if (probeExtension.invokeForRootEventsOnly() == false
&& (probeExtension.invokeForEventTypes() == null || probeExtension.invokeForEventTypes().contains(event.getType()))) {
probeExtension.processExitEvent(event, requestContext);
}
}
}
}catch(Exception e){
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "----------------Probe extension invocation failure---------------");
Tr.debug(tc, probeExtension.getClass().getName() + ".processExitEvent failed because of the following reason:" );
Tr.debug(tc, e.getMessage());
}
FFDCFilter.processException(e, RequestProbeService.class.getName() + ".processAllExitProbeExtensions", "185");
}
}
if (event == requestContext.getRootEvent()) {
// Remove the request from active request list
try{
RequestContext storedRequestContext = activeRequests.get(requestContext.getRequestContextIndex());
// 1) Check to handle stale requests.
// A long running stale request from the last time the feature was enabled could potentially
// end up evicting a valid request that is occupying the same slot in the list.
// 2) Also check if the returned request context is null, this can happen when we remove the feature while
// a request is executing as we clean up the active requests list and the slot no longer holds a request context.
if(storedRequestContext != null && (storedRequestContext.getRequestId() == requestContext.getRequestId()))
activeRequests.remove(requestContext.getRequestContextIndex());
}catch(ArrayIndexOutOfBoundsException e){
//Do nothing as this can fail for an in-flight request when the feature is disabled
//Rational being, the active request list gets reset and this index can no longer be valid.
}
}
} } | public class class_name {
public static void processAllExitProbeExtensions(Event event, RequestContext requestContext) {
List<ProbeExtension> probeExtnList = RequestProbeService.getProbeExtensions();
for (int i = 0; i < probeExtnList.size(); i ++) {
ProbeExtension probeExtension = probeExtnList.get(i);
try{
// Exit enabled??
if (probeExtension.invokeForEventExit()) {
// To be sampled ??
if (requestContext.getRequestId().getSequenceNumber() % probeExtension.getRequestSampleRate() == 0) {
if (event == requestContext.getRootEvent() && probeExtension.invokeForRootEventsOnly() == true
&& (probeExtension.invokeForEventTypes() == null || probeExtension.invokeForEventTypes().contains(event.getType()))) {
probeExtension.processExitEvent(event, requestContext); // depends on control dependency: [if], data = [(event]
}
if (probeExtension.invokeForRootEventsOnly() == false
&& (probeExtension.invokeForEventTypes() == null || probeExtension.invokeForEventTypes().contains(event.getType()))) {
probeExtension.processExitEvent(event, requestContext); // depends on control dependency: [if], data = [none]
}
}
}
}catch(Exception e){
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "----------------Probe extension invocation failure---------------"); // depends on control dependency: [if], data = [none]
Tr.debug(tc, probeExtension.getClass().getName() + ".processExitEvent failed because of the following reason:" ); // depends on control dependency: [if], data = [none]
Tr.debug(tc, e.getMessage()); // depends on control dependency: [if], data = [none]
}
FFDCFilter.processException(e, RequestProbeService.class.getName() + ".processAllExitProbeExtensions", "185");
} // depends on control dependency: [catch], data = [none]
}
if (event == requestContext.getRootEvent()) {
// Remove the request from active request list
try{
RequestContext storedRequestContext = activeRequests.get(requestContext.getRequestContextIndex());
// 1) Check to handle stale requests.
// A long running stale request from the last time the feature was enabled could potentially
// end up evicting a valid request that is occupying the same slot in the list.
// 2) Also check if the returned request context is null, this can happen when we remove the feature while
// a request is executing as we clean up the active requests list and the slot no longer holds a request context.
if(storedRequestContext != null && (storedRequestContext.getRequestId() == requestContext.getRequestId()))
activeRequests.remove(requestContext.getRequestContextIndex());
}catch(ArrayIndexOutOfBoundsException e){
//Do nothing as this can fail for an in-flight request when the feature is disabled
//Rational being, the active request list gets reset and this index can no longer be valid.
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void populateReference(final Reference reference,
final Map properties, final Map defaults) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "populateReference", new Object[] {
reference, properties, defaults});
}
// Make sure no-one can pull the rug from beneath us.
synchronized (properties) {
// Convert the map of properties into an encoded form, where the
// keys have the necessary prefix on the front, and the values are
// all Strings.
Map<String,String> encodedMap = getStringEncodedMap(properties,defaults);
for(Map.Entry<String,String> entry : encodedMap.entrySet())
{
reference.add(new StringRefAddr(entry.getKey(),entry.getValue()));
}
}//sync
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "populateReference");
}
} } | public class class_name {
public void populateReference(final Reference reference,
final Map properties, final Map defaults) {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "populateReference", new Object[] {
reference, properties, defaults}); // depends on control dependency: [if], data = [none]
}
// Make sure no-one can pull the rug from beneath us.
synchronized (properties) {
// Convert the map of properties into an encoded form, where the
// keys have the necessary prefix on the front, and the values are
// all Strings.
Map<String,String> encodedMap = getStringEncodedMap(properties,defaults);
for(Map.Entry<String,String> entry : encodedMap.entrySet())
{
reference.add(new StringRefAddr(entry.getKey(),entry.getValue())); // depends on control dependency: [for], data = [entry]
}
}//sync
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "populateReference"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DisassociateDRTLogBucketRequest disassociateDRTLogBucketRequest, ProtocolMarshaller protocolMarshaller) {
if (disassociateDRTLogBucketRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(disassociateDRTLogBucketRequest.getLogBucket(), LOGBUCKET_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DisassociateDRTLogBucketRequest disassociateDRTLogBucketRequest, ProtocolMarshaller protocolMarshaller) {
if (disassociateDRTLogBucketRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(disassociateDRTLogBucketRequest.getLogBucket(), LOGBUCKET_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 static void setFieldValue(final Object object, final String fieldName, final Object value) {
final boolean success = new DerivedClassIterator(object.getClass()) {
@Override
protected boolean handleClass(final Class<?> clazz) {
try {
setFieldValue(object, clazz, fieldName, value);
return true;
} catch (final NoSuchFieldException e) {
LOG.debug("could not set field " + fieldName + " value " + value, e);
}
return false;
}
}.iterate();
if (!success) {
LOG.warn("could not set field " + fieldName + " value " + value);
}
} } | public class class_name {
public static void setFieldValue(final Object object, final String fieldName, final Object value) {
final boolean success = new DerivedClassIterator(object.getClass()) {
@Override
protected boolean handleClass(final Class<?> clazz) {
try {
setFieldValue(object, clazz, fieldName, value); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (final NoSuchFieldException e) {
LOG.debug("could not set field " + fieldName + " value " + value, e);
} // depends on control dependency: [catch], data = [none]
return false;
}
}.iterate();
if (!success) {
LOG.warn("could not set field " + fieldName + " value " + value); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void parse (final int nYear, final HolidayMap aHolidayMap, final Holidays aConfig)
{
for (final RelativeToEasterSunday aDay : aConfig.getRelativeToEasterSunday ())
{
if (!isValid (aDay, nYear))
continue;
final ChronoLocalDate aEasterSunday = getEasterSunday (nYear, aDay.getChronology ());
aEasterSunday.plus (aDay.getDays (), ChronoUnit.DAYS);
final String sPropertiesKey = "christian." + aDay.getDescriptionPropertiesKey ();
addChrstianHoliday (aEasterSunday,
sPropertiesKey,
XMLHolidayHelper.getType (aDay.getLocalizedType ()),
aHolidayMap);
}
} } | public class class_name {
public void parse (final int nYear, final HolidayMap aHolidayMap, final Holidays aConfig)
{
for (final RelativeToEasterSunday aDay : aConfig.getRelativeToEasterSunday ())
{
if (!isValid (aDay, nYear))
continue;
final ChronoLocalDate aEasterSunday = getEasterSunday (nYear, aDay.getChronology ());
aEasterSunday.plus (aDay.getDays (), ChronoUnit.DAYS); // depends on control dependency: [for], data = [aDay]
final String sPropertiesKey = "christian." + aDay.getDescriptionPropertiesKey ();
addChrstianHoliday (aEasterSunday,
sPropertiesKey,
XMLHolidayHelper.getType (aDay.getLocalizedType ()),
aHolidayMap); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public void setGradationColor(GradationMode3D mode, Color color1, Color color2) {
setGradation(true);
if (startColor == null || endColor == null) {
startColor = new RGBColor(0.0, 0.0, 0.0);
endColor = new RGBColor(0.0, 0.0, 0.0);
}
startColor = color1;
endColor = color2;
this.mode = mode;
setGradationCorner();
} } | public class class_name {
public void setGradationColor(GradationMode3D mode, Color color1, Color color2) {
setGradation(true);
if (startColor == null || endColor == null) {
startColor = new RGBColor(0.0, 0.0, 0.0); // depends on control dependency: [if], data = [none]
endColor = new RGBColor(0.0, 0.0, 0.0); // depends on control dependency: [if], data = [none]
}
startColor = color1;
endColor = color2;
this.mode = mode;
setGradationCorner();
} } |
public class class_name {
public Object getService(Class c) {
String thisMethodName = CLASS_NAME + ".getService(Class)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName);
}
return null;
} } | public class class_name {
public Object getService(Class c) {
String thisMethodName = CLASS_NAME + ".getService(Class)";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public Map<String, Map<String, VariantSet>> getSkinMapping(ResourceBrowser rsBrowser, JawrConfig config) {
Map<String, Map<String, VariantSet>> currentSkinMapping = new HashMap<>();
PropertiesConfigHelper props = new PropertiesConfigHelper(config.getConfigProperties(), JawrConstant.CSS_TYPE);
Set<String> skinRootDirectories = props.getPropertyAsSet(JawrConstant.SKIN_DEFAULT_ROOT_DIRS);
if (skinMappingType.equals(JawrConstant.SKIN_TYPE_MAPPING_SKIN_LOCALE)) {
updateSkinMappingUsingTypeSkinLocale(rsBrowser, config, currentSkinMapping, skinRootDirectories);
} else {
updateSkinMappingUsingTypeLocaleSkin(rsBrowser, config, currentSkinMapping, skinRootDirectories);
}
return currentSkinMapping;
} } | public class class_name {
public Map<String, Map<String, VariantSet>> getSkinMapping(ResourceBrowser rsBrowser, JawrConfig config) {
Map<String, Map<String, VariantSet>> currentSkinMapping = new HashMap<>();
PropertiesConfigHelper props = new PropertiesConfigHelper(config.getConfigProperties(), JawrConstant.CSS_TYPE);
Set<String> skinRootDirectories = props.getPropertyAsSet(JawrConstant.SKIN_DEFAULT_ROOT_DIRS);
if (skinMappingType.equals(JawrConstant.SKIN_TYPE_MAPPING_SKIN_LOCALE)) {
updateSkinMappingUsingTypeSkinLocale(rsBrowser, config, currentSkinMapping, skinRootDirectories); // depends on control dependency: [if], data = [none]
} else {
updateSkinMappingUsingTypeLocaleSkin(rsBrowser, config, currentSkinMapping, skinRootDirectories); // depends on control dependency: [if], data = [none]
}
return currentSkinMapping;
} } |
public class class_name {
protected void deleteRecordFromCounterColumnFamily(Object pKey, String tableName, EntityMetadata metadata,
ConsistencyLevel consistencyLevel) {
ColumnPath path = new ColumnPath(tableName);
Cassandra.Client conn = null;
Object pooledConnection = null;
try {
pooledConnection = getConnection();
conn = (org.apache.cassandra.thrift.Cassandra.Client) getConnection(pooledConnection);
if (log.isInfoEnabled()) {
log.info("Removing data for counter column family {}.", tableName);
}
conn.remove_counter((CassandraUtilities.toBytes(pKey, metadata.getIdAttribute().getJavaType())), path,
consistencyLevel);
} catch (Exception e) {
log.error("Error during executing delete, Caused by: .", e);
throw new PersistenceException(e);
} finally {
releaseConnection(pooledConnection);
}
} } | public class class_name {
protected void deleteRecordFromCounterColumnFamily(Object pKey, String tableName, EntityMetadata metadata,
ConsistencyLevel consistencyLevel) {
ColumnPath path = new ColumnPath(tableName);
Cassandra.Client conn = null;
Object pooledConnection = null;
try {
pooledConnection = getConnection(); // depends on control dependency: [try], data = [none]
conn = (org.apache.cassandra.thrift.Cassandra.Client) getConnection(pooledConnection); // depends on control dependency: [try], data = [none]
if (log.isInfoEnabled()) {
log.info("Removing data for counter column family {}.", tableName); // depends on control dependency: [if], data = [none]
}
conn.remove_counter((CassandraUtilities.toBytes(pKey, metadata.getIdAttribute().getJavaType())), path,
consistencyLevel); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Error during executing delete, Caused by: .", e);
throw new PersistenceException(e);
} finally { // depends on control dependency: [catch], data = [none]
releaseConnection(pooledConnection);
}
} } |
public class class_name {
public static TypeDeclarationNode unionType(Iterable<TypeDeclarationNode> options) {
checkArgument(!Iterables.isEmpty(options), "union must have at least one option");
TypeDeclarationNode node = new TypeDeclarationNode(Token.UNION_TYPE);
for (Node option : options) {
node.addChildToBack(option);
}
return node;
} } | public class class_name {
public static TypeDeclarationNode unionType(Iterable<TypeDeclarationNode> options) {
checkArgument(!Iterables.isEmpty(options), "union must have at least one option");
TypeDeclarationNode node = new TypeDeclarationNode(Token.UNION_TYPE);
for (Node option : options) {
node.addChildToBack(option); // depends on control dependency: [for], data = [option]
}
return node;
} } |
public class class_name {
static <T> List<T> executeOraBlock(Connection connection, String sql, Class<T> clazz, List<SqlParam> sqlParams) throws SQLException {
String cursorParam = null;
List<T> list = new ArrayList<T>();
//boolean autoCommitOrig = connection.getAutoCommit();
//if (autoCommitOrig == true) {
// connection.setAutoCommit(false); // to able to read from temp-tables
//}
CallableStatement stmt = null;
ResultSet resultSet = null;
try {
stmt = connection.prepareCall(sql);
cursorParam = stmtAssignSqlParams(stmt, sqlParams);
boolean hasRs = stmt.execute();
if (cursorParam != null) {
resultSet = (ResultSet) stmt.getObject(cursorParam);
list = resultSetToList(resultSet, clazz);
}
} finally {
try { if (resultSet != null) resultSet.close(); } catch (Exception e) {logger.error("Cannot close resultSet", e);};
//if (autoCommitOrig == true)
// connection.setAutoCommit(autoCommitOrig);
try { if (stmt != null) stmt.close(); } catch (Exception e) {logger.error("Cannot close statement", e);};
}
return list;
} } | public class class_name {
static <T> List<T> executeOraBlock(Connection connection, String sql, Class<T> clazz, List<SqlParam> sqlParams) throws SQLException {
String cursorParam = null;
List<T> list = new ArrayList<T>();
//boolean autoCommitOrig = connection.getAutoCommit();
//if (autoCommitOrig == true) {
// connection.setAutoCommit(false); // to able to read from temp-tables
//}
CallableStatement stmt = null;
ResultSet resultSet = null;
try {
stmt = connection.prepareCall(sql);
cursorParam = stmtAssignSqlParams(stmt, sqlParams);
boolean hasRs = stmt.execute();
if (cursorParam != null) {
resultSet = (ResultSet) stmt.getObject(cursorParam); // depends on control dependency: [if], data = [(cursorParam]
list = resultSetToList(resultSet, clazz); // depends on control dependency: [if], data = [none]
}
} finally {
try { if (resultSet != null) resultSet.close(); } catch (Exception e) {logger.error("Cannot close resultSet", e);}; // depends on control dependency: [catch], data = [none]
//if (autoCommitOrig == true)
// connection.setAutoCommit(autoCommitOrig);
try { if (stmt != null) stmt.close(); } catch (Exception e) {logger.error("Cannot close statement", e);}; // depends on control dependency: [catch], data = [none]
}
return list;
} } |
public class class_name {
public static boolean isTableMaterializeViewSource(org.voltdb.catalog.Database database,
org.voltdb.catalog.Table table)
{
CatalogMap<Table> tables = database.getTables();
for (Table t : tables) {
Table matsrc = t.getMaterializer();
if ((matsrc != null) && (matsrc.getRelativeIndex() == table.getRelativeIndex())) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean isTableMaterializeViewSource(org.voltdb.catalog.Database database,
org.voltdb.catalog.Table table)
{
CatalogMap<Table> tables = database.getTables();
for (Table t : tables) {
Table matsrc = t.getMaterializer();
if ((matsrc != null) && (matsrc.getRelativeIndex() == table.getRelativeIndex())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void marshall(TerminologyProperties terminologyProperties, ProtocolMarshaller protocolMarshaller) {
if (terminologyProperties == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(terminologyProperties.getName(), NAME_BINDING);
protocolMarshaller.marshall(terminologyProperties.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(terminologyProperties.getArn(), ARN_BINDING);
protocolMarshaller.marshall(terminologyProperties.getSourceLanguageCode(), SOURCELANGUAGECODE_BINDING);
protocolMarshaller.marshall(terminologyProperties.getTargetLanguageCodes(), TARGETLANGUAGECODES_BINDING);
protocolMarshaller.marshall(terminologyProperties.getEncryptionKey(), ENCRYPTIONKEY_BINDING);
protocolMarshaller.marshall(terminologyProperties.getSizeBytes(), SIZEBYTES_BINDING);
protocolMarshaller.marshall(terminologyProperties.getTermCount(), TERMCOUNT_BINDING);
protocolMarshaller.marshall(terminologyProperties.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(terminologyProperties.getLastUpdatedAt(), LASTUPDATEDAT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(TerminologyProperties terminologyProperties, ProtocolMarshaller protocolMarshaller) {
if (terminologyProperties == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(terminologyProperties.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(terminologyProperties.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(terminologyProperties.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(terminologyProperties.getSourceLanguageCode(), SOURCELANGUAGECODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(terminologyProperties.getTargetLanguageCodes(), TARGETLANGUAGECODES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(terminologyProperties.getEncryptionKey(), ENCRYPTIONKEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(terminologyProperties.getSizeBytes(), SIZEBYTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(terminologyProperties.getTermCount(), TERMCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(terminologyProperties.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(terminologyProperties.getLastUpdatedAt(), LASTUPDATEDAT_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 addTaskStates(Collection<TaskState> taskStates) {
for (TaskState taskState : taskStates) {
this.taskStates.put(taskState.getTaskId(), taskState);
}
} } | public class class_name {
public void addTaskStates(Collection<TaskState> taskStates) {
for (TaskState taskState : taskStates) {
this.taskStates.put(taskState.getTaskId(), taskState); // depends on control dependency: [for], data = [taskState]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T[] toArray(Iterable<? extends T> iterable, Class<T> type) {
Collection<T> collection;
if (iterable instanceof Collection) {
collection = (Collection<T>) iterable;
} else {
collection = new ArrayList<T>();
for (T element : iterable) {
collection.add(element);
}
}
T[] array = (T[]) Array.newInstance(type, collection.size());
return collection.toArray(array);
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> T[] toArray(Iterable<? extends T> iterable, Class<T> type) {
Collection<T> collection;
if (iterable instanceof Collection) {
collection = (Collection<T>) iterable; // depends on control dependency: [if], data = [none]
} else {
collection = new ArrayList<T>(); // depends on control dependency: [if], data = [none]
for (T element : iterable) {
collection.add(element); // depends on control dependency: [for], data = [element]
}
}
T[] array = (T[]) Array.newInstance(type, collection.size());
return collection.toArray(array);
} } |
public class class_name {
public static MetadataService getMetadataService(ServiceRequestContext ctx) {
final MetadataService mds = ctx.attr(METADATA_SERVICE_ATTRIBUTE_KEY).get();
if (mds != null) {
return mds;
}
throw new IllegalStateException("No metadata service instance exists.");
} } | public class class_name {
public static MetadataService getMetadataService(ServiceRequestContext ctx) {
final MetadataService mds = ctx.attr(METADATA_SERVICE_ATTRIBUTE_KEY).get();
if (mds != null) {
return mds; // depends on control dependency: [if], data = [none]
}
throw new IllegalStateException("No metadata service instance exists.");
} } |
public class class_name {
public EEnum getOBPYoaOrent() {
if (obpYoaOrentEEnum == null) {
obpYoaOrentEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(55);
}
return obpYoaOrentEEnum;
} } | public class class_name {
public EEnum getOBPYoaOrent() {
if (obpYoaOrentEEnum == null) {
obpYoaOrentEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(55); // depends on control dependency: [if], data = [none]
}
return obpYoaOrentEEnum;
} } |
public class class_name {
@Pure
public int lastIndexOf(RoadSegment segment) {
int count = 0;
int index;
int lastIndex = -1;
for (final RoadPath p : this.paths) {
index = p.lastIndexOf(segment);
if (index >= 0) {
lastIndex = count + index;
}
count += p.size();
}
return lastIndex;
} } | public class class_name {
@Pure
public int lastIndexOf(RoadSegment segment) {
int count = 0;
int index;
int lastIndex = -1;
for (final RoadPath p : this.paths) {
index = p.lastIndexOf(segment); // depends on control dependency: [for], data = [p]
if (index >= 0) {
lastIndex = count + index; // depends on control dependency: [if], data = [none]
}
count += p.size(); // depends on control dependency: [for], data = [p]
}
return lastIndex;
} } |
public class class_name {
private void populateTasks(JobDetails job) throws IOException {
// TODO: see if we can merge common logic here with
// populateTasks(List<Flow>)
Table taskTable = hbaseConnection
.getTable(TableName.valueOf(Constants.HISTORY_TASK_TABLE));
Scan scan = getTaskScan(job.getJobKey());
ResultScanner scanner = taskTable.getScanner(scan);
try {
// advance through the scanner til we pass keys matching the job
for (Result currentResult : scanner) {
if (currentResult == null || currentResult.isEmpty()) {
break;
}
TaskKey taskKey = taskKeyConv.fromBytes(currentResult.getRow());
TaskDetails task = new TaskDetails(taskKey);
task.populate(currentResult.getFamilyMap(Constants.INFO_FAM_BYTES));
job.addTask(task);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Added " + job.getTasks().size() + " tasks to job "
+ job.getJobKey().toString());
}
} finally {
scanner.close();
taskTable.close();
}
} } | public class class_name {
private void populateTasks(JobDetails job) throws IOException {
// TODO: see if we can merge common logic here with
// populateTasks(List<Flow>)
Table taskTable = hbaseConnection
.getTable(TableName.valueOf(Constants.HISTORY_TASK_TABLE));
Scan scan = getTaskScan(job.getJobKey());
ResultScanner scanner = taskTable.getScanner(scan);
try {
// advance through the scanner til we pass keys matching the job
for (Result currentResult : scanner) {
if (currentResult == null || currentResult.isEmpty()) {
break;
}
TaskKey taskKey = taskKeyConv.fromBytes(currentResult.getRow());
TaskDetails task = new TaskDetails(taskKey);
task.populate(currentResult.getFamilyMap(Constants.INFO_FAM_BYTES)); // depends on control dependency: [for], data = [currentResult]
job.addTask(task); // depends on control dependency: [for], data = [none]
}
if (LOG.isDebugEnabled()) {
LOG.debug("Added " + job.getTasks().size() + " tasks to job "
+ job.getJobKey().toString()); // depends on control dependency: [if], data = [none]
}
} finally {
scanner.close();
taskTable.close();
}
} } |
public class class_name {
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{ // Read a valid record
if (this.getOwner().getRecord().getField(m_iMainFilesFieldSeq) instanceof DateTimeField)
{
DateTimeField thisField = ((DateTimeField)this.getOwner().getRecord().getField(m_iMainFilesFieldSeq));
double dDate = 0;
if (m_bMoveCurrentTime)
dDate = DateField.currentTime();
else
dDate = DateField.todaysDate();
int iErrorCode = thisField.setValue(dDate, bDisplayOption, iMoveMode); // File written or updated, set the update date
if (iMoveMode == DBConstants.INIT_MOVE)
thisField.setModified(false); // Don't make this record modified just because I set this field.
return iErrorCode;
}
return DBConstants.NORMAL_RETURN;
} } | public class class_name {
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{ // Read a valid record
if (this.getOwner().getRecord().getField(m_iMainFilesFieldSeq) instanceof DateTimeField)
{
DateTimeField thisField = ((DateTimeField)this.getOwner().getRecord().getField(m_iMainFilesFieldSeq));
double dDate = 0;
if (m_bMoveCurrentTime)
dDate = DateField.currentTime();
else
dDate = DateField.todaysDate();
int iErrorCode = thisField.setValue(dDate, bDisplayOption, iMoveMode); // File written or updated, set the update date
if (iMoveMode == DBConstants.INIT_MOVE)
thisField.setModified(false); // Don't make this record modified just because I set this field.
return iErrorCode; // depends on control dependency: [if], data = [none]
}
return DBConstants.NORMAL_RETURN;
} } |
public class class_name {
public void clear() {
synchronized (mLock) {
if (mOriginalValues != null) {
mOriginalValues.clear();
} else {
mObjects.clear();
}
}
if (mNotifyOnChange) notifyDataSetChanged();
} } | public class class_name {
public void clear() {
synchronized (mLock) {
if (mOriginalValues != null) {
mOriginalValues.clear(); // depends on control dependency: [if], data = [none]
} else {
mObjects.clear(); // depends on control dependency: [if], data = [none]
}
}
if (mNotifyOnChange) notifyDataSetChanged();
} } |
public class class_name {
private Collection<Candidate> findCandidateClasses(Outline outline, JClass xmlElementDeclModelClass) {
Map<String, ClassOutline> interfaceImplementations = new HashMap<String, ClassOutline>();
// Visit all classes to create a map "interfaceName -> ClassOutline".
// This map is later used to resolve implementations from interfaces.
for (ClassOutline classOutline : outline.getClasses()) {
for (Iterator<JClass> iter = classOutline.implClass._implements(); iter.hasNext();) {
JClass interfaceClass = iter.next();
if (interfaceClass instanceof JDefinedClass) {
// Don't care if some interfaces collide: value classes have exactly one implementation
interfaceImplementations.put(interfaceClass.fullName(), classOutline);
}
}
}
Collection<Candidate> candidates = new ArrayList<Candidate>();
JClass collectionModelClass = outline.getCodeModel().ref(Collection.class);
JClass xmlSchemaModelClass = outline.getCodeModel().ref(XmlSchema.class);
// Visit all classes created by JAXB processing to collect all potential wrapper classes to be removed:
for (ClassOutline classOutline : outline.getClasses()) {
JDefinedClass candidateClass = classOutline.implClass;
// * The candidate class should not extend any other model class (as the total number of properties in this case will be more than 1)
if (!isHiddenClass(candidateClass._extends())) {
continue;
}
JFieldVar field = null;
// * The candidate class should have exactly one property
for (JFieldVar f : candidateClass.fields().values()) {
if ((f.mods().getValue() & JMod.STATIC) == JMod.STATIC) {
continue;
}
// If there are at least two non-static fields, we discard this candidate:
if (field != null) {
field = null;
break;
}
field = f;
}
// "field" is null if there are no fields (or all fields are static) or there are more then two fields.
// The only property should be a collection, hence it should be class:
if (field == null || !(field.type() instanceof JClass)) {
continue;
}
JClass fieldType = (JClass) field.type();
// * The property should be a collection
if (!collectionModelClass.isAssignableFrom(fieldType)) {
continue;
}
List<JClass> fieldParametrisations = fieldType.getTypeParameters();
// FIXME: All known collections have exactly one parametrisation type.
assert fieldParametrisations.size() == 1;
JDefinedClass fieldParametrisationClass = null;
JDefinedClass fieldParametrisationImpl = null;
// Parametrisations like "List<String>" or "List<Serialazable>" are not considered.
// They are substituted as is and do not require moving of classes.
if (fieldParametrisations.get(0) instanceof JDefinedClass) {
fieldParametrisationClass = (JDefinedClass) fieldParametrisations.get(0);
ClassOutline fieldParametrisationClassOutline = interfaceImplementations
.get(fieldParametrisationClass.fullName());
if (fieldParametrisationClassOutline != null) {
assert fieldParametrisationClassOutline.ref == fieldParametrisationClass;
fieldParametrisationImpl = fieldParametrisationClassOutline.implClass;
}
else {
fieldParametrisationImpl = fieldParametrisationClass;
}
}
// We have a candidate class:
Candidate candidate = new Candidate(candidateClass, classOutline.target, field, fieldParametrisationClass,
fieldParametrisationImpl, xmlElementDeclModelClass, xmlSchemaModelClass);
candidates.add(candidate);
logger.debug("Found " + candidate);
}
return candidates;
} } | public class class_name {
private Collection<Candidate> findCandidateClasses(Outline outline, JClass xmlElementDeclModelClass) {
Map<String, ClassOutline> interfaceImplementations = new HashMap<String, ClassOutline>();
// Visit all classes to create a map "interfaceName -> ClassOutline".
// This map is later used to resolve implementations from interfaces.
for (ClassOutline classOutline : outline.getClasses()) {
for (Iterator<JClass> iter = classOutline.implClass._implements(); iter.hasNext();) {
JClass interfaceClass = iter.next();
if (interfaceClass instanceof JDefinedClass) {
// Don't care if some interfaces collide: value classes have exactly one implementation
interfaceImplementations.put(interfaceClass.fullName(), classOutline); // depends on control dependency: [if], data = [none]
}
}
}
Collection<Candidate> candidates = new ArrayList<Candidate>();
JClass collectionModelClass = outline.getCodeModel().ref(Collection.class);
JClass xmlSchemaModelClass = outline.getCodeModel().ref(XmlSchema.class);
// Visit all classes created by JAXB processing to collect all potential wrapper classes to be removed:
for (ClassOutline classOutline : outline.getClasses()) {
JDefinedClass candidateClass = classOutline.implClass;
// * The candidate class should not extend any other model class (as the total number of properties in this case will be more than 1)
if (!isHiddenClass(candidateClass._extends())) {
continue;
}
JFieldVar field = null;
// * The candidate class should have exactly one property
for (JFieldVar f : candidateClass.fields().values()) {
if ((f.mods().getValue() & JMod.STATIC) == JMod.STATIC) {
continue;
}
// If there are at least two non-static fields, we discard this candidate:
if (field != null) {
field = null; // depends on control dependency: [if], data = [none]
break;
}
field = f; // depends on control dependency: [for], data = [f]
}
// "field" is null if there are no fields (or all fields are static) or there are more then two fields.
// The only property should be a collection, hence it should be class:
if (field == null || !(field.type() instanceof JClass)) {
continue;
}
JClass fieldType = (JClass) field.type();
// * The property should be a collection
if (!collectionModelClass.isAssignableFrom(fieldType)) {
continue;
}
List<JClass> fieldParametrisations = fieldType.getTypeParameters();
// FIXME: All known collections have exactly one parametrisation type.
assert fieldParametrisations.size() == 1;
JDefinedClass fieldParametrisationClass = null;
JDefinedClass fieldParametrisationImpl = null;
// Parametrisations like "List<String>" or "List<Serialazable>" are not considered.
// They are substituted as is and do not require moving of classes.
if (fieldParametrisations.get(0) instanceof JDefinedClass) {
fieldParametrisationClass = (JDefinedClass) fieldParametrisations.get(0); // depends on control dependency: [if], data = [none]
ClassOutline fieldParametrisationClassOutline = interfaceImplementations
.get(fieldParametrisationClass.fullName());
if (fieldParametrisationClassOutline != null) {
assert fieldParametrisationClassOutline.ref == fieldParametrisationClass;
fieldParametrisationImpl = fieldParametrisationClassOutline.implClass; // depends on control dependency: [if], data = [none]
}
else {
fieldParametrisationImpl = fieldParametrisationClass; // depends on control dependency: [if], data = [none]
}
}
// We have a candidate class:
Candidate candidate = new Candidate(candidateClass, classOutline.target, field, fieldParametrisationClass,
fieldParametrisationImpl, xmlElementDeclModelClass, xmlSchemaModelClass);
candidates.add(candidate); // depends on control dependency: [for], data = [none]
logger.debug("Found " + candidate); // depends on control dependency: [for], data = [none]
}
return candidates;
} } |
public class class_name {
void writeCompoundAttribute(Attribute.Compound c) {
databuf.appendChar(pool.put(typeSig(c.type)));
databuf.appendChar(c.values.length());
for (Pair<Symbol.MethodSymbol,Attribute> p : c.values) {
databuf.appendChar(pool.put(p.fst.name));
p.snd.accept(awriter);
}
} } | public class class_name {
void writeCompoundAttribute(Attribute.Compound c) {
databuf.appendChar(pool.put(typeSig(c.type)));
databuf.appendChar(c.values.length());
for (Pair<Symbol.MethodSymbol,Attribute> p : c.values) {
databuf.appendChar(pool.put(p.fst.name)); // depends on control dependency: [for], data = [p]
p.snd.accept(awriter); // depends on control dependency: [for], data = [p]
}
} } |
public class class_name {
@Override
protected void doTickEffekts(ChannelMemory aktMemo)
{
if (aktMemo.effekt==0 && aktMemo.effektParam==0) return;
switch (aktMemo.effekt)
{
case 0x00 : // Arpeggio
aktMemo.arpegioIndex = (aktMemo.arpegioIndex+1)%3;
int nextNotePeriod = aktMemo.arpegioNote[aktMemo.arpegioIndex];
if (nextNotePeriod!=0)
{
aktMemo.currentNotePeriod = nextNotePeriod;
setNewPlayerTuningFor(aktMemo);
}
break;
case 0x01: // Porta Up
aktMemo.currentNotePeriod -= aktMemo.portaStepUp;
if (aktMemo.glissando) aktMemo.currentNotePeriod = Helpers.getRoundedPeriod(aktMemo.currentNotePeriod>>4)<<4;
if (aktMemo.currentNotePeriod<aktMemo.portaStepUpEnd) aktMemo.currentNotePeriod = aktMemo.portaStepUpEnd;
setNewPlayerTuningFor(aktMemo);
break;
case 0x02: // Porta Down
aktMemo.currentNotePeriod += aktMemo.portaStepDown;
if (aktMemo.glissando) aktMemo.currentNotePeriod = Helpers.getRoundedPeriod(aktMemo.currentNotePeriod>>4)<<4;
if (aktMemo.currentNotePeriod>aktMemo.portaStepDownEnd) aktMemo.currentNotePeriod = aktMemo.portaStepDownEnd;
setNewPlayerTuningFor(aktMemo);
break;
case 0x03 : // Porta to Note
doPortaToNoteEffekt(aktMemo);
break;
case 0x04 : // Vibrato
doVibratoEffekt(aktMemo);
break;
case 0x05 : // Porta to Note + VolumeSlide
doPortaToNoteEffekt(aktMemo);
doVolumeSlideEffekt(aktMemo);
break;
case 0x06: // Vibrato + VolumeSlide
doVibratoEffekt(aktMemo);
doVolumeSlideEffekt(aktMemo);
break;
case 0x07 : // Tremolo
doTremoloEffekt(aktMemo);
break;
case 0x0A : // VolumeSlide
doVolumeSlideEffekt(aktMemo);
break;
case 0x0E : // Extended
switch (aktMemo.effektParam>>4)
{
case 0x9 : // Retrig Note
aktMemo.retrigCount--;
if (aktMemo.retrigCount<=0)
{
aktMemo.retrigCount = aktMemo.retrigMemo;
resetInstrument(aktMemo);
}
break;
case 0xC : // Note Cut
if (aktMemo.noteCutCount>0)
{
aktMemo.noteCutCount--;
if (aktMemo.noteCutCount<=0)
{
aktMemo.noteCutCount=-1;
aktMemo.currentVolume = 0;
}
}
break;
case 0xD: // Note Delay
if (aktMemo.noteDelayCount>0)
{
aktMemo.noteDelayCount--;
if (aktMemo.noteDelayCount<=0)
{
aktMemo.noteDelayCount = -1;
setNewInstrumentAndPeriod(aktMemo);
}
}
break;
}
break;
case 0x11 : // Global volume slide
doGlobalVolumeSlideEffekt();
break;
case 0x14 : // Key off
if (aktMemo.keyOffCounter>0)
{
aktMemo.keyOffCounter--;
if (aktMemo.keyOffCounter<=0)
{
aktMemo.keyOffCounter = -1;
aktMemo.keyOff = true;
}
}
break;
case 0x19 : // Panning slide
doPanningSlideEffekt(aktMemo);
break;
case 0x1B: // Multi retrig note
if (aktMemo.retrigVolSlide>0)
{
switch (aktMemo.retrigVolSlide)
{
case 0x1: aktMemo.currentVolume--; break;
case 0x2: aktMemo.currentVolume-=2; break;
case 0x3: aktMemo.currentVolume-=4; break;
case 0x4: aktMemo.currentVolume-=8; break;
case 0x5: aktMemo.currentVolume-=16; break;
case 0x6: aktMemo.currentVolume=(aktMemo.currentVolume<<1)/3; break;
case 0x7: aktMemo.currentVolume>>=1; break;
case 0x8: break;
case 0x9: aktMemo.currentVolume++; break;
case 0xA: aktMemo.currentVolume+=2; break;
case 0xB: aktMemo.currentVolume+=4; break;
case 0xC: aktMemo.currentVolume+=8; break;
case 0xD: aktMemo.currentVolume+=16; break;
case 0xE: aktMemo.currentVolume=(aktMemo.currentVolume*3)>>1; break;
case 0xF: aktMemo.currentVolume<<=1; break;
}
aktMemo.currentSetVolume = aktMemo.currentVolume;
}
aktMemo.retrigCount--;
if (aktMemo.retrigCount<=0)
{
aktMemo.retrigCount = aktMemo.retrigMemo;
resetInstrument(aktMemo);
}
break;
case 0x1D : // Tremor
doTremorEffekt(aktMemo);
break;
}
} } | public class class_name {
@Override
protected void doTickEffekts(ChannelMemory aktMemo)
{
if (aktMemo.effekt==0 && aktMemo.effektParam==0) return;
switch (aktMemo.effekt)
{
case 0x00 : // Arpeggio
aktMemo.arpegioIndex = (aktMemo.arpegioIndex+1)%3;
int nextNotePeriod = aktMemo.arpegioNote[aktMemo.arpegioIndex];
if (nextNotePeriod!=0)
{
aktMemo.currentNotePeriod = nextNotePeriod; // depends on control dependency: [if], data = [none]
setNewPlayerTuningFor(aktMemo); // depends on control dependency: [if], data = [none]
}
break;
case 0x01: // Porta Up
aktMemo.currentNotePeriod -= aktMemo.portaStepUp;
if (aktMemo.glissando) aktMemo.currentNotePeriod = Helpers.getRoundedPeriod(aktMemo.currentNotePeriod>>4)<<4;
if (aktMemo.currentNotePeriod<aktMemo.portaStepUpEnd) aktMemo.currentNotePeriod = aktMemo.portaStepUpEnd;
setNewPlayerTuningFor(aktMemo);
break;
case 0x02: // Porta Down
aktMemo.currentNotePeriod += aktMemo.portaStepDown;
if (aktMemo.glissando) aktMemo.currentNotePeriod = Helpers.getRoundedPeriod(aktMemo.currentNotePeriod>>4)<<4;
if (aktMemo.currentNotePeriod>aktMemo.portaStepDownEnd) aktMemo.currentNotePeriod = aktMemo.portaStepDownEnd;
setNewPlayerTuningFor(aktMemo);
break;
case 0x03 : // Porta to Note
doPortaToNoteEffekt(aktMemo);
break;
case 0x04 : // Vibrato
doVibratoEffekt(aktMemo);
break;
case 0x05 : // Porta to Note + VolumeSlide
doPortaToNoteEffekt(aktMemo);
doVolumeSlideEffekt(aktMemo);
break;
case 0x06: // Vibrato + VolumeSlide
doVibratoEffekt(aktMemo);
doVolumeSlideEffekt(aktMemo);
break;
case 0x07 : // Tremolo
doTremoloEffekt(aktMemo);
break;
case 0x0A : // VolumeSlide
doVolumeSlideEffekt(aktMemo);
break;
case 0x0E : // Extended
switch (aktMemo.effektParam>>4)
{
case 0x9 : // Retrig Note
aktMemo.retrigCount--;
if (aktMemo.retrigCount<=0)
{
aktMemo.retrigCount = aktMemo.retrigMemo; // depends on control dependency: [if], data = [none]
resetInstrument(aktMemo); // depends on control dependency: [if], data = [none]
}
break;
case 0xC : // Note Cut
if (aktMemo.noteCutCount>0)
{
aktMemo.noteCutCount--; // depends on control dependency: [if], data = [none]
if (aktMemo.noteCutCount<=0)
{
aktMemo.noteCutCount=-1; // depends on control dependency: [if], data = [none]
aktMemo.currentVolume = 0; // depends on control dependency: [if], data = [none]
}
}
break;
case 0xD: // Note Delay
if (aktMemo.noteDelayCount>0)
{
aktMemo.noteDelayCount--; // depends on control dependency: [if], data = [none]
if (aktMemo.noteDelayCount<=0)
{
aktMemo.noteDelayCount = -1; // depends on control dependency: [if], data = [none]
setNewInstrumentAndPeriod(aktMemo); // depends on control dependency: [if], data = [none]
}
}
break;
}
break;
case 0x11 : // Global volume slide
doGlobalVolumeSlideEffekt();
break;
case 0x14 : // Key off
if (aktMemo.keyOffCounter>0)
{
aktMemo.keyOffCounter--; // depends on control dependency: [if], data = [none]
if (aktMemo.keyOffCounter<=0)
{
aktMemo.keyOffCounter = -1; // depends on control dependency: [if], data = [none]
aktMemo.keyOff = true; // depends on control dependency: [if], data = [none]
}
}
break;
case 0x19 : // Panning slide
doPanningSlideEffekt(aktMemo);
break;
case 0x1B: // Multi retrig note
if (aktMemo.retrigVolSlide>0)
{
switch (aktMemo.retrigVolSlide)
{
case 0x1: aktMemo.currentVolume--; break;
case 0x2: aktMemo.currentVolume-=2; break;
case 0x3: aktMemo.currentVolume-=4; break;
case 0x4: aktMemo.currentVolume-=8; break;
case 0x5: aktMemo.currentVolume-=16; break;
case 0x6: aktMemo.currentVolume=(aktMemo.currentVolume<<1)/3; break;
case 0x7: aktMemo.currentVolume>>=1; break;
case 0x8: break;
case 0x9: aktMemo.currentVolume++; break;
case 0xA: aktMemo.currentVolume+=2; break;
case 0xB: aktMemo.currentVolume+=4; break;
case 0xC: aktMemo.currentVolume+=8; break;
case 0xD: aktMemo.currentVolume+=16; break;
case 0xE: aktMemo.currentVolume=(aktMemo.currentVolume*3)>>1; break;
case 0xF: aktMemo.currentVolume<<=1; break;
}
aktMemo.currentSetVolume = aktMemo.currentVolume; // depends on control dependency: [if], data = [none]
}
aktMemo.retrigCount--;
if (aktMemo.retrigCount<=0)
{
aktMemo.retrigCount = aktMemo.retrigMemo; // depends on control dependency: [if], data = [none]
resetInstrument(aktMemo); // depends on control dependency: [if], data = [none]
}
break;
case 0x1D : // Tremor
doTremorEffekt(aktMemo);
break;
}
} } |
public class class_name {
@VisibleForTesting
boolean tryAssignResource(final LogicalSlot logicalSlot) {
assertRunningInJobMasterMainThread();
checkNotNull(logicalSlot);
// only allow to set the assigned resource in state SCHEDULED or CREATED
// note: we also accept resource assignment when being in state CREATED for testing purposes
if (state == SCHEDULED || state == CREATED) {
if (ASSIGNED_SLOT_UPDATER.compareAndSet(this, null, logicalSlot)) {
if (logicalSlot.tryAssignPayload(this)) {
// check for concurrent modification (e.g. cancelling call)
if ((state == SCHEDULED || state == CREATED) && !taskManagerLocationFuture.isDone()) {
taskManagerLocationFuture.complete(logicalSlot.getTaskManagerLocation());
assignedAllocationID = logicalSlot.getAllocationId();
return true;
} else {
// free assigned resource and return false
ASSIGNED_SLOT_UPDATER.set(this, null);
return false;
}
} else {
ASSIGNED_SLOT_UPDATER.set(this, null);
return false;
}
} else {
// the slot already has another slot assigned
return false;
}
} else {
// do not allow resource assignment if we are not in state SCHEDULED
return false;
}
} } | public class class_name {
@VisibleForTesting
boolean tryAssignResource(final LogicalSlot logicalSlot) {
assertRunningInJobMasterMainThread();
checkNotNull(logicalSlot);
// only allow to set the assigned resource in state SCHEDULED or CREATED
// note: we also accept resource assignment when being in state CREATED for testing purposes
if (state == SCHEDULED || state == CREATED) {
if (ASSIGNED_SLOT_UPDATER.compareAndSet(this, null, logicalSlot)) {
if (logicalSlot.tryAssignPayload(this)) {
// check for concurrent modification (e.g. cancelling call)
if ((state == SCHEDULED || state == CREATED) && !taskManagerLocationFuture.isDone()) {
taskManagerLocationFuture.complete(logicalSlot.getTaskManagerLocation()); // depends on control dependency: [if], data = [none]
assignedAllocationID = logicalSlot.getAllocationId(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
// free assigned resource and return false
ASSIGNED_SLOT_UPDATER.set(this, null); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
} else {
ASSIGNED_SLOT_UPDATER.set(this, null); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
} else {
// the slot already has another slot assigned
return false; // depends on control dependency: [if], data = [none]
}
} else {
// do not allow resource assignment if we are not in state SCHEDULED
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int toInt() {
if (mValue.length > 2) {
throw new UnsupportedOperationException("Only supported for Identifiers with max byte length of 2");
}
int result = 0;
for (int i = 0; i < mValue.length; i++) {
result |= (mValue[i] & 0xFF) << ((mValue.length - i - 1) * 8);
}
return result;
} } | public class class_name {
public int toInt() {
if (mValue.length > 2) {
throw new UnsupportedOperationException("Only supported for Identifiers with max byte length of 2");
}
int result = 0;
for (int i = 0; i < mValue.length; i++) {
result |= (mValue[i] & 0xFF) << ((mValue.length - i - 1) * 8); // depends on control dependency: [for], data = [i]
}
return result;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.