code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
protected boolean isLegalEmphOrStrongStartPos(){
if( currentIndex() == 0 )
return true;
Object lastItem = peek(1);
Class<?> lastClass = lastItem.getClass();
SuperNode supernode;
while( SuperNode.class.isAssignableFrom(lastClass) ) {
supernode = (SuperNode) lastItem;
if(supernode.getChildren().size() < 1 )
return true;
lastItem = supernode.getChildren().get( supernode.getChildren().size()-1 );
lastClass = lastItem.getClass();
}
return ( TextNode.class.equals(lastClass) && ( (TextNode) lastItem).getText().endsWith(" ") )
|| ( SimpleNode.class.equals(lastClass) )
|| ( java.lang.Integer.class.equals(lastClass) );
} } | public class class_name {
protected boolean isLegalEmphOrStrongStartPos(){
if( currentIndex() == 0 )
return true;
Object lastItem = peek(1);
Class<?> lastClass = lastItem.getClass();
SuperNode supernode;
while( SuperNode.class.isAssignableFrom(lastClass) ) {
supernode = (SuperNode) lastItem; // depends on control dependency: [while], data = [none]
if(supernode.getChildren().size() < 1 )
return true;
lastItem = supernode.getChildren().get( supernode.getChildren().size()-1 ); // depends on control dependency: [while], data = [none]
lastClass = lastItem.getClass(); // depends on control dependency: [while], data = [none]
}
return ( TextNode.class.equals(lastClass) && ( (TextNode) lastItem).getText().endsWith(" ") )
|| ( SimpleNode.class.equals(lastClass) )
|| ( java.lang.Integer.class.equals(lastClass) );
} } |
public class class_name {
public void sendMessage(final AVIMMessage message, final AVIMMessageOption messageOption, final AVIMConversationCallback callback) {
message.setConversationId(conversationId);
message.setFrom(client.getClientId());
message.generateUniqueToken();
message.setTimestamp(System.currentTimeMillis());
if (!AppConfiguration.getGlobalNetworkingDetector().isConnected()) {
// judge network status.
message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusFailed);
if (callback != null) {
callback.internalDone(new AVException(AVException.CONNECTION_FAILED, "Connection lost"));
}
return;
}
final AVIMCommonJsonCallback wrapperCallback = new AVIMCommonJsonCallback() {
@Override
public void done(Map<String, Object> result, AVIMException e) {
if (null == e && null != result) {
String msgId = (String) result.get(Conversation.callbackMessageId);
Long msgTimestamp = (Long) result.get(Conversation.callbackMessageTimeStamp);
message.setMessageId(msgId);
if (null != msgTimestamp) {
message.setTimestamp(msgTimestamp);
}
message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusSent);
if ((null == messageOption || !messageOption.isTransient()) && AVIMOptions.getGlobalOptions().isMessageQueryCacheEnabled()) {
setLastMessage(message);
storage.insertMessage(message, false);
} else {
LOGGER.d("skip inserting into local storage.");
}
AVIMConversation.this.lastMessageAt = (null != msgTimestamp)? new Date(msgTimestamp) : new Date();
storage.updateConversationLastMessageAt(AVIMConversation.this);
} else {
message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusFailed);
}
if (null != callback) {
callback.internalDone(AVIMException.wrapperAVException(e));
}
}
};
message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusSending);
if (AVIMFileMessage.class.isAssignableFrom(message.getClass())) {
AVIMFileMessageAccessor.upload((AVIMFileMessage) message, new SaveCallback() {
public void done(AVException e) {
if (e != null) {
message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusFailed);
if (callback != null) {
callback.internalDone(e);
}
} else {
InternalConfiguration.getOperationTube().sendMessage(client.getClientId(), getConversationId(), getType(),
message, messageOption, wrapperCallback);
}
}
});
} else {
InternalConfiguration.getOperationTube().sendMessage(client.getClientId(), getConversationId(), getType(),
message, messageOption, wrapperCallback);
}
} } | public class class_name {
public void sendMessage(final AVIMMessage message, final AVIMMessageOption messageOption, final AVIMConversationCallback callback) {
message.setConversationId(conversationId);
message.setFrom(client.getClientId());
message.generateUniqueToken();
message.setTimestamp(System.currentTimeMillis());
if (!AppConfiguration.getGlobalNetworkingDetector().isConnected()) {
// judge network status.
message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusFailed); // depends on control dependency: [if], data = [none]
if (callback != null) {
callback.internalDone(new AVException(AVException.CONNECTION_FAILED, "Connection lost")); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
final AVIMCommonJsonCallback wrapperCallback = new AVIMCommonJsonCallback() {
@Override
public void done(Map<String, Object> result, AVIMException e) {
if (null == e && null != result) {
String msgId = (String) result.get(Conversation.callbackMessageId);
Long msgTimestamp = (Long) result.get(Conversation.callbackMessageTimeStamp);
message.setMessageId(msgId); // depends on control dependency: [if], data = [none]
if (null != msgTimestamp) {
message.setTimestamp(msgTimestamp); // depends on control dependency: [if], data = [msgTimestamp)]
}
message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusSent); // depends on control dependency: [if], data = [none]
if ((null == messageOption || !messageOption.isTransient()) && AVIMOptions.getGlobalOptions().isMessageQueryCacheEnabled()) {
setLastMessage(message); // depends on control dependency: [if], data = [none]
storage.insertMessage(message, false); // depends on control dependency: [if], data = [none]
} else {
LOGGER.d("skip inserting into local storage."); // depends on control dependency: [if], data = [none]
}
AVIMConversation.this.lastMessageAt = (null != msgTimestamp)? new Date(msgTimestamp) : new Date(); // depends on control dependency: [if], data = [(null]
storage.updateConversationLastMessageAt(AVIMConversation.this); // depends on control dependency: [if], data = [none]
} else {
message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusFailed); // depends on control dependency: [if], data = [none]
}
if (null != callback) {
callback.internalDone(AVIMException.wrapperAVException(e)); // depends on control dependency: [if], data = [none]
}
}
};
message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusSending);
if (AVIMFileMessage.class.isAssignableFrom(message.getClass())) {
AVIMFileMessageAccessor.upload((AVIMFileMessage) message, new SaveCallback() {
public void done(AVException e) {
if (e != null) {
message.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusFailed); // depends on control dependency: [if], data = [none]
if (callback != null) {
callback.internalDone(e); // depends on control dependency: [if], data = [none]
}
} else {
InternalConfiguration.getOperationTube().sendMessage(client.getClientId(), getConversationId(), getType(),
message, messageOption, wrapperCallback); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
} else {
InternalConfiguration.getOperationTube().sendMessage(client.getClientId(), getConversationId(), getType(),
message, messageOption, wrapperCallback); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public BatchDetectSyntaxResult withResultList(BatchDetectSyntaxItemResult... resultList) {
if (this.resultList == null) {
setResultList(new java.util.ArrayList<BatchDetectSyntaxItemResult>(resultList.length));
}
for (BatchDetectSyntaxItemResult ele : resultList) {
this.resultList.add(ele);
}
return this;
} } | public class class_name {
public BatchDetectSyntaxResult withResultList(BatchDetectSyntaxItemResult... resultList) {
if (this.resultList == null) {
setResultList(new java.util.ArrayList<BatchDetectSyntaxItemResult>(resultList.length)); // depends on control dependency: [if], data = [none]
}
for (BatchDetectSyntaxItemResult ele : resultList) {
this.resultList.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static void toGeojsonPolygon(Polygon polygon, StringBuilder sb) {
sb.append("{\"type\":\"Polygon\",\"coordinates\":[");
//Process exterior ring
toGeojsonCoordinates(polygon.getExteriorRing().getCoordinates(), sb);
//Process interior rings
for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
sb.append(",");
toGeojsonCoordinates(polygon.getInteriorRingN(i).getCoordinates(), sb);
}
sb.append("]}");
} } | public class class_name {
public static void toGeojsonPolygon(Polygon polygon, StringBuilder sb) {
sb.append("{\"type\":\"Polygon\",\"coordinates\":[");
//Process exterior ring
toGeojsonCoordinates(polygon.getExteriorRing().getCoordinates(), sb);
//Process interior rings
for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
sb.append(","); // depends on control dependency: [for], data = [none]
toGeojsonCoordinates(polygon.getInteriorRingN(i).getCoordinates(), sb); // depends on control dependency: [for], data = [i]
}
sb.append("]}");
} } |
public class class_name {
private static String mapEnglishPennTagSetToNAF(final String postag) {
if (postag.startsWith("RB")) {
return "A"; // adverb
} else if (postag.equalsIgnoreCase("CC")) {
return "C"; // conjunction
} else if (postag.startsWith("D") || postag.equalsIgnoreCase("PDT")) {
return "D"; // determiner and predeterminer
} else if (postag.startsWith("J")) {
return "G"; // adjective
} else if (postag.equalsIgnoreCase("NN")
|| postag.equalsIgnoreCase("NNS")) {
return "N"; // common noun
} else if (postag.startsWith("NNP")) {
return "R"; // proper noun
} else if (postag.equalsIgnoreCase("TO") || postag.equalsIgnoreCase("IN")) {
return "P"; // preposition
} else if (postag.startsWith("PRP") || postag.startsWith("WP")) {
return "Q"; // pronoun
} else if (postag.startsWith("V")) {
return "V"; // verb
} else {
return "O"; // other
}
} } | public class class_name {
private static String mapEnglishPennTagSetToNAF(final String postag) {
if (postag.startsWith("RB")) {
return "A"; // adverb // depends on control dependency: [if], data = [none]
} else if (postag.equalsIgnoreCase("CC")) {
return "C"; // conjunction // depends on control dependency: [if], data = [none]
} else if (postag.startsWith("D") || postag.equalsIgnoreCase("PDT")) {
return "D"; // determiner and predeterminer // depends on control dependency: [if], data = [none]
} else if (postag.startsWith("J")) {
return "G"; // adjective // depends on control dependency: [if], data = [none]
} else if (postag.equalsIgnoreCase("NN")
|| postag.equalsIgnoreCase("NNS")) {
return "N"; // common noun // depends on control dependency: [if], data = [none]
} else if (postag.startsWith("NNP")) {
return "R"; // proper noun // depends on control dependency: [if], data = [none]
} else if (postag.equalsIgnoreCase("TO") || postag.equalsIgnoreCase("IN")) {
return "P"; // preposition // depends on control dependency: [if], data = [none]
} else if (postag.startsWith("PRP") || postag.startsWith("WP")) {
return "Q"; // pronoun // depends on control dependency: [if], data = [none]
} else if (postag.startsWith("V")) {
return "V"; // verb // depends on control dependency: [if], data = [none]
} else {
return "O"; // other // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listWithServiceResponseAsync(final JobScheduleListOptions jobScheduleListOptions) {
return listSinglePageAsync(jobScheduleListOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
JobScheduleListNextOptions jobScheduleListNextOptions = null;
if (jobScheduleListOptions != null) {
jobScheduleListNextOptions = new JobScheduleListNextOptions();
jobScheduleListNextOptions.withClientRequestId(jobScheduleListOptions.clientRequestId());
jobScheduleListNextOptions.withReturnClientRequestId(jobScheduleListOptions.returnClientRequestId());
jobScheduleListNextOptions.withOcpDate(jobScheduleListOptions.ocpDate());
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions));
}
});
} } | public class class_name {
public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> listWithServiceResponseAsync(final JobScheduleListOptions jobScheduleListOptions) {
return listSinglePageAsync(jobScheduleListOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders>> call(ServiceResponseWithHeaders<Page<CloudJobSchedule>, JobScheduleListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
JobScheduleListNextOptions jobScheduleListNextOptions = null;
if (jobScheduleListOptions != null) {
jobScheduleListNextOptions = new JobScheduleListNextOptions(); // depends on control dependency: [if], data = [none]
jobScheduleListNextOptions.withClientRequestId(jobScheduleListOptions.clientRequestId()); // depends on control dependency: [if], data = [(jobScheduleListOptions]
jobScheduleListNextOptions.withReturnClientRequestId(jobScheduleListOptions.returnClientRequestId()); // depends on control dependency: [if], data = [(jobScheduleListOptions]
jobScheduleListNextOptions.withOcpDate(jobScheduleListOptions.ocpDate()); // depends on control dependency: [if], data = [(jobScheduleListOptions]
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, jobScheduleListNextOptions));
}
});
} } |
public class class_name {
boolean belongsToCluster(final MemcachedNode node) {
for (MemcachedNode n : locator.getAll()) {
if (n.getSocketAddress().equals(node.getSocketAddress())) {
return true;
}
}
return false;
} } | public class class_name {
boolean belongsToCluster(final MemcachedNode node) {
for (MemcachedNode n : locator.getAll()) {
if (n.getSocketAddress().equals(node.getSocketAddress())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public BaseWroManagerFactory addModelTransformer(final Transformer<WroModel> modelTransformer) {
if (modelTransformers == null) {
modelTransformers = new ArrayList<Transformer<WroModel>>();
}
this.modelTransformers.add(modelTransformer);
return this;
} } | public class class_name {
public BaseWroManagerFactory addModelTransformer(final Transformer<WroModel> modelTransformer) {
if (modelTransformers == null) {
modelTransformers = new ArrayList<Transformer<WroModel>>(); // depends on control dependency: [if], data = [none]
}
this.modelTransformers.add(modelTransformer);
return this;
} } |
public class class_name {
public org.tensorflow.framework.AttrValue.ListValueOrBuilder getListOrBuilder() {
if (valueCase_ == 1) {
return (org.tensorflow.framework.AttrValue.ListValue) value_;
}
return org.tensorflow.framework.AttrValue.ListValue.getDefaultInstance();
} } | public class class_name {
public org.tensorflow.framework.AttrValue.ListValueOrBuilder getListOrBuilder() {
if (valueCase_ == 1) {
return (org.tensorflow.framework.AttrValue.ListValue) value_; // depends on control dependency: [if], data = [none]
}
return org.tensorflow.framework.AttrValue.ListValue.getDefaultInstance();
} } |
public class class_name {
public String getContentType() {
if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
checkRequestObjectInUse();
}
// 321485
// PK57679 Start
String contentType;
if (!_setInputDataStreamCalled) // 516233
contentType = _request.getContentType();
else
contentType = _setInputStreamContentType;
// PK57679 End
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"getContentType", "this->"+this+": "+" type --> " + contentType);
}
return contentType;
} } | public class class_name {
public String getContentType() {
if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
checkRequestObjectInUse(); // depends on control dependency: [if], data = [none]
}
// 321485
// PK57679 Start
String contentType;
if (!_setInputDataStreamCalled) // 516233
contentType = _request.getContentType();
else
contentType = _setInputStreamContentType;
// PK57679 End
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"getContentType", "this->"+this+": "+" type --> " + contentType); // depends on control dependency: [if], data = [none]
}
return contentType;
} } |
public class class_name {
public static void setFieldValue(final Class<?> source, final Object target, final String fieldName, final Object value) throws NoSuchFieldException
{
try
{
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>()
{
@Override
public Void run() throws Exception
{
Field field = source.getDeclaredField(fieldName);
if(!field.isAccessible())
{
field.setAccessible(true);
}
field.set(target, value);
return null;
}
});
}
// Unwrap
catch (final PrivilegedActionException pae)
{
final Throwable t = pae.getCause();
// Rethrow
if (t instanceof NoSuchFieldException)
{
throw (NoSuchFieldException) t;
}
else
{
// No other checked Exception thrown by Class.getConstructor
try
{
throw (RuntimeException) t;
}
// Just in case we've really messed up
catch (final ClassCastException cce)
{
throw new RuntimeException("Obtained unchecked Exception; this code should never be reached", t);
}
}
}
} } | public class class_name {
public static void setFieldValue(final Class<?> source, final Object target, final String fieldName, final Object value) throws NoSuchFieldException
{
try
{
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>()
{
@Override
public Void run() throws Exception
{
Field field = source.getDeclaredField(fieldName);
if(!field.isAccessible())
{
field.setAccessible(true); // depends on control dependency: [if], data = [none]
}
field.set(target, value);
return null;
}
});
}
// Unwrap
catch (final PrivilegedActionException pae)
{
final Throwable t = pae.getCause();
// Rethrow
if (t instanceof NoSuchFieldException)
{
throw (NoSuchFieldException) t;
}
else
{
// No other checked Exception thrown by Class.getConstructor
try
{
throw (RuntimeException) t;
}
// Just in case we've really messed up
catch (final ClassCastException cce)
{
throw new RuntimeException("Obtained unchecked Exception; this code should never be reached", t);
}
}
}
} } |
public class class_name {
@Override
public String marshal(ZonedDateTime zonedDateTime) {
if (null == zonedDateTime) {
return null;
}
return zonedDateTime.withZoneSameInstant(ZoneOffset.UTC).format(formatter);
} } | public class class_name {
@Override
public String marshal(ZonedDateTime zonedDateTime) {
if (null == zonedDateTime) {
return null; // depends on control dependency: [if], data = [none]
}
return zonedDateTime.withZoneSameInstant(ZoneOffset.UTC).format(formatter);
} } |
public class class_name {
public void registerAspectComponents() throws Exception {
Debug.logVerbose("[JdonFramework] note: registe aspect components ", module);
try {
InterceptorsChain existedInterceptorsChain = (InterceptorsChain) containerWrapper.lookup(ComponentKeys.INTERCEPTOR_CHAIN);
Iterator iter = aspectConfigComponents.iterator();
Debug.logVerbose("[JdonFramework] 3 aspectConfigComponents size:" + aspectConfigComponents.size(), module);
while (iter.hasNext()) {
String name = (String) iter.next();
AspectComponentsMetaDef componentMetaDef = (AspectComponentsMetaDef) aspectConfigComponents.getComponentMetaDef(name);
// registe into container
xmlcontainerRegistry.registerAspectComponentMetaDef(componentMetaDef);
// got the interceptor instance;
// add interceptor instance into InterceptorsChain object
existedInterceptorsChain.addInterceptor(componentMetaDef.getPointcut(), name);
}
} catch (Exception ex) {
Debug.logError("[JdonFramework] registerAspectComponents error:" + ex, module);
throw new Exception(ex);
}
} } | public class class_name {
public void registerAspectComponents() throws Exception {
Debug.logVerbose("[JdonFramework] note: registe aspect components ", module);
try {
InterceptorsChain existedInterceptorsChain = (InterceptorsChain) containerWrapper.lookup(ComponentKeys.INTERCEPTOR_CHAIN);
Iterator iter = aspectConfigComponents.iterator();
Debug.logVerbose("[JdonFramework] 3 aspectConfigComponents size:" + aspectConfigComponents.size(), module);
while (iter.hasNext()) {
String name = (String) iter.next();
AspectComponentsMetaDef componentMetaDef = (AspectComponentsMetaDef) aspectConfigComponents.getComponentMetaDef(name);
// registe into container
xmlcontainerRegistry.registerAspectComponentMetaDef(componentMetaDef);
// depends on control dependency: [while], data = [none]
// got the interceptor instance;
// add interceptor instance into InterceptorsChain object
existedInterceptorsChain.addInterceptor(componentMetaDef.getPointcut(), name);
// depends on control dependency: [while], data = [none]
}
} catch (Exception ex) {
Debug.logError("[JdonFramework] registerAspectComponents error:" + ex, module);
throw new Exception(ex);
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public <T> T features(Class<T> interfaceClass) {
try {
List<Class<?>> todo = new ArrayList<Class<?>>();
Set<Class<?>> done = new HashSet<Class<?>>();
todo.add(interfaceClass);
while (!todo.isEmpty()) {
Class<?> currentClass = todo.remove(0);
done.add(currentClass);
for (Method method : currentClass.getDeclaredMethods()) {
if (!methods.containsKey(method)) {
methods.put(method, findInvocationHandler(method));
}
for (Class<?> superInterfaceClazz : currentClass.getInterfaces()) {
if (!done.contains(superInterfaceClazz)) {
todo.add(superInterfaceClazz);
}
}
}
}
return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[] { interfaceClass }, this);
} catch (NoSuchMethodException e) {
throw new PicklockException("cannot resolve method/property " + e.getMessage() + " on " + object.getClass());
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public <T> T features(Class<T> interfaceClass) {
try {
List<Class<?>> todo = new ArrayList<Class<?>>(); // depends on control dependency: [try], data = [none]
Set<Class<?>> done = new HashSet<Class<?>>(); // depends on control dependency: [try], data = [none]
todo.add(interfaceClass); // depends on control dependency: [try], data = [none]
while (!todo.isEmpty()) {
Class<?> currentClass = todo.remove(0); // depends on control dependency: [while], data = [none]
done.add(currentClass); // depends on control dependency: [while], data = [none]
for (Method method : currentClass.getDeclaredMethods()) {
if (!methods.containsKey(method)) {
methods.put(method, findInvocationHandler(method)); // depends on control dependency: [if], data = [none]
}
for (Class<?> superInterfaceClazz : currentClass.getInterfaces()) {
if (!done.contains(superInterfaceClazz)) {
todo.add(superInterfaceClazz); // depends on control dependency: [if], data = [none]
}
}
}
}
return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[] { interfaceClass }, this); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
throw new PicklockException("cannot resolve method/property " + e.getMessage() + " on " + object.getClass());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void update(List<UninstallationProgressEvent> events) {
if (!isVisible()) {
if ((System.currentTimeMillis() - startTime) >= MS_TO_WAIT_BEFORE_SHOW) {
if (!done && !setVisibleInvoked) {
setVisibleInvoked = true;
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
if (!done) {
UninstallationProgressDialogue.super.setVisible(true);
}
}
});
}
}
}
int totalAmount = 0;
AddOn addOn = null;
for (UninstallationProgressEvent event : events) {
totalAmount += event.getAmount();
if (UninstallationProgressEvent.Type.FINISHED_ADD_ON == event.getType()) {
for (AddOnUninstallListener listener : listeners) {
failedUninstallations = !event.isUninstalled();
listener.addOnUninstalled(currentAddOn, update, event.isUninstalled());
}
} else if (UninstallationProgressEvent.Type.ADD_ON == event.getType()) {
addOn = event.getAddOn();
currentAddOn = addOn;
update = event.isUpdate();
for (AddOnUninstallListener listener : listeners) {
listener.uninstallingAddOn(addOn, update);
}
}
}
UninstallationProgressEvent last = events.get(events.size() - 1);
if (addOn != null) {
setCurrentAddOn(addOn);
}
if (totalAmount != 0) {
incrementProgress(totalAmount);
}
if (currentType != last.getType()) {
String keyMessage;
switch (last.getType()) {
case FILE:
keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingFile";
break;
case ACTIVE_RULE:
keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingActiveScanner";
break;
case PASSIVE_RULE:
keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingPassiveScanner";
break;
case EXTENSION:
keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingExtension";
break;
default:
keyMessage = "";
break;
}
currentType = last.getType();
keyBaseStatusMessage = keyMessage;
}
if (keyBaseStatusMessage.isEmpty()) {
setCustomMessage("");
} else {
setCustomMessage(
Constant.messages
.getString(keyBaseStatusMessage, last.getValue(), last.getMax()));
}
} } | public class class_name {
public void update(List<UninstallationProgressEvent> events) {
if (!isVisible()) {
if ((System.currentTimeMillis() - startTime) >= MS_TO_WAIT_BEFORE_SHOW) {
if (!done && !setVisibleInvoked) {
setVisibleInvoked = true; // depends on control dependency: [if], data = [none]
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
if (!done) {
UninstallationProgressDialogue.super.setVisible(true); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
}
}
int totalAmount = 0;
AddOn addOn = null;
for (UninstallationProgressEvent event : events) {
totalAmount += event.getAmount(); // depends on control dependency: [for], data = [event]
if (UninstallationProgressEvent.Type.FINISHED_ADD_ON == event.getType()) {
for (AddOnUninstallListener listener : listeners) {
failedUninstallations = !event.isUninstalled(); // depends on control dependency: [for], data = [none]
listener.addOnUninstalled(currentAddOn, update, event.isUninstalled()); // depends on control dependency: [for], data = [listener]
}
} else if (UninstallationProgressEvent.Type.ADD_ON == event.getType()) {
addOn = event.getAddOn(); // depends on control dependency: [if], data = [none]
currentAddOn = addOn; // depends on control dependency: [if], data = [none]
update = event.isUpdate(); // depends on control dependency: [if], data = [none]
for (AddOnUninstallListener listener : listeners) {
listener.uninstallingAddOn(addOn, update); // depends on control dependency: [for], data = [listener]
}
}
}
UninstallationProgressEvent last = events.get(events.size() - 1);
if (addOn != null) {
setCurrentAddOn(addOn); // depends on control dependency: [if], data = [(addOn]
}
if (totalAmount != 0) {
incrementProgress(totalAmount); // depends on control dependency: [if], data = [(totalAmount]
}
if (currentType != last.getType()) {
String keyMessage;
switch (last.getType()) {
case FILE:
keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingFile";
break;
case ACTIVE_RULE:
keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingActiveScanner";
break;
case PASSIVE_RULE:
keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingPassiveScanner";
break;
case EXTENSION:
keyMessage = "cfu.uninstallation.progress.dialogue.uninstallingExtension";
break;
default:
keyMessage = "";
break;
}
currentType = last.getType();
keyBaseStatusMessage = keyMessage;
}
if (keyBaseStatusMessage.isEmpty()) {
setCustomMessage("");
} else {
setCustomMessage(
Constant.messages
.getString(keyBaseStatusMessage, last.getValue(), last.getMax()));
}
} } |
public class class_name {
private boolean handleSpan(TextCursor cursor, int blockEnd, ArrayList<MDText> elements) {
if (mode != MODE_ONLY_LINKS) {
int spanStart = findSpanStart(cursor, blockEnd);
if (spanStart >= 0) {
char span = cursor.text.charAt(spanStart);
int spanEnd = findSpanEnd(cursor, spanStart, blockEnd, span);
if (spanEnd >= 0) {
// Handling next elements before span
handleUrls(cursor, spanStart, elements);
// Increment offset before processing internal spans
cursor.currentOffset++;
// Building child spans
MDText[] spanElements = handleSpans(cursor, spanEnd - 1);
// End of search: move cursor after span
cursor.currentOffset = spanEnd;
MDSpan spanElement = new MDSpan(
span == '*' ? MDSpan.TYPE_BOLD : MDSpan.TYPE_ITALIC,
spanElements);
elements.add(spanElement);
return true;
}
}
}
handleUrls(cursor, blockEnd, elements);
return false;
} } | public class class_name {
private boolean handleSpan(TextCursor cursor, int blockEnd, ArrayList<MDText> elements) {
if (mode != MODE_ONLY_LINKS) {
int spanStart = findSpanStart(cursor, blockEnd);
if (spanStart >= 0) {
char span = cursor.text.charAt(spanStart);
int spanEnd = findSpanEnd(cursor, spanStart, blockEnd, span);
if (spanEnd >= 0) {
// Handling next elements before span
handleUrls(cursor, spanStart, elements); // depends on control dependency: [if], data = [none]
// Increment offset before processing internal spans
cursor.currentOffset++; // depends on control dependency: [if], data = [none]
// Building child spans
MDText[] spanElements = handleSpans(cursor, spanEnd - 1);
// End of search: move cursor after span
cursor.currentOffset = spanEnd; // depends on control dependency: [if], data = [none]
MDSpan spanElement = new MDSpan(
span == '*' ? MDSpan.TYPE_BOLD : MDSpan.TYPE_ITALIC,
spanElements);
elements.add(spanElement); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
}
handleUrls(cursor, blockEnd, elements);
return false;
} } |
public class class_name {
public void updateRootTypes(ModelNode address, List<ModelNode> modelNodes) {
deck.showWidget(CHILD_VIEW);
tree.clear();
descView.clearDisplay();
formView.clearDisplay();
offsetDisplay.clear();
// IMPORTANT: when pin down is active, we need to consider the offset to calculate the real address
addressOffset = address;
nodeHeader.updateDescription(address);
List<Property> offset = addressOffset.asPropertyList();
if(offset.size()>0)
{
String parentName = offset.get(offset.size() - 1).getName();
HTML parentTag = new HTML("<div class='gwt-ToggleButton gwt-ToggleButton-down' title='Remove Filter'> " + parentName + " <i class='icon-remove'></i></div>");
parentTag.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
presenter.onPinTreeSelection(null);
}
});
offsetDisplay.add(parentTag);
}
TreeItem rootItem = null;
String rootTitle = null;
String key = null;
if(address.asList().isEmpty())
{
rootTitle = DEFAULT_ROOT;
key = DEFAULT_ROOT;
}
else
{
List<ModelNode> tuples = address.asList();
rootTitle = tuples.get(tuples.size() - 1).asProperty().getValue().asString();
key = rootTitle;
}
SafeHtmlBuilder html = new SafeHtmlBuilder().appendEscaped(rootTitle);
rootItem = new ModelTreeItem(html.toSafeHtml(), key, address, false);
tree.addItem(rootItem);
deck.showWidget(RESOURCE_VIEW);
rootItem.setSelected(true);
currentRootKey = key;
addChildrenTypes((ModelTreeItem)rootItem, modelNodes);
} } | public class class_name {
public void updateRootTypes(ModelNode address, List<ModelNode> modelNodes) {
deck.showWidget(CHILD_VIEW);
tree.clear();
descView.clearDisplay();
formView.clearDisplay();
offsetDisplay.clear();
// IMPORTANT: when pin down is active, we need to consider the offset to calculate the real address
addressOffset = address;
nodeHeader.updateDescription(address);
List<Property> offset = addressOffset.asPropertyList();
if(offset.size()>0)
{
String parentName = offset.get(offset.size() - 1).getName();
HTML parentTag = new HTML("<div class='gwt-ToggleButton gwt-ToggleButton-down' title='Remove Filter'> " + parentName + " <i class='icon-remove'></i></div>"); // depends on control dependency: [if], data = [none]
parentTag.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
presenter.onPinTreeSelection(null);
}
}); // depends on control dependency: [if], data = [none]
offsetDisplay.add(parentTag); // depends on control dependency: [if], data = [none]
}
TreeItem rootItem = null;
String rootTitle = null;
String key = null;
if(address.asList().isEmpty())
{
rootTitle = DEFAULT_ROOT; // depends on control dependency: [if], data = [none]
key = DEFAULT_ROOT; // depends on control dependency: [if], data = [none]
}
else
{
List<ModelNode> tuples = address.asList();
rootTitle = tuples.get(tuples.size() - 1).asProperty().getValue().asString(); // depends on control dependency: [if], data = [none]
key = rootTitle; // depends on control dependency: [if], data = [none]
}
SafeHtmlBuilder html = new SafeHtmlBuilder().appendEscaped(rootTitle);
rootItem = new ModelTreeItem(html.toSafeHtml(), key, address, false);
tree.addItem(rootItem);
deck.showWidget(RESOURCE_VIEW);
rootItem.setSelected(true);
currentRootKey = key;
addChildrenTypes((ModelTreeItem)rootItem, modelNodes);
} } |
public class class_name {
public String render(Node root, boolean processExtendRoots) {
OutputList output = new OutputList(config.getMaxOutputSize());
for (Node node : root.getChildren()) {
lineNumber = node.getLineNumber();
position = node.getStartPosition();
String renderStr = node.getMaster().getImage();
if (context.doesRenderStackContain(renderStr)) {
// This is a circular rendering. Stop rendering it here.
addError(new TemplateError(ErrorType.WARNING, ErrorReason.EXCEPTION, ErrorItem.TAG,
"Rendering cycle detected: '" + renderStr + "'", null, getLineNumber(), node.getStartPosition(),
null, BasicTemplateErrorCategory.IMPORT_CYCLE_DETECTED, ImmutableMap.of("string", renderStr)));
output.addNode(new RenderedOutputNode(renderStr));
} else {
OutputNode out;
context.pushRenderStack(renderStr);
try {
out = node.render(this);
} catch (DeferredValueException e) {
out = new RenderedOutputNode(node.getMaster().getImage());
}
context.popRenderStack();
output.addNode(out);
}
}
// render all extend parents, keeping the last as the root output
if (processExtendRoots) {
while (!extendParentRoots.isEmpty()) {
context.getCurrentPathStack().push(context.getExtendPathStack().peek().orElse(""), lineNumber, position);
Node parentRoot = extendParentRoots.removeFirst();
output = new OutputList(config.getMaxOutputSize());
for (Node node : parentRoot.getChildren()) {
OutputNode out = node.render(this);
output.addNode(out);
}
context.getExtendPathStack().pop();
context.getCurrentPathStack().pop();
}
}
resolveBlockStubs(output);
return output.getValue();
} } | public class class_name {
public String render(Node root, boolean processExtendRoots) {
OutputList output = new OutputList(config.getMaxOutputSize());
for (Node node : root.getChildren()) {
lineNumber = node.getLineNumber(); // depends on control dependency: [for], data = [node]
position = node.getStartPosition(); // depends on control dependency: [for], data = [node]
String renderStr = node.getMaster().getImage();
if (context.doesRenderStackContain(renderStr)) {
// This is a circular rendering. Stop rendering it here.
addError(new TemplateError(ErrorType.WARNING, ErrorReason.EXCEPTION, ErrorItem.TAG,
"Rendering cycle detected: '" + renderStr + "'", null, getLineNumber(), node.getStartPosition(),
null, BasicTemplateErrorCategory.IMPORT_CYCLE_DETECTED, ImmutableMap.of("string", renderStr))); // depends on control dependency: [if], data = [none]
output.addNode(new RenderedOutputNode(renderStr)); // depends on control dependency: [if], data = [none]
} else {
OutputNode out;
context.pushRenderStack(renderStr); // depends on control dependency: [if], data = [none]
try {
out = node.render(this); // depends on control dependency: [try], data = [none]
} catch (DeferredValueException e) {
out = new RenderedOutputNode(node.getMaster().getImage());
} // depends on control dependency: [catch], data = [none]
context.popRenderStack(); // depends on control dependency: [if], data = [none]
output.addNode(out); // depends on control dependency: [if], data = [none]
}
}
// render all extend parents, keeping the last as the root output
if (processExtendRoots) {
while (!extendParentRoots.isEmpty()) {
context.getCurrentPathStack().push(context.getExtendPathStack().peek().orElse(""), lineNumber, position); // depends on control dependency: [while], data = [none]
Node parentRoot = extendParentRoots.removeFirst();
output = new OutputList(config.getMaxOutputSize()); // depends on control dependency: [while], data = [none]
for (Node node : parentRoot.getChildren()) {
OutputNode out = node.render(this);
output.addNode(out); // depends on control dependency: [for], data = [none]
}
context.getExtendPathStack().pop(); // depends on control dependency: [while], data = [none]
context.getCurrentPathStack().pop(); // depends on control dependency: [while], data = [none]
}
}
resolveBlockStubs(output);
return output.getValue();
} } |
public class class_name {
private SizeableList<WAMInstruction> optimize(List<WAMInstruction> instructions)
{
StateMachine optimizeConstants = new OptimizeInstructions(symbolTable, interner);
Iterable<WAMInstruction> matcher =
new Matcher<WAMInstruction, WAMInstruction>(instructions.iterator(), optimizeConstants);
SizeableList<WAMInstruction> result = new SizeableLinkedList<WAMInstruction>();
for (WAMInstruction instruction : matcher)
{
result.add(instruction);
}
return result;
} } | public class class_name {
private SizeableList<WAMInstruction> optimize(List<WAMInstruction> instructions)
{
StateMachine optimizeConstants = new OptimizeInstructions(symbolTable, interner);
Iterable<WAMInstruction> matcher =
new Matcher<WAMInstruction, WAMInstruction>(instructions.iterator(), optimizeConstants);
SizeableList<WAMInstruction> result = new SizeableLinkedList<WAMInstruction>();
for (WAMInstruction instruction : matcher)
{
result.add(instruction); // depends on control dependency: [for], data = [instruction]
}
return result;
} } |
public class class_name {
private static byte[] bitSetToByteArray(BitSet bitSet) {
while (bitSet.length() % 8 != 0) { bitSet.set(bitSet.length(), true); }
byte[] array = new byte[bitSet.length()/8];
for (int i = 0; i < array.length; i++) {
int offset = i * 8;
int index = 0;
for (int j = 0; j < 8; j++) {
index <<= 1;
if (bitSet.get(offset+j)) { index++; }
}
array[i] = (byte)(index - 128);
}
return array;
} } | public class class_name {
private static byte[] bitSetToByteArray(BitSet bitSet) {
while (bitSet.length() % 8 != 0) { bitSet.set(bitSet.length(), true); }
// depends on control dependency: [while], data = [none]
byte[] array = new byte[bitSet.length()/8];
for (int i = 0; i < array.length; i++) {
int offset = i * 8;
int index = 0;
for (int j = 0; j < 8; j++) {
index <<= 1;
// depends on control dependency: [for], data = [none]
if (bitSet.get(offset+j)) { index++; }
// depends on control dependency: [if], data = [none]
}
array[i] = (byte)(index - 128);
// depends on control dependency: [for], data = [i]
}
return array;
} } |
public class class_name {
private int getIns( int opcode, Class type )
{
if( opcode == Opcodes.DUP )
{
return isWide( type ) ? Opcodes.DUP2 : opcode;
}
if( opcode == Opcodes.POP )
{
return isWide( type ) ? Opcodes.POP2 : opcode;
}
switch( opcode )
{
case Opcodes.ILOAD:
case Opcodes.ISTORE:
case Opcodes.IALOAD:
case Opcodes.IASTORE:
case Opcodes.IADD:
case Opcodes.ISUB:
case Opcodes.IMUL:
case Opcodes.IDIV:
case Opcodes.IREM:
case Opcodes.INEG:
case Opcodes.ISHL:
case Opcodes.ISHR:
case Opcodes.IUSHR:
case Opcodes.IAND:
case Opcodes.IOR:
case Opcodes.IXOR:
case Opcodes.IRETURN:
break;
default:
throw new IllegalArgumentException( "Opcode: " + Integer.toHexString( opcode ) + " is not handled" );
}
if( type == byte.class )
{
return Type.BYTE_TYPE.getOpcode( opcode );
}
else if( type == char.class )
{
return Type.CHAR_TYPE.getOpcode( opcode );
}
else if( type == short.class )
{
return Type.SHORT_TYPE.getOpcode( opcode );
}
else if( type == boolean.class)
{
return Type.BOOLEAN_TYPE.getOpcode( opcode );
}
else if( type == int.class)
{
return Type.INT_TYPE.getOpcode( opcode );
}
else if( type == long.class )
{
return Type.LONG_TYPE.getOpcode( opcode );
}
else if( type == float.class )
{
return Type.FLOAT_TYPE.getOpcode( opcode );
}
else if( type == double.class )
{
return Type.DOUBLE_TYPE.getOpcode( opcode );
}
else // handles array/ref types
{
return Type.getType(Object.class).getOpcode( opcode );
}
} } | public class class_name {
private int getIns( int opcode, Class type )
{
if( opcode == Opcodes.DUP )
{
return isWide( type ) ? Opcodes.DUP2 : opcode; // depends on control dependency: [if], data = [none]
}
if( opcode == Opcodes.POP )
{
return isWide( type ) ? Opcodes.POP2 : opcode; // depends on control dependency: [if], data = [none]
}
switch( opcode )
{
case Opcodes.ILOAD:
case Opcodes.ISTORE:
case Opcodes.IALOAD:
case Opcodes.IASTORE:
case Opcodes.IADD:
case Opcodes.ISUB:
case Opcodes.IMUL:
case Opcodes.IDIV:
case Opcodes.IREM:
case Opcodes.INEG:
case Opcodes.ISHL:
case Opcodes.ISHR:
case Opcodes.IUSHR:
case Opcodes.IAND:
case Opcodes.IOR:
case Opcodes.IXOR:
case Opcodes.IRETURN:
break;
default:
throw new IllegalArgumentException( "Opcode: " + Integer.toHexString( opcode ) + " is not handled" );
}
if( type == byte.class )
{
return Type.BYTE_TYPE.getOpcode( opcode ); // depends on control dependency: [if], data = [none]
}
else if( type == char.class )
{
return Type.CHAR_TYPE.getOpcode( opcode ); // depends on control dependency: [if], data = [none]
}
else if( type == short.class )
{
return Type.SHORT_TYPE.getOpcode( opcode ); // depends on control dependency: [if], data = [none]
}
else if( type == boolean.class)
{
return Type.BOOLEAN_TYPE.getOpcode( opcode ); // depends on control dependency: [if], data = [none]
}
else if( type == int.class)
{
return Type.INT_TYPE.getOpcode( opcode ); // depends on control dependency: [if], data = [none]
}
else if( type == long.class )
{
return Type.LONG_TYPE.getOpcode( opcode ); // depends on control dependency: [if], data = [none]
}
else if( type == float.class )
{
return Type.FLOAT_TYPE.getOpcode( opcode ); // depends on control dependency: [if], data = [none]
}
else if( type == double.class )
{
return Type.DOUBLE_TYPE.getOpcode( opcode ); // depends on control dependency: [if], data = [none]
}
else // handles array/ref types
{
return Type.getType(Object.class).getOpcode( opcode ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void viewDocument(final IdolViewRequest request, final OutputStream outputStream) throws ViewDocumentNotFoundException, IOException {
final ViewConfig viewConfig = configService.getConfig().getViewConfig();
if (viewConfig.getViewingMode() == ViewingMode.UNIVERSAL) {
final AciParameters viewParameters = new AciParameters(ViewActions.View.name());
parameterHandler.addViewParameters(viewParameters, request.getDocumentReference(), request);
try {
viewAciService.executeAction(viewParameters, new CopyResponseProcessor(outputStream));
return;
} catch (final AciServiceException e) {
throw new ViewServerErrorException(request.getDocumentReference(), e);
}
}
// Only fetch the minimum necessary information to know if we should use View, Connector, or DRECONTENT rendering.
final PrintFields printFields = new PrintFields(AUTN_IDENTIFIER, AUTN_GROUP);
final String refField = viewConfig.getReferenceField();
if(StringUtils.isNotBlank(refField)) {
printFields.append(refField);
}
final Hit document = loadDocument(request.getDocumentReference(), request.getDatabase(), printFields, null);
final Optional<String> maybeUrl = readViewUrl(document);
if (maybeUrl.isPresent()) {
final AciParameters viewParameters = new AciParameters(ViewActions.View.name());
parameterHandler.addViewParameters(viewParameters, maybeUrl.get(), request);
try {
viewAciService.executeAction(viewParameters, new CopyResponseProcessor(outputStream));
} catch (final AciServiceException e) {
throw new ViewServerErrorException(request.getDocumentReference(), e);
}
} else {
// We need to fetch the DRECONTENT if we have to use the DRECONTENT rendering fallback.
final Hit docContent = loadDocument(request.getDocumentReference(), request.getDatabase(), new PrintFields(CONTENT_FIELD), request.getHighlightExpression());
final String content = parseFieldValue(docContent, CONTENT_FIELD).orElse("");
final RawDocument rawDocument = RawDocument.builder()
.reference(document.getReference())
.title(document.getTitle())
.content(content)
.build();
try (final InputStream inputStream = rawContentViewer.formatRawContent(rawDocument)) {
IOUtils.copy(inputStream, outputStream);
}
}
} } | public class class_name {
@Override
public void viewDocument(final IdolViewRequest request, final OutputStream outputStream) throws ViewDocumentNotFoundException, IOException {
final ViewConfig viewConfig = configService.getConfig().getViewConfig();
if (viewConfig.getViewingMode() == ViewingMode.UNIVERSAL) {
final AciParameters viewParameters = new AciParameters(ViewActions.View.name());
parameterHandler.addViewParameters(viewParameters, request.getDocumentReference(), request);
try {
viewAciService.executeAction(viewParameters, new CopyResponseProcessor(outputStream)); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
} catch (final AciServiceException e) {
throw new ViewServerErrorException(request.getDocumentReference(), e);
} // depends on control dependency: [catch], data = [none]
}
// Only fetch the minimum necessary information to know if we should use View, Connector, or DRECONTENT rendering.
final PrintFields printFields = new PrintFields(AUTN_IDENTIFIER, AUTN_GROUP);
final String refField = viewConfig.getReferenceField();
if(StringUtils.isNotBlank(refField)) {
printFields.append(refField);
}
final Hit document = loadDocument(request.getDocumentReference(), request.getDatabase(), printFields, null);
final Optional<String> maybeUrl = readViewUrl(document);
if (maybeUrl.isPresent()) {
final AciParameters viewParameters = new AciParameters(ViewActions.View.name());
parameterHandler.addViewParameters(viewParameters, maybeUrl.get(), request);
try {
viewAciService.executeAction(viewParameters, new CopyResponseProcessor(outputStream));
} catch (final AciServiceException e) {
throw new ViewServerErrorException(request.getDocumentReference(), e);
}
} else {
// We need to fetch the DRECONTENT if we have to use the DRECONTENT rendering fallback.
final Hit docContent = loadDocument(request.getDocumentReference(), request.getDatabase(), new PrintFields(CONTENT_FIELD), request.getHighlightExpression());
final String content = parseFieldValue(docContent, CONTENT_FIELD).orElse("");
final RawDocument rawDocument = RawDocument.builder()
.reference(document.getReference())
.title(document.getTitle())
.content(content)
.build();
try (final InputStream inputStream = rawContentViewer.formatRawContent(rawDocument)) {
IOUtils.copy(inputStream, outputStream);
}
}
} } |
public class class_name {
protected synchronized InetAddress getHostAddress(URL u) {
if (u.hostAddress != null)
return (InetAddress) u.hostAddress;
String host = u.getHost();
if (host == null || host.equals("")) {
return null;
} else {
try {
u.hostAddress = InetAddress.getByName(host);
} catch (UnknownHostException ex) {
return null;
} catch (SecurityException se) {
return null;
}
}
return (InetAddress) u.hostAddress;
} } | public class class_name {
protected synchronized InetAddress getHostAddress(URL u) {
if (u.hostAddress != null)
return (InetAddress) u.hostAddress;
String host = u.getHost();
if (host == null || host.equals("")) {
return null; // depends on control dependency: [if], data = [none]
} else {
try {
u.hostAddress = InetAddress.getByName(host); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException ex) {
return null;
} catch (SecurityException se) { // depends on control dependency: [catch], data = [none]
return null;
} // depends on control dependency: [catch], data = [none]
}
return (InetAddress) u.hostAddress;
} } |
public class class_name {
protected TypeConverter createTypeConverter(Properties properties) {
Class<?> clazz = load(TypeConverter.class, properties);
if (clazz == null) {
return TypeConverter.DEFAULT;
}
try {
return TypeConverter.class.cast(clazz.newInstance());
} catch (Exception e) {
throw new ELException("TypeConverter " + clazz + " could not be instantiated", e);
}
} } | public class class_name {
protected TypeConverter createTypeConverter(Properties properties) {
Class<?> clazz = load(TypeConverter.class, properties);
if (clazz == null) {
return TypeConverter.DEFAULT; // depends on control dependency: [if], data = [none]
}
try {
return TypeConverter.class.cast(clazz.newInstance()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new ELException("TypeConverter " + clazz + " could not be instantiated", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static StoreAccessException handleException(Exception re) {
if(re instanceof StorePassThroughException) {
Throwable cause = re.getCause();
if(cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else {
return new StoreAccessException(cause);
}
} else {
return new StoreAccessException(re);
}
} } | public class class_name {
public static StoreAccessException handleException(Exception re) {
if(re instanceof StorePassThroughException) {
Throwable cause = re.getCause();
if(cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else {
return new StoreAccessException(cause); // depends on control dependency: [if], data = [none]
}
} else {
return new StoreAccessException(re); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <K, V> SortedSetMultimap<K, V> unmodifiableSortedSetMultimap(
SortedSetMultimap<K, V> delegate) {
if (delegate instanceof UnmodifiableSortedSetMultimap) {
return delegate;
}
return new UnmodifiableSortedSetMultimap<>(delegate);
} } | public class class_name {
public static <K, V> SortedSetMultimap<K, V> unmodifiableSortedSetMultimap(
SortedSetMultimap<K, V> delegate) {
if (delegate instanceof UnmodifiableSortedSetMultimap) {
return delegate; // depends on control dependency: [if], data = [none]
}
return new UnmodifiableSortedSetMultimap<>(delegate);
} } |
public class class_name {
public String getFormatted() {
String input = this.getUnformatted() + " ";
StringBuilder buf = new StringBuilder();
for (int i = 0; i < this.getUnformatted().length(); i+= 4) {
buf.append(input, i, i+4);
buf.append(' ');
}
return buf.toString().trim();
} } | public class class_name {
public String getFormatted() {
String input = this.getUnformatted() + " ";
StringBuilder buf = new StringBuilder();
for (int i = 0; i < this.getUnformatted().length(); i+= 4) {
buf.append(input, i, i+4); // depends on control dependency: [for], data = [i]
buf.append(' '); // depends on control dependency: [for], data = [none]
}
return buf.toString().trim();
} } |
public class class_name {
public void setRuleGroups(java.util.Collection<RuleGroupSummary> ruleGroups) {
if (ruleGroups == null) {
this.ruleGroups = null;
return;
}
this.ruleGroups = new java.util.ArrayList<RuleGroupSummary>(ruleGroups);
} } | public class class_name {
public void setRuleGroups(java.util.Collection<RuleGroupSummary> ruleGroups) {
if (ruleGroups == null) {
this.ruleGroups = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.ruleGroups = new java.util.ArrayList<RuleGroupSummary>(ruleGroups);
} } |
public class class_name {
@Override
public boolean isReady(final long time) {
while (true) {
final long thisTs = this.current.get();
if (thisTs >= time || this.current.compareAndSet(thisTs, time)) {
return true;
}
}
} } | public class class_name {
@Override
public boolean isReady(final long time) {
while (true) {
final long thisTs = this.current.get();
if (thisTs >= time || this.current.compareAndSet(thisTs, time)) {
return true; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public java.util.List<String> getNotificationARNs() {
if (notificationARNs == null) {
notificationARNs = new com.amazonaws.internal.SdkInternalList<String>();
}
return notificationARNs;
} } | public class class_name {
public java.util.List<String> getNotificationARNs() {
if (notificationARNs == null) {
notificationARNs = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return notificationARNs;
} } |
public class class_name {
public void info(final Consumer<DeferredLogBuilder> consumer) {
if (_slf4jLogger.isInfoEnabled()) {
final LogBuilder logBuilder = new DefaultLogBuilder(this, LogLevel.INFO);
consumer.accept(logBuilder);
logBuilder.log();
}
} } | public class class_name {
public void info(final Consumer<DeferredLogBuilder> consumer) {
if (_slf4jLogger.isInfoEnabled()) {
final LogBuilder logBuilder = new DefaultLogBuilder(this, LogLevel.INFO);
consumer.accept(logBuilder); // depends on control dependency: [if], data = [none]
logBuilder.log(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@RequestMapping(value = "changelog/{uuid}/commits", method = RequestMethod.GET)
public GitChangeLogCommits changeLogCommits(@PathVariable String uuid) {
// Gets the change log
GitChangeLog changeLog = getChangeLog(uuid);
// Cached?
GitChangeLogCommits commits = changeLog.getCommits();
if (commits != null) {
return commits;
}
// Loads the commits
GitChangeLogCommits loadedCommits = changeLog.loadCommits(gitService::getChangeLogCommits);
// Stores in cache
logCache.put(uuid, changeLog);
// OK
return loadedCommits;
} } | public class class_name {
@RequestMapping(value = "changelog/{uuid}/commits", method = RequestMethod.GET)
public GitChangeLogCommits changeLogCommits(@PathVariable String uuid) {
// Gets the change log
GitChangeLog changeLog = getChangeLog(uuid);
// Cached?
GitChangeLogCommits commits = changeLog.getCommits();
if (commits != null) {
return commits; // depends on control dependency: [if], data = [none]
}
// Loads the commits
GitChangeLogCommits loadedCommits = changeLog.loadCommits(gitService::getChangeLogCommits);
// Stores in cache
logCache.put(uuid, changeLog);
// OK
return loadedCommits;
} } |
public class class_name {
private void processCounters(Put p, JSONObject eventDetails, String key) {
try {
JSONObject jsonCounters = eventDetails.getJSONObject(key);
String counterMetaGroupName = jsonCounters.getString(NAME);
JSONArray groups = jsonCounters.getJSONArray(GROUPS);
for (int i = 0; i < groups.length(); i++) {
JSONObject aCounter = groups.getJSONObject(i);
JSONArray counts = aCounter.getJSONArray(COUNTS);
for (int j = 0; j < counts.length(); j++) {
JSONObject countDetails = counts.getJSONObject(j);
populatePut(p, Constants.INFO_FAM_BYTES, counterMetaGroupName, aCounter.get(NAME)
.toString(), countDetails.get(NAME).toString(), countDetails.getLong(VALUE));
}
}
} catch (JSONException e) {
throw new ProcessingException(" Caught json exception while processing counters ", e);
}
} } | public class class_name {
private void processCounters(Put p, JSONObject eventDetails, String key) {
try {
JSONObject jsonCounters = eventDetails.getJSONObject(key);
String counterMetaGroupName = jsonCounters.getString(NAME);
JSONArray groups = jsonCounters.getJSONArray(GROUPS);
for (int i = 0; i < groups.length(); i++) {
JSONObject aCounter = groups.getJSONObject(i);
JSONArray counts = aCounter.getJSONArray(COUNTS);
for (int j = 0; j < counts.length(); j++) {
JSONObject countDetails = counts.getJSONObject(j);
populatePut(p, Constants.INFO_FAM_BYTES, counterMetaGroupName, aCounter.get(NAME)
.toString(), countDetails.get(NAME).toString(), countDetails.getLong(VALUE)); // depends on control dependency: [for], data = [none]
}
}
} catch (JSONException e) {
throw new ProcessingException(" Caught json exception while processing counters ", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void tryRippleExit() {
if (mRipple != null) {
if (mExitingRipples == null) {
mExitingRipples = new RippleForeground[MAX_RIPPLES];
}
mExitingRipples[mExitingRipplesCount++] = mRipple;
mRipple.exit();
mRipple = null;
}
} } | public class class_name {
private void tryRippleExit() {
if (mRipple != null) {
if (mExitingRipples == null) {
mExitingRipples = new RippleForeground[MAX_RIPPLES]; // depends on control dependency: [if], data = [none]
}
mExitingRipples[mExitingRipplesCount++] = mRipple; // depends on control dependency: [if], data = [none]
mRipple.exit(); // depends on control dependency: [if], data = [none]
mRipple = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void contextInitialized(ServletContextEvent event) {
// On Windows, URL caches can cause problems, particularly with
// undeployment
// So, here we attempt to disable them if we detect that we are running
// on Windows
try {
String osName = System.getProperty("os.name");
if (osName != null && osName.toLowerCase().contains("windows")) {
URL url = new URL("http://localhost/");
URLConnection urlConn = url.openConnection();
urlConn.setDefaultUseCaches(false);
}
} catch (Throwable t) {
// Any errors thrown in disabling the caches aren't significant to
// the normal execution of the application, so we ignore them
}
} } | public class class_name {
@Override
public void contextInitialized(ServletContextEvent event) {
// On Windows, URL caches can cause problems, particularly with
// undeployment
// So, here we attempt to disable them if we detect that we are running
// on Windows
try {
String osName = System.getProperty("os.name");
if (osName != null && osName.toLowerCase().contains("windows")) {
URL url = new URL("http://localhost/");
URLConnection urlConn = url.openConnection();
urlConn.setDefaultUseCaches(false); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
// Any errors thrown in disabling the caches aren't significant to
// the normal execution of the application, so we ignore them
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private int getQueueIndex(Object[] queue, java.util.concurrent.atomic.AtomicInteger counter, boolean increment) {
// fast path for single element array
if (queue.length == 1) {
return 0;
} else if (increment) {
// get the next long value from counter
int i = counter.incrementAndGet();
// rollover logic to make sure we stay within
// the bounds of an integer. Not important that
// this logic is highly accurate, ballpark is okay.
if (i > MAX_COUNTER) {
if (counter.compareAndSet(i, 0)) {
System.out.println("BoundedBuffer: reset counter to 0");
}
}
return i % queue.length;
} else {
return counter.get() % queue.length;
}
} } | public class class_name {
private int getQueueIndex(Object[] queue, java.util.concurrent.atomic.AtomicInteger counter, boolean increment) {
// fast path for single element array
if (queue.length == 1) {
return 0; // depends on control dependency: [if], data = [none]
} else if (increment) {
// get the next long value from counter
int i = counter.incrementAndGet();
// rollover logic to make sure we stay within
// the bounds of an integer. Not important that
// this logic is highly accurate, ballpark is okay.
if (i > MAX_COUNTER) {
if (counter.compareAndSet(i, 0)) {
System.out.println("BoundedBuffer: reset counter to 0"); // depends on control dependency: [if], data = [none]
}
}
return i % queue.length; // depends on control dependency: [if], data = [none]
} else {
return counter.get() % queue.length; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String encode(String str) {
if (str == null) {
return null;
}
try {
return URLEncoder.encode(str, Charsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
// Should never happen
throw Throwables.propagate(e);
}
} } | public class class_name {
private String encode(String str) {
if (str == null) {
return null; // depends on control dependency: [if], data = [none]
}
try {
return URLEncoder.encode(str, Charsets.UTF_8.name()); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
// Should never happen
throw Throwables.propagate(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public HsqlArrayList listVisibleUsers(Session session) {
HsqlArrayList list;
User user;
boolean isAdmin;
String sessionName;
String userName;
list = new HsqlArrayList();
isAdmin = session.isAdmin();
sessionName = session.getUsername();
if (userList == null || userList.size() == 0) {
return list;
}
for (int i = 0; i < userList.size(); i++) {
user = (User) userList.get(i);
if (user == null) {
continue;
}
userName = user.getNameString();
if (isAdmin) {
list.add(user);
} else if (sessionName.equals(userName)) {
list.add(user);
}
}
return list;
} } | public class class_name {
public HsqlArrayList listVisibleUsers(Session session) {
HsqlArrayList list;
User user;
boolean isAdmin;
String sessionName;
String userName;
list = new HsqlArrayList();
isAdmin = session.isAdmin();
sessionName = session.getUsername();
if (userList == null || userList.size() == 0) {
return list; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < userList.size(); i++) {
user = (User) userList.get(i); // depends on control dependency: [for], data = [i]
if (user == null) {
continue;
}
userName = user.getNameString(); // depends on control dependency: [for], data = [none]
if (isAdmin) {
list.add(user); // depends on control dependency: [if], data = [none]
} else if (sessionName.equals(userName)) {
list.add(user); // depends on control dependency: [if], data = [none]
}
}
return list;
} } |
public class class_name {
private void writeToFile(List beans) {
if (fileChooser == null)
fileChooser = new FileManager(null, null, null, (PreferencesExt) prefs.node("FileManager"));
FileOutputStream fos = null;
RandomAccessFile raf = null;
try {
String filename = null;
boolean append = false;
int n = 0;
MFile curr = null;
for (Object o : beans) {
Grib2RecordBean bean = (Grib2RecordBean) o;
MFile mfile = fileList.get(bean.gr.getFile());
if (curr == null || curr != mfile) {
if (raf != null) raf.close();
raf = new RandomAccessFile(mfile.getPath(), "r");
curr = mfile;
}
if (fos == null) {
String defloc = mfile.getPath();
filename = fileChooser.chooseFilenameToSave(defloc + ".grib2");
if (filename == null) return;
File f = new File(filename);
append = f.exists();
fos = new FileOutputStream(filename, append);
}
Grib2SectionIndicator is = bean.gr.getIs();
int size = (int) (is.getMessageLength());
long startPos = is.getStartPos();
if (startPos < 0) {
JOptionPane.showMessageDialog(Grib2DataPanel.this, "Old index does not have message start - record not written");
}
byte[] rb = new byte[size];
raf.seek(startPos);
raf.readFully(rb);
fos.write(rb);
n++;
}
JOptionPane.showMessageDialog(Grib2DataPanel.this, filename + ": " + n + " records successfully written, append=" + append);
} catch (Exception ex) {
JOptionPane.showMessageDialog(Grib2DataPanel.this, "ERROR: " + ex.getMessage());
ex.printStackTrace();
} finally {
try {
if (fos != null) fos.close();
if (raf != null) raf.close();
} catch (IOException ioe) {
}
}
} } | public class class_name {
private void writeToFile(List beans) {
if (fileChooser == null)
fileChooser = new FileManager(null, null, null, (PreferencesExt) prefs.node("FileManager"));
FileOutputStream fos = null;
RandomAccessFile raf = null;
try {
String filename = null;
boolean append = false;
int n = 0;
MFile curr = null;
for (Object o : beans) {
Grib2RecordBean bean = (Grib2RecordBean) o;
MFile mfile = fileList.get(bean.gr.getFile());
if (curr == null || curr != mfile) {
if (raf != null) raf.close();
raf = new RandomAccessFile(mfile.getPath(), "r"); // depends on control dependency: [if], data = [none]
curr = mfile; // depends on control dependency: [if], data = [none]
}
if (fos == null) {
String defloc = mfile.getPath();
filename = fileChooser.chooseFilenameToSave(defloc + ".grib2"); // depends on control dependency: [if], data = [none]
if (filename == null) return;
File f = new File(filename);
append = f.exists(); // depends on control dependency: [if], data = [none]
fos = new FileOutputStream(filename, append); // depends on control dependency: [if], data = [none]
}
Grib2SectionIndicator is = bean.gr.getIs();
int size = (int) (is.getMessageLength());
long startPos = is.getStartPos();
if (startPos < 0) {
JOptionPane.showMessageDialog(Grib2DataPanel.this, "Old index does not have message start - record not written"); // depends on control dependency: [if], data = [none]
}
byte[] rb = new byte[size];
raf.seek(startPos); // depends on control dependency: [for], data = [o]
raf.readFully(rb); // depends on control dependency: [for], data = [none]
fos.write(rb); // depends on control dependency: [for], data = [o]
n++; // depends on control dependency: [for], data = [none]
}
JOptionPane.showMessageDialog(Grib2DataPanel.this, filename + ": " + n + " records successfully written, append=" + append); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
JOptionPane.showMessageDialog(Grib2DataPanel.this, "ERROR: " + ex.getMessage());
ex.printStackTrace();
} finally { // depends on control dependency: [catch], data = [none]
try {
if (fos != null) fos.close();
if (raf != null) raf.close();
} catch (IOException ioe) {
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static String byteToHex(byte[] array, String separator) {
assert array != null;
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < array.length; i++) {
// add separator in between, not before the first byte
if (i != 0) {
buffer.append(separator);
}
// (b & 0xff) treats b as unsigned byte
// first nibble is 0 if byte is less than 0x10
if ((array[i] & 0xff) < 0x10) {
buffer.append("0");
}
// use java's hex conversion for the rest
buffer.append(Integer.toString(array[i] & 0xff, 16));
}
return buffer.toString();
} } | public class class_name {
public static String byteToHex(byte[] array, String separator) {
assert array != null;
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < array.length; i++) {
// add separator in between, not before the first byte
if (i != 0) {
buffer.append(separator); // depends on control dependency: [if], data = [none]
}
// (b & 0xff) treats b as unsigned byte
// first nibble is 0 if byte is less than 0x10
if ((array[i] & 0xff) < 0x10) {
buffer.append("0"); // depends on control dependency: [if], data = [none]
}
// use java's hex conversion for the rest
buffer.append(Integer.toString(array[i] & 0xff, 16)); // depends on control dependency: [for], data = [i]
}
return buffer.toString();
} } |
public class class_name {
@Override
public void visitClassContext(ClassContext classContext) {
try {
if ((collectionClass != null) && (mapClass != null)) {
collectionFields = new HashMap<>();
aliases = new HashMap<>();
stack = new OpcodeStack();
JavaClass cls = classContext.getJavaClass();
className = cls.getClassName();
super.visitClassContext(classContext);
for (FieldInfo fi : collectionFields.values()) {
if (fi.isSynchronized()) {
bugReporter.reportBug(new BugInstance(this, BugType.NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION.name(), NORMAL_PRIORITY)
.addClass(this).addField(fi.getFieldAnnotation()));
}
}
}
} finally {
collectionFields = null;
aliases = null;
stack = null;
}
} } | public class class_name {
@Override
public void visitClassContext(ClassContext classContext) {
try {
if ((collectionClass != null) && (mapClass != null)) {
collectionFields = new HashMap<>(); // depends on control dependency: [if], data = [none]
aliases = new HashMap<>(); // depends on control dependency: [if], data = [none]
stack = new OpcodeStack(); // depends on control dependency: [if], data = [none]
JavaClass cls = classContext.getJavaClass();
className = cls.getClassName(); // depends on control dependency: [if], data = [none]
super.visitClassContext(classContext); // depends on control dependency: [if], data = [none]
for (FieldInfo fi : collectionFields.values()) {
if (fi.isSynchronized()) {
bugReporter.reportBug(new BugInstance(this, BugType.NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION.name(), NORMAL_PRIORITY)
.addClass(this).addField(fi.getFieldAnnotation())); // depends on control dependency: [if], data = [none]
}
}
}
} finally {
collectionFields = null;
aliases = null;
stack = null;
}
} } |
public class class_name {
public final void setSNIMatchers(Collection<SNIMatcher> matchers) {
if (matchers != null) {
if (!matchers.isEmpty()) {
sniMatchers = new HashMap<>(matchers.size());
for (SNIMatcher matcher : matchers) {
if (sniMatchers.put(matcher.getType(),
matcher) != null) {
throw new IllegalArgumentException(
"Duplicated server name of type " +
matcher.getType());
}
}
} else {
sniMatchers = Collections.<Integer, SNIMatcher>emptyMap();
}
} else {
sniMatchers = null;
}
} } | public class class_name {
public final void setSNIMatchers(Collection<SNIMatcher> matchers) {
if (matchers != null) {
if (!matchers.isEmpty()) {
sniMatchers = new HashMap<>(matchers.size()); // depends on control dependency: [if], data = [none]
for (SNIMatcher matcher : matchers) {
if (sniMatchers.put(matcher.getType(),
matcher) != null) {
throw new IllegalArgumentException(
"Duplicated server name of type " +
matcher.getType());
}
}
} else {
sniMatchers = Collections.<Integer, SNIMatcher>emptyMap(); // depends on control dependency: [if], data = [none]
}
} else {
sniMatchers = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean show(final Activity activity) {
final SharedPreferences preferences = activity.getSharedPreferences(PREFERENCES_EULA,
Activity.MODE_PRIVATE);
if (!preferences.getBoolean(PREFERENCE_EULA_ACCEPTED, false)) {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("License");
builder.setCancelable(true);
builder.setPositiveButton("Accept", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
accept(preferences);
if (activity instanceof OnEulaAgreedTo) {
((OnEulaAgreedTo) activity).onEulaAgreedTo();
}
}
});
builder.setNegativeButton("Refuse", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
refuse(activity);
}
});
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
refuse(activity);
}
});
builder.setMessage(readEula(activity));
builder.create().show();
return false;
}
return true;
} } | public class class_name {
public static boolean show(final Activity activity) {
final SharedPreferences preferences = activity.getSharedPreferences(PREFERENCES_EULA,
Activity.MODE_PRIVATE);
if (!preferences.getBoolean(PREFERENCE_EULA_ACCEPTED, false)) {
final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle("License"); // depends on control dependency: [if], data = [none]
builder.setCancelable(true); // depends on control dependency: [if], data = [none]
builder.setPositiveButton("Accept", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
accept(preferences);
if (activity instanceof OnEulaAgreedTo) {
((OnEulaAgreedTo) activity).onEulaAgreedTo(); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
builder.setNegativeButton("Refuse", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
refuse(activity);
}
}); // depends on control dependency: [if], data = [none]
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
refuse(activity);
}
}); // depends on control dependency: [if], data = [none]
builder.setMessage(readEula(activity)); // depends on control dependency: [if], data = [none]
builder.create().show(); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
protected void offlineCacheUpdate(CmsPublishedResource resource) {
for (CachePair cachePair : m_caches) {
try {
cachePair.getOfflineCache().update(resource);
} catch (Throwable e) {
LOG.error(e.getLocalizedMessage());
}
}
} } | public class class_name {
protected void offlineCacheUpdate(CmsPublishedResource resource) {
for (CachePair cachePair : m_caches) {
try {
cachePair.getOfflineCache().update(resource);
// depends on control dependency: [try], data = [none]
} catch (Throwable e) {
LOG.error(e.getLocalizedMessage());
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private double createZoom(RouteInformation routeInformation) {
CameraPosition position = createCameraPosition(routeInformation.location(), routeInformation.routeProgress());
if (position.zoom > MAX_CAMERA_ZOOM) {
return MAX_CAMERA_ZOOM;
} else if (position.zoom < MIN_CAMERA_ZOOM) {
return MIN_CAMERA_ZOOM;
}
return position.zoom;
} } | public class class_name {
private double createZoom(RouteInformation routeInformation) {
CameraPosition position = createCameraPosition(routeInformation.location(), routeInformation.routeProgress());
if (position.zoom > MAX_CAMERA_ZOOM) {
return MAX_CAMERA_ZOOM; // depends on control dependency: [if], data = [none]
} else if (position.zoom < MIN_CAMERA_ZOOM) {
return MIN_CAMERA_ZOOM; // depends on control dependency: [if], data = [none]
}
return position.zoom;
} } |
public class class_name {
public static String[] toIdentifierList(ProfileField<?>[] fields) {
if (fields == null) {
return null;
}
String[] identifiers = new String[fields.length];
for (int i = 0; i < fields.length; i++) {
identifiers[i] = fields[i].getIdentifier();
}
return identifiers;
} } | public class class_name {
public static String[] toIdentifierList(ProfileField<?>[] fields) {
if (fields == null) {
return null; // depends on control dependency: [if], data = [none]
}
String[] identifiers = new String[fields.length];
for (int i = 0; i < fields.length; i++) {
identifiers[i] = fields[i].getIdentifier(); // depends on control dependency: [for], data = [i]
}
return identifiers;
} } |
public class class_name {
public static byte[] compress(String urlString) throws MalformedURLException {
byte[] compressedBytes = null;
if (urlString != null) {
// Figure the compressed bytes can't be longer than the original string.
byte[] byteBuffer = new byte[urlString.length()];
int byteBufferIndex = 0;
Arrays.fill(byteBuffer, (byte) 0x00);
Pattern urlPattern = Pattern.compile(EDDYSTONE_URL_REGEX);
Matcher urlMatcher = urlPattern.matcher(urlString);
if (urlMatcher.matches()) {
// www.
String wwwdot = urlMatcher.group(EDDYSTONE_URL_WWW_GROUP);
boolean haswww = (wwwdot != null);
// Protocol.
String rawProtocol = urlMatcher.group(EDDYSTONE_URL_PROTOCOL_GROUP);
String protocol = rawProtocol.toLowerCase();
if (protocol.equalsIgnoreCase(URL_PROTOCOL_HTTP)) {
byteBuffer[byteBufferIndex] = (haswww ? EDDYSTONE_URL_PROTOCOL_HTTP_WWW : EDDYSTONE_URL_PROTOCOL_HTTP);
}
else {
byteBuffer[byteBufferIndex] = (haswww ? EDDYSTONE_URL_PROTOCOL_HTTPS_WWW : EDDYSTONE_URL_PROTOCOL_HTTPS);
}
byteBufferIndex++;
// Fully-qualified domain name (FQDN). This includes the hostname and any other components after the dots
// but BEFORE the first single slash in the URL.
byte[] hostnameBytes = urlMatcher.group(EDDYSTONE_URL_FQDN_GROUP).getBytes();
String rawHostname = new String(hostnameBytes);
String hostname = rawHostname.toLowerCase();
String[] domains = hostname.split(Pattern.quote("."));
boolean consumedSlash = false;
if (domains != null) {
// Write the hostname/subdomains prior to the last one. If there's only one (e. g. http://localhost)
// then that's the only thing to write out.
byte[] periodBytes = {'.'};
int writableDomainsCount = (domains.length == 1 ? 1 : domains.length - 1);
for (int domainIndex = 0; domainIndex < writableDomainsCount; domainIndex++) {
// Write out leading period, if necessary.
if (domainIndex > 0) {
System.arraycopy(periodBytes, 0, byteBuffer, byteBufferIndex, periodBytes.length);
byteBufferIndex += periodBytes.length;
}
byte[] domainBytes = domains[domainIndex].getBytes();
int domainLength = domainBytes.length;
System.arraycopy(domainBytes, 0, byteBuffer, byteBufferIndex, domainLength);
byteBufferIndex += domainLength;
}
// Is the TLD one that we can encode?
if (domains.length > 1) {
String tld = "." + domains[domains.length - 1];
String slash = urlMatcher.group(EDDYSTONE_URL_SLASH_GROUP);
String encodableTLDCandidate = (slash == null ? tld : tld + slash);
byte encodedTLDByte = encodedByteForTopLevelDomain(encodableTLDCandidate);
if (encodedTLDByte != TLD_NOT_ENCODABLE) {
byteBuffer[byteBufferIndex++] = encodedTLDByte;
consumedSlash = (slash != null);
} else {
byte[] tldBytes = tld.getBytes();
int tldLength = tldBytes.length;
System.arraycopy(tldBytes, 0, byteBuffer, byteBufferIndex, tldLength);
byteBufferIndex += tldLength;
}
}
}
// Optional slash.
if (! consumedSlash) {
String slash = urlMatcher.group(EDDYSTONE_URL_SLASH_GROUP);
if (slash != null) {
int slashLength = slash.length();
System.arraycopy(slash.getBytes(), 0, byteBuffer, byteBufferIndex, slashLength);
byteBufferIndex += slashLength;
}
}
// Path.
String path = urlMatcher.group(EDDYSTONE_URL_PATH_GROUP);
if (path != null) {
int pathLength = path.length();
System.arraycopy(path.getBytes(), 0, byteBuffer, byteBufferIndex, pathLength);
byteBufferIndex += pathLength;
}
// Copy the result.
compressedBytes = new byte[byteBufferIndex];
System.arraycopy(byteBuffer, 0, compressedBytes, 0, compressedBytes.length);
}
else {
throw new MalformedURLException();
}
}
else {
throw new MalformedURLException();
}
return compressedBytes;
} } | public class class_name {
public static byte[] compress(String urlString) throws MalformedURLException {
byte[] compressedBytes = null;
if (urlString != null) {
// Figure the compressed bytes can't be longer than the original string.
byte[] byteBuffer = new byte[urlString.length()];
int byteBufferIndex = 0;
Arrays.fill(byteBuffer, (byte) 0x00);
Pattern urlPattern = Pattern.compile(EDDYSTONE_URL_REGEX);
Matcher urlMatcher = urlPattern.matcher(urlString);
if (urlMatcher.matches()) {
// www.
String wwwdot = urlMatcher.group(EDDYSTONE_URL_WWW_GROUP);
boolean haswww = (wwwdot != null);
// Protocol.
String rawProtocol = urlMatcher.group(EDDYSTONE_URL_PROTOCOL_GROUP);
String protocol = rawProtocol.toLowerCase();
if (protocol.equalsIgnoreCase(URL_PROTOCOL_HTTP)) {
byteBuffer[byteBufferIndex] = (haswww ? EDDYSTONE_URL_PROTOCOL_HTTP_WWW : EDDYSTONE_URL_PROTOCOL_HTTP);
}
else {
byteBuffer[byteBufferIndex] = (haswww ? EDDYSTONE_URL_PROTOCOL_HTTPS_WWW : EDDYSTONE_URL_PROTOCOL_HTTPS);
}
byteBufferIndex++;
// Fully-qualified domain name (FQDN). This includes the hostname and any other components after the dots
// but BEFORE the first single slash in the URL.
byte[] hostnameBytes = urlMatcher.group(EDDYSTONE_URL_FQDN_GROUP).getBytes();
String rawHostname = new String(hostnameBytes);
String hostname = rawHostname.toLowerCase();
String[] domains = hostname.split(Pattern.quote("."));
boolean consumedSlash = false;
if (domains != null) {
// Write the hostname/subdomains prior to the last one. If there's only one (e. g. http://localhost)
// then that's the only thing to write out.
byte[] periodBytes = {'.'};
int writableDomainsCount = (domains.length == 1 ? 1 : domains.length - 1);
for (int domainIndex = 0; domainIndex < writableDomainsCount; domainIndex++) {
// Write out leading period, if necessary.
if (domainIndex > 0) {
System.arraycopy(periodBytes, 0, byteBuffer, byteBufferIndex, periodBytes.length); // depends on control dependency: [if], data = [none]
byteBufferIndex += periodBytes.length; // depends on control dependency: [if], data = [none]
}
byte[] domainBytes = domains[domainIndex].getBytes();
int domainLength = domainBytes.length;
System.arraycopy(domainBytes, 0, byteBuffer, byteBufferIndex, domainLength);
byteBufferIndex += domainLength;
}
// Is the TLD one that we can encode?
if (domains.length > 1) {
String tld = "." + domains[domains.length - 1];
String slash = urlMatcher.group(EDDYSTONE_URL_SLASH_GROUP);
String encodableTLDCandidate = (slash == null ? tld : tld + slash);
byte encodedTLDByte = encodedByteForTopLevelDomain(encodableTLDCandidate);
if (encodedTLDByte != TLD_NOT_ENCODABLE) {
byteBuffer[byteBufferIndex++] = encodedTLDByte; // depends on control dependency: [if], data = [none]
consumedSlash = (slash != null); // depends on control dependency: [if], data = [none]
} else {
byte[] tldBytes = tld.getBytes();
int tldLength = tldBytes.length;
System.arraycopy(tldBytes, 0, byteBuffer, byteBufferIndex, tldLength); // depends on control dependency: [if], data = [none]
byteBufferIndex += tldLength; // depends on control dependency: [if], data = [none]
}
}
}
// Optional slash.
if (! consumedSlash) {
String slash = urlMatcher.group(EDDYSTONE_URL_SLASH_GROUP);
if (slash != null) {
int slashLength = slash.length();
System.arraycopy(slash.getBytes(), 0, byteBuffer, byteBufferIndex, slashLength);
byteBufferIndex += slashLength;
}
}
// Path.
String path = urlMatcher.group(EDDYSTONE_URL_PATH_GROUP);
if (path != null) {
int pathLength = path.length();
System.arraycopy(path.getBytes(), 0, byteBuffer, byteBufferIndex, pathLength);
byteBufferIndex += pathLength;
}
// Copy the result.
compressedBytes = new byte[byteBufferIndex];
System.arraycopy(byteBuffer, 0, compressedBytes, 0, compressedBytes.length);
}
else {
throw new MalformedURLException();
}
}
else {
throw new MalformedURLException();
}
return compressedBytes;
} } |
public class class_name {
public void update() {
if (done) {
return;
}
float sampleRate = audio.getRate();
float sampleSize;
if (audio.getChannels() > 1) {
sampleSize = 4; // AL10.AL_FORMAT_STEREO16
} else {
sampleSize = 2; // AL10.AL_FORMAT_MONO16
}
int processed = AL10.alGetSourcei(source, AL10.AL_BUFFERS_PROCESSED);
while (processed > 0) {
unqueued.clear();
AL10.alSourceUnqueueBuffers(source, unqueued);
int bufferIndex = unqueued.get(0);
float bufferLength = (AL10.alGetBufferi(bufferIndex, AL10.AL_SIZE) / sampleSize) / sampleRate;
positionOffset += bufferLength;
if (stream(bufferIndex)) {
AL10.alSourceQueueBuffers(source, unqueued);
} else {
remainingBufferCount--;
if (remainingBufferCount == 0) {
done = true;
}
}
processed--;
}
int state = AL10.alGetSourcei(source, AL10.AL_SOURCE_STATE);
if (state != AL10.AL_PLAYING) {
AL10.alSourcePlay(source);
}
} } | public class class_name {
public void update() {
if (done) {
return;
// depends on control dependency: [if], data = [none]
}
float sampleRate = audio.getRate();
float sampleSize;
if (audio.getChannels() > 1) {
sampleSize = 4; // AL10.AL_FORMAT_STEREO16
// depends on control dependency: [if], data = [none]
} else {
sampleSize = 2; // AL10.AL_FORMAT_MONO16
// depends on control dependency: [if], data = [none]
}
int processed = AL10.alGetSourcei(source, AL10.AL_BUFFERS_PROCESSED);
while (processed > 0) {
unqueued.clear();
// depends on control dependency: [while], data = [none]
AL10.alSourceUnqueueBuffers(source, unqueued);
// depends on control dependency: [while], data = [none]
int bufferIndex = unqueued.get(0);
float bufferLength = (AL10.alGetBufferi(bufferIndex, AL10.AL_SIZE) / sampleSize) / sampleRate;
positionOffset += bufferLength;
// depends on control dependency: [while], data = [none]
if (stream(bufferIndex)) {
AL10.alSourceQueueBuffers(source, unqueued);
// depends on control dependency: [if], data = [none]
} else {
remainingBufferCount--;
// depends on control dependency: [if], data = [none]
if (remainingBufferCount == 0) {
done = true;
// depends on control dependency: [if], data = [none]
}
}
processed--;
// depends on control dependency: [while], data = [none]
}
int state = AL10.alGetSourcei(source, AL10.AL_SOURCE_STATE);
if (state != AL10.AL_PLAYING) {
AL10.alSourcePlay(source);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public boolean addEventListener(IEventListener listener) {
boolean result = super.addEventListener(listener) && so.register(listener);
for (ISharedObjectListener soListener : serverListeners) {
soListener.onSharedObjectConnect(this);
}
return result;
} } | public class class_name {
@Override
public boolean addEventListener(IEventListener listener) {
boolean result = super.addEventListener(listener) && so.register(listener);
for (ISharedObjectListener soListener : serverListeners) {
soListener.onSharedObjectConnect(this);
// depends on control dependency: [for], data = [soListener]
}
return result;
} } |
public class class_name {
private static void updatePersonAssignmentData(final PersonAssignmentData exist, final PersonAssignmentData update) {
final List<AssignmentData> assignmentList = update.getAssignmentList();
for (final AssignmentData assignmentData : assignmentList) {
updateAssignmentData(exist.getAssignmentList(), assignmentData);
}
} } | public class class_name {
private static void updatePersonAssignmentData(final PersonAssignmentData exist, final PersonAssignmentData update) {
final List<AssignmentData> assignmentList = update.getAssignmentList();
for (final AssignmentData assignmentData : assignmentList) {
updateAssignmentData(exist.getAssignmentList(), assignmentData); // depends on control dependency: [for], data = [assignmentData]
}
} } |
public class class_name {
public void truncateVocabulary(int threshold) {
logger.debug("Truncating vocabulary to minWordFrequency: [" + threshold + "]");
Set<String> keyset = vocabulary.keySet();
for (String word : keyset) {
VocabularyWord vw = vocabulary.get(word);
// please note: we're not applying threshold to SPECIAL words
if (!vw.isSpecial() && vw.getCount() < threshold) {
vocabulary.remove(word);
if (vw.getHuffmanNode() != null)
idxMap.remove(vw.getHuffmanNode().getIdx());
}
}
} } | public class class_name {
public void truncateVocabulary(int threshold) {
logger.debug("Truncating vocabulary to minWordFrequency: [" + threshold + "]");
Set<String> keyset = vocabulary.keySet();
for (String word : keyset) {
VocabularyWord vw = vocabulary.get(word);
// please note: we're not applying threshold to SPECIAL words
if (!vw.isSpecial() && vw.getCount() < threshold) {
vocabulary.remove(word); // depends on control dependency: [if], data = [none]
if (vw.getHuffmanNode() != null)
idxMap.remove(vw.getHuffmanNode().getIdx());
}
}
} } |
public class class_name {
public void optimizeFirstBytes() {
// now we post process the entries and remove the first byte ones we can optimize
for (MagicEntry entry : entryList) {
byte[] startingBytes = entry.getStartsWithByte();
if (startingBytes == null || startingBytes.length == 0) {
continue;
}
int index = (0xFF & startingBytes[0]);
if (firstByteEntryLists[index] == null) {
firstByteEntryLists[index] = new ArrayList<MagicEntry>();
}
firstByteEntryLists[index].add(entry);
/*
* We put an entry in the first-byte list but need to leave it in the main list because there may be
* optional characters or != or > comparisons in the match
*/
}
} } | public class class_name {
public void optimizeFirstBytes() {
// now we post process the entries and remove the first byte ones we can optimize
for (MagicEntry entry : entryList) {
byte[] startingBytes = entry.getStartsWithByte();
if (startingBytes == null || startingBytes.length == 0) {
continue;
}
int index = (0xFF & startingBytes[0]);
if (firstByteEntryLists[index] == null) {
firstByteEntryLists[index] = new ArrayList<MagicEntry>(); // depends on control dependency: [if], data = [none]
}
firstByteEntryLists[index].add(entry); // depends on control dependency: [for], data = [entry]
/*
* We put an entry in the first-byte list but need to leave it in the main list because there may be
* optional characters or != or > comparisons in the match
*/
}
} } |
public class class_name {
private Paint getStylePaint(StyleRow style, FeatureDrawType drawType) {
Paint paint = featurePaintCache.getPaint(style, drawType);
if (paint == null) {
Color color = null;
Style paintStyle = null;
Float strokeWidth = null;
switch (drawType) {
case CIRCLE:
color = style.getColorOrDefault();
paintStyle = Style.FILL;
break;
case STROKE:
color = style.getColorOrDefault();
paintStyle = Style.STROKE;
strokeWidth = this.density * (float) style.getWidthOrDefault();
break;
case FILL:
color = style.getFillColor();
paintStyle = Style.FILL;
strokeWidth = this.density * (float) style.getWidthOrDefault();
break;
default:
throw new GeoPackageException("Unsupported Draw Type: " + drawType);
}
Paint stylePaint = new Paint();
stylePaint.setAntiAlias(true);
stylePaint.setStyle(paintStyle);
stylePaint.setColor(color.getColorWithAlpha());
if (strokeWidth != null) {
stylePaint.setStrokeWidth(strokeWidth);
}
synchronized (featurePaintCache) {
paint = featurePaintCache.getPaint(style, drawType);
if (paint == null) {
featurePaintCache.setPaint(style, drawType, stylePaint);
paint = stylePaint;
}
}
}
return paint;
} } | public class class_name {
private Paint getStylePaint(StyleRow style, FeatureDrawType drawType) {
Paint paint = featurePaintCache.getPaint(style, drawType);
if (paint == null) {
Color color = null;
Style paintStyle = null;
Float strokeWidth = null;
switch (drawType) {
case CIRCLE:
color = style.getColorOrDefault();
paintStyle = Style.FILL;
break;
case STROKE:
color = style.getColorOrDefault();
paintStyle = Style.STROKE;
strokeWidth = this.density * (float) style.getWidthOrDefault();
break;
case FILL:
color = style.getFillColor();
paintStyle = Style.FILL;
strokeWidth = this.density * (float) style.getWidthOrDefault();
break;
default:
throw new GeoPackageException("Unsupported Draw Type: " + drawType);
}
Paint stylePaint = new Paint();
stylePaint.setAntiAlias(true); // depends on control dependency: [if], data = [none]
stylePaint.setStyle(paintStyle); // depends on control dependency: [if], data = [(paint]
stylePaint.setColor(color.getColorWithAlpha()); // depends on control dependency: [if], data = [none]
if (strokeWidth != null) {
stylePaint.setStrokeWidth(strokeWidth); // depends on control dependency: [if], data = [(strokeWidth]
}
synchronized (featurePaintCache) { // depends on control dependency: [if], data = [none]
paint = featurePaintCache.getPaint(style, drawType);
if (paint == null) {
featurePaintCache.setPaint(style, drawType, stylePaint); // depends on control dependency: [if], data = [none]
paint = stylePaint; // depends on control dependency: [if], data = [none]
}
}
}
return paint;
} } |
public class class_name {
private SubscriptionMessageHandler doProxySubscribeOp(
int op,
MESubscription subscription,
SubscriptionMessageHandler messageHandler,
Hashtable subscriptionsTable,
boolean sendProxy)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"doProxySubscribeOp",
new Object[] {
new Integer(op),
subscription,
messageHandler,
new Boolean(sendProxy)});
// If we don't want to send proxy messages, set the operation to be
// no operation.
if (!sendProxy)
{
// If we aren't to send the proxy and we have an unsubscribe, then we need
// to remove the subscription from the list.
if (op == MESubscription.UNSUBSCRIBE)
subscriptionsTable.remove(
subscriptionKey(
subscription.getTopicSpaceUuid(),
subscription.getTopic()));
op = MESubscription.NOP;
}
// Perform an action depending on the required operation.
switch (op)
{
// For new subscriptions or modified subscriptions, send a proxy subscription
// message to all active neighbours.
case MESubscription.SUBSCRIBE :
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(
tc,
"Publishing new Subscription "
+ subscription + "," + sendProxy);
// Create the Proxy Message to be sent to all the Neighbours in this
// Bus
if (messageHandler == null)
{
messageHandler = iProxyHandler.getMessageHandler();
// Reset the message.
messageHandler.resetCreateSubscriptionMessage(subscription, isLocalBus);
}
else
{
// Add the subscription to the message
messageHandler.addSubscriptionToMessage(subscription, isLocalBus);
}
break;
case MESubscription.UNSUBSCRIBE :
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(
tc,
"Publishing Delete subscription "
+ subscription + "," + sendProxy);
// Create the Proxy Message to be sent to all the Neighbours in this
// Bus.
messageHandler = iProxyHandler.getMessageHandler();
// Reset the message.
messageHandler.resetDeleteSubscriptionMessage(subscription, isLocalBus);
// Remove the subscription from the table.
subscriptionsTable.remove(
subscriptionKey(
subscription.getTopicSpaceUuid(),
subscription.getTopic()));
// Send the message to the Neighbours
break;
// For other operations, do nothing.
default :
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(
tc,
"Doing nothing for subscription "
+ subscription + "," + sendProxy);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "doProxySubscribeOp", messageHandler);
return messageHandler;
} } | public class class_name {
private SubscriptionMessageHandler doProxySubscribeOp(
int op,
MESubscription subscription,
SubscriptionMessageHandler messageHandler,
Hashtable subscriptionsTable,
boolean sendProxy)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"doProxySubscribeOp",
new Object[] {
new Integer(op),
subscription,
messageHandler,
new Boolean(sendProxy)});
// If we don't want to send proxy messages, set the operation to be
// no operation.
if (!sendProxy)
{
// If we aren't to send the proxy and we have an unsubscribe, then we need
// to remove the subscription from the list.
if (op == MESubscription.UNSUBSCRIBE)
subscriptionsTable.remove(
subscriptionKey(
subscription.getTopicSpaceUuid(),
subscription.getTopic()));
op = MESubscription.NOP; // depends on control dependency: [if], data = [none]
}
// Perform an action depending on the required operation.
switch (op)
{
// For new subscriptions or modified subscriptions, send a proxy subscription
// message to all active neighbours.
case MESubscription.SUBSCRIBE :
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(
tc,
"Publishing new Subscription "
+ subscription + "," + sendProxy);
// Create the Proxy Message to be sent to all the Neighbours in this
// Bus
if (messageHandler == null)
{
messageHandler = iProxyHandler.getMessageHandler(); // depends on control dependency: [if], data = [none]
// Reset the message.
messageHandler.resetCreateSubscriptionMessage(subscription, isLocalBus); // depends on control dependency: [if], data = [none]
}
else
{
// Add the subscription to the message
messageHandler.addSubscriptionToMessage(subscription, isLocalBus); // depends on control dependency: [if], data = [none]
}
break;
case MESubscription.UNSUBSCRIBE :
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(
tc,
"Publishing Delete subscription "
+ subscription + "," + sendProxy);
// Create the Proxy Message to be sent to all the Neighbours in this
// Bus.
messageHandler = iProxyHandler.getMessageHandler();
// Reset the message.
messageHandler.resetDeleteSubscriptionMessage(subscription, isLocalBus);
// Remove the subscription from the table.
subscriptionsTable.remove(
subscriptionKey(
subscription.getTopicSpaceUuid(),
subscription.getTopic()));
// Send the message to the Neighbours
break;
// For other operations, do nothing.
default :
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(
tc,
"Doing nothing for subscription "
+ subscription + "," + sendProxy);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "doProxySubscribeOp", messageHandler);
return messageHandler;
} } |
public class class_name {
public static final String updateFilenameHashCode(EnterpriseBean enterpriseBean, String oldName)
{
String newName = null;
int len = oldName.length();
int last_ = (len > 9 && (oldName.charAt(len - 9) == '_')) ? len - 9 : -1;
// input file name must have a trailing "_" follows by 8 hex digits
// and check to make sure the last 8 characters are all hex digits
if (last_ != -1 && allHexDigits(oldName, ++last_, len))
{
String hashStr = getHashStr(enterpriseBean);
newName = oldName.substring(0, last_) + BuzzHash.computeHashStringMid32Bit(hashStr, true);
}
return newName;
} } | public class class_name {
public static final String updateFilenameHashCode(EnterpriseBean enterpriseBean, String oldName)
{
String newName = null;
int len = oldName.length();
int last_ = (len > 9 && (oldName.charAt(len - 9) == '_')) ? len - 9 : -1;
// input file name must have a trailing "_" follows by 8 hex digits
// and check to make sure the last 8 characters are all hex digits
if (last_ != -1 && allHexDigits(oldName, ++last_, len))
{
String hashStr = getHashStr(enterpriseBean);
newName = oldName.substring(0, last_) + BuzzHash.computeHashStringMid32Bit(hashStr, true); // depends on control dependency: [if], data = [none]
}
return newName;
} } |
public class class_name {
private void processCachedTimerDataSettings(BeanMetaData bmd) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "processCachedTimerDataSettings " + AllowCachedTimerDataFor);
}
//F001419: start
if (AllowCachedTimerDataFor != null) {
StringTokenizer st = new StringTokenizer(AllowCachedTimerDataFor, ":");
while (st.hasMoreTokens()) {
String token = st.nextToken();
int assignmentPivot = token.indexOf('=');
if (assignmentPivot > 0) { //case where we have 'j2eename=<integer>' or '*=<integer>'
String lh = token.substring(0, assignmentPivot).trim(); //get j2eename or '*'
if (lh.equals(bmd.j2eeName.toString()) || lh.equals("*")) { // d130438
String rh = token.substring(assignmentPivot + 1).trim();//get <integer>
try {
bmd.allowCachedTimerDataForMethods = Integer.parseInt(rh);
bmd._moduleMetaData.ivAllowsCachedTimerData = true;
break;
} catch (NumberFormatException e) {
FFDCFilter.processException(e, CLASS_NAME + ".processCachedTimerDataSettings", "3923", this);
}
}
} else { //token did not include an equals sign....case where we have just 'j2eename' or '*'. Apply all caching in this case.
if (token.equals(bmd.j2eeName.toString()) || token.equals("*")) { // d130438
bmd.allowCachedTimerDataForMethods = -1; // d642293
bmd._moduleMetaData.ivAllowsCachedTimerData = true;
break;
}
}
} // while loop
} // allowCachedTimerDataForSpec not null
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "processCachedTimerDataSettings " + bmd.allowCachedTimerDataForMethods);
}
} } | public class class_name {
private void processCachedTimerDataSettings(BeanMetaData bmd) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "processCachedTimerDataSettings " + AllowCachedTimerDataFor); // depends on control dependency: [if], data = [none]
}
//F001419: start
if (AllowCachedTimerDataFor != null) {
StringTokenizer st = new StringTokenizer(AllowCachedTimerDataFor, ":");
while (st.hasMoreTokens()) {
String token = st.nextToken();
int assignmentPivot = token.indexOf('=');
if (assignmentPivot > 0) { //case where we have 'j2eename=<integer>' or '*=<integer>'
String lh = token.substring(0, assignmentPivot).trim(); //get j2eename or '*'
if (lh.equals(bmd.j2eeName.toString()) || lh.equals("*")) { // d130438
String rh = token.substring(assignmentPivot + 1).trim();//get <integer>
try {
bmd.allowCachedTimerDataForMethods = Integer.parseInt(rh); // depends on control dependency: [try], data = [none]
bmd._moduleMetaData.ivAllowsCachedTimerData = true; // depends on control dependency: [try], data = [none]
break;
} catch (NumberFormatException e) {
FFDCFilter.processException(e, CLASS_NAME + ".processCachedTimerDataSettings", "3923", this);
} // depends on control dependency: [catch], data = [none]
}
} else { //token did not include an equals sign....case where we have just 'j2eename' or '*'. Apply all caching in this case.
if (token.equals(bmd.j2eeName.toString()) || token.equals("*")) { // d130438
bmd.allowCachedTimerDataForMethods = -1; // d642293 // depends on control dependency: [if], data = [none]
bmd._moduleMetaData.ivAllowsCachedTimerData = true; // depends on control dependency: [if], data = [none]
break;
}
}
} // while loop
} // allowCachedTimerDataForSpec not null
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "processCachedTimerDataSettings " + bmd.allowCachedTimerDataForMethods); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void unregisterNamespace(String prefix) throws NamespaceException, RepositoryException
{
unregisterNamespace(prefix, true);
if (started && rpcService != null)
{
try
{
rpcService.executeCommandOnAllNodes(unregisterNamespace, false, id, prefix);
}
catch (Exception e)
{
LOG.warn("Could not unregister the prefix '" + prefix + "' on other cluster nodes", e);
}
}
} } | public class class_name {
public void unregisterNamespace(String prefix) throws NamespaceException, RepositoryException
{
unregisterNamespace(prefix, true);
if (started && rpcService != null)
{
try
{
rpcService.executeCommandOnAllNodes(unregisterNamespace, false, id, prefix); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
LOG.warn("Could not unregister the prefix '" + prefix + "' on other cluster nodes", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void play(int position) {
checkState();
ArrayList<SoundCloudTrack> tracks = mPlayerPlaylist.getPlaylist().getTracks();
if (position >= 0 && position < tracks.size()) {
SoundCloudTrack trackToPlay = tracks.get(position);
mPlayerPlaylist.setPlayingTrack(position);
PlaybackService.play(getContext(), mClientKey, trackToPlay);
}
} } | public class class_name {
public void play(int position) {
checkState();
ArrayList<SoundCloudTrack> tracks = mPlayerPlaylist.getPlaylist().getTracks();
if (position >= 0 && position < tracks.size()) {
SoundCloudTrack trackToPlay = tracks.get(position);
mPlayerPlaylist.setPlayingTrack(position); // depends on control dependency: [if], data = [(position]
PlaybackService.play(getContext(), mClientKey, trackToPlay); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public SuggestIndexResponse index(final SuggestItem[] items) {
// TODO parallel?
final SuggestItem[] array = Stream.of(items).filter(item -> !item.isBadWord(badWords)).toArray(n -> new SuggestItem[n]);
try {
final long start = System.currentTimeMillis();
final SuggestWriterResult result = suggestWriter.write(client, settings, index, array, true);
return new SuggestIndexResponse(items.length, items.length, result.getFailures(), System.currentTimeMillis() - start);
} catch (Exception e) {
throw new SuggestIndexException("Failed to write items[" + items.length + "] to " + index, e);
}
} } | public class class_name {
public SuggestIndexResponse index(final SuggestItem[] items) {
// TODO parallel?
final SuggestItem[] array = Stream.of(items).filter(item -> !item.isBadWord(badWords)).toArray(n -> new SuggestItem[n]);
try {
final long start = System.currentTimeMillis();
final SuggestWriterResult result = suggestWriter.write(client, settings, index, array, true);
return new SuggestIndexResponse(items.length, items.length, result.getFailures(), System.currentTimeMillis() - start); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SuggestIndexException("Failed to write items[" + items.length + "] to " + index, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static void insertionSort(ModifiableDoubleDBIDList data, int start, int end, DoubleDBIDListIter iter1, DoubleDBIDListIter iter2) {
for(int i = start + 1; i < end; i++) {
for(int j = i; j > start; j--) {
if(iter1.seek(j - 1).doubleValue() < iter2.seek(j).doubleValue()) {
break;
}
data.swap(j, j - 1);
}
}
} } | public class class_name {
private static void insertionSort(ModifiableDoubleDBIDList data, int start, int end, DoubleDBIDListIter iter1, DoubleDBIDListIter iter2) {
for(int i = start + 1; i < end; i++) {
for(int j = i; j > start; j--) {
if(iter1.seek(j - 1).doubleValue() < iter2.seek(j).doubleValue()) {
break;
}
data.swap(j, j - 1); // depends on control dependency: [for], data = [j]
}
}
} } |
public class class_name {
public PullResult pullFromRepository(Git git, String remote, String remoteBranch) {
try {
return git.pull()
.setRemote(remote)
.setRemoteBranchName(remoteBranch)
.call();
} catch (GitAPIException e) {
throw new IllegalStateException(e);
}
} } | public class class_name {
public PullResult pullFromRepository(Git git, String remote, String remoteBranch) {
try {
return git.pull()
.setRemote(remote)
.setRemoteBranchName(remoteBranch)
.call(); // depends on control dependency: [try], data = [none]
} catch (GitAPIException e) {
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public PrimitiveVector subset(int start, int stop, int stride) {
BooleanPrimitiveVector n = new BooleanPrimitiveVector(getTemplate());
stride = Math.max(stride, 1);
stop = Math.max(start, stop);
int length = 1 + (stop - start) / stride;
n.setLength(length);
int count = 0;
for (int i = start; i <= stop; i += stride) {
n.setValue(count, vals[i]);
count++;
}
return n;
} } | public class class_name {
public PrimitiveVector subset(int start, int stop, int stride) {
BooleanPrimitiveVector n = new BooleanPrimitiveVector(getTemplate());
stride = Math.max(stride, 1);
stop = Math.max(start, stop);
int length = 1 + (stop - start) / stride;
n.setLength(length);
int count = 0;
for (int i = start; i <= stop; i += stride) {
n.setValue(count, vals[i]);
// depends on control dependency: [for], data = [i]
count++;
// depends on control dependency: [for], data = [none]
}
return n;
} } |
public class class_name {
private Collection parseCollection(Element collectionElement) {
Collection collection = new Collection();
collection.setId(collectionElement.getAttribute("id"));
collection.setServer(collectionElement.getAttribute("server"));
collection.setSecret(collectionElement.getAttribute("secret"));
collection.setChildCount(collectionElement.getAttribute("child_count"));
collection.setIconLarge(collectionElement.getAttribute("iconlarge"));
collection.setIconSmall(collectionElement.getAttribute("iconsmall"));
collection.setDateCreated(collectionElement.getAttribute("datecreate"));
collection.setTitle(XMLUtilities.getChildValue(collectionElement, "title"));
collection.setDescription(XMLUtilities.getChildValue(collectionElement, "description"));
Element iconPhotos = XMLUtilities.getChild(collectionElement, "iconphotos");
if (iconPhotos != null) {
NodeList photoElements = iconPhotos.getElementsByTagName("photo");
for (int i = 0; i < photoElements.getLength(); i++) {
Element photoElement = (Element) photoElements.item(i);
collection.addPhoto(PhotoUtils.createPhoto(photoElement));
}
}
return collection;
} } | public class class_name {
private Collection parseCollection(Element collectionElement) {
Collection collection = new Collection();
collection.setId(collectionElement.getAttribute("id"));
collection.setServer(collectionElement.getAttribute("server"));
collection.setSecret(collectionElement.getAttribute("secret"));
collection.setChildCount(collectionElement.getAttribute("child_count"));
collection.setIconLarge(collectionElement.getAttribute("iconlarge"));
collection.setIconSmall(collectionElement.getAttribute("iconsmall"));
collection.setDateCreated(collectionElement.getAttribute("datecreate"));
collection.setTitle(XMLUtilities.getChildValue(collectionElement, "title"));
collection.setDescription(XMLUtilities.getChildValue(collectionElement, "description"));
Element iconPhotos = XMLUtilities.getChild(collectionElement, "iconphotos");
if (iconPhotos != null) {
NodeList photoElements = iconPhotos.getElementsByTagName("photo");
for (int i = 0; i < photoElements.getLength(); i++) {
Element photoElement = (Element) photoElements.item(i);
collection.addPhoto(PhotoUtils.createPhoto(photoElement)); // depends on control dependency: [for], data = [none]
}
}
return collection;
} } |
public class class_name {
@FFDCIgnore(IOException.class)
public static Parameter applyAnnotations(Parameter parameter, Type type, List<Annotation> annotations, Components components, String[] classTypes, String[] methodTypes) {
final AnnotationsHelper helper = new AnnotationsHelper(annotations, type);
if (helper.isContext()) {
return null;
}
if (parameter == null) {
// consider it to be body param
parameter = new ParameterImpl();
}
// first handle schema
List<Annotation> reworkedAnnotations = new ArrayList<>(annotations);
Annotation paramSchemaOrArrayAnnotation = getParamSchemaAnnotation(annotations);
Schema schemaFromAnn = null;
if (paramSchemaOrArrayAnnotation != null) {
reworkedAnnotations.add(paramSchemaOrArrayAnnotation);
if (paramSchemaOrArrayAnnotation instanceof org.eclipse.microprofile.openapi.annotations.media.Schema) {
org.eclipse.microprofile.openapi.annotations.media.Schema schemaAnn = (org.eclipse.microprofile.openapi.annotations.media.Schema) paramSchemaOrArrayAnnotation;
schemaFromAnn = AnnotationsUtils.getSchema(schemaAnn, components).orElse(null);
}
}
ResolvedSchema resolvedSchema = ModelConverters.getInstance().resolveAnnotatedType(type, reworkedAnnotations, "");
if (resolvedSchema.schema != null) {
if (schemaFromAnn != null) {
if (schemaFromAnn.getAllOf() != null) {
resolvedSchema.schema.setAllOf(schemaFromAnn.getAllOf());
resolvedSchema.schema.setType(null);
}
if (schemaFromAnn.getAnyOf() != null) {
resolvedSchema.schema.setAnyOf(schemaFromAnn.getAnyOf());
resolvedSchema.schema.setType(null);
}
if (schemaFromAnn.getOneOf() != null) {
resolvedSchema.schema.setOneOf(schemaFromAnn.getOneOf());
resolvedSchema.schema.setType(null);
}
if (schemaFromAnn.getNot() != null) {
resolvedSchema.schema.setNot(schemaFromAnn.getNot());
resolvedSchema.schema.setType(null);
}
}
parameter.setSchema(resolvedSchema.schema);
}
resolvedSchema.referencedSchemas.forEach((key, schema) -> components.addSchema(key, schema));
for (Annotation annotation : annotations) {
if (annotation instanceof org.eclipse.microprofile.openapi.annotations.parameters.Parameter) {
org.eclipse.microprofile.openapi.annotations.parameters.Parameter p = (org.eclipse.microprofile.openapi.annotations.parameters.Parameter) annotation;
if (p.hidden()) {
return null;
}
if (StringUtils.isNotBlank(p.ref())) {
parameter.setRef(p.ref());
}
if (StringUtils.isNotBlank(p.description())) {
parameter.setDescription(p.description());
}
if (StringUtils.isNotBlank(p.name())) {
parameter.setName(p.name());
}
if (StringUtils.isNotBlank(p.in().toString())) {
((ParameterImpl) parameter).setIn(Parameter.In.valueOf(p.in().toString().toUpperCase()));
}
if (StringUtils.isNotBlank(p.example())) {
try {
parameter.setExample(Json.mapper().readTree(p.example()));
} catch (IOException e) {
parameter.setExample(p.example());
}
}
if (p.deprecated()) {
parameter.setDeprecated(p.deprecated());
}
if (p.required()) {
parameter.setRequired(p.required());
}
if (p.allowEmptyValue()) {
parameter.setAllowEmptyValue(p.allowEmptyValue());
}
if (p.allowReserved()) {
parameter.setAllowReserved(p.allowReserved());
}
Map<String, Example> exampleMap = new HashMap<>();
for (ExampleObject exampleObject : p.examples()) {
AnnotationsUtils.getExample(exampleObject).ifPresent(example -> exampleMap.put(AnnotationsUtils.getNameOfReferenceableItem(exampleObject), example));
}
if (exampleMap.size() > 0) {
parameter.setExamples(exampleMap);
}
Optional<Content> content = AnnotationsUtils.getContent(p.content(), classTypes, methodTypes, parameter.getSchema());
if (content.isPresent()) {
parameter.setContent(content.get());
parameter.setSchema(null);
}
setParameterStyle(parameter, p);
setParameterExplode(parameter, p);
} else if (annotation.annotationType().getName().equals("javax.ws.rs.PathParam")) {
try {
String name = (String) annotation.annotationType().getMethod("value").invoke(annotation);
if (StringUtils.isNotBlank(name)) {
parameter.setName(name);
}
} catch (Exception e) {
}
} else if (annotation.annotationType().getName().equals("javax.validation.constraints.Size")) {
try {
if (parameter.getSchema() == null) {
parameter.setSchema(new SchemaImpl().type(SchemaType.ARRAY));
}
if (parameter.getSchema().getType() == SchemaType.ARRAY) {
Integer min = (Integer) annotation.annotationType().getMethod("min").invoke(annotation);
if (min != null) {
parameter.getSchema().setMinItems(min);
}
Integer max = (Integer) annotation.annotationType().getMethod("max").invoke(annotation);
if (max != null) {
parameter.getSchema().setMaxItems(max);
}
}
} catch (Exception e) {
//LOGGER.error("failed on " + annotation.annotationType().getName(), e);
}
}
}
final String defaultValue = helper.getDefaultValue();
Schema paramSchema = parameter.getSchema();
if (paramSchema == null) {
if (parameter.getContent() != null && parameter.getContent().values().size() > 0) {
paramSchema = parameter.getContent().values().iterator().next().getSchema();
}
}
if (paramSchema != null) {
if (paramSchema.getType() == SchemaType.ARRAY) {
if (defaultValue != null) {
paramSchema.getItems().setDefaultValue(defaultValue);
}
} else {
if (defaultValue != null) {
paramSchema.setDefaultValue(defaultValue);
}
}
}
return parameter;
} } | public class class_name {
@FFDCIgnore(IOException.class)
public static Parameter applyAnnotations(Parameter parameter, Type type, List<Annotation> annotations, Components components, String[] classTypes, String[] methodTypes) {
final AnnotationsHelper helper = new AnnotationsHelper(annotations, type);
if (helper.isContext()) {
return null; // depends on control dependency: [if], data = [none]
}
if (parameter == null) {
// consider it to be body param
parameter = new ParameterImpl(); // depends on control dependency: [if], data = [none]
}
// first handle schema
List<Annotation> reworkedAnnotations = new ArrayList<>(annotations);
Annotation paramSchemaOrArrayAnnotation = getParamSchemaAnnotation(annotations);
Schema schemaFromAnn = null;
if (paramSchemaOrArrayAnnotation != null) {
reworkedAnnotations.add(paramSchemaOrArrayAnnotation); // depends on control dependency: [if], data = [(paramSchemaOrArrayAnnotation]
if (paramSchemaOrArrayAnnotation instanceof org.eclipse.microprofile.openapi.annotations.media.Schema) {
org.eclipse.microprofile.openapi.annotations.media.Schema schemaAnn = (org.eclipse.microprofile.openapi.annotations.media.Schema) paramSchemaOrArrayAnnotation;
schemaFromAnn = AnnotationsUtils.getSchema(schemaAnn, components).orElse(null); // depends on control dependency: [if], data = [none]
}
}
ResolvedSchema resolvedSchema = ModelConverters.getInstance().resolveAnnotatedType(type, reworkedAnnotations, "");
if (resolvedSchema.schema != null) {
if (schemaFromAnn != null) {
if (schemaFromAnn.getAllOf() != null) {
resolvedSchema.schema.setAllOf(schemaFromAnn.getAllOf()); // depends on control dependency: [if], data = [(schemaFromAnn.getAllOf()]
resolvedSchema.schema.setType(null); // depends on control dependency: [if], data = [null)]
}
if (schemaFromAnn.getAnyOf() != null) {
resolvedSchema.schema.setAnyOf(schemaFromAnn.getAnyOf()); // depends on control dependency: [if], data = [(schemaFromAnn.getAnyOf()]
resolvedSchema.schema.setType(null); // depends on control dependency: [if], data = [null)]
}
if (schemaFromAnn.getOneOf() != null) {
resolvedSchema.schema.setOneOf(schemaFromAnn.getOneOf()); // depends on control dependency: [if], data = [(schemaFromAnn.getOneOf()]
resolvedSchema.schema.setType(null); // depends on control dependency: [if], data = [null)]
}
if (schemaFromAnn.getNot() != null) {
resolvedSchema.schema.setNot(schemaFromAnn.getNot()); // depends on control dependency: [if], data = [(schemaFromAnn.getNot()]
resolvedSchema.schema.setType(null); // depends on control dependency: [if], data = [null)]
}
}
parameter.setSchema(resolvedSchema.schema); // depends on control dependency: [if], data = [(resolvedSchema.schema]
}
resolvedSchema.referencedSchemas.forEach((key, schema) -> components.addSchema(key, schema));
for (Annotation annotation : annotations) {
if (annotation instanceof org.eclipse.microprofile.openapi.annotations.parameters.Parameter) {
org.eclipse.microprofile.openapi.annotations.parameters.Parameter p = (org.eclipse.microprofile.openapi.annotations.parameters.Parameter) annotation;
if (p.hidden()) {
return null; // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotBlank(p.ref())) {
parameter.setRef(p.ref()); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotBlank(p.description())) {
parameter.setDescription(p.description()); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotBlank(p.name())) {
parameter.setName(p.name()); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotBlank(p.in().toString())) {
((ParameterImpl) parameter).setIn(Parameter.In.valueOf(p.in().toString().toUpperCase())); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotBlank(p.example())) {
try {
parameter.setExample(Json.mapper().readTree(p.example())); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
parameter.setExample(p.example());
} // depends on control dependency: [catch], data = [none]
}
if (p.deprecated()) {
parameter.setDeprecated(p.deprecated()); // depends on control dependency: [if], data = [(p.deprecated())]
}
if (p.required()) {
parameter.setRequired(p.required()); // depends on control dependency: [if], data = [(p.required())]
}
if (p.allowEmptyValue()) {
parameter.setAllowEmptyValue(p.allowEmptyValue()); // depends on control dependency: [if], data = [(p.allowEmptyValue())]
}
if (p.allowReserved()) {
parameter.setAllowReserved(p.allowReserved()); // depends on control dependency: [if], data = [(p.allowReserved())]
}
Map<String, Example> exampleMap = new HashMap<>();
for (ExampleObject exampleObject : p.examples()) {
AnnotationsUtils.getExample(exampleObject).ifPresent(example -> exampleMap.put(AnnotationsUtils.getNameOfReferenceableItem(exampleObject), example)); // depends on control dependency: [for], data = [exampleObject]
}
if (exampleMap.size() > 0) {
parameter.setExamples(exampleMap); // depends on control dependency: [if], data = [none]
}
Optional<Content> content = AnnotationsUtils.getContent(p.content(), classTypes, methodTypes, parameter.getSchema());
if (content.isPresent()) {
parameter.setContent(content.get()); // depends on control dependency: [if], data = [none]
parameter.setSchema(null); // depends on control dependency: [if], data = [none]
}
setParameterStyle(parameter, p); // depends on control dependency: [if], data = [none]
setParameterExplode(parameter, p); // depends on control dependency: [if], data = [none]
} else if (annotation.annotationType().getName().equals("javax.ws.rs.PathParam")) {
try {
String name = (String) annotation.annotationType().getMethod("value").invoke(annotation);
if (StringUtils.isNotBlank(name)) {
parameter.setName(name); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
} else if (annotation.annotationType().getName().equals("javax.validation.constraints.Size")) {
try {
if (parameter.getSchema() == null) {
parameter.setSchema(new SchemaImpl().type(SchemaType.ARRAY));
}
if (parameter.getSchema().getType() == SchemaType.ARRAY) {
Integer min = (Integer) annotation.annotationType().getMethod("min").invoke(annotation);
if (min != null) {
parameter.getSchema().setMinItems(min);
}
Integer max = (Integer) annotation.annotationType().getMethod("max").invoke(annotation);
if (max != null) {
parameter.getSchema().setMaxItems(max);
}
}
} catch (Exception e) {
//LOGGER.error("failed on " + annotation.annotationType().getName(), e);
}
}
}
final String defaultValue = helper.getDefaultValue();
Schema paramSchema = parameter.getSchema();
if (paramSchema == null) {
if (parameter.getContent() != null && parameter.getContent().values().size() > 0) {
paramSchema = parameter.getContent().values().iterator().next().getSchema();
}
}
if (paramSchema != null) {
if (paramSchema.getType() == SchemaType.ARRAY) {
if (defaultValue != null) {
paramSchema.getItems().setDefaultValue(defaultValue);
}
} else {
if (defaultValue != null) {
paramSchema.setDefaultValue(defaultValue);
}
}
}
return parameter;
} } |
public class class_name {
public static int preg_match(Pattern pattern, String subject) {
int matches=0;
Matcher m = pattern.matcher(subject);
while(m.find()){
++matches;
}
return matches;
} } | public class class_name {
public static int preg_match(Pattern pattern, String subject) {
int matches=0;
Matcher m = pattern.matcher(subject);
while(m.find()){
++matches; // depends on control dependency: [while], data = [none]
}
return matches;
} } |
public class class_name {
protected void setState(int newState) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setState", newState);
synchronized (stateLock) {
if ((newState == JmsInternalConstants.CLOSED)
|| (newState == JmsInternalConstants.STOPPED)
|| (newState == JmsInternalConstants.STARTED)) {
state = newState;
stateLock.notifyAll();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setState");
} } | public class class_name {
protected void setState(int newState) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setState", newState);
synchronized (stateLock) {
if ((newState == JmsInternalConstants.CLOSED)
|| (newState == JmsInternalConstants.STOPPED)
|| (newState == JmsInternalConstants.STARTED)) {
state = newState; // depends on control dependency: [if], data = [none]
stateLock.notifyAll(); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setState");
} } |
public class class_name {
public String getXmlStart(Language lang, Language motherTongue) {
StringBuilder xml = new StringBuilder(CAPACITY);
xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
.append("<!-- THIS OUTPUT IS DEPRECATED, PLEASE SEE http://wiki.languagetool.org/http-server FOR A BETTER APPROACH -->\n")
.append("<matches software=\"LanguageTool\" version=\"" + JLanguageTool.VERSION + "\"" + " buildDate=\"")
.append(JLanguageTool.BUILD_DATE).append("\">\n");
if (lang != null || motherTongue != null) {
String languageXml = "<language ";
String warning = "";
if (lang != null) {
languageXml += "shortname=\"" + lang.getShortCodeWithCountryAndVariant() + "\" name=\"" + lang.getName() + "\"";
String longCode = lang.getShortCodeWithCountryAndVariant();
if ("en".equals(longCode) || "de".equals(longCode)) {
xml.append("<!-- NOTE: The language code you selected ('").append(longCode).append("') doesn't support spell checking. Consider using a code with a variant like 'en-US'. -->\n");
}
}
if (motherTongue != null && (lang == null || !motherTongue.getShortCode().equals(lang.getShortCodeWithCountryAndVariant()))) {
languageXml += " mothertongueshortname=\"" + motherTongue.getShortCode() + "\" mothertonguename=\"" + motherTongue.getName() + "\"";
}
languageXml += "/>\n";
xml.append(languageXml);
xml.append(warning);
}
return xml.toString();
} } | public class class_name {
public String getXmlStart(Language lang, Language motherTongue) {
StringBuilder xml = new StringBuilder(CAPACITY);
xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
.append("<!-- THIS OUTPUT IS DEPRECATED, PLEASE SEE http://wiki.languagetool.org/http-server FOR A BETTER APPROACH -->\n")
.append("<matches software=\"LanguageTool\" version=\"" + JLanguageTool.VERSION + "\"" + " buildDate=\"")
.append(JLanguageTool.BUILD_DATE).append("\">\n");
if (lang != null || motherTongue != null) {
String languageXml = "<language ";
String warning = "";
if (lang != null) {
languageXml += "shortname=\"" + lang.getShortCodeWithCountryAndVariant() + "\" name=\"" + lang.getName() + "\""; // depends on control dependency: [if], data = [none]
String longCode = lang.getShortCodeWithCountryAndVariant();
if ("en".equals(longCode) || "de".equals(longCode)) {
xml.append("<!-- NOTE: The language code you selected ('").append(longCode).append("') doesn't support spell checking. Consider using a code with a variant like 'en-US'. -->\n");
}
}
if (motherTongue != null && (lang == null || !motherTongue.getShortCode().equals(lang.getShortCodeWithCountryAndVariant()))) {
languageXml += " mothertongueshortname=\"" + motherTongue.getShortCode() + "\" mothertonguename=\"" + motherTongue.getName() + "\""; // depends on control dependency: [if], data = [none]
}
languageXml += "/>\n"; // depends on control dependency: [if], data = [none]
xml.append(languageXml); // depends on control dependency: [if], data = [(lang]
xml.append(warning); // depends on control dependency: [if], data = [none]
}
return xml.toString();
} } |
public class class_name {
public static void expInPlace(double[] a) {
for (int i = 0; i < a.length; i++) {
a[i] = Math.exp(a[i]);
}
} } | public class class_name {
public static void expInPlace(double[] a) {
for (int i = 0; i < a.length; i++) {
a[i] = Math.exp(a[i]);
// depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private static char readStringChar(DataInputView source) throws IOException {
int c = source.readByte() & 0xFF;
if (c >= HIGH_BIT) {
int shift = 7;
int curr;
c = c & 0x7F;
while ((curr = source.readByte() & 0xFF) >= HIGH_BIT) {
c |= (curr & 0x7F) << shift;
shift += 7;
}
c |= curr << shift;
}
return (char) c;
} } | public class class_name {
private static char readStringChar(DataInputView source) throws IOException {
int c = source.readByte() & 0xFF;
if (c >= HIGH_BIT) {
int shift = 7;
int curr;
c = c & 0x7F;
while ((curr = source.readByte() & 0xFF) >= HIGH_BIT) {
c |= (curr & 0x7F) << shift; // depends on control dependency: [while], data = [none]
shift += 7; // depends on control dependency: [while], data = [none]
}
c |= curr << shift;
}
return (char) c;
} } |
public class class_name {
@Override
public void encode(ChannelHandlerContext ctx, Message in, List<Object> out) throws Exception {
Object body = null;
long bodyLength = 0;
boolean isBodyInFrame = false;
// If the message has a body, take it out to enable zero-copy transfer for the payload.
if (in.body() != null) {
try {
bodyLength = in.body().size();
body = in.body().convertToNetty();
isBodyInFrame = in.isBodyInFrame();
} catch (Exception e) {
in.body().release();
if (in instanceof AbstractResponseMessage) {
AbstractResponseMessage resp = (AbstractResponseMessage) in;
// Re-encode this message as a failure response.
String error = e.getMessage() != null ? e.getMessage() : "null";
logger.error(String.format("Error processing %s for client %s",
in, ctx.channel().remoteAddress()), e);
encode(ctx, resp.createFailureResponse(error), out);
} else {
throw e;
}
return;
}
}
Message.Type msgType = in.type();
// All messages have the frame length, message type, and message itself. The frame length
// may optionally include the length of the body data, depending on what message is being
// sent.
int headerLength = 8 + msgType.encodedLength() + in.encodedLength();
long frameLength = headerLength + (isBodyInFrame ? bodyLength : 0);
ByteBuf header = ctx.alloc().buffer(headerLength);
header.writeLong(frameLength);
msgType.encode(header);
in.encode(header);
assert header.writableBytes() == 0;
if (body != null) {
// We transfer ownership of the reference on in.body() to MessageWithHeader.
// This reference will be freed when MessageWithHeader.deallocate() is called.
out.add(new MessageWithHeader(in.body(), header, body, bodyLength));
} else {
out.add(header);
}
} } | public class class_name {
@Override
public void encode(ChannelHandlerContext ctx, Message in, List<Object> out) throws Exception {
Object body = null;
long bodyLength = 0;
boolean isBodyInFrame = false;
// If the message has a body, take it out to enable zero-copy transfer for the payload.
if (in.body() != null) {
try {
bodyLength = in.body().size();
body = in.body().convertToNetty();
isBodyInFrame = in.isBodyInFrame();
} catch (Exception e) {
in.body().release();
if (in instanceof AbstractResponseMessage) {
AbstractResponseMessage resp = (AbstractResponseMessage) in;
// Re-encode this message as a failure response.
String error = e.getMessage() != null ? e.getMessage() : "null";
logger.error(String.format("Error processing %s for client %s",
in, ctx.channel().remoteAddress()), e); // depends on control dependency: [if], data = [none]
encode(ctx, resp.createFailureResponse(error), out); // depends on control dependency: [if], data = [none]
} else {
throw e;
}
return;
}
}
Message.Type msgType = in.type();
// All messages have the frame length, message type, and message itself. The frame length
// may optionally include the length of the body data, depending on what message is being
// sent.
int headerLength = 8 + msgType.encodedLength() + in.encodedLength();
long frameLength = headerLength + (isBodyInFrame ? bodyLength : 0);
ByteBuf header = ctx.alloc().buffer(headerLength);
header.writeLong(frameLength);
msgType.encode(header);
in.encode(header);
assert header.writableBytes() == 0;
if (body != null) {
// We transfer ownership of the reference on in.body() to MessageWithHeader.
// This reference will be freed when MessageWithHeader.deallocate() is called.
out.add(new MessageWithHeader(in.body(), header, body, bodyLength));
} else {
out.add(header);
}
} } |
public class class_name {
private String getBaseUrl(String pUrl, String pServletPath) {
String sUrl;
try {
URL url = new URL(pUrl);
String host = getIpIfPossible(url.getHost());
sUrl = new URL(url.getProtocol(),host,url.getPort(),pServletPath).toExternalForm();
} catch (MalformedURLException exp) {
sUrl = plainReplacement(pUrl, pServletPath);
}
return sUrl;
} } | public class class_name {
private String getBaseUrl(String pUrl, String pServletPath) {
String sUrl;
try {
URL url = new URL(pUrl);
String host = getIpIfPossible(url.getHost());
sUrl = new URL(url.getProtocol(),host,url.getPort(),pServletPath).toExternalForm(); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException exp) {
sUrl = plainReplacement(pUrl, pServletPath);
} // depends on control dependency: [catch], data = [none]
return sUrl;
} } |
public class class_name {
private Optional<String[]> parseProxy(String url, String defPort) {
if (!Strings.isNullOrEmpty(url)) {
String[] result = new String[2];
int p = url.indexOf("://");
if (p != -1)
url = url.substring(p + 3);
if ((p = url.indexOf('@')) != -1)
url = url.substring(p + 1);
if ((p = url.indexOf(':')) != -1) {
result[0] = url.substring(0, p);
result[1] = url.substring(p + 1);
} else {
result[0] = url;
result[1] = defPort;
}
// remove trailing slash from the host name
p = result[0].indexOf('/');
if (p != -1) {
result[0] = result[0].substring(0, p);
}
// remove trailing slash from the port number
p = result[1].indexOf('/');
if (p != -1) {
result[1] = result[1].substring(0, p);
}
return Optional.of(result);
}
return Optional.empty();
} } | public class class_name {
private Optional<String[]> parseProxy(String url, String defPort) {
if (!Strings.isNullOrEmpty(url)) {
String[] result = new String[2];
int p = url.indexOf("://");
if (p != -1)
url = url.substring(p + 3);
if ((p = url.indexOf('@')) != -1)
url = url.substring(p + 1);
if ((p = url.indexOf(':')) != -1) {
result[0] = url.substring(0, p); // depends on control dependency: [if], data = [none]
result[1] = url.substring(p + 1); // depends on control dependency: [if], data = [none]
} else {
result[0] = url; // depends on control dependency: [if], data = [none]
result[1] = defPort; // depends on control dependency: [if], data = [none]
}
// remove trailing slash from the host name
p = result[0].indexOf('/'); // depends on control dependency: [if], data = [none]
if (p != -1) {
result[0] = result[0].substring(0, p); // depends on control dependency: [if], data = [none]
}
// remove trailing slash from the port number
p = result[1].indexOf('/'); // depends on control dependency: [if], data = [none]
if (p != -1) {
result[1] = result[1].substring(0, p); // depends on control dependency: [if], data = [none]
}
return Optional.of(result); // depends on control dependency: [if], data = [none]
}
return Optional.empty();
} } |
public class class_name {
protected void updateStoryInformation(FeatureCollector collector) {
long storyDataStart = System.currentTimeMillis();
AtomicLong count = new AtomicLong();
if (Objects.equals(collector.getMode(), JiraMode.Team)) {
List<Scope> projects = new ArrayList<>(getScopeList(collector.getId()));
projects.forEach(project -> {
LOGGER.info("Collecting " + count.incrementAndGet() + " of " + projects.size() + " projects.");
long lastCollection = System.currentTimeMillis();
FeatureEpicResult featureEpicResult = jiraClient.getIssues(project);
List<Feature> features = featureEpicResult.getFeatureList();
saveFeatures(features, collector);
updateFeaturesWithLatestEpics(featureEpicResult.getEpicList(), collector);
log("Story Data Collected since " + LocalDateTime.ofInstant(Instant.ofEpochMilli(project.getLastCollected()), ZoneId.systemDefault()), storyDataStart, features.size());
project.setLastCollected(lastCollection); //set it after everything is successfully done
projectRepository.save(project);
});
} else {
List<Team> boards = getBoardList(collector.getId());
boards.forEach(board -> {
LOGGER.info("Collecting " + count.incrementAndGet() + " of " + boards.size() + " boards.");
long lastCollection = System.currentTimeMillis();
FeatureEpicResult featureEpicResult = jiraClient.getIssues(board);
List<Feature> features = featureEpicResult.getFeatureList();
saveFeatures(features, collector);
updateFeaturesWithLatestEpics(featureEpicResult.getEpicList(), collector);
log("Story Data Collected since " + LocalDateTime.ofInstant(Instant.ofEpochMilli(board.getLastCollected()), ZoneId.systemDefault()), storyDataStart, features.size());
board.setLastCollected(lastCollection); //set it after everything is successfully done
teamRepository.save(board);
FeatureBoard featureBoard = featureBoardRepository.findFeatureBoard(collector.getId(), board.getTeamId());
if(featureBoard != null){
featureBoard.setLastUpdated(System.currentTimeMillis());
featureBoardRepository.save(featureBoard);
}
});
}
} } | public class class_name {
protected void updateStoryInformation(FeatureCollector collector) {
long storyDataStart = System.currentTimeMillis();
AtomicLong count = new AtomicLong();
if (Objects.equals(collector.getMode(), JiraMode.Team)) {
List<Scope> projects = new ArrayList<>(getScopeList(collector.getId()));
projects.forEach(project -> {
LOGGER.info("Collecting " + count.incrementAndGet() + " of " + projects.size() + " projects.");
long lastCollection = System.currentTimeMillis();
FeatureEpicResult featureEpicResult = jiraClient.getIssues(project);
List<Feature> features = featureEpicResult.getFeatureList();
saveFeatures(features, collector);
updateFeaturesWithLatestEpics(featureEpicResult.getEpicList(), collector);
log("Story Data Collected since " + LocalDateTime.ofInstant(Instant.ofEpochMilli(project.getLastCollected()), ZoneId.systemDefault()), storyDataStart, features.size());
project.setLastCollected(lastCollection); //set it after everything is successfully done
projectRepository.save(project);
}); // depends on control dependency: [if], data = [none]
} else {
List<Team> boards = getBoardList(collector.getId());
boards.forEach(board -> {
LOGGER.info("Collecting " + count.incrementAndGet() + " of " + boards.size() + " boards.");
long lastCollection = System.currentTimeMillis();
FeatureEpicResult featureEpicResult = jiraClient.getIssues(board);
List<Feature> features = featureEpicResult.getFeatureList();
saveFeatures(features, collector);
updateFeaturesWithLatestEpics(featureEpicResult.getEpicList(), collector);
log("Story Data Collected since " + LocalDateTime.ofInstant(Instant.ofEpochMilli(board.getLastCollected()), ZoneId.systemDefault()), storyDataStart, features.size());
board.setLastCollected(lastCollection); //set it after everything is successfully done
teamRepository.save(board);
FeatureBoard featureBoard = featureBoardRepository.findFeatureBoard(collector.getId(), board.getTeamId());
if(featureBoard != null){
featureBoard.setLastUpdated(System.currentTimeMillis());
featureBoardRepository.save(featureBoard);
}
}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private W3CEndpointReference buildEndpoint(QName serviceName, String adress) {
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
// builder.serviceName(serviceName);
builder.address(adress);
SLEndpoint endpoint = null;
try {
endpoint = locatorClient.getEndpoint(serviceName, adress);
} catch (ServiceLocatorException e) {
throw new WebApplicationException(Response
.status(Status.INTERNAL_SERVER_ERROR)
.entity(e.getMessage()).build());
} catch (InterruptedException e) {
throw new WebApplicationException(Response
.status(Status.INTERNAL_SERVER_ERROR)
.entity(e.getMessage()).build());
}
if (endpoint != null) {
SLProperties properties = endpoint.getProperties();
if (properties != null && !properties.getPropertyNames().isEmpty()) {
EndpointTransformerImpl transformer = new EndpointTransformerImpl();
DOMResult result = new DOMResult();
transformer.writePropertiesTo(properties, result);
Document docResult = (Document) result.getNode();
builder.metadata(docResult.getDocumentElement());
}
}
return builder.build();
} } | public class class_name {
private W3CEndpointReference buildEndpoint(QName serviceName, String adress) {
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
// builder.serviceName(serviceName);
builder.address(adress);
SLEndpoint endpoint = null;
try {
endpoint = locatorClient.getEndpoint(serviceName, adress); // depends on control dependency: [try], data = [none]
} catch (ServiceLocatorException e) {
throw new WebApplicationException(Response
.status(Status.INTERNAL_SERVER_ERROR)
.entity(e.getMessage()).build());
} catch (InterruptedException e) { // depends on control dependency: [catch], data = [none]
throw new WebApplicationException(Response
.status(Status.INTERNAL_SERVER_ERROR)
.entity(e.getMessage()).build());
} // depends on control dependency: [catch], data = [none]
if (endpoint != null) {
SLProperties properties = endpoint.getProperties();
if (properties != null && !properties.getPropertyNames().isEmpty()) {
EndpointTransformerImpl transformer = new EndpointTransformerImpl();
DOMResult result = new DOMResult();
transformer.writePropertiesTo(properties, result); // depends on control dependency: [if], data = [(properties]
Document docResult = (Document) result.getNode();
builder.metadata(docResult.getDocumentElement()); // depends on control dependency: [if], data = [none]
}
}
return builder.build();
} } |
public class class_name {
@Override
public void parse(final String... parameters) {
// Manage red composite
if (parameters.length >= 1) {
redProperty().set(Double.parseDouble(parameters[0]));
}
// Manage green composite
if (parameters.length >= 2) {
greenProperty().set(Double.parseDouble(parameters[1]));
}
// Manage blue composite
if (parameters.length >= 3) {
blueProperty().set(Double.parseDouble(parameters[2]));
}
// Manage opacity
if (parameters.length >= 4) {
opacityProperty().set(Double.parseDouble(parameters[3]));
}
} } | public class class_name {
@Override
public void parse(final String... parameters) {
// Manage red composite
if (parameters.length >= 1) {
redProperty().set(Double.parseDouble(parameters[0]));
// depends on control dependency: [if], data = [none]
}
// Manage green composite
if (parameters.length >= 2) {
greenProperty().set(Double.parseDouble(parameters[1]));
// depends on control dependency: [if], data = [none]
}
// Manage blue composite
if (parameters.length >= 3) {
blueProperty().set(Double.parseDouble(parameters[2]));
// depends on control dependency: [if], data = [none]
}
// Manage opacity
if (parameters.length >= 4) {
opacityProperty().set(Double.parseDouble(parameters[3]));
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setAnd(java.util.Collection<Expression> and) {
if (and == null) {
this.and = null;
return;
}
this.and = new java.util.ArrayList<Expression>(and);
} } | public class class_name {
public void setAnd(java.util.Collection<Expression> and) {
if (and == null) {
this.and = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.and = new java.util.ArrayList<Expression>(and);
} } |
public class class_name {
public static void encodeAscii(byte[] array, int pos, String string) {
for (int i = 0; i < string.length(); i++) {
array[pos++] = (byte) string.charAt(i);
}
} } | public class class_name {
public static void encodeAscii(byte[] array, int pos, String string) {
for (int i = 0; i < string.length(); i++) {
array[pos++] = (byte) string.charAt(i); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public boolean isPatterned() {
final boolean result;
if (pattern.indexOf('*') != -1 || pattern.indexOf('?') != -1) {
result = true;
} else {
result = false;
}
return result;
} } | public class class_name {
public boolean isPatterned() {
final boolean result;
if (pattern.indexOf('*') != -1 || pattern.indexOf('?') != -1) {
result = true;
// depends on control dependency: [if], data = [none]
} else {
result = false;
// depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
private void flush() {
try {
if (this.isSkipBlankRow && this.isBlankLastRow) {
//若不需要写入空行,且上一行为空行的话则保留上一行不被刷入缓存
((SXSSFSheet) this.currentSheet).flushRows(1);
} else {
((SXSSFSheet) this.currentSheet).flushRows();
}
} catch (Exception e) {
throw new WriteExcelRuntimeException("Flush Error");
}
} } | public class class_name {
private void flush() {
try {
if (this.isSkipBlankRow && this.isBlankLastRow) {
//若不需要写入空行,且上一行为空行的话则保留上一行不被刷入缓存
((SXSSFSheet) this.currentSheet).flushRows(1); // depends on control dependency: [if], data = [none]
} else {
((SXSSFSheet) this.currentSheet).flushRows(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
throw new WriteExcelRuntimeException("Flush Error");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void applyWhere(final INDArray to, final Condition condition, final Function<Number, Number> function,
final Function<Number, Number> alternativeFunction) {
Shape.iterate(to, new CoordinateFunction() {
@Override
public void process(long[]... coord) {
if (condition.apply(to.getDouble(coord[0]))) {
to.putScalar(coord[0], function.apply(to.getDouble(coord[0])).doubleValue());
} else {
to.putScalar(coord[0], alternativeFunction.apply(to.getDouble(coord[0])).doubleValue());
}
}
});
} } | public class class_name {
public static void applyWhere(final INDArray to, final Condition condition, final Function<Number, Number> function,
final Function<Number, Number> alternativeFunction) {
Shape.iterate(to, new CoordinateFunction() {
@Override
public void process(long[]... coord) {
if (condition.apply(to.getDouble(coord[0]))) {
to.putScalar(coord[0], function.apply(to.getDouble(coord[0])).doubleValue()); // depends on control dependency: [if], data = [none]
} else {
to.putScalar(coord[0], alternativeFunction.apply(to.getDouble(coord[0])).doubleValue()); // depends on control dependency: [if], data = [none]
}
}
});
} } |
public class class_name {
public static void starthHomeActivity(@Nullable Activity activity) {
if (activity != null) {
if (activity.getClass() != AbstractApplication.get().getHomeActivityClass()) {
Intent intent = new Intent(activity, AbstractApplication.get().getHomeActivityClass());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activity.startActivity(intent);
}
} else {
LOGGER.warn("Null activity. Ignoring launch of " + AbstractApplication.get().getHomeActivityClass().getSimpleName());
}
} } | public class class_name {
public static void starthHomeActivity(@Nullable Activity activity) {
if (activity != null) {
if (activity.getClass() != AbstractApplication.get().getHomeActivityClass()) {
Intent intent = new Intent(activity, AbstractApplication.get().getHomeActivityClass());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // depends on control dependency: [if], data = [none]
activity.startActivity(intent); // depends on control dependency: [if], data = [none]
}
} else {
LOGGER.warn("Null activity. Ignoring launch of " + AbstractApplication.get().getHomeActivityClass().getSimpleName()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void updateLastIndexed() {
TableIndex tableIndex = new TableIndex();
tableIndex.setTableName(tableName);
tableIndex.setLastIndexed(new Date());
try {
tableIndexDao.createOrUpdate(tableIndex);
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to update last indexed date. GeoPackage: "
+ geoPackage.getName() + ", Table Name: "
+ tableName, e);
}
} } | public class class_name {
protected void updateLastIndexed() {
TableIndex tableIndex = new TableIndex();
tableIndex.setTableName(tableName);
tableIndex.setLastIndexed(new Date());
try {
tableIndexDao.createOrUpdate(tableIndex); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to update last indexed date. GeoPackage: "
+ geoPackage.getName() + ", Table Name: "
+ tableName, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void match(Pipe pipe)
{
int idx = pipes.indexOf(pipe);
// If pipe is already matching do nothing.
if (idx < matching) {
return;
}
// If the pipe isn't eligible, ignore it.
if (idx >= eligible) {
return;
}
// Mark the pipe as matching.
Collections.swap(pipes, idx, matching);
matching++;
} } | public class class_name {
public void match(Pipe pipe)
{
int idx = pipes.indexOf(pipe);
// If pipe is already matching do nothing.
if (idx < matching) {
return; // depends on control dependency: [if], data = [none]
}
// If the pipe isn't eligible, ignore it.
if (idx >= eligible) {
return; // depends on control dependency: [if], data = [none]
}
// Mark the pipe as matching.
Collections.swap(pipes, idx, matching);
matching++;
} } |
public class class_name {
private ImmutableMap<Predicate,ImmutableList<TermType>> extractCastTypeMap(
Multimap<Predicate, CQIE> ruleIndex, List<Predicate> predicatesInBottomUp,
ImmutableMap<CQIE, ImmutableList<Optional<TermType>>> termTypeMap, DBMetadata metadata) {
// Append-only
Map<Predicate,ImmutableList<TermType>> mutableCastMap = Maps.newHashMap();
for (Predicate predicate : predicatesInBottomUp) {
ImmutableList<TermType> castTypes = inferCastTypes(predicate, ruleIndex.get(predicate), termTypeMap,
mutableCastMap,metadata);
mutableCastMap.put(predicate, castTypes);
}
return ImmutableMap.copyOf(mutableCastMap);
} } | public class class_name {
private ImmutableMap<Predicate,ImmutableList<TermType>> extractCastTypeMap(
Multimap<Predicate, CQIE> ruleIndex, List<Predicate> predicatesInBottomUp,
ImmutableMap<CQIE, ImmutableList<Optional<TermType>>> termTypeMap, DBMetadata metadata) {
// Append-only
Map<Predicate,ImmutableList<TermType>> mutableCastMap = Maps.newHashMap();
for (Predicate predicate : predicatesInBottomUp) {
ImmutableList<TermType> castTypes = inferCastTypes(predicate, ruleIndex.get(predicate), termTypeMap,
mutableCastMap,metadata);
mutableCastMap.put(predicate, castTypes); // depends on control dependency: [for], data = [predicate]
}
return ImmutableMap.copyOf(mutableCastMap);
} } |
public class class_name {
public static Integer computeGrammarSize(GrammarRules rules, Integer paaSize) {
// The final grammar's size in BYTES
//
int res = 0;
// The final size is the sum of the sizes of all rules
//
for (GrammarRuleRecord r : rules) {
String ruleStr = r.getRuleString();
String[] tokens = ruleStr.split("\\s+");
int ruleSize = computeRuleSize(paaSize, tokens);
res += ruleSize;
}
return res;
} } | public class class_name {
public static Integer computeGrammarSize(GrammarRules rules, Integer paaSize) {
// The final grammar's size in BYTES
//
int res = 0;
// The final size is the sum of the sizes of all rules
//
for (GrammarRuleRecord r : rules) {
String ruleStr = r.getRuleString();
String[] tokens = ruleStr.split("\\s+");
int ruleSize = computeRuleSize(paaSize, tokens);
res += ruleSize; // depends on control dependency: [for], data = [r]
}
return res;
} } |
public class class_name {
@Override
public final boolean satisfiedForFlowOrdering(final FilterOutcomes outcomes) {
if (isAlwaysSatisfiedRequirement()) {
return true;
}
final ComponentRequirement componentRequirement = _hasComponentRequirement.getComponentRequirement();
if (componentRequirement == null) {
return true;
}
final Collection<FilterOutcome> dependencies = componentRequirement.getProcessingDependencies();
for (final FilterOutcome filterOutcome : dependencies) {
final boolean contains = outcomes.contains(filterOutcome);
if (!contains) {
return false;
}
}
return componentRequirement.isSatisfied(null, outcomes);
} } | public class class_name {
@Override
public final boolean satisfiedForFlowOrdering(final FilterOutcomes outcomes) {
if (isAlwaysSatisfiedRequirement()) {
return true; // depends on control dependency: [if], data = [none]
}
final ComponentRequirement componentRequirement = _hasComponentRequirement.getComponentRequirement();
if (componentRequirement == null) {
return true; // depends on control dependency: [if], data = [none]
}
final Collection<FilterOutcome> dependencies = componentRequirement.getProcessingDependencies();
for (final FilterOutcome filterOutcome : dependencies) {
final boolean contains = outcomes.contains(filterOutcome);
if (!contains) {
return false; // depends on control dependency: [if], data = [none]
}
}
return componentRequirement.isSatisfied(null, outcomes);
} } |
public class class_name {
private static boolean showCheatSheet(View view, CharSequence text) {
if (TextUtils.isEmpty(text)) {
return false;
}
final int[] screenPos = new int[2]; // origin is device display
final Rect displayFrame = new Rect(); // includes decorations (e.g. status bar)
view.getLocationOnScreen(screenPos);
view.getWindowVisibleDisplayFrame(displayFrame);
final Context context = view.getContext();
final int viewWidth = view.getWidth();
final int viewHeight = view.getHeight();
final int viewCenterX = screenPos[0] + (viewWidth / 2);
final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
final int estimatedToastHeight = (int)(ESTIMATED_TOAST_HEIGHT_DPS * context.getResources().getDisplayMetrics().density);
Toast cheatSheet = Toast.makeText(context, text, Toast.LENGTH_SHORT);
boolean showBelow = screenPos[1] < estimatedToastHeight;
if (showBelow) {
// Show below
// Offsets are after decorations (e.g. status bar) are factored in
cheatSheet.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL, viewCenterX - (screenWidth / 2),
(screenPos[1] - displayFrame.top) + viewHeight);
} else {
// Show above
// Offsets are after decorations (e.g. status bar) are factored in
cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, viewCenterX - (screenWidth / 2),
displayFrame.bottom - screenPos[1]);
}
cheatSheet.show();
return true;
} } | public class class_name {
private static boolean showCheatSheet(View view, CharSequence text) {
if (TextUtils.isEmpty(text)) {
return false; // depends on control dependency: [if], data = [none]
}
final int[] screenPos = new int[2]; // origin is device display
final Rect displayFrame = new Rect(); // includes decorations (e.g. status bar)
view.getLocationOnScreen(screenPos);
view.getWindowVisibleDisplayFrame(displayFrame);
final Context context = view.getContext();
final int viewWidth = view.getWidth();
final int viewHeight = view.getHeight();
final int viewCenterX = screenPos[0] + (viewWidth / 2);
final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
final int estimatedToastHeight = (int)(ESTIMATED_TOAST_HEIGHT_DPS * context.getResources().getDisplayMetrics().density);
Toast cheatSheet = Toast.makeText(context, text, Toast.LENGTH_SHORT);
boolean showBelow = screenPos[1] < estimatedToastHeight;
if (showBelow) {
// Show below
// Offsets are after decorations (e.g. status bar) are factored in
cheatSheet.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL, viewCenterX - (screenWidth / 2),
(screenPos[1] - displayFrame.top) + viewHeight); // depends on control dependency: [if], data = [none]
} else {
// Show above
// Offsets are after decorations (e.g. status bar) are factored in
cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, viewCenterX - (screenWidth / 2),
displayFrame.bottom - screenPos[1]); // depends on control dependency: [if], data = [none]
}
cheatSheet.show();
return true;
} } |
public class class_name {
private static Stream<Message> getMessagesAsStream(TextChannel channel, long before, long after) {
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(new Iterator<Message>() {
private final DiscordApiImpl api = ((DiscordApiImpl) channel.getApi());
// before was set or both were not set
private final boolean older = (before != -1) || (after == -1);
private final boolean newer = after != -1;
private long referenceMessageId = older ? before : after;
private final List<JsonNode> messageJsons = Collections.synchronizedList(new ArrayList<>());
private void ensureMessagesAvailable() {
if (messageJsons.isEmpty()) {
synchronized (messageJsons) {
if (messageJsons.isEmpty()) {
messageJsons.addAll(requestAsSortedJsonNodes(
channel,
100,
older ? referenceMessageId : -1,
newer ? referenceMessageId : -1,
older
));
if (!messageJsons.isEmpty()) {
referenceMessageId = messageJsons.get(messageJsons.size() - 1).get("id").asLong();
}
}
}
}
}
@Override
public boolean hasNext() {
ensureMessagesAvailable();
return !messageJsons.isEmpty();
}
@Override
public Message next() {
ensureMessagesAvailable();
return api.getOrCreateMessage(channel, messageJsons.remove(0));
}
}, Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.NONNULL | Spliterator.CONCURRENT), false);
} } | public class class_name {
private static Stream<Message> getMessagesAsStream(TextChannel channel, long before, long after) {
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(new Iterator<Message>() {
private final DiscordApiImpl api = ((DiscordApiImpl) channel.getApi());
// before was set or both were not set
private final boolean older = (before != -1) || (after == -1);
private final boolean newer = after != -1;
private long referenceMessageId = older ? before : after;
private final List<JsonNode> messageJsons = Collections.synchronizedList(new ArrayList<>());
private void ensureMessagesAvailable() {
if (messageJsons.isEmpty()) {
synchronized (messageJsons) { // depends on control dependency: [if], data = [none]
if (messageJsons.isEmpty()) {
messageJsons.addAll(requestAsSortedJsonNodes(
channel,
100,
older ? referenceMessageId : -1,
newer ? referenceMessageId : -1,
older
)); // depends on control dependency: [if], data = [none]
if (!messageJsons.isEmpty()) {
referenceMessageId = messageJsons.get(messageJsons.size() - 1).get("id").asLong(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
@Override
public boolean hasNext() {
ensureMessagesAvailable();
return !messageJsons.isEmpty();
}
@Override
public Message next() {
ensureMessagesAvailable();
return api.getOrCreateMessage(channel, messageJsons.remove(0));
}
}, Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.NONNULL | Spliterator.CONCURRENT), false);
} } |
public class class_name {
public void marshall(DescribeWorkflowExecutionRequest describeWorkflowExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (describeWorkflowExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeWorkflowExecutionRequest.getDomain(), DOMAIN_BINDING);
protocolMarshaller.marshall(describeWorkflowExecutionRequest.getExecution(), EXECUTION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeWorkflowExecutionRequest describeWorkflowExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (describeWorkflowExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeWorkflowExecutionRequest.getDomain(), DOMAIN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeWorkflowExecutionRequest.getExecution(), EXECUTION_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 Branch getInstance(@NonNull Context context, @NonNull String branchKey) {
if (branchReferral_ == null) {
branchReferral_ = Branch.initInstance(context);
}
branchReferral_.context_ = context.getApplicationContext();
if (branchKey.startsWith("key_")) {
boolean isNewBranchKeySet = branchReferral_.prefHelper_.setBranchKey(branchKey);
//on setting a new key clear link cache and pending requests
if (isNewBranchKeySet) {
branchReferral_.linkCache_.clear();
branchReferral_.requestQueue_.clear();
}
} else {
PrefHelper.Debug("Branch Key is invalid. Please check your BranchKey");
}
return branchReferral_;
} } | public class class_name {
public static Branch getInstance(@NonNull Context context, @NonNull String branchKey) {
if (branchReferral_ == null) {
branchReferral_ = Branch.initInstance(context); // depends on control dependency: [if], data = [none]
}
branchReferral_.context_ = context.getApplicationContext();
if (branchKey.startsWith("key_")) {
boolean isNewBranchKeySet = branchReferral_.prefHelper_.setBranchKey(branchKey);
//on setting a new key clear link cache and pending requests
if (isNewBranchKeySet) {
branchReferral_.linkCache_.clear(); // depends on control dependency: [if], data = [none]
branchReferral_.requestQueue_.clear(); // depends on control dependency: [if], data = [none]
}
} else {
PrefHelper.Debug("Branch Key is invalid. Please check your BranchKey"); // depends on control dependency: [if], data = [none]
}
return branchReferral_;
} } |
public class class_name {
@Override
public Double getValue(GriddedTile griddedTile,
CoverageDataTiffImage image, int x, int y) {
Double value = null;
if (image.getDirectory() != null) {
float pixelValue = image.getPixel(x, y);
value = getValue(griddedTile, pixelValue);
} else {
value = getValue(griddedTile, image.getImageBytes(), x, y);
}
return value;
} } | public class class_name {
@Override
public Double getValue(GriddedTile griddedTile,
CoverageDataTiffImage image, int x, int y) {
Double value = null;
if (image.getDirectory() != null) {
float pixelValue = image.getPixel(x, y);
value = getValue(griddedTile, pixelValue); // depends on control dependency: [if], data = [none]
} else {
value = getValue(griddedTile, image.getImageBytes(), x, y); // depends on control dependency: [if], data = [none]
}
return value;
} } |
public class class_name {
@Override
public void clear()
{
final Enumeration<Variable> varIter = getVariables().elements();
while (varIter.hasMoreElements())
{
final Variable var = varIter.nextElement();
if (var.systemGenerated)
continue;
removeVariable(var.name);
}
} } | public class class_name {
@Override
public void clear()
{
final Enumeration<Variable> varIter = getVariables().elements();
while (varIter.hasMoreElements())
{
final Variable var = varIter.nextElement();
if (var.systemGenerated)
continue;
removeVariable(var.name); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
static Node fuseExpressionIntoExpression(Node exp1, Node exp2) {
if (exp2.isEmpty()) {
return exp1;
}
Node comma = new Node(Token.COMMA, exp1);
comma.useSourceInfoIfMissingFrom(exp2);
// We can just join the new comma expression with another comma but
// lets keep all the comma's in a straight line. That way we can use
// tree comparison.
if (exp2.isComma()) {
Node leftMostChild = exp2;
while (leftMostChild.isComma()) {
leftMostChild = leftMostChild.getFirstChild();
}
Node parent = leftMostChild.getParent();
comma.addChildToBack(leftMostChild.detach());
parent.addChildToFront(comma);
return exp2;
} else {
comma.addChildToBack(exp2);
return comma;
}
} } | public class class_name {
static Node fuseExpressionIntoExpression(Node exp1, Node exp2) {
if (exp2.isEmpty()) {
return exp1; // depends on control dependency: [if], data = [none]
}
Node comma = new Node(Token.COMMA, exp1);
comma.useSourceInfoIfMissingFrom(exp2);
// We can just join the new comma expression with another comma but
// lets keep all the comma's in a straight line. That way we can use
// tree comparison.
if (exp2.isComma()) {
Node leftMostChild = exp2;
while (leftMostChild.isComma()) {
leftMostChild = leftMostChild.getFirstChild(); // depends on control dependency: [while], data = [none]
}
Node parent = leftMostChild.getParent();
comma.addChildToBack(leftMostChild.detach()); // depends on control dependency: [if], data = [none]
parent.addChildToFront(comma); // depends on control dependency: [if], data = [none]
return exp2; // depends on control dependency: [if], data = [none]
} else {
comma.addChildToBack(exp2); // depends on control dependency: [if], data = [none]
return comma; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Set<String> readColumnSet(String infile, int field) throws IOException
{
BufferedReader br = IOUtils.getBufferedFileReader(infile);
String line;
Set<String> set = new HashSet<String>();
while ((line = br.readLine()) != null) {
line = line.trim();
if (line.length() > 0) {
if (field < 0) {
set.add(line);
} else {
String[] fields = tab.split(line);
if (field < fields.length) {
set.add(fields[field]);
}
}
}
}
br.close();
return set;
} } | public class class_name {
public static Set<String> readColumnSet(String infile, int field) throws IOException
{
BufferedReader br = IOUtils.getBufferedFileReader(infile);
String line;
Set<String> set = new HashSet<String>();
while ((line = br.readLine()) != null) {
line = line.trim();
if (line.length() > 0) {
if (field < 0) {
set.add(line);
// depends on control dependency: [if], data = [none]
} else {
String[] fields = tab.split(line);
if (field < fields.length) {
set.add(fields[field]);
// depends on control dependency: [if], data = [(field]
}
}
}
}
br.close();
return set;
} } |
public class class_name {
public String getAccumuloPassword() {
if (containsKey(ACCUMULO_PASSWORD_PROP)) {
return verifyNotNull(ACCUMULO_PASSWORD_PROP, getString(ACCUMULO_PASSWORD_PROP));
} else if (containsKey(CLIENT_ACCUMULO_PASSWORD_PROP)) {
return verifyNotNull(CLIENT_ACCUMULO_PASSWORD_PROP, getString(CLIENT_ACCUMULO_PASSWORD_PROP));
}
throw new NoSuchElementException(ACCUMULO_PASSWORD_PROP + " is not set!");
} } | public class class_name {
public String getAccumuloPassword() {
if (containsKey(ACCUMULO_PASSWORD_PROP)) {
return verifyNotNull(ACCUMULO_PASSWORD_PROP, getString(ACCUMULO_PASSWORD_PROP)); // depends on control dependency: [if], data = [none]
} else if (containsKey(CLIENT_ACCUMULO_PASSWORD_PROP)) {
return verifyNotNull(CLIENT_ACCUMULO_PASSWORD_PROP, getString(CLIENT_ACCUMULO_PASSWORD_PROP)); // depends on control dependency: [if], data = [none]
}
throw new NoSuchElementException(ACCUMULO_PASSWORD_PROP + " is not set!");
} } |
public class class_name {
@Override
public List<T> getList() {
if (isCacheEnabled) {
if (cachedResult == null) {
cachedResult = makeUnmodifiableUniqueList();
}
return cachedResult;
} else {
return makeUnmodifiableUniqueList();
}
} } | public class class_name {
@Override
public List<T> getList() {
if (isCacheEnabled) {
if (cachedResult == null) {
cachedResult = makeUnmodifiableUniqueList(); // depends on control dependency: [if], data = [none]
}
return cachedResult; // depends on control dependency: [if], data = [none]
} else {
return makeUnmodifiableUniqueList(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Object[] processByteArrayWithData(long rowOffset, long rowLength, List<String> columnNames) {
Object[] rowElements;
if (columnNames != null) {
rowElements = new Object[columnNames.size()];
} else {
rowElements = new Object[(int) sasFileProperties.getColumnsCount()];
}
byte[] source;
int offset;
if (sasFileProperties.isCompressed() && rowLength < sasFileProperties.getRowLength()) {
Decompressor decompressor = LITERALS_TO_DECOMPRESSOR.get(sasFileProperties.getCompressionMethod());
source = decompressor.decompressRow((int) rowOffset, (int) rowLength,
(int) sasFileProperties.getRowLength(), cachedPage);
offset = 0;
} else {
source = cachedPage;
offset = (int) rowOffset;
}
for (int currentColumnIndex = 0; currentColumnIndex < sasFileProperties.getColumnsCount()
&& columnsDataLength.get(currentColumnIndex) != 0; currentColumnIndex++) {
if (columnNames == null) {
rowElements[currentColumnIndex] = processElement(source, offset, currentColumnIndex);
} else {
String name = columns.get(currentColumnIndex).getName();
if (columnNames.contains(name)) {
rowElements[columnNames.indexOf(name)] = processElement(source, offset, currentColumnIndex);
}
}
}
return rowElements;
} } | public class class_name {
private Object[] processByteArrayWithData(long rowOffset, long rowLength, List<String> columnNames) {
Object[] rowElements;
if (columnNames != null) {
rowElements = new Object[columnNames.size()]; // depends on control dependency: [if], data = [none]
} else {
rowElements = new Object[(int) sasFileProperties.getColumnsCount()]; // depends on control dependency: [if], data = [none]
}
byte[] source;
int offset;
if (sasFileProperties.isCompressed() && rowLength < sasFileProperties.getRowLength()) {
Decompressor decompressor = LITERALS_TO_DECOMPRESSOR.get(sasFileProperties.getCompressionMethod());
source = decompressor.decompressRow((int) rowOffset, (int) rowLength,
(int) sasFileProperties.getRowLength(), cachedPage); // depends on control dependency: [if], data = [none]
offset = 0; // depends on control dependency: [if], data = [none]
} else {
source = cachedPage; // depends on control dependency: [if], data = [none]
offset = (int) rowOffset; // depends on control dependency: [if], data = [none]
}
for (int currentColumnIndex = 0; currentColumnIndex < sasFileProperties.getColumnsCount()
&& columnsDataLength.get(currentColumnIndex) != 0; currentColumnIndex++) {
if (columnNames == null) {
rowElements[currentColumnIndex] = processElement(source, offset, currentColumnIndex); // depends on control dependency: [if], data = [none]
} else {
String name = columns.get(currentColumnIndex).getName();
if (columnNames.contains(name)) {
rowElements[columnNames.indexOf(name)] = processElement(source, offset, currentColumnIndex); // depends on control dependency: [if], data = [none]
}
}
}
return rowElements;
} } |
public class class_name {
public boolean isEndedBy(final T element) {
if (element == null) {
return false;
}
return comparator.compare(element, maximum) == 0;
} } | public class class_name {
public boolean isEndedBy(final T element) {
if (element == null) {
return false; // depends on control dependency: [if], data = [none]
}
return comparator.compare(element, maximum) == 0;
} } |
public class class_name {
public void save(final long chunkSize) {
if (outputStream != null) {
throw new MongoException("cannot mix OutputStream and regular save()");
}
// note that chunkSize only changes chunkSize in case we actually save chunks
// otherwise there is a risk file and chunks are not compatible
if (!savedChunks) {
try {
saveChunks(chunkSize);
} catch (IOException ioe) {
throw new MongoException("couldn't save chunks", ioe);
}
}
super.save();
} } | public class class_name {
public void save(final long chunkSize) {
if (outputStream != null) {
throw new MongoException("cannot mix OutputStream and regular save()");
}
// note that chunkSize only changes chunkSize in case we actually save chunks
// otherwise there is a risk file and chunks are not compatible
if (!savedChunks) {
try {
saveChunks(chunkSize); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
throw new MongoException("couldn't save chunks", ioe);
} // depends on control dependency: [catch], data = [none]
}
super.save();
} } |
public class class_name {
protected void addExceptions(ExecutableElement member, Content htmltree, int indentSize) {
List<? extends TypeMirror> exceptions = member.getThrownTypes();
if (!exceptions.isEmpty()) {
CharSequence indent = makeSpace(indentSize + 1 - 7);
htmltree.addContent(DocletConstants.NL);
htmltree.addContent(indent);
htmltree.addContent("throws ");
indent = makeSpace(indentSize + 1);
Content link = writer.getLink(new LinkInfoImpl(configuration, MEMBER, exceptions.get(0)));
htmltree.addContent(link);
for(int i = 1; i < exceptions.size(); i++) {
htmltree.addContent(",");
htmltree.addContent(DocletConstants.NL);
htmltree.addContent(indent);
Content exceptionLink = writer.getLink(new LinkInfoImpl(configuration, MEMBER,
exceptions.get(i)));
htmltree.addContent(exceptionLink);
}
}
} } | public class class_name {
protected void addExceptions(ExecutableElement member, Content htmltree, int indentSize) {
List<? extends TypeMirror> exceptions = member.getThrownTypes();
if (!exceptions.isEmpty()) {
CharSequence indent = makeSpace(indentSize + 1 - 7);
htmltree.addContent(DocletConstants.NL); // depends on control dependency: [if], data = [none]
htmltree.addContent(indent); // depends on control dependency: [if], data = [none]
htmltree.addContent("throws "); // depends on control dependency: [if], data = [none]
indent = makeSpace(indentSize + 1); // depends on control dependency: [if], data = [none]
Content link = writer.getLink(new LinkInfoImpl(configuration, MEMBER, exceptions.get(0)));
htmltree.addContent(link); // depends on control dependency: [if], data = [none]
for(int i = 1; i < exceptions.size(); i++) {
htmltree.addContent(","); // depends on control dependency: [for], data = [none]
htmltree.addContent(DocletConstants.NL); // depends on control dependency: [for], data = [none]
htmltree.addContent(indent); // depends on control dependency: [for], data = [none]
Content exceptionLink = writer.getLink(new LinkInfoImpl(configuration, MEMBER,
exceptions.get(i)));
htmltree.addContent(exceptionLink); // depends on control dependency: [for], data = [none]
}
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.