code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private DescribeImagesResponseType describeImages(final Set<String> imageId) {
DescribeImagesResponseType ret = new DescribeImagesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
DescribeImagesResponseInfoType info = new DescribeImagesResponseInfoType();
for (String ami : MOCK_AMIS) {
if (imageId == null || imageId.isEmpty()) {
DescribeImagesResponseItemType item = new DescribeImagesResponseItemType();
item.setImageId(ami);
item.setArchitecture("x86_64");
item.setVirtualizationType("paravirtual");
item.setName("My server");
item.setHypervisor("xen");
item.setRootDeviceType("ebs");
item.setImageLocation("123456789012/My server");
item.setKernelId("aki-88aa75e1");
item.setImageOwnerId("123456789012");
item.setRootDeviceName("/dev/sda1");
item.setIsPublic(false);
item.setImageType("machine");
BlockDeviceMappingType blockDeviceMappingType = new BlockDeviceMappingType();
BlockDeviceMappingItemType blockDeviceMapping = new BlockDeviceMappingItemType();
blockDeviceMapping.setDeviceName("/dev/sda1");
EbsBlockDeviceType ebs = new EbsBlockDeviceType();
ebs.setDeleteOnTermination(true);
ebs.setSnapshotId("snap-1234567890abcdef0");
ebs.setVolumeSize(1);
ebs.setVolumeType("standard");
blockDeviceMapping.setEbs(ebs);
blockDeviceMappingType.getItem().add(blockDeviceMapping);
item.setBlockDeviceMapping(blockDeviceMappingType);
info.getItem().add(item);
} else if (imageId.contains(ami)) {
DescribeImagesResponseItemType item = new DescribeImagesResponseItemType();
item.setImageId(ami);
item.setArchitecture("x86_64");
item.setVirtualizationType("paravirtual");
item.setName("My server");
item.setHypervisor("xen");
item.setRootDeviceType("ebs");
item.setImageLocation("123456789012/My server");
item.setKernelId("aki-88aa75e1");
item.setImageOwnerId("123456789012");
item.setRootDeviceName("/dev/sda1");
item.setIsPublic(false);
item.setImageType("machine");
BlockDeviceMappingType blockDeviceMappingType = new BlockDeviceMappingType();
BlockDeviceMappingItemType blockDeviceMapping = new BlockDeviceMappingItemType();
blockDeviceMapping.setDeviceName("/dev/sda1");
EbsBlockDeviceType ebs = new EbsBlockDeviceType();
ebs.setDeleteOnTermination(true);
ebs.setSnapshotId("snap-1234567890abcdef0");
ebs.setVolumeSize(1);
ebs.setVolumeType("standard");
blockDeviceMapping.setEbs(ebs);
blockDeviceMappingType.getItem().add(blockDeviceMapping);
item.setBlockDeviceMapping(blockDeviceMappingType);
info.getItem().add(item);
}
}
ret.setImagesSet(info);
return ret;
} }
|
public class class_name {
private DescribeImagesResponseType describeImages(final Set<String> imageId) {
DescribeImagesResponseType ret = new DescribeImagesResponseType();
ret.setRequestId(UUID.randomUUID().toString());
DescribeImagesResponseInfoType info = new DescribeImagesResponseInfoType();
for (String ami : MOCK_AMIS) {
if (imageId == null || imageId.isEmpty()) {
DescribeImagesResponseItemType item = new DescribeImagesResponseItemType();
item.setImageId(ami); // depends on control dependency: [if], data = [none]
item.setArchitecture("x86_64"); // depends on control dependency: [if], data = [none]
item.setVirtualizationType("paravirtual"); // depends on control dependency: [if], data = [none]
item.setName("My server"); // depends on control dependency: [if], data = [none]
item.setHypervisor("xen"); // depends on control dependency: [if], data = [none]
item.setRootDeviceType("ebs"); // depends on control dependency: [if], data = [none]
item.setImageLocation("123456789012/My server"); // depends on control dependency: [if], data = [none]
item.setKernelId("aki-88aa75e1"); // depends on control dependency: [if], data = [none]
item.setImageOwnerId("123456789012"); // depends on control dependency: [if], data = [none]
item.setRootDeviceName("/dev/sda1"); // depends on control dependency: [if], data = [none]
item.setIsPublic(false); // depends on control dependency: [if], data = [none]
item.setImageType("machine"); // depends on control dependency: [if], data = [none]
BlockDeviceMappingType blockDeviceMappingType = new BlockDeviceMappingType();
BlockDeviceMappingItemType blockDeviceMapping = new BlockDeviceMappingItemType();
blockDeviceMapping.setDeviceName("/dev/sda1"); // depends on control dependency: [if], data = [none]
EbsBlockDeviceType ebs = new EbsBlockDeviceType();
ebs.setDeleteOnTermination(true); // depends on control dependency: [if], data = [none]
ebs.setSnapshotId("snap-1234567890abcdef0"); // depends on control dependency: [if], data = [none]
ebs.setVolumeSize(1); // depends on control dependency: [if], data = [none]
ebs.setVolumeType("standard"); // depends on control dependency: [if], data = [none]
blockDeviceMapping.setEbs(ebs); // depends on control dependency: [if], data = [none]
blockDeviceMappingType.getItem().add(blockDeviceMapping); // depends on control dependency: [if], data = [none]
item.setBlockDeviceMapping(blockDeviceMappingType); // depends on control dependency: [if], data = [none]
info.getItem().add(item); // depends on control dependency: [if], data = [none]
} else if (imageId.contains(ami)) {
DescribeImagesResponseItemType item = new DescribeImagesResponseItemType();
item.setImageId(ami); // depends on control dependency: [if], data = [none]
item.setArchitecture("x86_64"); // depends on control dependency: [if], data = [none]
item.setVirtualizationType("paravirtual"); // depends on control dependency: [if], data = [none]
item.setName("My server"); // depends on control dependency: [if], data = [none]
item.setHypervisor("xen"); // depends on control dependency: [if], data = [none]
item.setRootDeviceType("ebs"); // depends on control dependency: [if], data = [none]
item.setImageLocation("123456789012/My server"); // depends on control dependency: [if], data = [none]
item.setKernelId("aki-88aa75e1"); // depends on control dependency: [if], data = [none]
item.setImageOwnerId("123456789012"); // depends on control dependency: [if], data = [none]
item.setRootDeviceName("/dev/sda1"); // depends on control dependency: [if], data = [none]
item.setIsPublic(false); // depends on control dependency: [if], data = [none]
item.setImageType("machine"); // depends on control dependency: [if], data = [none]
BlockDeviceMappingType blockDeviceMappingType = new BlockDeviceMappingType();
BlockDeviceMappingItemType blockDeviceMapping = new BlockDeviceMappingItemType();
blockDeviceMapping.setDeviceName("/dev/sda1"); // depends on control dependency: [if], data = [none]
EbsBlockDeviceType ebs = new EbsBlockDeviceType();
ebs.setDeleteOnTermination(true); // depends on control dependency: [if], data = [none]
ebs.setSnapshotId("snap-1234567890abcdef0"); // depends on control dependency: [if], data = [none]
ebs.setVolumeSize(1); // depends on control dependency: [if], data = [none]
ebs.setVolumeType("standard"); // depends on control dependency: [if], data = [none]
blockDeviceMapping.setEbs(ebs); // depends on control dependency: [if], data = [none]
blockDeviceMappingType.getItem().add(blockDeviceMapping); // depends on control dependency: [if], data = [none]
item.setBlockDeviceMapping(blockDeviceMappingType); // depends on control dependency: [if], data = [none]
info.getItem().add(item); // depends on control dependency: [if], data = [none]
}
}
ret.setImagesSet(info);
return ret;
} }
|
public class class_name {
public EventDestination withMatchingEventTypes(EventType... matchingEventTypes) {
com.amazonaws.internal.SdkInternalList<String> matchingEventTypesCopy = new com.amazonaws.internal.SdkInternalList<String>(matchingEventTypes.length);
for (EventType value : matchingEventTypes) {
matchingEventTypesCopy.add(value.toString());
}
if (getMatchingEventTypes() == null) {
setMatchingEventTypes(matchingEventTypesCopy);
} else {
getMatchingEventTypes().addAll(matchingEventTypesCopy);
}
return this;
} }
|
public class class_name {
public EventDestination withMatchingEventTypes(EventType... matchingEventTypes) {
com.amazonaws.internal.SdkInternalList<String> matchingEventTypesCopy = new com.amazonaws.internal.SdkInternalList<String>(matchingEventTypes.length);
for (EventType value : matchingEventTypes) {
matchingEventTypesCopy.add(value.toString()); // depends on control dependency: [for], data = [value]
}
if (getMatchingEventTypes() == null) {
setMatchingEventTypes(matchingEventTypesCopy); // depends on control dependency: [if], data = [none]
} else {
getMatchingEventTypes().addAll(matchingEventTypesCopy); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public static Content getInlineTagOuput(TagletManager tagletManager,
Tag holderTag, Tag inlineTag, TagletWriter tagletWriter) {
Taglet[] definedTags = tagletManager.getInlineCustomTaglets();
//This is a custom inline tag.
for (int j = 0; j < definedTags.length; j++) {
if (("@"+definedTags[j].getName()).equals(inlineTag.name())) {
//Given a name of a seen custom tag, remove it from the
// set of unseen custom tags.
tagletManager.seenCustomTag(definedTags[j].getName());
Content output = definedTags[j].getTagletOutput(
holderTag != null &&
definedTags[j].getName().equals("inheritDoc") ?
holderTag : inlineTag, tagletWriter);
return output;
}
}
return null;
} }
|
public class class_name {
public static Content getInlineTagOuput(TagletManager tagletManager,
Tag holderTag, Tag inlineTag, TagletWriter tagletWriter) {
Taglet[] definedTags = tagletManager.getInlineCustomTaglets();
//This is a custom inline tag.
for (int j = 0; j < definedTags.length; j++) {
if (("@"+definedTags[j].getName()).equals(inlineTag.name())) {
//Given a name of a seen custom tag, remove it from the
// set of unseen custom tags.
tagletManager.seenCustomTag(definedTags[j].getName()); // depends on control dependency: [if], data = [none]
Content output = definedTags[j].getTagletOutput(
holderTag != null &&
definedTags[j].getName().equals("inheritDoc") ?
holderTag : inlineTag, tagletWriter);
return output; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public EClass getIfcBuilding() {
if (ifcBuildingEClass == null) {
ifcBuildingEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(54);
}
return ifcBuildingEClass;
} }
|
public class class_name {
public EClass getIfcBuilding() {
if (ifcBuildingEClass == null) {
ifcBuildingEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(54);
// depends on control dependency: [if], data = [none]
}
return ifcBuildingEClass;
} }
|
public class class_name {
public static void finishIfApplicable(Iterable<?> toFinish) throws IOException {
for (final Object o : toFinish) {
if (o instanceof Finishable) {
((Finishable) o).finish();
}
}
} }
|
public class class_name {
public static void finishIfApplicable(Iterable<?> toFinish) throws IOException {
for (final Object o : toFinish) {
if (o instanceof Finishable) {
((Finishable) o).finish(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static Date parseq(DateFormat fmt, String s) {
try {
return parse(fmt, s);
}
catch (ParseException e) {
throw Lang.wrapThrow(e);
}
} }
|
public class class_name {
public static Date parseq(DateFormat fmt, String s) {
try {
return parse(fmt, s);
// depends on control dependency: [try], data = [none]
}
catch (ParseException e) {
throw Lang.wrapThrow(e);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void inverse1(WaveletDescription<WlCoef_I32> desc ,
GrayS32 input , GrayS32 output ,
GrayS32 storage , int minValue , int maxValue )
{
UtilWavelet.checkShape(output,input);
WlCoef_I32 coef = desc.getForward();
if( output.width < coef.scaling.length || output.width < coef.wavelet.length )
throw new IllegalArgumentException("Wavelet is too large for provided image.");
if( output.height < coef.scaling.length || output.height < coef.wavelet.length )
throw new IllegalArgumentException("Wavelet is too large for provided image.");
storage = InputSanityCheck.checkDeclare(input, storage);
// the faster routines can only be run on images which are not too small
int minSize = Math.max(coef.getScalingLength(),coef.getWaveletLength())*3;
if( output.getWidth() <= minSize || output.getHeight() <= minSize ) {
ImplWaveletTransformNaive.verticalInverse(desc.getBorder(),desc.getInverse(),input,storage);
ImplWaveletTransformNaive.horizontalInverse(desc.getBorder(),desc.getInverse(),storage,output);
} else {
ImplWaveletTransformInner.verticalInverse(desc.getInverse().getInnerCoefficients(),input,storage);
ImplWaveletTransformBorder.verticalInverse(desc.getBorder(),desc.getInverse(),input,storage);
ImplWaveletTransformInner.horizontalInverse(desc.getInverse().getInnerCoefficients(),storage,output);
ImplWaveletTransformBorder.horizontalInverse(desc.getBorder(),desc.getInverse(),storage,output);
}
if( minValue != Integer.MIN_VALUE && maxValue != Integer.MAX_VALUE )
PixelMath.boundImage(output,minValue,maxValue);
} }
|
public class class_name {
public static void inverse1(WaveletDescription<WlCoef_I32> desc ,
GrayS32 input , GrayS32 output ,
GrayS32 storage , int minValue , int maxValue )
{
UtilWavelet.checkShape(output,input);
WlCoef_I32 coef = desc.getForward();
if( output.width < coef.scaling.length || output.width < coef.wavelet.length )
throw new IllegalArgumentException("Wavelet is too large for provided image.");
if( output.height < coef.scaling.length || output.height < coef.wavelet.length )
throw new IllegalArgumentException("Wavelet is too large for provided image.");
storage = InputSanityCheck.checkDeclare(input, storage);
// the faster routines can only be run on images which are not too small
int minSize = Math.max(coef.getScalingLength(),coef.getWaveletLength())*3;
if( output.getWidth() <= minSize || output.getHeight() <= minSize ) {
ImplWaveletTransformNaive.verticalInverse(desc.getBorder(),desc.getInverse(),input,storage); // depends on control dependency: [if], data = [none]
ImplWaveletTransformNaive.horizontalInverse(desc.getBorder(),desc.getInverse(),storage,output); // depends on control dependency: [if], data = [none]
} else {
ImplWaveletTransformInner.verticalInverse(desc.getInverse().getInnerCoefficients(),input,storage); // depends on control dependency: [if], data = [none]
ImplWaveletTransformBorder.verticalInverse(desc.getBorder(),desc.getInverse(),input,storage); // depends on control dependency: [if], data = [none]
ImplWaveletTransformInner.horizontalInverse(desc.getInverse().getInnerCoefficients(),storage,output); // depends on control dependency: [if], data = [none]
ImplWaveletTransformBorder.horizontalInverse(desc.getBorder(),desc.getInverse(),storage,output); // depends on control dependency: [if], data = [none]
}
if( minValue != Integer.MIN_VALUE && maxValue != Integer.MAX_VALUE )
PixelMath.boundImage(output,minValue,maxValue);
} }
|
public class class_name {
protected void filter(String value, AbstractRenderAppender writer, boolean markupHTMLSpaceReturn)
{
if (value.equals(" ")) {
writer.append(" ");
return;
}
HtmlUtils.filter(value, writer, markupHTMLSpaceReturn);
} }
|
public class class_name {
protected void filter(String value, AbstractRenderAppender writer, boolean markupHTMLSpaceReturn)
{
if (value.equals(" ")) {
writer.append(" "); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
HtmlUtils.filter(value, writer, markupHTMLSpaceReturn);
} }
|
public class class_name {
@Override
public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
if (validating) {
try {
InputSource source = null;
if (publicId != null) {
String path = doctypeMap.get(publicId.toUpperCase());
source = getInputSource(path);
}
if (source == null && systemId != null) {
String path = doctypeMap.get(systemId.toUpperCase());
source = getInputSource(path);
}
return source;
} catch (Exception e) {
throw new SAXException(e.toString());
}
} else {
return new InputSource(new StringReader(""));
}
} }
|
public class class_name {
@Override
public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
if (validating) {
try {
InputSource source = null;
if (publicId != null) {
String path = doctypeMap.get(publicId.toUpperCase());
source = getInputSource(path); // depends on control dependency: [if], data = [none]
}
if (source == null && systemId != null) {
String path = doctypeMap.get(systemId.toUpperCase());
source = getInputSource(path); // depends on control dependency: [if], data = [none]
}
return source; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SAXException(e.toString());
} // depends on control dependency: [catch], data = [none]
} else {
return new InputSource(new StringReader(""));
}
} }
|
public class class_name {
public static void createTemplateWithJson(RestClient client, String template, String json, boolean force) throws Exception {
if (isTemplateExist(client, template)) {
if (force) {
logger.debug("Template [{}] already exists. Force is set. Removing it.", template);
removeTemplate(client, template);
} else {
logger.debug("Template [{}] already exists.", template);
}
}
if (!isTemplateExist(client, template)) {
logger.debug("Template [{}] doesn't exist. Creating it.", template);
createTemplateWithJsonInElasticsearch(client, template, json);
}
} }
|
public class class_name {
public static void createTemplateWithJson(RestClient client, String template, String json, boolean force) throws Exception {
if (isTemplateExist(client, template)) {
if (force) {
logger.debug("Template [{}] already exists. Force is set. Removing it.", template); // depends on control dependency: [if], data = [none]
removeTemplate(client, template); // depends on control dependency: [if], data = [none]
} else {
logger.debug("Template [{}] already exists.", template); // depends on control dependency: [if], data = [none]
}
}
if (!isTemplateExist(client, template)) {
logger.debug("Template [{}] doesn't exist. Creating it.", template);
createTemplateWithJsonInElasticsearch(client, template, json);
}
} }
|
public class class_name {
public PersonMatch withFaceMatches(FaceMatch... faceMatches) {
if (this.faceMatches == null) {
setFaceMatches(new java.util.ArrayList<FaceMatch>(faceMatches.length));
}
for (FaceMatch ele : faceMatches) {
this.faceMatches.add(ele);
}
return this;
} }
|
public class class_name {
public PersonMatch withFaceMatches(FaceMatch... faceMatches) {
if (this.faceMatches == null) {
setFaceMatches(new java.util.ArrayList<FaceMatch>(faceMatches.length)); // depends on control dependency: [if], data = [none]
}
for (FaceMatch ele : faceMatches) {
this.faceMatches.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public Span[][] tag(final int numTaggings, final String[] tokens) {
final Sequence[] bestSequences = this.model.bestSequences(numTaggings,
tokens, null, this.contextGenerator, this.sequenceValidator);
final Span[][] tags = new Span[bestSequences.length][];
for (int i = 0; i < tags.length; i++) {
final List<String> c = bestSequences[i].getOutcomes();
this.contextGenerator.updateAdaptiveData(tokens,
c.toArray(new String[c.size()]));
final Span[] spans = this.seqCodec.decode(c);
tags[i] = spans;
}
return tags;
} }
|
public class class_name {
public Span[][] tag(final int numTaggings, final String[] tokens) {
final Sequence[] bestSequences = this.model.bestSequences(numTaggings,
tokens, null, this.contextGenerator, this.sequenceValidator);
final Span[][] tags = new Span[bestSequences.length][];
for (int i = 0; i < tags.length; i++) {
final List<String> c = bestSequences[i].getOutcomes();
this.contextGenerator.updateAdaptiveData(tokens,
c.toArray(new String[c.size()])); // depends on control dependency: [for], data = [none]
final Span[] spans = this.seqCodec.decode(c);
tags[i] = spans; // depends on control dependency: [for], data = [i]
}
return tags;
} }
|
public class class_name {
protected void rewriteContent(CmsFile file, Collection<CmsRelation> relations) throws CmsException {
LOG.info("Rewriting in-content links for " + file.getRootPath());
CmsPair<String, String> contentAndEncoding = decode(file);
String content = "";
if (OpenCms.getResourceManager().getResourceType(file) instanceof CmsResourceTypeXmlContent) {
CmsXmlContent contentXml = CmsXmlContentFactory.unmarshal(m_cms, file);
try {
contentXml.validateXmlStructure(new CmsXmlEntityResolver(m_cms));
} catch (CmsException e) {
LOG.info("XML content was corrected automatically for resource " + file.getRootPath());
contentXml.setAutoCorrectionEnabled(true);
contentXml.correctXmlStructure(m_cms);
try {
content = new String(contentXml.marshal(), contentAndEncoding.getSecond());
} catch (UnsupportedEncodingException e1) {
//
}
}
}
if (content.isEmpty()) {
content = contentAndEncoding.getFirst();
}
String encodingForSave = contentAndEncoding.getSecond();
String newContent = rewriteContentString(content);
byte[] newContentBytes;
try {
newContentBytes = newContent.getBytes(encodingForSave);
} catch (UnsupportedEncodingException e) {
newContentBytes = newContent.getBytes();
}
file.setContents(newContentBytes);
m_cms.writeFile(file);
} }
|
public class class_name {
protected void rewriteContent(CmsFile file, Collection<CmsRelation> relations) throws CmsException {
LOG.info("Rewriting in-content links for " + file.getRootPath());
CmsPair<String, String> contentAndEncoding = decode(file);
String content = "";
if (OpenCms.getResourceManager().getResourceType(file) instanceof CmsResourceTypeXmlContent) {
CmsXmlContent contentXml = CmsXmlContentFactory.unmarshal(m_cms, file);
try {
contentXml.validateXmlStructure(new CmsXmlEntityResolver(m_cms)); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.info("XML content was corrected automatically for resource " + file.getRootPath());
contentXml.setAutoCorrectionEnabled(true);
contentXml.correctXmlStructure(m_cms);
try {
content = new String(contentXml.marshal(), contentAndEncoding.getSecond()); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e1) {
//
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
}
if (content.isEmpty()) {
content = contentAndEncoding.getFirst();
}
String encodingForSave = contentAndEncoding.getSecond();
String newContent = rewriteContentString(content);
byte[] newContentBytes;
try {
newContentBytes = newContent.getBytes(encodingForSave);
} catch (UnsupportedEncodingException e) {
newContentBytes = newContent.getBytes();
}
file.setContents(newContentBytes);
m_cms.writeFile(file);
} }
|
public class class_name {
private static String adjustData(String data, ClassNode type, DelegationMetadata dmd) {
StringBuilder path = new StringBuilder();
int i = 0;
String[] propertyPath = data.split("\\.");
while (dmd != null) {
int strategy = dmd.getStrategy();
ClassNode delegate = dmd.getType();
dmd = dmd.getParent();
switch (strategy) {
case Closure.DELEGATE_FIRST:
if (!delegate.isDerivedFrom(CLOSURE_TYPE) && !delegate.isDerivedFrom(type)) {
path.append("owner"); // must be non-delegate case
} else {
path.append("delegate");
}
break;
default:
if (i >= propertyPath.length) return data;
path.append(propertyPath[i]);
}
if (type.equals(delegate)) break;
i++;
if (dmd != null) path.append('.');
}
String result = path.toString();
if (!result.isEmpty()) {
return result;
}
return data;
} }
|
public class class_name {
private static String adjustData(String data, ClassNode type, DelegationMetadata dmd) {
StringBuilder path = new StringBuilder();
int i = 0;
String[] propertyPath = data.split("\\.");
while (dmd != null) {
int strategy = dmd.getStrategy();
ClassNode delegate = dmd.getType();
dmd = dmd.getParent(); // depends on control dependency: [while], data = [none]
switch (strategy) {
case Closure.DELEGATE_FIRST:
if (!delegate.isDerivedFrom(CLOSURE_TYPE) && !delegate.isDerivedFrom(type)) {
path.append("owner"); // must be non-delegate case // depends on control dependency: [if], data = [none]
} else {
path.append("delegate"); // depends on control dependency: [if], data = [none]
}
break;
default:
if (i >= propertyPath.length) return data;
path.append(propertyPath[i]);
}
if (type.equals(delegate)) break;
i++; // depends on control dependency: [while], data = [none]
if (dmd != null) path.append('.');
}
String result = path.toString();
if (!result.isEmpty()) {
return result; // depends on control dependency: [if], data = [none]
}
return data;
} }
|
public class class_name {
public void renderLinesImpl(float[] points, int count, float w) {
float width = w / 2;
float lastx1 = 0;
float lasty1 = 0;
float lastx2 = 0;
float lasty2 = 0;
GL.glBegin(SGL.GL_QUADS);
for (int i=0;i<count+1;i++) {
int current = i;
int next = i+1;
int prev = i-1;
if (prev < 0) {
prev += count;
}
if (next >= count) {
next -= count;
}
if (current >= count) {
current -= count;
}
float x1 = points[(current*2)];
float y1 = points[(current*2)+1];
float x2 = points[(next*2)];
float y2 = points[(next*2)+1];
// draw the next segment
float dx = x2 - x1;
float dy = y2 - y1;
if ((dx == 0) && (dy == 0)) {
continue;
}
float d2 = (dx*dx)+(dy*dy);
float d = (float) Math.sqrt(d2);
dx *= width;
dy *= width;
dx /= d;
dy /= d;
float tx = dy;
float ty = -dx;
if (i != 0) {
bindColor(prev);
GL.glVertex3f(lastx1,lasty1,0);
GL.glVertex3f(lastx2,lasty2,0);
bindColor(current);
GL.glVertex3f(x1+tx,y1+ty,0);
GL.glVertex3f(x1-tx,y1-ty,0);
}
lastx1 = x2-tx;
lasty1 = y2-ty;
lastx2 = x2+tx;
lasty2 = y2+ty;
if (i < count-1) {
bindColor(current);
GL.glVertex3f(x1+tx,y1+ty,0);
GL.glVertex3f(x1-tx,y1-ty,0);
bindColor(next);
GL.glVertex3f(x2-tx,y2-ty,0);
GL.glVertex3f(x2+tx,y2+ty,0);
}
}
GL.glEnd();
float step = width <= 12.5f ? 5 : 180 / (float)Math.ceil(width / 2.5);
// start cap
if (lineCaps) {
float dx = points[2] - points[0];
float dy = points[3] - points[1];
float fang = (float) Math.toDegrees(Math.atan2(dy,dx)) + 90;
if ((dx != 0) || (dy != 0)) {
GL.glBegin(SGL.GL_TRIANGLE_FAN);
bindColor(0);
GL.glVertex2f(points[0], points[1]);
for (int i=0;i<180+step;i+=step) {
float ang = (float) Math.toRadians(fang+i);
GL.glVertex2f(points[0]+((float) (Math.cos(ang) * width)),
points[1]+((float) (Math.sin(ang) * width)));
}
GL.glEnd();
}
}
// end cap
if (lineCaps) {
float dx = points[(count*2)-2] - points[(count*2)-4];
float dy = points[(count*2)-1] - points[(count*2)-3];
float fang = (float) Math.toDegrees(Math.atan2(dy,dx)) - 90;
if ((dx != 0) || (dy != 0)) {
GL.glBegin(SGL.GL_TRIANGLE_FAN);
bindColor(count-1);
GL.glVertex2f(points[(count*2)-2], points[(count*2)-1]);
for (int i=0;i<180+step;i+=step) {
float ang = (float) Math.toRadians(fang+i);
GL.glVertex2f(points[(count*2)-2]+((float) (Math.cos(ang) * width)),
points[(count*2)-1]+((float) (Math.sin(ang) * width)));
}
GL.glEnd();
}
}
} }
|
public class class_name {
public void renderLinesImpl(float[] points, int count, float w) {
float width = w / 2;
float lastx1 = 0;
float lasty1 = 0;
float lastx2 = 0;
float lasty2 = 0;
GL.glBegin(SGL.GL_QUADS);
for (int i=0;i<count+1;i++) {
int current = i;
int next = i+1;
int prev = i-1;
if (prev < 0) {
prev += count;
// depends on control dependency: [if], data = [none]
}
if (next >= count) {
next -= count;
// depends on control dependency: [if], data = [none]
}
if (current >= count) {
current -= count;
// depends on control dependency: [if], data = [none]
}
float x1 = points[(current*2)];
float y1 = points[(current*2)+1];
float x2 = points[(next*2)];
float y2 = points[(next*2)+1];
// draw the next segment
float dx = x2 - x1;
float dy = y2 - y1;
if ((dx == 0) && (dy == 0)) {
continue;
}
float d2 = (dx*dx)+(dy*dy);
float d = (float) Math.sqrt(d2);
dx *= width;
// depends on control dependency: [for], data = [none]
dy *= width;
// depends on control dependency: [for], data = [none]
dx /= d;
// depends on control dependency: [for], data = [none]
dy /= d;
// depends on control dependency: [for], data = [none]
float tx = dy;
float ty = -dx;
if (i != 0) {
bindColor(prev);
// depends on control dependency: [if], data = [none]
GL.glVertex3f(lastx1,lasty1,0);
// depends on control dependency: [if], data = [0)]
GL.glVertex3f(lastx2,lasty2,0);
// depends on control dependency: [if], data = [0)]
bindColor(current);
// depends on control dependency: [if], data = [none]
GL.glVertex3f(x1+tx,y1+ty,0);
// depends on control dependency: [if], data = [0)]
GL.glVertex3f(x1-tx,y1-ty,0);
// depends on control dependency: [if], data = [0)]
}
lastx1 = x2-tx;
// depends on control dependency: [for], data = [none]
lasty1 = y2-ty;
// depends on control dependency: [for], data = [none]
lastx2 = x2+tx;
// depends on control dependency: [for], data = [none]
lasty2 = y2+ty;
// depends on control dependency: [for], data = [none]
if (i < count-1) {
bindColor(current);
// depends on control dependency: [if], data = [none]
GL.glVertex3f(x1+tx,y1+ty,0);
// depends on control dependency: [if], data = [none]
GL.glVertex3f(x1-tx,y1-ty,0);
// depends on control dependency: [if], data = [none]
bindColor(next);
// depends on control dependency: [if], data = [none]
GL.glVertex3f(x2-tx,y2-ty,0);
// depends on control dependency: [if], data = [none]
GL.glVertex3f(x2+tx,y2+ty,0);
// depends on control dependency: [if], data = [none]
}
}
GL.glEnd();
float step = width <= 12.5f ? 5 : 180 / (float)Math.ceil(width / 2.5);
// start cap
if (lineCaps) {
float dx = points[2] - points[0];
float dy = points[3] - points[1];
float fang = (float) Math.toDegrees(Math.atan2(dy,dx)) + 90;
if ((dx != 0) || (dy != 0)) {
GL.glBegin(SGL.GL_TRIANGLE_FAN);
// depends on control dependency: [if], data = [none]
bindColor(0);
// depends on control dependency: [if], data = [none]
GL.glVertex2f(points[0], points[1]);
// depends on control dependency: [if], data = [none]
for (int i=0;i<180+step;i+=step) {
float ang = (float) Math.toRadians(fang+i);
GL.glVertex2f(points[0]+((float) (Math.cos(ang) * width)),
points[1]+((float) (Math.sin(ang) * width)));
// depends on control dependency: [for], data = [none]
}
GL.glEnd();
// depends on control dependency: [if], data = [none]
}
}
// end cap
if (lineCaps) {
float dx = points[(count*2)-2] - points[(count*2)-4];
float dy = points[(count*2)-1] - points[(count*2)-3];
float fang = (float) Math.toDegrees(Math.atan2(dy,dx)) - 90;
if ((dx != 0) || (dy != 0)) {
GL.glBegin(SGL.GL_TRIANGLE_FAN);
// depends on control dependency: [if], data = [none]
bindColor(count-1);
// depends on control dependency: [if], data = [none]
GL.glVertex2f(points[(count*2)-2], points[(count*2)-1]);
// depends on control dependency: [if], data = [none]
for (int i=0;i<180+step;i+=step) {
float ang = (float) Math.toRadians(fang+i);
GL.glVertex2f(points[(count*2)-2]+((float) (Math.cos(ang) * width)),
points[(count*2)-1]+((float) (Math.sin(ang) * width)));
// depends on control dependency: [for], data = [none]
}
GL.glEnd();
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static Graph<String, Double> loadWeightedEdgeListFile(String path, int numVertices, String delim,
boolean directed, boolean allowMultipleEdges, String... ignoreLinesStartingWith)
throws IOException {
Graph<String, Double> graph = new Graph<>(numVertices, allowMultipleEdges, new StringVertexFactory());
EdgeLineProcessor<Double> lineProcessor =
new WeightedEdgeLineProcessor(delim, directed, ignoreLinesStartingWith);
try (BufferedReader br = new BufferedReader(new FileReader(new File(path)))) {
String line;
while ((line = br.readLine()) != null) {
Edge<Double> edge = lineProcessor.processLine(line);
if (edge != null) {
graph.addEdge(edge);
}
}
}
return graph;
} }
|
public class class_name {
public static Graph<String, Double> loadWeightedEdgeListFile(String path, int numVertices, String delim,
boolean directed, boolean allowMultipleEdges, String... ignoreLinesStartingWith)
throws IOException {
Graph<String, Double> graph = new Graph<>(numVertices, allowMultipleEdges, new StringVertexFactory());
EdgeLineProcessor<Double> lineProcessor =
new WeightedEdgeLineProcessor(delim, directed, ignoreLinesStartingWith);
try (BufferedReader br = new BufferedReader(new FileReader(new File(path)))) {
String line;
while ((line = br.readLine()) != null) {
Edge<Double> edge = lineProcessor.processLine(line);
if (edge != null) {
graph.addEdge(edge); // depends on control dependency: [if], data = [(edge]
}
}
}
return graph;
} }
|
public class class_name {
private RTPFormat createAudioFormat(int payload, Text description) {
Iterator<Text> it = description.split('/').iterator();
//encoding name
Text token = it.next();
token.trim();
EncodingName name = new EncodingName(token);
//clock rate
//TODO : convert to sample rate
token = it.next();
token.trim();
int clockRate = token.toInteger();
//channels
int channels = 1;
if (it.hasNext()) {
token = it.next();
token.trim();
channels = token.toInteger();
}
RTPFormat rtpFormat = getFormat(payload);
if (rtpFormat == null) {
formats.add(new RTPFormat(payload, FormatFactory.createAudioFormat(name, clockRate, -1, channels)));
} else {
//TODO: recreate format anyway. it is illegal to use clock rate as sample rate
((AudioFormat)rtpFormat.getFormat()).setName(name);
((AudioFormat)rtpFormat.getFormat()).setSampleRate(clockRate);
((AudioFormat)rtpFormat.getFormat()).setChannels(channels);
}
return rtpFormat;
} }
|
public class class_name {
private RTPFormat createAudioFormat(int payload, Text description) {
Iterator<Text> it = description.split('/').iterator();
//encoding name
Text token = it.next();
token.trim();
EncodingName name = new EncodingName(token);
//clock rate
//TODO : convert to sample rate
token = it.next();
token.trim();
int clockRate = token.toInteger();
//channels
int channels = 1;
if (it.hasNext()) {
token = it.next(); // depends on control dependency: [if], data = [none]
token.trim(); // depends on control dependency: [if], data = [none]
channels = token.toInteger(); // depends on control dependency: [if], data = [none]
}
RTPFormat rtpFormat = getFormat(payload);
if (rtpFormat == null) {
formats.add(new RTPFormat(payload, FormatFactory.createAudioFormat(name, clockRate, -1, channels))); // depends on control dependency: [if], data = [none]
} else {
//TODO: recreate format anyway. it is illegal to use clock rate as sample rate
((AudioFormat)rtpFormat.getFormat()).setName(name); // depends on control dependency: [if], data = [none]
((AudioFormat)rtpFormat.getFormat()).setSampleRate(clockRate); // depends on control dependency: [if], data = [none]
((AudioFormat)rtpFormat.getFormat()).setChannels(channels); // depends on control dependency: [if], data = [none]
}
return rtpFormat;
} }
|
public class class_name {
public SipTransaction sendReinvite(String newContact, String displayName,
ArrayList<Header> additionalHeaders, ArrayList<Header> replaceHeaders, String body) {
initErrorInfo();
if (dialog == null) {
setReturnCode(SipSession.INVALID_OPERATION);
setErrorMessage((String) SipSession.statusCodeDescription.get(new Integer(returnCode))
+ " - dialog hasn't been established, can't send RE-INVITE");
return null;
}
try {
Request req = dialog.createRequest(Request.INVITE);
parent.addAuthorizations(callId.getCallId(), req);
MaxForwardsHeader mf = parent.getHeaderFactory().createMaxForwardsHeader(70);
req.setHeader(mf);
if (newContact != null) {
req.setHeader(parent.updateContactInfo(newContact, displayName));
} else {
req.setHeader((ContactHeader) parent.getContactInfo().getContactHeader().clone());
}
SipStack.dumpMessage("We have created this RE-INVITE", req);
SipTransaction siptrans;
synchronized (this) // needed for asynchronous response -
// processEvent(), although we're not using that here now.
// Change there would be needed because that uses attribute
// 'transaction'
{
siptrans = parent.sendRequestWithTransaction(req, false, dialog, additionalHeaders,
replaceHeaders, body);
}
if (siptrans != null) {
cseq = (CSeqHeader) req.getHeader(CSeqHeader.NAME);
return siptrans;
}
setReturnCode(parent.getReturnCode());
setErrorMessage(parent.getErrorMessage());
setException(parent.getException());
return null;
} catch (Exception ex) {
setReturnCode(SipSession.EXCEPTION_ENCOUNTERED);
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
return null;
}
} }
|
public class class_name {
public SipTransaction sendReinvite(String newContact, String displayName,
ArrayList<Header> additionalHeaders, ArrayList<Header> replaceHeaders, String body) {
initErrorInfo();
if (dialog == null) {
setReturnCode(SipSession.INVALID_OPERATION); // depends on control dependency: [if], data = [none]
setErrorMessage((String) SipSession.statusCodeDescription.get(new Integer(returnCode))
+ " - dialog hasn't been established, can't send RE-INVITE");
return null;
}
try {
Request req = dialog.createRequest(Request.INVITE);
parent.addAuthorizations(callId.getCallId(), req);
MaxForwardsHeader mf = parent.getHeaderFactory().createMaxForwardsHeader(70);
req.setHeader(mf);
if (newContact != null) {
req.setHeader(parent.updateContactInfo(newContact, displayName));
} else {
req.setHeader((ContactHeader) parent.getContactInfo().getContactHeader().clone());
}
SipStack.dumpMessage("We have created this RE-INVITE", req);
SipTransaction siptrans;
synchronized (this) // needed for asynchronous response -
// processEvent(), although we're not using that here now.
// Change there would be needed because that uses attribute
// 'transaction'
{
siptrans = parent.sendRequestWithTransaction(req, false, dialog, additionalHeaders,
replaceHeaders, body);
}
if (siptrans != null) {
cseq = (CSeqHeader) req.getHeader(CSeqHeader.NAME); // depends on control dependency: [if], data = [none]
return siptrans; // depends on control dependency: [if], data = [none]
}
setReturnCode(parent.getReturnCode()); // depends on control dependency: [if], data = [none]
setErrorMessage(parent.getErrorMessage()); // depends on control dependency: [if], data = [none]
setException(parent.getException()); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
} catch (Exception ex) {
setReturnCode(SipSession.EXCEPTION_ENCOUNTERED);
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
return null;
}
} }
|
public class class_name {
public static Type getReturnType(final String methodDescriptor) {
// Skip the first character, which is always a '('.
int currentOffset = 1;
// Skip the argument types, one at a each loop iteration.
while (methodDescriptor.charAt(currentOffset) != ')') {
while (methodDescriptor.charAt(currentOffset) == '[') {
currentOffset++;
}
if (methodDescriptor.charAt(currentOffset++) == 'L') {
while (methodDescriptor.charAt(currentOffset++) != ';') {
// Skip the argument descriptor content.
}
}
}
return getType(methodDescriptor, currentOffset + 1, methodDescriptor.length());
} }
|
public class class_name {
public static Type getReturnType(final String methodDescriptor) {
// Skip the first character, which is always a '('.
int currentOffset = 1;
// Skip the argument types, one at a each loop iteration.
while (methodDescriptor.charAt(currentOffset) != ')') {
while (methodDescriptor.charAt(currentOffset) == '[') {
currentOffset++; // depends on control dependency: [while], data = [none]
}
if (methodDescriptor.charAt(currentOffset++) == 'L') {
while (methodDescriptor.charAt(currentOffset++) != ';') {
// Skip the argument descriptor content.
}
}
}
return getType(methodDescriptor, currentOffset + 1, methodDescriptor.length());
} }
|
public class class_name {
private void createSubtree(Node n, BoxTreeCreationStatus stat)
{
//store current status for the parent
stat.parent.curstat = new BoxTreeCreationStatus(stat);
//Create the new box for the child
Box newbox;
boolean istext = false;
if (n.getNodeType() == Node.TEXT_NODE)
{
newbox = createTextBox((Text) n, stat);
istext = true;
}
else
newbox = createElementBox((Element) n, stat);
//Create the child subtree
if (!istext)
{
//Determine the containing boxes of the children
BoxTreeCreationStatus newstat = new BoxTreeCreationStatus(stat);
newstat.parent = (ElementBox) newbox;
if (((ElementBox) newbox).mayContainBlocks()) //the new box forms a block context
{
BlockBox block = (BlockBox) newbox;
//propagate overflow if necessary
if (!overflowPropagated)
overflowPropagated = viewport.checkPropagateOverflow(block);
//positioned element?
if (block.position == BlockBox.POS_ABSOLUTE ||
block.position == BlockBox.POS_RELATIVE ||
block.position == BlockBox.POS_FIXED)
{
//A positioned box forms a content box for following absolutely positioned boxes
newstat.absbox = block;
//update clip box for the block
ElementBox cblock = block.getContainingBlockBox();
if (cblock instanceof BlockBox && (cblock.getClipBlock() == null || ((BlockBox) cblock).getOverflowX() != Overflow.VISIBLE))
block.setClipBlock((BlockBox) cblock);
else
block.setClipBlock(cblock.getClipBlock());
//A box with overflow:hidden creates a clipping box
if (block.overflowX != BlockBox.OVERFLOW_VISIBLE || block.clipRegion != null)
newstat.clipbox = block;
else
newstat.clipbox = block.getClipBlock();
}
else //not positioned element
{
//A box with overflow:hidden creates a clipping box
if (block.overflowX != BlockBox.OVERFLOW_VISIBLE)
newstat.clipbox = block;
}
//Any block box forms a containing box for not positioned elements
newstat.contbox = block;
//Last inflow box is local for block boxes
newstat.lastinflow = null; //TODO this does not work in some cases (absolute.html)
//create the subtree
createBoxTree(newstat);
//remove trailing whitespaces in blocks
removeTrailingWhitespaces(block);
}
else
createBoxTree(newstat);
}
//Add the new box to the parent according to its type
addToTree(newbox, stat);
} }
|
public class class_name {
private void createSubtree(Node n, BoxTreeCreationStatus stat)
{
//store current status for the parent
stat.parent.curstat = new BoxTreeCreationStatus(stat);
//Create the new box for the child
Box newbox;
boolean istext = false;
if (n.getNodeType() == Node.TEXT_NODE)
{
newbox = createTextBox((Text) n, stat); // depends on control dependency: [if], data = [none]
istext = true; // depends on control dependency: [if], data = [none]
}
else
newbox = createElementBox((Element) n, stat);
//Create the child subtree
if (!istext)
{
//Determine the containing boxes of the children
BoxTreeCreationStatus newstat = new BoxTreeCreationStatus(stat);
newstat.parent = (ElementBox) newbox; // depends on control dependency: [if], data = [none]
if (((ElementBox) newbox).mayContainBlocks()) //the new box forms a block context
{
BlockBox block = (BlockBox) newbox;
//propagate overflow if necessary
if (!overflowPropagated)
overflowPropagated = viewport.checkPropagateOverflow(block);
//positioned element?
if (block.position == BlockBox.POS_ABSOLUTE ||
block.position == BlockBox.POS_RELATIVE ||
block.position == BlockBox.POS_FIXED)
{
//A positioned box forms a content box for following absolutely positioned boxes
newstat.absbox = block; // depends on control dependency: [if], data = [none]
//update clip box for the block
ElementBox cblock = block.getContainingBlockBox();
if (cblock instanceof BlockBox && (cblock.getClipBlock() == null || ((BlockBox) cblock).getOverflowX() != Overflow.VISIBLE))
block.setClipBlock((BlockBox) cblock);
else
block.setClipBlock(cblock.getClipBlock());
//A box with overflow:hidden creates a clipping box
if (block.overflowX != BlockBox.OVERFLOW_VISIBLE || block.clipRegion != null)
newstat.clipbox = block;
else
newstat.clipbox = block.getClipBlock();
}
else //not positioned element
{
//A box with overflow:hidden creates a clipping box
if (block.overflowX != BlockBox.OVERFLOW_VISIBLE)
newstat.clipbox = block;
}
//Any block box forms a containing box for not positioned elements
newstat.contbox = block; // depends on control dependency: [if], data = [none]
//Last inflow box is local for block boxes
newstat.lastinflow = null; //TODO this does not work in some cases (absolute.html) // depends on control dependency: [if], data = [none]
//create the subtree
createBoxTree(newstat); // depends on control dependency: [if], data = [none]
//remove trailing whitespaces in blocks
removeTrailingWhitespaces(block); // depends on control dependency: [if], data = [none]
}
else
createBoxTree(newstat);
}
//Add the new box to the parent according to its type
addToTree(newbox, stat);
} }
|
public class class_name {
public void setOrgUnitFlags(String orgUnitFlags) {
try {
m_orgUnitFlags = Integer.parseInt(orgUnitFlags);
} catch (Throwable e) {
setThrowable(e);
}
} }
|
public class class_name {
public void setOrgUnitFlags(String orgUnitFlags) {
try {
m_orgUnitFlags = Integer.parseInt(orgUnitFlags); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
setThrowable(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void visitCode(Code obj) {
Method m = getMethod();
if (prescreen(m)) {
if (m.isSynchronized()) {
syncPC = 0;
} else {
syncPC = -1;
}
isStatic = m.isStatic();
unsafeAliases.clear();
unsafeAliases.set(0);
branchInfo.clear();
unsafeCallOccurred = false;
stack.resetForMethodEntry(this);
}
} }
|
public class class_name {
@Override
public void visitCode(Code obj) {
Method m = getMethod();
if (prescreen(m)) {
if (m.isSynchronized()) {
syncPC = 0; // depends on control dependency: [if], data = [none]
} else {
syncPC = -1; // depends on control dependency: [if], data = [none]
}
isStatic = m.isStatic(); // depends on control dependency: [if], data = [none]
unsafeAliases.clear(); // depends on control dependency: [if], data = [none]
unsafeAliases.set(0); // depends on control dependency: [if], data = [none]
branchInfo.clear(); // depends on control dependency: [if], data = [none]
unsafeCallOccurred = false; // depends on control dependency: [if], data = [none]
stack.resetForMethodEntry(this); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean detect(Predicate<Row> predicate) {
Row row = new Row(this);
while (row.hasNext()) {
if (predicate.test(row.next())) {
return true;
}
}
return false;
} }
|
public class class_name {
public boolean detect(Predicate<Row> predicate) {
Row row = new Row(this);
while (row.hasNext()) {
if (predicate.test(row.next())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@VisibleForTesting
static void getLocationsFromLink(List<String> possiblePaths, Path link) {
try {
Path resolvedLink = link.toRealPath();
Path possibleBinDir = resolvedLink.getParent();
// check if the parent is "bin", we actually depend on that for other resolution
if (possibleBinDir != null && possibleBinDir.getFileName().toString().equals("bin")) {
Path possibleCloudSdkHome = possibleBinDir.getParent();
if (possibleCloudSdkHome != null && Files.exists(possibleCloudSdkHome)) {
possiblePaths.add(possibleCloudSdkHome.toString());
}
}
} catch (IOException ioe) {
// intentionally ignore exception
logger.log(Level.FINE, "Non-critical exception when searching for cloud-sdk", ioe);
}
} }
|
public class class_name {
@VisibleForTesting
static void getLocationsFromLink(List<String> possiblePaths, Path link) {
try {
Path resolvedLink = link.toRealPath();
Path possibleBinDir = resolvedLink.getParent();
// check if the parent is "bin", we actually depend on that for other resolution
if (possibleBinDir != null && possibleBinDir.getFileName().toString().equals("bin")) {
Path possibleCloudSdkHome = possibleBinDir.getParent();
if (possibleCloudSdkHome != null && Files.exists(possibleCloudSdkHome)) {
possiblePaths.add(possibleCloudSdkHome.toString()); // depends on control dependency: [if], data = [(possibleCloudSdkHome]
}
}
} catch (IOException ioe) {
// intentionally ignore exception
logger.log(Level.FINE, "Non-critical exception when searching for cloud-sdk", ioe);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void writeTitleProperty(CmsResource res) {
String resPath = getCms().getSitePath(res);
String currentPropertyValue = getParamPropertyValue();
try {
CmsProperty currentProperty = getCms().readPropertyObject(
resPath,
CmsPropertyDefinition.PROPERTY_TITLE,
false);
// detect if property is a null property or not
if (currentProperty.isNullProperty()) {
// create new property object and set key and value
currentProperty = new CmsProperty();
currentProperty.setName(CmsPropertyDefinition.PROPERTY_TITLE);
if (OpenCms.getWorkplaceManager().isDefaultPropertiesOnStructure()) {
// set structure value
currentProperty.setStructureValue(currentPropertyValue);
currentProperty.setResourceValue(null);
} else {
// set resource value
currentProperty.setStructureValue(null);
currentProperty.setResourceValue(currentPropertyValue);
}
} else if (currentProperty.getStructureValue() != null) {
// structure value has to be updated
currentProperty.setStructureValue(currentPropertyValue);
currentProperty.setResourceValue(null);
} else {
// resource value has to be updated
currentProperty.setStructureValue(null);
currentProperty.setResourceValue(currentPropertyValue);
}
CmsLock lock = getCms().getLock(res);
if (lock.isUnlocked()) {
// lock resource before operation
getCms().lockResource(resPath);
}
// write the property to the resource
getCms().writePropertyObject(resPath, currentProperty);
// unlock the resource
getCms().unlockResource(resPath);
} catch (CmsException e) {
// writing the property failed, log error
LOG.error(e.getLocalizedMessage(), e);
}
} }
|
public class class_name {
protected void writeTitleProperty(CmsResource res) {
String resPath = getCms().getSitePath(res);
String currentPropertyValue = getParamPropertyValue();
try {
CmsProperty currentProperty = getCms().readPropertyObject(
resPath,
CmsPropertyDefinition.PROPERTY_TITLE,
false);
// detect if property is a null property or not
if (currentProperty.isNullProperty()) {
// create new property object and set key and value
currentProperty = new CmsProperty(); // depends on control dependency: [if], data = [none]
currentProperty.setName(CmsPropertyDefinition.PROPERTY_TITLE); // depends on control dependency: [if], data = [none]
if (OpenCms.getWorkplaceManager().isDefaultPropertiesOnStructure()) {
// set structure value
currentProperty.setStructureValue(currentPropertyValue); // depends on control dependency: [if], data = [none]
currentProperty.setResourceValue(null); // depends on control dependency: [if], data = [none]
} else {
// set resource value
currentProperty.setStructureValue(null); // depends on control dependency: [if], data = [none]
currentProperty.setResourceValue(currentPropertyValue); // depends on control dependency: [if], data = [none]
}
} else if (currentProperty.getStructureValue() != null) {
// structure value has to be updated
currentProperty.setStructureValue(currentPropertyValue); // depends on control dependency: [if], data = [none]
currentProperty.setResourceValue(null); // depends on control dependency: [if], data = [null)]
} else {
// resource value has to be updated
currentProperty.setStructureValue(null); // depends on control dependency: [if], data = [null)]
currentProperty.setResourceValue(currentPropertyValue); // depends on control dependency: [if], data = [none]
}
CmsLock lock = getCms().getLock(res);
if (lock.isUnlocked()) {
// lock resource before operation
getCms().lockResource(resPath); // depends on control dependency: [if], data = [none]
}
// write the property to the resource
getCms().writePropertyObject(resPath, currentProperty); // depends on control dependency: [try], data = [none]
// unlock the resource
getCms().unlockResource(resPath); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
// writing the property failed, log error
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private static <T> T cast(Object obj, Class<T> clazz) {
if (obj == null) {
return null;
}
if (clazz == null) {
throw new IllegalArgumentException("parameter 'Class<T> clazz' is not allowed to be null.");
}
if (clazz.isEnum() && obj instanceof String) {
Class<Enum> enumClazz = (Class<Enum>) clazz;
return (T) Enum.valueOf(enumClazz, obj.toString());
}
if (clazz.isPrimitive()) {
if (clazz == Integer.TYPE) {
clazz = (Class<T>) Integer.class;
} else if (clazz == Long.TYPE) {
clazz = (Class<T>) Long.class;
} else if (clazz == Short.TYPE) {
clazz = (Class<T>) Short.class;
} else if (clazz == Double.TYPE) {
clazz = (Class<T>) Double.class;
} else if (clazz == Float.TYPE) {
clazz = (Class<T>) Float.class;
} else if (clazz == Character.TYPE) {
clazz = (Class<T>) Character.class;
} else if (clazz == Byte.TYPE) {
clazz = (Class<T>) Byte.class;
} else if (clazz == Boolean.TYPE) {
clazz = (Class<T>) Boolean.class;
}
}
return clazz.cast(obj);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private static <T> T cast(Object obj, Class<T> clazz) {
if (obj == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (clazz == null) {
throw new IllegalArgumentException("parameter 'Class<T> clazz' is not allowed to be null.");
}
if (clazz.isEnum() && obj instanceof String) {
Class<Enum> enumClazz = (Class<Enum>) clazz; // depends on control dependency: [if], data = [none]
return (T) Enum.valueOf(enumClazz, obj.toString()); // depends on control dependency: [if], data = [none]
}
if (clazz.isPrimitive()) {
if (clazz == Integer.TYPE) {
clazz = (Class<T>) Integer.class; // depends on control dependency: [if], data = [none]
} else if (clazz == Long.TYPE) {
clazz = (Class<T>) Long.class; // depends on control dependency: [if], data = [none]
} else if (clazz == Short.TYPE) {
clazz = (Class<T>) Short.class; // depends on control dependency: [if], data = [none]
} else if (clazz == Double.TYPE) {
clazz = (Class<T>) Double.class; // depends on control dependency: [if], data = [none]
} else if (clazz == Float.TYPE) {
clazz = (Class<T>) Float.class; // depends on control dependency: [if], data = [none]
} else if (clazz == Character.TYPE) {
clazz = (Class<T>) Character.class; // depends on control dependency: [if], data = [none]
} else if (clazz == Byte.TYPE) {
clazz = (Class<T>) Byte.class; // depends on control dependency: [if], data = [none]
} else if (clazz == Boolean.TYPE) {
clazz = (Class<T>) Boolean.class; // depends on control dependency: [if], data = [none]
}
}
return clazz.cast(obj);
} }
|
public class class_name {
public AceExperiment getExperiment(String exname) {
if (this.eidMap.containsKey(exname)) {
return this.experimentMap.get(eidMap.get(exname));
} else {
return null;
}
} }
|
public class class_name {
public AceExperiment getExperiment(String exname) {
if (this.eidMap.containsKey(exname)) {
return this.experimentMap.get(eidMap.get(exname)); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public DescribeExportConfigurationsResult withExportsInfo(ExportInfo... exportsInfo) {
if (this.exportsInfo == null) {
setExportsInfo(new java.util.ArrayList<ExportInfo>(exportsInfo.length));
}
for (ExportInfo ele : exportsInfo) {
this.exportsInfo.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeExportConfigurationsResult withExportsInfo(ExportInfo... exportsInfo) {
if (this.exportsInfo == null) {
setExportsInfo(new java.util.ArrayList<ExportInfo>(exportsInfo.length)); // depends on control dependency: [if], data = [none]
}
for (ExportInfo ele : exportsInfo) {
this.exportsInfo.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static Map<String, Object> revisionHistoryToJson(List<InternalDocumentRevision> history,
Map<String, ? extends Attachment> attachments,
boolean shouldInline,
int minRevPos) {
Misc.checkNotNull(history, "History");
Misc.checkArgument(history.size() > 0, "History must have at least one DocumentRevision.");
Misc.checkArgument(checkHistoryIsInDescendingOrder(history),
"History must be in descending order.");
InternalDocumentRevision currentNode = history.get(0);
Map<String, Object> m = currentNode.asMap();
if (attachments != null && !attachments.isEmpty()) {
// graft attachments on to m for this particular revision here
addAttachments(attachments, m, shouldInline, minRevPos);
}
m.put(CouchConstants._revisions, createRevisions(history));
return m;
} }
|
public class class_name {
public static Map<String, Object> revisionHistoryToJson(List<InternalDocumentRevision> history,
Map<String, ? extends Attachment> attachments,
boolean shouldInline,
int minRevPos) {
Misc.checkNotNull(history, "History");
Misc.checkArgument(history.size() > 0, "History must have at least one DocumentRevision.");
Misc.checkArgument(checkHistoryIsInDescendingOrder(history),
"History must be in descending order.");
InternalDocumentRevision currentNode = history.get(0);
Map<String, Object> m = currentNode.asMap();
if (attachments != null && !attachments.isEmpty()) {
// graft attachments on to m for this particular revision here
addAttachments(attachments, m, shouldInline, minRevPos); // depends on control dependency: [if], data = [(attachments]
}
m.put(CouchConstants._revisions, createRevisions(history));
return m;
} }
|
public class class_name {
public void setRootLoggingLevel(final int loggingLevel) {
rootLoggingLevel = loggingLevel;
if (rootLoggerBack != null) {
rootLoggerBack.setLevel(LoggingLevel.getLevelFromInt(loggingLevel));
}
} }
|
public class class_name {
public void setRootLoggingLevel(final int loggingLevel) {
rootLoggingLevel = loggingLevel;
if (rootLoggerBack != null) {
rootLoggerBack.setLevel(LoggingLevel.getLevelFromInt(loggingLevel)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
static boolean isCOctetStringNullOrNValValid(String value,
int length) {
if (value == null) {
return true;
}
if (value.length() == 0) {
return true;
}
if (value.length() == length - 1) {
return true;
}
return false;
} }
|
public class class_name {
static boolean isCOctetStringNullOrNValValid(String value,
int length) {
if (value == null) {
return true; // depends on control dependency: [if], data = [none]
}
if (value.length() == 0) {
return true; // depends on control dependency: [if], data = [none]
}
if (value.length() == length - 1) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public static NfsType fromValue(int value) {
NfsType nfsType = VALUES.get(value);
if (nfsType == null) {
nfsType = new NfsType(value);
VALUES.put(value, nfsType);
}
return nfsType;
} }
|
public class class_name {
public static NfsType fromValue(int value) {
NfsType nfsType = VALUES.get(value);
if (nfsType == null) {
nfsType = new NfsType(value); // depends on control dependency: [if], data = [none]
VALUES.put(value, nfsType); // depends on control dependency: [if], data = [none]
}
return nfsType;
} }
|
public class class_name {
protected Record<V> removeImpl (int key, boolean checkShrink)
{
int index = keyToIndex(key);
// go through the chain looking for a match
for (Record<V> prev = null, rec = _buckets[index]; rec != null; rec = rec.next) {
if (rec.key == key) {
if (prev == null) {
_buckets[index] = rec.next;
} else {
prev.next = rec.next;
}
_size--;
if (checkShrink) {
checkShrink();
}
return rec;
}
prev = rec;
}
return null;
} }
|
public class class_name {
protected Record<V> removeImpl (int key, boolean checkShrink)
{
int index = keyToIndex(key);
// go through the chain looking for a match
for (Record<V> prev = null, rec = _buckets[index]; rec != null; rec = rec.next) {
if (rec.key == key) {
if (prev == null) {
_buckets[index] = rec.next; // depends on control dependency: [if], data = [none]
} else {
prev.next = rec.next; // depends on control dependency: [if], data = [none]
}
_size--; // depends on control dependency: [if], data = [none]
if (checkShrink) {
checkShrink(); // depends on control dependency: [if], data = [none]
}
return rec; // depends on control dependency: [if], data = [none]
}
prev = rec; // depends on control dependency: [for], data = [prev]
}
return null;
} }
|
public class class_name {
public final EObject ruleXRelationalExpression() throws RecognitionException {
EObject current = null;
Token otherlv_2=null;
EObject this_XOtherOperatorExpression_0 = null;
EObject lv_type_3_0 = null;
EObject lv_rightOperand_6_0 = null;
enterRule();
try {
// InternalPureXbase.g:1368:2: ( (this_XOtherOperatorExpression_0= ruleXOtherOperatorExpression ( ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) ) | ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) ) )* ) )
// InternalPureXbase.g:1369:2: (this_XOtherOperatorExpression_0= ruleXOtherOperatorExpression ( ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) ) | ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) ) )* )
{
// InternalPureXbase.g:1369:2: (this_XOtherOperatorExpression_0= ruleXOtherOperatorExpression ( ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) ) | ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) ) )* )
// InternalPureXbase.g:1370:3: this_XOtherOperatorExpression_0= ruleXOtherOperatorExpression ( ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) ) | ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) ) )*
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXRelationalExpressionAccess().getXOtherOperatorExpressionParserRuleCall_0());
}
pushFollow(FOLLOW_23);
this_XOtherOperatorExpression_0=ruleXOtherOperatorExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_XOtherOperatorExpression_0;
afterParserOrEnumRuleCall();
}
// InternalPureXbase.g:1378:3: ( ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) ) | ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) ) )*
loop26:
do {
int alt26=3;
switch ( input.LA(1) ) {
case 28:
{
int LA26_2 = input.LA(2);
if ( (synpred14_InternalPureXbase()) ) {
alt26=2;
}
}
break;
case 29:
{
int LA26_3 = input.LA(2);
if ( (synpred14_InternalPureXbase()) ) {
alt26=2;
}
}
break;
case 37:
{
int LA26_4 = input.LA(2);
if ( (synpred13_InternalPureXbase()) ) {
alt26=1;
}
}
break;
case 30:
{
int LA26_5 = input.LA(2);
if ( (synpred14_InternalPureXbase()) ) {
alt26=2;
}
}
break;
}
switch (alt26) {
case 1 :
// InternalPureXbase.g:1379:4: ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) )
{
// InternalPureXbase.g:1379:4: ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) )
// InternalPureXbase.g:1380:5: ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) )
{
// InternalPureXbase.g:1380:5: ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) )
// InternalPureXbase.g:1381:6: ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' )
{
// InternalPureXbase.g:1387:6: ( () otherlv_2= 'instanceof' )
// InternalPureXbase.g:1388:7: () otherlv_2= 'instanceof'
{
// InternalPureXbase.g:1388:7: ()
// InternalPureXbase.g:1389:8:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0(),
current);
}
}
otherlv_2=(Token)match(input,37,FOLLOW_11); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXRelationalExpressionAccess().getInstanceofKeyword_1_0_0_0_1());
}
}
}
// InternalPureXbase.g:1401:5: ( (lv_type_3_0= ruleJvmTypeReference ) )
// InternalPureXbase.g:1402:6: (lv_type_3_0= ruleJvmTypeReference )
{
// InternalPureXbase.g:1402:6: (lv_type_3_0= ruleJvmTypeReference )
// InternalPureXbase.g:1403:7: lv_type_3_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXRelationalExpressionAccess().getTypeJvmTypeReferenceParserRuleCall_1_0_1_0());
}
pushFollow(FOLLOW_23);
lv_type_3_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXRelationalExpressionRule());
}
set(
current,
"type",
lv_type_3_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference");
afterParserOrEnumRuleCall();
}
}
}
}
}
break;
case 2 :
// InternalPureXbase.g:1422:4: ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) )
{
// InternalPureXbase.g:1422:4: ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) )
// InternalPureXbase.g:1423:5: ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) )
{
// InternalPureXbase.g:1423:5: ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) )
// InternalPureXbase.g:1424:6: ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) )
{
// InternalPureXbase.g:1434:6: ( () ( ( ruleOpCompare ) ) )
// InternalPureXbase.g:1435:7: () ( ( ruleOpCompare ) )
{
// InternalPureXbase.g:1435:7: ()
// InternalPureXbase.g:1436:8:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getXRelationalExpressionAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0(),
current);
}
}
// InternalPureXbase.g:1442:7: ( ( ruleOpCompare ) )
// InternalPureXbase.g:1443:8: ( ruleOpCompare )
{
// InternalPureXbase.g:1443:8: ( ruleOpCompare )
// InternalPureXbase.g:1444:9: ruleOpCompare
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXRelationalExpressionRule());
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXRelationalExpressionAccess().getFeatureJvmIdentifiableElementCrossReference_1_1_0_0_1_0());
}
pushFollow(FOLLOW_3);
ruleOpCompare();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
}
}
}
}
// InternalPureXbase.g:1460:5: ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) )
// InternalPureXbase.g:1461:6: (lv_rightOperand_6_0= ruleXOtherOperatorExpression )
{
// InternalPureXbase.g:1461:6: (lv_rightOperand_6_0= ruleXOtherOperatorExpression )
// InternalPureXbase.g:1462:7: lv_rightOperand_6_0= ruleXOtherOperatorExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXRelationalExpressionAccess().getRightOperandXOtherOperatorExpressionParserRuleCall_1_1_1_0());
}
pushFollow(FOLLOW_23);
lv_rightOperand_6_0=ruleXOtherOperatorExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXRelationalExpressionRule());
}
set(
current,
"rightOperand",
lv_rightOperand_6_0,
"org.eclipse.xtext.xbase.Xbase.XOtherOperatorExpression");
afterParserOrEnumRuleCall();
}
}
}
}
}
break;
default :
break loop26;
}
} while (true);
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject ruleXRelationalExpression() throws RecognitionException {
EObject current = null;
Token otherlv_2=null;
EObject this_XOtherOperatorExpression_0 = null;
EObject lv_type_3_0 = null;
EObject lv_rightOperand_6_0 = null;
enterRule();
try {
// InternalPureXbase.g:1368:2: ( (this_XOtherOperatorExpression_0= ruleXOtherOperatorExpression ( ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) ) | ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) ) )* ) )
// InternalPureXbase.g:1369:2: (this_XOtherOperatorExpression_0= ruleXOtherOperatorExpression ( ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) ) | ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) ) )* )
{
// InternalPureXbase.g:1369:2: (this_XOtherOperatorExpression_0= ruleXOtherOperatorExpression ( ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) ) | ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) ) )* )
// InternalPureXbase.g:1370:3: this_XOtherOperatorExpression_0= ruleXOtherOperatorExpression ( ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) ) | ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) ) )*
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXRelationalExpressionAccess().getXOtherOperatorExpressionParserRuleCall_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_23);
this_XOtherOperatorExpression_0=ruleXOtherOperatorExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_XOtherOperatorExpression_0; // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:1378:3: ( ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) ) | ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) ) )*
loop26:
do {
int alt26=3;
switch ( input.LA(1) ) {
case 28:
{
int LA26_2 = input.LA(2);
if ( (synpred14_InternalPureXbase()) ) {
alt26=2; // depends on control dependency: [if], data = [none]
}
}
break;
case 29:
{
int LA26_3 = input.LA(2);
if ( (synpred14_InternalPureXbase()) ) {
alt26=2; // depends on control dependency: [if], data = [none]
}
}
break;
case 37:
{
int LA26_4 = input.LA(2);
if ( (synpred13_InternalPureXbase()) ) {
alt26=1; // depends on control dependency: [if], data = [none]
}
}
break;
case 30:
{
int LA26_5 = input.LA(2);
if ( (synpred14_InternalPureXbase()) ) {
alt26=2; // depends on control dependency: [if], data = [none]
}
}
break;
}
switch (alt26) {
case 1 :
// InternalPureXbase.g:1379:4: ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) )
{
// InternalPureXbase.g:1379:4: ( ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) ) )
// InternalPureXbase.g:1380:5: ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) ) ( (lv_type_3_0= ruleJvmTypeReference ) )
{
// InternalPureXbase.g:1380:5: ( ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' ) )
// InternalPureXbase.g:1381:6: ( ( () 'instanceof' ) )=> ( () otherlv_2= 'instanceof' )
{
// InternalPureXbase.g:1387:6: ( () otherlv_2= 'instanceof' )
// InternalPureXbase.g:1388:7: () otherlv_2= 'instanceof'
{
// InternalPureXbase.g:1388:7: ()
// InternalPureXbase.g:1389:8:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0(),
current); // depends on control dependency: [if], data = [none]
}
}
otherlv_2=(Token)match(input,37,FOLLOW_11); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXRelationalExpressionAccess().getInstanceofKeyword_1_0_0_0_1()); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:1401:5: ( (lv_type_3_0= ruleJvmTypeReference ) )
// InternalPureXbase.g:1402:6: (lv_type_3_0= ruleJvmTypeReference )
{
// InternalPureXbase.g:1402:6: (lv_type_3_0= ruleJvmTypeReference )
// InternalPureXbase.g:1403:7: lv_type_3_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXRelationalExpressionAccess().getTypeJvmTypeReferenceParserRuleCall_1_0_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_23);
lv_type_3_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXRelationalExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"type",
lv_type_3_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
break;
case 2 :
// InternalPureXbase.g:1422:4: ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) )
{
// InternalPureXbase.g:1422:4: ( ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) ) )
// InternalPureXbase.g:1423:5: ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) ) ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) )
{
// InternalPureXbase.g:1423:5: ( ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) ) )
// InternalPureXbase.g:1424:6: ( ( () ( ( ruleOpCompare ) ) ) )=> ( () ( ( ruleOpCompare ) ) )
{
// InternalPureXbase.g:1434:6: ( () ( ( ruleOpCompare ) ) )
// InternalPureXbase.g:1435:7: () ( ( ruleOpCompare ) )
{
// InternalPureXbase.g:1435:7: ()
// InternalPureXbase.g:1436:8:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getXRelationalExpressionAccess().getXBinaryOperationLeftOperandAction_1_1_0_0_0(),
current); // depends on control dependency: [if], data = [none]
}
}
// InternalPureXbase.g:1442:7: ( ( ruleOpCompare ) )
// InternalPureXbase.g:1443:8: ( ruleOpCompare )
{
// InternalPureXbase.g:1443:8: ( ruleOpCompare )
// InternalPureXbase.g:1444:9: ruleOpCompare
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXRelationalExpressionRule()); // depends on control dependency: [if], data = [none]
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXRelationalExpressionAccess().getFeatureJvmIdentifiableElementCrossReference_1_1_0_0_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_3);
ruleOpCompare();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
// InternalPureXbase.g:1460:5: ( (lv_rightOperand_6_0= ruleXOtherOperatorExpression ) )
// InternalPureXbase.g:1461:6: (lv_rightOperand_6_0= ruleXOtherOperatorExpression )
{
// InternalPureXbase.g:1461:6: (lv_rightOperand_6_0= ruleXOtherOperatorExpression )
// InternalPureXbase.g:1462:7: lv_rightOperand_6_0= ruleXOtherOperatorExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXRelationalExpressionAccess().getRightOperandXOtherOperatorExpressionParserRuleCall_1_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_23);
lv_rightOperand_6_0=ruleXOtherOperatorExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXRelationalExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"rightOperand",
lv_rightOperand_6_0,
"org.eclipse.xtext.xbase.Xbase.XOtherOperatorExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
break;
default :
break loop26;
}
} while (true);
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public static Option getVariedOption(OptionHandler learner, String variedParamName) {
// split nested option string
String[] singleOptions = variedParamName.split("/");
// check if first level is "learner", which has already been resolved
int startIndex = 0;
if (singleOptions.length > 0 && singleOptions[0].equals("learner/")) {
startIndex = 1;
}
// iteratively create objects and get next options for each level
Option learnerVariedParamOption = null;
OptionHandler currentOptionHandler = learner;
for (int i = startIndex; i < singleOptions.length; i++) {
for (Option opt : currentOptionHandler.getOptions().getOptionArray()) {
if (opt.getName().equals(singleOptions[i])) {
if (opt instanceof ClassOption) {
currentOptionHandler = (OptionHandler)
((ClassOption) opt).getPreMaterializedObject();
}
else {
learnerVariedParamOption = opt;
}
break;
}
}
}
return learnerVariedParamOption;
} }
|
public class class_name {
public static Option getVariedOption(OptionHandler learner, String variedParamName) {
// split nested option string
String[] singleOptions = variedParamName.split("/");
// check if first level is "learner", which has already been resolved
int startIndex = 0;
if (singleOptions.length > 0 && singleOptions[0].equals("learner/")) {
startIndex = 1; // depends on control dependency: [if], data = [none]
}
// iteratively create objects and get next options for each level
Option learnerVariedParamOption = null;
OptionHandler currentOptionHandler = learner;
for (int i = startIndex; i < singleOptions.length; i++) {
for (Option opt : currentOptionHandler.getOptions().getOptionArray()) {
if (opt.getName().equals(singleOptions[i])) {
if (opt instanceof ClassOption) {
currentOptionHandler = (OptionHandler)
((ClassOption) opt).getPreMaterializedObject(); // depends on control dependency: [if], data = [none]
}
else {
learnerVariedParamOption = opt; // depends on control dependency: [if], data = [none]
}
break;
}
}
}
return learnerVariedParamOption;
} }
|
public class class_name {
protected final static DataSetException buildException(SAXException cause) {
int lineNumber = -1;
if (cause instanceof SAXParseException) {
lineNumber = ((SAXParseException) cause).getLineNumber();
}
Exception exception = cause.getException() == null ? cause : cause.getException();
String message;
if (lineNumber >= 0) {
message = "Line " + lineNumber + ": " + exception.getMessage();
} else {
message = exception.getMessage();
}
if (exception instanceof DataSetException) {
return (DataSetException) exception;
} else {
return new DataSetException(message, exception);
}
} }
|
public class class_name {
protected final static DataSetException buildException(SAXException cause) {
int lineNumber = -1;
if (cause instanceof SAXParseException) {
lineNumber = ((SAXParseException) cause).getLineNumber(); // depends on control dependency: [if], data = [none]
}
Exception exception = cause.getException() == null ? cause : cause.getException();
String message;
if (lineNumber >= 0) {
message = "Line " + lineNumber + ": " + exception.getMessage(); // depends on control dependency: [if], data = [none]
} else {
message = exception.getMessage(); // depends on control dependency: [if], data = [none]
}
if (exception instanceof DataSetException) {
return (DataSetException) exception; // depends on control dependency: [if], data = [none]
} else {
return new DataSetException(message, exception); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@ReadOperation
public Ticket getToken(@Selector final String ticketId) {
var ticket = (Ticket) ticketRegistry.getTicket(ticketId, AccessToken.class);
if (ticket == null) {
ticket = ticketRegistry.getTicket(ticketId, RefreshToken.class);
}
if (ticket == null) {
LOGGER.debug("Ticket [{}] is not found", ticketId);
return null;
}
if (ticket.isExpired()) {
LOGGER.debug("Ticket [{}] is has expired", ticketId);
return null;
}
return ticket;
} }
|
public class class_name {
@ReadOperation
public Ticket getToken(@Selector final String ticketId) {
var ticket = (Ticket) ticketRegistry.getTicket(ticketId, AccessToken.class);
if (ticket == null) {
ticket = ticketRegistry.getTicket(ticketId, RefreshToken.class); // depends on control dependency: [if], data = [(ticket]
}
if (ticket == null) {
LOGGER.debug("Ticket [{}] is not found", ticketId); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
if (ticket.isExpired()) {
LOGGER.debug("Ticket [{}] is has expired", ticketId); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return ticket;
} }
|
public class class_name {
public static SequenceBatchCSVRecord fromWritables(List<List<List<Writable>>> input) {
SequenceBatchCSVRecord ret = new SequenceBatchCSVRecord();
for(int i = 0; i < input.size(); i++) {
ret.add(Arrays.asList(BatchCSVRecord.fromWritables(input.get(i))));
}
return ret;
} }
|
public class class_name {
public static SequenceBatchCSVRecord fromWritables(List<List<List<Writable>>> input) {
SequenceBatchCSVRecord ret = new SequenceBatchCSVRecord();
for(int i = 0; i < input.size(); i++) {
ret.add(Arrays.asList(BatchCSVRecord.fromWritables(input.get(i)))); // depends on control dependency: [for], data = [i]
}
return ret;
} }
|
public class class_name {
private void update() {
if (!predefinedPriori) {
for (int c = 0; c < k; c++) {
priori[c] = (nc[c] + EPSILON) / (n + k * EPSILON);
}
}
if (model == Model.MULTINOMIAL || model == Model.POLYAURN) {
for (int c = 0; c < k; c++) {
for (int t = 0; t < p; t++) {
condprob[c][t] = (ntc[c][t] + sigma) / (nt[c] + sigma * p);
}
}
} else {
for (int c = 0; c < k; c++) {
for (int t = 0; t < p; t++) {
condprob[c][t] = (ntc[c][t] + sigma) / (nc[c] + sigma * 2);
}
}
}
} }
|
public class class_name {
private void update() {
if (!predefinedPriori) {
for (int c = 0; c < k; c++) {
priori[c] = (nc[c] + EPSILON) / (n + k * EPSILON); // depends on control dependency: [for], data = [c]
}
}
if (model == Model.MULTINOMIAL || model == Model.POLYAURN) {
for (int c = 0; c < k; c++) {
for (int t = 0; t < p; t++) {
condprob[c][t] = (ntc[c][t] + sigma) / (nt[c] + sigma * p); // depends on control dependency: [for], data = [t]
}
}
} else {
for (int c = 0; c < k; c++) {
for (int t = 0; t < p; t++) {
condprob[c][t] = (ntc[c][t] + sigma) / (nc[c] + sigma * 2); // depends on control dependency: [for], data = [t]
}
}
}
} }
|
public class class_name {
public String[] extractStringArray(final DeviceData deviceData) {
if (deviceData.getAny()==null) {
System.out.println("any = null !!");
}
return DevVarStringArrayHelper.extract(deviceData.getAny());
} }
|
public class class_name {
public String[] extractStringArray(final DeviceData deviceData) {
if (deviceData.getAny()==null) {
System.out.println("any = null !!"); // depends on control dependency: [if], data = [none]
}
return DevVarStringArrayHelper.extract(deviceData.getAny());
} }
|
public class class_name {
public static String normalize(String path, String enc) {
if (Strings.isEmpty(path))
return null;
if (path.charAt(0) == '~')
path = Disks.home() + path.substring(1);
try {
return URLDecoder.decode(path, enc);
}
catch (UnsupportedEncodingException e) {
return null;
}
} }
|
public class class_name {
public static String normalize(String path, String enc) {
if (Strings.isEmpty(path))
return null;
if (path.charAt(0) == '~')
path = Disks.home() + path.substring(1);
try {
return URLDecoder.decode(path, enc);
// depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException e) {
return null;
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static boolean isInstanceOf(TypeRef type, TypeDef targetType, Function<TypeRef, Boolean> function) {
if (type instanceof ClassRef) {
ClassRef classRef = (ClassRef) type;
TypeDef definition = classRef.getDefinition();
if (definition.getFullyQualifiedName().equals(targetType.getFullyQualifiedName())) {
return true;
}
for (TypeRef i : definition.getImplementsList()) {
if (function.apply(i)) {
return true;
}
}
for (TypeRef e : definition.getExtendsList()) {
if (function.apply(e)) {
return true;
}
}
}
return false;
} }
|
public class class_name {
public static boolean isInstanceOf(TypeRef type, TypeDef targetType, Function<TypeRef, Boolean> function) {
if (type instanceof ClassRef) {
ClassRef classRef = (ClassRef) type;
TypeDef definition = classRef.getDefinition();
if (definition.getFullyQualifiedName().equals(targetType.getFullyQualifiedName())) {
return true; // depends on control dependency: [if], data = [none]
}
for (TypeRef i : definition.getImplementsList()) {
if (function.apply(i)) {
return true; // depends on control dependency: [if], data = [none]
}
}
for (TypeRef e : definition.getExtendsList()) {
if (function.apply(e)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
private Map processEvent(MatchResult result) {
Map map = new HashMap();
//group zero is the entire match - process all other groups
for (int i = 1; i < result.groupCount() + 1; i++) {
Object key = matchingKeywords.get(i - 1);
Object value = result.group(i);
map.put(key, value);
}
return map;
} }
|
public class class_name {
private Map processEvent(MatchResult result) {
Map map = new HashMap();
//group zero is the entire match - process all other groups
for (int i = 1; i < result.groupCount() + 1; i++) {
Object key = matchingKeywords.get(i - 1);
Object value = result.group(i);
map.put(key, value); // depends on control dependency: [for], data = [none]
}
return map;
} }
|
public class class_name {
public GetRoutesResult withItems(Route... items) {
if (this.items == null) {
setItems(new java.util.ArrayList<Route>(items.length));
}
for (Route ele : items) {
this.items.add(ele);
}
return this;
} }
|
public class class_name {
public GetRoutesResult withItems(Route... items) {
if (this.items == null) {
setItems(new java.util.ArrayList<Route>(items.length)); // depends on control dependency: [if], data = [none]
}
for (Route ele : items) {
this.items.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
protected String validateDefaultName(InputProblemReporter rep, boolean normalize)
throws XMLStreamException
{
String origDefValue = mDefValue.getValue();
String defValue = origDefValue.trim();
if (defValue.length() == 0) {
reportValidationProblem(rep, "Invalid default value '"+defValue
+"'; empty String is not a valid name");
}
// Ok, needs to be a valid XML name:
int illegalIx = WstxInputData.findIllegalNameChar(defValue, mCfgNsAware, mCfgXml11);
if (illegalIx >= 0) {
if (illegalIx == 0) {
reportValidationProblem(rep, "Invalid default value '"+defValue+"'; character "
+WstxInputData.getCharDesc(defValue.charAt(0))
+") not valid first character of a name");
} else {
reportValidationProblem(rep, "Invalid default value '"+defValue+"'; character #"+illegalIx+" ("
+WstxInputData.getCharDesc(defValue.charAt(illegalIx))
+") not valid name character");
}
}
// Ok, cool it's ok...
return normalize ? defValue : origDefValue;
} }
|
public class class_name {
protected String validateDefaultName(InputProblemReporter rep, boolean normalize)
throws XMLStreamException
{
String origDefValue = mDefValue.getValue();
String defValue = origDefValue.trim();
if (defValue.length() == 0) {
reportValidationProblem(rep, "Invalid default value '"+defValue
+"'; empty String is not a valid name");
}
// Ok, needs to be a valid XML name:
int illegalIx = WstxInputData.findIllegalNameChar(defValue, mCfgNsAware, mCfgXml11);
if (illegalIx >= 0) {
if (illegalIx == 0) {
reportValidationProblem(rep, "Invalid default value '"+defValue+"'; character "
+WstxInputData.getCharDesc(defValue.charAt(0))
+") not valid first character of a name"); // depends on control dependency: [if], data = [none]
} else {
reportValidationProblem(rep, "Invalid default value '"+defValue+"'; character #"+illegalIx+" ("
+WstxInputData.getCharDesc(defValue.charAt(illegalIx))
+") not valid name character"); // depends on control dependency: [if], data = [none]
}
}
// Ok, cool it's ok...
return normalize ? defValue : origDefValue;
} }
|
public class class_name {
Object replaceObject(ResourceRefConfigFactory resRefConfigFactory) {
DSConfig config = dsConfig.get();
String filter = config.jndiName == null || config.jndiName.startsWith("java:")
? FilterUtils.createPropertyFilter("config.displayId", config.id)
: FilterUtils.createPropertyFilter(ResourceFactory.JNDI_NAME, config.jndiName);
ResourceRefConfig resRefConfig = resRefInfo == null ? null : resRefConfigFactory.createResourceRefConfig(DataSource.class.getName());
if (resRefInfo != null) {
resRefConfig.setBranchCoupling(resRefInfo.getBranchCoupling());
resRefConfig.setCommitPriority(resRefInfo.getCommitPriority());
resRefConfig.setIsolationLevel(resRefInfo.getIsolationLevel());
resRefConfig.setJNDIName(resRefInfo.getJNDIName());
resRefConfig.setLoginConfigurationName(resRefInfo.getLoginConfigurationName());
resRefConfig.setResAuthType(resRefInfo.getAuth());
resRefConfig.setSharingScope(resRefInfo.getSharingScope());
}
return new SerializedDataSourceWrapper(filter, resRefConfig);
} }
|
public class class_name {
Object replaceObject(ResourceRefConfigFactory resRefConfigFactory) {
DSConfig config = dsConfig.get();
String filter = config.jndiName == null || config.jndiName.startsWith("java:")
? FilterUtils.createPropertyFilter("config.displayId", config.id)
: FilterUtils.createPropertyFilter(ResourceFactory.JNDI_NAME, config.jndiName);
ResourceRefConfig resRefConfig = resRefInfo == null ? null : resRefConfigFactory.createResourceRefConfig(DataSource.class.getName());
if (resRefInfo != null) {
resRefConfig.setBranchCoupling(resRefInfo.getBranchCoupling()); // depends on control dependency: [if], data = [(resRefInfo]
resRefConfig.setCommitPriority(resRefInfo.getCommitPriority()); // depends on control dependency: [if], data = [(resRefInfo]
resRefConfig.setIsolationLevel(resRefInfo.getIsolationLevel()); // depends on control dependency: [if], data = [(resRefInfo]
resRefConfig.setJNDIName(resRefInfo.getJNDIName()); // depends on control dependency: [if], data = [(resRefInfo]
resRefConfig.setLoginConfigurationName(resRefInfo.getLoginConfigurationName()); // depends on control dependency: [if], data = [(resRefInfo]
resRefConfig.setResAuthType(resRefInfo.getAuth()); // depends on control dependency: [if], data = [(resRefInfo]
resRefConfig.setSharingScope(resRefInfo.getSharingScope()); // depends on control dependency: [if], data = [(resRefInfo]
}
return new SerializedDataSourceWrapper(filter, resRefConfig);
} }
|
public class class_name {
public static String resolveFigurative(
final String value,
final int length,
final boolean quoteIsQuote) {
if (value == null || value.length() == 0) {
return value;
}
String ucValue = value.toUpperCase(Locale.getDefault());
if (ucValue.matches("^ZERO(S|ES)?$")) {
return "0";
}
/* We avoid filling with spaces because this is the most common
* initial value for large strings*/
if (ucValue.matches("^SPACES?$")) {
return " ";
}
if (ucValue.matches("^QUOTES?$")) {
return quoteIsQuote ? "\"" : "\'";
}
if (ucValue.matches("^APOST$")) {
return "\'";
}
/* For binary content, we use pseudo hexadecimal representation
* This is understood downstream by the COBOL binder. */
if (ucValue.matches("^HIGH-VALUES?$")) {
return fill("0x", "FF", length);
}
if (ucValue.matches("^LOW-VALUES?$")) {
return fill("0x", "00", length);
}
/* Nulls are treated like low-value. */
if (ucValue.matches("^NULLS?$")) {
return fill("0x", "00", length);
}
/* All is followed by a literal which can be a figurative constant.
* If that figurative constant is binary, then the filling already
* took place. Otherwise, if the total length is not a multiple
* of the repeated character sequence, then we need to fill the
* the remainder with a substring of the literal. */
if (ucValue.startsWith("ALL ")) {
String literal = value.substring("ALL ".length());
String resolvedLiteral = ValueUtil.resolveFigurative(
literal, length, quoteIsQuote);
if (resolvedLiteral.length() > 0 && resolvedLiteral.length() < length) {
String filled = fill(null, resolvedLiteral, length / resolvedLiteral.length());
if (filled.length() < length) {
return filled + resolvedLiteral.substring(0, length - filled.length());
} else {
return filled;
}
} else {
return resolvedLiteral;
}
}
/* This is not a figurative constant just strip delimiters */
return stripDelimiters(value);
} }
|
public class class_name {
public static String resolveFigurative(
final String value,
final int length,
final boolean quoteIsQuote) {
if (value == null || value.length() == 0) {
return value; // depends on control dependency: [if], data = [none]
}
String ucValue = value.toUpperCase(Locale.getDefault());
if (ucValue.matches("^ZERO(S|ES)?$")) {
return "0";
}
/* We avoid filling with spaces because this is the most common
* initial value for large strings*/
if (ucValue.matches("^SPACES?$")) {
return " ";
}
if (ucValue.matches("^QUOTES?$")) {
return quoteIsQuote ? "\"" : "\'";
}
if (ucValue.matches("^APOST$")) {
return "\'";
}
/* For binary content, we use pseudo hexadecimal representation
* This is understood downstream by the COBOL binder. */
if (ucValue.matches("^HIGH-VALUES?$")) {
return fill("0x", "FF", length);
}
if (ucValue.matches("^LOW-VALUES?$")) {
return fill("0x", "00", length);
}
/* Nulls are treated like low-value. */
if (ucValue.matches("^NULLS?$")) {
return fill("0x", "00", length);
}
/* All is followed by a literal which can be a figurative constant.
* If that figurative constant is binary, then the filling already
* took place. Otherwise, if the total length is not a multiple
* of the repeated character sequence, then we need to fill the
* the remainder with a substring of the literal. */
if (ucValue.startsWith("ALL ")) {
String literal = value.substring("ALL ".length());
String resolvedLiteral = ValueUtil.resolveFigurative(
literal, length, quoteIsQuote);
if (resolvedLiteral.length() > 0 && resolvedLiteral.length() < length) {
String filled = fill(null, resolvedLiteral, length / resolvedLiteral.length());
if (filled.length() < length) {
return filled + resolvedLiteral.substring(0, length - filled.length()); // depends on control dependency: [if], data = [none]
} else {
return filled; // depends on control dependency: [if], data = [none]
}
} else {
return resolvedLiteral;
}
}
/* This is not a figurative constant just strip delimiters */
return stripDelimiters(value);
} }
|
public class class_name {
private String getContentItemForXPath(Map<String, String> contentItems, String xpath) {
if (contentItems.get(xpath) != null) { // content item found for XPath
return contentItems.get(xpath);
} else { // try a multiple value mapping and ensure that the values are in correct order.
SortedMap<List<Integer>, String> valueMap = new TreeMap<>(new Comparator<List<Integer>>() {
// expects lists of the same length that contain only non-null values. This is given for the use case.
@SuppressWarnings("boxing")
public int compare(List<Integer> l1, List<Integer> l2) {
for (int i = 0; i < l1.size(); i++) {
int numCompare = Integer.compare(l1.get(i), l2.get(i));
if (0 != numCompare) {
return numCompare;
}
}
return 0;
}
});
for (Map.Entry<String, String> entry : contentItems.entrySet()) {
if (CmsXmlUtils.removeXpath(entry.getKey()).equals(xpath)) { // the removed path refers an item
String[] xPathParts = entry.getKey().split("/");
List<Integer> indexes = new ArrayList<>(xPathParts.length);
for (String xPathPart : Arrays.asList(xPathParts)) {
if (!xPathPart.isEmpty()) {
indexes.add(Integer.valueOf(CmsXmlUtils.getXpathIndexInt(xPathPart)));
}
}
valueMap.put(indexes, entry.getValue());
}
}
StringBuffer result = new StringBuffer();
for (String value : valueMap.values()) {
result.append(value);
result.append("\n");
}
return result.length() > 1 ? result.toString().substring(0, result.length() - 1) : null;
}
} }
|
public class class_name {
private String getContentItemForXPath(Map<String, String> contentItems, String xpath) {
if (contentItems.get(xpath) != null) { // content item found for XPath
return contentItems.get(xpath); // depends on control dependency: [if], data = [none]
} else { // try a multiple value mapping and ensure that the values are in correct order.
SortedMap<List<Integer>, String> valueMap = new TreeMap<>(new Comparator<List<Integer>>() {
// expects lists of the same length that contain only non-null values. This is given for the use case.
@SuppressWarnings("boxing")
public int compare(List<Integer> l1, List<Integer> l2) {
for (int i = 0; i < l1.size(); i++) {
int numCompare = Integer.compare(l1.get(i), l2.get(i));
if (0 != numCompare) {
return numCompare; // depends on control dependency: [if], data = [none]
}
}
return 0;
}
});
for (Map.Entry<String, String> entry : contentItems.entrySet()) {
if (CmsXmlUtils.removeXpath(entry.getKey()).equals(xpath)) { // the removed path refers an item
String[] xPathParts = entry.getKey().split("/");
List<Integer> indexes = new ArrayList<>(xPathParts.length);
for (String xPathPart : Arrays.asList(xPathParts)) {
if (!xPathPart.isEmpty()) {
indexes.add(Integer.valueOf(CmsXmlUtils.getXpathIndexInt(xPathPart))); // depends on control dependency: [if], data = [none]
}
}
valueMap.put(indexes, entry.getValue()); // depends on control dependency: [if], data = [none]
}
}
StringBuffer result = new StringBuffer();
for (String value : valueMap.values()) {
result.append(value); // depends on control dependency: [for], data = [value]
result.append("\n"); // depends on control dependency: [for], data = [none]
}
return result.length() > 1 ? result.toString().substring(0, result.length() - 1) : null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public Object getValue(String paramName) {
Object value = null;
if (privateFields.contains(paramName)) {
value = beanWrapper.getPropertyValue(paramName);
} else if (publicFeilds.containsKey(paramName)) {
Field field = publicFeilds.get(paramName);
try {
value = field.get(entity);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException(e);
}
}
if (value == null) {
return null;
}
return Jsr310JdbcUtils.convertIfNecessary(value, zoneId);
} }
|
public class class_name {
@Override
public Object getValue(String paramName) {
Object value = null;
if (privateFields.contains(paramName)) {
value = beanWrapper.getPropertyValue(paramName); // depends on control dependency: [if], data = [none]
} else if (publicFeilds.containsKey(paramName)) {
Field field = publicFeilds.get(paramName);
try {
value = field.get(entity); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
}
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
return Jsr310JdbcUtils.convertIfNecessary(value, zoneId);
} }
|
public class class_name {
@Override
public String decode(final byte[] bytes) {
if (bytes == null) {
return null;
}
StringBuilder buffer = new StringBuilder(estimateDecodeCharLength(bytes));
decode(bytes, buffer);
return buffer.toString();
} }
|
public class class_name {
@Override
public String decode(final byte[] bytes) {
if (bytes == null) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuilder buffer = new StringBuilder(estimateDecodeCharLength(bytes));
decode(bytes, buffer);
return buffer.toString();
} }
|
public class class_name {
public static IType findParameterizedTypeInHierarchy( IType sourceType, IType rawGenericType )
{
if( sourceType == null )
{
return null;
}
if( sourceType.isParameterizedType() && sourceType.getGenericType().equals( rawGenericType ) )
{
return sourceType;
}
IType[] list = sourceType.getInterfaces();
for( int i = 0; i < list.length; i++ )
{
IType returnType = findParameterizedTypeInHierarchy( list[i], rawGenericType );
if( returnType != null )
{
return returnType;
}
}
return findParameterizedTypeInHierarchy( sourceType.getSupertype(), rawGenericType );
} }
|
public class class_name {
public static IType findParameterizedTypeInHierarchy( IType sourceType, IType rawGenericType )
{
if( sourceType == null )
{
return null; // depends on control dependency: [if], data = [none]
}
if( sourceType.isParameterizedType() && sourceType.getGenericType().equals( rawGenericType ) )
{
return sourceType; // depends on control dependency: [if], data = [none]
}
IType[] list = sourceType.getInterfaces();
for( int i = 0; i < list.length; i++ )
{
IType returnType = findParameterizedTypeInHierarchy( list[i], rawGenericType );
if( returnType != null )
{
return returnType; // depends on control dependency: [if], data = [none]
}
}
return findParameterizedTypeInHierarchy( sourceType.getSupertype(), rawGenericType );
} }
|
public class class_name {
public <T> void transactAsync(final DbCodeTypedTx<T> code, Handler<AsyncResult<T>> resultHandler) {
VertxUtil.executeBlocking(executor, future -> {
try {
T returnValue = null;
Transaction tx = new TransactionImpl();
tx.setRollbackOnError(true);
tx.setRollbackOnly(false);
boolean complete = false;
try {
returnValue = code.run(this, tx);
complete = true;
} catch (ThreadDeath | DatabaseException t) {
throw t;
} catch (Throwable t) {
throw new DatabaseException("Error during transaction", t);
} finally {
if ((!complete && tx.isRollbackOnError()) || tx.isRollbackOnly()) {
rollbackAndClose();
} else {
commitAndClose();
}
}
future.complete(returnValue);
} catch (ThreadDeath t) {
throw t;
} catch (Throwable t) {
future.fail(t);
}
}, resultHandler);
} }
|
public class class_name {
public <T> void transactAsync(final DbCodeTypedTx<T> code, Handler<AsyncResult<T>> resultHandler) {
VertxUtil.executeBlocking(executor, future -> {
try {
T returnValue = null;
Transaction tx = new TransactionImpl();
tx.setRollbackOnError(true);
tx.setRollbackOnly(false);
boolean complete = false;
try {
returnValue = code.run(this, tx); // depends on control dependency: [try], data = [none]
complete = true; // depends on control dependency: [try], data = [none]
} catch (ThreadDeath | DatabaseException t) {
throw t;
} catch (Throwable t) { // depends on control dependency: [catch], data = [none]
throw new DatabaseException("Error during transaction", t);
} finally { // depends on control dependency: [catch], data = [none]
if ((!complete && tx.isRollbackOnError()) || tx.isRollbackOnly()) {
rollbackAndClose(); // depends on control dependency: [if], data = [none]
} else {
commitAndClose(); // depends on control dependency: [if], data = [none]
}
}
future.complete(returnValue);
} catch (ThreadDeath t) {
throw t;
} catch (Throwable t) {
future.fail(t);
}
}, resultHandler);
} }
|
public class class_name {
boolean fitsIntoLong(boolean isPositive, boolean ignoreNegativeZero) {
// Figure out if the result will fit in a long. We have to
// first look for nonzero digits after the decimal point;
// then check the size. If the digit count is 18 or less, then
// the value can definitely be represented as a long. If it is 19
// then it may be too large.
// Trim trailing zeros. This does not change the represented value.
while (count > 0 && digits[count - 1] == '0') {
--count;
}
if (count == 0) {
// Positive zero fits into a long, but negative zero can only
// be represented as a double. - bug 4162852
return isPositive || ignoreNegativeZero;
}
if (decimalAt < count || decimalAt > MAX_COUNT) {
return false;
}
if (decimalAt < MAX_COUNT) return true;
// At this point we have decimalAt == count, and count == MAX_COUNT.
// The number will overflow if it is larger than 9223372036854775807
// or smaller than -9223372036854775808.
for (int i=0; i<count; ++i) {
char dig = digits[i], max = LONG_MIN_REP[i];
if (dig > max) return false;
if (dig < max) return true;
}
// At this point the first count digits match. If decimalAt is less
// than count, then the remaining digits are zero, and we return true.
if (count < decimalAt) return true;
// Now we have a representation of Long.MIN_VALUE, without the leading
// negative sign. If this represents a positive value, then it does
// not fit; otherwise it fits.
return !isPositive;
} }
|
public class class_name {
boolean fitsIntoLong(boolean isPositive, boolean ignoreNegativeZero) {
// Figure out if the result will fit in a long. We have to
// first look for nonzero digits after the decimal point;
// then check the size. If the digit count is 18 or less, then
// the value can definitely be represented as a long. If it is 19
// then it may be too large.
// Trim trailing zeros. This does not change the represented value.
while (count > 0 && digits[count - 1] == '0') {
--count; // depends on control dependency: [while], data = [none]
}
if (count == 0) {
// Positive zero fits into a long, but negative zero can only
// be represented as a double. - bug 4162852
return isPositive || ignoreNegativeZero; // depends on control dependency: [if], data = [none]
}
if (decimalAt < count || decimalAt > MAX_COUNT) {
return false; // depends on control dependency: [if], data = [none]
}
if (decimalAt < MAX_COUNT) return true;
// At this point we have decimalAt == count, and count == MAX_COUNT.
// The number will overflow if it is larger than 9223372036854775807
// or smaller than -9223372036854775808.
for (int i=0; i<count; ++i) {
char dig = digits[i], max = LONG_MIN_REP[i];
if (dig > max) return false;
if (dig < max) return true;
}
// At this point the first count digits match. If decimalAt is less
// than count, then the remaining digits are zero, and we return true.
if (count < decimalAt) return true;
// Now we have a representation of Long.MIN_VALUE, without the leading
// negative sign. If this represents a positive value, then it does
// not fit; otherwise it fits.
return !isPositive;
} }
|
public class class_name {
public void getResourceValue(final ResolutionContext resolutionContext, final ServiceBuilder<?> serviceBuilder, final DeploymentPhaseContext phaseContext, final Injector<ManagedReferenceFactory> injector) {
final String applicationName = resolutionContext.getApplicationName();
final String moduleName = resolutionContext.getModuleName();
final String componentName = resolutionContext.getComponentName();
final boolean compUsesModule = resolutionContext.isCompUsesModule();
final String scheme = org.jboss.as.naming.InitialContext.getURLScheme(lookupName);
if (scheme == null) {
// relative name, build absolute name and setup normal lookup injection
if (componentName != null && !compUsesModule) {
ContextNames.bindInfoFor(applicationName, moduleName, componentName, "java:comp/env/" + lookupName)
.setupLookupInjection(serviceBuilder, injector, phaseContext.getDeploymentUnit(), optional);
} else if (compUsesModule) {
ContextNames.bindInfoFor(applicationName, moduleName, componentName, "java:module/env/" + lookupName)
.setupLookupInjection(serviceBuilder, injector, phaseContext.getDeploymentUnit(), optional);
} else {
ContextNames.bindInfoFor(applicationName, moduleName, componentName, "java:jboss/env/" + lookupName)
.setupLookupInjection(serviceBuilder, injector, phaseContext.getDeploymentUnit(), optional);
}
} else {
if (scheme.equals("java")) {
// an absolute java name, setup normal lookup injection
if (compUsesModule && lookupName.startsWith("java:comp/")) {
// switch "comp" with "module"
ContextNames.bindInfoFor(applicationName, moduleName, componentName, "java:module/" + lookupName.substring(10))
.setupLookupInjection(serviceBuilder, injector, phaseContext.getDeploymentUnit(), optional);
} else {
ContextNames.bindInfoFor(applicationName, moduleName, componentName, lookupName)
.setupLookupInjection(serviceBuilder, injector, phaseContext.getDeploymentUnit(), optional);
}
} else {
// an absolute non java name
final ManagedReferenceFactory managedReferenceFactory;
if (URL_SCHEMES.contains(scheme)) {
// a Java EE Standard Resource Manager Connection Factory for URLs, using lookup to define value of URL, inject factory that creates URL instances
managedReferenceFactory = new ManagedReferenceFactory() {
@Override
public ManagedReference getReference() {
try {
return new ImmediateManagedReference(new URL(lookupName));
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
};
} else {
// lookup for a non java jndi resource, inject factory which does a true jndi lookup
managedReferenceFactory = new ManagedReferenceFactory() {
@Override
public ManagedReference getReference() {
try {
return new ImmediateManagedReference(new InitialContext().lookup(lookupName));
} catch (NamingException e) {
EeLogger.ROOT_LOGGER.tracef(e, "failed to lookup %s", lookupName);
return null;
}
}
};
}
injector.inject(managedReferenceFactory);
}
}
} }
|
public class class_name {
public void getResourceValue(final ResolutionContext resolutionContext, final ServiceBuilder<?> serviceBuilder, final DeploymentPhaseContext phaseContext, final Injector<ManagedReferenceFactory> injector) {
final String applicationName = resolutionContext.getApplicationName();
final String moduleName = resolutionContext.getModuleName();
final String componentName = resolutionContext.getComponentName();
final boolean compUsesModule = resolutionContext.isCompUsesModule();
final String scheme = org.jboss.as.naming.InitialContext.getURLScheme(lookupName);
if (scheme == null) {
// relative name, build absolute name and setup normal lookup injection
if (componentName != null && !compUsesModule) {
ContextNames.bindInfoFor(applicationName, moduleName, componentName, "java:comp/env/" + lookupName)
.setupLookupInjection(serviceBuilder, injector, phaseContext.getDeploymentUnit(), optional); // depends on control dependency: [if], data = [none]
} else if (compUsesModule) {
ContextNames.bindInfoFor(applicationName, moduleName, componentName, "java:module/env/" + lookupName)
.setupLookupInjection(serviceBuilder, injector, phaseContext.getDeploymentUnit(), optional); // depends on control dependency: [if], data = [none]
} else {
ContextNames.bindInfoFor(applicationName, moduleName, componentName, "java:jboss/env/" + lookupName)
.setupLookupInjection(serviceBuilder, injector, phaseContext.getDeploymentUnit(), optional); // depends on control dependency: [if], data = [none]
}
} else {
if (scheme.equals("java")) {
// an absolute java name, setup normal lookup injection
if (compUsesModule && lookupName.startsWith("java:comp/")) {
// switch "comp" with "module"
ContextNames.bindInfoFor(applicationName, moduleName, componentName, "java:module/" + lookupName.substring(10))
.setupLookupInjection(serviceBuilder, injector, phaseContext.getDeploymentUnit(), optional); // depends on control dependency: [if], data = [none]
} else {
ContextNames.bindInfoFor(applicationName, moduleName, componentName, lookupName)
.setupLookupInjection(serviceBuilder, injector, phaseContext.getDeploymentUnit(), optional); // depends on control dependency: [if], data = [none]
}
} else {
// an absolute non java name
final ManagedReferenceFactory managedReferenceFactory;
if (URL_SCHEMES.contains(scheme)) {
// a Java EE Standard Resource Manager Connection Factory for URLs, using lookup to define value of URL, inject factory that creates URL instances
managedReferenceFactory = new ManagedReferenceFactory() {
@Override
public ManagedReference getReference() {
try {
return new ImmediateManagedReference(new URL(lookupName)); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
}; // depends on control dependency: [if], data = [none]
} else {
// lookup for a non java jndi resource, inject factory which does a true jndi lookup
managedReferenceFactory = new ManagedReferenceFactory() {
@Override
public ManagedReference getReference() {
try {
return new ImmediateManagedReference(new InitialContext().lookup(lookupName)); // depends on control dependency: [try], data = [none]
} catch (NamingException e) {
EeLogger.ROOT_LOGGER.tracef(e, "failed to lookup %s", lookupName);
return null;
} // depends on control dependency: [catch], data = [none]
}
}; // depends on control dependency: [if], data = [none]
}
injector.inject(managedReferenceFactory); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
protected EventObject waitResponse(long timeout) {
synchronized (responseBlock) {
LinkedList<EventObject> events = transaction.getEvents();
if (events.isEmpty()) {
try {
LOG.trace("about to block, waiting");
responseBlock.waitForEvent(timeout);
LOG.trace("we've come out of the block");
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(SipSession.EXCEPTION_ENCOUNTERED);
return null;
}
}
LOG.trace("either we got the response, or timed out");
if (events.isEmpty()) {
setReturnCode(SipSession.TIMEOUT_OCCURRED);
setErrorMessage("The maximum amount of time to wait for a response message has elapsed.");
return null;
}
return (EventObject) events.removeFirst();
}
} }
|
public class class_name {
protected EventObject waitResponse(long timeout) {
synchronized (responseBlock) {
LinkedList<EventObject> events = transaction.getEvents();
if (events.isEmpty()) {
try {
LOG.trace("about to block, waiting"); // depends on control dependency: [try], data = [none]
responseBlock.waitForEvent(timeout); // depends on control dependency: [try], data = [none]
LOG.trace("we've come out of the block"); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(SipSession.EXCEPTION_ENCOUNTERED);
return null;
} // depends on control dependency: [catch], data = [none]
}
LOG.trace("either we got the response, or timed out");
if (events.isEmpty()) {
setReturnCode(SipSession.TIMEOUT_OCCURRED); // depends on control dependency: [if], data = [none]
setErrorMessage("The maximum amount of time to wait for a response message has elapsed."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return (EventObject) events.removeFirst();
}
} }
|
public class class_name {
public static void roundBitmapInPlace(Bitmap bitmap) {
Preconditions.checkNotNull(bitmap);
final int w = bitmap.getWidth();
final int h = bitmap.getHeight();
final int radius = Math.min(w, h) / 2;
final int centerX = w / 2;
final int centerY = h / 2;
// Nothing to do if the radius is equal to 0.
if (radius == 0) {
return;
}
Preconditions.checkArgument(radius >= 1);
Preconditions.checkArgument(w > 0 && w <= BitmapUtil.MAX_BITMAP_SIZE);
Preconditions.checkArgument(h > 0 && h <= BitmapUtil.MAX_BITMAP_SIZE);
Preconditions.checkArgument(centerX > 0 && centerX < w);
Preconditions.checkArgument(centerY > 0 && centerY < h);
final int[] pixels = new int[w * h];
bitmap.getPixels(pixels, 0, w, 0, 0, w, h);
int x = radius - 1;
int y = 0;
final int maxX = centerX + x;
final int maxY = centerY + x;
final int minX = centerX - x;
final int minY = centerY - x;
Preconditions.checkArgument(minX >= 0 && minY >= 0 && maxX < w && maxY < h);
int dx = 1;
int dy = 1;
final int rInc = -radius * 2;
final int[] transparentColor = new int[w];
int err = dx + rInc;
int cXpX;
int cXmX;
int cXpY;
int cXmY;
int cYpX;
int cYmX;
int cYpY;
int cYmY;
int offA;
int offB;
int offC;
int offD;
while (x >= y) {
cXpX = centerX + x;
cXmX = centerX - x;
cXpY = centerX + y;
cXmY = centerX - y;
cYpX = centerY + x;
cYmX = centerY - x;
cYpY = centerY + y;
cYmY = centerY - y;
Preconditions.checkArgument(x >= 0 && cXpY < w && cXmY >= 0 && cYpY < h && cYmY >= 0);
offA = w * cYpY;
offB = w * cYmY;
offC = w * cYpX;
offD = w * cYmX;
// Clear left
System.arraycopy(transparentColor, 0, pixels, offA, cXmX);
System.arraycopy(transparentColor, 0, pixels, offB, cXmX);
System.arraycopy(transparentColor, 0, pixels, offC, cXmY);
System.arraycopy(transparentColor, 0, pixels, offD, cXmY);
// Clear right
System.arraycopy(transparentColor, 0, pixels, offA + cXpX, w - cXpX);
System.arraycopy(transparentColor, 0, pixels, offB + cXpX, w - cXpX);
System.arraycopy(transparentColor, 0, pixels, offC + cXpY, w - cXpY);
System.arraycopy(transparentColor, 0, pixels, offD + cXpY, w - cXpY);
if (err <= 0) {
y++;
dy += 2;
err += dy;
}
if (err > 0) {
x--;
dx += 2;
err += dx + rInc;
}
}
// Clear top / bottom if height > width
for (int i = centerY - radius; i >= 0; i--) {
System.arraycopy(transparentColor, 0, pixels, i * w, w);
}
for (int i = centerY + radius; i < h; i++) {
System.arraycopy(transparentColor, 0, pixels, i * w, w);
}
bitmap.setPixels(pixels, 0, w, 0, 0, w, h);
} }
|
public class class_name {
public static void roundBitmapInPlace(Bitmap bitmap) {
Preconditions.checkNotNull(bitmap);
final int w = bitmap.getWidth();
final int h = bitmap.getHeight();
final int radius = Math.min(w, h) / 2;
final int centerX = w / 2;
final int centerY = h / 2;
// Nothing to do if the radius is equal to 0.
if (radius == 0) {
return; // depends on control dependency: [if], data = [none]
}
Preconditions.checkArgument(radius >= 1);
Preconditions.checkArgument(w > 0 && w <= BitmapUtil.MAX_BITMAP_SIZE);
Preconditions.checkArgument(h > 0 && h <= BitmapUtil.MAX_BITMAP_SIZE);
Preconditions.checkArgument(centerX > 0 && centerX < w);
Preconditions.checkArgument(centerY > 0 && centerY < h);
final int[] pixels = new int[w * h];
bitmap.getPixels(pixels, 0, w, 0, 0, w, h);
int x = radius - 1;
int y = 0;
final int maxX = centerX + x;
final int maxY = centerY + x;
final int minX = centerX - x;
final int minY = centerY - x;
Preconditions.checkArgument(minX >= 0 && minY >= 0 && maxX < w && maxY < h);
int dx = 1;
int dy = 1;
final int rInc = -radius * 2;
final int[] transparentColor = new int[w];
int err = dx + rInc;
int cXpX;
int cXmX;
int cXpY;
int cXmY;
int cYpX;
int cYmX;
int cYpY;
int cYmY;
int offA;
int offB;
int offC;
int offD;
while (x >= y) {
cXpX = centerX + x; // depends on control dependency: [while], data = [none]
cXmX = centerX - x; // depends on control dependency: [while], data = [none]
cXpY = centerX + y; // depends on control dependency: [while], data = [none]
cXmY = centerX - y; // depends on control dependency: [while], data = [none]
cYpX = centerY + x; // depends on control dependency: [while], data = [none]
cYmX = centerY - x; // depends on control dependency: [while], data = [none]
cYpY = centerY + y; // depends on control dependency: [while], data = [none]
cYmY = centerY - y; // depends on control dependency: [while], data = [none]
Preconditions.checkArgument(x >= 0 && cXpY < w && cXmY >= 0 && cYpY < h && cYmY >= 0); // depends on control dependency: [while], data = [(x]
offA = w * cYpY; // depends on control dependency: [while], data = [none]
offB = w * cYmY; // depends on control dependency: [while], data = [none]
offC = w * cYpX; // depends on control dependency: [while], data = [none]
offD = w * cYmX; // depends on control dependency: [while], data = [none]
// Clear left
System.arraycopy(transparentColor, 0, pixels, offA, cXmX); // depends on control dependency: [while], data = [none]
System.arraycopy(transparentColor, 0, pixels, offB, cXmX); // depends on control dependency: [while], data = [none]
System.arraycopy(transparentColor, 0, pixels, offC, cXmY); // depends on control dependency: [while], data = [none]
System.arraycopy(transparentColor, 0, pixels, offD, cXmY); // depends on control dependency: [while], data = [none]
// Clear right
System.arraycopy(transparentColor, 0, pixels, offA + cXpX, w - cXpX); // depends on control dependency: [while], data = [none]
System.arraycopy(transparentColor, 0, pixels, offB + cXpX, w - cXpX); // depends on control dependency: [while], data = [none]
System.arraycopy(transparentColor, 0, pixels, offC + cXpY, w - cXpY); // depends on control dependency: [while], data = [none]
System.arraycopy(transparentColor, 0, pixels, offD + cXpY, w - cXpY); // depends on control dependency: [while], data = [none]
if (err <= 0) {
y++; // depends on control dependency: [if], data = [none]
dy += 2; // depends on control dependency: [if], data = [none]
err += dy; // depends on control dependency: [if], data = [none]
}
if (err > 0) {
x--; // depends on control dependency: [if], data = [none]
dx += 2; // depends on control dependency: [if], data = [none]
err += dx + rInc; // depends on control dependency: [if], data = [none]
}
}
// Clear top / bottom if height > width
for (int i = centerY - radius; i >= 0; i--) {
System.arraycopy(transparentColor, 0, pixels, i * w, w); // depends on control dependency: [for], data = [i]
}
for (int i = centerY + radius; i < h; i++) {
System.arraycopy(transparentColor, 0, pixels, i * w, w); // depends on control dependency: [for], data = [i]
}
bitmap.setPixels(pixels, 0, w, 0, 0, w, h);
} }
|
public class class_name {
@Override
void animateValue(float fraction) {
super.animateValue(fraction);
int numValues = mValues.length;
for (int i = 0; i < numValues; ++i) {
mValues[i].setAnimatedValue(mTarget);
}
} }
|
public class class_name {
@Override
void animateValue(float fraction) {
super.animateValue(fraction);
int numValues = mValues.length;
for (int i = 0; i < numValues; ++i) {
mValues[i].setAnimatedValue(mTarget); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
protected void performTypeValidation(String path, Object type, Object value, List<ValidationResult> results) {
// If type it not defined then skip
if (type == null)
return;
// Perform validation against schema
if (type instanceof Schema) {
Schema schema = (Schema) type;
schema.performValidation(path, value, results);
return;
}
// If value is null then skip
value = ObjectReader.getValue(value);
if (value == null)
return;
String name = path != null ? path : "value";
Class<?> valueType = value.getClass();
// Match types
if (TypeMatcher.matchType(type, valueType))
return;
// Generate type mismatch error
results.add(new ValidationResult(path, ValidationResultType.Error, "TYPE_MISMATCH",
name + " type must be " + type + " but found " + valueType, type, valueType));
} }
|
public class class_name {
protected void performTypeValidation(String path, Object type, Object value, List<ValidationResult> results) {
// If type it not defined then skip
if (type == null)
return;
// Perform validation against schema
if (type instanceof Schema) {
Schema schema = (Schema) type;
schema.performValidation(path, value, results); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// If value is null then skip
value = ObjectReader.getValue(value);
if (value == null)
return;
String name = path != null ? path : "value";
Class<?> valueType = value.getClass();
// Match types
if (TypeMatcher.matchType(type, valueType))
return;
// Generate type mismatch error
results.add(new ValidationResult(path, ValidationResultType.Error, "TYPE_MISMATCH",
name + " type must be " + type + " but found " + valueType, type, valueType));
} }
|
public class class_name {
public static List < PictureSymbol > parsePicture(final String picture,
final char currencySymbol) {
int factoredNumber = 0;
boolean factorSequence = false;
char lastChar = 0;
PictureSymbol pictureSymbol = null;
List < PictureSymbol > result = new LinkedList < PictureSymbol >();
for (int i = 0; i < picture.length(); i++) {
char c = picture.charAt(i);
if (c != currencySymbol) {
c = Character.toUpperCase(c);
}
if (factorSequence) {
if (c == ')') {
pictureSymbol.setNumber(pictureSymbol.getNumber()
+ factoredNumber - 1);
factorSequence = false;
} else {
if (Character.isDigit(c)) {
factoredNumber = factoredNumber * 10
+ Character.getNumericValue(c);
}
}
} else {
if (c == '(') {
factoredNumber = 0;
factorSequence = true;
} else {
/*
* CR and DB are special cases where we need to ignore, the
* second character R or B.
*/
if ((c != 'B' || lastChar != 'D')
&& (c != 'R' || lastChar != 'C')) {
if (c == lastChar) {
pictureSymbol
.setNumber(pictureSymbol.getNumber() + 1);
} else {
pictureSymbol = new PictureSymbol(c, 1);
result.add(pictureSymbol);
lastChar = c;
}
}
}
}
}
return result;
} }
|
public class class_name {
public static List < PictureSymbol > parsePicture(final String picture,
final char currencySymbol) {
int factoredNumber = 0;
boolean factorSequence = false;
char lastChar = 0;
PictureSymbol pictureSymbol = null;
List < PictureSymbol > result = new LinkedList < PictureSymbol >();
for (int i = 0; i < picture.length(); i++) {
char c = picture.charAt(i);
if (c != currencySymbol) {
c = Character.toUpperCase(c); // depends on control dependency: [if], data = [(c]
}
if (factorSequence) {
if (c == ')') {
pictureSymbol.setNumber(pictureSymbol.getNumber()
+ factoredNumber - 1); // depends on control dependency: [if], data = [none]
factorSequence = false; // depends on control dependency: [if], data = [none]
} else {
if (Character.isDigit(c)) {
factoredNumber = factoredNumber * 10
+ Character.getNumericValue(c); // depends on control dependency: [if], data = [none]
}
}
} else {
if (c == '(') {
factoredNumber = 0; // depends on control dependency: [if], data = [none]
factorSequence = true; // depends on control dependency: [if], data = [none]
} else {
/*
* CR and DB are special cases where we need to ignore, the
* second character R or B.
*/
if ((c != 'B' || lastChar != 'D')
&& (c != 'R' || lastChar != 'C')) {
if (c == lastChar) {
pictureSymbol
.setNumber(pictureSymbol.getNumber() + 1); // depends on control dependency: [if], data = [none]
} else {
pictureSymbol = new PictureSymbol(c, 1); // depends on control dependency: [if], data = [(c]
result.add(pictureSymbol); // depends on control dependency: [if], data = [none]
lastChar = c; // depends on control dependency: [if], data = [none]
}
}
}
}
}
return result;
} }
|
public class class_name {
public void create(MapTile map, Media config, SpriteTiled sheet)
{
this.map.create(map.getTileWidth(), map.getTileHeight(), map.getInTileWidth(), map.getInTileHeight());
if (sheet != null)
{
this.map.loadSheets(Arrays.asList(sheet));
}
for (int i = 0; i < NO_FOG; i++)
{
final String group;
if (i == FOG)
{
group = FOG_GROUP;
}
else
{
group = TRANSITION_GROUP;
}
mapGroup.changeGroup(new TileGame(Integer.valueOf(0), i, 0, 0, map.getTileWidth(), map.getTileHeight()),
group);
}
mapGroup.changeGroup(new TileGame(Integer.valueOf(0), NO_FOG, 0, 0, map.getTileWidth(), map.getTileHeight()),
MapTileGroupModel.NO_GROUP_NAME);
transition.loadTransitions(config);
for (int x = 0; x < map.getInTileWidth(); x++)
{
for (int y = 0; y < map.getInTileHeight(); y++)
{
final Tile tile = new TileGame(Integer.valueOf(0),
FOG,
x * (double) map.getTileWidth(),
y * (double) map.getTileHeight(),
map.getTileWidth(),
map.getTileHeight());
this.map.setTile(tile);
}
}
} }
|
public class class_name {
public void create(MapTile map, Media config, SpriteTiled sheet)
{
this.map.create(map.getTileWidth(), map.getTileHeight(), map.getInTileWidth(), map.getInTileHeight());
if (sheet != null)
{
this.map.loadSheets(Arrays.asList(sheet)); // depends on control dependency: [if], data = [(sheet]
}
for (int i = 0; i < NO_FOG; i++)
{
final String group;
if (i == FOG)
{
group = FOG_GROUP; // depends on control dependency: [if], data = [none]
}
else
{
group = TRANSITION_GROUP; // depends on control dependency: [if], data = [none]
}
mapGroup.changeGroup(new TileGame(Integer.valueOf(0), i, 0, 0, map.getTileWidth(), map.getTileHeight()),
group); // depends on control dependency: [for], data = [none]
}
mapGroup.changeGroup(new TileGame(Integer.valueOf(0), NO_FOG, 0, 0, map.getTileWidth(), map.getTileHeight()),
MapTileGroupModel.NO_GROUP_NAME);
transition.loadTransitions(config);
for (int x = 0; x < map.getInTileWidth(); x++)
{
for (int y = 0; y < map.getInTileHeight(); y++)
{
final Tile tile = new TileGame(Integer.valueOf(0),
FOG,
x * (double) map.getTileWidth(),
y * (double) map.getTileHeight(),
map.getTileWidth(),
map.getTileHeight());
this.map.setTile(tile); // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
@Override
protected void suspendFaxJobImpl(FaxJob faxJob)
{
//get fax job
HylaFaxJob hylaFaxJob=(HylaFaxJob)faxJob;
//get client
HylaFAXClient client=this.getHylaFAXClient();
try
{
this.suspendFaxJob(hylaFaxJob,client);
}
catch(FaxException exception)
{
throw exception;
}
catch(Exception exception)
{
throw new FaxException("General error.",exception);
}
} }
|
public class class_name {
@Override
protected void suspendFaxJobImpl(FaxJob faxJob)
{
//get fax job
HylaFaxJob hylaFaxJob=(HylaFaxJob)faxJob;
//get client
HylaFAXClient client=this.getHylaFAXClient();
try
{
this.suspendFaxJob(hylaFaxJob,client); // depends on control dependency: [try], data = [none]
}
catch(FaxException exception)
{
throw exception;
} // depends on control dependency: [catch], data = [none]
catch(Exception exception)
{
throw new FaxException("General error.",exception);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private J2EETransactionImpl newInternTransaction()
{
if (log.isDebugEnabled()) log.debug("obtain new intern odmg-transaction");
J2EETransactionImpl tx = new J2EETransactionImpl(this);
try
{
getConfigurator().configure(tx);
}
catch (ConfigurationException e)
{
throw new OJBRuntimeException("Cannot create new intern odmg transaction", e);
}
return tx;
} }
|
public class class_name {
private J2EETransactionImpl newInternTransaction()
{
if (log.isDebugEnabled()) log.debug("obtain new intern odmg-transaction");
J2EETransactionImpl tx = new J2EETransactionImpl(this);
try
{
getConfigurator().configure(tx);
// depends on control dependency: [try], data = [none]
}
catch (ConfigurationException e)
{
throw new OJBRuntimeException("Cannot create new intern odmg transaction", e);
}
// depends on control dependency: [catch], data = [none]
return tx;
} }
|
public class class_name {
@Override
public Response addInstance( String applicationName, String parentInstancePath, Instance instance ) {
if( parentInstancePath == null )
this.logger.fine( "Request: add root instance " + instance.getName() + " in " + applicationName + "." );
else
this.logger.fine( "Request: add instance " + instance.getName() + " under " + parentInstancePath + " in " + applicationName + "." );
String lang = lang( this.manager );
Response response;
try {
ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( applicationName );
if( ma == null ) {
response = handleError(
Status.NOT_FOUND,
new RestError( REST_INEXISTING, application( applicationName )),
lang ).build();
} else {
Graphs graphs = ma.getApplication().getTemplate().getGraphs();
String componentName = null;
if( instance.getComponent() != null )
componentName = instance.getComponent().getName();
// The deserialized instance is not the real one, but just hints
// (e.g. only the component name is pertinent, and all the exports - included overridden ones - are
// serialized in the same map...). Now let's make this "fictional" instance real (fix it)!
Component realComponent;
if( componentName == null ) {
response = handleError(
Status.NOT_FOUND,
new RestError( REST_MISSING_PROPERTY, value( "component" )),
lang ).build();
} else if((realComponent = ComponentHelpers.findComponent( graphs, componentName )) == null ) {
response = handleError(
Status.NOT_FOUND,
new RestError( REST_INEXISTING, component( componentName )),
lang ).build();
} else {
instance.setComponent( realComponent );
InstanceHelpers.fixOverriddenExports( instance );
Instance parentInstance = InstanceHelpers.findInstanceByPath( ma.getApplication(), parentInstancePath );
this.manager.instancesMngr().addInstance( ma, parentInstance, instance );
response = Response.ok().build();
}
}
} catch( ImpossibleInsertionException | IOException e ) {
response = RestServicesUtils.handleError(
Status.FORBIDDEN,
new RestError( ErrorCode.REST_UNDETAILED_ERROR, e ),
lang ).build();
}
return response;
} }
|
public class class_name {
@Override
public Response addInstance( String applicationName, String parentInstancePath, Instance instance ) {
if( parentInstancePath == null )
this.logger.fine( "Request: add root instance " + instance.getName() + " in " + applicationName + "." );
else
this.logger.fine( "Request: add instance " + instance.getName() + " under " + parentInstancePath + " in " + applicationName + "." );
String lang = lang( this.manager );
Response response;
try {
ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( applicationName );
if( ma == null ) {
response = handleError(
Status.NOT_FOUND,
new RestError( REST_INEXISTING, application( applicationName )),
lang ).build(); // depends on control dependency: [if], data = [none]
} else {
Graphs graphs = ma.getApplication().getTemplate().getGraphs();
String componentName = null;
if( instance.getComponent() != null )
componentName = instance.getComponent().getName();
// The deserialized instance is not the real one, but just hints
// (e.g. only the component name is pertinent, and all the exports - included overridden ones - are
// serialized in the same map...). Now let's make this "fictional" instance real (fix it)!
Component realComponent;
if( componentName == null ) {
response = handleError(
Status.NOT_FOUND,
new RestError( REST_MISSING_PROPERTY, value( "component" )),
lang ).build(); // depends on control dependency: [if], data = [none]
} else if((realComponent = ComponentHelpers.findComponent( graphs, componentName )) == null ) {
response = handleError(
Status.NOT_FOUND,
new RestError( REST_INEXISTING, component( componentName )),
lang ).build(); // depends on control dependency: [if], data = [none]
} else {
instance.setComponent( realComponent ); // depends on control dependency: [if], data = [none]
InstanceHelpers.fixOverriddenExports( instance ); // depends on control dependency: [if], data = [none]
Instance parentInstance = InstanceHelpers.findInstanceByPath( ma.getApplication(), parentInstancePath );
this.manager.instancesMngr().addInstance( ma, parentInstance, instance ); // depends on control dependency: [if], data = [none]
response = Response.ok().build(); // depends on control dependency: [if], data = [none]
}
}
} catch( ImpossibleInsertionException | IOException e ) {
response = RestServicesUtils.handleError(
Status.FORBIDDEN,
new RestError( ErrorCode.REST_UNDETAILED_ERROR, e ),
lang ).build();
} // depends on control dependency: [catch], data = [none]
return response;
} }
|
public class class_name {
protected String toLocaleString(Locale locale) {
String language = locale.getLanguage();
if(language.isEmpty()) return "";
String country = locale.getCountry();
if(country.isEmpty()) return language;
String variant = locale.getVariant();
if(variant.isEmpty()) {
return language + '-' + country;
} else {
return language + '-' + country + '-' + variant;
}
} }
|
public class class_name {
protected String toLocaleString(Locale locale) {
String language = locale.getLanguage();
if(language.isEmpty()) return "";
String country = locale.getCountry();
if(country.isEmpty()) return language;
String variant = locale.getVariant();
if(variant.isEmpty()) {
return language + '-' + country; // depends on control dependency: [if], data = [none]
} else {
return language + '-' + country + '-' + variant; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected List<CmsResource> getMovedFolders(CmsObject cms) throws CmsException {
CmsProject onlineProject = cms.readProject(CmsProject.ONLINE_PROJECT_ID);
List<CmsResource> movedFolders = new ArrayList<CmsResource>();
for (CmsResource folder : m_folderList) {
if (folder.getState().isChanged()) {
CmsProject oldProject = cms.getRequestContext().getCurrentProject();
boolean isMoved = false;
try {
cms.getRequestContext().setCurrentProject(onlineProject);
CmsResource onlineResource = cms.readResource(folder.getStructureId());
isMoved = !onlineResource.getRootPath().equals(folder.getRootPath());
} catch (CmsVfsResourceNotFoundException e) {
// resource not found online, this means it doesn't matter whether it has been moved
} finally {
cms.getRequestContext().setCurrentProject(oldProject);
}
if (isMoved) {
movedFolders.add(folder);
}
}
}
return movedFolders;
} }
|
public class class_name {
protected List<CmsResource> getMovedFolders(CmsObject cms) throws CmsException {
CmsProject onlineProject = cms.readProject(CmsProject.ONLINE_PROJECT_ID);
List<CmsResource> movedFolders = new ArrayList<CmsResource>();
for (CmsResource folder : m_folderList) {
if (folder.getState().isChanged()) {
CmsProject oldProject = cms.getRequestContext().getCurrentProject();
boolean isMoved = false;
try {
cms.getRequestContext().setCurrentProject(onlineProject); // depends on control dependency: [try], data = [none]
CmsResource onlineResource = cms.readResource(folder.getStructureId());
isMoved = !onlineResource.getRootPath().equals(folder.getRootPath()); // depends on control dependency: [try], data = [none]
} catch (CmsVfsResourceNotFoundException e) {
// resource not found online, this means it doesn't matter whether it has been moved
} finally { // depends on control dependency: [catch], data = [none]
cms.getRequestContext().setCurrentProject(oldProject);
}
if (isMoved) {
movedFolders.add(folder); // depends on control dependency: [if], data = [none]
}
}
}
return movedFolders;
} }
|
public class class_name {
public static WritableRaster integerArray2WritableRaster( int[] array, double divide, int width, int height ) {
WritableRaster writableRaster = createWritableRaster(width, height, null, null, null);
int index = 0;;
for( int x = 0; x < width; x++ ) {
for( int y = 0; y < height; y++ ) {
double value = (double) array[index++] / divide;
writableRaster.setSample(x, y, 0, value);
}
}
return writableRaster;
} }
|
public class class_name {
public static WritableRaster integerArray2WritableRaster( int[] array, double divide, int width, int height ) {
WritableRaster writableRaster = createWritableRaster(width, height, null, null, null);
int index = 0;;
for( int x = 0; x < width; x++ ) {
for( int y = 0; y < height; y++ ) {
double value = (double) array[index++] / divide;
writableRaster.setSample(x, y, 0, value); // depends on control dependency: [for], data = [y]
}
}
return writableRaster;
} }
|
public class class_name {
public static double hypot(final double x, final double y) {
if (Double.isInfinite(x) || Double.isInfinite(y)) {
return Double.POSITIVE_INFINITY;
} else if (Double.isNaN(x) || Double.isNaN(y)) {
return Double.NaN;
} else {
final int expX = getExponent(x);
final int expY = getExponent(y);
if (expX > expY + 27) {
// y is neglectible with respect to x
return abs(x);
} else if (expY > expX + 27) {
// x is neglectible with respect to y
return abs(y);
} else {
// find an intermediate scale to avoid both overflow and underflow
final int middleExp = (expX + expY) / 2;
// scale parameters without losing precision
final double scaledX = scalb(x, -middleExp);
final double scaledY = scalb(y, -middleExp);
// compute scaled hypotenuse
final double scaledH = sqrt(scaledX * scaledX + scaledY * scaledY);
// remove scaling
return scalb(scaledH, middleExp);
}
}
} }
|
public class class_name {
public static double hypot(final double x, final double y) {
if (Double.isInfinite(x) || Double.isInfinite(y)) {
return Double.POSITIVE_INFINITY; // depends on control dependency: [if], data = [none]
} else if (Double.isNaN(x) || Double.isNaN(y)) {
return Double.NaN; // depends on control dependency: [if], data = [none]
} else {
final int expX = getExponent(x);
final int expY = getExponent(y);
if (expX > expY + 27) {
// y is neglectible with respect to x
return abs(x); // depends on control dependency: [if], data = [none]
} else if (expY > expX + 27) {
// x is neglectible with respect to y
return abs(y); // depends on control dependency: [if], data = [none]
} else {
// find an intermediate scale to avoid both overflow and underflow
final int middleExp = (expX + expY) / 2;
// scale parameters without losing precision
final double scaledX = scalb(x, -middleExp);
final double scaledY = scalb(y, -middleExp);
// compute scaled hypotenuse
final double scaledH = sqrt(scaledX * scaledX + scaledY * scaledY);
// remove scaling
return scalb(scaledH, middleExp); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void setAllInjectableAndRPC(boolean enabled) {
this.getChkInjectableQueryString().setEnabled(enabled);
this.getChkAddQueryParam().setEnabled(enabled && getChkInjectableQueryString().isSelected());
this.getChkInjectableUrlPath().setEnabled(enabled);
this.getChkInjectablePostData().setEnabled(enabled);
this.getChkInjectableHeaders().setEnabled(enabled);
this.getChkInjectableHeadersAllRequests().setEnabled(enabled && getChkInjectableHeaders().isSelected());
this.getChkInjectableCookie().setEnabled(enabled);
this.getChkRPCMultipart().setEnabled(enabled);
this.getChkRPCXML().setEnabled(enabled);
this.getChkRPCJSON().setEnabled(enabled);
this.getChkRPCGWT().setEnabled(enabled);
this.getChkRPCoData().setEnabled(enabled);
this.getChkRPCDWR().setEnabled(enabled);
this.getChkRPCCustom().setEnabled(enabled && isExtensionScriptEnabled());
if (!reasonVariantsDisabled.isEmpty()) {
labelReasonVariantsDisabled.setVisible(!enabled);
}
} }
|
public class class_name {
public void setAllInjectableAndRPC(boolean enabled) {
this.getChkInjectableQueryString().setEnabled(enabled);
this.getChkAddQueryParam().setEnabled(enabled && getChkInjectableQueryString().isSelected());
this.getChkInjectableUrlPath().setEnabled(enabled);
this.getChkInjectablePostData().setEnabled(enabled);
this.getChkInjectableHeaders().setEnabled(enabled);
this.getChkInjectableHeadersAllRequests().setEnabled(enabled && getChkInjectableHeaders().isSelected());
this.getChkInjectableCookie().setEnabled(enabled);
this.getChkRPCMultipart().setEnabled(enabled);
this.getChkRPCXML().setEnabled(enabled);
this.getChkRPCJSON().setEnabled(enabled);
this.getChkRPCGWT().setEnabled(enabled);
this.getChkRPCoData().setEnabled(enabled);
this.getChkRPCDWR().setEnabled(enabled);
this.getChkRPCCustom().setEnabled(enabled && isExtensionScriptEnabled());
if (!reasonVariantsDisabled.isEmpty()) {
labelReasonVariantsDisabled.setVisible(!enabled);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setParameterNameValues(java.util.Collection<ParameterNameValue> parameterNameValues) {
if (parameterNameValues == null) {
this.parameterNameValues = null;
return;
}
this.parameterNameValues = new com.amazonaws.internal.SdkInternalList<ParameterNameValue>(parameterNameValues);
} }
|
public class class_name {
public void setParameterNameValues(java.util.Collection<ParameterNameValue> parameterNameValues) {
if (parameterNameValues == null) {
this.parameterNameValues = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.parameterNameValues = new com.amazonaws.internal.SdkInternalList<ParameterNameValue>(parameterNameValues);
} }
|
public class class_name {
private Symbol findDiamond(Env<AttrContext> env,
Type site,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs) {
Symbol bestSoFar = methodNotFound;
for (Scope.Entry e = site.tsym.members().lookup(names.init);
e.scope != null;
e = e.next()) {
final Symbol sym = e.sym;
//- System.out.println(" e " + e.sym);
if (sym.kind == MTH &&
(sym.flags_field & SYNTHETIC) == 0) {
List<Type> oldParams = e.sym.type.hasTag(FORALL) ?
((ForAll)sym.type).tvars :
List.<Type>nil();
Type constrType = new ForAll(site.tsym.type.getTypeArguments().appendList(oldParams),
types.createMethodTypeWithReturn(sym.type.asMethodType(), site));
MethodSymbol newConstr = new MethodSymbol(sym.flags(), names.init, constrType, site.tsym) {
@Override
public Symbol baseSymbol() {
return sym;
}
};
bestSoFar = selectBest(env, site, argtypes, typeargtypes,
newConstr,
bestSoFar,
allowBoxing,
useVarargs,
false);
}
}
return bestSoFar;
} }
|
public class class_name {
private Symbol findDiamond(Env<AttrContext> env,
Type site,
List<Type> argtypes,
List<Type> typeargtypes,
boolean allowBoxing,
boolean useVarargs) {
Symbol bestSoFar = methodNotFound;
for (Scope.Entry e = site.tsym.members().lookup(names.init);
e.scope != null;
e = e.next()) {
final Symbol sym = e.sym;
//- System.out.println(" e " + e.sym);
if (sym.kind == MTH &&
(sym.flags_field & SYNTHETIC) == 0) {
List<Type> oldParams = e.sym.type.hasTag(FORALL) ?
((ForAll)sym.type).tvars :
List.<Type>nil();
Type constrType = new ForAll(site.tsym.type.getTypeArguments().appendList(oldParams),
types.createMethodTypeWithReturn(sym.type.asMethodType(), site));
MethodSymbol newConstr = new MethodSymbol(sym.flags(), names.init, constrType, site.tsym) {
@Override
public Symbol baseSymbol() {
return sym;
}
};
bestSoFar = selectBest(env, site, argtypes, typeargtypes,
newConstr,
bestSoFar,
allowBoxing,
useVarargs,
false); // depends on control dependency: [if], data = [none]
}
}
return bestSoFar;
} }
|
public class class_name {
private boolean lineLinePredicates_(int half_edge, int id_a, int id_b) {
boolean bRelationKnown = true;
if (m_perform_predicates[MatrixPredicate.InteriorInterior])
{
interiorLineInteriorLine_(half_edge, id_a, id_b, m_cluster_index_a, m_cluster_index_b);
bRelationKnown &= isPredicateKnown_(MatrixPredicate.InteriorInterior);
}
if (m_perform_predicates[MatrixPredicate.InteriorBoundary])
{
interiorLineBoundaryLine_(half_edge, id_a, id_b, m_cluster_index_a, m_cluster_index_b, MatrixPredicate.InteriorBoundary);
bRelationKnown &= isPredicateKnown_(MatrixPredicate.InteriorBoundary);
}
if (m_perform_predicates[MatrixPredicate.InteriorExterior])
{
interiorLineExteriorLine_(half_edge, id_a, id_b, MatrixPredicate.InteriorExterior);
bRelationKnown &= isPredicateKnown_(MatrixPredicate.InteriorExterior);
}
if (m_perform_predicates[MatrixPredicate.BoundaryInterior])
{
interiorLineBoundaryLine_(half_edge, id_b, id_a, m_cluster_index_b, m_cluster_index_a, MatrixPredicate.BoundaryInterior);
bRelationKnown &= isPredicateKnown_(MatrixPredicate.BoundaryInterior);
}
if (m_perform_predicates[MatrixPredicate.BoundaryBoundary])
{
boundaryLineBoundaryLine_(half_edge, id_a, id_b, m_cluster_index_a, m_cluster_index_b);
bRelationKnown &= isPredicateKnown_(MatrixPredicate.BoundaryBoundary);
}
if (m_perform_predicates[MatrixPredicate.BoundaryExterior])
{
boundaryLineExteriorLine_(half_edge, id_a, id_b, m_cluster_index_a, MatrixPredicate.BoundaryExterior);
bRelationKnown &= isPredicateKnown_(MatrixPredicate.BoundaryExterior);
}
if (m_perform_predicates[MatrixPredicate.ExteriorInterior])
{
interiorLineExteriorLine_(half_edge, id_b, id_a, MatrixPredicate.ExteriorInterior);
bRelationKnown &= isPredicateKnown_(MatrixPredicate.ExteriorInterior);
}
if (m_perform_predicates[MatrixPredicate.ExteriorBoundary])
{
boundaryLineExteriorLine_(half_edge, id_b, id_a, m_cluster_index_b, MatrixPredicate.ExteriorBoundary);
bRelationKnown &= isPredicateKnown_(MatrixPredicate.ExteriorBoundary);
}
return bRelationKnown;
} }
|
public class class_name {
private boolean lineLinePredicates_(int half_edge, int id_a, int id_b) {
boolean bRelationKnown = true;
if (m_perform_predicates[MatrixPredicate.InteriorInterior])
{
interiorLineInteriorLine_(half_edge, id_a, id_b, m_cluster_index_a, m_cluster_index_b); // depends on control dependency: [if], data = [none]
bRelationKnown &= isPredicateKnown_(MatrixPredicate.InteriorInterior); // depends on control dependency: [if], data = [none]
}
if (m_perform_predicates[MatrixPredicate.InteriorBoundary])
{
interiorLineBoundaryLine_(half_edge, id_a, id_b, m_cluster_index_a, m_cluster_index_b, MatrixPredicate.InteriorBoundary); // depends on control dependency: [if], data = [none]
bRelationKnown &= isPredicateKnown_(MatrixPredicate.InteriorBoundary); // depends on control dependency: [if], data = [none]
}
if (m_perform_predicates[MatrixPredicate.InteriorExterior])
{
interiorLineExteriorLine_(half_edge, id_a, id_b, MatrixPredicate.InteriorExterior); // depends on control dependency: [if], data = [none]
bRelationKnown &= isPredicateKnown_(MatrixPredicate.InteriorExterior); // depends on control dependency: [if], data = [none]
}
if (m_perform_predicates[MatrixPredicate.BoundaryInterior])
{
interiorLineBoundaryLine_(half_edge, id_b, id_a, m_cluster_index_b, m_cluster_index_a, MatrixPredicate.BoundaryInterior); // depends on control dependency: [if], data = [none]
bRelationKnown &= isPredicateKnown_(MatrixPredicate.BoundaryInterior); // depends on control dependency: [if], data = [none]
}
if (m_perform_predicates[MatrixPredicate.BoundaryBoundary])
{
boundaryLineBoundaryLine_(half_edge, id_a, id_b, m_cluster_index_a, m_cluster_index_b); // depends on control dependency: [if], data = [none]
bRelationKnown &= isPredicateKnown_(MatrixPredicate.BoundaryBoundary); // depends on control dependency: [if], data = [none]
}
if (m_perform_predicates[MatrixPredicate.BoundaryExterior])
{
boundaryLineExteriorLine_(half_edge, id_a, id_b, m_cluster_index_a, MatrixPredicate.BoundaryExterior); // depends on control dependency: [if], data = [none]
bRelationKnown &= isPredicateKnown_(MatrixPredicate.BoundaryExterior); // depends on control dependency: [if], data = [none]
}
if (m_perform_predicates[MatrixPredicate.ExteriorInterior])
{
interiorLineExteriorLine_(half_edge, id_b, id_a, MatrixPredicate.ExteriorInterior); // depends on control dependency: [if], data = [none]
bRelationKnown &= isPredicateKnown_(MatrixPredicate.ExteriorInterior); // depends on control dependency: [if], data = [none]
}
if (m_perform_predicates[MatrixPredicate.ExteriorBoundary])
{
boundaryLineExteriorLine_(half_edge, id_b, id_a, m_cluster_index_b, MatrixPredicate.ExteriorBoundary); // depends on control dependency: [if], data = [none]
bRelationKnown &= isPredicateKnown_(MatrixPredicate.ExteriorBoundary); // depends on control dependency: [if], data = [none]
}
return bRelationKnown;
} }
|
public class class_name {
protected List<EvaluatedCandidate<T>> evaluatePopulation(List<T> population)
{
List<EvaluatedCandidate<T>> evaluatedPopulation = new ArrayList<EvaluatedCandidate<T>>(population.size());
if (singleThreaded) // Do fitness evaluations on the request thread.
{
for (T candidate : population)
{
evaluatedPopulation.add(new EvaluatedCandidate<T>(candidate,
fitnessEvaluator.getFitness(candidate, population)));
}
}
else
{
// Divide the required number of fitness evaluations equally among the
// available processors and coordinate the threads so that we do not
// proceed until all threads have finished processing.
try
{
List<T> unmodifiablePopulation = Collections.unmodifiableList(population);
List<Future<EvaluatedCandidate<T>>> results = new ArrayList<Future<EvaluatedCandidate<T>>>(population.size());
// Submit tasks for execution and wait until all threads have finished fitness evaluations.
for (T candidate : population)
{
results.add(getSharedWorker().submit(new FitnessEvalutationTask<T>(fitnessEvaluator,
candidate,
unmodifiablePopulation)));
}
for (Future<EvaluatedCandidate<T>> result : results)
{
evaluatedPopulation.add(result.get());
}
}
catch (ExecutionException ex)
{
throw new IllegalStateException("Fitness evaluation task execution failed.", ex);
}
catch (InterruptedException ex)
{
// Restore the interrupted status, allows methods further up the call-stack
// to abort processing if appropriate.
Thread.currentThread().interrupt();
}
}
return evaluatedPopulation;
} }
|
public class class_name {
protected List<EvaluatedCandidate<T>> evaluatePopulation(List<T> population)
{
List<EvaluatedCandidate<T>> evaluatedPopulation = new ArrayList<EvaluatedCandidate<T>>(population.size());
if (singleThreaded) // Do fitness evaluations on the request thread.
{
for (T candidate : population)
{
evaluatedPopulation.add(new EvaluatedCandidate<T>(candidate,
fitnessEvaluator.getFitness(candidate, population))); // depends on control dependency: [for], data = [candidate]
}
}
else
{
// Divide the required number of fitness evaluations equally among the
// available processors and coordinate the threads so that we do not
// proceed until all threads have finished processing.
try
{
List<T> unmodifiablePopulation = Collections.unmodifiableList(population);
List<Future<EvaluatedCandidate<T>>> results = new ArrayList<Future<EvaluatedCandidate<T>>>(population.size());
// Submit tasks for execution and wait until all threads have finished fitness evaluations.
for (T candidate : population)
{
results.add(getSharedWorker().submit(new FitnessEvalutationTask<T>(fitnessEvaluator,
candidate,
unmodifiablePopulation))); // depends on control dependency: [for], data = [none]
}
for (Future<EvaluatedCandidate<T>> result : results)
{
evaluatedPopulation.add(result.get()); // depends on control dependency: [for], data = [result]
}
}
catch (ExecutionException ex)
{
throw new IllegalStateException("Fitness evaluation task execution failed.", ex);
} // depends on control dependency: [catch], data = [none]
catch (InterruptedException ex)
{
// Restore the interrupted status, allows methods further up the call-stack
// to abort processing if appropriate.
Thread.currentThread().interrupt();
} // depends on control dependency: [catch], data = [none]
}
return evaluatedPopulation;
} }
|
public class class_name {
public static <T extends ImageBase<T>>
T median(T input, @Nullable T output, int radius , @Nullable WorkArrays work) {
if( input instanceof GrayU8) {
return (T)BlurImageOps.median((GrayU8) input, (GrayU8) output, radius, (IWorkArrays)work);
} else if( input instanceof GrayF32) {
return (T)BlurImageOps.median((GrayF32) input, (GrayF32) output, radius);
} else if( input instanceof Planar) {
return (T)BlurImageOps.median((Planar)input,(Planar)output,radius, work);
} else {
throw new IllegalArgumentException("Unsupported image type");
}
} }
|
public class class_name {
public static <T extends ImageBase<T>>
T median(T input, @Nullable T output, int radius , @Nullable WorkArrays work) {
if( input instanceof GrayU8) {
return (T)BlurImageOps.median((GrayU8) input, (GrayU8) output, radius, (IWorkArrays)work); // depends on control dependency: [if], data = [none]
} else if( input instanceof GrayF32) {
return (T)BlurImageOps.median((GrayF32) input, (GrayF32) output, radius); // depends on control dependency: [if], data = [none]
} else if( input instanceof Planar) {
return (T)BlurImageOps.median((Planar)input,(Planar)output,radius, work); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unsupported image type");
}
} }
|
public class class_name {
public Map<Shape, Set<ShapeTarget>> getExplicitShapeTargets(Collection<Shape> shapes) {
Map<Shape, Set<ShapeTarget>> targets = new HashMap<>();
shapes.forEach( s -> {
Set<ShapeTarget> trgs = BatchShapeTargetReader.create().read(s.getElement());
if (!trgs.isEmpty()) {
targets.put(s, trgs);
}
});
return targets;
} }
|
public class class_name {
public Map<Shape, Set<ShapeTarget>> getExplicitShapeTargets(Collection<Shape> shapes) {
Map<Shape, Set<ShapeTarget>> targets = new HashMap<>();
shapes.forEach( s -> {
Set<ShapeTarget> trgs = BatchShapeTargetReader.create().read(s.getElement());
if (!trgs.isEmpty()) {
targets.put(s, trgs); // depends on control dependency: [if], data = [none]
}
});
return targets;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private JSONObject convertMapToJSONObject(Map map) throws IOException {
Map newMap;
// Only perform wrapping if it's enabled and the input map requires it.
if (isWrapNestedMapsAndCollections && requiresWrap(map)) {
newMap = new HashMap<String, Object>();
// Iterate through the elements in the input map.
for (Object key : map.keySet()) {
Object value = map.get(key);
Object newValue = value;
// Perform recursive conversions on maps and collections.
if (value instanceof Map) {
newValue = convertMapToJSONObject((Map) value);
} else if (value instanceof Collection) {
newValue = convertCollectionToJSONArray((Collection) value);
} else if (value instanceof Object[]) {
newValue = convertCollectionToJSONArray(Arrays.asList((Object[]) value));
}
// Add the value to the new map.
newMap.put(key, newValue);
}
} else {
// Use the input map as-is.
newMap = map;
}
// Pass the new map to the JSONObject constructor.
return getJsonObjectManager().newObject(newMap);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
private JSONObject convertMapToJSONObject(Map map) throws IOException {
Map newMap;
// Only perform wrapping if it's enabled and the input map requires it.
if (isWrapNestedMapsAndCollections && requiresWrap(map)) {
newMap = new HashMap<String, Object>();
// Iterate through the elements in the input map.
for (Object key : map.keySet()) {
Object value = map.get(key);
Object newValue = value;
// Perform recursive conversions on maps and collections.
if (value instanceof Map) {
newValue = convertMapToJSONObject((Map) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Collection) {
newValue = convertCollectionToJSONArray((Collection) value); // depends on control dependency: [if], data = [none]
} else if (value instanceof Object[]) {
newValue = convertCollectionToJSONArray(Arrays.asList((Object[]) value)); // depends on control dependency: [if], data = [none]
}
// Add the value to the new map.
newMap.put(key, newValue); // depends on control dependency: [for], data = [key]
}
} else {
// Use the input map as-is.
newMap = map;
}
// Pass the new map to the JSONObject constructor.
return getJsonObjectManager().newObject(newMap);
} }
|
public class class_name {
private void kill() {
Set copy = new HashSet(registeredWachdogs.values());
Iterator iter = copy.iterator();
while (iter.hasNext()) {
Watchdog th = (Watchdog) iter.next();
if (th.isAlive()) {
if (log.isInfoEnabled()) {
log.info(". . . Killing Watchdog " + th.getId());
}
th.kill();
}
}
this.joinAllThreads();
// remove all Watchdogs frim the registry ....
iter = copy.iterator();
while (iter.hasNext()) {
this.deregisterWatchdog((IWatchdog) iter.next());
}
} }
|
public class class_name {
private void kill() {
Set copy = new HashSet(registeredWachdogs.values());
Iterator iter = copy.iterator();
while (iter.hasNext()) {
Watchdog th = (Watchdog) iter.next();
if (th.isAlive()) {
if (log.isInfoEnabled()) {
log.info(". . . Killing Watchdog " + th.getId()); // depends on control dependency: [if], data = [none]
}
th.kill(); // depends on control dependency: [if], data = [none]
}
}
this.joinAllThreads();
// remove all Watchdogs frim the registry ....
iter = copy.iterator();
while (iter.hasNext()) {
this.deregisterWatchdog((IWatchdog) iter.next()); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
private void registerDataSources(Map<String, Properties> mapCustom) {
DefaultListableBeanFactory acf = (DefaultListableBeanFactory) this.context.getAutowireCapableBeanFactory();
Iterator<String> iter = mapCustom.keySet().iterator();
Map<Object, DataSource> targetDataSources = new HashMap<>();
BeanDefinitionBuilder beanDefinitionBuilder = null;
while (iter.hasNext()) {
String dsKey = iter.next(); //
Properties nodeProps = mapCustom.get(dsKey);
// 如果当前库为最新一组数据库,注册beanName为master
logger.info(">>>>>begin to initialize datasource:" + dsKey + "\n================\n" + nodeProps.toString()
+ "\n==============");
if (DataSourceType.Druid == dataSourceType) {
beanDefinitionBuilder = DruidDataSourceBuilder.builder(nodeProps);
} else if (DataSourceType.HikariCP == dataSourceType) {
beanDefinitionBuilder = HikariCPDataSourceBuilder.builder(nodeProps);
}
acf.registerBeanDefinition(dsKey, beanDefinitionBuilder.getRawBeanDefinition());
DataSource ds = (DataSource) this.context.getBean(dsKey);
targetDataSources.put(dsKey, ds);
// 设置默认数据源
if (dsKey.equals(MASTER_KEY)) {
defaultDataSource = ds;
}
logger.info("bean[" + dsKey + "] has initialized! lookupKey:" + dsKey);
//
DataSourceContextHolder.get().registerDataSourceKey(dsKey);
}
addTargetDataSources(targetDataSources);
} }
|
public class class_name {
private void registerDataSources(Map<String, Properties> mapCustom) {
DefaultListableBeanFactory acf = (DefaultListableBeanFactory) this.context.getAutowireCapableBeanFactory();
Iterator<String> iter = mapCustom.keySet().iterator();
Map<Object, DataSource> targetDataSources = new HashMap<>();
BeanDefinitionBuilder beanDefinitionBuilder = null;
while (iter.hasNext()) {
String dsKey = iter.next(); //
Properties nodeProps = mapCustom.get(dsKey);
// 如果当前库为最新一组数据库,注册beanName为master
logger.info(">>>>>begin to initialize datasource:" + dsKey + "\n================\n" + nodeProps.toString() // depends on control dependency: [while], data = [none]
+ "\n=============="); // depends on control dependency: [while], data = [none]
if (DataSourceType.Druid == dataSourceType) {
beanDefinitionBuilder = DruidDataSourceBuilder.builder(nodeProps); // depends on control dependency: [if], data = [none]
} else if (DataSourceType.HikariCP == dataSourceType) {
beanDefinitionBuilder = HikariCPDataSourceBuilder.builder(nodeProps); // depends on control dependency: [if], data = [none]
}
acf.registerBeanDefinition(dsKey, beanDefinitionBuilder.getRawBeanDefinition()); // depends on control dependency: [while], data = [none]
DataSource ds = (DataSource) this.context.getBean(dsKey);
targetDataSources.put(dsKey, ds); // depends on control dependency: [while], data = [none]
// 设置默认数据源
if (dsKey.equals(MASTER_KEY)) {
defaultDataSource = ds; // depends on control dependency: [if], data = [none]
}
logger.info("bean[" + dsKey + "] has initialized! lookupKey:" + dsKey); // depends on control dependency: [while], data = [none]
//
DataSourceContextHolder.get().registerDataSourceKey(dsKey); // depends on control dependency: [while], data = [none]
}
addTargetDataSources(targetDataSources);
} }
|
public class class_name {
public DescribeVTLDevicesRequest withVTLDeviceARNs(String... vTLDeviceARNs) {
if (this.vTLDeviceARNs == null) {
setVTLDeviceARNs(new com.amazonaws.internal.SdkInternalList<String>(vTLDeviceARNs.length));
}
for (String ele : vTLDeviceARNs) {
this.vTLDeviceARNs.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeVTLDevicesRequest withVTLDeviceARNs(String... vTLDeviceARNs) {
if (this.vTLDeviceARNs == null) {
setVTLDeviceARNs(new com.amazonaws.internal.SdkInternalList<String>(vTLDeviceARNs.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : vTLDeviceARNs) {
this.vTLDeviceARNs.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void scan() {
final PackageNamesScanner scanner = new PackageNamesScanner(
scanPkgs.toArray(new String[scanPkgs.size()]), true);
while (scanner.hasNext()) {
String fileName = scanner.next();
if (!fileName.endsWith(".class")) continue;
ClassInfo info = new ClassInfo(fileName) {
InputStream in;
@Override
public InputStream getFileStream() {
if (in == null) {
in = scanner.open();
}
return in;
}
@Override
public void closeFileStream() {
closeQuietly(in);
}
};
String className = info.getCtClass().getName();
if (!foundClasses.contains(className)) {
ClassFoundEvent event = new ClassFoundEvent(info);
SystemEventBus.publish(event);
info.closeFileStream();
if (event.accept) {
acceptClasses.add(className);
}
}
foundClasses.add(className);
}
} }
|
public class class_name {
public void scan() {
final PackageNamesScanner scanner = new PackageNamesScanner(
scanPkgs.toArray(new String[scanPkgs.size()]), true);
while (scanner.hasNext()) {
String fileName = scanner.next();
if (!fileName.endsWith(".class")) continue;
ClassInfo info = new ClassInfo(fileName) {
InputStream in;
@Override
public InputStream getFileStream() {
if (in == null) {
in = scanner.open(); // depends on control dependency: [if], data = [none]
}
return in;
}
@Override
public void closeFileStream() {
closeQuietly(in);
}
};
String className = info.getCtClass().getName();
if (!foundClasses.contains(className)) {
ClassFoundEvent event = new ClassFoundEvent(info);
SystemEventBus.publish(event); // depends on control dependency: [if], data = [none]
info.closeFileStream(); // depends on control dependency: [if], data = [none]
if (event.accept) {
acceptClasses.add(className); // depends on control dependency: [if], data = [none]
}
}
foundClasses.add(className); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
@Override
public void setGeneratedColumnInfo(int generate, ResultMetaData meta) {
// can support INSERT_SELECT also
if (type != StatementTypes.INSERT) {
return;
}
int colIndex = baseTable.getIdentityColumnIndex();
if (colIndex == -1) {
return;
}
switch (generate) {
case ResultConstants.RETURN_NO_GENERATED_KEYS :
return;
case ResultConstants.RETURN_GENERATED_KEYS_COL_INDEXES :
int[] columnIndexes = meta.getGeneratedColumnIndexes();
if (columnIndexes.length != 1) {
return;
}
if (columnIndexes[0] != colIndex) {
return;
}
// $FALL-THROUGH$
case ResultConstants.RETURN_GENERATED_KEYS :
generatedIndexes = new int[]{ colIndex };
break;
case ResultConstants.RETURN_GENERATED_KEYS_COL_NAMES :
String[] columnNames = meta.getGeneratedColumnNames();
if (columnNames.length != 1) {
return;
}
if (baseTable.findColumn(columnNames[0]) != colIndex) {
return;
}
generatedIndexes = new int[]{ colIndex };
break;
}
generatedResultMetaData =
ResultMetaData.newResultMetaData(generatedIndexes.length);
for (int i = 0; i < generatedIndexes.length; i++) {
ColumnSchema column = baseTable.getColumn(generatedIndexes[i]);
generatedResultMetaData.columns[i] = column;
}
generatedResultMetaData.prepareData();
} }
|
public class class_name {
@Override
public void setGeneratedColumnInfo(int generate, ResultMetaData meta) {
// can support INSERT_SELECT also
if (type != StatementTypes.INSERT) {
return; // depends on control dependency: [if], data = [none]
}
int colIndex = baseTable.getIdentityColumnIndex();
if (colIndex == -1) {
return; // depends on control dependency: [if], data = [none]
}
switch (generate) {
case ResultConstants.RETURN_NO_GENERATED_KEYS :
return;
case ResultConstants.RETURN_GENERATED_KEYS_COL_INDEXES :
int[] columnIndexes = meta.getGeneratedColumnIndexes();
if (columnIndexes.length != 1) {
return; // depends on control dependency: [if], data = [none]
}
if (columnIndexes[0] != colIndex) {
return; // depends on control dependency: [if], data = [none]
}
// $FALL-THROUGH$
case ResultConstants.RETURN_GENERATED_KEYS :
generatedIndexes = new int[]{ colIndex };
break;
case ResultConstants.RETURN_GENERATED_KEYS_COL_NAMES :
String[] columnNames = meta.getGeneratedColumnNames();
if (columnNames.length != 1) {
return; // depends on control dependency: [if], data = [none]
}
if (baseTable.findColumn(columnNames[0]) != colIndex) {
return; // depends on control dependency: [if], data = [none]
}
generatedIndexes = new int[]{ colIndex };
break;
}
generatedResultMetaData =
ResultMetaData.newResultMetaData(generatedIndexes.length);
for (int i = 0; i < generatedIndexes.length; i++) {
ColumnSchema column = baseTable.getColumn(generatedIndexes[i]);
generatedResultMetaData.columns[i] = column; // depends on control dependency: [for], data = [i]
}
generatedResultMetaData.prepareData();
} }
|
public class class_name {
private double bic(int k, int n, int d, double distortion, int[] clusterSize) {
double variance = distortion / (n - k);
double L = 0.0;
for (int i = 0; i < k; i++) {
L += logLikelihood(k, n, clusterSize[i], d, variance);
}
int numParameters = k + k * d;
return L - 0.5 * numParameters * Math.log(n);
} }
|
public class class_name {
private double bic(int k, int n, int d, double distortion, int[] clusterSize) {
double variance = distortion / (n - k);
double L = 0.0;
for (int i = 0; i < k; i++) {
L += logLikelihood(k, n, clusterSize[i], d, variance); // depends on control dependency: [for], data = [i]
}
int numParameters = k + k * d;
return L - 0.5 * numParameters * Math.log(n);
} }
|
public class class_name {
private boolean isShadowed(String resourceName) {
if (persistenceHandler.isManifest() || !resourceName.endsWith(CLASS_FILE_SUFFIX)) {
return false;
}
// This synchronization is required to avoid a racing condition to the actual class loading.
synchronized (this) {
String typeName = resourceName.replace('/', '.').substring(0, resourceName.length() - CLASS_FILE_SUFFIX.length());
if (typeDefinitions.containsKey(typeName)) {
return true;
}
Class<?> loadedClass = findLoadedClass(typeName);
return loadedClass != null && loadedClass.getClassLoader() == this;
}
} }
|
public class class_name {
private boolean isShadowed(String resourceName) {
if (persistenceHandler.isManifest() || !resourceName.endsWith(CLASS_FILE_SUFFIX)) {
return false; // depends on control dependency: [if], data = [none]
}
// This synchronization is required to avoid a racing condition to the actual class loading.
synchronized (this) {
String typeName = resourceName.replace('/', '.').substring(0, resourceName.length() - CLASS_FILE_SUFFIX.length());
if (typeDefinitions.containsKey(typeName)) {
return true; // depends on control dependency: [if], data = [none]
}
Class<?> loadedClass = findLoadedClass(typeName);
return loadedClass != null && loadedClass.getClassLoader() == this;
}
} }
|
public class class_name {
private void writeResource(Resource mpxjResource, net.sf.mpxj.planner.schema.Resource plannerResource)
{
ProjectCalendar resourceCalendar = mpxjResource.getResourceCalendar();
if (resourceCalendar != null)
{
plannerResource.setCalendar(getIntegerString(resourceCalendar.getUniqueID()));
}
plannerResource.setEmail(mpxjResource.getEmailAddress());
plannerResource.setId(getIntegerString(mpxjResource.getUniqueID()));
plannerResource.setName(getString(mpxjResource.getName()));
plannerResource.setNote(mpxjResource.getNotes());
plannerResource.setShortName(mpxjResource.getInitials());
plannerResource.setType(mpxjResource.getType() == ResourceType.MATERIAL ? "2" : "1");
//plannerResource.setStdRate();
//plannerResource.setOvtRate();
plannerResource.setUnits("0");
//plannerResource.setProperties();
m_eventManager.fireResourceWrittenEvent(mpxjResource);
} }
|
public class class_name {
private void writeResource(Resource mpxjResource, net.sf.mpxj.planner.schema.Resource plannerResource)
{
ProjectCalendar resourceCalendar = mpxjResource.getResourceCalendar();
if (resourceCalendar != null)
{
plannerResource.setCalendar(getIntegerString(resourceCalendar.getUniqueID())); // depends on control dependency: [if], data = [(resourceCalendar]
}
plannerResource.setEmail(mpxjResource.getEmailAddress());
plannerResource.setId(getIntegerString(mpxjResource.getUniqueID()));
plannerResource.setName(getString(mpxjResource.getName()));
plannerResource.setNote(mpxjResource.getNotes());
plannerResource.setShortName(mpxjResource.getInitials());
plannerResource.setType(mpxjResource.getType() == ResourceType.MATERIAL ? "2" : "1");
//plannerResource.setStdRate();
//plannerResource.setOvtRate();
plannerResource.setUnits("0");
//plannerResource.setProperties();
m_eventManager.fireResourceWrittenEvent(mpxjResource);
} }
|
public class class_name {
public void put(TransactionLocal key, Object value)
{
// We don't use a fast path as with get() because it is at
// least as common to use set() to create new entries as
// it is to replace existing ones, in which case, a fast
// path would fail more often than not.
Entry[] tab = table;
int len = tab.length;
int i = key.hashCode & (len - 1);
for (Entry e = tab[i];
e != null;
e = tab[i = nextIndex(i, len)])
{
if (e.key == key)
{
e.value = value;
return;
}
}
tab[i] = new Entry(key, value);
int sz = ++size;
if (sz >= threshold)
rehash();
} }
|
public class class_name {
public void put(TransactionLocal key, Object value)
{
// We don't use a fast path as with get() because it is at
// least as common to use set() to create new entries as
// it is to replace existing ones, in which case, a fast
// path would fail more often than not.
Entry[] tab = table;
int len = tab.length;
int i = key.hashCode & (len - 1);
for (Entry e = tab[i];
e != null;
e = tab[i = nextIndex(i, len)])
{
if (e.key == key)
{
e.value = value;
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
}
tab[i] = new Entry(key, value);
int sz = ++size;
if (sz >= threshold)
rehash();
} }
|
public class class_name {
private QueryResultImpl unionResults(QueryImpl query, Queue<QueryResultImpl> results, boolean distinct) {
QueryResultImpl result = new QueryResultImpl(query);
boolean ask = false;
for (QueryResultImpl r : results) {
if (r.ask()) {
ask = true;
}
r.getBindings().forEach(result::add);
}
result.setAsk(ask);
if (distinct) {
return eliminateDuplicates(result);
}
return result;
} }
|
public class class_name {
private QueryResultImpl unionResults(QueryImpl query, Queue<QueryResultImpl> results, boolean distinct) {
QueryResultImpl result = new QueryResultImpl(query);
boolean ask = false;
for (QueryResultImpl r : results) {
if (r.ask()) {
ask = true; // depends on control dependency: [if], data = [none]
}
r.getBindings().forEach(result::add); // depends on control dependency: [for], data = [r]
}
result.setAsk(ask);
if (distinct) {
return eliminateDuplicates(result); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
@Override
public Map<String, Object> toSource() {
Map<String, Object> sourceMap = new HashMap<>();
if (endTime != null) {
addFieldToSource(sourceMap, "endTime", endTime);
}
if (jobName != null) {
addFieldToSource(sourceMap, "jobName", jobName);
}
if (jobStatus != null) {
addFieldToSource(sourceMap, "jobStatus", jobStatus);
}
if (lastUpdated != null) {
addFieldToSource(sourceMap, "lastUpdated", lastUpdated);
}
if (scriptData != null) {
addFieldToSource(sourceMap, "scriptData", scriptData);
}
if (scriptResult != null) {
addFieldToSource(sourceMap, "scriptResult", scriptResult);
}
if (scriptType != null) {
addFieldToSource(sourceMap, "scriptType", scriptType);
}
if (startTime != null) {
addFieldToSource(sourceMap, "startTime", startTime);
}
if (target != null) {
addFieldToSource(sourceMap, "target", target);
}
return sourceMap;
} }
|
public class class_name {
@Override
public Map<String, Object> toSource() {
Map<String, Object> sourceMap = new HashMap<>();
if (endTime != null) {
addFieldToSource(sourceMap, "endTime", endTime); // depends on control dependency: [if], data = [none]
}
if (jobName != null) {
addFieldToSource(sourceMap, "jobName", jobName); // depends on control dependency: [if], data = [none]
}
if (jobStatus != null) {
addFieldToSource(sourceMap, "jobStatus", jobStatus); // depends on control dependency: [if], data = [none]
}
if (lastUpdated != null) {
addFieldToSource(sourceMap, "lastUpdated", lastUpdated); // depends on control dependency: [if], data = [none]
}
if (scriptData != null) {
addFieldToSource(sourceMap, "scriptData", scriptData); // depends on control dependency: [if], data = [none]
}
if (scriptResult != null) {
addFieldToSource(sourceMap, "scriptResult", scriptResult); // depends on control dependency: [if], data = [none]
}
if (scriptType != null) {
addFieldToSource(sourceMap, "scriptType", scriptType); // depends on control dependency: [if], data = [none]
}
if (startTime != null) {
addFieldToSource(sourceMap, "startTime", startTime); // depends on control dependency: [if], data = [none]
}
if (target != null) {
addFieldToSource(sourceMap, "target", target); // depends on control dependency: [if], data = [none]
}
return sourceMap;
} }
|
public class class_name {
private String setSelectQuery(List<String> columns) {
if (columns != null && !columns.isEmpty()) {
return CQLTranslator.SELECT_QUERY;
}
if (kunderaQuery.isAggregated()) {
Expression selectExpression =
((SelectClause) kunderaQuery.getSelectStatement().getSelectClause()).getSelectExpression();
// create query depending on function
if (selectExpression instanceof CountFunction) {
return CQLTranslator.SELECT_COUNT_QUERY;
}
}
return CQLTranslator.SELECTALL_QUERY;
} }
|
public class class_name {
private String setSelectQuery(List<String> columns) {
if (columns != null && !columns.isEmpty()) {
return CQLTranslator.SELECT_QUERY; // depends on control dependency: [if], data = [none]
}
if (kunderaQuery.isAggregated()) {
Expression selectExpression =
((SelectClause) kunderaQuery.getSelectStatement().getSelectClause()).getSelectExpression();
// create query depending on function
if (selectExpression instanceof CountFunction) {
return CQLTranslator.SELECT_COUNT_QUERY; // depends on control dependency: [if], data = [none]
}
}
return CQLTranslator.SELECTALL_QUERY;
} }
|
public class class_name {
@Override
public ValidationResult<?> validate(final OptionalConfigurationComponent<?> configurationComponent) {
if (configurationComponent instanceof ValidatingConfigurationComponent) {
@SuppressWarnings("rawtypes")
final ValidatingConfigurationComponent<?> validatingComponent = (ValidatingConfigurationComponent) configurationComponent;
return validatingComponent.validate();
} else {
final Class<?> componentClass = configurationComponent.getClass();
final Validator<?> validator = validators.get(componentClass);
if (validator != null) {
@SuppressWarnings({"unchecked", "rawtypes"})
final ValidationResult<?> validationResult = ((Validator) validator).validate(configurationComponent);
return validationResult;
} else {
throw new IllegalArgumentException("No validator for class " + componentClass.getCanonicalName());
}
}
} }
|
public class class_name {
@Override
public ValidationResult<?> validate(final OptionalConfigurationComponent<?> configurationComponent) {
if (configurationComponent instanceof ValidatingConfigurationComponent) {
@SuppressWarnings("rawtypes")
final ValidatingConfigurationComponent<?> validatingComponent = (ValidatingConfigurationComponent) configurationComponent;
return validatingComponent.validate(); // depends on control dependency: [if], data = [none]
} else {
final Class<?> componentClass = configurationComponent.getClass();
final Validator<?> validator = validators.get(componentClass);
if (validator != null) {
@SuppressWarnings({"unchecked", "rawtypes"})
final ValidationResult<?> validationResult = ((Validator) validator).validate(configurationComponent);
return validationResult; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("No validator for class " + componentClass.getCanonicalName());
}
}
} }
|
public class class_name {
public final void ruleFeatureCallID() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXbase.g:1221:2: ( ( ( rule__FeatureCallID__Alternatives ) ) )
// InternalXbase.g:1222:2: ( ( rule__FeatureCallID__Alternatives ) )
{
// InternalXbase.g:1222:2: ( ( rule__FeatureCallID__Alternatives ) )
// InternalXbase.g:1223:3: ( rule__FeatureCallID__Alternatives )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getFeatureCallIDAccess().getAlternatives());
}
// InternalXbase.g:1224:3: ( rule__FeatureCallID__Alternatives )
// InternalXbase.g:1224:4: rule__FeatureCallID__Alternatives
{
pushFollow(FOLLOW_2);
rule__FeatureCallID__Alternatives();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getFeatureCallIDAccess().getAlternatives());
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} }
|
public class class_name {
public final void ruleFeatureCallID() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXbase.g:1221:2: ( ( ( rule__FeatureCallID__Alternatives ) ) )
// InternalXbase.g:1222:2: ( ( rule__FeatureCallID__Alternatives ) )
{
// InternalXbase.g:1222:2: ( ( rule__FeatureCallID__Alternatives ) )
// InternalXbase.g:1223:3: ( rule__FeatureCallID__Alternatives )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getFeatureCallIDAccess().getAlternatives()); // depends on control dependency: [if], data = [none]
}
// InternalXbase.g:1224:3: ( rule__FeatureCallID__Alternatives )
// InternalXbase.g:1224:4: rule__FeatureCallID__Alternatives
{
pushFollow(FOLLOW_2);
rule__FeatureCallID__Alternatives();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getFeatureCallIDAccess().getAlternatives()); // depends on control dependency: [if], data = [none]
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} }
|
public class class_name {
public void terminate() {
if (!isTerminated()) {
for (final Stage stage : stages.values()) {
stage.stop();
}
loggerProviderKeeper.close();
mailboxProviderKeeper.close();
completesProviderKeeper.close();
}
} }
|
public class class_name {
public void terminate() {
if (!isTerminated()) {
for (final Stage stage : stages.values()) {
stage.stop(); // depends on control dependency: [for], data = [stage]
}
loggerProviderKeeper.close(); // depends on control dependency: [if], data = [none]
mailboxProviderKeeper.close(); // depends on control dependency: [if], data = [none]
completesProviderKeeper.close(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static String analyst(String date) {
String style = null;
boolean hasDiagonal = false;
Replacer r = Replacer.of(checkNotNull(date));
if (hasDiagonal = r.contain("/")) {
r.update(r.lookups("/").with("-"));
}
//ISO
if (r.containAll(".", "T")) {
style = DateStyle.ISO_FORMAT;
}
//CST
else if (r.contain("CST")) {
style = DateStyle.CST_FORMAT;
}
//GMT
else if (r.contain("GMT")) {
style = DateStyle.GMT_FORMAT;
}
//analyst
else {
switch (date.length()) {
case 6: style = "HHmmss"; break;
case 8: style = r.contain(":") ? DateStyle.HH_mm_ss : DateStyle.yyyyMMdd; break;
case 10: style = DateStyle.yyyy_MM_dd; break;
case 14: style = DateStyle.yyyyMMddHHmmss; break;
case 19: style = DateStyle.yyyy_MM_dd_HH_mm_ss; break;
}
}
return hasDiagonal ? r.set(style).lookups("-").with("/") : style;
} }
|
public class class_name {
private static String analyst(String date) {
String style = null;
boolean hasDiagonal = false;
Replacer r = Replacer.of(checkNotNull(date));
if (hasDiagonal = r.contain("/")) {
r.update(r.lookups("/").with("-")); // depends on control dependency: [if], data = [none]
}
//ISO
if (r.containAll(".", "T")) {
style = DateStyle.ISO_FORMAT; // depends on control dependency: [if], data = [none]
}
//CST
else if (r.contain("CST")) {
style = DateStyle.CST_FORMAT; // depends on control dependency: [if], data = [none]
}
//GMT
else if (r.contain("GMT")) {
style = DateStyle.GMT_FORMAT; // depends on control dependency: [if], data = [none]
}
//analyst
else {
switch (date.length()) {
case 6: style = "HHmmss"; break;
case 8: style = r.contain(":") ? DateStyle.HH_mm_ss : DateStyle.yyyyMMdd; break;
case 10: style = DateStyle.yyyy_MM_dd; break;
case 14: style = DateStyle.yyyyMMddHHmmss; break;
case 19: style = DateStyle.yyyy_MM_dd_HH_mm_ss; break;
}
}
return hasDiagonal ? r.set(style).lookups("-").with("/") : style;
} }
|
public class class_name {
static void removeOldKeys(Map<String, String> map, String... keys) {
if (CommonUtils.isEmpty(map)) {
return;
}
for (String key : keys) {
map.remove(key);
}
} }
|
public class class_name {
static void removeOldKeys(Map<String, String> map, String... keys) {
if (CommonUtils.isEmpty(map)) {
return; // depends on control dependency: [if], data = [none]
}
for (String key : keys) {
map.remove(key); // depends on control dependency: [for], data = [key]
}
} }
|
public class class_name {
public static int CrowdingDistanceCompare(Solution solution1, Solution solution2)
{
double crowding1 = solution1.getCrowdingDistance();
double crowding2 = solution2.getCrowdingDistance();
if (crowding1 > crowding2)
{
return -1;
}
else if (crowding1 < crowding2)
{
return 1;
}
else
{
return 0;
}
} }
|
public class class_name {
public static int CrowdingDistanceCompare(Solution solution1, Solution solution2)
{
double crowding1 = solution1.getCrowdingDistance();
double crowding2 = solution2.getCrowdingDistance();
if (crowding1 > crowding2)
{
return -1; // depends on control dependency: [if], data = [none]
}
else if (crowding1 < crowding2)
{
return 1; // depends on control dependency: [if], data = [none]
}
else
{
return 0; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Nullable
public static long[] optLongArray(@Nullable Bundle bundle, @Nullable String key, @Nullable long[] fallback) {
if (bundle == null) {
return fallback;
}
return bundle.getLongArray(key);
} }
|
public class class_name {
@Nullable
public static long[] optLongArray(@Nullable Bundle bundle, @Nullable String key, @Nullable long[] fallback) {
if (bundle == null) {
return fallback; // depends on control dependency: [if], data = [none]
}
return bundle.getLongArray(key);
} }
|
public class class_name {
public TraceSummary withServiceIds(ServiceId... serviceIds) {
if (this.serviceIds == null) {
setServiceIds(new java.util.ArrayList<ServiceId>(serviceIds.length));
}
for (ServiceId ele : serviceIds) {
this.serviceIds.add(ele);
}
return this;
} }
|
public class class_name {
public TraceSummary withServiceIds(ServiceId... serviceIds) {
if (this.serviceIds == null) {
setServiceIds(new java.util.ArrayList<ServiceId>(serviceIds.length)); // depends on control dependency: [if], data = [none]
}
for (ServiceId ele : serviceIds) {
this.serviceIds.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public int compareByAvg(ProcProfRow lhs, ProcProfRow rhs)
{
if (lhs.avg * lhs.invocations > rhs.avg * rhs.invocations) {
return 1;
} else if (lhs.avg * lhs.invocations < rhs.avg * rhs.invocations) {
return -1;
} else {
return 0;
}
} }
|
public class class_name {
public int compareByAvg(ProcProfRow lhs, ProcProfRow rhs)
{
if (lhs.avg * lhs.invocations > rhs.avg * rhs.invocations) {
return 1; // depends on control dependency: [if], data = [none]
} else if (lhs.avg * lhs.invocations < rhs.avg * rhs.invocations) {
return -1; // depends on control dependency: [if], data = [none]
} else {
return 0; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String getID() {
byte[] genBytes = new byte[_byteArraySize];
synchronized(_random) {
_random.nextBytes(genBytes);
}
String id = convertSessionIdBytesToSessionId(genBytes, _sessionIDLength);
if (logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, methodClassName, "getSessionID", "sessionID=" + id);
}
return id;
} }
|
public class class_name {
public String getID() {
byte[] genBytes = new byte[_byteArraySize];
synchronized(_random) {
_random.nextBytes(genBytes);
}
String id = convertSessionIdBytesToSessionId(genBytes, _sessionIDLength);
if (logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, methodClassName, "getSessionID", "sessionID=" + id); // depends on control dependency: [if], data = [none]
}
return id;
} }
|
public class class_name {
protected byte[] spoolInternalValue()
{
try
{
return value.getString().getBytes(Constants.DEFAULT_ENCODING);
}
catch (UnsupportedEncodingException e)
{
throw new RuntimeException("FATAL ERROR Charset " + Constants.DEFAULT_ENCODING + " is not supported!");
}
} }
|
public class class_name {
protected byte[] spoolInternalValue()
{
try
{
return value.getString().getBytes(Constants.DEFAULT_ENCODING); // depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException e)
{
throw new RuntimeException("FATAL ERROR Charset " + Constants.DEFAULT_ENCODING + " is not supported!");
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public final void forget() throws XAException
{
if (tc.isEntryEnabled())
Tr.entry(tc, "forget", new Object[] { _resource, _xid });
if (tcSummary.isDebugEnabled())
Tr.debug(tcSummary, "xa_forget", this);
int rc = -1; // not an XA RC
try
{
if (!_completed && _resource != null)
{
if (_state == FAILED)
_resource = reconnectRM(); // D419307A
_resource.forget(_xid);
rc = XAResource.XA_OK;
destroy();
}
} catch (XAException xae)
{
rc = xae.errorCode;
throw xae;
} finally
{
if (tc.isEntryEnabled())
Tr.exit(tc, "forget");
if (tcSummary.isDebugEnabled())
Tr.debug(tcSummary, "xa_rollback result: " +
XAReturnCodeHelper.convertXACode(rc));
}
} }
|
public class class_name {
@Override
public final void forget() throws XAException
{
if (tc.isEntryEnabled())
Tr.entry(tc, "forget", new Object[] { _resource, _xid });
if (tcSummary.isDebugEnabled())
Tr.debug(tcSummary, "xa_forget", this);
int rc = -1; // not an XA RC
try
{
if (!_completed && _resource != null)
{
if (_state == FAILED)
_resource = reconnectRM(); // D419307A
_resource.forget(_xid); // depends on control dependency: [if], data = [none]
rc = XAResource.XA_OK; // depends on control dependency: [if], data = [none]
destroy(); // depends on control dependency: [if], data = [none]
}
} catch (XAException xae)
{
rc = xae.errorCode;
throw xae;
} finally // depends on control dependency: [catch], data = [none]
{
if (tc.isEntryEnabled())
Tr.exit(tc, "forget");
if (tcSummary.isDebugEnabled())
Tr.debug(tcSummary, "xa_rollback result: " +
XAReturnCodeHelper.convertXACode(rc));
}
} }
|
public class class_name {
protected Box createTfra(Track track, Container isoFile) {
TrackFragmentRandomAccessBox tfra = new TrackFragmentRandomAccessBox();
tfra.setVersion(1); // use long offsets and times
List<TrackFragmentRandomAccessBox.Entry> offset2timeEntries = new LinkedList<TrackFragmentRandomAccessBox.Entry>();
TrackExtendsBox trex = null;
List<TrackExtendsBox> trexs = Path.getPaths(isoFile, "moov/mvex/trex");
for (TrackExtendsBox innerTrex : trexs) {
if (innerTrex.getTrackId() == track.getTrackMetaData().getTrackId()) {
trex = innerTrex;
}
}
long offset = 0;
long duration = 0;
for (Box box : isoFile.getBoxes()) {
if (box instanceof MovieFragmentBox) {
List<TrackFragmentBox> trafs = ((MovieFragmentBox) box).getBoxes(TrackFragmentBox.class);
for (int i = 0; i < trafs.size(); i++) {
TrackFragmentBox traf = trafs.get(i);
if (traf.getTrackFragmentHeaderBox().getTrackId() == track.getTrackMetaData().getTrackId()) {
// here we are at the offset required for the current entry.
List<TrackRunBox> truns = traf.getBoxes(TrackRunBox.class);
for (int j = 0; j < truns.size(); j++) {
List<TrackFragmentRandomAccessBox.Entry> offset2timeEntriesThisTrun = new LinkedList<TrackFragmentRandomAccessBox.Entry>();
TrackRunBox trun = truns.get(j);
for (int k = 0; k < trun.getEntries().size(); k++) {
TrackRunBox.Entry trunEntry = trun.getEntries().get(k);
SampleFlags sf;
if (k == 0 && trun.isFirstSampleFlagsPresent()) {
sf = trun.getFirstSampleFlags();
} else if (trun.isSampleFlagsPresent()) {
sf = trunEntry.getSampleFlags();
} else {
sf = trex.getDefaultSampleFlags();
}
if (sf == null && track.getHandler().equals("vide")) {
throw new RuntimeException("Cannot find SampleFlags for video track but it's required to build tfra");
}
if (sf == null || sf.getSampleDependsOn() == 2) {
offset2timeEntriesThisTrun.add(new TrackFragmentRandomAccessBox.Entry(
duration,
offset,
i + 1, j + 1, k + 1));
}
duration += trunEntry.getSampleDuration();
}
if (offset2timeEntriesThisTrun.size() == trun.getEntries().size() && trun.getEntries().size() > 0) {
// Oooops every sample seems to be random access sample
// is this an audio track? I don't care.
// I just use the first for trun sample for tfra random access
offset2timeEntries.add(offset2timeEntriesThisTrun.get(0));
} else {
offset2timeEntries.addAll(offset2timeEntriesThisTrun);
}
}
}
}
}
offset += box.getSize();
}
tfra.setEntries(offset2timeEntries);
tfra.setTrackId(track.getTrackMetaData().getTrackId());
return tfra;
} }
|
public class class_name {
protected Box createTfra(Track track, Container isoFile) {
TrackFragmentRandomAccessBox tfra = new TrackFragmentRandomAccessBox();
tfra.setVersion(1); // use long offsets and times
List<TrackFragmentRandomAccessBox.Entry> offset2timeEntries = new LinkedList<TrackFragmentRandomAccessBox.Entry>();
TrackExtendsBox trex = null;
List<TrackExtendsBox> trexs = Path.getPaths(isoFile, "moov/mvex/trex");
for (TrackExtendsBox innerTrex : trexs) {
if (innerTrex.getTrackId() == track.getTrackMetaData().getTrackId()) {
trex = innerTrex; // depends on control dependency: [if], data = [none]
}
}
long offset = 0;
long duration = 0;
for (Box box : isoFile.getBoxes()) {
if (box instanceof MovieFragmentBox) {
List<TrackFragmentBox> trafs = ((MovieFragmentBox) box).getBoxes(TrackFragmentBox.class);
for (int i = 0; i < trafs.size(); i++) {
TrackFragmentBox traf = trafs.get(i);
if (traf.getTrackFragmentHeaderBox().getTrackId() == track.getTrackMetaData().getTrackId()) {
// here we are at the offset required for the current entry.
List<TrackRunBox> truns = traf.getBoxes(TrackRunBox.class);
for (int j = 0; j < truns.size(); j++) {
List<TrackFragmentRandomAccessBox.Entry> offset2timeEntriesThisTrun = new LinkedList<TrackFragmentRandomAccessBox.Entry>();
TrackRunBox trun = truns.get(j);
for (int k = 0; k < trun.getEntries().size(); k++) {
TrackRunBox.Entry trunEntry = trun.getEntries().get(k);
SampleFlags sf;
if (k == 0 && trun.isFirstSampleFlagsPresent()) {
sf = trun.getFirstSampleFlags(); // depends on control dependency: [if], data = [none]
} else if (trun.isSampleFlagsPresent()) {
sf = trunEntry.getSampleFlags(); // depends on control dependency: [if], data = [none]
} else {
sf = trex.getDefaultSampleFlags(); // depends on control dependency: [if], data = [none]
}
if (sf == null && track.getHandler().equals("vide")) {
throw new RuntimeException("Cannot find SampleFlags for video track but it's required to build tfra");
}
if (sf == null || sf.getSampleDependsOn() == 2) {
offset2timeEntriesThisTrun.add(new TrackFragmentRandomAccessBox.Entry(
duration,
offset,
i + 1, j + 1, k + 1));
}
duration += trunEntry.getSampleDuration();
}
if (offset2timeEntriesThisTrun.size() == trun.getEntries().size() && trun.getEntries().size() > 0) {
// Oooops every sample seems to be random access sample
// is this an audio track? I don't care.
// I just use the first for trun sample for tfra random access
offset2timeEntries.add(offset2timeEntriesThisTrun.get(0));
} else {
offset2timeEntries.addAll(offset2timeEntriesThisTrun); // depends on control dependency: [if], data = [none]
}
}
}
}
}
offset += box.getSize(); // depends on control dependency: [if], data = [none]
}
tfra.setEntries(offset2timeEntries); // depends on control dependency: [for], data = [none]
tfra.setTrackId(track.getTrackMetaData().getTrackId()); // depends on control dependency: [for], data = [none]
return tfra; // depends on control dependency: [for], data = [none]
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.