code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void updateFaxJob(FaxJob faxJob,HTTPResponse httpResponse,FaxActionType faxActionType)
{
//get path
String path=this.getPathToResponseData(faxActionType);
//get fax job ID
String id=this.findValue(httpResponse,path);
if(id!=null)
{
faxJob.setID(id);
}
} } | public class class_name {
public void updateFaxJob(FaxJob faxJob,HTTPResponse httpResponse,FaxActionType faxActionType)
{
//get path
String path=this.getPathToResponseData(faxActionType);
//get fax job ID
String id=this.findValue(httpResponse,path);
if(id!=null)
{
faxJob.setID(id); // depends on control dependency: [if], data = [(id]
}
} } |
public class class_name {
@Override
public boolean isValid(String wert) {
if (StringUtils.length(wert) < 1) {
return false;
} else {
return getPruefziffer(wert).equals(berechnePruefziffer(wert.substring(0, wert.length() - 1)));
}
} } | public class class_name {
@Override
public boolean isValid(String wert) {
if (StringUtils.length(wert) < 1) {
return false; // depends on control dependency: [if], data = [none]
} else {
return getPruefziffer(wert).equals(berechnePruefziffer(wert.substring(0, wert.length() - 1))); // depends on control dependency: [if], data = [1)]
}
} } |
public class class_name {
private void start() {
try {
timer.schedule(new IsAliveTimerTask(), 0, period);
} catch (Throwable t) {
Utils.exitWithFailure("Throwable caught during the startup", t);
}
} } | public class class_name {
private void start() {
try {
timer.schedule(new IsAliveTimerTask(), 0, period); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
Utils.exitWithFailure("Throwable caught during the startup", t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String queryToExpressionStr(ServiceInstanceQuery query){
List<QueryCriterion> criteria = query.getCriteria();
StringBuilder sb = new StringBuilder();
for(QueryCriterion criterion : criteria){
String statement = criterionToExpressionStr(criterion);
if(statement != null && ! statement.isEmpty()){
sb.append(statement).append(";");
}
}
return sb.toString();
} } | public class class_name {
public static String queryToExpressionStr(ServiceInstanceQuery query){
List<QueryCriterion> criteria = query.getCriteria();
StringBuilder sb = new StringBuilder();
for(QueryCriterion criterion : criteria){
String statement = criterionToExpressionStr(criterion);
if(statement != null && ! statement.isEmpty()){
sb.append(statement).append(";"); // depends on control dependency: [if], data = [(statement]
}
}
return sb.toString();
} } |
public class class_name {
private void fireNotAuthenticatedEvent(String userName) {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isEntryEnabled())
SibTr.entry(tc, "fireNotAuthenticatedEvent", userName);
// Check that we have a RuntimeEventListener
if (_runtimeEventListener != null) {
// Build the message for the Notification
String message = nls.getFormattedMessage(
"USER_NOT_AUTHORIZED_ERROR_CWSIP0301", new Object[] {
userName, getMessagingEngineName(),
getMessagingEngineBus() }, null);
// Build the properties for the Notification
Properties props = new Properties();
props.put(SibNotificationConstants.KEY_OPERATION,
SibNotificationConstants.OPERATION_CONNECT);
props.put(SibNotificationConstants.KEY_SECURITY_USERID, userName);
props.put(SibNotificationConstants.KEY_SECURITY_REASON,
SibNotificationConstants.SECURITY_REASON_NOT_AUTHENTICATED);
// Fire the event
_runtimeEventListener
.runtimeEventOccurred(
_engine,
SibNotificationConstants.TYPE_SIB_SECURITY_NOT_AUTHENTICATED,
message, props);
} else {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isDebugEnabled())
SibTr.debug(tc, "Null RuntimeEventListener, cannot fire event");
}
if (TraceComponent.isAnyTracingEnabled()
&& tc.isEntryEnabled())
SibTr.exit(tc, "fireNotAuthenticatedEvent");
} } | public class class_name {
private void fireNotAuthenticatedEvent(String userName) {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isEntryEnabled())
SibTr.entry(tc, "fireNotAuthenticatedEvent", userName);
// Check that we have a RuntimeEventListener
if (_runtimeEventListener != null) {
// Build the message for the Notification
String message = nls.getFormattedMessage(
"USER_NOT_AUTHORIZED_ERROR_CWSIP0301", new Object[] {
userName, getMessagingEngineName(),
getMessagingEngineBus() }, null);
// Build the properties for the Notification
Properties props = new Properties();
props.put(SibNotificationConstants.KEY_OPERATION,
SibNotificationConstants.OPERATION_CONNECT); // depends on control dependency: [if], data = [none]
props.put(SibNotificationConstants.KEY_SECURITY_USERID, userName); // depends on control dependency: [if], data = [none]
props.put(SibNotificationConstants.KEY_SECURITY_REASON,
SibNotificationConstants.SECURITY_REASON_NOT_AUTHENTICATED); // depends on control dependency: [if], data = [none]
// Fire the event
_runtimeEventListener
.runtimeEventOccurred(
_engine,
SibNotificationConstants.TYPE_SIB_SECURITY_NOT_AUTHENTICATED,
message, props); // depends on control dependency: [if], data = [none]
} else {
if (TraceComponent.isAnyTracingEnabled()
&& tc.isDebugEnabled())
SibTr.debug(tc, "Null RuntimeEventListener, cannot fire event");
}
if (TraceComponent.isAnyTracingEnabled()
&& tc.isEntryEnabled())
SibTr.exit(tc, "fireNotAuthenticatedEvent");
} } |
public class class_name {
protected synchronized void readFile() {
if (realmFile != null && realmFile.exists() && (realmFile.lastModified() != lastModified)) {
lastModified = realmFile.lastModified();
try {
Preconditions.checkArgument(realmFile.canRead(), "The file '{}' can not be read!", realmFile);
Config config = ConfigFactory.parseFile(realmFile);
super.setup(config);
} catch (Exception e) {
log.error("Failed to read {}", realmFile, e);
}
}
} } | public class class_name {
protected synchronized void readFile() {
if (realmFile != null && realmFile.exists() && (realmFile.lastModified() != lastModified)) {
lastModified = realmFile.lastModified(); // depends on control dependency: [if], data = [none]
try {
Preconditions.checkArgument(realmFile.canRead(), "The file '{}' can not be read!", realmFile); // depends on control dependency: [try], data = [none]
Config config = ConfigFactory.parseFile(realmFile);
super.setup(config); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Failed to read {}", realmFile, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected Response put(Response.Status expectedStatus, MultivaluedMap<String, String> queryParams, Object... pathArgs) throws GitLabApiException {
try {
return validate(getApiClient().put(queryParams, pathArgs), expectedStatus);
} catch (Exception e) {
throw handle(e);
}
} } | public class class_name {
protected Response put(Response.Status expectedStatus, MultivaluedMap<String, String> queryParams, Object... pathArgs) throws GitLabApiException {
try {
return validate(getApiClient().put(queryParams, pathArgs), expectedStatus); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw handle(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private String convertToString(Reader reader) throws IOException {
StringBuilder stringBuilder = new StringBuilder();
int numChars;
char[] chars = new char[50];
do {
numChars = reader.read(chars, 0, chars.length);
if (numChars > 0) {
stringBuilder.append(chars, 0, numChars);
}
} while (numChars != -1);
return stringBuilder.toString();
} } | public class class_name {
private String convertToString(Reader reader) throws IOException {
StringBuilder stringBuilder = new StringBuilder();
int numChars;
char[] chars = new char[50];
do {
numChars = reader.read(chars, 0, chars.length);
if (numChars > 0) {
stringBuilder.append(chars, 0, numChars); // depends on control dependency: [if], data = [none]
}
} while (numChars != -1);
return stringBuilder.toString();
} } |
public class class_name {
protected PrintableResult getPDFStream(ProposalDevelopmentDocumentContract pdDoc)
throws S2SException {
List<AuditError> errors = new ArrayList<>();
DevelopmentProposalContract developmentProposal = pdDoc
.getDevelopmentProposal();
String proposalNumber = developmentProposal.getProposalNumber();
List<String> sortedNameSpaces = getSortedNameSpaces(proposalNumber, developmentProposal.getS2sOppForms());
List<S2SPrintable> formPrintables = new ArrayList<>();
boolean formEntryFlag = true;
getNarrativeService().deleteSystemGeneratedNarratives(pdDoc.getDevelopmentProposal().getNarratives());
Forms forms = Forms.Factory.newInstance();
for (String namespace : sortedNameSpaces) {
FormMappingInfo info = formMappingService.getFormInfo(namespace,proposalNumber);
if(info==null) continue;
S2SFormGenerator s2sFormGenerator = s2SFormGeneratorService.getS2SGenerator(proposalNumber,info.getNameSpace());
XmlObject formObject = s2sFormGenerator.getFormObject(pdDoc);
errors.addAll(s2sFormGenerator.getAuditErrors());
if (s2SValidatorService.validate(formObject, errors, info.getFormName()) && errors.isEmpty() && StringUtils.isNotBlank(info.getStyleSheet())) {
String applicationXml = formObject.xmlText(s2SFormGeneratorService.getXmlOptionsPrefixes());
String filteredApplicationXml = s2SDateTimeService.removeTimezoneFactor(applicationXml);
byte[] formXmlBytes = filteredApplicationXml.getBytes();
GenericPrintable formPrintable = new GenericPrintable();
// Linkedhashmap is used to preserve the order of entry.
Map<String, byte[]> formXmlDataMap = new LinkedHashMap<>();
formXmlDataMap.put(info.getFormName(), formXmlBytes);
formPrintable.setStreamMap(formXmlDataMap);
ArrayList<Source> templates = new ArrayList<>();
DefaultResourceLoader resourceLoader = new DefaultResourceLoader(ClassLoaderUtils.getDefaultClassLoader());
Resource resource = resourceLoader.getResource(info.getStyleSheet());
Source xsltSource;
try {
xsltSource = new StreamSource(resource.getInputStream());
} catch (IOException e) {
throw new S2SException(e);
}
templates.add(xsltSource);
formPrintable.setXSLTemplates(templates);
List<AttachmentData> attachmentList = s2sFormGenerator.getAttachments();
try {
if(developmentProposal.getGrantsGovSelectFlag()){
List<S2sAppAttachmentsContract> attachmentLists = new ArrayList<>();
setFormObject(forms, formObject);
saveGrantsGovXml(pdDoc,formEntryFlag,forms,attachmentList,attachmentLists);
formEntryFlag = false;
}
}
catch (Exception e) {
LOG.error(e.getMessage(), e);
}
Map<String, byte[]> formAttachments = new LinkedHashMap<>();
if (attachmentList != null && !attachmentList.isEmpty()) {
for (AttachmentData attachmentData : attachmentList) {
if (!isPdfType(attachmentData.getContent()))
continue;
StringBuilder attachment = new StringBuilder();
attachment.append(" ATT : ");
attachment.append(attachmentData.getContentId());
formAttachments.put(attachment.toString(),
attachmentData.getContent());
}
}
if (formAttachments.size() > 0) {
formPrintable.setAttachments(formAttachments);
}
formPrintables.add(formPrintable);
}
}
final PrintableResult result = new PrintableResult();
result.errors = errors;
result.printables = formPrintables;
return result;
} } | public class class_name {
protected PrintableResult getPDFStream(ProposalDevelopmentDocumentContract pdDoc)
throws S2SException {
List<AuditError> errors = new ArrayList<>();
DevelopmentProposalContract developmentProposal = pdDoc
.getDevelopmentProposal();
String proposalNumber = developmentProposal.getProposalNumber();
List<String> sortedNameSpaces = getSortedNameSpaces(proposalNumber, developmentProposal.getS2sOppForms());
List<S2SPrintable> formPrintables = new ArrayList<>();
boolean formEntryFlag = true;
getNarrativeService().deleteSystemGeneratedNarratives(pdDoc.getDevelopmentProposal().getNarratives());
Forms forms = Forms.Factory.newInstance();
for (String namespace : sortedNameSpaces) {
FormMappingInfo info = formMappingService.getFormInfo(namespace,proposalNumber);
if(info==null) continue;
S2SFormGenerator s2sFormGenerator = s2SFormGeneratorService.getS2SGenerator(proposalNumber,info.getNameSpace());
XmlObject formObject = s2sFormGenerator.getFormObject(pdDoc);
errors.addAll(s2sFormGenerator.getAuditErrors());
if (s2SValidatorService.validate(formObject, errors, info.getFormName()) && errors.isEmpty() && StringUtils.isNotBlank(info.getStyleSheet())) {
String applicationXml = formObject.xmlText(s2SFormGeneratorService.getXmlOptionsPrefixes());
String filteredApplicationXml = s2SDateTimeService.removeTimezoneFactor(applicationXml);
byte[] formXmlBytes = filteredApplicationXml.getBytes();
GenericPrintable formPrintable = new GenericPrintable();
// Linkedhashmap is used to preserve the order of entry.
Map<String, byte[]> formXmlDataMap = new LinkedHashMap<>();
formXmlDataMap.put(info.getFormName(), formXmlBytes); // depends on control dependency: [if], data = [none]
formPrintable.setStreamMap(formXmlDataMap); // depends on control dependency: [if], data = [none]
ArrayList<Source> templates = new ArrayList<>();
DefaultResourceLoader resourceLoader = new DefaultResourceLoader(ClassLoaderUtils.getDefaultClassLoader());
Resource resource = resourceLoader.getResource(info.getStyleSheet());
Source xsltSource;
try {
xsltSource = new StreamSource(resource.getInputStream()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new S2SException(e);
} // depends on control dependency: [catch], data = [none]
templates.add(xsltSource); // depends on control dependency: [if], data = [none]
formPrintable.setXSLTemplates(templates); // depends on control dependency: [if], data = [none]
List<AttachmentData> attachmentList = s2sFormGenerator.getAttachments();
try {
if(developmentProposal.getGrantsGovSelectFlag()){
List<S2sAppAttachmentsContract> attachmentLists = new ArrayList<>();
setFormObject(forms, formObject); // depends on control dependency: [if], data = [none]
saveGrantsGovXml(pdDoc,formEntryFlag,forms,attachmentList,attachmentLists); // depends on control dependency: [if], data = [none]
formEntryFlag = false; // depends on control dependency: [if], data = [none]
}
}
catch (Exception e) {
LOG.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
Map<String, byte[]> formAttachments = new LinkedHashMap<>();
if (attachmentList != null && !attachmentList.isEmpty()) {
for (AttachmentData attachmentData : attachmentList) {
if (!isPdfType(attachmentData.getContent()))
continue;
StringBuilder attachment = new StringBuilder();
attachment.append(" ATT : "); // depends on control dependency: [for], data = [none]
attachment.append(attachmentData.getContentId()); // depends on control dependency: [for], data = [attachmentData]
formAttachments.put(attachment.toString(),
attachmentData.getContent()); // depends on control dependency: [for], data = [none]
}
}
if (formAttachments.size() > 0) {
formPrintable.setAttachments(formAttachments); // depends on control dependency: [if], data = [none]
}
formPrintables.add(formPrintable); // depends on control dependency: [if], data = [none]
}
}
final PrintableResult result = new PrintableResult();
result.errors = errors;
result.printables = formPrintables;
return result;
} } |
public class class_name {
public List<JAXBElement<? extends DeploymentDescriptorType>> getDeploymentDescriptor() {
if (deploymentDescriptor == null) {
deploymentDescriptor = new ArrayList<JAXBElement<? extends DeploymentDescriptorType>>();
}
return this.deploymentDescriptor;
} } | public class class_name {
public List<JAXBElement<? extends DeploymentDescriptorType>> getDeploymentDescriptor() {
if (deploymentDescriptor == null) {
deploymentDescriptor = new ArrayList<JAXBElement<? extends DeploymentDescriptorType>>(); // depends on control dependency: [if], data = [none]
}
return this.deploymentDescriptor;
} } |
public class class_name {
public Object[] toArray() {
XEvent array[] = new XEvent[events.size()];
for (int i = 0; i < events.size(); i++) {
try {
array[i] = events.get(i);
} catch (IOException e) {
e.printStackTrace();
}
}
return array;
} } | public class class_name {
public Object[] toArray() {
XEvent array[] = new XEvent[events.size()];
for (int i = 0; i < events.size(); i++) {
try {
array[i] = events.get(i); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return array;
} } |
public class class_name {
public String readLine() throws Exception
{
byte[] buffer = new byte[4 * 1024];
int bufPos = 0;
byte prevByte = 0;
while (true)
{
int received = clientSession.getClientSocket().getInputStream().read();
if (received < 0)
{
return null;
}
buffer[bufPos] = (byte)received;
bufPos++;
if (prevByte == '\r' && received == '\n')
{
StringBuilder resultLine = new StringBuilder();
for (int i = 0; i < bufPos - 2; i++)
{
resultLine.append((char)buffer[i]);
}
return resultLine.toString();
}
prevByte = (byte)received;
}
} } | public class class_name {
public String readLine() throws Exception
{
byte[] buffer = new byte[4 * 1024];
int bufPos = 0;
byte prevByte = 0;
while (true)
{
int received = clientSession.getClientSocket().getInputStream().read();
if (received < 0)
{
return null; // depends on control dependency: [if], data = [none]
}
buffer[bufPos] = (byte)received;
bufPos++;
if (prevByte == '\r' && received == '\n')
{
StringBuilder resultLine = new StringBuilder();
for (int i = 0; i < bufPos - 2; i++)
{
resultLine.append((char)buffer[i]); // depends on control dependency: [for], data = [i]
}
return resultLine.toString(); // depends on control dependency: [if], data = [none]
}
prevByte = (byte)received;
}
} } |
public class class_name {
public static OptionalEntity<ElevateWord> getEntity(final CreateForm form, final String username, final long currentTime) {
switch (form.crudMode) {
case CrudMode.CREATE:
return OptionalEntity.of(new ElevateWord()).map(entity -> {
entity.setCreatedBy(username);
entity.setCreatedTime(currentTime);
return entity;
});
case CrudMode.EDIT:
if (form instanceof EditForm) {
return ComponentUtil.getComponent(ElevateWordService.class).getElevateWord(((EditForm) form).id);
}
break;
default:
break;
}
return OptionalEntity.empty();
} } | public class class_name {
public static OptionalEntity<ElevateWord> getEntity(final CreateForm form, final String username, final long currentTime) {
switch (form.crudMode) {
case CrudMode.CREATE:
return OptionalEntity.of(new ElevateWord()).map(entity -> {
entity.setCreatedBy(username);
entity.setCreatedTime(currentTime);
return entity;
});
case CrudMode.EDIT:
if (form instanceof EditForm) {
return ComponentUtil.getComponent(ElevateWordService.class).getElevateWord(((EditForm) form).id); // depends on control dependency: [if], data = [none]
}
break;
default:
break;
}
return OptionalEntity.empty();
} } |
public class class_name {
public JSDocInfo cloneClassDoc() {
JSDocInfo other = new JSDocInfo();
other.info = this.info == null ? null : this.info.cloneClassDoc();
other.documentation = this.documentation;
other.visibility = this.visibility;
other.bitset = this.bitset;
other.type = cloneType(this.type, false);
other.thisType = cloneType(this.thisType, false);
other.includeDocumentation = this.includeDocumentation;
other.originalCommentPosition = this.originalCommentPosition;
other.setConstructor(false);
other.setStruct(false);
if (!isInterface() && other.info != null) {
other.info.baseType = null;
}
return other;
} } | public class class_name {
public JSDocInfo cloneClassDoc() {
JSDocInfo other = new JSDocInfo();
other.info = this.info == null ? null : this.info.cloneClassDoc();
other.documentation = this.documentation;
other.visibility = this.visibility;
other.bitset = this.bitset;
other.type = cloneType(this.type, false);
other.thisType = cloneType(this.thisType, false);
other.includeDocumentation = this.includeDocumentation;
other.originalCommentPosition = this.originalCommentPosition;
other.setConstructor(false);
other.setStruct(false);
if (!isInterface() && other.info != null) {
other.info.baseType = null; // depends on control dependency: [if], data = [none]
}
return other;
} } |
public class class_name {
@Override
public void unset(String propName) {
if (propName.equals(PROP_DESCRIPTION)) {
unsetDescription();
}
super.unset(propName);
} } | public class class_name {
@Override
public void unset(String propName) {
if (propName.equals(PROP_DESCRIPTION)) {
unsetDescription(); // depends on control dependency: [if], data = [none]
}
super.unset(propName);
} } |
public class class_name {
@Override
public <E> List<E> sort(final List<E> elements) {
boolean swapped = true;
for (int size = elements.size(), gap = size; gap > 0 && swapped; ) {
gap = Math.max(1, (int) Math.floor(gap / SHRINK));
swapped = false;
for (int index = 0; index + gap < size; index++) {
if (getOrderBy().compare(elements.get(index), elements.get(index + gap)) > 0) {
swap(elements, index, index + gap);
swapped = true;
}
}
}
return elements;
} } | public class class_name {
@Override
public <E> List<E> sort(final List<E> elements) {
boolean swapped = true;
for (int size = elements.size(), gap = size; gap > 0 && swapped; ) {
gap = Math.max(1, (int) Math.floor(gap / SHRINK)); // depends on control dependency: [for], data = [none]
swapped = false; // depends on control dependency: [for], data = [none]
for (int index = 0; index + gap < size; index++) {
if (getOrderBy().compare(elements.get(index), elements.get(index + gap)) > 0) {
swap(elements, index, index + gap); // depends on control dependency: [if], data = [none]
swapped = true; // depends on control dependency: [if], data = [none]
}
}
}
return elements;
} } |
public class class_name {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
if (intent != null) {
Bundle extras = intent.getExtras();
if (extras != null) {
images = extras.getStringArrayList(KEY_IMAGES);
title = extras.getString(KEY_TITLE);
}
}
setContentView(R.layout.activity_image_gallery);
bindViews();
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(title);
}
setUpRecyclerView();
} } | public class class_name {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
if (intent != null) {
Bundle extras = intent.getExtras();
if (extras != null) {
images = extras.getStringArrayList(KEY_IMAGES); // depends on control dependency: [if], data = [none]
title = extras.getString(KEY_TITLE); // depends on control dependency: [if], data = [none]
}
}
setContentView(R.layout.activity_image_gallery);
bindViews();
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true); // depends on control dependency: [if], data = [none]
actionBar.setTitle(title); // depends on control dependency: [if], data = [none]
}
setUpRecyclerView();
} } |
public class class_name {
public JoinDescription nested(JoinDescription... joins) {
for (JoinDescription join : joins) {
join.parent = this;
join.alias(J.path(this.getAlias(), join.getOriginalAlias()));
addJoin(join);
reAliasChildren(join);
}
return this;
} } | public class class_name {
public JoinDescription nested(JoinDescription... joins) {
for (JoinDescription join : joins) {
join.parent = this; // depends on control dependency: [for], data = [join]
join.alias(J.path(this.getAlias(), join.getOriginalAlias())); // depends on control dependency: [for], data = [join]
addJoin(join); // depends on control dependency: [for], data = [join]
reAliasChildren(join); // depends on control dependency: [for], data = [join]
}
return this;
} } |
public class class_name {
public List<LargeMailUserType.LargeMailUserName> getLargeMailUserName() {
if (largeMailUserName == null) {
largeMailUserName = new ArrayList<LargeMailUserType.LargeMailUserName>();
}
return this.largeMailUserName;
} } | public class class_name {
public List<LargeMailUserType.LargeMailUserName> getLargeMailUserName() {
if (largeMailUserName == null) {
largeMailUserName = new ArrayList<LargeMailUserType.LargeMailUserName>(); // depends on control dependency: [if], data = [none]
}
return this.largeMailUserName;
} } |
public class class_name {
@Override
public void log(StopWatch sw)
{
if( !m_queue.offer( sw.freeze() ) ) m_rejectedStopWatches.getAndIncrement();
if( m_collectorThread == null )
{
synchronized(this)
{
//
// Ensure that there is no race condition starting the thread.
// Note that under the JVM5 memory model this also requires
// that the field is declared as "volatile", or else the compiler
// may do something nasty.
//
if( m_collectorThread == null )
{
m_collectorThread = new CollectorThread();
m_collectorThread.setName( "Speed4J PeriodicalLog Collector Thread" );
m_collectorThread.setDaemon( true );
m_collectorThread.start();
}
}
}
} } | public class class_name {
@Override
public void log(StopWatch sw)
{
if( !m_queue.offer( sw.freeze() ) ) m_rejectedStopWatches.getAndIncrement();
if( m_collectorThread == null )
{
synchronized(this) // depends on control dependency: [if], data = [none]
{
//
// Ensure that there is no race condition starting the thread.
// Note that under the JVM5 memory model this also requires
// that the field is declared as "volatile", or else the compiler
// may do something nasty.
//
if( m_collectorThread == null )
{
m_collectorThread = new CollectorThread(); // depends on control dependency: [if], data = [none]
m_collectorThread.setName( "Speed4J PeriodicalLog Collector Thread" ); // depends on control dependency: [if], data = [none]
m_collectorThread.setDaemon( true ); // depends on control dependency: [if], data = [none]
m_collectorThread.start(); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public void marshall(DeleteNamedQueryRequest deleteNamedQueryRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteNamedQueryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteNamedQueryRequest.getNamedQueryId(), NAMEDQUERYID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteNamedQueryRequest deleteNamedQueryRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteNamedQueryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteNamedQueryRequest.getNamedQueryId(), NAMEDQUERYID_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 {
@Override
public boolean setParam(String name, Object value)
{
String sname = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
Method m;
try {
if (value instanceof Integer)
{
m = getClass().getMethod(sname, int.class);
m.invoke(this, value);
}
else if (value instanceof Double)
{
try {
m = getClass().getMethod(sname, float.class);
m.invoke(this, ((Double) value).floatValue());
} catch (NoSuchMethodException e) {
//no float version found, try the int version
m = getClass().getMethod(sname, int.class);
m.invoke(this, ((Double) value).intValue());
}
}
else if (value instanceof Float)
{
try {
m = getClass().getMethod(sname, float.class);
m.invoke(this, value);
} catch (NoSuchMethodException e) {
//no float version found, try the int version
m = getClass().getMethod(sname, int.class);
m.invoke(this, ((Double) value).intValue());
}
}
else if (value instanceof Boolean)
{
m = getClass().getMethod(sname, boolean.class);
m.invoke(this, value);
}
else
{
m = getClass().getMethod(sname, String.class);
m.invoke(this, value.toString());
}
return true;
} catch (NoSuchMethodException e) {
log.warn("Setting unknown parameter: " + e.getMessage());
return false;
} catch (IllegalAccessException e) {
e.printStackTrace();
return false;
} catch (IllegalArgumentException e) {
e.printStackTrace();
return false;
} catch (InvocationTargetException e) {
e.printStackTrace();
return false;
}
} } | public class class_name {
@Override
public boolean setParam(String name, Object value)
{
String sname = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
Method m;
try {
if (value instanceof Integer)
{
m = getClass().getMethod(sname, int.class); // depends on control dependency: [if], data = [none]
m.invoke(this, value); // depends on control dependency: [if], data = [none]
}
else if (value instanceof Double)
{
try {
m = getClass().getMethod(sname, float.class); // depends on control dependency: [try], data = [none]
m.invoke(this, ((Double) value).floatValue()); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
//no float version found, try the int version
m = getClass().getMethod(sname, int.class);
m.invoke(this, ((Double) value).intValue());
} // depends on control dependency: [catch], data = [none]
}
else if (value instanceof Float)
{
try {
m = getClass().getMethod(sname, float.class); // depends on control dependency: [try], data = [none]
m.invoke(this, value); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
//no float version found, try the int version
m = getClass().getMethod(sname, int.class);
m.invoke(this, ((Double) value).intValue());
} // depends on control dependency: [catch], data = [none]
}
else if (value instanceof Boolean)
{
m = getClass().getMethod(sname, boolean.class); // depends on control dependency: [if], data = [none]
m.invoke(this, value); // depends on control dependency: [if], data = [none]
}
else
{
m = getClass().getMethod(sname, String.class); // depends on control dependency: [if], data = [none]
m.invoke(this, value.toString()); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
log.warn("Setting unknown parameter: " + e.getMessage());
return false;
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
return false;
} catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
return false;
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public OutlierResult run(Relation<?> relation) {
WritableDoubleDataStore scores = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_HOT);
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
scores.putDouble(iditer, 0.0);
}
DoubleRelation scoreres = new MaterializedDoubleRelation("Trivial no-outlier score", "no-outlier", scores, relation.getDBIDs());
OutlierScoreMeta meta = new ProbabilisticOutlierScore();
return new OutlierResult(meta, scoreres);
} } | public class class_name {
public OutlierResult run(Relation<?> relation) {
WritableDoubleDataStore scores = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_HOT);
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
scores.putDouble(iditer, 0.0); // depends on control dependency: [for], data = [iditer]
}
DoubleRelation scoreres = new MaterializedDoubleRelation("Trivial no-outlier score", "no-outlier", scores, relation.getDBIDs());
OutlierScoreMeta meta = new ProbabilisticOutlierScore();
return new OutlierResult(meta, scoreres);
} } |
public class class_name {
CipherAndAuthTag retrieveMessageKeyAndAuthTag(OmemoDevice sender, OmemoElement element) throws CryptoFailedException,
NoRawSessionException {
int keyId = omemoManager.getDeviceId();
byte[] unpackedKey = null;
List<CryptoFailedException> decryptExceptions = new ArrayList<>();
List<OmemoKeyElement> keys = element.getHeader().getKeys();
boolean preKey = false;
// Find key with our ID.
for (OmemoKeyElement k : keys) {
if (k.getId() == keyId) {
try {
unpackedKey = doubleRatchetDecrypt(sender, k.getData());
preKey = k.isPreKey();
break;
} catch (CryptoFailedException e) {
// There might be multiple keys with our id, but we can only decrypt one.
// So we can't throw the exception, when decrypting the first duplicate which is not for us.
decryptExceptions.add(e);
} catch (CorruptedOmemoKeyException e) {
decryptExceptions.add(new CryptoFailedException(e));
} catch (UntrustedOmemoIdentityException e) {
LOGGER.log(Level.WARNING, "Received message from " + sender + " contained unknown identityKey. Ignore message.", e);
}
}
}
if (unpackedKey == null) {
if (!decryptExceptions.isEmpty()) {
throw MultipleCryptoFailedException.from(decryptExceptions);
}
throw new CryptoFailedException("Transported key could not be decrypted, since no suitable message key " +
"was provided. Provides keys: " + keys);
}
// Split in AES auth-tag and key
byte[] messageKey = new byte[16];
byte[] authTag = null;
if (unpackedKey.length == 32) {
authTag = new byte[16];
// copy key part into messageKey
System.arraycopy(unpackedKey, 0, messageKey, 0, 16);
// copy tag part into authTag
System.arraycopy(unpackedKey, 16, authTag, 0,16);
} else if (element.isKeyTransportElement() && unpackedKey.length == 16) {
messageKey = unpackedKey;
} else {
throw new CryptoFailedException("MessageKey has wrong length: "
+ unpackedKey.length + ". Probably legacy auth tag format.");
}
return new CipherAndAuthTag(messageKey, element.getHeader().getIv(), authTag, preKey);
} } | public class class_name {
CipherAndAuthTag retrieveMessageKeyAndAuthTag(OmemoDevice sender, OmemoElement element) throws CryptoFailedException,
NoRawSessionException {
int keyId = omemoManager.getDeviceId();
byte[] unpackedKey = null;
List<CryptoFailedException> decryptExceptions = new ArrayList<>();
List<OmemoKeyElement> keys = element.getHeader().getKeys();
boolean preKey = false;
// Find key with our ID.
for (OmemoKeyElement k : keys) {
if (k.getId() == keyId) {
try {
unpackedKey = doubleRatchetDecrypt(sender, k.getData()); // depends on control dependency: [try], data = [none]
preKey = k.isPreKey(); // depends on control dependency: [try], data = [none]
break;
} catch (CryptoFailedException e) {
// There might be multiple keys with our id, but we can only decrypt one.
// So we can't throw the exception, when decrypting the first duplicate which is not for us.
decryptExceptions.add(e);
} catch (CorruptedOmemoKeyException e) { // depends on control dependency: [catch], data = [none]
decryptExceptions.add(new CryptoFailedException(e));
} catch (UntrustedOmemoIdentityException e) { // depends on control dependency: [catch], data = [none]
LOGGER.log(Level.WARNING, "Received message from " + sender + " contained unknown identityKey. Ignore message.", e);
} // depends on control dependency: [catch], data = [none]
}
}
if (unpackedKey == null) {
if (!decryptExceptions.isEmpty()) {
throw MultipleCryptoFailedException.from(decryptExceptions);
}
throw new CryptoFailedException("Transported key could not be decrypted, since no suitable message key " +
"was provided. Provides keys: " + keys);
}
// Split in AES auth-tag and key
byte[] messageKey = new byte[16];
byte[] authTag = null;
if (unpackedKey.length == 32) {
authTag = new byte[16];
// copy key part into messageKey
System.arraycopy(unpackedKey, 0, messageKey, 0, 16);
// copy tag part into authTag
System.arraycopy(unpackedKey, 16, authTag, 0,16);
} else if (element.isKeyTransportElement() && unpackedKey.length == 16) {
messageKey = unpackedKey;
} else {
throw new CryptoFailedException("MessageKey has wrong length: "
+ unpackedKey.length + ". Probably legacy auth tag format.");
}
return new CipherAndAuthTag(messageKey, element.getHeader().getIv(), authTag, preKey);
} } |
public class class_name {
static <K, V> MapMakerInternalMap<K, V, ? extends InternalEntry<K, V, ?>, ?> create(
MapMaker builder) {
if (builder.getKeyStrength() == Strength.STRONG
&& builder.getValueStrength() == Strength.STRONG) {
return new MapMakerInternalMap<>(builder, StrongKeyStrongValueEntry.Helper.<K, V>instance());
}
if (builder.getKeyStrength() == Strength.STRONG
&& builder.getValueStrength() == Strength.WEAK) {
return new MapMakerInternalMap<>(builder, StrongKeyWeakValueEntry.Helper.<K, V>instance());
}
if (builder.getKeyStrength() == Strength.WEAK
&& builder.getValueStrength() == Strength.STRONG) {
return new MapMakerInternalMap<>(builder, WeakKeyStrongValueEntry.Helper.<K, V>instance());
}
if (builder.getKeyStrength() == Strength.WEAK && builder.getValueStrength() == Strength.WEAK) {
return new MapMakerInternalMap<>(builder, WeakKeyWeakValueEntry.Helper.<K, V>instance());
}
throw new AssertionError();
} } | public class class_name {
static <K, V> MapMakerInternalMap<K, V, ? extends InternalEntry<K, V, ?>, ?> create(
MapMaker builder) {
if (builder.getKeyStrength() == Strength.STRONG
&& builder.getValueStrength() == Strength.STRONG) {
return new MapMakerInternalMap<>(builder, StrongKeyStrongValueEntry.Helper.<K, V>instance()); // depends on control dependency: [if], data = [none]
}
if (builder.getKeyStrength() == Strength.STRONG
&& builder.getValueStrength() == Strength.WEAK) {
return new MapMakerInternalMap<>(builder, StrongKeyWeakValueEntry.Helper.<K, V>instance()); // depends on control dependency: [if], data = [none]
}
if (builder.getKeyStrength() == Strength.WEAK
&& builder.getValueStrength() == Strength.STRONG) {
return new MapMakerInternalMap<>(builder, WeakKeyStrongValueEntry.Helper.<K, V>instance()); // depends on control dependency: [if], data = [none]
}
if (builder.getKeyStrength() == Strength.WEAK && builder.getValueStrength() == Strength.WEAK) {
return new MapMakerInternalMap<>(builder, WeakKeyWeakValueEntry.Helper.<K, V>instance()); // depends on control dependency: [if], data = [none]
}
throw new AssertionError();
} } |
public class class_name {
private @Nonnull NodeList evaluate(String xpath) {
try {
XPathExpression expr = xpf.newXPath().compile(xpath);
return (NodeList) expr.evaluate(node, XPathConstants.NODESET);
} catch (XPathExpressionException ex) {
throw new IllegalArgumentException("Invalid XPath '" + xpath + "'", ex);
}
} } | public class class_name {
private @Nonnull NodeList evaluate(String xpath) {
try {
XPathExpression expr = xpf.newXPath().compile(xpath);
return (NodeList) expr.evaluate(node, XPathConstants.NODESET); // depends on control dependency: [try], data = [none]
} catch (XPathExpressionException ex) {
throw new IllegalArgumentException("Invalid XPath '" + xpath + "'", ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void addFragment(Fragment frag, String tag, FragmentAnimation animation, int flags, int containerId) {
if (frag != null) {
if ((!((FraggleFragment) frag).isSingleInstance()) || peek(tag) == null) {
FragmentTransaction ft = fm.beginTransaction();
processClearBackstack(flags);
processAddToBackstackFlag(tag, flags, ft);
processAnimations(animation, ft);
performTransaction(frag, flags, ft, containerId);
} else {
fm.popBackStack(tag, 0);
if (frag.getArguments() != null && !frag.getArguments().equals(((Fragment) peek(tag)).getArguments())) {
peek(tag).onNewArgumentsReceived(frag.getArguments());
}
peek(tag).onFragmentVisible();
}
}
} } | public class class_name {
public void addFragment(Fragment frag, String tag, FragmentAnimation animation, int flags, int containerId) {
if (frag != null) {
if ((!((FraggleFragment) frag).isSingleInstance()) || peek(tag) == null) {
FragmentTransaction ft = fm.beginTransaction();
processClearBackstack(flags); // depends on control dependency: [if], data = [none]
processAddToBackstackFlag(tag, flags, ft); // depends on control dependency: [if], data = [none]
processAnimations(animation, ft); // depends on control dependency: [if], data = [none]
performTransaction(frag, flags, ft, containerId); // depends on control dependency: [if], data = [none]
} else {
fm.popBackStack(tag, 0); // depends on control dependency: [if], data = [none]
if (frag.getArguments() != null && !frag.getArguments().equals(((Fragment) peek(tag)).getArguments())) {
peek(tag).onNewArgumentsReceived(frag.getArguments()); // depends on control dependency: [if], data = [(frag.getArguments()]
}
peek(tag).onFragmentVisible(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public final void ruleXImportDeclaration() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXtype.g:396:2: ( ( ( rule__XImportDeclaration__Group__0 ) ) )
// InternalXtype.g:397:2: ( ( rule__XImportDeclaration__Group__0 ) )
{
// InternalXtype.g:397:2: ( ( rule__XImportDeclaration__Group__0 ) )
// InternalXtype.g:398:3: ( rule__XImportDeclaration__Group__0 )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getXImportDeclarationAccess().getGroup());
}
// InternalXtype.g:399:3: ( rule__XImportDeclaration__Group__0 )
// InternalXtype.g:399:4: rule__XImportDeclaration__Group__0
{
pushFollow(FOLLOW_2);
rule__XImportDeclaration__Group__0();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getXImportDeclarationAccess().getGroup());
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} } | public class class_name {
public final void ruleXImportDeclaration() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXtype.g:396:2: ( ( ( rule__XImportDeclaration__Group__0 ) ) )
// InternalXtype.g:397:2: ( ( rule__XImportDeclaration__Group__0 ) )
{
// InternalXtype.g:397:2: ( ( rule__XImportDeclaration__Group__0 ) )
// InternalXtype.g:398:3: ( rule__XImportDeclaration__Group__0 )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getXImportDeclarationAccess().getGroup()); // depends on control dependency: [if], data = [none]
}
// InternalXtype.g:399:3: ( rule__XImportDeclaration__Group__0 )
// InternalXtype.g:399:4: rule__XImportDeclaration__Group__0
{
pushFollow(FOLLOW_2);
rule__XImportDeclaration__Group__0();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getXImportDeclarationAccess().getGroup()); // depends on control dependency: [if], data = [none]
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} } |
public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, Long adGroupId)
throws RemoteException {
// Get the AdGroupAdService.
AdGroupAdServiceInterface adGroupAdService =
adWordsServices.get(session, AdGroupAdServiceInterface.class);
int offset = 0;
// Create selector.
SelectorBuilder builder = new SelectorBuilder();
Selector selector =
builder
.fields(AdGroupAdField.Id, AdGroupAdField.PolicySummary)
.orderAscBy(AdGroupAdField.Id)
.equals(AdGroupAdField.AdGroupId, adGroupId.toString())
.equals(
AdGroupAdField.CombinedApprovalStatus,
PolicyApprovalStatus.DISAPPROVED.toString())
.offset(offset)
.limit(PAGE_SIZE)
.build();
// Get all disapproved ads.
AdGroupAdPage page = null;
int disapprovedAdsCount = 0;
do {
page = adGroupAdService.get(selector);
// Display ads.
for (AdGroupAd adGroupAd : page) {
disapprovedAdsCount++;
AdGroupAdPolicySummary policySummary = adGroupAd.getPolicySummary();
System.out.printf(
"Ad with ID %d and type '%s' was disapproved with the following "
+ "policy topic entries:%n",
adGroupAd.getAd().getId(), adGroupAd.getAd().getAdType());
// Display the policy topic entries related to the ad disapproval.
for (PolicyTopicEntry policyTopicEntry : policySummary.getPolicyTopicEntries()) {
System.out.printf(
" topic id: %s, topic name: '%s', Help Center URL: %s%n",
policyTopicEntry.getPolicyTopicId(),
policyTopicEntry.getPolicyTopicName(),
policyTopicEntry.getPolicyTopicHelpCenterUrl());
// Display the attributes and values that triggered the policy topic.
if (policyTopicEntry.getPolicyTopicEvidences() != null) {
for (PolicyTopicEvidence evidence : policyTopicEntry.getPolicyTopicEvidences()) {
System.out.printf(" evidence type: %s%n", evidence.getPolicyTopicEvidenceType());
if (evidence.getEvidenceTextList() != null) {
for (int i = 0; i < evidence.getEvidenceTextList().length; i++) {
System.out.printf(
" evidence text[%d]: %s%n", i, evidence.getEvidenceTextList(i));
}
}
}
}
}
}
offset += PAGE_SIZE;
selector = builder.increaseOffsetBy(PAGE_SIZE).build();
} while (offset < page.getTotalNumEntries());
System.out.printf("%d disapproved ads were found.%n", disapprovedAdsCount);
} } | public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, Long adGroupId)
throws RemoteException {
// Get the AdGroupAdService.
AdGroupAdServiceInterface adGroupAdService =
adWordsServices.get(session, AdGroupAdServiceInterface.class);
int offset = 0;
// Create selector.
SelectorBuilder builder = new SelectorBuilder();
Selector selector =
builder
.fields(AdGroupAdField.Id, AdGroupAdField.PolicySummary)
.orderAscBy(AdGroupAdField.Id)
.equals(AdGroupAdField.AdGroupId, adGroupId.toString())
.equals(
AdGroupAdField.CombinedApprovalStatus,
PolicyApprovalStatus.DISAPPROVED.toString())
.offset(offset)
.limit(PAGE_SIZE)
.build();
// Get all disapproved ads.
AdGroupAdPage page = null;
int disapprovedAdsCount = 0;
do {
page = adGroupAdService.get(selector);
// Display ads.
for (AdGroupAd adGroupAd : page) {
disapprovedAdsCount++; // depends on control dependency: [for], data = [none]
AdGroupAdPolicySummary policySummary = adGroupAd.getPolicySummary();
System.out.printf(
"Ad with ID %d and type '%s' was disapproved with the following "
+ "policy topic entries:%n",
adGroupAd.getAd().getId(), adGroupAd.getAd().getAdType()); // depends on control dependency: [for], data = [none]
// Display the policy topic entries related to the ad disapproval.
for (PolicyTopicEntry policyTopicEntry : policySummary.getPolicyTopicEntries()) {
System.out.printf(
" topic id: %s, topic name: '%s', Help Center URL: %s%n",
policyTopicEntry.getPolicyTopicId(),
policyTopicEntry.getPolicyTopicName(),
policyTopicEntry.getPolicyTopicHelpCenterUrl()); // depends on control dependency: [for], data = [none]
// Display the attributes and values that triggered the policy topic.
if (policyTopicEntry.getPolicyTopicEvidences() != null) {
for (PolicyTopicEvidence evidence : policyTopicEntry.getPolicyTopicEvidences()) {
System.out.printf(" evidence type: %s%n", evidence.getPolicyTopicEvidenceType()); // depends on control dependency: [for], data = [evidence]
if (evidence.getEvidenceTextList() != null) {
for (int i = 0; i < evidence.getEvidenceTextList().length; i++) {
System.out.printf(
" evidence text[%d]: %s%n", i, evidence.getEvidenceTextList(i)); // depends on control dependency: [for], data = [none]
}
}
}
}
}
}
offset += PAGE_SIZE;
selector = builder.increaseOffsetBy(PAGE_SIZE).build();
} while (offset < page.getTotalNumEntries());
System.out.printf("%d disapproved ads were found.%n", disapprovedAdsCount);
} } |
public class class_name {
@SuppressWarnings("rawtypes")
@Override
public boolean getIsEmpty() {
if (m_object == null) {
// this is the case for non existing values
return true;
} else if (m_object instanceof String) {
// return values for String
return CmsStringUtil.isEmpty((String)m_object);
} else if (m_object instanceof Collection) {
// if a collection has any entries it is not emtpy
return !((Collection)m_object).isEmpty();
} else {
// assume all other non-null objects are not empty
return false;
}
} } | public class class_name {
@SuppressWarnings("rawtypes")
@Override
public boolean getIsEmpty() {
if (m_object == null) {
// this is the case for non existing values
return true; // depends on control dependency: [if], data = [none]
} else if (m_object instanceof String) {
// return values for String
return CmsStringUtil.isEmpty((String)m_object); // depends on control dependency: [if], data = [none]
} else if (m_object instanceof Collection) {
// if a collection has any entries it is not emtpy
return !((Collection)m_object).isEmpty(); // depends on control dependency: [if], data = [none]
} else {
// assume all other non-null objects are not empty
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private ReqlFunction1 parseAndBuildFilters(EntityType entityType, Expression whereExp)
{
if (whereExp instanceof ComparisonExpression)
{
String left = ((ComparisonExpression) whereExp).getLeftExpression().toActualText();
String right = ((ComparisonExpression) whereExp).getRightExpression().toActualText();
right = right.replaceAll("['\"]", "");
if (right.startsWith(POSITIONAL_PREFIX) || right.startsWith(PARAMETERIZED_PREFIX))
{
right = kunderaQuery.getParametersMap().get(right) + "";
}
Attribute attribute = entityType.getAttribute(left.split(DOT_REGEX)[1]);
boolean isId = ((Field) attribute.getJavaMember()).isAnnotationPresent(Id.class);
return buildFunction(isId ? ID : ((AbstractAttribute) attribute).getJPAColumnName(),
ConvertUtils.convert(right, attribute.getJavaType()),
((ComparisonExpression) whereExp).getActualIdentifier());
}
else
{
logger.error("Operation not supported");
throw new KunderaException("Operation not supported");
}
} } | public class class_name {
private ReqlFunction1 parseAndBuildFilters(EntityType entityType, Expression whereExp)
{
if (whereExp instanceof ComparisonExpression)
{
String left = ((ComparisonExpression) whereExp).getLeftExpression().toActualText();
String right = ((ComparisonExpression) whereExp).getRightExpression().toActualText();
right = right.replaceAll("['\"]", ""); // depends on control dependency: [if], data = [none]
if (right.startsWith(POSITIONAL_PREFIX) || right.startsWith(PARAMETERIZED_PREFIX))
{
right = kunderaQuery.getParametersMap().get(right) + ""; // depends on control dependency: [if], data = [none]
}
Attribute attribute = entityType.getAttribute(left.split(DOT_REGEX)[1]);
boolean isId = ((Field) attribute.getJavaMember()).isAnnotationPresent(Id.class);
return buildFunction(isId ? ID : ((AbstractAttribute) attribute).getJPAColumnName(),
ConvertUtils.convert(right, attribute.getJavaType()),
((ComparisonExpression) whereExp).getActualIdentifier()); // depends on control dependency: [if], data = [none]
}
else
{
logger.error("Operation not supported"); // depends on control dependency: [if], data = [none]
throw new KunderaException("Operation not supported");
}
} } |
public class class_name {
void resetStatistics(boolean clearHistory) {
lastTimerPop = System.currentTimeMillis();
previousCompleted = threadPool == null ? 0 : threadPool.getCompletedTaskCount();
previousThroughput = 0;
consecutiveQueueEmptyCount = 0;
consecutiveNoAdjustment = 0;
consecutiveOutlierAfterAdjustment = 0;
consecutiveIdleCount = 0;
if (clearHistory) {
threadStats = new TreeMap<Integer, ThroughputDistribution>();
}
lastAction = LastAction.NONE;
} } | public class class_name {
void resetStatistics(boolean clearHistory) {
lastTimerPop = System.currentTimeMillis();
previousCompleted = threadPool == null ? 0 : threadPool.getCompletedTaskCount();
previousThroughput = 0;
consecutiveQueueEmptyCount = 0;
consecutiveNoAdjustment = 0;
consecutiveOutlierAfterAdjustment = 0;
consecutiveIdleCount = 0;
if (clearHistory) {
threadStats = new TreeMap<Integer, ThroughputDistribution>(); // depends on control dependency: [if], data = [none]
}
lastAction = LastAction.NONE;
} } |
public class class_name {
public final boolean tryLockForWrite(L locker) {
int state = mState;
if (state == 0) {
// no locks are held
if (isUpgradeOrReadWriteFirst() && setWriteLock(state)) {
// keep upgrade state bit clear to indicate automatic upgrade
mOwner = locker;
incrementUpgradeCount();
incrementWriteCount();
return true;
}
} else if (state == LOCK_STATE_UPGRADE) {
// only upgrade lock is held; upgrade to full write lock
if (mOwner == locker && setWriteLock(state)) {
incrementWriteCount();
return true;
}
} else if (state < 0) {
// write lock is held, and upgrade lock might be held too
if (mOwner == locker) {
incrementWriteCount();
return true;
}
}
return false;
} } | public class class_name {
public final boolean tryLockForWrite(L locker) {
int state = mState;
if (state == 0) {
// no locks are held
if (isUpgradeOrReadWriteFirst() && setWriteLock(state)) {
// keep upgrade state bit clear to indicate automatic upgrade
mOwner = locker;
// depends on control dependency: [if], data = [none]
incrementUpgradeCount();
// depends on control dependency: [if], data = [none]
incrementWriteCount();
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
}
} else if (state == LOCK_STATE_UPGRADE) {
// only upgrade lock is held; upgrade to full write lock
if (mOwner == locker && setWriteLock(state)) {
incrementWriteCount();
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
}
} else if (state < 0) {
// write lock is held, and upgrade lock might be held too
if (mOwner == locker) {
incrementWriteCount();
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static ConnectionProperties build(final Map<String, ?> properties) {
Validate.notNull(properties, "The validated object 'properties' is null");
// tmpConfig now holds all the configuration values with the keys expected by the Util libs connection
// properties builder. We will let that library do all the hard work of setting reasonable defaults and
// dealing with null values.
// For this, we first try to copy the entire map to a Map<String, String> map (because this is what the builder
// we will be using requires), and then ALSO copy the values that are in the Map and that we care about to the
// same map, potentially overwriting values that may already be there (e.g. if the user has configured them
// under a key that coincidentally collides with a key that we care about).
final Map<String, String> tmpConfig = new ConcurrentHashMap<>();
// first try to copy all the values in the map. We know that they are all of the same type, but we do not know
// what that type is. Let's reasonably assume that they are Strings (not sure if the JAAS configuration
// mechanism allows anything else), and just cast them. If the cast fails, we will fail the entire operation:
try {
for (final Map.Entry<String, ?> entry : properties.entrySet()) {
final String key = entry.getKey();
final String value = (String) entry.getValue();
if (value != null) {
tmpConfig.put(key, value);
}
}
} catch (ClassCastException e) {
final String error = "The values of the configured JAAS properties must be Strings. "
+ "Sorry, but we do not support anything else here!";
throw new IllegalArgumentException(error, e);
}
// second, we copy the values that we care about from the "JAAS config namespace" to the "Connection namespace":
copyValue(properties, KEY_DRIVER, tmpConfig, MapBasedConnPropsBuilder.KEY_DRIVER);
copyValue(properties, KEY_URL, tmpConfig, MapBasedConnPropsBuilder.KEY_URL);
copyValue(properties, KEY_USERNAME, tmpConfig, MapBasedConnPropsBuilder.KEY_USERNAME);
copyValue(properties, KEY_PASSWORD, tmpConfig, MapBasedConnPropsBuilder.KEY_PASSWORD);
copyValue(properties, KEY_MAX_TOTAL, tmpConfig, MapBasedConnPropsBuilder.KEY_MAX_TOTAL);
copyValue(properties, KEY_MAX_IDLE, tmpConfig, MapBasedConnPropsBuilder.KEY_MAX_IDLE);
copyValue(properties, KEY_MIN_IDLE, tmpConfig, MapBasedConnPropsBuilder.KEY_MIN_IDLE);
copyValue(properties, KEY_MAX_WAIT_MILLIS, tmpConfig, MapBasedConnPropsBuilder.KEY_MAX_WAIT_MILLIS);
copyValue(properties, KEY_TEST_ON_CREATE, tmpConfig, MapBasedConnPropsBuilder.KEY_TEST_ON_CREATE);
copyValue(properties, KEY_TEST_ON_BORROW, tmpConfig, MapBasedConnPropsBuilder.KEY_TEST_ON_BORROW);
copyValue(properties, KEY_TEST_ON_RETURN, tmpConfig, MapBasedConnPropsBuilder.KEY_TEST_ON_RETURN);
copyValue(properties, KEY_TEST_WHILE_IDLE, tmpConfig, MapBasedConnPropsBuilder.KEY_TEST_WHILE_IDLE);
copyValue(properties, KEY_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
tmpConfig, MapBasedConnPropsBuilder.KEY_TIME_BETWEEN_EVICTION_RUNS_MILLIS);
copyValue(properties, KEY_NUM_TESTS_PER_EVICITON_RUN,
tmpConfig, MapBasedConnPropsBuilder.KEY_NUM_TESTS_PER_EVICITON_RUN);
copyValue(properties, KEY_MIN_EVICTABLE_IDLE_TIME_MILLIS,
tmpConfig, MapBasedConnPropsBuilder.KEY_MIN_EVICTABLE_IDLE_TIME_MILLIS);
copyValue(properties, KEY_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
tmpConfig, MapBasedConnPropsBuilder.KEY_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS);
copyValue(properties, KEY_LIFO, tmpConfig, MapBasedConnPropsBuilder.KEY_LIFO);
copyValue(properties, KEY_AUTO_COMMIT, tmpConfig, MapBasedConnPropsBuilder.KEY_AUTO_COMMIT);
copyValue(properties, KEY_READ_ONLY, tmpConfig, MapBasedConnPropsBuilder.KEY_READ_ONLY);
copyValue(properties, KEY_TRANSACTION_ISOLATION, tmpConfig, MapBasedConnPropsBuilder.KEY_TRANSACTION_ISOLATION);
copyValue(properties, KEY_CACHE_STATE, tmpConfig, MapBasedConnPropsBuilder.KEY_CACHE_STATE);
copyValue(properties, KEY_VALIDATION_QUERY, tmpConfig, MapBasedConnPropsBuilder.KEY_VALIDATION_QUERY);
copyValue(properties, KEY_MAX_CONN_LIFETIME_MILLIS,
tmpConfig, MapBasedConnPropsBuilder.KEY_MAX_CONN_LIFETIME_MILLIS);
return MapBasedConnPropsBuilder.build(tmpConfig);
} } | public class class_name {
public static ConnectionProperties build(final Map<String, ?> properties) {
Validate.notNull(properties, "The validated object 'properties' is null");
// tmpConfig now holds all the configuration values with the keys expected by the Util libs connection
// properties builder. We will let that library do all the hard work of setting reasonable defaults and
// dealing with null values.
// For this, we first try to copy the entire map to a Map<String, String> map (because this is what the builder
// we will be using requires), and then ALSO copy the values that are in the Map and that we care about to the
// same map, potentially overwriting values that may already be there (e.g. if the user has configured them
// under a key that coincidentally collides with a key that we care about).
final Map<String, String> tmpConfig = new ConcurrentHashMap<>();
// first try to copy all the values in the map. We know that they are all of the same type, but we do not know
// what that type is. Let's reasonably assume that they are Strings (not sure if the JAAS configuration
// mechanism allows anything else), and just cast them. If the cast fails, we will fail the entire operation:
try {
for (final Map.Entry<String, ?> entry : properties.entrySet()) {
final String key = entry.getKey();
final String value = (String) entry.getValue();
if (value != null) {
tmpConfig.put(key, value); // depends on control dependency: [if], data = [none]
}
}
} catch (ClassCastException e) {
final String error = "The values of the configured JAAS properties must be Strings. "
+ "Sorry, but we do not support anything else here!";
throw new IllegalArgumentException(error, e);
}
// second, we copy the values that we care about from the "JAAS config namespace" to the "Connection namespace":
copyValue(properties, KEY_DRIVER, tmpConfig, MapBasedConnPropsBuilder.KEY_DRIVER);
copyValue(properties, KEY_URL, tmpConfig, MapBasedConnPropsBuilder.KEY_URL);
copyValue(properties, KEY_USERNAME, tmpConfig, MapBasedConnPropsBuilder.KEY_USERNAME);
copyValue(properties, KEY_PASSWORD, tmpConfig, MapBasedConnPropsBuilder.KEY_PASSWORD);
copyValue(properties, KEY_MAX_TOTAL, tmpConfig, MapBasedConnPropsBuilder.KEY_MAX_TOTAL);
copyValue(properties, KEY_MAX_IDLE, tmpConfig, MapBasedConnPropsBuilder.KEY_MAX_IDLE);
copyValue(properties, KEY_MIN_IDLE, tmpConfig, MapBasedConnPropsBuilder.KEY_MIN_IDLE);
copyValue(properties, KEY_MAX_WAIT_MILLIS, tmpConfig, MapBasedConnPropsBuilder.KEY_MAX_WAIT_MILLIS);
copyValue(properties, KEY_TEST_ON_CREATE, tmpConfig, MapBasedConnPropsBuilder.KEY_TEST_ON_CREATE);
copyValue(properties, KEY_TEST_ON_BORROW, tmpConfig, MapBasedConnPropsBuilder.KEY_TEST_ON_BORROW);
copyValue(properties, KEY_TEST_ON_RETURN, tmpConfig, MapBasedConnPropsBuilder.KEY_TEST_ON_RETURN);
copyValue(properties, KEY_TEST_WHILE_IDLE, tmpConfig, MapBasedConnPropsBuilder.KEY_TEST_WHILE_IDLE);
copyValue(properties, KEY_TIME_BETWEEN_EVICTION_RUNS_MILLIS,
tmpConfig, MapBasedConnPropsBuilder.KEY_TIME_BETWEEN_EVICTION_RUNS_MILLIS);
copyValue(properties, KEY_NUM_TESTS_PER_EVICITON_RUN,
tmpConfig, MapBasedConnPropsBuilder.KEY_NUM_TESTS_PER_EVICITON_RUN);
copyValue(properties, KEY_MIN_EVICTABLE_IDLE_TIME_MILLIS,
tmpConfig, MapBasedConnPropsBuilder.KEY_MIN_EVICTABLE_IDLE_TIME_MILLIS);
copyValue(properties, KEY_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS,
tmpConfig, MapBasedConnPropsBuilder.KEY_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS);
copyValue(properties, KEY_LIFO, tmpConfig, MapBasedConnPropsBuilder.KEY_LIFO);
copyValue(properties, KEY_AUTO_COMMIT, tmpConfig, MapBasedConnPropsBuilder.KEY_AUTO_COMMIT);
copyValue(properties, KEY_READ_ONLY, tmpConfig, MapBasedConnPropsBuilder.KEY_READ_ONLY);
copyValue(properties, KEY_TRANSACTION_ISOLATION, tmpConfig, MapBasedConnPropsBuilder.KEY_TRANSACTION_ISOLATION);
copyValue(properties, KEY_CACHE_STATE, tmpConfig, MapBasedConnPropsBuilder.KEY_CACHE_STATE);
copyValue(properties, KEY_VALIDATION_QUERY, tmpConfig, MapBasedConnPropsBuilder.KEY_VALIDATION_QUERY);
copyValue(properties, KEY_MAX_CONN_LIFETIME_MILLIS,
tmpConfig, MapBasedConnPropsBuilder.KEY_MAX_CONN_LIFETIME_MILLIS);
return MapBasedConnPropsBuilder.build(tmpConfig);
} } |
public class class_name {
public static Map<String, Map<String, String>> parseComplexArrayStructure(String configPrefix) {
Configuration configuration = ConfigurationFactory.getConfiguration();
Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>();
// get a subset of the configuration based on the config prefix.
final Configuration subset = configuration.subset(configPrefix);
@SuppressWarnings("unchecked")
final Iterator<String> keys = subset.getKeys();
while (keys.hasNext()) {
final String key = keys.next();
final String mapKey = stripKey(key);
// only if the map key is not null and contains the above saved
// criteria key do we want to handle this.
if (mapKey != null) {
// first time only - create the inner map instance
if (!result.containsKey(mapKey)) {
result.put(mapKey, new HashMap<String, String>());
}
// get the inner map key value.
final String innerMapKey = getInnerMapKey(key);
// update the reply map format.
result.get(mapKey).put(innerMapKey, subset.getString(key));
}
}
return result;
} } | public class class_name {
public static Map<String, Map<String, String>> parseComplexArrayStructure(String configPrefix) {
Configuration configuration = ConfigurationFactory.getConfiguration();
Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>();
// get a subset of the configuration based on the config prefix.
final Configuration subset = configuration.subset(configPrefix);
@SuppressWarnings("unchecked")
final Iterator<String> keys = subset.getKeys();
while (keys.hasNext()) {
final String key = keys.next();
final String mapKey = stripKey(key);
// only if the map key is not null and contains the above saved
// criteria key do we want to handle this.
if (mapKey != null) {
// first time only - create the inner map instance
if (!result.containsKey(mapKey)) {
result.put(mapKey, new HashMap<String, String>()); // depends on control dependency: [if], data = [none]
}
// get the inner map key value.
final String innerMapKey = getInnerMapKey(key);
// update the reply map format.
result.get(mapKey).put(innerMapKey, subset.getString(key)); // depends on control dependency: [if], data = [(mapKey]
}
}
return result;
} } |
public class class_name {
public void setTagFilters(java.util.Collection<EC2TagFilter> tagFilters) {
if (tagFilters == null) {
this.tagFilters = null;
return;
}
this.tagFilters = new com.amazonaws.internal.SdkInternalList<EC2TagFilter>(tagFilters);
} } | public class class_name {
public void setTagFilters(java.util.Collection<EC2TagFilter> tagFilters) {
if (tagFilters == null) {
this.tagFilters = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.tagFilters = new com.amazonaws.internal.SdkInternalList<EC2TagFilter>(tagFilters);
} } |
public class class_name {
public boolean permissionsContainOwnKeyword(User user, ParaObject object) {
if (user == null || object == null) {
return false;
}
String resourcePath1 = object.getType();
String resourcePath2 = object.getObjectURI().substring(1); // remove first '/'
String resourcePath3 = object.getPlural();
return hasOwnKeyword(App.ALLOW_ALL, resourcePath1)
|| hasOwnKeyword(App.ALLOW_ALL, resourcePath2)
|| hasOwnKeyword(App.ALLOW_ALL, resourcePath3)
|| hasOwnKeyword(user.getId(), resourcePath1)
|| hasOwnKeyword(user.getId(), resourcePath2)
|| hasOwnKeyword(user.getId(), resourcePath3);
} } | public class class_name {
public boolean permissionsContainOwnKeyword(User user, ParaObject object) {
if (user == null || object == null) {
return false; // depends on control dependency: [if], data = [none]
}
String resourcePath1 = object.getType();
String resourcePath2 = object.getObjectURI().substring(1); // remove first '/'
String resourcePath3 = object.getPlural();
return hasOwnKeyword(App.ALLOW_ALL, resourcePath1)
|| hasOwnKeyword(App.ALLOW_ALL, resourcePath2)
|| hasOwnKeyword(App.ALLOW_ALL, resourcePath3)
|| hasOwnKeyword(user.getId(), resourcePath1)
|| hasOwnKeyword(user.getId(), resourcePath2)
|| hasOwnKeyword(user.getId(), resourcePath3);
} } |
public class class_name {
public void exit(Object monitor) {
if (monitor == null) {
throw new NullPointerException();
}
// remove last
ListIterator it = monitors.listIterator(monitors.size());
while (it.hasPrevious()) {
Object prev = it.previous();
if (monitor == prev) { // Never use equals() to test equality. We always need to make sure that the objects are the same, we
// don't care if they're the objects are logically equivalent
it.remove();
return;
}
}
throw new IllegalArgumentException(); // not found
} } | public class class_name {
public void exit(Object monitor) {
if (monitor == null) {
throw new NullPointerException();
}
// remove last
ListIterator it = monitors.listIterator(monitors.size());
while (it.hasPrevious()) {
Object prev = it.previous();
if (monitor == prev) { // Never use equals() to test equality. We always need to make sure that the objects are the same, we
// don't care if they're the objects are logically equivalent
it.remove(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
throw new IllegalArgumentException(); // not found
} } |
public class class_name {
private final void waitForActivityIfNotAvailable(){
if(activityStack.isEmpty() || activityStack.peek().get() == null){
if (activityMonitor != null) {
Activity activity = activityMonitor.getLastActivity();
while (activity == null){
sleeper.sleepMini();
activity = activityMonitor.getLastActivity();
}
addActivityToStack(activity);
}
else if(config.trackActivities){
sleeper.sleepMini();
setupActivityMonitor();
waitForActivityIfNotAvailable();
}
}
} } | public class class_name {
private final void waitForActivityIfNotAvailable(){
if(activityStack.isEmpty() || activityStack.peek().get() == null){
if (activityMonitor != null) {
Activity activity = activityMonitor.getLastActivity();
while (activity == null){
sleeper.sleepMini(); // depends on control dependency: [while], data = [none]
activity = activityMonitor.getLastActivity(); // depends on control dependency: [while], data = [none]
}
addActivityToStack(activity); // depends on control dependency: [if], data = [none]
}
else if(config.trackActivities){
sleeper.sleepMini(); // depends on control dependency: [if], data = [none]
setupActivityMonitor(); // depends on control dependency: [if], data = [none]
waitForActivityIfNotAvailable(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void handleExpansionRequest(final Request request) {
String[] paramValue = request.getParameterValues(getId() + ".expanded");
if (paramValue == null) {
paramValue = new String[0];
}
String[] expandedRows = removeEmptyStrings(paramValue);
List<Integer> oldExpansions = getExpandedRows();
List<Integer> expansions;
TableDataModel model = getDataModel();
if (model.getRowCount() == 0) {
setExpandedRows(new ArrayList<Integer>());
return;
} else if (getPaginationMode() == PaginationMode.NONE
|| getPaginationMode() == PaginationMode.CLIENT
|| oldExpansions == null) {
expansions = new ArrayList<>(expandedRows.length);
} else {
// row expansions only apply to the current page
expansions = new ArrayList<>(oldExpansions);
int startRow = getCurrentPageStartRow();
int endRow = getCurrentPageEndRow();
expansions.removeAll(getRowIds(startRow, endRow));
}
for (String expandedRow : expandedRows) {
try {
expansions.add(Integer.parseInt(expandedRow));
} catch (NumberFormatException e) {
LOG.warn("Invalid row id for expansion: " + expandedRow);
}
}
// For tree tables, we also have to tell the nodes to expand themselves
if (model instanceof TreeTableDataModel) {
TreeTableDataModel treeModel = (TreeTableDataModel) model;
// We need the expanded indices sorted, as expanding/collapsing sections alters row indices
Collections.sort(expansions);
for (int row = 0; row < treeModel.getRowCount(); row++) {
for (Iterator<TreeNode> i = treeModel.getNodeAtLine(row).depthFirst(); i.hasNext();) {
TableTreeNode node = (TableTreeNode) i.next();
node.setExpanded(false);
}
}
for (int i = expansions.size() - 1; i >= 0; i--) {
treeModel.getNodeAtLine(expansions.get(i)).setExpanded(true);
}
}
setExpandedRows(expansions);
} } | public class class_name {
private void handleExpansionRequest(final Request request) {
String[] paramValue = request.getParameterValues(getId() + ".expanded");
if (paramValue == null) {
paramValue = new String[0]; // depends on control dependency: [if], data = [none]
}
String[] expandedRows = removeEmptyStrings(paramValue);
List<Integer> oldExpansions = getExpandedRows();
List<Integer> expansions;
TableDataModel model = getDataModel();
if (model.getRowCount() == 0) {
setExpandedRows(new ArrayList<Integer>()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else if (getPaginationMode() == PaginationMode.NONE
|| getPaginationMode() == PaginationMode.CLIENT
|| oldExpansions == null) {
expansions = new ArrayList<>(expandedRows.length); // depends on control dependency: [if], data = [none]
} else {
// row expansions only apply to the current page
expansions = new ArrayList<>(oldExpansions); // depends on control dependency: [if], data = [none]
int startRow = getCurrentPageStartRow();
int endRow = getCurrentPageEndRow();
expansions.removeAll(getRowIds(startRow, endRow)); // depends on control dependency: [if], data = [none]
}
for (String expandedRow : expandedRows) {
try {
expansions.add(Integer.parseInt(expandedRow)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
LOG.warn("Invalid row id for expansion: " + expandedRow);
} // depends on control dependency: [catch], data = [none]
}
// For tree tables, we also have to tell the nodes to expand themselves
if (model instanceof TreeTableDataModel) {
TreeTableDataModel treeModel = (TreeTableDataModel) model;
// We need the expanded indices sorted, as expanding/collapsing sections alters row indices
Collections.sort(expansions); // depends on control dependency: [if], data = [none]
for (int row = 0; row < treeModel.getRowCount(); row++) {
for (Iterator<TreeNode> i = treeModel.getNodeAtLine(row).depthFirst(); i.hasNext();) {
TableTreeNode node = (TableTreeNode) i.next();
node.setExpanded(false); // depends on control dependency: [for], data = [none]
}
}
for (int i = expansions.size() - 1; i >= 0; i--) {
treeModel.getNodeAtLine(expansions.get(i)).setExpanded(true); // depends on control dependency: [for], data = [i]
}
}
setExpandedRows(expansions);
} } |
public class class_name {
public RouteResult<T> route(HttpMethod method, String uri) {
MethodlessRouter<T> router = routers.get(method);
if (router == null) {
router = anyMethodRouter;
}
QueryStringDecoder decoder = new QueryStringDecoder(uri);
String[] tokens = decodePathTokens(uri);
RouteResult<T> ret = router.route(uri, decoder.path(), tokens);
if (ret != null) {
return new RouteResult<T>(uri, decoder.path(), ret.pathParams(), decoder.parameters(), ret.target());
}
if (router != anyMethodRouter) {
ret = anyMethodRouter.route(uri, decoder.path(), tokens);
if (ret != null) {
return new RouteResult<T>(uri, decoder.path(), ret.pathParams(), decoder.parameters(), ret.target());
}
}
if (notFound != null) {
return new RouteResult<T>(uri, decoder.path(), Collections.<String, String>emptyMap(), decoder.parameters(), notFound);
}
return null;
} } | public class class_name {
public RouteResult<T> route(HttpMethod method, String uri) {
MethodlessRouter<T> router = routers.get(method);
if (router == null) {
router = anyMethodRouter; // depends on control dependency: [if], data = [none]
}
QueryStringDecoder decoder = new QueryStringDecoder(uri);
String[] tokens = decodePathTokens(uri);
RouteResult<T> ret = router.route(uri, decoder.path(), tokens);
if (ret != null) {
return new RouteResult<T>(uri, decoder.path(), ret.pathParams(), decoder.parameters(), ret.target()); // depends on control dependency: [if], data = [none]
}
if (router != anyMethodRouter) {
ret = anyMethodRouter.route(uri, decoder.path(), tokens); // depends on control dependency: [if], data = [none]
if (ret != null) {
return new RouteResult<T>(uri, decoder.path(), ret.pathParams(), decoder.parameters(), ret.target()); // depends on control dependency: [if], data = [none]
}
}
if (notFound != null) {
return new RouteResult<T>(uri, decoder.path(), Collections.<String, String>emptyMap(), decoder.parameters(), notFound); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void notifyOfTaskAssignment(long taskId, long nextExecTime, short binaryFlags, int transactionTimeout) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
Boolean previous = inMemoryTaskIds.put(taskId, Boolean.TRUE);
if (previous == null) {
InvokerTask task = new InvokerTask(this, taskId, nextExecTime, binaryFlags, transactionTimeout);
long delay = nextExecTime - new Date().getTime();
if (trace && tc.isDebugEnabled())
Tr.debug(PersistentExecutorImpl.this, tc, "Found task " + taskId + " for " + delay + "ms from now");
scheduledExecutor.schedule(task, delay, TimeUnit.MILLISECONDS);
} else {
if (trace && tc.isDebugEnabled())
Tr.debug(PersistentExecutorImpl.this, tc, "Found task " + taskId + " already scheduled");
}
} } | public class class_name {
public void notifyOfTaskAssignment(long taskId, long nextExecTime, short binaryFlags, int transactionTimeout) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
Boolean previous = inMemoryTaskIds.put(taskId, Boolean.TRUE);
if (previous == null) {
InvokerTask task = new InvokerTask(this, taskId, nextExecTime, binaryFlags, transactionTimeout);
long delay = nextExecTime - new Date().getTime();
if (trace && tc.isDebugEnabled())
Tr.debug(PersistentExecutorImpl.this, tc, "Found task " + taskId + " for " + delay + "ms from now");
scheduledExecutor.schedule(task, delay, TimeUnit.MILLISECONDS); // depends on control dependency: [if], data = [none]
} else {
if (trace && tc.isDebugEnabled())
Tr.debug(PersistentExecutorImpl.this, tc, "Found task " + taskId + " already scheduled");
}
} } |
public class class_name {
@Override
public void visit(final int version, final int access, final String name,
final String signature, final String superName,
final String[] interfaces) {
super.visit(Opcodes.V1_2, access, name, null, superName, interfaces);
int index = name.lastIndexOf('/');
if (index > 0) {
pkgName = name.substring(0, index);
} else {
pkgName = "";
}
clsName = name;
isInterface = (access & Opcodes.ACC_INTERFACE) != 0;
} } | public class class_name {
@Override
public void visit(final int version, final int access, final String name,
final String signature, final String superName,
final String[] interfaces) {
super.visit(Opcodes.V1_2, access, name, null, superName, interfaces);
int index = name.lastIndexOf('/');
if (index > 0) {
pkgName = name.substring(0, index); // depends on control dependency: [if], data = [none]
} else {
pkgName = ""; // depends on control dependency: [if], data = [none]
}
clsName = name;
isInterface = (access & Opcodes.ACC_INTERFACE) != 0;
} } |
public class class_name {
public SwaggerWebAppFraction addWebContent(String content) {
if (content == null) return this;
if (content.equals("")) return this;
File maybeFile = new File(content);
if (!maybeFile.exists()) {
// the content string is a GAV
try {
this.webContent = Swarm.artifact(content);
} catch (Exception e) {
e.printStackTrace();
}
} else if (maybeFile.isDirectory()) {
try {
this.webContent = loadFromDirectory(maybeFile);
} catch (IOException e) {
e.printStackTrace();
}
} else {
this.webContent = ShrinkWrap.createFromZipFile(JARArchive.class, maybeFile);
}
return this;
} } | public class class_name {
public SwaggerWebAppFraction addWebContent(String content) {
if (content == null) return this;
if (content.equals("")) return this;
File maybeFile = new File(content);
if (!maybeFile.exists()) {
// the content string is a GAV
try {
this.webContent = Swarm.artifact(content); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} else if (maybeFile.isDirectory()) {
try {
this.webContent = loadFromDirectory(maybeFile); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} else {
this.webContent = ShrinkWrap.createFromZipFile(JARArchive.class, maybeFile); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public java.lang.String getMaybeTypeName() {
java.lang.Object ref = maybeTypeName_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
maybeTypeName_ = s;
return s;
}
} } | public class class_name {
public java.lang.String getMaybeTypeName() {
java.lang.Object ref = maybeTypeName_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref; // depends on control dependency: [if], data = [none]
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
maybeTypeName_ = s; // depends on control dependency: [if], data = [none]
return s; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void visitChildren(ParentNode<? extends N> node) {
List<? extends N> children = node.getChildren();
int size = children.size();
for (int i = 0; i < size; i++) {
visit(children.get(i));
}
} } | public class class_name {
protected void visitChildren(ParentNode<? extends N> node) {
List<? extends N> children = node.getChildren();
int size = children.size();
for (int i = 0; i < size; i++) {
visit(children.get(i)); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private List<IIsotope> orderList(List<IIsotope> isotopes_TO) {
List<IIsotope> newOrderList = new ArrayList<IIsotope>();
for (int i = 0; i < orderElements.length; i++) {
String symbol = orderElements[i];
Iterator<IIsotope> itIso = isotopes_TO.iterator();
while (itIso.hasNext()) {
IIsotope isotopeToCo = itIso.next();
if (isotopeToCo.getSymbol().equals(symbol)) {
newOrderList.add(isotopeToCo);
}
}
}
return newOrderList;
} } | public class class_name {
private List<IIsotope> orderList(List<IIsotope> isotopes_TO) {
List<IIsotope> newOrderList = new ArrayList<IIsotope>();
for (int i = 0; i < orderElements.length; i++) {
String symbol = orderElements[i];
Iterator<IIsotope> itIso = isotopes_TO.iterator();
while (itIso.hasNext()) {
IIsotope isotopeToCo = itIso.next();
if (isotopeToCo.getSymbol().equals(symbol)) {
newOrderList.add(isotopeToCo); // depends on control dependency: [if], data = [none]
}
}
}
return newOrderList;
} } |
public class class_name {
private synchronized boolean addProvisionedSlave(DockerSlaveTemplate template) throws Exception {
final DockerContainerLifecycle dockerCreateContainer = template.getDockerContainerLifecycle();
String dockerImageName = dockerCreateContainer.getImage();
int templateCapacity = template.getMaxCapacity();
int estimatedTotalSlaves = countCurrentDockerSlaves(null);
int estimatedAmiSlaves = countCurrentDockerSlaves(template);
synchronized (provisionedImages) {
int currentProvisioning = 0;
if (provisionedImages.containsKey(template)) {
currentProvisioning = provisionedImages.get(template);
}
for (int amiCount : provisionedImages.values()) {
estimatedTotalSlaves += amiCount;
}
estimatedAmiSlaves += currentProvisioning;
if (estimatedTotalSlaves >= getContainerCap()) {
LOG.info("Not Provisioning '{}'; Server '{}' full with '{}' container(s)",
dockerImageName, name, getContainerCap());
return false; // maxed out
}
if (templateCapacity != 0 && estimatedAmiSlaves >= templateCapacity) {
LOG.info("Not Provisioning '{}'. Instance limit of '{}' reached on server '{}'",
dockerImageName, templateCapacity, name);
return false; // maxed out
}
LOG.info("Provisioning '{}' number '{}' on '{}'; Total containers: '{}'",
dockerImageName, estimatedAmiSlaves, name, estimatedTotalSlaves);
provisionedImages.put(template, currentProvisioning + 1);
return true;
}
} } | public class class_name {
private synchronized boolean addProvisionedSlave(DockerSlaveTemplate template) throws Exception {
final DockerContainerLifecycle dockerCreateContainer = template.getDockerContainerLifecycle();
String dockerImageName = dockerCreateContainer.getImage();
int templateCapacity = template.getMaxCapacity();
int estimatedTotalSlaves = countCurrentDockerSlaves(null);
int estimatedAmiSlaves = countCurrentDockerSlaves(template);
synchronized (provisionedImages) {
int currentProvisioning = 0;
if (provisionedImages.containsKey(template)) {
currentProvisioning = provisionedImages.get(template); // depends on control dependency: [if], data = [none]
}
for (int amiCount : provisionedImages.values()) {
estimatedTotalSlaves += amiCount; // depends on control dependency: [for], data = [amiCount]
}
estimatedAmiSlaves += currentProvisioning;
if (estimatedTotalSlaves >= getContainerCap()) {
LOG.info("Not Provisioning '{}'; Server '{}' full with '{}' container(s)",
dockerImageName, name, getContainerCap()); // depends on control dependency: [if], data = [none]
return false; // maxed out // depends on control dependency: [if], data = [none]
}
if (templateCapacity != 0 && estimatedAmiSlaves >= templateCapacity) {
LOG.info("Not Provisioning '{}'. Instance limit of '{}' reached on server '{}'",
dockerImageName, templateCapacity, name); // depends on control dependency: [if], data = [none]
return false; // maxed out // depends on control dependency: [if], data = [none]
}
LOG.info("Provisioning '{}' number '{}' on '{}'; Total containers: '{}'",
dockerImageName, estimatedAmiSlaves, name, estimatedTotalSlaves);
provisionedImages.put(template, currentProvisioning + 1);
return true;
}
} } |
public class class_name {
@SneakyThrows
public void gracefullyShutdown(Duration timeout) {
logger.info("Shutting down...");
if(!shuttingDown) {
synchronized (this) {
shuttingDown = true;
threadPoolExecutor.shutdown();
}
// stops jobs that have not yet started to be executed
for(Job job : jobStatus()) {
Runnable runningJob = job.runningJob();
if(runningJob != null) {
threadPoolExecutor.remove(runningJob);
}
job.status(JobStatus.DONE);
}
synchronized (launcherNotifier) {
launcherNotifier.set(false);
launcherNotifier.notify();
}
}
threadPoolExecutor.awaitTermination(timeout.toMillis(), TimeUnit.MILLISECONDS);
} } | public class class_name {
@SneakyThrows
public void gracefullyShutdown(Duration timeout) {
logger.info("Shutting down...");
if(!shuttingDown) {
synchronized (this) { // depends on control dependency: [if], data = [none]
shuttingDown = true;
threadPoolExecutor.shutdown();
}
// stops jobs that have not yet started to be executed
for(Job job : jobStatus()) {
Runnable runningJob = job.runningJob();
if(runningJob != null) {
threadPoolExecutor.remove(runningJob); // depends on control dependency: [if], data = [(runningJob]
}
job.status(JobStatus.DONE); // depends on control dependency: [for], data = [job]
}
synchronized (launcherNotifier) { // depends on control dependency: [if], data = [none]
launcherNotifier.set(false);
launcherNotifier.notify();
}
}
threadPoolExecutor.awaitTermination(timeout.toMillis(), TimeUnit.MILLISECONDS);
} } |
public class class_name {
@SuppressWarnings("UnusedParameters")
protected liquibase.serializer.LiquibaseSerializable.SerializationType createSerializationTypeMetaData(
String parameterName, DatabaseChangeProperty changePropertyAnnotation
) {
if (changePropertyAnnotation == null) {
return SerializationType.NAMED_FIELD;
}
return changePropertyAnnotation.serializationType();
} } | public class class_name {
@SuppressWarnings("UnusedParameters")
protected liquibase.serializer.LiquibaseSerializable.SerializationType createSerializationTypeMetaData(
String parameterName, DatabaseChangeProperty changePropertyAnnotation
) {
if (changePropertyAnnotation == null) {
return SerializationType.NAMED_FIELD; // depends on control dependency: [if], data = [none]
}
return changePropertyAnnotation.serializationType();
} } |
public class class_name {
protected String onSetText()
{
String text = "";
if (getValue() != null)
{
text = getValue().toString();
}
return text;
} } | public class class_name {
protected String onSetText()
{
String text = "";
if (getValue() != null)
{
text = getValue().toString(); // depends on control dependency: [if], data = [none]
}
return text;
} } |
public class class_name {
VoltTable migrateRowsCommon(SystemProcedureExecutionContext ctx,
String tableName,
String columnName,
String compStr,
VoltTable paramTable,
long chunksize,
boolean replicated) {
// Some basic checks
if (chunksize <= 0) {
throw new VoltAbortException(
"Chunk size must be positive, current value is" + chunksize);
}
Table catTable = ctx.getDatabase().getTables().getIgnoreCase(tableName);
if (catTable == null) {
throw new VoltAbortException(
String.format("Table %s doesn't present in catalog", tableName));
}
if (replicated != catTable.getIsreplicated()) {
throw new VoltAbortException(
String.format("%s incompatible with %s table %s.",
replicated ? "@MigrateRowsMP" : "@MigrateRowsSP",
catTable.getIsreplicated() ? "replicated" : "partitioned", tableName));
}
Column column = catTable.getColumns().get(columnName);
if (column == null) {
throw new VoltAbortException(
String.format("Column %s does not exist in table %s", columnName, tableName));
}
// verify all required indices
verifyRequiredIndices(catTable, column);
// so far should only be single column, single row table
int columnCount = paramTable.getColumnCount();
if (columnCount > 1) {
throw new VoltAbortException("More than one input parameter is not supported right now.");
}
assert(columnCount == 1);
paramTable.resetRowPosition();
paramTable.advanceRow();
Object[] params = new Object[columnCount];
for (int i = 0; i < columnCount; i++) {
params[i] = paramTable.get(i, paramTable.getColumnType(i));
}
assert (params.length == 1);
VoltType expectedType = VoltType.values()[column.getType()];
VoltType actualType = VoltType.typeFromObject(params[0]);
if (actualType != expectedType) {
throw new VoltAbortException(String.format("Parameter type %s doesn't match column type %s",
actualType.toString(), expectedType.toString()));
}
ComparisonOperation op = ComparisonOperation.fromString(compStr);
ProcedureRunner pr = ctx.getSiteProcedureConnection().getMigrateProcRunner(
tableName + ".autogenMigrate"+ op.toString(), catTable, column, op);
Procedure newCatProc = pr.getCatalogProcedure();
Statement countStmt = newCatProc.getStatements().get(VoltDB.ANON_STMT_NAME + "0");
Statement valueAtStmt = newCatProc.getStatements().get(VoltDB.ANON_STMT_NAME + "1");
Statement migrateStmt = newCatProc.getStatements().get(VoltDB.ANON_STMT_NAME + "2");
if (countStmt == null || migrateStmt == null || valueAtStmt == null) {
throw new VoltAbortException(
String.format("Unable to find SQL statement for migrate on table %s",
tableName));
}
Object cutoffValue = null;
VoltTable result = null;
result = executePrecompiledSQL(countStmt, params, replicated);
long rowCount = result.asScalarLong();
if (exportLog.isDebugEnabled()) {
exportLog.debug("Migrate on table " + tableName +
(replicated ? "" : " on partition " + ctx.getPartitionId()) +
" reported " + rowCount + " matching rows");
}
// If number of rows meet the criteria is more than chunk size, pick the column value
// which offset equals to chunk size as new predicate.
// Please be noted that it means rows be deleted can be more than chunk size, normally
// data has higher cardinality won't exceed the limit a lot, but low cardinality data
// might cause this procedure to delete a large number of rows than the limit chunk size.
if (op != ComparisonOperation.EQ) {
if (rowCount > chunksize) {
result = executePrecompiledSQL(valueAtStmt, new Object[] { chunksize }, replicated);
cutoffValue = result.fetchRow(0).get(0, actualType);
if (exportLog.isDebugEnabled()) {
exportLog.debug("Migrate on table " + tableName +
(replicated ? "" : " on partition " + ctx.getPartitionId()) +
" reported " + cutoffValue + " target ttl");
}
}
}
result = executePrecompiledSQL(migrateStmt,
cutoffValue == null ? params : new Object[] {cutoffValue},
replicated);
long migratedRows = result.asScalarLong();
// Return rows be deleted in this run and rows left for next run
VoltTable retTable = new VoltTable(schema);
retTable.addRow(migratedRows, rowCount - migratedRows);
return retTable;
} } | public class class_name {
VoltTable migrateRowsCommon(SystemProcedureExecutionContext ctx,
String tableName,
String columnName,
String compStr,
VoltTable paramTable,
long chunksize,
boolean replicated) {
// Some basic checks
if (chunksize <= 0) {
throw new VoltAbortException(
"Chunk size must be positive, current value is" + chunksize);
}
Table catTable = ctx.getDatabase().getTables().getIgnoreCase(tableName);
if (catTable == null) {
throw new VoltAbortException(
String.format("Table %s doesn't present in catalog", tableName));
}
if (replicated != catTable.getIsreplicated()) {
throw new VoltAbortException(
String.format("%s incompatible with %s table %s.",
replicated ? "@MigrateRowsMP" : "@MigrateRowsSP",
catTable.getIsreplicated() ? "replicated" : "partitioned", tableName));
}
Column column = catTable.getColumns().get(columnName);
if (column == null) {
throw new VoltAbortException(
String.format("Column %s does not exist in table %s", columnName, tableName));
}
// verify all required indices
verifyRequiredIndices(catTable, column);
// so far should only be single column, single row table
int columnCount = paramTable.getColumnCount();
if (columnCount > 1) {
throw new VoltAbortException("More than one input parameter is not supported right now.");
}
assert(columnCount == 1);
paramTable.resetRowPosition();
paramTable.advanceRow();
Object[] params = new Object[columnCount];
for (int i = 0; i < columnCount; i++) {
params[i] = paramTable.get(i, paramTable.getColumnType(i)); // depends on control dependency: [for], data = [i]
}
assert (params.length == 1);
VoltType expectedType = VoltType.values()[column.getType()];
VoltType actualType = VoltType.typeFromObject(params[0]);
if (actualType != expectedType) {
throw new VoltAbortException(String.format("Parameter type %s doesn't match column type %s",
actualType.toString(), expectedType.toString()));
}
ComparisonOperation op = ComparisonOperation.fromString(compStr);
ProcedureRunner pr = ctx.getSiteProcedureConnection().getMigrateProcRunner(
tableName + ".autogenMigrate"+ op.toString(), catTable, column, op);
Procedure newCatProc = pr.getCatalogProcedure();
Statement countStmt = newCatProc.getStatements().get(VoltDB.ANON_STMT_NAME + "0");
Statement valueAtStmt = newCatProc.getStatements().get(VoltDB.ANON_STMT_NAME + "1");
Statement migrateStmt = newCatProc.getStatements().get(VoltDB.ANON_STMT_NAME + "2");
if (countStmt == null || migrateStmt == null || valueAtStmt == null) {
throw new VoltAbortException(
String.format("Unable to find SQL statement for migrate on table %s",
tableName));
}
Object cutoffValue = null;
VoltTable result = null;
result = executePrecompiledSQL(countStmt, params, replicated);
long rowCount = result.asScalarLong();
if (exportLog.isDebugEnabled()) {
exportLog.debug("Migrate on table " + tableName +
(replicated ? "" : " on partition " + ctx.getPartitionId()) +
" reported " + rowCount + " matching rows"); // depends on control dependency: [if], data = [none]
}
// If number of rows meet the criteria is more than chunk size, pick the column value
// which offset equals to chunk size as new predicate.
// Please be noted that it means rows be deleted can be more than chunk size, normally
// data has higher cardinality won't exceed the limit a lot, but low cardinality data
// might cause this procedure to delete a large number of rows than the limit chunk size.
if (op != ComparisonOperation.EQ) {
if (rowCount > chunksize) {
result = executePrecompiledSQL(valueAtStmt, new Object[] { chunksize }, replicated); // depends on control dependency: [if], data = [none]
cutoffValue = result.fetchRow(0).get(0, actualType); // depends on control dependency: [if], data = [none]
if (exportLog.isDebugEnabled()) {
exportLog.debug("Migrate on table " + tableName +
(replicated ? "" : " on partition " + ctx.getPartitionId()) +
" reported " + cutoffValue + " target ttl"); // depends on control dependency: [if], data = [none]
}
}
}
result = executePrecompiledSQL(migrateStmt,
cutoffValue == null ? params : new Object[] {cutoffValue},
replicated);
long migratedRows = result.asScalarLong();
// Return rows be deleted in this run and rows left for next run
VoltTable retTable = new VoltTable(schema);
retTable.addRow(migratedRows, rowCount - migratedRows);
return retTable;
} } |
public class class_name {
public List<String> getTextGroups(final String toTest, final int group) {
List<String> groups = new ArrayList<>();
Matcher m = pattern.matcher(toTest);
while (m.find()) {
groups.add(m.group(group));
}
return groups;
} } | public class class_name {
public List<String> getTextGroups(final String toTest, final int group) {
List<String> groups = new ArrayList<>();
Matcher m = pattern.matcher(toTest);
while (m.find()) {
groups.add(m.group(group)); // depends on control dependency: [while], data = [none]
}
return groups;
} } |
public class class_name {
private MustacheTagType identifyTagType(String buffer) {
if (buffer.length() == 0) {
return MustacheTagType.VARIABLE;
}
// Triple mustache is supported for default delimiters only
if (delimiters.hasDefaultDelimitersSet()
&& buffer.charAt(0) == ((String) EngineConfigurationKey.START_DELIMITER
.getDefaultValue()).charAt(0)
&& buffer.charAt(buffer.length() - 1) == ((String) EngineConfigurationKey.END_DELIMITER
.getDefaultValue()).charAt(0)) {
return MustacheTagType.UNESCAPE_VARIABLE;
}
Character command = buffer.charAt(0);
for (MustacheTagType type : MustacheTagType.values()) {
if (command.equals(type.getCommand())) {
return type;
}
}
return MustacheTagType.VARIABLE;
} } | public class class_name {
private MustacheTagType identifyTagType(String buffer) {
if (buffer.length() == 0) {
return MustacheTagType.VARIABLE; // depends on control dependency: [if], data = [none]
}
// Triple mustache is supported for default delimiters only
if (delimiters.hasDefaultDelimitersSet()
&& buffer.charAt(0) == ((String) EngineConfigurationKey.START_DELIMITER
.getDefaultValue()).charAt(0)
&& buffer.charAt(buffer.length() - 1) == ((String) EngineConfigurationKey.END_DELIMITER
.getDefaultValue()).charAt(0)) {
return MustacheTagType.UNESCAPE_VARIABLE; // depends on control dependency: [if], data = [none]
}
Character command = buffer.charAt(0);
for (MustacheTagType type : MustacheTagType.values()) {
if (command.equals(type.getCommand())) {
return type; // depends on control dependency: [if], data = [none]
}
}
return MustacheTagType.VARIABLE;
} } |
public class class_name {
void writeBestRankTriples() {
for (Resource resource : this.rankBuffer.getBestRankedStatements()) {
try {
this.rdfWriter.writeTripleUriObject(resource,
RdfWriter.RDF_TYPE, RdfWriter.WB_BEST_RANK.toString());
} catch (RDFHandlerException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
this.rankBuffer.clear();
} } | public class class_name {
void writeBestRankTriples() {
for (Resource resource : this.rankBuffer.getBestRankedStatements()) {
try {
this.rdfWriter.writeTripleUriObject(resource,
RdfWriter.RDF_TYPE, RdfWriter.WB_BEST_RANK.toString()); // depends on control dependency: [try], data = [none]
} catch (RDFHandlerException e) {
throw new RuntimeException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
this.rankBuffer.clear();
} } |
public class class_name {
public List<String> toList() {
List<String> errorStrings = new ArrayList<String>();
ErrorIterator errIterator = iterator();
while (errIterator.hasNext()) {
ValidationError err = errIterator.next();
errorStrings.add(err.getMessage());
}
return errorStrings;
} } | public class class_name {
public List<String> toList() {
List<String> errorStrings = new ArrayList<String>();
ErrorIterator errIterator = iterator();
while (errIterator.hasNext()) {
ValidationError err = errIterator.next();
errorStrings.add(err.getMessage());
// depends on control dependency: [while], data = [none]
}
return errorStrings;
} } |
public class class_name {
public boolean replace(String key, CacheEntry oldValue, CacheEntry newValue) {
final String sourceMethod = "replace"; //$NON-NLS-1$
boolean replaced = false;
SignalUtil.lock(cloneLock.readLock(), sourceClass, sourceMethod);
try {
replaced = map.replace(keyPrefix + key, oldValue, newValue);
if (replaced && oldValue != newValue) {
oldValue.delete(cacheMgr);
}
} finally {
cloneLock.readLock().unlock();
}
return replaced;
} } | public class class_name {
public boolean replace(String key, CacheEntry oldValue, CacheEntry newValue) {
final String sourceMethod = "replace"; //$NON-NLS-1$
boolean replaced = false;
SignalUtil.lock(cloneLock.readLock(), sourceClass, sourceMethod);
try {
replaced = map.replace(keyPrefix + key, oldValue, newValue);
// depends on control dependency: [try], data = [none]
if (replaced && oldValue != newValue) {
oldValue.delete(cacheMgr);
// depends on control dependency: [if], data = [none]
}
} finally {
cloneLock.readLock().unlock();
}
return replaced;
} } |
public class class_name {
protected ActivityBehavior determineBehaviour(ActivityBehavior delegateInstance) {
if (hasMultiInstanceCharacteristics()) {
multiInstanceActivityBehavior.setInnerActivityBehavior((AbstractBpmnActivityBehavior) delegateInstance);
return multiInstanceActivityBehavior;
}
return delegateInstance;
} } | public class class_name {
protected ActivityBehavior determineBehaviour(ActivityBehavior delegateInstance) {
if (hasMultiInstanceCharacteristics()) {
multiInstanceActivityBehavior.setInnerActivityBehavior((AbstractBpmnActivityBehavior) delegateInstance); // depends on control dependency: [if], data = [none]
return multiInstanceActivityBehavior; // depends on control dependency: [if], data = [none]
}
return delegateInstance;
} } |
public class class_name {
public static List<PointIndex_I32> fitPolygon(List<Point2D_I32> sequence, boolean loop,
int minimumSideLength , double cornerPenalty ) {
PolylineSplitMerge alg = new PolylineSplitMerge();
alg.setLoops(loop);
alg.setMinimumSideLength(minimumSideLength);
alg.setCornerScorePenalty(cornerPenalty);
alg.process(sequence);
PolylineSplitMerge.CandidatePolyline best = alg.getBestPolyline();
FastQueue<PointIndex_I32> output = new FastQueue<>(PointIndex_I32.class, true);
if( best != null ) {
indexToPointIndex(sequence,best.splits,output);
}
return new ArrayList<>(output.toList());
} } | public class class_name {
public static List<PointIndex_I32> fitPolygon(List<Point2D_I32> sequence, boolean loop,
int minimumSideLength , double cornerPenalty ) {
PolylineSplitMerge alg = new PolylineSplitMerge();
alg.setLoops(loop);
alg.setMinimumSideLength(minimumSideLength);
alg.setCornerScorePenalty(cornerPenalty);
alg.process(sequence);
PolylineSplitMerge.CandidatePolyline best = alg.getBestPolyline();
FastQueue<PointIndex_I32> output = new FastQueue<>(PointIndex_I32.class, true);
if( best != null ) {
indexToPointIndex(sequence,best.splits,output); // depends on control dependency: [if], data = [none]
}
return new ArrayList<>(output.toList());
} } |
public class class_name {
public Page getLoadedPage()
{
boolean allLoaded = true;
Block[] loadedBlocks = new Block[blocks.length];
for (int i = 0; i < blocks.length; i++) {
loadedBlocks[i] = blocks[i].getLoadedBlock();
if (loadedBlocks[i] != blocks[i]) {
allLoaded = false;
}
}
if (allLoaded) {
return this;
}
return new Page(loadedBlocks);
} } | public class class_name {
public Page getLoadedPage()
{
boolean allLoaded = true;
Block[] loadedBlocks = new Block[blocks.length];
for (int i = 0; i < blocks.length; i++) {
loadedBlocks[i] = blocks[i].getLoadedBlock(); // depends on control dependency: [for], data = [i]
if (loadedBlocks[i] != blocks[i]) {
allLoaded = false; // depends on control dependency: [if], data = [none]
}
}
if (allLoaded) {
return this; // depends on control dependency: [if], data = [none]
}
return new Page(loadedBlocks);
} } |
public class class_name {
public AwsSecurityFindingFilters withNetworkSourceIpV4(IpFilter... networkSourceIpV4) {
if (this.networkSourceIpV4 == null) {
setNetworkSourceIpV4(new java.util.ArrayList<IpFilter>(networkSourceIpV4.length));
}
for (IpFilter ele : networkSourceIpV4) {
this.networkSourceIpV4.add(ele);
}
return this;
} } | public class class_name {
public AwsSecurityFindingFilters withNetworkSourceIpV4(IpFilter... networkSourceIpV4) {
if (this.networkSourceIpV4 == null) {
setNetworkSourceIpV4(new java.util.ArrayList<IpFilter>(networkSourceIpV4.length)); // depends on control dependency: [if], data = [none]
}
for (IpFilter ele : networkSourceIpV4) {
this.networkSourceIpV4.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public boolean put(Locator locator, String key, String value) throws CacheException {
if (value == null) return false;
Timer.Context cachePutTimerContext = MetadataCache.cachePutTimer.time();
boolean dbWrite = false;
try {
CacheKey cacheKey = new CacheKey(locator, key);
String oldValue = cache.getIfPresent(cacheKey);
// don't care if oldValue == EMPTY.
// always put new value in the cache. it keeps reads from happening.
cache.put(cacheKey, value);
if (oldValue == null || !oldValue.equals(value)) {
dbWrite = true;
}
if (dbWrite) {
updatedMetricMeter.mark();
if (!batchedWrites) {
databasePut(locator, key, value);
} else {
databaseLazyWrite(locator, key);
}
}
return dbWrite;
} finally {
cachePutTimerContext.stop();
}
} } | public class class_name {
public boolean put(Locator locator, String key, String value) throws CacheException {
if (value == null) return false;
Timer.Context cachePutTimerContext = MetadataCache.cachePutTimer.time();
boolean dbWrite = false;
try {
CacheKey cacheKey = new CacheKey(locator, key);
String oldValue = cache.getIfPresent(cacheKey);
// don't care if oldValue == EMPTY.
// always put new value in the cache. it keeps reads from happening.
cache.put(cacheKey, value);
if (oldValue == null || !oldValue.equals(value)) {
dbWrite = true; // depends on control dependency: [if], data = [none]
}
if (dbWrite) {
updatedMetricMeter.mark(); // depends on control dependency: [if], data = [none]
if (!batchedWrites) {
databasePut(locator, key, value); // depends on control dependency: [if], data = [none]
} else {
databaseLazyWrite(locator, key); // depends on control dependency: [if], data = [none]
}
}
return dbWrite;
} finally {
cachePutTimerContext.stop();
}
} } |
public class class_name {
public void marshall(QueryFilter queryFilter, ProtocolMarshaller protocolMarshaller) {
if (queryFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(queryFilter.getDeltaTime(), DELTATIME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(QueryFilter queryFilter, ProtocolMarshaller protocolMarshaller) {
if (queryFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(queryFilter.getDeltaTime(), DELTATIME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void setConnector(final SocketConnector connector) {
if (connector == null) {
throw new NullPointerException("connector cannot be null");
}
this.connector = connector;
String className = ProxyFilter.class.getName();
// Removes an old ProxyFilter instance from the chain
if (connector.getFilterChain().contains(className)) {
connector.getFilterChain().remove(className);
}
// Insert the ProxyFilter as the first filter in the filter chain builder
connector.getFilterChain().addFirst(className, proxyFilter);
} } | public class class_name {
private void setConnector(final SocketConnector connector) {
if (connector == null) {
throw new NullPointerException("connector cannot be null");
}
this.connector = connector;
String className = ProxyFilter.class.getName();
// Removes an old ProxyFilter instance from the chain
if (connector.getFilterChain().contains(className)) {
connector.getFilterChain().remove(className); // depends on control dependency: [if], data = [none]
}
// Insert the ProxyFilter as the first filter in the filter chain builder
connector.getFilterChain().addFirst(className, proxyFilter);
} } |
public class class_name {
private Report getReport(ReportType reportType) {
String type = null;
String primaryColumn = null;
Properties properties = new Properties();
if (reportType != null) {
type = reportType.getType();
primaryColumn = reportType.getPrimaryColumn();
for (PropertyType propertyType : reportType.getProperty()) {
properties.setProperty(propertyType.getName(), propertyType.getValue());
}
}
Report.ReportBuilder reportBuilder = Report.builder().primaryColumn(primaryColumn).properties(properties);
if (type != null) {
reportBuilder.selectedTypes(Report.selectTypes(type));
}
return reportBuilder.build();
} } | public class class_name {
private Report getReport(ReportType reportType) {
String type = null;
String primaryColumn = null;
Properties properties = new Properties();
if (reportType != null) {
type = reportType.getType(); // depends on control dependency: [if], data = [none]
primaryColumn = reportType.getPrimaryColumn(); // depends on control dependency: [if], data = [none]
for (PropertyType propertyType : reportType.getProperty()) {
properties.setProperty(propertyType.getName(), propertyType.getValue()); // depends on control dependency: [for], data = [propertyType]
}
}
Report.ReportBuilder reportBuilder = Report.builder().primaryColumn(primaryColumn).properties(properties);
if (type != null) {
reportBuilder.selectedTypes(Report.selectTypes(type)); // depends on control dependency: [if], data = [(type]
}
return reportBuilder.build();
} } |
public class class_name {
public Note getStringNote(int stringNumber) {
if (stringNumber > 0 && stringNumber <= m_strings.length) {
return m_strings[stringNumber-1];
}
else return null;
} } | public class class_name {
public Note getStringNote(int stringNumber) {
if (stringNumber > 0 && stringNumber <= m_strings.length) {
return m_strings[stringNumber-1];
// depends on control dependency: [if], data = [none]
}
else return null;
} } |
public class class_name {
public ListAssessmentTargetsResult withAssessmentTargetArns(String... assessmentTargetArns) {
if (this.assessmentTargetArns == null) {
setAssessmentTargetArns(new java.util.ArrayList<String>(assessmentTargetArns.length));
}
for (String ele : assessmentTargetArns) {
this.assessmentTargetArns.add(ele);
}
return this;
} } | public class class_name {
public ListAssessmentTargetsResult withAssessmentTargetArns(String... assessmentTargetArns) {
if (this.assessmentTargetArns == null) {
setAssessmentTargetArns(new java.util.ArrayList<String>(assessmentTargetArns.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : assessmentTargetArns) {
this.assessmentTargetArns.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static void deleteMessengerProfile(StringEntity input) {
String pageToken = FbBotMillContext.getInstance().getPageToken();
// If the page token is invalid, returns.
if (!validatePageToken(pageToken)) {
return;
}
String url = FbBotMillNetworkConstants.FACEBOOK_BASE_URL
+ FbBotMillNetworkConstants.FACEBOOK_MESSENGER_PROFILE
+ pageToken;
BotMillNetworkResponse response = NetworkUtils.delete(url, input);
propagateResponse(response);
} } | public class class_name {
public static void deleteMessengerProfile(StringEntity input) {
String pageToken = FbBotMillContext.getInstance().getPageToken();
// If the page token is invalid, returns.
if (!validatePageToken(pageToken)) {
return; // depends on control dependency: [if], data = [none]
}
String url = FbBotMillNetworkConstants.FACEBOOK_BASE_URL
+ FbBotMillNetworkConstants.FACEBOOK_MESSENGER_PROFILE
+ pageToken;
BotMillNetworkResponse response = NetworkUtils.delete(url, input);
propagateResponse(response);
} } |
public class class_name {
private IOException wrapException(InetSocketAddress addr,
IOException exception) {
if (exception instanceof ConnectException) {
//connection refused; include the host:port in the error
return (ConnectException)new ConnectException(
"Call to " + addr + " failed on connection exception: " + exception)
.initCause(exception);
} else if (exception instanceof SocketTimeoutException) {
return (SocketTimeoutException)new SocketTimeoutException(
"Call to " + addr + " failed on socket timeout exception: "
+ exception).initCause(exception);
} else if (exception instanceof NoRouteToHostException) {
return (NoRouteToHostException)new NoRouteToHostException(
"Call to " + addr + " failed on NoRouteToHostException exception: "
+ exception).initCause(exception);
} else if (exception instanceof PortUnreachableException) {
return (PortUnreachableException)new PortUnreachableException(
"Call to " + addr + " failed on PortUnreachableException exception: "
+ exception).initCause(exception);
} else if (exception instanceof EOFException) {
return (EOFException)new EOFException(
"Call to " + addr + " failed on EOFException exception: "
+ exception).initCause(exception);
} else {
return (IOException)new IOException(
"Call to " + addr + " failed on local exception: " + exception)
.initCause(exception);
}
} } | public class class_name {
private IOException wrapException(InetSocketAddress addr,
IOException exception) {
if (exception instanceof ConnectException) {
//connection refused; include the host:port in the error
return (ConnectException)new ConnectException(
"Call to " + addr + " failed on connection exception: " + exception)
.initCause(exception); // depends on control dependency: [if], data = [none]
} else if (exception instanceof SocketTimeoutException) {
return (SocketTimeoutException)new SocketTimeoutException(
"Call to " + addr + " failed on socket timeout exception: "
+ exception).initCause(exception); // depends on control dependency: [if], data = [none]
} else if (exception instanceof NoRouteToHostException) {
return (NoRouteToHostException)new NoRouteToHostException(
"Call to " + addr + " failed on NoRouteToHostException exception: "
+ exception).initCause(exception); // depends on control dependency: [if], data = [none]
} else if (exception instanceof PortUnreachableException) {
return (PortUnreachableException)new PortUnreachableException(
"Call to " + addr + " failed on PortUnreachableException exception: "
+ exception).initCause(exception); // depends on control dependency: [if], data = [none]
} else if (exception instanceof EOFException) {
return (EOFException)new EOFException(
"Call to " + addr + " failed on EOFException exception: "
+ exception).initCause(exception); // depends on control dependency: [if], data = [none]
} else {
return (IOException)new IOException(
"Call to " + addr + " failed on local exception: " + exception)
.initCause(exception); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Optional<String> findTableName(final PredicateSegment predicateSegment, final SQLStatement sqlStatement, final ShardingTableMetaData shardingTableMetaData) {
if (!(sqlStatement instanceof SelectStatement)) {
return Optional.of(sqlStatement.getTables().getSingleTableName());
}
SelectStatement currentSelectStatement = (SelectStatement) sqlStatement;
while (null != currentSelectStatement.getParentStatement()) {
currentSelectStatement = currentSelectStatement.getParentStatement();
Optional<String> tableName = findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData);
if (tableName.isPresent()) {
return tableName;
}
}
return findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData);
} } | public class class_name {
public static Optional<String> findTableName(final PredicateSegment predicateSegment, final SQLStatement sqlStatement, final ShardingTableMetaData shardingTableMetaData) {
if (!(sqlStatement instanceof SelectStatement)) {
return Optional.of(sqlStatement.getTables().getSingleTableName()); // depends on control dependency: [if], data = [none]
}
SelectStatement currentSelectStatement = (SelectStatement) sqlStatement;
while (null != currentSelectStatement.getParentStatement()) {
currentSelectStatement = currentSelectStatement.getParentStatement(); // depends on control dependency: [while], data = [none]
Optional<String> tableName = findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData);
if (tableName.isPresent()) {
return tableName; // depends on control dependency: [if], data = [none]
}
}
return findTableName(predicateSegment, currentSelectStatement.getTables(), shardingTableMetaData);
} } |
public class class_name {
public static double mean(TransposeDataCollection sampleDataCollection) {
double mean = 0.0;
int totalSampleN = 0;
for(Map.Entry<Object, FlatDataCollection> entry : sampleDataCollection.entrySet()) {
mean += Descriptives.sum(entry.getValue());
totalSampleN += entry.getValue().size();
}
mean/=totalSampleN;
return mean;
} } | public class class_name {
public static double mean(TransposeDataCollection sampleDataCollection) {
double mean = 0.0;
int totalSampleN = 0;
for(Map.Entry<Object, FlatDataCollection> entry : sampleDataCollection.entrySet()) {
mean += Descriptives.sum(entry.getValue()); // depends on control dependency: [for], data = [entry]
totalSampleN += entry.getValue().size(); // depends on control dependency: [for], data = [entry]
}
mean/=totalSampleN;
return mean;
} } |
public class class_name {
@NotNull
public Exceptional<T> ifPresent(@NotNull Consumer<? super T> consumer) {
if (throwable == null) {
consumer.accept(value);
}
return this;
} } | public class class_name {
@NotNull
public Exceptional<T> ifPresent(@NotNull Consumer<? super T> consumer) {
if (throwable == null) {
consumer.accept(value); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
protected void adjustSSL() {
if (simpleReturn(null)) {
return;
}
CmsSSLMode siteMode = ((CmsSite)m_server.getValue()).getSSLMode();
m_encryption.setValue(siteMode.equals(CmsSSLMode.SECURE_SERVER) ? CmsSSLMode.NO : siteMode); //Set mode according to site, don't allow Secure Server
} } | public class class_name {
protected void adjustSSL() {
if (simpleReturn(null)) {
return; // depends on control dependency: [if], data = [none]
}
CmsSSLMode siteMode = ((CmsSite)m_server.getValue()).getSSLMode();
m_encryption.setValue(siteMode.equals(CmsSSLMode.SECURE_SERVER) ? CmsSSLMode.NO : siteMode); //Set mode according to site, don't allow Secure Server
} } |
public class class_name {
public void dumpStats(final String file) throws FileNotFoundException {
PrintStream out = null;
try {
out = new PrintStream(new FileOutputStream(file));
dumpStats(out);
} finally {
try {
out.close();
} catch (Exception ign) {
}
}
} } | public class class_name {
public void dumpStats(final String file) throws FileNotFoundException {
PrintStream out = null;
try {
out = new PrintStream(new FileOutputStream(file));
dumpStats(out);
} finally {
try {
out.close(); // depends on control dependency: [try], data = [none]
} catch (Exception ign) {
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public String getString(String name)
{
List part = _partMap.getValues(name);
if (part==null)
return null;
if (_encoding != null)
{
try
{
return new String(((Part)part.get(0))._data, _encoding);
}
catch (UnsupportedEncodingException uee)
{
if (log.isDebugEnabled())log.debug("Invalid character set: " + uee);
return null;
}
}
else
return new String(((Part)part.get(0))._data);
} } | public class class_name {
public String getString(String name)
{
List part = _partMap.getValues(name);
if (part==null)
return null;
if (_encoding != null)
{
try
{
return new String(((Part)part.get(0))._data, _encoding); // depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException uee)
{
if (log.isDebugEnabled())log.debug("Invalid character set: " + uee);
return null;
} // depends on control dependency: [catch], data = [none]
}
else
return new String(((Part)part.get(0))._data);
} } |
public class class_name {
@Override
public void setValue(Boolean value, boolean fireEvents) {
boolean oldValue = getValue();
if (value) {
input.getElement().setAttribute("checked", "true");
} else {
input.getElement().removeAttribute("checked");
}
if (fireEvents && oldValue != value) {
ValueChangeEvent.fire(this, getValue());
}
} } | public class class_name {
@Override
public void setValue(Boolean value, boolean fireEvents) {
boolean oldValue = getValue();
if (value) {
input.getElement().setAttribute("checked", "true"); // depends on control dependency: [if], data = [none]
} else {
input.getElement().removeAttribute("checked"); // depends on control dependency: [if], data = [none]
}
if (fireEvents && oldValue != value) {
ValueChangeEvent.fire(this, getValue()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Point3D getClosestPointTo(PathIterator3f pathIterator, double x, double y, double z) {
Point3D closest = null;
double bestDist = Double.POSITIVE_INFINITY;
Point3D candidate;
AbstractPathElement3F pe = pathIterator.next();
Path3f subPath;
if (pe.type != PathElementType.MOVE_TO) {
throw new IllegalArgumentException("missing initial moveto in path definition");
}
candidate = new Point3f(pe.getToX(), pe.getToY(), pe.getToZ());
while (pathIterator.hasNext()) {
pe = pathIterator.next();
candidate = null;
switch(pe.type) {
case MOVE_TO:
candidate = new Point3f(pe.getToX(), pe.getToY(), pe.getToZ());
break;
case LINE_TO:
candidate = (new Segment3f(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3f(x,y,z));
break;
case CLOSE:
if (!pe.isEmpty()) {
candidate = (new Segment3f(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3f(x,y,z));
}
break;
case QUAD_TO:
subPath = new Path3f();
subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ());
subPath.quadTo(
pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(),
pe.getToX(), pe.getToY(), pe.getToZ());
candidate = subPath.getClosestPointTo(new Point3f(x,y,z));
break;
case CURVE_TO:
subPath = new Path3f();
subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ());
subPath.curveTo(
pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(),
pe.getCtrlX2(), pe.getCtrlY2(), pe.getCtrlZ2(),
pe.getToX(), pe.getToY(), pe.getToZ());
candidate = subPath.getClosestPointTo(new Point3f(x,y,z));
break;
default:
throw new IllegalStateException(
pe.type==null ? null : pe.type.toString());
}
if (candidate!=null) {
double d = candidate.getDistanceSquared(new Point3f(x,y,z));
if (d<bestDist) {
bestDist = d;
closest = candidate;
}
}
}
return closest;
} } | public class class_name {
public static Point3D getClosestPointTo(PathIterator3f pathIterator, double x, double y, double z) {
Point3D closest = null;
double bestDist = Double.POSITIVE_INFINITY;
Point3D candidate;
AbstractPathElement3F pe = pathIterator.next();
Path3f subPath;
if (pe.type != PathElementType.MOVE_TO) {
throw new IllegalArgumentException("missing initial moveto in path definition");
}
candidate = new Point3f(pe.getToX(), pe.getToY(), pe.getToZ());
while (pathIterator.hasNext()) {
pe = pathIterator.next(); // depends on control dependency: [while], data = [none]
candidate = null; // depends on control dependency: [while], data = [none]
switch(pe.type) {
case MOVE_TO:
candidate = new Point3f(pe.getToX(), pe.getToY(), pe.getToZ());
break;
case LINE_TO:
candidate = (new Segment3f(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3f(x,y,z));
break;
case CLOSE:
if (!pe.isEmpty()) {
candidate = (new Segment3f(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3f(x,y,z)); // depends on control dependency: [if], data = [none]
}
break;
case QUAD_TO:
subPath = new Path3f();
subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ());
subPath.quadTo(
pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(),
pe.getToX(), pe.getToY(), pe.getToZ());
candidate = subPath.getClosestPointTo(new Point3f(x,y,z));
break;
case CURVE_TO:
subPath = new Path3f();
subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ());
subPath.curveTo(
pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(),
pe.getCtrlX2(), pe.getCtrlY2(), pe.getCtrlZ2(),
pe.getToX(), pe.getToY(), pe.getToZ());
candidate = subPath.getClosestPointTo(new Point3f(x,y,z));
break;
default:
throw new IllegalStateException(
pe.type==null ? null : pe.type.toString());
}
if (candidate!=null) {
double d = candidate.getDistanceSquared(new Point3f(x,y,z));
if (d<bestDist) {
bestDist = d; // depends on control dependency: [if], data = [none]
closest = candidate; // depends on control dependency: [if], data = [none]
}
}
}
return closest;
} } |
public class class_name {
public Hashtable<Integer, JLabel> getSliderLabels()
{
Hashtable<Integer, JLabel> dict = new Hashtable<Integer, JLabel>();
for(Map.Entry<Integer, String> entry : labels.entrySet())
{
dict.put(entry.getKey(), new JLabel(entry.getValue()));
}
return dict;
} } | public class class_name {
public Hashtable<Integer, JLabel> getSliderLabels()
{
Hashtable<Integer, JLabel> dict = new Hashtable<Integer, JLabel>();
for(Map.Entry<Integer, String> entry : labels.entrySet())
{
dict.put(entry.getKey(), new JLabel(entry.getValue())); // depends on control dependency: [for], data = [entry]
}
return dict;
} } |
public class class_name {
static Mono<Object> decode(HttpResponse httpResponse, SerializerAdapter serializer, HttpResponseDecodeData decodeData) {
Type headerType = decodeData.headersType();
if (headerType == null) {
return Mono.empty();
} else {
return Mono.defer(() -> {
try {
return Mono.just(deserializeHeaders(httpResponse.headers(), serializer, decodeData));
} catch (IOException e) {
return Mono.error(new HttpRequestException("HTTP response has malformed headers", httpResponse, e));
}
});
}
} } | public class class_name {
static Mono<Object> decode(HttpResponse httpResponse, SerializerAdapter serializer, HttpResponseDecodeData decodeData) {
Type headerType = decodeData.headersType();
if (headerType == null) {
return Mono.empty(); // depends on control dependency: [if], data = [none]
} else {
return Mono.defer(() -> {
try {
return Mono.just(deserializeHeaders(httpResponse.headers(), serializer, decodeData)); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
return Mono.error(new HttpRequestException("HTTP response has malformed headers", httpResponse, e));
} // depends on control dependency: [catch], data = [none]
});
}
} } |
public class class_name {
@Override
public Bitmap drawUnindexedTile(int tileWidth, int tileHeight, long totalFeatureCount, FeatureCursor allFeatureResults) {
Bitmap bitmap = null;
if (drawUnindexedTiles) {
// Draw a tile indicating we have no idea if there are features inside.
// The table is not indexed and more features exist than the max feature count set.
bitmap = drawTile(tileWidth, tileHeight, "?");
}
return bitmap;
} } | public class class_name {
@Override
public Bitmap drawUnindexedTile(int tileWidth, int tileHeight, long totalFeatureCount, FeatureCursor allFeatureResults) {
Bitmap bitmap = null;
if (drawUnindexedTiles) {
// Draw a tile indicating we have no idea if there are features inside.
// The table is not indexed and more features exist than the max feature count set.
bitmap = drawTile(tileWidth, tileHeight, "?"); // depends on control dependency: [if], data = [none]
}
return bitmap;
} } |
public class class_name {
@Override
public void addHandler(Handler handler)
{
synchronized (this) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader == null) {
loader = _systemClassLoader;
}
boolean hasLoader = false;
for (int i = _loaders.size() - 1; i >= 0; i--) {
WeakReference<ClassLoader> ref = _loaders.get(i);
ClassLoader refLoader = ref.get();
if (refLoader == null)
_loaders.remove(i);
if (refLoader == loader)
hasLoader = true;
if (isParentLoader(loader, refLoader))
addHandler(handler, refLoader);
}
if (! hasLoader) {
_loaders.add(new WeakReference<ClassLoader>(loader));
addHandler(handler, loader);
EnvLoader.addClassLoaderListener(this, loader);
}
HandlerEntry ownHandlers = _ownHandlers.get();
if (ownHandlers == null) {
ownHandlers = new HandlerEntry(this);
_ownHandlers.set(ownHandlers);
}
ownHandlers.addHandler(handler);
}
} } | public class class_name {
@Override
public void addHandler(Handler handler)
{
synchronized (this) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader == null) {
loader = _systemClassLoader; // depends on control dependency: [if], data = [none]
}
boolean hasLoader = false;
for (int i = _loaders.size() - 1; i >= 0; i--) {
WeakReference<ClassLoader> ref = _loaders.get(i);
ClassLoader refLoader = ref.get();
if (refLoader == null)
_loaders.remove(i);
if (refLoader == loader)
hasLoader = true;
if (isParentLoader(loader, refLoader))
addHandler(handler, refLoader);
}
if (! hasLoader) {
_loaders.add(new WeakReference<ClassLoader>(loader)); // depends on control dependency: [if], data = [none]
addHandler(handler, loader); // depends on control dependency: [if], data = [none]
EnvLoader.addClassLoaderListener(this, loader); // depends on control dependency: [if], data = [none]
}
HandlerEntry ownHandlers = _ownHandlers.get();
if (ownHandlers == null) {
ownHandlers = new HandlerEntry(this); // depends on control dependency: [if], data = [none]
_ownHandlers.set(ownHandlers); // depends on control dependency: [if], data = [(ownHandlers]
}
ownHandlers.addHandler(handler);
}
} } |
public class class_name {
protected final Bucket<K, V> getBucketForKey(K key) {
int bucket_index = (key.hashCode() & 0x7FFFFFFF) % buckets.length;
Bucket<K, V> thebucket = buckets[bucket_index];
if (thebucket == null) {
synchronized (this) {
thebucket = buckets[bucket_index];
if (thebucket == null) {
thebucket = new Bucket<K, V>();
buckets[bucket_index] = thebucket;
} // if
} // sync
} // if
return thebucket;
} } | public class class_name {
protected final Bucket<K, V> getBucketForKey(K key) {
int bucket_index = (key.hashCode() & 0x7FFFFFFF) % buckets.length;
Bucket<K, V> thebucket = buckets[bucket_index];
if (thebucket == null) {
synchronized (this) { // depends on control dependency: [if], data = [none]
thebucket = buckets[bucket_index];
if (thebucket == null) {
thebucket = new Bucket<K, V>(); // depends on control dependency: [if], data = [none]
buckets[bucket_index] = thebucket; // depends on control dependency: [if], data = [none]
} // if
} // sync
} // if
return thebucket;
} } |
public class class_name {
private void nodeToStringBuffer(Node node, StringBuffer buffer, int indent) {
if (indent >= 0) {
if (indent > 0) {
buffer.append("\n");
}
buffer.append(StringUtil.repeat(" ", indent));
}
buffer.append("<").append(node.getNodeName());
SortedMap<String, String> attributeMap = new TreeMap<>();
NamedNodeMap attributes = node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node attribute = attributes.item(i);
attributeMap.put(attribute.getNodeName(), attribute.getNodeValue());
}
boolean firstAttribute = true;
for (Map.Entry entry : attributeMap.entrySet()) {
String value = (String) entry.getValue();
if (value != null) {
if ((indent >= 0) && !firstAttribute && (attributeMap.size() > 2)) {
buffer.append("\n").append(StringUtil.repeat(" ", indent)).append(" ");
} else {
buffer.append(" ");
}
buffer.append(entry.getKey()).append("=\"").append(value).append("\"");
firstAttribute = false;
}
}
String textContent = StringUtil.trimToEmpty(XMLUtil.getTextContent(node));
buffer.append(">").append(textContent);
boolean sawChildren = false;
NodeList childNodes = node.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node childNode = childNodes.item(i);
if (childNode instanceof Element) {
int newIndent = indent;
if (newIndent >= 0) {
newIndent += 4;
}
nodeToStringBuffer(childNode, buffer, newIndent);
sawChildren = true;
}
}
if (indent >= 0) {
if (sawChildren) {
buffer.append("\n").append(StringUtil.repeat(" ", indent));
}
}
if (!sawChildren && "".equals(textContent)) {
buffer.replace(buffer.length() - 1, buffer.length(), "/>");
} else {
buffer.append("</").append(node.getNodeName()).append(">");
}
} } | public class class_name {
private void nodeToStringBuffer(Node node, StringBuffer buffer, int indent) {
if (indent >= 0) {
if (indent > 0) {
buffer.append("\n"); // depends on control dependency: [if], data = [none]
}
buffer.append(StringUtil.repeat(" ", indent)); // depends on control dependency: [if], data = [none]
}
buffer.append("<").append(node.getNodeName());
SortedMap<String, String> attributeMap = new TreeMap<>();
NamedNodeMap attributes = node.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node attribute = attributes.item(i);
attributeMap.put(attribute.getNodeName(), attribute.getNodeValue()); // depends on control dependency: [for], data = [none]
}
boolean firstAttribute = true;
for (Map.Entry entry : attributeMap.entrySet()) {
String value = (String) entry.getValue();
if (value != null) {
if ((indent >= 0) && !firstAttribute && (attributeMap.size() > 2)) {
buffer.append("\n").append(StringUtil.repeat(" ", indent)).append(" "); // depends on control dependency: [if], data = [none]
} else {
buffer.append(" "); // depends on control dependency: [if], data = [none]
}
buffer.append(entry.getKey()).append("=\"").append(value).append("\""); // depends on control dependency: [if], data = [(value]
firstAttribute = false; // depends on control dependency: [if], data = [none]
}
}
String textContent = StringUtil.trimToEmpty(XMLUtil.getTextContent(node));
buffer.append(">").append(textContent);
boolean sawChildren = false;
NodeList childNodes = node.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node childNode = childNodes.item(i);
if (childNode instanceof Element) {
int newIndent = indent;
if (newIndent >= 0) {
newIndent += 4; // depends on control dependency: [if], data = [none]
}
nodeToStringBuffer(childNode, buffer, newIndent); // depends on control dependency: [if], data = [none]
sawChildren = true; // depends on control dependency: [if], data = [none]
}
}
if (indent >= 0) {
if (sawChildren) {
buffer.append("\n").append(StringUtil.repeat(" ", indent)); // depends on control dependency: [if], data = [none]
}
}
if (!sawChildren && "".equals(textContent)) {
buffer.replace(buffer.length() - 1, buffer.length(), "/>"); // depends on control dependency: [if], data = [none]
} else {
buffer.append("</").append(node.getNodeName()).append(">"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public JobPatchHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null;
} else {
this.lastModified = new DateTimeRfc1123(lastModified);
}
return this;
} } | public class class_name {
public JobPatchHeaders withLastModified(DateTime lastModified) {
if (lastModified == null) {
this.lastModified = null; // depends on control dependency: [if], data = [none]
} else {
this.lastModified = new DateTimeRfc1123(lastModified); // depends on control dependency: [if], data = [(lastModified]
}
return this;
} } |
public class class_name {
public List<Statement> createSequencesStatements(Iterable<Sequence> sequences) {
List<Statement> statements = new ArrayList<Statement>();
for ( Sequence sequence : sequences ) {
addSequence( statements, sequence );
}
return statements;
} } | public class class_name {
public List<Statement> createSequencesStatements(Iterable<Sequence> sequences) {
List<Statement> statements = new ArrayList<Statement>();
for ( Sequence sequence : sequences ) {
addSequence( statements, sequence ); // depends on control dependency: [for], data = [sequence]
}
return statements;
} } |
public class class_name {
private WebElement getViewFromList(List<WebElement> webElements, int match){
WebElement webElementToReturn = null;
if(webElements.size() >= match){
try{
webElementToReturn = webElements.get(--match);
}catch(Exception ignored){}
}
if(webElementToReturn != null)
webElements.clear();
return webElementToReturn;
} } | public class class_name {
private WebElement getViewFromList(List<WebElement> webElements, int match){
WebElement webElementToReturn = null;
if(webElements.size() >= match){
try{
webElementToReturn = webElements.get(--match); // depends on control dependency: [try], data = [none]
}catch(Exception ignored){} // depends on control dependency: [catch], data = [none]
}
if(webElementToReturn != null)
webElements.clear();
return webElementToReturn;
} } |
public class class_name {
private String getWorkingRepositoryName(PropertiesParam props)
{
if (props.getProperty("repository") == null)
{
try
{
return repositoryService.getCurrentRepository().getConfiguration().getName();
}
catch (RepositoryException e)
{
throw new RuntimeException("Can not get current repository and repository name was not configured", e);
}
}
else
{
return props.getProperty("repository");
}
} } | public class class_name {
private String getWorkingRepositoryName(PropertiesParam props)
{
if (props.getProperty("repository") == null)
{
try
{
return repositoryService.getCurrentRepository().getConfiguration().getName(); // depends on control dependency: [try], data = [none]
}
catch (RepositoryException e)
{
throw new RuntimeException("Can not get current repository and repository name was not configured", e);
} // depends on control dependency: [catch], data = [none]
}
else
{
return props.getProperty("repository"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Deprecated
public static List<Footer> readAllFootersInParallelUsingSummaryFiles(
final Configuration configuration,
final Collection<FileStatus> partFiles,
final boolean skipRowGroups) throws IOException {
// figure out list of all parents to part files
Set<Path> parents = new HashSet<Path>();
for (FileStatus part : partFiles) {
parents.add(part.getPath().getParent());
}
// read corresponding summary files if they exist
List<Callable<Map<Path, Footer>>> summaries = new ArrayList<Callable<Map<Path, Footer>>>();
for (final Path path : parents) {
summaries.add(new Callable<Map<Path, Footer>>() {
@Override
public Map<Path, Footer> call() throws Exception {
ParquetMetadata mergedMetadata = readSummaryMetadata(configuration, path, skipRowGroups);
if (mergedMetadata != null) {
final List<Footer> footers;
if (skipRowGroups) {
footers = new ArrayList<Footer>();
for (FileStatus f : partFiles) {
footers.add(new Footer(f.getPath(), mergedMetadata));
}
} else {
footers = footersFromSummaryFile(path, mergedMetadata);
}
Map<Path, Footer> map = new HashMap<Path, Footer>();
for (Footer footer : footers) {
// the folder may have been moved
footer = new Footer(new Path(path, footer.getFile().getName()), footer.getParquetMetadata());
map.put(footer.getFile(), footer);
}
return map;
} else {
return Collections.emptyMap();
}
}
});
}
Map<Path, Footer> cache = new HashMap<Path, Footer>();
try {
List<Map<Path, Footer>> footersFromSummaries = runAllInParallel(configuration.getInt(PARQUET_READ_PARALLELISM, 5), summaries);
for (Map<Path, Footer> footers : footersFromSummaries) {
cache.putAll(footers);
}
} catch (ExecutionException e) {
throw new IOException("Error reading summaries", e);
}
// keep only footers for files actually requested and read file footer if not found in summaries
List<Footer> result = new ArrayList<Footer>(partFiles.size());
List<FileStatus> toRead = new ArrayList<FileStatus>();
for (FileStatus part : partFiles) {
Footer f = cache.get(part.getPath());
if (f != null) {
result.add(f);
} else {
toRead.add(part);
}
}
if (toRead.size() > 0) {
// read the footers of the files that did not have a summary file
LOG.info("reading another {} footers", toRead.size());
result.addAll(readAllFootersInParallel(configuration, toRead, skipRowGroups));
}
return result;
} } | public class class_name {
@Deprecated
public static List<Footer> readAllFootersInParallelUsingSummaryFiles(
final Configuration configuration,
final Collection<FileStatus> partFiles,
final boolean skipRowGroups) throws IOException {
// figure out list of all parents to part files
Set<Path> parents = new HashSet<Path>();
for (FileStatus part : partFiles) {
parents.add(part.getPath().getParent());
}
// read corresponding summary files if they exist
List<Callable<Map<Path, Footer>>> summaries = new ArrayList<Callable<Map<Path, Footer>>>();
for (final Path path : parents) {
summaries.add(new Callable<Map<Path, Footer>>() {
@Override
public Map<Path, Footer> call() throws Exception {
ParquetMetadata mergedMetadata = readSummaryMetadata(configuration, path, skipRowGroups);
if (mergedMetadata != null) {
final List<Footer> footers;
if (skipRowGroups) {
footers = new ArrayList<Footer>();
for (FileStatus f : partFiles) {
footers.add(new Footer(f.getPath(), mergedMetadata)); // depends on control dependency: [for], data = [f]
}
} else {
footers = footersFromSummaryFile(path, mergedMetadata);
}
Map<Path, Footer> map = new HashMap<Path, Footer>();
for (Footer footer : footers) {
// the folder may have been moved
footer = new Footer(new Path(path, footer.getFile().getName()), footer.getParquetMetadata());
map.put(footer.getFile(), footer);
}
return map;
} else {
return Collections.emptyMap();
}
}
});
}
Map<Path, Footer> cache = new HashMap<Path, Footer>();
try {
List<Map<Path, Footer>> footersFromSummaries = runAllInParallel(configuration.getInt(PARQUET_READ_PARALLELISM, 5), summaries);
for (Map<Path, Footer> footers : footersFromSummaries) {
cache.putAll(footers);
}
} catch (ExecutionException e) {
throw new IOException("Error reading summaries", e);
}
// keep only footers for files actually requested and read file footer if not found in summaries
List<Footer> result = new ArrayList<Footer>(partFiles.size());
List<FileStatus> toRead = new ArrayList<FileStatus>();
for (FileStatus part : partFiles) {
Footer f = cache.get(part.getPath());
if (f != null) {
result.add(f);
} else {
toRead.add(part);
}
}
if (toRead.size() > 0) {
// read the footers of the files that did not have a summary file
LOG.info("reading another {} footers", toRead.size());
result.addAll(readAllFootersInParallel(configuration, toRead, skipRowGroups));
}
return result;
} } |
public class class_name {
private String update() {
// If this has been done before, there is no change in checkSum and the last time notified is within GracePeriod
if(checksum!=0 && checksum()==checksum && now < last.getTime()+graceEnds && now > last.getTime()+lastdays) {
return null;
} else {
return "UPDATE authz.notify SET last = '" +
Chrono.dateOnlyStamp(last) +
"', checksum=" +
current +
" WHERE user='" +
user +
"' AND type=" +
type.getValue() +
";";
}
} } | public class class_name {
private String update() {
// If this has been done before, there is no change in checkSum and the last time notified is within GracePeriod
if(checksum!=0 && checksum()==checksum && now < last.getTime()+graceEnds && now > last.getTime()+lastdays) {
return null; // depends on control dependency: [if], data = [none]
} else {
return "UPDATE authz.notify SET last = '" +
Chrono.dateOnlyStamp(last) +
"', checksum=" +
current +
" WHERE user='" +
user +
"' AND type=" +
type.getValue() +
";"; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected DoubleMatrix2D createFullDataMatrix(DoubleMatrix2D SubDiagonalSymmMatrix){
int c = SubDiagonalSymmMatrix.columns();
DoubleMatrix2D ret = F2.make(c, c);
for(int i=0; i<c; i++){
for(int j=0; j<=i; j++){
ret.setQuick(i, j, SubDiagonalSymmMatrix.getQuick(i, j));
ret.setQuick(j, i, SubDiagonalSymmMatrix.getQuick(i, j));
}
}
return ret;
} } | public class class_name {
protected DoubleMatrix2D createFullDataMatrix(DoubleMatrix2D SubDiagonalSymmMatrix){
int c = SubDiagonalSymmMatrix.columns();
DoubleMatrix2D ret = F2.make(c, c);
for(int i=0; i<c; i++){
for(int j=0; j<=i; j++){
ret.setQuick(i, j, SubDiagonalSymmMatrix.getQuick(i, j));
// depends on control dependency: [for], data = [j]
ret.setQuick(j, i, SubDiagonalSymmMatrix.getQuick(i, j));
// depends on control dependency: [for], data = [j]
}
}
return ret;
} } |
public class class_name {
void logException(HttpServletRequest req, Level level, String sourceMethod, Throwable t) {
if (log.isLoggable(level)) {
StringBuffer sb = new StringBuffer();
// add the request URI and query args
String uri = req.getRequestURI();
if (uri != null) {
sb.append(uri);
String queryArgs = req.getQueryString();
if (queryArgs != null) {
sb.append("?").append(queryArgs); //$NON-NLS-1$
}
}
// append the exception class name
sb.append(": ").append(t.getClass().getName()); //$NON-NLS-1$
// append the exception message
sb.append(" - ").append(t.getMessage() != null ? t.getMessage() : "null"); //$NON-NLS-1$//$NON-NLS-2$
log.logp(level, AbstractAggregatorImpl.class.getName(), sourceMethod, sb.toString(), t);
}
} } | public class class_name {
void logException(HttpServletRequest req, Level level, String sourceMethod, Throwable t) {
if (log.isLoggable(level)) {
StringBuffer sb = new StringBuffer();
// add the request URI and query args
String uri = req.getRequestURI();
if (uri != null) {
sb.append(uri);
// depends on control dependency: [if], data = [(uri]
String queryArgs = req.getQueryString();
if (queryArgs != null) {
sb.append("?").append(queryArgs); //$NON-NLS-1$
// depends on control dependency: [if], data = [(queryArgs]
}
}
// append the exception class name
sb.append(": ").append(t.getClass().getName()); //$NON-NLS-1$
// depends on control dependency: [if], data = [none]
// append the exception message
sb.append(" - ").append(t.getMessage() != null ? t.getMessage() : "null"); //$NON-NLS-1$//$NON-NLS-2$
// depends on control dependency: [if], data = [none]
log.logp(level, AbstractAggregatorImpl.class.getName(), sourceMethod, sb.toString(), t);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setEntityArns(java.util.Collection<String> entityArns) {
if (entityArns == null) {
this.entityArns = null;
return;
}
this.entityArns = new java.util.ArrayList<String>(entityArns);
} } | public class class_name {
public void setEntityArns(java.util.Collection<String> entityArns) {
if (entityArns == null) {
this.entityArns = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.entityArns = new java.util.ArrayList<String>(entityArns);
} } |
public class class_name {
void setHandshakeSessionSE(SSLSessionImpl handshakeSession) {
if (conn != null) {
conn.setHandshakeSession(handshakeSession);
} else {
engine.setHandshakeSession(handshakeSession);
}
} } | public class class_name {
void setHandshakeSessionSE(SSLSessionImpl handshakeSession) {
if (conn != null) {
conn.setHandshakeSession(handshakeSession); // depends on control dependency: [if], data = [none]
} else {
engine.setHandshakeSession(handshakeSession); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public AtomicValue operate(final AtomicValue mOperand1, final AtomicValue mOperand2)
throws TTXPathException {
final Type returnType = getReturnType(mOperand1.getTypeKey(), mOperand2.getTypeKey());
final int typeKey = NamePageHash.generateHashForString(returnType.getStringRepr());
final byte[] value;
switch (returnType) {
case DECIMAL:
case FLOAT:
case DOUBLE:
final double aD = Double.parseDouble(new String(mOperand1.getRawValue()));
final double dValue;
if (aD == 0.0 || aD == -0.0) {
dValue = Double.NaN;
} else {
dValue = aD / Double.parseDouble(new String(mOperand2.getRawValue()));
}
value = TypedValue.getBytes(dValue);
return new AtomicValue(value, typeKey);
case INTEGER:
try {
final int iValue =
(int)Double.parseDouble(new String(mOperand1.getRawValue()))
/ (int)Double.parseDouble(new String(mOperand2.getRawValue()));
value = TypedValue.getBytes(iValue);
return new AtomicValue(value, typeKey);
} catch (final ArithmeticException e) {
throw new XPathError(ErrorType.FOAR0001);
}
case YEAR_MONTH_DURATION:
case DAY_TIME_DURATION:
throw new IllegalStateException("Add operator is not implemented for the type "
+ returnType.getStringRepr() + " yet.");
default:
throw new XPathError(ErrorType.XPTY0004);
}
} } | public class class_name {
@Override
public AtomicValue operate(final AtomicValue mOperand1, final AtomicValue mOperand2)
throws TTXPathException {
final Type returnType = getReturnType(mOperand1.getTypeKey(), mOperand2.getTypeKey());
final int typeKey = NamePageHash.generateHashForString(returnType.getStringRepr());
final byte[] value;
switch (returnType) {
case DECIMAL:
case FLOAT:
case DOUBLE:
final double aD = Double.parseDouble(new String(mOperand1.getRawValue()));
final double dValue;
if (aD == 0.0 || aD == -0.0) {
dValue = Double.NaN; // depends on control dependency: [if], data = [none]
} else {
dValue = aD / Double.parseDouble(new String(mOperand2.getRawValue())); // depends on control dependency: [if], data = [none]
}
value = TypedValue.getBytes(dValue);
return new AtomicValue(value, typeKey);
case INTEGER:
try {
final int iValue =
(int)Double.parseDouble(new String(mOperand1.getRawValue()))
/ (int)Double.parseDouble(new String(mOperand2.getRawValue()));
value = TypedValue.getBytes(iValue); // depends on control dependency: [try], data = [none]
return new AtomicValue(value, typeKey); // depends on control dependency: [try], data = [none]
} catch (final ArithmeticException e) {
throw new XPathError(ErrorType.FOAR0001);
} // depends on control dependency: [catch], data = [none]
case YEAR_MONTH_DURATION:
case DAY_TIME_DURATION:
throw new IllegalStateException("Add operator is not implemented for the type "
+ returnType.getStringRepr() + " yet.");
default:
throw new XPathError(ErrorType.XPTY0004);
}
} } |
public class class_name {
private void gcFileIfStale(UfsJournalFile file, long checkpointSequenceNumber) {
if (file.getEnd() > checkpointSequenceNumber && !file.isTmpCheckpoint()) {
return;
}
long lastModifiedTimeMs;
try {
lastModifiedTimeMs = mUfs.getFileStatus(file.getLocation().toString()).getLastModifiedTime();
} catch (IOException e) {
LOG.warn("Failed to get the last modified time for {}.", file.getLocation());
return;
}
long thresholdMs = file.isTmpCheckpoint()
? ServerConfiguration.getMs(PropertyKey.MASTER_JOURNAL_TEMPORARY_FILE_GC_THRESHOLD_MS)
: ServerConfiguration.getMs(PropertyKey.MASTER_JOURNAL_GC_THRESHOLD_MS);
if (System.currentTimeMillis() - lastModifiedTimeMs > thresholdMs) {
deleteNoException(file.getLocation());
}
} } | public class class_name {
private void gcFileIfStale(UfsJournalFile file, long checkpointSequenceNumber) {
if (file.getEnd() > checkpointSequenceNumber && !file.isTmpCheckpoint()) {
return; // depends on control dependency: [if], data = [none]
}
long lastModifiedTimeMs;
try {
lastModifiedTimeMs = mUfs.getFileStatus(file.getLocation().toString()).getLastModifiedTime(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOG.warn("Failed to get the last modified time for {}.", file.getLocation());
return;
} // depends on control dependency: [catch], data = [none]
long thresholdMs = file.isTmpCheckpoint()
? ServerConfiguration.getMs(PropertyKey.MASTER_JOURNAL_TEMPORARY_FILE_GC_THRESHOLD_MS)
: ServerConfiguration.getMs(PropertyKey.MASTER_JOURNAL_GC_THRESHOLD_MS);
if (System.currentTimeMillis() - lastModifiedTimeMs > thresholdMs) {
deleteNoException(file.getLocation()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setCidrAllowedList(java.util.Collection<String> cidrAllowedList) {
if (cidrAllowedList == null) {
this.cidrAllowedList = null;
return;
}
this.cidrAllowedList = new java.util.ArrayList<String>(cidrAllowedList);
} } | public class class_name {
public void setCidrAllowedList(java.util.Collection<String> cidrAllowedList) {
if (cidrAllowedList == null) {
this.cidrAllowedList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.cidrAllowedList = new java.util.ArrayList<String>(cidrAllowedList);
} } |
public class class_name {
public void marshall(PreviewAgentsRequest previewAgentsRequest, ProtocolMarshaller protocolMarshaller) {
if (previewAgentsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(previewAgentsRequest.getPreviewAgentsArn(), PREVIEWAGENTSARN_BINDING);
protocolMarshaller.marshall(previewAgentsRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(previewAgentsRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PreviewAgentsRequest previewAgentsRequest, ProtocolMarshaller protocolMarshaller) {
if (previewAgentsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(previewAgentsRequest.getPreviewAgentsArn(), PREVIEWAGENTSARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(previewAgentsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(previewAgentsRequest.getMaxResults(), MAXRESULTS_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 {
@Override
public void logp(Level level, String sourceClass, String sourceMethod, String msg) {
if (isLoggable(level)) {
LogRecord logRecord = createLogRecord(level, msg, null, sourceClass, sourceMethod, null, null);
log(logRecord);
}
} } | public class class_name {
@Override
public void logp(Level level, String sourceClass, String sourceMethod, String msg) {
if (isLoggable(level)) {
LogRecord logRecord = createLogRecord(level, msg, null, sourceClass, sourceMethod, null, null);
log(logRecord); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public RouteTable withRoutes(Route... routes) {
if (this.routes == null) {
setRoutes(new com.amazonaws.internal.SdkInternalList<Route>(routes.length));
}
for (Route ele : routes) {
this.routes.add(ele);
}
return this;
} } | public class class_name {
public RouteTable withRoutes(Route... routes) {
if (this.routes == null) {
setRoutes(new com.amazonaws.internal.SdkInternalList<Route>(routes.length)); // depends on control dependency: [if], data = [none]
}
for (Route ele : routes) {
this.routes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public boolean cleanupDestination() throws SIRollbackException, SIConnectionLostException, SIIncorrectCallException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "cleanupDestination");
boolean cleanedUp;
//Clean up any remote localisations, reallocate messages that are marked as guesses
cleanedUp = super.cleanupLocalisations();
//Ensure any cleanup does not occur at the same time the link is being used.
synchronized(this)
{
if (isToBeDeleted())
{
// Clean up any PubSub neighbours that were making use of
// the link
messageProcessor.getProxyHandler().cleanupLinkNeighbour(_busName);
// A link can have inbound target stream state without a localisation for
// the messages to be put onto, as it routes the messages directly onto
// other destinations in the bus. Until all the inbound streams are flushed,
// the link cannot be deleted.
PtoPInputHandler ptoPInputHandler = (PtoPInputHandler) getInputHandler(ProtocolType.UNICASTINPUT, null, null);
TargetStreamManager targetStreamManager = ptoPInputHandler.getTargetStreamManager();
if (targetStreamManager.isEmpty())
{
cleanedUp = super.cleanupDestination();
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "cleanupDestination", new Boolean(cleanedUp));
return cleanedUp;
} } | public class class_name {
public boolean cleanupDestination() throws SIRollbackException, SIConnectionLostException, SIIncorrectCallException, SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "cleanupDestination");
boolean cleanedUp;
//Clean up any remote localisations, reallocate messages that are marked as guesses
cleanedUp = super.cleanupLocalisations();
//Ensure any cleanup does not occur at the same time the link is being used.
synchronized(this)
{
if (isToBeDeleted())
{
// Clean up any PubSub neighbours that were making use of
// the link
messageProcessor.getProxyHandler().cleanupLinkNeighbour(_busName); // depends on control dependency: [if], data = [none]
// A link can have inbound target stream state without a localisation for
// the messages to be put onto, as it routes the messages directly onto
// other destinations in the bus. Until all the inbound streams are flushed,
// the link cannot be deleted.
PtoPInputHandler ptoPInputHandler = (PtoPInputHandler) getInputHandler(ProtocolType.UNICASTINPUT, null, null);
TargetStreamManager targetStreamManager = ptoPInputHandler.getTargetStreamManager();
if (targetStreamManager.isEmpty())
{
cleanedUp = super.cleanupDestination(); // depends on control dependency: [if], data = [none]
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "cleanupDestination", new Boolean(cleanedUp));
return cleanedUp;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.