code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public static String getDefaultSearchTypes(CmsObject cms, CmsResource resource) {
StringBuffer result = new StringBuffer();
String referenceSitePath = cms.getSitePath(resource);
String configPath;
if (resource == null) {
// not sure if this can ever happen?
configPath = cms.addSiteRoot(cms.getRequestContext().getUri());
} else {
configPath = resource.getRootPath();
}
CmsADEConfigData config = OpenCms.getADEManager().lookupConfiguration(cms, configPath);
Set<String> detailPageTypes = OpenCms.getADEManager().getDetailPageTypes(cms);
for (CmsResourceTypeConfig typeConfig : config.getResourceTypes()) {
String typeName = typeConfig.getTypeName();
if (!detailPageTypes.contains(typeName)) {
continue;
}
if (typeConfig.checkViewable(cms, referenceSitePath)) {
result.append(typeName).append(",");
}
}
result.append(CmsResourceTypeXmlContainerPage.getStaticTypeName()).append(",");
result.append(CmsResourceTypeBinary.getStaticTypeName()).append(",");
result.append(CmsResourceTypeImage.getStaticTypeName()).append(",");
result.append(CmsResourceTypePlain.getStaticTypeName());
return result.toString();
} } | public class class_name {
public static String getDefaultSearchTypes(CmsObject cms, CmsResource resource) {
StringBuffer result = new StringBuffer();
String referenceSitePath = cms.getSitePath(resource);
String configPath;
if (resource == null) {
// not sure if this can ever happen?
configPath = cms.addSiteRoot(cms.getRequestContext().getUri()); // depends on control dependency: [if], data = [none]
} else {
configPath = resource.getRootPath(); // depends on control dependency: [if], data = [none]
}
CmsADEConfigData config = OpenCms.getADEManager().lookupConfiguration(cms, configPath);
Set<String> detailPageTypes = OpenCms.getADEManager().getDetailPageTypes(cms);
for (CmsResourceTypeConfig typeConfig : config.getResourceTypes()) {
String typeName = typeConfig.getTypeName();
if (!detailPageTypes.contains(typeName)) {
continue;
}
if (typeConfig.checkViewable(cms, referenceSitePath)) {
result.append(typeName).append(","); // depends on control dependency: [if], data = [none]
}
}
result.append(CmsResourceTypeXmlContainerPage.getStaticTypeName()).append(",");
result.append(CmsResourceTypeBinary.getStaticTypeName()).append(",");
result.append(CmsResourceTypeImage.getStaticTypeName()).append(",");
result.append(CmsResourceTypePlain.getStaticTypeName());
return result.toString();
} } |
public class class_name {
private void populateApplicationWithNumber(Application application, final Map<String, Object> map, String field_prefix) {
// first create the number
ApplicationNumberSummary number = new ApplicationNumberSummary(
readString(map.get(field_prefix + "sid")),
readString(map.get(field_prefix + "friendly_name")),
readString(map.get(field_prefix + "phone_number")),
readString(map.get(field_prefix + "voice_application_sid")),
readString(map.get(field_prefix + "sms_application_sid")),
readString(map.get(field_prefix + "ussd_application_sid")),
readString(map.get(field_prefix + "refer_application_sid"))
);
List<ApplicationNumberSummary> numbers = application.getNumbers();
if (numbers == null) {
numbers = new ArrayList<ApplicationNumberSummary>();
application.setNumbers(numbers);
}
numbers.add(number);
} } | public class class_name {
private void populateApplicationWithNumber(Application application, final Map<String, Object> map, String field_prefix) {
// first create the number
ApplicationNumberSummary number = new ApplicationNumberSummary(
readString(map.get(field_prefix + "sid")),
readString(map.get(field_prefix + "friendly_name")),
readString(map.get(field_prefix + "phone_number")),
readString(map.get(field_prefix + "voice_application_sid")),
readString(map.get(field_prefix + "sms_application_sid")),
readString(map.get(field_prefix + "ussd_application_sid")),
readString(map.get(field_prefix + "refer_application_sid"))
);
List<ApplicationNumberSummary> numbers = application.getNumbers();
if (numbers == null) {
numbers = new ArrayList<ApplicationNumberSummary>(); // depends on control dependency: [if], data = [none]
application.setNumbers(numbers); // depends on control dependency: [if], data = [(numbers]
}
numbers.add(number);
} } |
public class class_name {
public void marshall(DetachTypedLinkRequest detachTypedLinkRequest, ProtocolMarshaller protocolMarshaller) {
if (detachTypedLinkRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detachTypedLinkRequest.getDirectoryArn(), DIRECTORYARN_BINDING);
protocolMarshaller.marshall(detachTypedLinkRequest.getTypedLinkSpecifier(), TYPEDLINKSPECIFIER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DetachTypedLinkRequest detachTypedLinkRequest, ProtocolMarshaller protocolMarshaller) {
if (detachTypedLinkRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detachTypedLinkRequest.getDirectoryArn(), DIRECTORYARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(detachTypedLinkRequest.getTypedLinkSpecifier(), TYPEDLINKSPECIFIER_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public AddOnModel getAddonModel(Identifiable identifiable) {
if (identifiable.getClass().getClassLoader() instanceof IzouPluginClassLoader && !identifiable.getClass().getName().toLowerCase()
.contains(IzouPluginClassLoader.PLUGIN_PACKAGE_PREFIX_IZOU_SDK)) {
return getMain().getAddOnInformationManager().getAddOnForClassLoader(identifiable.getClass().getClassLoader())
.orElse(null);
}
return null;
} } | public class class_name {
public AddOnModel getAddonModel(Identifiable identifiable) {
if (identifiable.getClass().getClassLoader() instanceof IzouPluginClassLoader && !identifiable.getClass().getName().toLowerCase()
.contains(IzouPluginClassLoader.PLUGIN_PACKAGE_PREFIX_IZOU_SDK)) {
return getMain().getAddOnInformationManager().getAddOnForClassLoader(identifiable.getClass().getClassLoader())
.orElse(null); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static boolean findSipApplicationAnnotation(InputStream stream) {
try {
byte[] rawClassBytes;
rawClassBytes = new byte[stream.available()];
stream.read(rawClassBytes);
boolean one = contains(rawClassBytes, SIP_APPLICATION_BYTES);
boolean two = contains(rawClassBytes, ANNOTATION_BYTES);
if(one && two)
return true;
} catch (Exception e) {}
return false;
} } | public class class_name {
public static boolean findSipApplicationAnnotation(InputStream stream) {
try {
byte[] rawClassBytes;
rawClassBytes = new byte[stream.available()]; // depends on control dependency: [try], data = [none]
stream.read(rawClassBytes); // depends on control dependency: [try], data = [none]
boolean one = contains(rawClassBytes, SIP_APPLICATION_BYTES);
boolean two = contains(rawClassBytes, ANNOTATION_BYTES);
if(one && two)
return true;
} catch (Exception e) {} // depends on control dependency: [catch], data = [none]
return false;
} } |
public class class_name {
public void SFFS() throws Exception {
int NumTemplate = Templates.length;
CurSet = new boolean[NumTemplate];
LeftSet = new boolean[NumTemplate];
for (int i = 0; i < NumTemplate; i++) {
CurSet[i] = false;
LeftSet[i] = true;
}
Evaluate(Templates, CurSet);
boolean continueDelete = false;
while (SetSize(CurSet) <= NumTemplate) {
if (!continueDelete) {
Integer theInt = BooleanSet2Integer(CurSet);
int best = BestFeatureByAdding(CurSet, LeftSet);
if (best != -1) {
System.out.println("Add Best " + best);
AlreadyAdded.add(theInt);
CurSet[best] = true;
LeftSet[best] = false;
printAccuracy(CurSet);
}
}
Integer theInt = BooleanSet2Integer(CurSet);
// 被删除过的集合就不再删除了
if (AlreadyRemoved.contains(theInt)) {
continueDelete = false;
continue;
} else {
int worst = WorstFeatureByRemoving(CurSet);
boolean[] TestSet = CurSet.clone();
TestSet[worst] = false;
double accuracy = Evaluate(Templates, TestSet);
if (accuracy >= AccuracyRecords.get(theInt)) {
System.out.println("Remove Worst " + worst);
AlreadyRemoved.add(theInt);
CurSet[worst] = false;
LeftSet[worst] = true;
printAccuracy(CurSet);
if (SetSize(CurSet) == 0) {
continueDelete = false;
} else
continueDelete = true;
} else {
continueDelete = false;
continue;
}
}
}
printAccuracyRecords(AccuracyRecords);
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(
"/home/zliu/corpus/testTemplate/SFFS.ser"));
oos.writeObject(AccuracyRecords);
oos.close();
} } | public class class_name {
public void SFFS() throws Exception {
int NumTemplate = Templates.length;
CurSet = new boolean[NumTemplate];
LeftSet = new boolean[NumTemplate];
for (int i = 0; i < NumTemplate; i++) {
CurSet[i] = false;
LeftSet[i] = true;
}
Evaluate(Templates, CurSet);
boolean continueDelete = false;
while (SetSize(CurSet) <= NumTemplate) {
if (!continueDelete) {
Integer theInt = BooleanSet2Integer(CurSet);
int best = BestFeatureByAdding(CurSet, LeftSet);
if (best != -1) {
System.out.println("Add Best " + best);
AlreadyAdded.add(theInt);
CurSet[best] = true;
LeftSet[best] = false;
printAccuracy(CurSet);
}
}
Integer theInt = BooleanSet2Integer(CurSet);
// 被删除过的集合就不再删除了
if (AlreadyRemoved.contains(theInt)) {
continueDelete = false;
continue;
} else {
int worst = WorstFeatureByRemoving(CurSet);
boolean[] TestSet = CurSet.clone();
TestSet[worst] = false;
double accuracy = Evaluate(Templates, TestSet);
if (accuracy >= AccuracyRecords.get(theInt)) {
System.out.println("Remove Worst " + worst); // depends on control dependency: [if], data = [none]
AlreadyRemoved.add(theInt); // depends on control dependency: [if], data = [none]
CurSet[worst] = false; // depends on control dependency: [if], data = [none]
LeftSet[worst] = true; // depends on control dependency: [if], data = [none]
printAccuracy(CurSet); // depends on control dependency: [if], data = [none]
if (SetSize(CurSet) == 0) {
continueDelete = false; // depends on control dependency: [if], data = [none]
} else
continueDelete = true;
} else {
continueDelete = false; // depends on control dependency: [if], data = [none]
continue;
}
}
}
printAccuracyRecords(AccuracyRecords);
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(
"/home/zliu/corpus/testTemplate/SFFS.ser"));
oos.writeObject(AccuracyRecords);
oos.close();
} } |
public class class_name {
public List<Query> shard(List<KeyOffset> sampledRowKeys) {
Preconditions.checkState(builder.getRowsLimit() == 0, "Can't shard query with row limits");
ImmutableSortedSet.Builder<ByteString> splitPoints =
ImmutableSortedSet.orderedBy(ByteStringComparator.INSTANCE);
for (KeyOffset keyOffset : sampledRowKeys) {
if (!keyOffset.getKey().isEmpty()) {
splitPoints.add(keyOffset.getKey());
}
}
return shard(splitPoints.build());
} } | public class class_name {
public List<Query> shard(List<KeyOffset> sampledRowKeys) {
Preconditions.checkState(builder.getRowsLimit() == 0, "Can't shard query with row limits");
ImmutableSortedSet.Builder<ByteString> splitPoints =
ImmutableSortedSet.orderedBy(ByteStringComparator.INSTANCE);
for (KeyOffset keyOffset : sampledRowKeys) {
if (!keyOffset.getKey().isEmpty()) {
splitPoints.add(keyOffset.getKey()); // depends on control dependency: [if], data = [none]
}
}
return shard(splitPoints.build());
} } |
public class class_name {
public WmfDumpFileManager getWmfDumpFileManager() {
try {
return new WmfDumpFileManager(this.projectName,
this.downloadDirectoryManager, this.webResourceFetcher);
} catch (IOException e) {
logger.error("Could not create dump file manager: " + e.toString());
return null;
}
} } | public class class_name {
public WmfDumpFileManager getWmfDumpFileManager() {
try {
return new WmfDumpFileManager(this.projectName,
this.downloadDirectoryManager, this.webResourceFetcher); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("Could not create dump file manager: " + e.toString());
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static DataUri parse(String uri) {
//Syntax: data:[<media type>][;charset=<character set>][;base64],<data>
String scheme = "data:";
if (uri.length() < scheme.length() || !uri.substring(0, scheme.length()).equalsIgnoreCase(scheme)) {
//not a data URI
throw Messages.INSTANCE.getIllegalArgumentException(22);
}
String contentType = null;
String charset = null;
boolean base64 = false;
String dataStr = null;
int tokenStart = scheme.length();
for (int i = scheme.length(); i < uri.length(); i++) {
char c = uri.charAt(i);
if (c == ';') {
String token = uri.substring(tokenStart, i);
if (contentType == null) {
contentType = token.toLowerCase();
} else {
String cs = StringUtils.afterPrefixIgnoreCase(token, "charset=");
if (cs != null) {
charset = cs;
} else if ("base64".equalsIgnoreCase(token)) {
base64 = true;
}
}
tokenStart = i + 1;
continue;
}
if (c == ',') {
String token = uri.substring(tokenStart, i);
if (contentType == null) {
contentType = token.toLowerCase();
} else {
String cs = StringUtils.afterPrefixIgnoreCase(token, "charset=");
if (cs != null) {
charset = cs;
} else if ("base64".equalsIgnoreCase(token)) {
base64 = true;
}
}
dataStr = uri.substring(i + 1);
break;
}
}
if (dataStr == null) {
throw Messages.INSTANCE.getIllegalArgumentException(23);
}
String text = null;
byte[] data = null;
if (base64) {
dataStr = dataStr.replaceAll("\\s", "");
data = Base64.decodeBase64(dataStr);
if (charset != null) {
try {
text = new String(data, charset);
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(Messages.INSTANCE.getExceptionMessage(24, charset), e);
}
data = null;
}
} else {
text = dataStr;
}
return new DataUri(contentType, data, text);
} } | public class class_name {
public static DataUri parse(String uri) {
//Syntax: data:[<media type>][;charset=<character set>][;base64],<data>
String scheme = "data:";
if (uri.length() < scheme.length() || !uri.substring(0, scheme.length()).equalsIgnoreCase(scheme)) {
//not a data URI
throw Messages.INSTANCE.getIllegalArgumentException(22);
}
String contentType = null;
String charset = null;
boolean base64 = false;
String dataStr = null;
int tokenStart = scheme.length();
for (int i = scheme.length(); i < uri.length(); i++) {
char c = uri.charAt(i);
if (c == ';') {
String token = uri.substring(tokenStart, i);
if (contentType == null) {
contentType = token.toLowerCase(); // depends on control dependency: [if], data = [none]
} else {
String cs = StringUtils.afterPrefixIgnoreCase(token, "charset=");
if (cs != null) {
charset = cs; // depends on control dependency: [if], data = [none]
} else if ("base64".equalsIgnoreCase(token)) {
base64 = true; // depends on control dependency: [if], data = [none]
}
}
tokenStart = i + 1; // depends on control dependency: [if], data = [none]
continue;
}
if (c == ',') {
String token = uri.substring(tokenStart, i);
if (contentType == null) {
contentType = token.toLowerCase(); // depends on control dependency: [if], data = [none]
} else {
String cs = StringUtils.afterPrefixIgnoreCase(token, "charset=");
if (cs != null) {
charset = cs; // depends on control dependency: [if], data = [none]
} else if ("base64".equalsIgnoreCase(token)) {
base64 = true; // depends on control dependency: [if], data = [none]
}
}
dataStr = uri.substring(i + 1); // depends on control dependency: [if], data = [none]
break;
}
}
if (dataStr == null) {
throw Messages.INSTANCE.getIllegalArgumentException(23);
}
String text = null;
byte[] data = null;
if (base64) {
dataStr = dataStr.replaceAll("\\s", ""); // depends on control dependency: [if], data = [none]
data = Base64.decodeBase64(dataStr); // depends on control dependency: [if], data = [none]
if (charset != null) {
try {
text = new String(data, charset); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new IllegalArgumentException(Messages.INSTANCE.getExceptionMessage(24, charset), e);
} // depends on control dependency: [catch], data = [none]
data = null; // depends on control dependency: [if], data = [none]
}
} else {
text = dataStr; // depends on control dependency: [if], data = [none]
}
return new DataUri(contentType, data, text);
} } |
public class class_name {
public void onActivityResult(
@NonNull Activity activity,
int requestCode,
int resultCode,
@Nullable Intent data) {
if (requestCode != this.requestCode) {
return;
}
if (resultCode == Activity.RESULT_OK) {
handleResultOk(data);
} else if (resultCode == Activity.RESULT_CANCELED) {
handleResultCancelled(activity, data);
}
} } | public class class_name {
public void onActivityResult(
@NonNull Activity activity,
int requestCode,
int resultCode,
@Nullable Intent data) {
if (requestCode != this.requestCode) {
return; // depends on control dependency: [if], data = [none]
}
if (resultCode == Activity.RESULT_OK) {
handleResultOk(data); // depends on control dependency: [if], data = [none]
} else if (resultCode == Activity.RESULT_CANCELED) {
handleResultCancelled(activity, data); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static <T> T call(ContextFactory factory, ContextAction<T> action) {
Context cx = enter(null, factory);
try {
return action.run(cx);
}
finally {
exit();
}
} } | public class class_name {
static <T> T call(ContextFactory factory, ContextAction<T> action) {
Context cx = enter(null, factory);
try {
return action.run(cx); // depends on control dependency: [try], data = [none]
}
finally {
exit();
}
} } |
public class class_name {
public void marshall(MediaPackageOutputSettings mediaPackageOutputSettings, ProtocolMarshaller protocolMarshaller) {
if (mediaPackageOutputSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(MediaPackageOutputSettings mediaPackageOutputSettings, ProtocolMarshaller protocolMarshaller) {
if (mediaPackageOutputSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <T extends IItem & IExpandable> void selectAllSubItems(final FastAdapter adapter, T header, boolean select, boolean notifyParent, Object payload) {
int subItems = header.getSubItems().size();
int position = adapter.getPosition(header);
if (header.isExpanded()) {
for (int i = 0; i < subItems; i++) {
if (((IItem) header.getSubItems().get(i)).isSelectable()) {
SelectExtension extension = (SelectExtension) adapter.getExtension(SelectExtension.class);
if (extension != null) {
if (select) {
extension.select(position + i + 1);
} else {
extension.deselect(position + i + 1);
}
}
}
if (header.getSubItems().get(i) instanceof IExpandable)
selectAllSubItems(adapter, header, select, notifyParent, payload);
}
} else {
for (int i = 0; i < subItems; i++) {
if (((IItem) header.getSubItems().get(i)).isSelectable()) {
((IItem) header.getSubItems().get(i)).withSetSelected(select);
}
if (header.getSubItems().get(i) instanceof IExpandable)
selectAllSubItems(adapter, header, select, notifyParent, payload);
}
}
// we must notify the view only!
if (notifyParent && position >= 0) {
adapter.notifyItemChanged(position, payload);
}
} } | public class class_name {
public static <T extends IItem & IExpandable> void selectAllSubItems(final FastAdapter adapter, T header, boolean select, boolean notifyParent, Object payload) {
int subItems = header.getSubItems().size();
int position = adapter.getPosition(header);
if (header.isExpanded()) {
for (int i = 0; i < subItems; i++) {
if (((IItem) header.getSubItems().get(i)).isSelectable()) {
SelectExtension extension = (SelectExtension) adapter.getExtension(SelectExtension.class);
if (extension != null) {
if (select) {
extension.select(position + i + 1); // depends on control dependency: [if], data = [none]
} else {
extension.deselect(position + i + 1); // depends on control dependency: [if], data = [none]
}
}
}
if (header.getSubItems().get(i) instanceof IExpandable)
selectAllSubItems(adapter, header, select, notifyParent, payload);
}
} else {
for (int i = 0; i < subItems; i++) {
if (((IItem) header.getSubItems().get(i)).isSelectable()) {
((IItem) header.getSubItems().get(i)).withSetSelected(select); // depends on control dependency: [if], data = [none]
}
if (header.getSubItems().get(i) instanceof IExpandable)
selectAllSubItems(adapter, header, select, notifyParent, payload);
}
}
// we must notify the view only!
if (notifyParent && position >= 0) {
adapter.notifyItemChanged(position, payload); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override public void addFieldListener(FieldListener listener)
{
if (m_listeners == null)
{
m_listeners = new LinkedList<FieldListener>();
}
m_listeners.add(listener);
} } | public class class_name {
@Override public void addFieldListener(FieldListener listener)
{
if (m_listeners == null)
{
m_listeners = new LinkedList<FieldListener>(); // depends on control dependency: [if], data = [none]
}
m_listeners.add(listener);
} } |
public class class_name {
public Long durationOfCompletedBuildInSeconds() {
Date buildingDate = getStartedDateFor(JobState.Building);
Date completedDate = getCompletedDate();
if (buildingDate == null || completedDate == null) {
return 0L;
}
Long elapsed = completedDate.getTime() - buildingDate.getTime();
int elapsedSeconds = Math.round(elapsed / 1000);
return Long.valueOf(elapsedSeconds);
} } | public class class_name {
public Long durationOfCompletedBuildInSeconds() {
Date buildingDate = getStartedDateFor(JobState.Building);
Date completedDate = getCompletedDate();
if (buildingDate == null || completedDate == null) {
return 0L; // depends on control dependency: [if], data = [none]
}
Long elapsed = completedDate.getTime() - buildingDate.getTime();
int elapsedSeconds = Math.round(elapsed / 1000);
return Long.valueOf(elapsedSeconds);
} } |
public class class_name {
@Override
public EClass getIfcUnitaryControlElement() {
if (ifcUnitaryControlElementEClass == null) {
ifcUnitaryControlElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(743);
}
return ifcUnitaryControlElementEClass;
} } | public class class_name {
@Override
public EClass getIfcUnitaryControlElement() {
if (ifcUnitaryControlElementEClass == null) {
ifcUnitaryControlElementEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(743);
// depends on control dependency: [if], data = [none]
}
return ifcUnitaryControlElementEClass;
} } |
public class class_name {
private OtherDirectCosts getOtherDirectCosts(BudgetPeriodDto periodInfo) {
OtherDirectCosts otherDirectCosts = OtherDirectCosts.Factory
.newInstance();
if (periodInfo != null && periodInfo.getOtherDirectCosts().size() > 0) {
if (periodInfo.getOtherDirectCosts().get(0).getpublications() != null) {
otherDirectCosts.setPublicationCosts(periodInfo
.getOtherDirectCosts().get(0).getpublications()
.bigDecimalValue());
}
if (periodInfo.getOtherDirectCosts().get(0).getmaterials() != null) {
otherDirectCosts.setMaterialsSupplies(periodInfo
.getOtherDirectCosts().get(0).getmaterials()
.bigDecimalValue());
}
if (periodInfo.getOtherDirectCosts().get(0).getConsultants() != null) {
otherDirectCosts.setConsultantServices(periodInfo
.getOtherDirectCosts().get(0).getConsultants()
.bigDecimalValue());
}
if (periodInfo.getOtherDirectCosts().get(0).getcomputer() != null) {
otherDirectCosts.setADPComputerServices(periodInfo
.getOtherDirectCosts().get(0).getcomputer()
.bigDecimalValue());
}
if (periodInfo.getOtherDirectCosts().get(0).getsubAwards() != null) {
otherDirectCosts
.setSubawardConsortiumContractualCosts(periodInfo
.getOtherDirectCosts().get(0).getsubAwards()
.bigDecimalValue());
}
if (periodInfo.getOtherDirectCosts().get(0).getAlterations() != null) {
otherDirectCosts.setAlterationsRenovations(periodInfo
.getOtherDirectCosts().get(0).getAlterations()
.bigDecimalValue());
}
if (periodInfo.getOtherDirectCosts().get(0).getEquipRental() != null) {
otherDirectCosts.setEquipmentRentalFee(periodInfo
.getOtherDirectCosts().get(0).getEquipRental()
.bigDecimalValue());
}
otherDirectCosts
.setOthers(getOthersForOtherDirectCosts(periodInfo));
if (periodInfo.getOtherDirectCosts().get(0).gettotalOtherDirect() != null) {
otherDirectCosts.setTotalOtherDirectCost(periodInfo
.getOtherDirectCosts().get(0).gettotalOtherDirect()
.bigDecimalValue());
}
}
return otherDirectCosts;
} } | public class class_name {
private OtherDirectCosts getOtherDirectCosts(BudgetPeriodDto periodInfo) {
OtherDirectCosts otherDirectCosts = OtherDirectCosts.Factory
.newInstance();
if (periodInfo != null && periodInfo.getOtherDirectCosts().size() > 0) {
if (periodInfo.getOtherDirectCosts().get(0).getpublications() != null) {
otherDirectCosts.setPublicationCosts(periodInfo
.getOtherDirectCosts().get(0).getpublications()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
if (periodInfo.getOtherDirectCosts().get(0).getmaterials() != null) {
otherDirectCosts.setMaterialsSupplies(periodInfo
.getOtherDirectCosts().get(0).getmaterials()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
if (periodInfo.getOtherDirectCosts().get(0).getConsultants() != null) {
otherDirectCosts.setConsultantServices(periodInfo
.getOtherDirectCosts().get(0).getConsultants()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
if (periodInfo.getOtherDirectCosts().get(0).getcomputer() != null) {
otherDirectCosts.setADPComputerServices(periodInfo
.getOtherDirectCosts().get(0).getcomputer()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
if (periodInfo.getOtherDirectCosts().get(0).getsubAwards() != null) {
otherDirectCosts
.setSubawardConsortiumContractualCosts(periodInfo
.getOtherDirectCosts().get(0).getsubAwards()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
if (periodInfo.getOtherDirectCosts().get(0).getAlterations() != null) {
otherDirectCosts.setAlterationsRenovations(periodInfo
.getOtherDirectCosts().get(0).getAlterations()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
if (periodInfo.getOtherDirectCosts().get(0).getEquipRental() != null) {
otherDirectCosts.setEquipmentRentalFee(periodInfo
.getOtherDirectCosts().get(0).getEquipRental()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
otherDirectCosts
.setOthers(getOthersForOtherDirectCosts(periodInfo)); // depends on control dependency: [if], data = [none]
if (periodInfo.getOtherDirectCosts().get(0).gettotalOtherDirect() != null) {
otherDirectCosts.setTotalOtherDirectCost(periodInfo
.getOtherDirectCosts().get(0).gettotalOtherDirect()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
}
return otherDirectCosts;
} } |
public class class_name {
private void computePeriod(InfoTree it1, int aVp, int aNextVp, InfoTree it2, int aStrategy) {
int fTreeSize = it1.getSize();
int gTreeSize = it2.getSize();
int vpPreorder = it1.info[POST2_PRE][aVp];
int vpRevPreorder = fTreeSize - 1 - aVp;
int vpSize = it1.info[POST2_SIZE][aVp];
int gSize = it2.info[POST2_SIZE][it2.getCurrentNode()];
int gPreorder = it2.info[POST2_PRE][it2.getCurrentNode()];
int gRevPreorder = gTreeSize - 1 - it2.getCurrentNode();
int nextVpPreorder = -1;
int nextVpRevPreorder = -1;
int nextVpSize = -1;
// count k and assign next vp values
int k;
if (aNextVp != -1) {
nextVpPreorder = it1.info[POST2_PRE][aNextVp];
nextVpRevPreorder = fTreeSize - 1 - aNextVp;
nextVpSize = it1.info[POST2_SIZE][aNextVp];
// if strategy==LEFT use preorder to count number of left deletions from vp to
// vp-1
// if strategy==RIGHT use reversed preorder
k = aStrategy == LEFT ? nextVpPreorder - vpPreorder
: nextVpRevPreorder - vpRevPreorder;
if (aStrategy != previousStrategy) {
computeIJTable(it2, gPreorder, gRevPreorder, gSize, aStrategy, gTreeSize);
}
} else {
k = 1;
computeIJTable(it2, gPreorder, gRevPreorder, gSize, aStrategy, gTreeSize);
}
int realStrategy = it1.info[POST2_STRATEGY][aVp];
boolean switched = it1.isSwitched();
double[][] tTable_copy = t.clone();
// Q and T are visible for every i
double[] qTable = new double[k];
// if aVp is a leaf => precompute table T - edit distance betwen EMPTY and all
// subforests of G
// check if nextVp is the only child of vp
if (vpSize - nextVpSize == 1) {
// update delta from T table => dist between Fvp-1 and G was computed in
// previous compute period
if (gSize == 1) {
setDeltaValue(it1.info[PRE2_POST][vpPreorder], it2.info[PRE2_POST][gPreorder],
vpSize - 1, switched);
} else {
setDeltaValue(it1.info[PRE2_POST][vpPreorder], it2.info[PRE2_POST][gPreorder],
t[1][0], switched);
}
}
double[][] sTable;// = new double[k][gTreeSize+1];
int gijForestPreorder;
int previousI;
int fForestPreorderKPrime;
int jPrime;
int kBis;
int jOfIminus1;
int gijOfIMinus1Preorder;
int jOfI;
double deleteFromLeft;
double deleteFromRight;
double match;
int fLabel;
int gLabel;
// Q and T are visible for every i
for (int i = gSize - 1; i >= 0; i--) {
// jOfI was already computed once in spfH
jOfI = jOfI(it2, i, gSize, gRevPreorder, gPreorder, aStrategy, gTreeSize);
// when strategy==BOTH first LEFT then RIGHT is done
counter += realStrategy == BOTH && aStrategy == LEFT ? (k - 1) * (jOfI + 1)
: k * (jOfI + 1);
// compute table S - visible for actual i
sTable = new double[k][jOfI + 1]; // initialized outside loop? -> doesn't work
for (int kPrime = 1; kPrime <= k; kPrime++) {
fForestPreorderKPrime = aStrategy == LEFT ? vpPreorder + (k - kPrime)
: it1.info[POST2_PRE][fTreeSize - 1 - (vpRevPreorder + (k - kPrime))];
kBis = kPrime - it1.info[POST2_SIZE][it1.info[PRE2_POST][fForestPreorderKPrime]];
// reset the minimum arguments' values
deleteFromRight = costIns;
deleteFromLeft = costDel;
match = 0;
match += aStrategy == LEFT ? kBis + nextVpSize : vpSize - k + kBis;
if ((i + jOfI) == (gSize - 1)) {
deleteFromRight += (vpSize - (k - kPrime));
} else {
deleteFromRight += qTable[kPrime - 1];
}
fLabel = it1.info[POST2_LABEL][it1.info[PRE2_POST][fForestPreorderKPrime]];
for (int j = jOfI; j >= 0; j--) {
// count dist(FkPrime, Gij) with min
// delete from left
gijForestPreorder = aStrategy == LEFT ? IJ[i][j]
: it2.info[POST2_PRE][gTreeSize - 1 - IJ[i][j]];
if (kPrime == 1) {
// if the direction changed from the previous period to this one use i and j
// of
// previous strategy
// since T is overwritten continously, thus use T_copy for getting values
// from
// previous period
if (aStrategy != previousStrategy) {
if (aStrategy == LEFT) {
previousI = gijForestPreorder - gPreorder; // minus preorder of G
} else {
previousI = gTreeSize - 1
- it2.info[RPOST2_POST][gTreeSize - 1 - gijForestPreorder]
- gRevPreorder; // minus rev preorder of G
}
deleteFromLeft += tTable_copy[previousI][i + j - previousI];
} else {
deleteFromLeft += tTable_copy[i][j];
}
} else {
deleteFromLeft += sTable[kPrime - 1 - 1][j];
}
// match
match += switched
?
delta[it2.info[PRE2_POST][gijForestPreorder]][it1.info[PRE2_POST][fForestPreorderKPrime]]
:
delta[it1.info[PRE2_POST][fForestPreorderKPrime]][it2.info[PRE2_POST][gijForestPreorder]];
jPrime = j + it2.info[POST2_SIZE][it2.info[PRE2_POST][gijForestPreorder]];
// if root nodes of L/R Fk' and L/R Gij have different labels add the match cost
gLabel = it2.info[POST2_LABEL][it2.info[PRE2_POST][gijForestPreorder]];
if (fLabel != gLabel) {
match += costMatch;
}
// this condition is checked many times but is not satisfied only once
if (j != jOfI) {
// delete from right
deleteFromRight += sTable[kPrime - 1][j + 1];
if (kBis == 0) {
if (aStrategy != previousStrategy) {
previousI = aStrategy == LEFT ? IJ[i][jPrime] - gPreorder
: IJ[i][jPrime] - gRevPreorder;
match += tTable_copy[previousI][i + jPrime - previousI];
} else {
match += tTable_copy[i][jPrime];
}
} else if (kBis > 0) {
match += sTable[kBis - 1][jPrime];
} else {
match += gSize - (i + jPrime);
}
}
// fill S table
sTable[kPrime - 1][j] = (deleteFromLeft < deleteFromRight)
? ((deleteFromLeft < match) ? deleteFromLeft : match)
: ((deleteFromRight < match) ? deleteFromRight : match);
// reset the minimum arguments' values
deleteFromRight = costIns;
deleteFromLeft = costDel;
match = 0;
}
}
// compute table T => add row to T
if (realStrategy == BOTH && aStrategy == LEFT) {
t[i] = sTable[k - 1 - 1];
} else {
t[i] = sTable[k - 1];
}
if (i > 0) {
// compute table Q
jOfIminus1 =
jOfI(it2, i - 1, gSize, gRevPreorder, gPreorder, aStrategy, gTreeSize);
if (jOfIminus1 <= jOfI) {
for (int x = 0;
x < qTable.length; x++) { // copy whole column | qTable.length=k
qTable[x] = sTable[x][jOfIminus1];
}
}
// fill table delta
if (i + jOfIminus1 < gSize) {
gijOfIMinus1Preorder = aStrategy == LEFT
? it2.info[POST2_PRE][gTreeSize - 1 - (gRevPreorder + (i - 1))]
: gPreorder + (i - 1);
// If Fk from Fk-1 differ with a single node,
// then Fk without the root node is Fk-1 and the distance value has to be taken
// from previous T table.
if (k - 1 - 1 < 0) {
if (aStrategy != previousStrategy) {
previousI = aStrategy == LEFT ? IJ[i][jOfIminus1] - gPreorder
: IJ[i][jOfIminus1] - gRevPreorder;
setDeltaValue(it1.info[PRE2_POST][vpPreorder],
it2.info[PRE2_POST][gijOfIMinus1Preorder],
tTable_copy[previousI][i + jOfIminus1 - previousI], switched);
} else {
setDeltaValue(it1.info[PRE2_POST][vpPreorder],
it2.info[PRE2_POST][gijOfIMinus1Preorder],
tTable_copy[i][jOfIminus1], switched);
}
} else {
setDeltaValue(it1.info[PRE2_POST][vpPreorder],
it2.info[PRE2_POST][gijOfIMinus1Preorder],
sTable[k - 1 - 1][jOfIminus1], switched);
}
}
}
}
previousStrategy = aStrategy;
} } | public class class_name {
private void computePeriod(InfoTree it1, int aVp, int aNextVp, InfoTree it2, int aStrategy) {
int fTreeSize = it1.getSize();
int gTreeSize = it2.getSize();
int vpPreorder = it1.info[POST2_PRE][aVp];
int vpRevPreorder = fTreeSize - 1 - aVp;
int vpSize = it1.info[POST2_SIZE][aVp];
int gSize = it2.info[POST2_SIZE][it2.getCurrentNode()];
int gPreorder = it2.info[POST2_PRE][it2.getCurrentNode()];
int gRevPreorder = gTreeSize - 1 - it2.getCurrentNode();
int nextVpPreorder = -1;
int nextVpRevPreorder = -1;
int nextVpSize = -1;
// count k and assign next vp values
int k;
if (aNextVp != -1) {
nextVpPreorder = it1.info[POST2_PRE][aNextVp]; // depends on control dependency: [if], data = [none]
nextVpRevPreorder = fTreeSize - 1 - aNextVp; // depends on control dependency: [if], data = [none]
nextVpSize = it1.info[POST2_SIZE][aNextVp]; // depends on control dependency: [if], data = [none]
// if strategy==LEFT use preorder to count number of left deletions from vp to
// vp-1
// if strategy==RIGHT use reversed preorder
k = aStrategy == LEFT ? nextVpPreorder - vpPreorder
: nextVpRevPreorder - vpRevPreorder; // depends on control dependency: [if], data = [none]
if (aStrategy != previousStrategy) {
computeIJTable(it2, gPreorder, gRevPreorder, gSize, aStrategy, gTreeSize); // depends on control dependency: [if], data = [none]
}
} else {
k = 1; // depends on control dependency: [if], data = [none]
computeIJTable(it2, gPreorder, gRevPreorder, gSize, aStrategy, gTreeSize); // depends on control dependency: [if], data = [none]
}
int realStrategy = it1.info[POST2_STRATEGY][aVp];
boolean switched = it1.isSwitched();
double[][] tTable_copy = t.clone();
// Q and T are visible for every i
double[] qTable = new double[k];
// if aVp is a leaf => precompute table T - edit distance betwen EMPTY and all
// subforests of G
// check if nextVp is the only child of vp
if (vpSize - nextVpSize == 1) {
// update delta from T table => dist between Fvp-1 and G was computed in
// previous compute period
if (gSize == 1) {
setDeltaValue(it1.info[PRE2_POST][vpPreorder], it2.info[PRE2_POST][gPreorder],
vpSize - 1, switched); // depends on control dependency: [if], data = [none]
} else {
setDeltaValue(it1.info[PRE2_POST][vpPreorder], it2.info[PRE2_POST][gPreorder],
t[1][0], switched); // depends on control dependency: [if], data = [none]
}
}
double[][] sTable;// = new double[k][gTreeSize+1];
int gijForestPreorder;
int previousI;
int fForestPreorderKPrime;
int jPrime;
int kBis;
int jOfIminus1;
int gijOfIMinus1Preorder;
int jOfI;
double deleteFromLeft;
double deleteFromRight;
double match;
int fLabel;
int gLabel;
// Q and T are visible for every i
for (int i = gSize - 1; i >= 0; i--) {
// jOfI was already computed once in spfH
jOfI = jOfI(it2, i, gSize, gRevPreorder, gPreorder, aStrategy, gTreeSize); // depends on control dependency: [for], data = [i]
// when strategy==BOTH first LEFT then RIGHT is done
counter += realStrategy == BOTH && aStrategy == LEFT ? (k - 1) * (jOfI + 1)
: k * (jOfI + 1); // depends on control dependency: [for], data = [none]
// compute table S - visible for actual i
sTable = new double[k][jOfI + 1]; // initialized outside loop? -> doesn't work // depends on control dependency: [for], data = [none]
for (int kPrime = 1; kPrime <= k; kPrime++) {
fForestPreorderKPrime = aStrategy == LEFT ? vpPreorder + (k - kPrime)
: it1.info[POST2_PRE][fTreeSize - 1 - (vpRevPreorder + (k - kPrime))]; // depends on control dependency: [for], data = [kPrime]
kBis = kPrime - it1.info[POST2_SIZE][it1.info[PRE2_POST][fForestPreorderKPrime]]; // depends on control dependency: [for], data = [kPrime]
// reset the minimum arguments' values
deleteFromRight = costIns; // depends on control dependency: [for], data = [none]
deleteFromLeft = costDel; // depends on control dependency: [for], data = [none]
match = 0; // depends on control dependency: [for], data = [none]
match += aStrategy == LEFT ? kBis + nextVpSize : vpSize - k + kBis; // depends on control dependency: [for], data = [none]
if ((i + jOfI) == (gSize - 1)) {
deleteFromRight += (vpSize - (k - kPrime)); // depends on control dependency: [if], data = [none]
} else {
deleteFromRight += qTable[kPrime - 1]; // depends on control dependency: [if], data = [none]
}
fLabel = it1.info[POST2_LABEL][it1.info[PRE2_POST][fForestPreorderKPrime]]; // depends on control dependency: [for], data = [none]
for (int j = jOfI; j >= 0; j--) {
// count dist(FkPrime, Gij) with min
// delete from left
gijForestPreorder = aStrategy == LEFT ? IJ[i][j]
: it2.info[POST2_PRE][gTreeSize - 1 - IJ[i][j]]; // depends on control dependency: [for], data = [j]
if (kPrime == 1) {
// if the direction changed from the previous period to this one use i and j
// of
// previous strategy
// since T is overwritten continously, thus use T_copy for getting values
// from
// previous period
if (aStrategy != previousStrategy) {
if (aStrategy == LEFT) {
previousI = gijForestPreorder - gPreorder; // minus preorder of G // depends on control dependency: [if], data = [none]
} else {
previousI = gTreeSize - 1
- it2.info[RPOST2_POST][gTreeSize - 1 - gijForestPreorder]
- gRevPreorder; // minus rev preorder of G // depends on control dependency: [if], data = [none]
}
deleteFromLeft += tTable_copy[previousI][i + j - previousI]; // depends on control dependency: [if], data = [none]
} else {
deleteFromLeft += tTable_copy[i][j]; // depends on control dependency: [if], data = [none]
}
} else {
deleteFromLeft += sTable[kPrime - 1 - 1][j]; // depends on control dependency: [if], data = [none]
}
// match
match += switched
?
delta[it2.info[PRE2_POST][gijForestPreorder]][it1.info[PRE2_POST][fForestPreorderKPrime]]
:
delta[it1.info[PRE2_POST][fForestPreorderKPrime]][it2.info[PRE2_POST][gijForestPreorder]]; // depends on control dependency: [for], data = [none]
jPrime = j + it2.info[POST2_SIZE][it2.info[PRE2_POST][gijForestPreorder]]; // depends on control dependency: [for], data = [j]
// if root nodes of L/R Fk' and L/R Gij have different labels add the match cost
gLabel = it2.info[POST2_LABEL][it2.info[PRE2_POST][gijForestPreorder]]; // depends on control dependency: [for], data = [none]
if (fLabel != gLabel) {
match += costMatch; // depends on control dependency: [if], data = [none]
}
// this condition is checked many times but is not satisfied only once
if (j != jOfI) {
// delete from right
deleteFromRight += sTable[kPrime - 1][j + 1]; // depends on control dependency: [if], data = [none]
if (kBis == 0) {
if (aStrategy != previousStrategy) {
previousI = aStrategy == LEFT ? IJ[i][jPrime] - gPreorder
: IJ[i][jPrime] - gRevPreorder; // depends on control dependency: [if], data = [none]
match += tTable_copy[previousI][i + jPrime - previousI]; // depends on control dependency: [if], data = [none]
} else {
match += tTable_copy[i][jPrime]; // depends on control dependency: [if], data = [none]
}
} else if (kBis > 0) {
match += sTable[kBis - 1][jPrime]; // depends on control dependency: [if], data = [none]
} else {
match += gSize - (i + jPrime); // depends on control dependency: [if], data = [none]
}
}
// fill S table
sTable[kPrime - 1][j] = (deleteFromLeft < deleteFromRight)
? ((deleteFromLeft < match) ? deleteFromLeft : match)
: ((deleteFromRight < match) ? deleteFromRight : match); // depends on control dependency: [for], data = [j]
// reset the minimum arguments' values
deleteFromRight = costIns; // depends on control dependency: [for], data = [none]
deleteFromLeft = costDel; // depends on control dependency: [for], data = [none]
match = 0; // depends on control dependency: [for], data = [none]
}
}
// compute table T => add row to T
if (realStrategy == BOTH && aStrategy == LEFT) {
t[i] = sTable[k - 1 - 1]; // depends on control dependency: [if], data = [none]
} else {
t[i] = sTable[k - 1]; // depends on control dependency: [if], data = [none]
}
if (i > 0) {
// compute table Q
jOfIminus1 =
jOfI(it2, i - 1, gSize, gRevPreorder, gPreorder, aStrategy, gTreeSize); // depends on control dependency: [if], data = [none]
if (jOfIminus1 <= jOfI) {
for (int x = 0;
x < qTable.length; x++) { // copy whole column | qTable.length=k
qTable[x] = sTable[x][jOfIminus1]; // depends on control dependency: [for], data = [x]
}
}
// fill table delta
if (i + jOfIminus1 < gSize) {
gijOfIMinus1Preorder = aStrategy == LEFT
? it2.info[POST2_PRE][gTreeSize - 1 - (gRevPreorder + (i - 1))]
: gPreorder + (i - 1); // depends on control dependency: [if], data = [none]
// If Fk from Fk-1 differ with a single node,
// then Fk without the root node is Fk-1 and the distance value has to be taken
// from previous T table.
if (k - 1 - 1 < 0) {
if (aStrategy != previousStrategy) {
previousI = aStrategy == LEFT ? IJ[i][jOfIminus1] - gPreorder
: IJ[i][jOfIminus1] - gRevPreorder; // depends on control dependency: [if], data = [none]
setDeltaValue(it1.info[PRE2_POST][vpPreorder],
it2.info[PRE2_POST][gijOfIMinus1Preorder],
tTable_copy[previousI][i + jOfIminus1 - previousI], switched); // depends on control dependency: [if], data = [none]
} else {
setDeltaValue(it1.info[PRE2_POST][vpPreorder],
it2.info[PRE2_POST][gijOfIMinus1Preorder],
tTable_copy[i][jOfIminus1], switched); // depends on control dependency: [if], data = [none]
}
} else {
setDeltaValue(it1.info[PRE2_POST][vpPreorder],
it2.info[PRE2_POST][gijOfIMinus1Preorder],
sTable[k - 1 - 1][jOfIminus1], switched); // depends on control dependency: [if], data = [none]
}
}
}
}
previousStrategy = aStrategy;
} } |
public class class_name {
public boolean gotPong (PongResponse pong)
{
if (_ping == null) {
// an errant pong that is likely being processed late after
// a new connection was opened.
return false;
}
// don't freak out if they keep calling gotPong() after we're done
if (_iter >= _deltas.length) {
return true;
}
// make a note of when the ping message was sent and when the pong
// response was received (both in client time)
long send = _ping.getPackStamp(), recv = pong.getUnpackStamp();
_ping = null; // clear out the saved sent ping
// make a note of when the pong response was sent (in server time)
// and the processing delay incurred on the server
long server = pong.getPackStamp(), delay = pong.getProcessDelay();
// compute the network delay (round-trip time divided by two)
long nettime = (recv - send - delay)/2;
// the time delta is the client time when the pong was received
// minus the server's send time (plus network delay): dT = C - S
_deltas[_iter] = recv - (server + nettime);
log.debug("Calculated delta", "delay", delay, "nettime", nettime, "delta", _deltas[_iter],
"rtt", (recv-send));
return (++_iter >= CLOCK_SYNC_PING_COUNT);
} } | public class class_name {
public boolean gotPong (PongResponse pong)
{
if (_ping == null) {
// an errant pong that is likely being processed late after
// a new connection was opened.
return false; // depends on control dependency: [if], data = [none]
}
// don't freak out if they keep calling gotPong() after we're done
if (_iter >= _deltas.length) {
return true; // depends on control dependency: [if], data = [none]
}
// make a note of when the ping message was sent and when the pong
// response was received (both in client time)
long send = _ping.getPackStamp(), recv = pong.getUnpackStamp();
_ping = null; // clear out the saved sent ping
// make a note of when the pong response was sent (in server time)
// and the processing delay incurred on the server
long server = pong.getPackStamp(), delay = pong.getProcessDelay();
// compute the network delay (round-trip time divided by two)
long nettime = (recv - send - delay)/2;
// the time delta is the client time when the pong was received
// minus the server's send time (plus network delay): dT = C - S
_deltas[_iter] = recv - (server + nettime);
log.debug("Calculated delta", "delay", delay, "nettime", nettime, "delta", _deltas[_iter],
"rtt", (recv-send));
return (++_iter >= CLOCK_SYNC_PING_COUNT);
} } |
public class class_name {
public BlockInfo[] getParityBlocks(BlockInfo[] blocks) {
int numBlocks = (blocks.length / numStripeBlocks) * numParityBlocks
+ ((blocks.length % numStripeBlocks == 0) ? 0 : numParityBlocks);
BlockInfo[] parityBlocks = new BlockInfo[numBlocks];
int pos = 0;
int parityEnd = numParityBlocks;
for (int i = 0; i < numBlocks; i++) {
parityBlocks[i] = blocks[pos];
pos++;
if (pos == parityEnd) {
pos += numDataBlocks;
parityEnd += numStripeBlocks;
}
}
return parityBlocks;
} } | public class class_name {
public BlockInfo[] getParityBlocks(BlockInfo[] blocks) {
int numBlocks = (blocks.length / numStripeBlocks) * numParityBlocks
+ ((blocks.length % numStripeBlocks == 0) ? 0 : numParityBlocks);
BlockInfo[] parityBlocks = new BlockInfo[numBlocks];
int pos = 0;
int parityEnd = numParityBlocks;
for (int i = 0; i < numBlocks; i++) {
parityBlocks[i] = blocks[pos]; // depends on control dependency: [for], data = [i]
pos++; // depends on control dependency: [for], data = [none]
if (pos == parityEnd) {
pos += numDataBlocks; // depends on control dependency: [if], data = [none]
parityEnd += numStripeBlocks; // depends on control dependency: [if], data = [none]
}
}
return parityBlocks;
} } |
public class class_name {
public static void cleanupTemporaryWorlds(String currentWorld){
List<WorldSummary> saveList;
ISaveFormat isaveformat = Minecraft.getMinecraft().getSaveLoader();
isaveformat.flushCache();
try{
saveList = isaveformat.getSaveList();
} catch (AnvilConverterException e){
e.printStackTrace();
return;
}
String searchString = tempMark + AddressHelper.getMissionControlPort() + "_";
for (WorldSummary s: saveList){
String folderName = s.getFileName();
if (folderName.startsWith(searchString) && !folderName.equals(currentWorld)){
isaveformat.deleteWorldDirectory(folderName);
}
}
} } | public class class_name {
public static void cleanupTemporaryWorlds(String currentWorld){
List<WorldSummary> saveList;
ISaveFormat isaveformat = Minecraft.getMinecraft().getSaveLoader();
isaveformat.flushCache();
try{
saveList = isaveformat.getSaveList(); // depends on control dependency: [try], data = [none]
} catch (AnvilConverterException e){
e.printStackTrace();
return;
} // depends on control dependency: [catch], data = [none]
String searchString = tempMark + AddressHelper.getMissionControlPort() + "_";
for (WorldSummary s: saveList){
String folderName = s.getFileName();
if (folderName.startsWith(searchString) && !folderName.equals(currentWorld)){
isaveformat.deleteWorldDirectory(folderName); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
static List<JmxData> query(MBeanServer server, ObjectName query) throws Exception {
List<JmxData> data = new ArrayList<>();
Set<ObjectName> names = server.queryNames(query, null);
LOGGER.trace("query [{}], found {} matches", query, names.size());
for (ObjectName name : names) {
MBeanInfo info = server.getMBeanInfo(name);
MBeanAttributeInfo[] attrs = info.getAttributes();
String[] attrNames = new String[attrs.length];
for (int i = 0; i < attrs.length; ++i) {
attrNames[i] = attrs[i].getName();
}
Map<String, String> stringAttrs = new HashMap<>();
stringAttrs.put("domain", name.getDomain());
Map<String, Number> numberAttrs = new HashMap<>();
for (Attribute attr : server.getAttributes(name, attrNames).asList()) {
Object obj = attr.getValue();
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("attribute [{}][{}] = {}", name, attr.getName(), mkString(obj));
}
if (obj instanceof String) {
stringAttrs.put(attr.getName(), (String) obj);
} else if (obj instanceof Number) {
numberAttrs.put(attr.getName(), ((Number) obj).doubleValue());
} else if (obj instanceof CompositeDataSupport) {
CompositeDataSupport composite = (CompositeDataSupport) obj;
CompositeType compositeType = composite.getCompositeType();
for (String key : compositeType.keySet()) {
if (composite.containsKey(key)) {
Object o = composite.get(key);
String attrKey = attr.getName() + "." + key;
if (o instanceof Number) {
numberAttrs.put(attrKey, ((Number) o).doubleValue());
} else if (o instanceof String) {
stringAttrs.put(attrKey, (String) o);
} else if (o instanceof TimeUnit) {
stringAttrs.put(attrKey, o.toString());
}
}
}
} else if (obj instanceof TimeUnit) {
stringAttrs.put(attr.getName(), obj.toString());
}
}
// Add properties from ObjectName after attributes to ensure they have a higher
// priority if the same key is used both in the Object and as an attribute
stringAttrs.putAll(name.getKeyPropertyList());
data.add(new JmxData(name, stringAttrs, numberAttrs));
}
return data;
} } | public class class_name {
static List<JmxData> query(MBeanServer server, ObjectName query) throws Exception {
List<JmxData> data = new ArrayList<>();
Set<ObjectName> names = server.queryNames(query, null);
LOGGER.trace("query [{}], found {} matches", query, names.size());
for (ObjectName name : names) {
MBeanInfo info = server.getMBeanInfo(name);
MBeanAttributeInfo[] attrs = info.getAttributes();
String[] attrNames = new String[attrs.length];
for (int i = 0; i < attrs.length; ++i) {
attrNames[i] = attrs[i].getName(); // depends on control dependency: [for], data = [i]
}
Map<String, String> stringAttrs = new HashMap<>();
stringAttrs.put("domain", name.getDomain());
Map<String, Number> numberAttrs = new HashMap<>();
for (Attribute attr : server.getAttributes(name, attrNames).asList()) {
Object obj = attr.getValue();
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("attribute [{}][{}] = {}", name, attr.getName(), mkString(obj)); // depends on control dependency: [if], data = [none]
}
if (obj instanceof String) {
stringAttrs.put(attr.getName(), (String) obj); // depends on control dependency: [if], data = [none]
} else if (obj instanceof Number) {
numberAttrs.put(attr.getName(), ((Number) obj).doubleValue()); // depends on control dependency: [if], data = [none]
} else if (obj instanceof CompositeDataSupport) {
CompositeDataSupport composite = (CompositeDataSupport) obj;
CompositeType compositeType = composite.getCompositeType();
for (String key : compositeType.keySet()) {
if (composite.containsKey(key)) {
Object o = composite.get(key);
String attrKey = attr.getName() + "." + key;
if (o instanceof Number) {
numberAttrs.put(attrKey, ((Number) o).doubleValue()); // depends on control dependency: [if], data = [none]
} else if (o instanceof String) {
stringAttrs.put(attrKey, (String) o); // depends on control dependency: [if], data = [none]
} else if (o instanceof TimeUnit) {
stringAttrs.put(attrKey, o.toString()); // depends on control dependency: [if], data = [none]
}
}
}
} else if (obj instanceof TimeUnit) {
stringAttrs.put(attr.getName(), obj.toString()); // depends on control dependency: [if], data = [none]
}
}
// Add properties from ObjectName after attributes to ensure they have a higher
// priority if the same key is used both in the Object and as an attribute
stringAttrs.putAll(name.getKeyPropertyList());
data.add(new JmxData(name, stringAttrs, numberAttrs));
}
return data;
} } |
public class class_name {
private void checkAndSetFastPathStatus() {
boolean fastPathWasOn = isFastPath;
if ((roundingMode == RoundingMode.HALF_EVEN) &&
(isGroupingUsed()) &&
(groupingSize == 3) &&
(secondaryGroupingSize == 0) &&
(multiplier == 1) &&
(!decimalSeparatorAlwaysShown) &&
(!useExponentialNotation)) {
// The fast-path algorithm is semi-hardcoded against
// minimumIntegerDigits and maximumIntegerDigits.
isFastPath = ((minimumIntegerDigits == 1) &&
(maximumIntegerDigits >= 10));
// The fast-path algorithm is hardcoded against
// minimumFractionDigits and maximumFractionDigits.
if (isFastPath) {
if (isCurrencyFormat) {
if ((minimumFractionDigits != 2) ||
(maximumFractionDigits != 2))
isFastPath = false;
} else if ((minimumFractionDigits != 0) ||
(maximumFractionDigits != 3))
isFastPath = false;
}
} else
isFastPath = false;
// Since some instance properties may have changed while still falling
// in the fast-path case, we need to reinitialize fastPathData anyway.
if (isFastPath) {
// We need to instantiate fastPathData if not already done.
if (fastPathData == null)
fastPathData = new FastPathData();
// Sets up the locale specific constants used when formatting.
// '0' is our default representation of zero.
fastPathData.zeroDelta = symbols.getZeroDigit() - '0';
fastPathData.groupingChar = symbols.getGroupingSeparator();
// Sets up fractional constants related to currency/decimal pattern.
fastPathData.fractionalMaxIntBound = (isCurrencyFormat) ? 99 : 999;
fastPathData.fractionalScaleFactor = (isCurrencyFormat) ? 100.0d : 1000.0d;
// Records the need for adding prefix or suffix
fastPathData.positiveAffixesRequired =
(positivePrefix.length() != 0) || (positiveSuffix.length() != 0);
fastPathData.negativeAffixesRequired =
(negativePrefix.length() != 0) || (negativeSuffix.length() != 0);
// Creates a cached char container for result, with max possible size.
int maxNbIntegralDigits = 10;
int maxNbGroups = 3;
int containerSize =
Math.max(positivePrefix.length(), negativePrefix.length()) +
maxNbIntegralDigits + maxNbGroups + 1 + maximumFractionDigits +
Math.max(positiveSuffix.length(), negativeSuffix.length());
fastPathData.fastPathContainer = new char[containerSize];
// Sets up prefix and suffix char arrays constants.
fastPathData.charsPositiveSuffix = positiveSuffix.toCharArray();
fastPathData.charsNegativeSuffix = negativeSuffix.toCharArray();
fastPathData.charsPositivePrefix = positivePrefix.toCharArray();
fastPathData.charsNegativePrefix = negativePrefix.toCharArray();
// Sets up fixed index positions for integral and fractional digits.
// Sets up decimal point in cached result container.
int longestPrefixLength =
Math.max(positivePrefix.length(), negativePrefix.length());
int decimalPointIndex =
maxNbIntegralDigits + maxNbGroups + longestPrefixLength;
fastPathData.integralLastIndex = decimalPointIndex - 1;
fastPathData.fractionalFirstIndex = decimalPointIndex + 1;
fastPathData.fastPathContainer[decimalPointIndex] =
isCurrencyFormat ?
symbols.getMonetaryDecimalSeparator() :
symbols.getDecimalSeparator();
} else if (fastPathWasOn) {
// Previous state was fast-path and is no more.
// Resets cached array constants.
fastPathData.fastPathContainer = null;
fastPathData.charsPositiveSuffix = null;
fastPathData.charsNegativeSuffix = null;
fastPathData.charsPositivePrefix = null;
fastPathData.charsNegativePrefix = null;
}
fastPathCheckNeeded = false;
} } | public class class_name {
private void checkAndSetFastPathStatus() {
boolean fastPathWasOn = isFastPath;
if ((roundingMode == RoundingMode.HALF_EVEN) &&
(isGroupingUsed()) &&
(groupingSize == 3) &&
(secondaryGroupingSize == 0) &&
(multiplier == 1) &&
(!decimalSeparatorAlwaysShown) &&
(!useExponentialNotation)) {
// The fast-path algorithm is semi-hardcoded against
// minimumIntegerDigits and maximumIntegerDigits.
isFastPath = ((minimumIntegerDigits == 1) &&
(maximumIntegerDigits >= 10)); // depends on control dependency: [if], data = [none]
// The fast-path algorithm is hardcoded against
// minimumFractionDigits and maximumFractionDigits.
if (isFastPath) {
if (isCurrencyFormat) {
if ((minimumFractionDigits != 2) ||
(maximumFractionDigits != 2))
isFastPath = false;
} else if ((minimumFractionDigits != 0) ||
(maximumFractionDigits != 3))
isFastPath = false;
}
} else
isFastPath = false;
// Since some instance properties may have changed while still falling
// in the fast-path case, we need to reinitialize fastPathData anyway.
if (isFastPath) {
// We need to instantiate fastPathData if not already done.
if (fastPathData == null)
fastPathData = new FastPathData();
// Sets up the locale specific constants used when formatting.
// '0' is our default representation of zero.
fastPathData.zeroDelta = symbols.getZeroDigit() - '0'; // depends on control dependency: [if], data = [none]
fastPathData.groupingChar = symbols.getGroupingSeparator(); // depends on control dependency: [if], data = [none]
// Sets up fractional constants related to currency/decimal pattern.
fastPathData.fractionalMaxIntBound = (isCurrencyFormat) ? 99 : 999; // depends on control dependency: [if], data = [none]
fastPathData.fractionalScaleFactor = (isCurrencyFormat) ? 100.0d : 1000.0d; // depends on control dependency: [if], data = [none]
// Records the need for adding prefix or suffix
fastPathData.positiveAffixesRequired =
(positivePrefix.length() != 0) || (positiveSuffix.length() != 0); // depends on control dependency: [if], data = [none]
fastPathData.negativeAffixesRequired =
(negativePrefix.length() != 0) || (negativeSuffix.length() != 0); // depends on control dependency: [if], data = [none]
// Creates a cached char container for result, with max possible size.
int maxNbIntegralDigits = 10;
int maxNbGroups = 3;
int containerSize =
Math.max(positivePrefix.length(), negativePrefix.length()) +
maxNbIntegralDigits + maxNbGroups + 1 + maximumFractionDigits +
Math.max(positiveSuffix.length(), negativeSuffix.length());
fastPathData.fastPathContainer = new char[containerSize]; // depends on control dependency: [if], data = [none]
// Sets up prefix and suffix char arrays constants.
fastPathData.charsPositiveSuffix = positiveSuffix.toCharArray(); // depends on control dependency: [if], data = [none]
fastPathData.charsNegativeSuffix = negativeSuffix.toCharArray(); // depends on control dependency: [if], data = [none]
fastPathData.charsPositivePrefix = positivePrefix.toCharArray(); // depends on control dependency: [if], data = [none]
fastPathData.charsNegativePrefix = negativePrefix.toCharArray(); // depends on control dependency: [if], data = [none]
// Sets up fixed index positions for integral and fractional digits.
// Sets up decimal point in cached result container.
int longestPrefixLength =
Math.max(positivePrefix.length(), negativePrefix.length());
int decimalPointIndex =
maxNbIntegralDigits + maxNbGroups + longestPrefixLength;
fastPathData.integralLastIndex = decimalPointIndex - 1; // depends on control dependency: [if], data = [none]
fastPathData.fractionalFirstIndex = decimalPointIndex + 1; // depends on control dependency: [if], data = [none]
fastPathData.fastPathContainer[decimalPointIndex] =
isCurrencyFormat ?
symbols.getMonetaryDecimalSeparator() :
symbols.getDecimalSeparator(); // depends on control dependency: [if], data = [none]
} else if (fastPathWasOn) {
// Previous state was fast-path and is no more.
// Resets cached array constants.
fastPathData.fastPathContainer = null; // depends on control dependency: [if], data = [none]
fastPathData.charsPositiveSuffix = null; // depends on control dependency: [if], data = [none]
fastPathData.charsNegativeSuffix = null; // depends on control dependency: [if], data = [none]
fastPathData.charsPositivePrefix = null; // depends on control dependency: [if], data = [none]
fastPathData.charsNegativePrefix = null; // depends on control dependency: [if], data = [none]
}
fastPathCheckNeeded = false;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public ServiceT getService() {
if (service == null) {
service = serviceFactory.create((OptionsT) this);
}
return service;
} } | public class class_name {
@SuppressWarnings("unchecked")
public ServiceT getService() {
if (service == null) {
service = serviceFactory.create((OptionsT) this); // depends on control dependency: [if], data = [none]
}
return service;
} } |
public class class_name {
public static int[] unravelIndexFromStrides(int configIx, int... strides) {
int offset = 0;
int[] config = new int[strides.length];
// fill things out from slowest to fastest
for (int i = 0; i < strides.length; i++) {
// how many strides are we passed the offset
int ix = (configIx - offset) / strides[i];
config[i] = ix;
// move the offset
offset += ix * strides[i];
}
return config;
} } | public class class_name {
public static int[] unravelIndexFromStrides(int configIx, int... strides) {
int offset = 0;
int[] config = new int[strides.length];
// fill things out from slowest to fastest
for (int i = 0; i < strides.length; i++) {
// how many strides are we passed the offset
int ix = (configIx - offset) / strides[i];
config[i] = ix; // depends on control dependency: [for], data = [i]
// move the offset
offset += ix * strides[i]; // depends on control dependency: [for], data = [i]
}
return config;
} } |
public class class_name {
@Nonnull
public ByteBuffer getByteBuffer() {
if (base instanceof byte[] && offset >= BYTE_ARRAY_OFFSET) {
final byte[] bytes = (byte[]) base;
// the offset includes an object header... this is only needed for unsafe copies
final long arrayOffset = offset - BYTE_ARRAY_OFFSET;
// verify that the offset and length points somewhere inside the byte array
// and that the offset can safely be truncated to a 32-bit integer
if ((long) bytes.length < arrayOffset + numBytes) {
throw new ArrayIndexOutOfBoundsException();
}
return ByteBuffer.wrap(bytes, (int) arrayOffset, numBytes);
} else {
return ByteBuffer.wrap(getBytes());
}
} } | public class class_name {
@Nonnull
public ByteBuffer getByteBuffer() {
if (base instanceof byte[] && offset >= BYTE_ARRAY_OFFSET) {
final byte[] bytes = (byte[]) base;
// the offset includes an object header... this is only needed for unsafe copies
final long arrayOffset = offset - BYTE_ARRAY_OFFSET;
// verify that the offset and length points somewhere inside the byte array
// and that the offset can safely be truncated to a 32-bit integer
if ((long) bytes.length < arrayOffset + numBytes) {
throw new ArrayIndexOutOfBoundsException();
}
return ByteBuffer.wrap(bytes, (int) arrayOffset, numBytes); // depends on control dependency: [if], data = [none]
} else {
return ByteBuffer.wrap(getBytes()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setAttribute(String name, String value, String facet)
throws JspException
{
if (name != null) {
if (name.equals(SRC) || name.equals(VALUE)) {
String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name});
registerTagError(s, null);
}
else {
if (name.equals(DISABLED)) {
setDisabled(Boolean.parseBoolean(value));
return;
}
}
}
super.setAttribute(name, value, facet);
} } | public class class_name {
public void setAttribute(String name, String value, String facet)
throws JspException
{
if (name != null) {
if (name.equals(SRC) || name.equals(VALUE)) {
String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name});
registerTagError(s, null);
}
else {
if (name.equals(DISABLED)) {
setDisabled(Boolean.parseBoolean(value)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
}
super.setAttribute(name, value, facet);
} } |
public class class_name {
public void offer(PrioritizedSplitRunner split)
{
checkArgument(split != null, "split is null");
split.setReady();
int level = split.getPriority().getLevel();
lock.lock();
try {
if (levelWaitingSplits.get(level).isEmpty()) {
// Accesses to levelScheduledTime are not synchronized, so we have a data race
// here - our level time math will be off. However, the staleness is bounded by
// the fact that only running splits that complete during this computation
// can update the level time. Therefore, this is benign.
long level0Time = getLevel0TargetTime();
long levelExpectedTime = (long) (level0Time / Math.pow(levelTimeMultiplier, level));
long delta = levelExpectedTime - levelScheduledTime[level].get();
levelScheduledTime[level].addAndGet(delta);
}
levelWaitingSplits.get(level).offer(split);
notEmpty.signal();
}
finally {
lock.unlock();
}
} } | public class class_name {
public void offer(PrioritizedSplitRunner split)
{
checkArgument(split != null, "split is null");
split.setReady();
int level = split.getPriority().getLevel();
lock.lock();
try {
if (levelWaitingSplits.get(level).isEmpty()) {
// Accesses to levelScheduledTime are not synchronized, so we have a data race
// here - our level time math will be off. However, the staleness is bounded by
// the fact that only running splits that complete during this computation
// can update the level time. Therefore, this is benign.
long level0Time = getLevel0TargetTime();
long levelExpectedTime = (long) (level0Time / Math.pow(levelTimeMultiplier, level));
long delta = levelExpectedTime - levelScheduledTime[level].get();
levelScheduledTime[level].addAndGet(delta); // depends on control dependency: [if], data = [none]
}
levelWaitingSplits.get(level).offer(split); // depends on control dependency: [try], data = [none]
notEmpty.signal(); // depends on control dependency: [try], data = [none]
}
finally {
lock.unlock();
}
} } |
public class class_name {
private String processQueryElements(String urlToFilter) {
try {
// Handle illegal characters by making a url first
// this will clean illegal characters like |
URL url = new URL(urlToFilter);
String query = url.getQuery();
String path = url.getPath();
// check if the last element of the path contains parameters
// if so convert them to query elements
if (path.contains(";")) {
String[] pathElements = path.split("/");
String last = pathElements[pathElements.length - 1];
// replace last value by part without params
int semicolon = last.indexOf(";");
if (semicolon != -1) {
pathElements[pathElements.length - 1] = last.substring(0,
semicolon);
String params = last.substring(semicolon + 1).replaceAll(
";", "&");
if (query == null) {
query = params;
} else {
query += "&" + params;
}
// rebuild the path
StringBuilder newPath = new StringBuilder();
for (String p : pathElements) {
if (StringUtils.isNotBlank(p)) {
newPath.append("/").append(p);
}
}
path = newPath.toString();
}
}
if (StringUtils.isEmpty(query)) {
return urlToFilter;
}
List<NameValuePair> pairs = URLEncodedUtils.parse(query,
StandardCharsets.UTF_8);
Iterator<NameValuePair> pairsIterator = pairs.iterator();
while (pairsIterator.hasNext()) {
NameValuePair param = pairsIterator.next();
if (queryElementsToRemove.contains(param.getName())) {
pairsIterator.remove();
} else if (removeHashes && param.getValue() != null) {
Matcher m = thirtytwobithash.matcher(param.getValue());
if (m.matches()) {
pairsIterator.remove();
}
}
}
StringBuilder newFile = new StringBuilder();
if (StringUtils.isNotBlank(path)) {
newFile.append(path);
}
if (!pairs.isEmpty()) {
Collections.sort(pairs, comp);
String newQueryString = URLEncodedUtils.format(pairs,
StandardCharsets.UTF_8);
newFile.append('?').append(newQueryString);
}
if (url.getRef() != null) {
newFile.append('#').append(url.getRef());
}
return new URL(url.getProtocol(), url.getHost(), url.getPort(),
newFile.toString()).toString();
} catch (MalformedURLException e) {
LOG.warn("Invalid urlToFilter {}. {}", urlToFilter, e);
return null;
}
} } | public class class_name {
private String processQueryElements(String urlToFilter) {
try {
// Handle illegal characters by making a url first
// this will clean illegal characters like |
URL url = new URL(urlToFilter);
String query = url.getQuery();
String path = url.getPath();
// check if the last element of the path contains parameters
// if so convert them to query elements
if (path.contains(";")) {
String[] pathElements = path.split("/");
String last = pathElements[pathElements.length - 1];
// replace last value by part without params
int semicolon = last.indexOf(";");
if (semicolon != -1) {
pathElements[pathElements.length - 1] = last.substring(0,
semicolon); // depends on control dependency: [if], data = [none]
String params = last.substring(semicolon + 1).replaceAll(
";", "&");
if (query == null) {
query = params; // depends on control dependency: [if], data = [none]
} else {
query += "&" + params; // depends on control dependency: [if], data = [none]
}
// rebuild the path
StringBuilder newPath = new StringBuilder();
for (String p : pathElements) {
if (StringUtils.isNotBlank(p)) {
newPath.append("/").append(p); // depends on control dependency: [if], data = [none]
}
}
path = newPath.toString(); // depends on control dependency: [if], data = [none]
}
}
if (StringUtils.isEmpty(query)) {
return urlToFilter; // depends on control dependency: [if], data = [none]
}
List<NameValuePair> pairs = URLEncodedUtils.parse(query,
StandardCharsets.UTF_8);
Iterator<NameValuePair> pairsIterator = pairs.iterator();
while (pairsIterator.hasNext()) {
NameValuePair param = pairsIterator.next();
if (queryElementsToRemove.contains(param.getName())) {
pairsIterator.remove(); // depends on control dependency: [if], data = [none]
} else if (removeHashes && param.getValue() != null) {
Matcher m = thirtytwobithash.matcher(param.getValue());
if (m.matches()) {
pairsIterator.remove(); // depends on control dependency: [if], data = [none]
}
}
}
StringBuilder newFile = new StringBuilder();
if (StringUtils.isNotBlank(path)) {
newFile.append(path); // depends on control dependency: [if], data = [none]
}
if (!pairs.isEmpty()) {
Collections.sort(pairs, comp); // depends on control dependency: [if], data = [none]
String newQueryString = URLEncodedUtils.format(pairs,
StandardCharsets.UTF_8);
newFile.append('?').append(newQueryString); // depends on control dependency: [if], data = [none]
}
if (url.getRef() != null) {
newFile.append('#').append(url.getRef()); // depends on control dependency: [if], data = [(url.getRef()]
}
return new URL(url.getProtocol(), url.getHost(), url.getPort(),
newFile.toString()).toString(); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
LOG.warn("Invalid urlToFilter {}. {}", urlToFilter, e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final void mFLOAT() throws RecognitionException {
try {
int _type = FLOAT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// src/riemann/Query.g:92:5: ( ( '-' )? ( '0' .. '9' )+ ( '.' ( '0' .. '9' )* )? ( EXPONENT )? )
// src/riemann/Query.g:92:9: ( '-' )? ( '0' .. '9' )+ ( '.' ( '0' .. '9' )* )? ( EXPONENT )?
{
// src/riemann/Query.g:92:9: ( '-' )?
int alt4=2;
int LA4_0 = input.LA(1);
if ( (LA4_0=='-') ) {
alt4=1;
}
switch (alt4) {
case 1 :
// src/riemann/Query.g:92:9: '-'
{
match('-');
}
break;
}
// src/riemann/Query.g:92:14: ( '0' .. '9' )+
int cnt5=0;
loop5:
do {
int alt5=2;
int LA5_0 = input.LA(1);
if ( ((LA5_0>='0' && LA5_0<='9')) ) {
alt5=1;
}
switch (alt5) {
case 1 :
// src/riemann/Query.g:92:15: '0' .. '9'
{
matchRange('0','9');
}
break;
default :
if ( cnt5 >= 1 ) break loop5;
EarlyExitException eee =
new EarlyExitException(5, input);
throw eee;
}
cnt5++;
} while (true);
// src/riemann/Query.g:92:26: ( '.' ( '0' .. '9' )* )?
int alt7=2;
int LA7_0 = input.LA(1);
if ( (LA7_0=='.') ) {
alt7=1;
}
switch (alt7) {
case 1 :
// src/riemann/Query.g:92:27: '.' ( '0' .. '9' )*
{
match('.');
// src/riemann/Query.g:92:31: ( '0' .. '9' )*
loop6:
do {
int alt6=2;
int LA6_0 = input.LA(1);
if ( ((LA6_0>='0' && LA6_0<='9')) ) {
alt6=1;
}
switch (alt6) {
case 1 :
// src/riemann/Query.g:92:32: '0' .. '9'
{
matchRange('0','9');
}
break;
default :
break loop6;
}
} while (true);
}
break;
}
// src/riemann/Query.g:92:45: ( EXPONENT )?
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0=='E'||LA8_0=='e') ) {
alt8=1;
}
switch (alt8) {
case 1 :
// src/riemann/Query.g:92:45: EXPONENT
{
mEXPONENT();
}
break;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
}
} } | public class class_name {
public final void mFLOAT() throws RecognitionException {
try {
int _type = FLOAT;
int _channel = DEFAULT_TOKEN_CHANNEL;
// src/riemann/Query.g:92:5: ( ( '-' )? ( '0' .. '9' )+ ( '.' ( '0' .. '9' )* )? ( EXPONENT )? )
// src/riemann/Query.g:92:9: ( '-' )? ( '0' .. '9' )+ ( '.' ( '0' .. '9' )* )? ( EXPONENT )?
{
// src/riemann/Query.g:92:9: ( '-' )?
int alt4=2;
int LA4_0 = input.LA(1);
if ( (LA4_0=='-') ) {
alt4=1; // depends on control dependency: [if], data = [none]
}
switch (alt4) {
case 1 :
// src/riemann/Query.g:92:9: '-'
{
match('-');
}
break;
}
// src/riemann/Query.g:92:14: ( '0' .. '9' )+
int cnt5=0;
loop5:
do {
int alt5=2;
int LA5_0 = input.LA(1);
if ( ((LA5_0>='0' && LA5_0<='9')) ) {
alt5=1; // depends on control dependency: [if], data = [none]
}
switch (alt5) {
case 1 :
// src/riemann/Query.g:92:15: '0' .. '9'
{
matchRange('0','9');
}
break;
default :
if ( cnt5 >= 1 ) break loop5;
EarlyExitException eee =
new EarlyExitException(5, input);
throw eee;
}
cnt5++;
} while (true);
// src/riemann/Query.g:92:26: ( '.' ( '0' .. '9' )* )?
int alt7=2;
int LA7_0 = input.LA(1);
if ( (LA7_0=='.') ) {
alt7=1; // depends on control dependency: [if], data = [none]
}
switch (alt7) {
case 1 :
// src/riemann/Query.g:92:27: '.' ( '0' .. '9' )*
{
match('.');
// src/riemann/Query.g:92:31: ( '0' .. '9' )*
loop6:
do {
int alt6=2;
int LA6_0 = input.LA(1);
if ( ((LA6_0>='0' && LA6_0<='9')) ) {
alt6=1; // depends on control dependency: [if], data = [none]
}
switch (alt6) {
case 1 :
// src/riemann/Query.g:92:32: '0' .. '9'
{
matchRange('0','9');
}
break;
default :
break loop6;
}
} while (true);
}
break;
}
// src/riemann/Query.g:92:45: ( EXPONENT )?
int alt8=2;
int LA8_0 = input.LA(1);
if ( (LA8_0=='E'||LA8_0=='e') ) {
alt8=1; // depends on control dependency: [if], data = [none]
}
switch (alt8) {
case 1 :
// src/riemann/Query.g:92:45: EXPONENT
{
mEXPONENT();
}
break;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
}
} } |
public class class_name {
@Override
public ObjectName createName(String type, String domain, String name) {
Matcher matcher = PATTERN.matcher(name);
ObjectName objectName = null;
if (matcher.matches()) {
String className = matcher.group(1);
String database = matcher.group(2);
String sql = matcher.group(3);
String event = matcher.group(4);
Hashtable<String, String> props = new Hashtable<>();
props.put("class", className);
props.put("database", database);
if (sql!=null) {
// , and \ are not allowed
props.put("sql", sql.replaceAll("[:=*?,\\n\\\\]", " ").replaceAll("[\\s]+", " "));
}
if (event!=null) {
props.put("event", event);
}
if (type!=null) {
props.put("metricType", type);
}
try {
objectName = new ObjectName(domain, props);
} catch (MalformedObjectNameException malformedObjectNameException) {
}
}
if (objectName == null) {
objectName = defaultObjectFactory.createName(type, domain, name);
}
return objectName;
} } | public class class_name {
@Override
public ObjectName createName(String type, String domain, String name) {
Matcher matcher = PATTERN.matcher(name);
ObjectName objectName = null;
if (matcher.matches()) {
String className = matcher.group(1);
String database = matcher.group(2);
String sql = matcher.group(3);
String event = matcher.group(4);
Hashtable<String, String> props = new Hashtable<>();
props.put("class", className); // depends on control dependency: [if], data = [none]
props.put("database", database); // depends on control dependency: [if], data = [none]
if (sql!=null) {
// , and \ are not allowed
props.put("sql", sql.replaceAll("[:=*?,\\n\\\\]", " ").replaceAll("[\\s]+", " ")); // depends on control dependency: [if], data = [none]
}
if (event!=null) {
props.put("event", event); // depends on control dependency: [if], data = [none]
}
if (type!=null) {
props.put("metricType", type); // depends on control dependency: [if], data = [none]
}
try {
objectName = new ObjectName(domain, props); // depends on control dependency: [try], data = [none]
} catch (MalformedObjectNameException malformedObjectNameException) {
} // depends on control dependency: [catch], data = [none]
}
if (objectName == null) {
objectName = defaultObjectFactory.createName(type, domain, name); // depends on control dependency: [if], data = [none]
}
return objectName;
} } |
public class class_name {
public final AntlrDatatypeRuleToken ruleRuleID() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
AntlrDatatypeRuleToken this_ValidID_0 = null;
AntlrDatatypeRuleToken this_ValidID_2 = null;
enterRule();
try {
// InternalXtext.g:2092:2: ( (this_ValidID_0= ruleValidID (kw= '::' this_ValidID_2= ruleValidID )* ) )
// InternalXtext.g:2093:2: (this_ValidID_0= ruleValidID (kw= '::' this_ValidID_2= ruleValidID )* )
{
// InternalXtext.g:2093:2: (this_ValidID_0= ruleValidID (kw= '::' this_ValidID_2= ruleValidID )* )
// InternalXtext.g:2094:3: this_ValidID_0= ruleValidID (kw= '::' this_ValidID_2= ruleValidID )*
{
newCompositeNode(grammarAccess.getRuleIDAccess().getValidIDParserRuleCall_0());
pushFollow(FollowSets000.FOLLOW_38);
this_ValidID_0=ruleValidID();
state._fsp--;
current.merge(this_ValidID_0);
afterParserOrEnumRuleCall();
// InternalXtext.g:2104:3: (kw= '::' this_ValidID_2= ruleValidID )*
loop48:
do {
int alt48=2;
int LA48_0 = input.LA(1);
if ( (LA48_0==29) ) {
alt48=1;
}
switch (alt48) {
case 1 :
// InternalXtext.g:2105:4: kw= '::' this_ValidID_2= ruleValidID
{
kw=(Token)match(input,29,FollowSets000.FOLLOW_3);
current.merge(kw);
newLeafNode(kw, grammarAccess.getRuleIDAccess().getColonColonKeyword_1_0());
newCompositeNode(grammarAccess.getRuleIDAccess().getValidIDParserRuleCall_1_1());
pushFollow(FollowSets000.FOLLOW_38);
this_ValidID_2=ruleValidID();
state._fsp--;
current.merge(this_ValidID_2);
afterParserOrEnumRuleCall();
}
break;
default :
break loop48;
}
} while (true);
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final AntlrDatatypeRuleToken ruleRuleID() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
AntlrDatatypeRuleToken this_ValidID_0 = null;
AntlrDatatypeRuleToken this_ValidID_2 = null;
enterRule();
try {
// InternalXtext.g:2092:2: ( (this_ValidID_0= ruleValidID (kw= '::' this_ValidID_2= ruleValidID )* ) )
// InternalXtext.g:2093:2: (this_ValidID_0= ruleValidID (kw= '::' this_ValidID_2= ruleValidID )* )
{
// InternalXtext.g:2093:2: (this_ValidID_0= ruleValidID (kw= '::' this_ValidID_2= ruleValidID )* )
// InternalXtext.g:2094:3: this_ValidID_0= ruleValidID (kw= '::' this_ValidID_2= ruleValidID )*
{
newCompositeNode(grammarAccess.getRuleIDAccess().getValidIDParserRuleCall_0());
pushFollow(FollowSets000.FOLLOW_38);
this_ValidID_0=ruleValidID();
state._fsp--;
current.merge(this_ValidID_0);
afterParserOrEnumRuleCall();
// InternalXtext.g:2104:3: (kw= '::' this_ValidID_2= ruleValidID )*
loop48:
do {
int alt48=2;
int LA48_0 = input.LA(1);
if ( (LA48_0==29) ) {
alt48=1; // depends on control dependency: [if], data = [none]
}
switch (alt48) {
case 1 :
// InternalXtext.g:2105:4: kw= '::' this_ValidID_2= ruleValidID
{
kw=(Token)match(input,29,FollowSets000.FOLLOW_3);
current.merge(kw);
newLeafNode(kw, grammarAccess.getRuleIDAccess().getColonColonKeyword_1_0());
newCompositeNode(grammarAccess.getRuleIDAccess().getValidIDParserRuleCall_1_1());
pushFollow(FollowSets000.FOLLOW_38);
this_ValidID_2=ruleValidID();
state._fsp--;
current.merge(this_ValidID_2);
afterParserOrEnumRuleCall();
}
break;
default :
break loop48;
}
} while (true);
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
@Override
public String getLocalizedMessage() {
String localizedContext = getLocalizedString(context);
if (value == null) {
return getLocalizedMessage("pruefung.missingvalue.exception.message", localizedContext);
}
if (range == null) {
return getLocalizedMessage("pruefung.invalidvalue.exception.message", value.toString(), localizedContext);
}
return getLocalizedMessage("pruefung.invalidrange.exception.message", value.toString(), localizedContext, range);
} } | public class class_name {
@Override
public String getLocalizedMessage() {
String localizedContext = getLocalizedString(context);
if (value == null) {
return getLocalizedMessage("pruefung.missingvalue.exception.message", localizedContext); // depends on control dependency: [if], data = [none]
}
if (range == null) {
return getLocalizedMessage("pruefung.invalidvalue.exception.message", value.toString(), localizedContext); // depends on control dependency: [if], data = [none]
}
return getLocalizedMessage("pruefung.invalidrange.exception.message", value.toString(), localizedContext, range);
} } |
public class class_name {
public com.google.protobuf.ByteString
getLocalityBytes() {
java.lang.Object ref = locality_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
locality_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
} } | public class class_name {
public com.google.protobuf.ByteString
getLocalityBytes() {
java.lang.Object ref = locality_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
locality_ = b; // depends on control dependency: [if], data = [none]
return b; // depends on control dependency: [if], data = [none]
} else {
return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ListCommandInvocationsResult withCommandInvocations(CommandInvocation... commandInvocations) {
if (this.commandInvocations == null) {
setCommandInvocations(new com.amazonaws.internal.SdkInternalList<CommandInvocation>(commandInvocations.length));
}
for (CommandInvocation ele : commandInvocations) {
this.commandInvocations.add(ele);
}
return this;
} } | public class class_name {
public ListCommandInvocationsResult withCommandInvocations(CommandInvocation... commandInvocations) {
if (this.commandInvocations == null) {
setCommandInvocations(new com.amazonaws.internal.SdkInternalList<CommandInvocation>(commandInvocations.length)); // depends on control dependency: [if], data = [none]
}
for (CommandInvocation ele : commandInvocations) {
this.commandInvocations.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static Polygon readPolygon(ByteReader reader, boolean hasZ,
boolean hasM) {
Polygon polygon = new Polygon(hasZ, hasM);
int numRings = reader.readInt();
for (int i = 0; i < numRings; i++) {
LineString ring = readLineString(reader, hasZ, hasM);
polygon.addRing(ring);
}
return polygon;
} } | public class class_name {
public static Polygon readPolygon(ByteReader reader, boolean hasZ,
boolean hasM) {
Polygon polygon = new Polygon(hasZ, hasM);
int numRings = reader.readInt();
for (int i = 0; i < numRings; i++) {
LineString ring = readLineString(reader, hasZ, hasM);
polygon.addRing(ring); // depends on control dependency: [for], data = [none]
}
return polygon;
} } |
public class class_name {
void parseHeader(String headerName, String headerValue, ParseHeaderState state) {
List<Type> context = state.context;
ClassInfo classInfo = state.classInfo;
ArrayValueMap arrayValueMap = state.arrayValueMap;
StringBuilder logger = state.logger;
if (logger != null) {
logger.append(headerName + ": " + headerValue).append(StringUtils.LINE_SEPARATOR);
}
// use field information if available
FieldInfo fieldInfo = classInfo.getFieldInfo(headerName);
if (fieldInfo != null) {
Type type = Data.resolveWildcardTypeOrTypeVariable(context, fieldInfo.getGenericType());
// type is now class, parameterized type, or generic array type
if (Types.isArray(type)) {
// array that can handle repeating values
Class<?> rawArrayComponentType =
Types.getRawArrayComponentType(context, Types.getArrayComponentType(type));
arrayValueMap.put(
fieldInfo.getField(),
rawArrayComponentType,
parseValue(rawArrayComponentType, context, headerValue));
} else if (Types.isAssignableToOrFrom(
Types.getRawArrayComponentType(context, type), Iterable.class)) {
// iterable that can handle repeating values
@SuppressWarnings("unchecked")
Collection<Object> collection = (Collection<Object>) fieldInfo.getValue(this);
if (collection == null) {
collection = Data.newCollectionInstance(type);
fieldInfo.setValue(this, collection);
}
Type subFieldType = type == Object.class ? null : Types.getIterableParameter(type);
collection.add(parseValue(subFieldType, context, headerValue));
} else {
// parse value based on field type
fieldInfo.setValue(this, parseValue(type, context, headerValue));
}
} else {
// store header values in an array list
@SuppressWarnings("unchecked")
ArrayList<String> listValue = (ArrayList<String>) this.get(headerName);
if (listValue == null) {
listValue = new ArrayList<String>();
this.set(headerName, listValue);
}
listValue.add(headerValue);
}
} } | public class class_name {
void parseHeader(String headerName, String headerValue, ParseHeaderState state) {
List<Type> context = state.context;
ClassInfo classInfo = state.classInfo;
ArrayValueMap arrayValueMap = state.arrayValueMap;
StringBuilder logger = state.logger;
if (logger != null) {
logger.append(headerName + ": " + headerValue).append(StringUtils.LINE_SEPARATOR); // depends on control dependency: [if], data = [none]
}
// use field information if available
FieldInfo fieldInfo = classInfo.getFieldInfo(headerName);
if (fieldInfo != null) {
Type type = Data.resolveWildcardTypeOrTypeVariable(context, fieldInfo.getGenericType());
// type is now class, parameterized type, or generic array type
if (Types.isArray(type)) {
// array that can handle repeating values
Class<?> rawArrayComponentType =
Types.getRawArrayComponentType(context, Types.getArrayComponentType(type));
arrayValueMap.put(
fieldInfo.getField(),
rawArrayComponentType,
parseValue(rawArrayComponentType, context, headerValue));
} else if (Types.isAssignableToOrFrom(
Types.getRawArrayComponentType(context, type), Iterable.class)) {
// iterable that can handle repeating values
@SuppressWarnings("unchecked")
Collection<Object> collection = (Collection<Object>) fieldInfo.getValue(this);
if (collection == null) {
collection = Data.newCollectionInstance(type); // depends on control dependency: [if], data = [none]
fieldInfo.setValue(this, collection); // depends on control dependency: [if], data = [none]
}
Type subFieldType = type == Object.class ? null : Types.getIterableParameter(type);
collection.add(parseValue(subFieldType, context, headerValue)); // depends on control dependency: [if], data = [none]
} else {
// parse value based on field type
fieldInfo.setValue(this, parseValue(type, context, headerValue)); // depends on control dependency: [if], data = [none]
}
} else {
// store header values in an array list
@SuppressWarnings("unchecked")
ArrayList<String> listValue = (ArrayList<String>) this.get(headerName);
if (listValue == null) {
listValue = new ArrayList<String>(); // depends on control dependency: [if], data = [none]
this.set(headerName, listValue); // depends on control dependency: [if], data = [none]
}
listValue.add(headerValue); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public synchronized boolean lockdown(ConnectionException connectionException) {
// If we are already in a lockdown state, don't change anything
if (isLockedDown()) {
return false;
}
if (connectionException != null && connectionException.getRecommendedLockdownTime() != null) {
lockdownTime = connectionException.getRecommendedLockdownTime();
} else if (lockdownTime != 0) {
lockdownTime = lockdownTime * 2;
} else {
lockdownTime = baseLockdownTime;
}
lockdownTime = Math.min(maxLockdownTime, lockdownTime);
lockdownStartTime = clock.date();
return true;
} } | public class class_name {
public synchronized boolean lockdown(ConnectionException connectionException) {
// If we are already in a lockdown state, don't change anything
if (isLockedDown()) {
return false; // depends on control dependency: [if], data = [none]
}
if (connectionException != null && connectionException.getRecommendedLockdownTime() != null) {
lockdownTime = connectionException.getRecommendedLockdownTime(); // depends on control dependency: [if], data = [none]
} else if (lockdownTime != 0) {
lockdownTime = lockdownTime * 2; // depends on control dependency: [if], data = [none]
} else {
lockdownTime = baseLockdownTime; // depends on control dependency: [if], data = [none]
}
lockdownTime = Math.min(maxLockdownTime, lockdownTime);
lockdownStartTime = clock.date();
return true;
} } |
public class class_name {
protected String[] readMethodActionPath(final String methodName, final ActionAnnotationValues annotationValues, final ActionConfig actionConfig) {
// read annotation
String methodActionPath = annotationValues != null ? annotationValues.value() : null;
if (methodActionPath == null) {
methodActionPath = methodName;
} else {
if (methodActionPath.equals(Action.NONE)) {
return ArraysUtil.array(null, null);
}
}
// check for defaults
for (String path : actionConfig.getActionMethodNames()) {
if (methodActionPath.equals(path)) {
methodActionPath = null;
break;
}
}
return ArraysUtil.array(methodName, methodActionPath);
} } | public class class_name {
protected String[] readMethodActionPath(final String methodName, final ActionAnnotationValues annotationValues, final ActionConfig actionConfig) {
// read annotation
String methodActionPath = annotationValues != null ? annotationValues.value() : null;
if (methodActionPath == null) {
methodActionPath = methodName; // depends on control dependency: [if], data = [none]
} else {
if (methodActionPath.equals(Action.NONE)) {
return ArraysUtil.array(null, null); // depends on control dependency: [if], data = [none]
}
}
// check for defaults
for (String path : actionConfig.getActionMethodNames()) {
if (methodActionPath.equals(path)) {
methodActionPath = null; // depends on control dependency: [if], data = [none]
break;
}
}
return ArraysUtil.array(methodName, methodActionPath);
} } |
public class class_name {
public static List<VirtualMachineDescriptor> list()
{
List<VirtualMachineDescriptor> l = new ArrayList<VirtualMachineDescriptor>();
List<AttachProvider> providers = AttachProvider.providers();
for (AttachProvider provider : providers) {
l.addAll(provider.listVirtualMachines());
}
return l;
} } | public class class_name {
public static List<VirtualMachineDescriptor> list()
{
List<VirtualMachineDescriptor> l = new ArrayList<VirtualMachineDescriptor>();
List<AttachProvider> providers = AttachProvider.providers();
for (AttachProvider provider : providers) {
l.addAll(provider.listVirtualMachines()); // depends on control dependency: [for], data = [provider]
}
return l;
} } |
public class class_name {
public void queryLiveness(ActivityHandle arg0) {
final SipActivityHandle handle = (SipActivityHandle) arg0;
final Wrapper activity = activityManagement.get(handle);
if (activity == null || activity.isEnding()) {
sleeEndpoint.endActivity(handle);
}
} } | public class class_name {
public void queryLiveness(ActivityHandle arg0) {
final SipActivityHandle handle = (SipActivityHandle) arg0;
final Wrapper activity = activityManagement.get(handle);
if (activity == null || activity.isEnding()) {
sleeEndpoint.endActivity(handle); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ListServiceActionsResult withServiceActionSummaries(ServiceActionSummary... serviceActionSummaries) {
if (this.serviceActionSummaries == null) {
setServiceActionSummaries(new java.util.ArrayList<ServiceActionSummary>(serviceActionSummaries.length));
}
for (ServiceActionSummary ele : serviceActionSummaries) {
this.serviceActionSummaries.add(ele);
}
return this;
} } | public class class_name {
public ListServiceActionsResult withServiceActionSummaries(ServiceActionSummary... serviceActionSummaries) {
if (this.serviceActionSummaries == null) {
setServiceActionSummaries(new java.util.ArrayList<ServiceActionSummary>(serviceActionSummaries.length)); // depends on control dependency: [if], data = [none]
}
for (ServiceActionSummary ele : serviceActionSummaries) {
this.serviceActionSummaries.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected void updateParameterTable() {
parameterTable.setEnabled(false);
ListParameterization config = new ListParameterization();
parameterTable.appendParameters(config);
setParameters(config);
if(config.getErrors().size() > 0) {
reportErrors(config);
}
config.clearErrors();
parameterTable.setEnabled(true);
} } | public class class_name {
protected void updateParameterTable() {
parameterTable.setEnabled(false);
ListParameterization config = new ListParameterization();
parameterTable.appendParameters(config);
setParameters(config);
if(config.getErrors().size() > 0) {
reportErrors(config); // depends on control dependency: [if], data = [none]
}
config.clearErrors();
parameterTable.setEnabled(true);
} } |
public class class_name {
public Object mapRowToReturnType() {
Object resultObject = null;
if (_columnCount == 1) {
final int typeId = _tmf.getTypeId(_returnTypeClass);
try {
if (typeId != TypeMappingsFactory.TYPE_UNKNOWN) {
return extractColumnValue(1, typeId);
} else {
// we still might want a single value (i.e. java.util.Date)
Object val = extractColumnValue(1, typeId);
if (_returnTypeClass.isAssignableFrom(val.getClass())) {
return val;
}
}
} catch (SQLException e) {
throw new ControlException(e.getMessage(), e);
}
}
if (_setterMethods == null) {
try {
getResultSetMappings();
} catch (SQLException e) {
throw new ControlException(e.getMessage(), e);
}
}
resultObject = XmlObject.Factory.newInstance(new XmlOptions().setDocumentType(_schemaType));
for (int i = 1; i < _setterMethods.length; i++) {
Method setterMethod = _setterMethods[i].getSetter();
Object resultValue = null;
try {
resultValue = extractColumnValue(i, _setterMethods[i].getParameterType());
// if the setter is for an xmlbean enum type, convert the extracted resultset column
// value to the proper xmlbean enum type. All xmlbean enums are derived from the class
// StringEnumAbstractBase
if (_setterMethods[i].getParameterType() == TypeMappingsFactory.TYPE_XMLBEAN_ENUM) {
Class parameterClass = _setterMethods[i].getParameterClass();
Method m = parameterClass.getMethod("forString", new Class[]{String.class});
resultValue = m.invoke(null, new Object[]{resultValue});
}
_args[0] = resultValue;
setterMethod.invoke(resultObject, _args);
if (_setterMethods[i].getNilable() != null) {
if (_resultSet.wasNull()) {
_setterMethods[i].getNilable().invoke(resultObject, (Object[]) null);
}
}
} catch (SQLException se) {
throw new ControlException(se.getMessage(), se);
} catch (IllegalArgumentException iae) {
try {
ResultSetMetaData md = _resultSet.getMetaData();
throw new ControlException("The declared Java type for method " + setterMethod.getName()
+ setterMethod.getParameterTypes()[0].toString()
+ " is incompatible with the SQL format of column " + md.getColumnName(i).toString()
+ md.getColumnTypeName(i).toString()
+ " which returns objects of type " + resultValue.getClass().getName());
} catch (SQLException e) {
throw new ControlException(e.getMessage(), e);
}
} catch (IllegalAccessException e) {
throw new ControlException("IllegalAccessException when trying to access method " + setterMethod.getName(), e);
} catch (NoSuchMethodException e) {
throw new ControlException("NoSuchMethodException when trying to map schema enum value using Enum.forString().", e);
} catch (InvocationTargetException e) {
throw new ControlException("IllegalInvocationException when trying to access method " + setterMethod.getName(), e);
}
}
return resultObject;
} } | public class class_name {
public Object mapRowToReturnType() {
Object resultObject = null;
if (_columnCount == 1) {
final int typeId = _tmf.getTypeId(_returnTypeClass);
try {
if (typeId != TypeMappingsFactory.TYPE_UNKNOWN) {
return extractColumnValue(1, typeId); // depends on control dependency: [if], data = [none]
} else {
// we still might want a single value (i.e. java.util.Date)
Object val = extractColumnValue(1, typeId);
if (_returnTypeClass.isAssignableFrom(val.getClass())) {
return val; // depends on control dependency: [if], data = [none]
}
}
} catch (SQLException e) {
throw new ControlException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
if (_setterMethods == null) {
try {
getResultSetMappings(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new ControlException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
resultObject = XmlObject.Factory.newInstance(new XmlOptions().setDocumentType(_schemaType));
for (int i = 1; i < _setterMethods.length; i++) {
Method setterMethod = _setterMethods[i].getSetter();
Object resultValue = null;
try {
resultValue = extractColumnValue(i, _setterMethods[i].getParameterType()); // depends on control dependency: [try], data = [none]
// if the setter is for an xmlbean enum type, convert the extracted resultset column
// value to the proper xmlbean enum type. All xmlbean enums are derived from the class
// StringEnumAbstractBase
if (_setterMethods[i].getParameterType() == TypeMappingsFactory.TYPE_XMLBEAN_ENUM) {
Class parameterClass = _setterMethods[i].getParameterClass();
Method m = parameterClass.getMethod("forString", new Class[]{String.class}); // depends on control dependency: [if], data = [none]
resultValue = m.invoke(null, new Object[]{resultValue}); // depends on control dependency: [if], data = [none]
}
_args[0] = resultValue; // depends on control dependency: [try], data = [none]
setterMethod.invoke(resultObject, _args); // depends on control dependency: [try], data = [none]
if (_setterMethods[i].getNilable() != null) {
if (_resultSet.wasNull()) {
_setterMethods[i].getNilable().invoke(resultObject, (Object[]) null); // depends on control dependency: [if], data = [none]
}
}
} catch (SQLException se) {
throw new ControlException(se.getMessage(), se);
} catch (IllegalArgumentException iae) { // depends on control dependency: [catch], data = [none]
try {
ResultSetMetaData md = _resultSet.getMetaData();
throw new ControlException("The declared Java type for method " + setterMethod.getName()
+ setterMethod.getParameterTypes()[0].toString()
+ " is incompatible with the SQL format of column " + md.getColumnName(i).toString()
+ md.getColumnTypeName(i).toString()
+ " which returns objects of type " + resultValue.getClass().getName());
} catch (SQLException e) {
throw new ControlException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
throw new ControlException("IllegalAccessException when trying to access method " + setterMethod.getName(), e);
} catch (NoSuchMethodException e) { // depends on control dependency: [catch], data = [none]
throw new ControlException("NoSuchMethodException when trying to map schema enum value using Enum.forString().", e);
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
throw new ControlException("IllegalInvocationException when trying to access method " + setterMethod.getName(), e);
} // depends on control dependency: [catch], data = [none]
}
return resultObject;
} } |
public class class_name {
public void setTextAlignment(final TextAlignment ALIGNMENT) {
if (null == textAlignment) {
_textAlignment = ALIGNMENT;
fireTileEvent(RESIZE_EVENT);
} else {
textAlignment.set(ALIGNMENT);
}
} } | public class class_name {
public void setTextAlignment(final TextAlignment ALIGNMENT) {
if (null == textAlignment) {
_textAlignment = ALIGNMENT; // depends on control dependency: [if], data = [none]
fireTileEvent(RESIZE_EVENT); // depends on control dependency: [if], data = [none]
} else {
textAlignment.set(ALIGNMENT); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void addUrlSeed(String url, String externAuth, List<Pair<String, String>> extraHeaders) {
string_string_pair_vector v = new string_string_pair_vector();
for (Pair<String, String> p : extraHeaders) {
v.push_back(p.to_string_string_pair());
}
ti.add_url_seed(url, externAuth, v);
} } | public class class_name {
public void addUrlSeed(String url, String externAuth, List<Pair<String, String>> extraHeaders) {
string_string_pair_vector v = new string_string_pair_vector();
for (Pair<String, String> p : extraHeaders) {
v.push_back(p.to_string_string_pair()); // depends on control dependency: [for], data = [p]
}
ti.add_url_seed(url, externAuth, v);
} } |
public class class_name {
public static String toMemberName(String words)
{
if(words == null) {
return null;
}
if(words.isEmpty()) {
return "";
}
String[] parts = words.split("-+");
StringBuilder sb = new StringBuilder(parts[0]);
for(int i = 1; i < parts.length; i++) {
assert parts[i].length() > 0;
sb.append(Character.toUpperCase(parts[i].charAt(0)));
sb.append(parts[i].substring(1));
}
return sb.toString();
} } | public class class_name {
public static String toMemberName(String words)
{
if(words == null) {
return null;
// depends on control dependency: [if], data = [none]
}
if(words.isEmpty()) {
return "";
// depends on control dependency: [if], data = [none]
}
String[] parts = words.split("-+");
StringBuilder sb = new StringBuilder(parts[0]);
for(int i = 1; i < parts.length; i++) {
assert parts[i].length() > 0;
sb.append(Character.toUpperCase(parts[i].charAt(0)));
// depends on control dependency: [for], data = [i]
sb.append(parts[i].substring(1));
// depends on control dependency: [for], data = [i]
}
return sb.toString();
} } |
public class class_name {
public static long longFromBase64(String value) {
int pos = 0;
long longVal = base64Values[value.charAt(pos++)];
int len = value.length();
while (pos < len) {
longVal <<= 6;
longVal |= base64Values[value.charAt(pos++)];
}
return longVal;
} } | public class class_name {
public static long longFromBase64(String value) {
int pos = 0;
long longVal = base64Values[value.charAt(pos++)];
int len = value.length();
while (pos < len) {
longVal <<= 6; // depends on control dependency: [while], data = [none]
longVal |= base64Values[value.charAt(pos++)]; // depends on control dependency: [while], data = [(pos]
}
return longVal;
} } |
public class class_name {
private Set<String> loadWords(InputStream stream) throws IOException {
Set<String> words = new HashSet<>();
try (
InputStreamReader isr = new InputStreamReader(stream, "UTF-8");
BufferedReader br = new BufferedReader(isr)
) {
String line;
while ((line = br.readLine()) != null) {
line = line.trim();
if (line.isEmpty() || line.charAt(0) == '#') { // ignore comments
continue;
}
words.add(line);
}
}
return words;
} } | public class class_name {
private Set<String> loadWords(InputStream stream) throws IOException {
Set<String> words = new HashSet<>();
try (
InputStreamReader isr = new InputStreamReader(stream, "UTF-8");
BufferedReader br = new BufferedReader(isr)
) {
String line;
while ((line = br.readLine()) != null) {
line = line.trim(); // depends on control dependency: [while], data = [none]
if (line.isEmpty() || line.charAt(0) == '#') { // ignore comments
continue;
}
words.add(line); // depends on control dependency: [while], data = [none]
}
}
return words;
} } |
public class class_name {
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value)
{
if (facesContext == null)
{
throw new NullPointerException("facesContext");
}
if (uiComponent == null)
{
throw new NullPointerException("uiComponent");
}
if (value != null)
{
value = value.trim();
if (value.length() > 0)
{
try
{
return Boolean.valueOf(value);
}
catch (Exception e)
{
throw new ConverterException(_MessageUtils.getErrorMessage(facesContext,
BOOLEAN_ID,
new Object[]{value,_MessageUtils.getLabel(facesContext, uiComponent)}), e);
}
}
}
return null;
} } | public class class_name {
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String value)
{
if (facesContext == null)
{
throw new NullPointerException("facesContext");
}
if (uiComponent == null)
{
throw new NullPointerException("uiComponent");
}
if (value != null)
{
value = value.trim(); // depends on control dependency: [if], data = [none]
if (value.length() > 0)
{
try
{
return Boolean.valueOf(value); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
throw new ConverterException(_MessageUtils.getErrorMessage(facesContext,
BOOLEAN_ID,
new Object[]{value,_MessageUtils.getLabel(facesContext, uiComponent)}), e);
} // depends on control dependency: [catch], data = [none]
}
}
return null;
} } |
public class class_name {
public static String addDomainIfMissing(final String aUrl, final String aDomain) {
if (aUrl != null && !aUrl.isEmpty() && aUrl.startsWith("/")) {
return aDomain + aUrl;
}
return aUrl;
} } | public class class_name {
public static String addDomainIfMissing(final String aUrl, final String aDomain) {
if (aUrl != null && !aUrl.isEmpty() && aUrl.startsWith("/")) {
return aDomain + aUrl;
// depends on control dependency: [if], data = [none]
}
return aUrl;
} } |
public class class_name {
private void unwatchInstance(final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
Handler<MapEvent<String, String>> watchHandler = watchHandlers.remove(instance.address());
if (watchHandler != null) {
data.unwatch(instance.status(), watchHandler, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
data.remove(instance.address(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
counter.fail(result.cause());
} else {
counter.succeed();
}
}
});
}
});
} else {
data.remove(instance.address(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
counter.fail(result.cause());
} else {
counter.succeed();
}
}
});
}
} } | public class class_name {
private void unwatchInstance(final InstanceContext instance, final CountingCompletionHandler<Void> counter) {
Handler<MapEvent<String, String>> watchHandler = watchHandlers.remove(instance.address());
if (watchHandler != null) {
data.unwatch(instance.status(), watchHandler, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
data.remove(instance.address(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
counter.fail(result.cause()); // depends on control dependency: [if], data = [none]
} else {
counter.succeed(); // depends on control dependency: [if], data = [none]
}
}
});
}
}); // depends on control dependency: [if], data = [none]
} else {
data.remove(instance.address(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
counter.fail(result.cause()); // depends on control dependency: [if], data = [none]
} else {
counter.succeed(); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Collection map(Mapper mapper, Iterator i, boolean includeNull) {
ArrayList l = new ArrayList();
while (i.hasNext()) {
Object o = mapper.map(i.next());
if (includeNull || o != null) {
l.add(o);
}
}
return l;
} } | public class class_name {
public static Collection map(Mapper mapper, Iterator i, boolean includeNull) {
ArrayList l = new ArrayList();
while (i.hasNext()) {
Object o = mapper.map(i.next());
if (includeNull || o != null) {
l.add(o); // depends on control dependency: [if], data = [none]
}
}
return l;
} } |
public class class_name {
public synchronized void close() throws InterruptedException {
if (!state.isAlive()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Close called on already closed client");
}
return;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Closing session: 0x" + Long.toHexString(getSessionId()));
}
try {
cnxn.close();
} catch (IOException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Ignoring unexpected exception during close", e);
}
}
LOG.debug("Session: 0x" + Long.toHexString(getSessionId()) + " closed");
} } | public class class_name {
public synchronized void close() throws InterruptedException {
if (!state.isAlive()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Close called on already closed client"); // depends on control dependency: [if], data = [none]
}
return;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Closing session: 0x" + Long.toHexString(getSessionId()));
}
try {
cnxn.close();
} catch (IOException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Ignoring unexpected exception during close", e);
}
}
LOG.debug("Session: 0x" + Long.toHexString(getSessionId()) + " closed");
} } |
public class class_name {
public String formatObj(Object objs) {
String ans = "";
final String nlPad;
// Pad amount changes based on trace format
if (TraceFormat.ADVANCED.equals(traceFormat)) {
nlPad = nlAdvancedPadding;
} else if (TraceFormat.BASIC.equals(traceFormat)) {
nlPad = nlBasicPadding;
} else {
nlPad = nlEnhancedPadding;
}
final String nlPadA = nlPad + " ";
if (objs != null) {
if (objs.getClass().isArray()) {
StringBuilder sb = new StringBuilder();
final int len = Array.getLength(objs);
if (objs.getClass().getName().equals("[B")) { // Byte array
final int COLUMNS = 32;
byte b[] = (byte[]) objs;
int printLen = len > LoggingConstants.MAX_DATA_LENGTH ? LoggingConstants.MAX_DATA_LENGTH : len;
sb.append(nlPad).append(objs.toString()).append(",len=").append(len);
for (int i = 0; i < printLen; i++) {
if (i % COLUMNS == 0) // offset
sb.append(nlPadA + '|' + DataFormatHelper.padHexString(i, 4) + '|');
if (i % 4 == 0) // group in words
sb.append(" ");
sb.append(hexChars[(b[i] >> 4) & 0xF]);
sb.append(hexChars[b[i] & 0xF]);
}
if (printLen != len)
sb.append(nlPadA).append(" ...");
} else if (objs.getClass().getName().equals("[C")) {
// Character array - Just print it as a string rather than a single
// character on each line
sb.append((char[]) objs);
} else { // not a Byte or char array
for (int i = 0; i < len; i++) {
String s = formatObj(Array.get(objs, i));
if (s.startsWith(LoggingConstants.nl))
sb.append(s);
else
sb.append(nlPad + s);
if (sb.length() > LoggingConstants.MAX_DATA_LENGTH) {
sb.append(nlPad + "...");
break;
}
}
}
ans = sb.toString();
} else if (objs instanceof Untraceable) {
ans = nlPad + objs.getClass().getName(); // Use only the class name of the object
} else if (objs instanceof Traceable) {
ans = nlPad + formatTraceable((Traceable) objs);
} else if (objs instanceof TruncatableThrowable) {
ans = nlPad + DataFormatHelper.throwableToString((TruncatableThrowable) objs);
} else if (objs instanceof Throwable) {
ans = nlPad + DataFormatHelper.throwableToString(new TruncatableThrowable((Throwable) objs));
} else {
try { // Protect ourselves from badly behaved toString methods
ans = nlPad + objs.toString();
} catch (Exception e) {
// No FFDC code needed
ans = "<Exception " + e + " caught while calling toString() on object " + objs.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(objs))
+ ">";
}
}
} else {
// objs is null - print out "null"
ans = nlPad + nullParamString;
}
return ans;
} } | public class class_name {
public String formatObj(Object objs) {
String ans = "";
final String nlPad;
// Pad amount changes based on trace format
if (TraceFormat.ADVANCED.equals(traceFormat)) {
nlPad = nlAdvancedPadding; // depends on control dependency: [if], data = [none]
} else if (TraceFormat.BASIC.equals(traceFormat)) {
nlPad = nlBasicPadding; // depends on control dependency: [if], data = [none]
} else {
nlPad = nlEnhancedPadding; // depends on control dependency: [if], data = [none]
}
final String nlPadA = nlPad + " ";
if (objs != null) {
if (objs.getClass().isArray()) {
StringBuilder sb = new StringBuilder();
final int len = Array.getLength(objs);
if (objs.getClass().getName().equals("[B")) { // Byte array
final int COLUMNS = 32;
byte b[] = (byte[]) objs;
int printLen = len > LoggingConstants.MAX_DATA_LENGTH ? LoggingConstants.MAX_DATA_LENGTH : len;
sb.append(nlPad).append(objs.toString()).append(",len=").append(len); // depends on control dependency: [if], data = [none]
for (int i = 0; i < printLen; i++) {
if (i % COLUMNS == 0) // offset
sb.append(nlPadA + '|' + DataFormatHelper.padHexString(i, 4) + '|');
if (i % 4 == 0) // group in words
sb.append(" ");
sb.append(hexChars[(b[i] >> 4) & 0xF]); // depends on control dependency: [for], data = [i]
sb.append(hexChars[b[i] & 0xF]); // depends on control dependency: [for], data = [i]
}
if (printLen != len)
sb.append(nlPadA).append(" ...");
} else if (objs.getClass().getName().equals("[C")) {
// Character array - Just print it as a string rather than a single
// character on each line
sb.append((char[]) objs); // depends on control dependency: [if], data = [none]
} else { // not a Byte or char array
for (int i = 0; i < len; i++) {
String s = formatObj(Array.get(objs, i));
if (s.startsWith(LoggingConstants.nl))
sb.append(s);
else
sb.append(nlPad + s);
if (sb.length() > LoggingConstants.MAX_DATA_LENGTH) {
sb.append(nlPad + "..."); // depends on control dependency: [if], data = [none]
break;
}
}
}
ans = sb.toString(); // depends on control dependency: [if], data = [none]
} else if (objs instanceof Untraceable) {
ans = nlPad + objs.getClass().getName(); // Use only the class name of the object // depends on control dependency: [if], data = [none]
} else if (objs instanceof Traceable) {
ans = nlPad + formatTraceable((Traceable) objs); // depends on control dependency: [if], data = [none]
} else if (objs instanceof TruncatableThrowable) {
ans = nlPad + DataFormatHelper.throwableToString((TruncatableThrowable) objs); // depends on control dependency: [if], data = [none]
} else if (objs instanceof Throwable) {
ans = nlPad + DataFormatHelper.throwableToString(new TruncatableThrowable((Throwable) objs)); // depends on control dependency: [if], data = [none]
} else {
try { // Protect ourselves from badly behaved toString methods
ans = nlPad + objs.toString(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// No FFDC code needed
ans = "<Exception " + e + " caught while calling toString() on object " + objs.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(objs))
+ ">";
} // depends on control dependency: [catch], data = [none]
}
} else {
// objs is null - print out "null"
ans = nlPad + nullParamString; // depends on control dependency: [if], data = [none]
}
return ans;
} } |
public class class_name {
private void addAppendNodelets() {
parser.setXpath("/aspectran/append");
parser.addNodelet(attrs -> {
String file = attrs.get("file");
String resource = attrs.get("resource");
String url = attrs.get("url");
String format = attrs.get("format");
String profile = attrs.get("profile");
RuleAppendHandler appendHandler = assistant.getRuleAppendHandler();
if (appendHandler != null) {
AppendRule appendRule = AppendRule.newInstance(file, resource, url, format, profile);
appendHandler.pending(appendRule);
}
});
} } | public class class_name {
private void addAppendNodelets() {
parser.setXpath("/aspectran/append");
parser.addNodelet(attrs -> {
String file = attrs.get("file");
String resource = attrs.get("resource");
String url = attrs.get("url");
String format = attrs.get("format");
String profile = attrs.get("profile");
RuleAppendHandler appendHandler = assistant.getRuleAppendHandler();
if (appendHandler != null) {
AppendRule appendRule = AppendRule.newInstance(file, resource, url, format, profile);
appendHandler.pending(appendRule); // depends on control dependency: [if], data = [none]
}
});
} } |
public class class_name {
static DiscordianDate ofYearDay(int prolepticYear, int dayOfYear) {
DiscordianChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR);
DAY_OF_YEAR.checkValidValue(dayOfYear);
boolean leap = DiscordianChronology.INSTANCE.isLeapYear(prolepticYear);
if (dayOfYear == 366 && !leap) {
throw new DateTimeException("Invalid date 'DayOfYear 366' as '" + prolepticYear + "' is not a leap year");
}
if (leap) {
if (dayOfYear == ST_TIBS_OFFSET) {
// Take care of special case of St Tib's Day.
return new DiscordianDate(prolepticYear, 0, 0);
} else if (dayOfYear > ST_TIBS_OFFSET) {
// Offset dayOfYear to account for added day.
dayOfYear--;
}
}
int month = (dayOfYear - 1) / DAYS_IN_MONTH + 1;
int dayOfMonth = (dayOfYear - 1) % DAYS_IN_MONTH + 1;
return new DiscordianDate(prolepticYear, month, dayOfMonth);
} } | public class class_name {
static DiscordianDate ofYearDay(int prolepticYear, int dayOfYear) {
DiscordianChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR);
DAY_OF_YEAR.checkValidValue(dayOfYear);
boolean leap = DiscordianChronology.INSTANCE.isLeapYear(prolepticYear);
if (dayOfYear == 366 && !leap) {
throw new DateTimeException("Invalid date 'DayOfYear 366' as '" + prolepticYear + "' is not a leap year");
}
if (leap) {
if (dayOfYear == ST_TIBS_OFFSET) {
// Take care of special case of St Tib's Day.
return new DiscordianDate(prolepticYear, 0, 0); // depends on control dependency: [if], data = [none]
} else if (dayOfYear > ST_TIBS_OFFSET) {
// Offset dayOfYear to account for added day.
dayOfYear--; // depends on control dependency: [if], data = [none]
}
}
int month = (dayOfYear - 1) / DAYS_IN_MONTH + 1;
int dayOfMonth = (dayOfYear - 1) % DAYS_IN_MONTH + 1;
return new DiscordianDate(prolepticYear, month, dayOfMonth);
} } |
public class class_name {
protected void validateEqualField(String field_1, String field_2, String errorKey, String errorMessage) {
String value_1 = controller.getPara(field_1);
String value_2 = controller.getPara(field_2);
if (value_1 == null || value_2 == null || (! value_1.equals(value_2))) {
addError(errorKey, errorMessage);
}
} } | public class class_name {
protected void validateEqualField(String field_1, String field_2, String errorKey, String errorMessage) {
String value_1 = controller.getPara(field_1);
String value_2 = controller.getPara(field_2);
if (value_1 == null || value_2 == null || (! value_1.equals(value_2))) {
addError(errorKey, errorMessage);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void initActionHandler(final Window window) {
if (m_actionHandler != null) {
window.addActionHandler(m_actionHandler);
window.addCloseListener(new CloseListener() {
private static final long serialVersionUID = 1L;
public void windowClose(CloseEvent e) {
clearActionHandler(window);
}
});
}
} } | public class class_name {
public void initActionHandler(final Window window) {
if (m_actionHandler != null) {
window.addActionHandler(m_actionHandler); // depends on control dependency: [if], data = [(m_actionHandler]
window.addCloseListener(new CloseListener() {
private static final long serialVersionUID = 1L;
public void windowClose(CloseEvent e) {
clearActionHandler(window);
}
}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public synchronized void flush()
throws ObjectManagerException
{
final String methodName = "flush";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
methodName);
if (storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN) {
// Since we only flush on shutdown make sure we are shutting down, otherwise just return.
if (objectManagerState.getObjectManagerStateState() != ObjectManagerState.stateStopped) {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
return;
}
// If there are any active transactions it is not safe to flush.
if (objectManagerState.getTransactionIterator().hasNext()) {
trace.warning(this,
cclass,
methodName,
"ObjectStore_UnsafeToFlush",
this
);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
return;
}
} // if ( storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN ).
// Debug freespace list
// if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "START of Flush: newFreeSpace.size() = "+newFreeSpace.size());
// if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "START of Flush: freeSpaceByLength.size() = "+freeSpaceByLength.size());
// We are single threaded through flush, we are now about to make
// updates to the directory and free space map, which must be consistent.
// Also reserve space in the file for the directory updates and free space map.
updateDirectory();
// Release any space into the free space pool.
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this,
cclass,
methodName,
"Release new free space");
// Free up space that was release by directory changes, replaced or deleted Objects.
freeAllocatedSpace(newFreeSpace);
if (gatherStatistics) {
long now = System.currentTimeMillis();
releasingEntrySpaceMilliseconds += now - lastFlushMilliseconds;
lastFlushMilliseconds = now;
} // if (gatherStatistics).
// Write the modified parts of the directory to disk.
directory.write();
if (gatherStatistics) {
long now = System.currentTimeMillis();
directoryWriteMilliseconds += now - lastFlushMilliseconds;
lastFlushMilliseconds = now;
} // if (gatherStatistics).
// Write the free space map to disk.
writeFreeSpace();
// Force the data to disk then force the header, if we can make the assumption that
// these writes go to disk first, this first force is unnecessary.
if (storeStrategy == STRATEGY_KEEP_ALWAYS)
force();
writeHeader();
if (storeStrategy == STRATEGY_KEEP_ALWAYS)
force();
// Debug freespace list
// if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "END of Flush: newFreeSpace.size() = "+newFreeSpace.size());
// if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "END of Flush: freeSpaceByLength.size() = "+freeSpaceByLength.size());
// Defect 573905
// Reset the newFreeSpace after we have finished with it to release the
// memory it uses while we are not flushing.
newFreeSpace.clear();
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
} } | public class class_name {
public synchronized void flush()
throws ObjectManagerException
{
final String methodName = "flush";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
methodName);
if (storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN) {
// Since we only flush on shutdown make sure we are shutting down, otherwise just return.
if (objectManagerState.getObjectManagerStateState() != ObjectManagerState.stateStopped) {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
return; // depends on control dependency: [if], data = [none]
}
// If there are any active transactions it is not safe to flush.
if (objectManagerState.getTransactionIterator().hasNext()) {
trace.warning(this,
cclass,
methodName,
"ObjectStore_UnsafeToFlush",
this
); // depends on control dependency: [if], data = [none]
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
return; // depends on control dependency: [if], data = [none]
}
} // if ( storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN ).
// Debug freespace list
// if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "START of Flush: newFreeSpace.size() = "+newFreeSpace.size());
// if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "START of Flush: freeSpaceByLength.size() = "+freeSpaceByLength.size());
// We are single threaded through flush, we are now about to make
// updates to the directory and free space map, which must be consistent.
// Also reserve space in the file for the directory updates and free space map.
updateDirectory();
// Release any space into the free space pool.
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this,
cclass,
methodName,
"Release new free space");
// Free up space that was release by directory changes, replaced or deleted Objects.
freeAllocatedSpace(newFreeSpace);
if (gatherStatistics) {
long now = System.currentTimeMillis();
releasingEntrySpaceMilliseconds += now - lastFlushMilliseconds;
lastFlushMilliseconds = now;
} // if (gatherStatistics).
// Write the modified parts of the directory to disk.
directory.write();
if (gatherStatistics) {
long now = System.currentTimeMillis();
directoryWriteMilliseconds += now - lastFlushMilliseconds;
lastFlushMilliseconds = now;
} // if (gatherStatistics).
// Write the free space map to disk.
writeFreeSpace();
// Force the data to disk then force the header, if we can make the assumption that
// these writes go to disk first, this first force is unnecessary.
if (storeStrategy == STRATEGY_KEEP_ALWAYS)
force();
writeHeader();
if (storeStrategy == STRATEGY_KEEP_ALWAYS)
force();
// Debug freespace list
// if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "END of Flush: newFreeSpace.size() = "+newFreeSpace.size());
// if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "END of Flush: freeSpaceByLength.size() = "+freeSpaceByLength.size());
// Defect 573905
// Reset the newFreeSpace after we have finished with it to release the
// memory it uses while we are not flushing.
newFreeSpace.clear();
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
} } |
public class class_name {
private void waitForDisabled(String distId) {
long maxTime = 1800000; // 30 min
long start = System.currentTimeMillis();
boolean deployed = isDeployed(distId);
while (!deployed) {
if (System.currentTimeMillis() < start + maxTime) {
sleep(10000);
deployed = isDeployed(distId);
} else {
String error = "Timeout Reached waiting for distribution to " +
"be disabled. Please wait a few minutes and try again.";
throw new RuntimeException(error);
}
}
} } | public class class_name {
private void waitForDisabled(String distId) {
long maxTime = 1800000; // 30 min
long start = System.currentTimeMillis();
boolean deployed = isDeployed(distId);
while (!deployed) {
if (System.currentTimeMillis() < start + maxTime) {
sleep(10000); // depends on control dependency: [if], data = [none]
deployed = isDeployed(distId); // depends on control dependency: [if], data = [none]
} else {
String error = "Timeout Reached waiting for distribution to " +
"be disabled. Please wait a few minutes and try again.";
throw new RuntimeException(error);
}
}
} } |
public class class_name {
public TimephasedCostContainer getBaselineCost(ProjectCalendar calendar, TimephasedCostNormaliser normaliser, byte[] data, boolean raw)
{
TimephasedCostContainer result = null;
if (data != null && data.length > 0)
{
LinkedList<TimephasedCost> list = null;
//System.out.println(ByteArrayHelper.hexdump(data, false));
int index = 16; // 16 byte header
int blockSize = 20;
double previousTotalCost = 0;
Date blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 16);
index += blockSize;
while (index + blockSize <= data.length)
{
Date blockEndDate = MPPUtility.getTimestampFromTenths(data, index + 16);
double currentTotalCost = (double) ((long) MPPUtility.getDouble(data, index + 8)) / 100;
if (!costEquals(previousTotalCost, currentTotalCost))
{
TimephasedCost cost = new TimephasedCost();
cost.setStart(blockStartDate);
cost.setFinish(blockEndDate);
cost.setTotalAmount(Double.valueOf(currentTotalCost - previousTotalCost));
if (list == null)
{
list = new LinkedList<TimephasedCost>();
}
list.add(cost);
//System.out.println(cost);
previousTotalCost = currentTotalCost;
}
blockStartDate = blockEndDate;
index += blockSize;
}
if (list != null)
{
result = new DefaultTimephasedCostContainer(calendar, normaliser, list, raw);
}
}
return result;
} } | public class class_name {
public TimephasedCostContainer getBaselineCost(ProjectCalendar calendar, TimephasedCostNormaliser normaliser, byte[] data, boolean raw)
{
TimephasedCostContainer result = null;
if (data != null && data.length > 0)
{
LinkedList<TimephasedCost> list = null;
//System.out.println(ByteArrayHelper.hexdump(data, false));
int index = 16; // 16 byte header
int blockSize = 20;
double previousTotalCost = 0;
Date blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 16);
index += blockSize; // depends on control dependency: [if], data = [none]
while (index + blockSize <= data.length)
{
Date blockEndDate = MPPUtility.getTimestampFromTenths(data, index + 16);
double currentTotalCost = (double) ((long) MPPUtility.getDouble(data, index + 8)) / 100;
if (!costEquals(previousTotalCost, currentTotalCost))
{
TimephasedCost cost = new TimephasedCost();
cost.setStart(blockStartDate); // depends on control dependency: [if], data = [none]
cost.setFinish(blockEndDate); // depends on control dependency: [if], data = [none]
cost.setTotalAmount(Double.valueOf(currentTotalCost - previousTotalCost)); // depends on control dependency: [if], data = [none]
if (list == null)
{
list = new LinkedList<TimephasedCost>(); // depends on control dependency: [if], data = [none]
}
list.add(cost); // depends on control dependency: [if], data = [none]
//System.out.println(cost);
previousTotalCost = currentTotalCost; // depends on control dependency: [if], data = [none]
}
blockStartDate = blockEndDate; // depends on control dependency: [while], data = [none]
index += blockSize; // depends on control dependency: [while], data = [none]
}
if (list != null)
{
result = new DefaultTimephasedCostContainer(calendar, normaliser, list, raw); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
protected void other() {
while (true) {
Scanner scanner = new Scanner(System.in);
if (scanner.hasNext()) {
String text = scanner.next();
if ("quit".equals(text) || "exit".equals(text)) {
api.logout();
break;
}
}
DateUtils.sleep(100);
}
} } | public class class_name {
protected void other() {
while (true) {
Scanner scanner = new Scanner(System.in);
if (scanner.hasNext()) {
String text = scanner.next();
if ("quit".equals(text) || "exit".equals(text)) {
api.logout(); // depends on control dependency: [if], data = [none]
break;
}
}
DateUtils.sleep(100); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private String getAppFileName(MavenProject project) {
String name = project.getBuild().getFinalName() + "." + project.getPackaging();
if (project.getPackaging().equals("liberty-assembly")) {
name = project.getBuild().getFinalName() + ".war";
}
if (stripVersion) {
name = stripVersionFromName(name, project.getVersion());
}
return name;
} } | public class class_name {
private String getAppFileName(MavenProject project) {
String name = project.getBuild().getFinalName() + "." + project.getPackaging();
if (project.getPackaging().equals("liberty-assembly")) {
name = project.getBuild().getFinalName() + ".war"; // depends on control dependency: [if], data = [none]
}
if (stripVersion) {
name = stripVersionFromName(name, project.getVersion()); // depends on control dependency: [if], data = [none]
}
return name;
} } |
public class class_name {
public void visitDependences(Archive source, Visitor v, Type level) {
if (level == Type.SUMMARY) {
final ArchiveDeps result = results.get(source);
SortedMap<String, Archive> sorted = new TreeMap<>();
for (Archive a : result.requires()) {
sorted.put(a.getName(), a);
}
for (Archive archive : sorted.values()) {
Profile profile = result.getTargetProfile(archive);
v.visitDependence(source.getName(), source,
profile != null ? profile.profileName() : archive.getName(), archive);
}
} else {
ArchiveDeps result = results.get(source);
if (level != type) {
// requesting different level of analysis
result = new ArchiveDeps(source, level);
source.visitDependences(result);
}
SortedSet<Dep> sorted = new TreeSet<>(result.dependencies());
for (Dep d : sorted) {
v.visitDependence(d.origin(), d.originArchive(), d.target(), d.targetArchive());
}
}
} } | public class class_name {
public void visitDependences(Archive source, Visitor v, Type level) {
if (level == Type.SUMMARY) {
final ArchiveDeps result = results.get(source);
SortedMap<String, Archive> sorted = new TreeMap<>();
for (Archive a : result.requires()) {
sorted.put(a.getName(), a); // depends on control dependency: [for], data = [a]
}
for (Archive archive : sorted.values()) {
Profile profile = result.getTargetProfile(archive);
v.visitDependence(source.getName(), source,
profile != null ? profile.profileName() : archive.getName(), archive); // depends on control dependency: [for], data = [none]
}
} else {
ArchiveDeps result = results.get(source);
if (level != type) {
// requesting different level of analysis
result = new ArchiveDeps(source, level); // depends on control dependency: [if], data = [none]
source.visitDependences(result); // depends on control dependency: [if], data = [none]
}
SortedSet<Dep> sorted = new TreeSet<>(result.dependencies());
for (Dep d : sorted) {
v.visitDependence(d.origin(), d.originArchive(), d.target(), d.targetArchive()); // depends on control dependency: [for], data = [d]
}
}
} } |
public class class_name {
@Override
@Deprecated
protected void handleTransliterate(Replaceable text,
Position index, boolean incremental) {
/* We keep start and limit fixed the entire time,
* relative to the text -- limit may move numerically if text is
* inserted or removed. The cursor moves from start to limit, with
* replacements happening under it.
*
* Example: rules 1. ab>x|y
* 2. yc>z
*
* |eabcd start - no match, advance cursor
* e|abcd match rule 1 - change text & adjust cursor
* ex|ycd match rule 2 - change text & adjust cursor
* exz|d no match, advance cursor
* exzd| done
*/
/* A rule like
* a>b|a
* creates an infinite loop. To prevent that, we put an arbitrary
* limit on the number of iterations that we take, one that is
* high enough that any reasonable rules are ok, but low enough to
* prevent a server from hanging. The limit is 16 times the
* number of characters n, unless n is so large that 16n exceeds a
* uint32_t.
*/
synchronized(data) {
int loopCount = 0;
int loopLimit = (index.limit - index.start) << 4;
if (loopLimit < 0) {
loopLimit = 0x7FFFFFFF;
}
while (index.start < index.limit &&
loopCount <= loopLimit &&
data.ruleSet.transliterate(text, index, incremental)) {
++loopCount;
}
}
} } | public class class_name {
@Override
@Deprecated
protected void handleTransliterate(Replaceable text,
Position index, boolean incremental) {
/* We keep start and limit fixed the entire time,
* relative to the text -- limit may move numerically if text is
* inserted or removed. The cursor moves from start to limit, with
* replacements happening under it.
*
* Example: rules 1. ab>x|y
* 2. yc>z
*
* |eabcd start - no match, advance cursor
* e|abcd match rule 1 - change text & adjust cursor
* ex|ycd match rule 2 - change text & adjust cursor
* exz|d no match, advance cursor
* exzd| done
*/
/* A rule like
* a>b|a
* creates an infinite loop. To prevent that, we put an arbitrary
* limit on the number of iterations that we take, one that is
* high enough that any reasonable rules are ok, but low enough to
* prevent a server from hanging. The limit is 16 times the
* number of characters n, unless n is so large that 16n exceeds a
* uint32_t.
*/
synchronized(data) {
int loopCount = 0;
int loopLimit = (index.limit - index.start) << 4;
if (loopLimit < 0) {
loopLimit = 0x7FFFFFFF; // depends on control dependency: [if], data = [none]
}
while (index.start < index.limit &&
loopCount <= loopLimit &&
data.ruleSet.transliterate(text, index, incremental)) {
++loopCount; // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
public void marshall(TrainingJob trainingJob, ProtocolMarshaller protocolMarshaller) {
if (trainingJob == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(trainingJob.getTrainingJobName(), TRAININGJOBNAME_BINDING);
protocolMarshaller.marshall(trainingJob.getTrainingJobArn(), TRAININGJOBARN_BINDING);
protocolMarshaller.marshall(trainingJob.getTuningJobArn(), TUNINGJOBARN_BINDING);
protocolMarshaller.marshall(trainingJob.getLabelingJobArn(), LABELINGJOBARN_BINDING);
protocolMarshaller.marshall(trainingJob.getModelArtifacts(), MODELARTIFACTS_BINDING);
protocolMarshaller.marshall(trainingJob.getTrainingJobStatus(), TRAININGJOBSTATUS_BINDING);
protocolMarshaller.marshall(trainingJob.getSecondaryStatus(), SECONDARYSTATUS_BINDING);
protocolMarshaller.marshall(trainingJob.getFailureReason(), FAILUREREASON_BINDING);
protocolMarshaller.marshall(trainingJob.getHyperParameters(), HYPERPARAMETERS_BINDING);
protocolMarshaller.marshall(trainingJob.getAlgorithmSpecification(), ALGORITHMSPECIFICATION_BINDING);
protocolMarshaller.marshall(trainingJob.getRoleArn(), ROLEARN_BINDING);
protocolMarshaller.marshall(trainingJob.getInputDataConfig(), INPUTDATACONFIG_BINDING);
protocolMarshaller.marshall(trainingJob.getOutputDataConfig(), OUTPUTDATACONFIG_BINDING);
protocolMarshaller.marshall(trainingJob.getResourceConfig(), RESOURCECONFIG_BINDING);
protocolMarshaller.marshall(trainingJob.getVpcConfig(), VPCCONFIG_BINDING);
protocolMarshaller.marshall(trainingJob.getStoppingCondition(), STOPPINGCONDITION_BINDING);
protocolMarshaller.marshall(trainingJob.getCreationTime(), CREATIONTIME_BINDING);
protocolMarshaller.marshall(trainingJob.getTrainingStartTime(), TRAININGSTARTTIME_BINDING);
protocolMarshaller.marshall(trainingJob.getTrainingEndTime(), TRAININGENDTIME_BINDING);
protocolMarshaller.marshall(trainingJob.getLastModifiedTime(), LASTMODIFIEDTIME_BINDING);
protocolMarshaller.marshall(trainingJob.getSecondaryStatusTransitions(), SECONDARYSTATUSTRANSITIONS_BINDING);
protocolMarshaller.marshall(trainingJob.getFinalMetricDataList(), FINALMETRICDATALIST_BINDING);
protocolMarshaller.marshall(trainingJob.getEnableNetworkIsolation(), ENABLENETWORKISOLATION_BINDING);
protocolMarshaller.marshall(trainingJob.getEnableInterContainerTrafficEncryption(), ENABLEINTERCONTAINERTRAFFICENCRYPTION_BINDING);
protocolMarshaller.marshall(trainingJob.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(TrainingJob trainingJob, ProtocolMarshaller protocolMarshaller) {
if (trainingJob == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(trainingJob.getTrainingJobName(), TRAININGJOBNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getTrainingJobArn(), TRAININGJOBARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getTuningJobArn(), TUNINGJOBARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getLabelingJobArn(), LABELINGJOBARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getModelArtifacts(), MODELARTIFACTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getTrainingJobStatus(), TRAININGJOBSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getSecondaryStatus(), SECONDARYSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getFailureReason(), FAILUREREASON_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getHyperParameters(), HYPERPARAMETERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getAlgorithmSpecification(), ALGORITHMSPECIFICATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getRoleArn(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getInputDataConfig(), INPUTDATACONFIG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getOutputDataConfig(), OUTPUTDATACONFIG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getResourceConfig(), RESOURCECONFIG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getVpcConfig(), VPCCONFIG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getStoppingCondition(), STOPPINGCONDITION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getCreationTime(), CREATIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getTrainingStartTime(), TRAININGSTARTTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getTrainingEndTime(), TRAININGENDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getLastModifiedTime(), LASTMODIFIEDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getSecondaryStatusTransitions(), SECONDARYSTATUSTRANSITIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getFinalMetricDataList(), FINALMETRICDATALIST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getEnableNetworkIsolation(), ENABLENETWORKISOLATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getEnableInterContainerTrafficEncryption(), ENABLEINTERCONTAINERTRAFFICENCRYPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trainingJob.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(ListQualificationRequestsRequest listQualificationRequestsRequest, ProtocolMarshaller protocolMarshaller) {
if (listQualificationRequestsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listQualificationRequestsRequest.getQualificationTypeId(), QUALIFICATIONTYPEID_BINDING);
protocolMarshaller.marshall(listQualificationRequestsRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listQualificationRequestsRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListQualificationRequestsRequest listQualificationRequestsRequest, ProtocolMarshaller protocolMarshaller) {
if (listQualificationRequestsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listQualificationRequestsRequest.getQualificationTypeId(), QUALIFICATIONTYPEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listQualificationRequestsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listQualificationRequestsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
Expr sharedMethod() {
Tok tok = peek();
if (tok.sym != Sym.ID) {
return indexMethodField(null);
}
if (move().sym != Sym.LPAREN) {
resetForward(forward - 1);
return indexMethodField(null);
}
move();
if (peek().sym == Sym.RPAREN) {
SharedMethod sharedMethod = new SharedMethod(engineConfig.getSharedMethodKit(), tok.value(), ExprList.NULL_EXPR_LIST, location);
move();
return indexMethodField(sharedMethod);
}
ExprList exprList = exprList();
SharedMethod sharedMethod = new SharedMethod(engineConfig.getSharedMethodKit(), tok.value(), exprList, location);
match(Sym.RPAREN);
return indexMethodField(sharedMethod);
} } | public class class_name {
Expr sharedMethod() {
Tok tok = peek();
if (tok.sym != Sym.ID) {
return indexMethodField(null);
// depends on control dependency: [if], data = [none]
}
if (move().sym != Sym.LPAREN) {
resetForward(forward - 1);
// depends on control dependency: [if], data = [none]
return indexMethodField(null);
// depends on control dependency: [if], data = [none]
}
move();
if (peek().sym == Sym.RPAREN) {
SharedMethod sharedMethod = new SharedMethod(engineConfig.getSharedMethodKit(), tok.value(), ExprList.NULL_EXPR_LIST, location);
move();
// depends on control dependency: [if], data = [none]
return indexMethodField(sharedMethod);
// depends on control dependency: [if], data = [none]
}
ExprList exprList = exprList();
SharedMethod sharedMethod = new SharedMethod(engineConfig.getSharedMethodKit(), tok.value(), exprList, location);
match(Sym.RPAREN);
return indexMethodField(sharedMethod);
} } |
public class class_name {
public <S extends Storable> void register(Class<S> type, Cursor<S> cursor) {
mLock.lock();
try {
checkClosed();
if (mCursors == null) {
mCursors = new IdentityHashMap<Class<?>, CursorList<TransactionImpl<Txn>>>();
}
CursorList<TransactionImpl<Txn>> cursorList = mCursors.get(type);
if (cursorList == null) {
cursorList = new CursorList<TransactionImpl<Txn>>();
mCursors.put(type, cursorList);
}
cursorList.register(cursor, mActive);
if (mActive != null) {
mActive.register(cursor);
}
} finally {
mLock.unlock();
}
} } | public class class_name {
public <S extends Storable> void register(Class<S> type, Cursor<S> cursor) {
mLock.lock();
try {
checkClosed();
// depends on control dependency: [try], data = [none]
if (mCursors == null) {
mCursors = new IdentityHashMap<Class<?>, CursorList<TransactionImpl<Txn>>>();
// depends on control dependency: [if], data = [none]
}
CursorList<TransactionImpl<Txn>> cursorList = mCursors.get(type);
if (cursorList == null) {
cursorList = new CursorList<TransactionImpl<Txn>>();
// depends on control dependency: [if], data = [none]
mCursors.put(type, cursorList);
// depends on control dependency: [if], data = [none]
}
cursorList.register(cursor, mActive);
// depends on control dependency: [try], data = [none]
if (mActive != null) {
mActive.register(cursor);
// depends on control dependency: [if], data = [none]
}
} finally {
mLock.unlock();
}
} } |
public class class_name {
private static PersistenceUnitMetadata parsePersistenceUnit(final URL url, final String[] persistenceUnits,
Element top, final String versionName)
{
PersistenceUnitMetadata metadata = new PersistenceUnitMetadata(versionName, getPersistenceRootUrl(url), url);
String puName = top.getAttribute("name");
if (!Arrays.asList(persistenceUnits).contains(puName))
{
// Returning null because this persistence unit is not intended for
// creating entity manager factory.
return null;
}
if (!isEmpty(puName))
{
log.trace("Persistent Unit name from persistence.xml: " + puName);
metadata.setPersistenceUnitName(puName);
String transactionType = top.getAttribute("transaction-type");
if (StringUtils.isEmpty(transactionType)
|| PersistenceUnitTransactionType.RESOURCE_LOCAL.name().equals(transactionType))
{
metadata.setTransactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL);
}
else if (PersistenceUnitTransactionType.JTA.name().equals(transactionType))
{
metadata.setTransactionType(PersistenceUnitTransactionType.JTA);
}
}
NodeList children = top.getChildNodes();
for (int i = 0; i < children.getLength(); i++)
{
if (children.item(i).getNodeType() == Node.ELEMENT_NODE)
{
Element element = (Element) children.item(i);
String tag = element.getTagName();
if (tag.equals("provider"))
{
metadata.setProvider(getElementContent(element));
}
else if (tag.equals("properties"))
{
NodeList props = element.getChildNodes();
for (int j = 0; j < props.getLength(); j++)
{
if (props.item(j).getNodeType() == Node.ELEMENT_NODE)
{
Element propElement = (Element) props.item(j);
// if element is not "property" then skip
if (!"property".equals(propElement.getTagName()))
{
continue;
}
String propName = propElement.getAttribute("name").trim();
String propValue = propElement.getAttribute("value").trim();
if (isEmpty(propValue))
{
propValue = getElementContent(propElement, "");
}
metadata.getProperties().put(propName, propValue);
}
}
}
else if (tag.equals("class"))
{
metadata.getClasses().add(getElementContent(element));
}
else if (tag.equals("jar-file"))
{
metadata.addJarFile(getElementContent(element));
}
else if (tag.equals("exclude-unlisted-classes"))
{
String excludeUnlisted = getElementContent(element);
metadata.setExcludeUnlistedClasses(Boolean.parseBoolean(excludeUnlisted));
}
}
}
PersistenceUnitTransactionType transactionType = getTransactionType(top.getAttribute("transaction-type"));
if (transactionType != null)
{
metadata.setTransactionType(transactionType);
}
return metadata;
} } | public class class_name {
private static PersistenceUnitMetadata parsePersistenceUnit(final URL url, final String[] persistenceUnits,
Element top, final String versionName)
{
PersistenceUnitMetadata metadata = new PersistenceUnitMetadata(versionName, getPersistenceRootUrl(url), url);
String puName = top.getAttribute("name");
if (!Arrays.asList(persistenceUnits).contains(puName))
{
// Returning null because this persistence unit is not intended for
// creating entity manager factory.
return null;
// depends on control dependency: [if], data = [none]
}
if (!isEmpty(puName))
{
log.trace("Persistent Unit name from persistence.xml: " + puName);
// depends on control dependency: [if], data = [none]
metadata.setPersistenceUnitName(puName);
// depends on control dependency: [if], data = [none]
String transactionType = top.getAttribute("transaction-type");
if (StringUtils.isEmpty(transactionType)
|| PersistenceUnitTransactionType.RESOURCE_LOCAL.name().equals(transactionType))
{
metadata.setTransactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL);
// depends on control dependency: [if], data = [none]
}
else if (PersistenceUnitTransactionType.JTA.name().equals(transactionType))
{
metadata.setTransactionType(PersistenceUnitTransactionType.JTA);
// depends on control dependency: [if], data = [none]
}
}
NodeList children = top.getChildNodes();
for (int i = 0; i < children.getLength(); i++)
{
if (children.item(i).getNodeType() == Node.ELEMENT_NODE)
{
Element element = (Element) children.item(i);
String tag = element.getTagName();
if (tag.equals("provider"))
{
metadata.setProvider(getElementContent(element));
// depends on control dependency: [if], data = [none]
}
else if (tag.equals("properties"))
{
NodeList props = element.getChildNodes();
for (int j = 0; j < props.getLength(); j++)
{
if (props.item(j).getNodeType() == Node.ELEMENT_NODE)
{
Element propElement = (Element) props.item(j);
// if element is not "property" then skip
if (!"property".equals(propElement.getTagName()))
{
continue;
}
String propName = propElement.getAttribute("name").trim();
String propValue = propElement.getAttribute("value").trim();
if (isEmpty(propValue))
{
propValue = getElementContent(propElement, "");
// depends on control dependency: [if], data = [none]
}
metadata.getProperties().put(propName, propValue);
// depends on control dependency: [if], data = [none]
}
}
}
else if (tag.equals("class"))
{
metadata.getClasses().add(getElementContent(element));
// depends on control dependency: [if], data = [none]
}
else if (tag.equals("jar-file"))
{
metadata.addJarFile(getElementContent(element));
// depends on control dependency: [if], data = [none]
}
else if (tag.equals("exclude-unlisted-classes"))
{
String excludeUnlisted = getElementContent(element);
metadata.setExcludeUnlistedClasses(Boolean.parseBoolean(excludeUnlisted));
// depends on control dependency: [if], data = [none]
}
}
}
PersistenceUnitTransactionType transactionType = getTransactionType(top.getAttribute("transaction-type"));
if (transactionType != null)
{
metadata.setTransactionType(transactionType);
// depends on control dependency: [if], data = [(transactionType]
}
return metadata;
} } |
public class class_name {
@Override
public void doFilterWriteListeners(final long sessionId, final long sessionWrittenBytes, final WriteRequest writeRequest) {
runManagementTask(new Runnable() {
@Override
public void run() {
try {
// The particular management listeners change on strategy, so get them here.
for (final GatewayManagementListener listener : getManagementListeners()) {
listener.doFilterWrite(GatewayManagementBeanImpl.this, sessionId);
}
markChanged(); // mark ourselves as changed, possibly tell listeners
} catch (Exception ex) {
logger.warn("Error during filterWrite gateway listener notifications:", ex);
}
}
});
} } | public class class_name {
@Override
public void doFilterWriteListeners(final long sessionId, final long sessionWrittenBytes, final WriteRequest writeRequest) {
runManagementTask(new Runnable() {
@Override
public void run() {
try {
// The particular management listeners change on strategy, so get them here.
for (final GatewayManagementListener listener : getManagementListeners()) {
listener.doFilterWrite(GatewayManagementBeanImpl.this, sessionId); // depends on control dependency: [for], data = [listener]
}
markChanged(); // mark ourselves as changed, possibly tell listeners // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
logger.warn("Error during filterWrite gateway listener notifications:", ex);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
private static void generateParserOnXmlStartElement(BindTypeContext context, MethodSpec.Builder methodBuilder,
String instanceName, String parserName, BindEntity entity) {
BindTransform bindTransform;
// start and inner bean
methodBuilder.addStatement("currentTag = xmlParser.getName().toString()");
int count = 0;
// count property to manage
{
// for each elements
for (BindProperty property : entity.getCollection()) {
if (property.xmlInfo.xmlType != XmlType.TAG)
continue;
bindTransform = BindTransformer.lookup(property);
// here we manage only property of bean type
if (bindTransform != null) {
count++;
}
}
}
if (count > 0) {
// switch for tag elements
// @formatter:off
methodBuilder.beginControlFlow("switch(currentTag)$>");
// for each elements
for (BindProperty property : entity.getCollection()) {
if (property.xmlInfo.xmlType != XmlType.TAG)
continue;
bindTransform = BindTransformer.lookup(property);
// here we manage only property of bean type
if (bindTransform != null) {
methodBuilder.addCode("case $S:\n$>", BindProperty.xmlName(property));
methodBuilder.addCode("// property $L (mapped on $S)\n", property.getName(),
BindProperty.xmlName(property));
// methodBuilder.beginControlFlow("if
// (!xmlParser.isEmptyElement())");
bindTransform.generateParseOnXml(context, methodBuilder, "xmlParser",
property.getPropertyType().getTypeName(), "instance", property);
// methodBuilder.endControlFlow();
methodBuilder.addStatement("$<break");
}
}
methodBuilder.addCode("default:\n$>");
// methodBuilder.addStatement("$L.skipElement()", parserName);
methodBuilder.addStatement("$<break");
methodBuilder.endControlFlow();
} else {
methodBuilder.addCode("// No property to manage here\n");
}
// @formatter:on
} } | public class class_name {
private static void generateParserOnXmlStartElement(BindTypeContext context, MethodSpec.Builder methodBuilder,
String instanceName, String parserName, BindEntity entity) {
BindTransform bindTransform;
// start and inner bean
methodBuilder.addStatement("currentTag = xmlParser.getName().toString()");
int count = 0;
// count property to manage
{
// for each elements
for (BindProperty property : entity.getCollection()) {
if (property.xmlInfo.xmlType != XmlType.TAG)
continue;
bindTransform = BindTransformer.lookup(property); // depends on control dependency: [for], data = [property]
// here we manage only property of bean type
if (bindTransform != null) {
count++; // depends on control dependency: [if], data = [none]
}
}
}
if (count > 0) {
// switch for tag elements
// @formatter:off
methodBuilder.beginControlFlow("switch(currentTag)$>");
// for each elements
for (BindProperty property : entity.getCollection()) {
if (property.xmlInfo.xmlType != XmlType.TAG)
continue;
bindTransform = BindTransformer.lookup(property);
// here we manage only property of bean type
if (bindTransform != null) {
methodBuilder.addCode("case $S:\n$>", BindProperty.xmlName(property));
methodBuilder.addCode("// property $L (mapped on $S)\n", property.getName(),
BindProperty.xmlName(property));
// methodBuilder.beginControlFlow("if
// (!xmlParser.isEmptyElement())");
bindTransform.generateParseOnXml(context, methodBuilder, "xmlParser",
property.getPropertyType().getTypeName(), "instance", property);
// methodBuilder.endControlFlow();
methodBuilder.addStatement("$<break");
}
}
methodBuilder.addCode("default:\n$>");
// methodBuilder.addStatement("$L.skipElement()", parserName);
methodBuilder.addStatement("$<break");
methodBuilder.endControlFlow();
} else {
methodBuilder.addCode("// No property to manage here\n");
}
// @formatter:on
} } |
public class class_name {
private void addPostParams(final Request request) {
if (command != null) {
request.addPostParam("Command", command);
}
if (device != null) {
request.addPostParam("Device", device);
}
if (sim != null) {
request.addPostParam("Sim", sim);
}
if (callbackMethod != null) {
request.addPostParam("CallbackMethod", callbackMethod);
}
if (callbackUrl != null) {
request.addPostParam("CallbackUrl", callbackUrl.toString());
}
if (commandMode != null) {
request.addPostParam("CommandMode", commandMode);
}
if (includeSid != null) {
request.addPostParam("IncludeSid", includeSid);
}
} } | public class class_name {
private void addPostParams(final Request request) {
if (command != null) {
request.addPostParam("Command", command); // depends on control dependency: [if], data = [none]
}
if (device != null) {
request.addPostParam("Device", device); // depends on control dependency: [if], data = [none]
}
if (sim != null) {
request.addPostParam("Sim", sim); // depends on control dependency: [if], data = [none]
}
if (callbackMethod != null) {
request.addPostParam("CallbackMethod", callbackMethod); // depends on control dependency: [if], data = [none]
}
if (callbackUrl != null) {
request.addPostParam("CallbackUrl", callbackUrl.toString()); // depends on control dependency: [if], data = [none]
}
if (commandMode != null) {
request.addPostParam("CommandMode", commandMode); // depends on control dependency: [if], data = [none]
}
if (includeSid != null) {
request.addPostParam("IncludeSid", includeSid); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static List<Locale> localeLookupList(final Locale locale, final Locale defaultLocale) {
final List<Locale> list = new ArrayList<>(4);
if (locale != null) {
list.add(locale);
if (locale.getVariant().length() > 0) {
list.add(new Locale(locale.getLanguage(), locale.getCountry()));
}
if (locale.getCountry().length() > 0) {
list.add(new Locale(locale.getLanguage(), StringUtils.EMPTY));
}
if (!list.contains(defaultLocale)) {
list.add(defaultLocale);
}
}
return Collections.unmodifiableList(list);
} } | public class class_name {
public static List<Locale> localeLookupList(final Locale locale, final Locale defaultLocale) {
final List<Locale> list = new ArrayList<>(4);
if (locale != null) {
list.add(locale); // depends on control dependency: [if], data = [(locale]
if (locale.getVariant().length() > 0) {
list.add(new Locale(locale.getLanguage(), locale.getCountry())); // depends on control dependency: [if], data = [none]
}
if (locale.getCountry().length() > 0) {
list.add(new Locale(locale.getLanguage(), StringUtils.EMPTY)); // depends on control dependency: [if], data = [none]
}
if (!list.contains(defaultLocale)) {
list.add(defaultLocale); // depends on control dependency: [if], data = [none]
}
}
return Collections.unmodifiableList(list);
} } |
public class class_name {
private static void mergeBlocks(List< Block > blocks) {
for (int i = 1; i < blocks.size(); i++) {
Block b1 = blocks.get(i - 1);
Block b2 = blocks.get(i);
if ((b1.mode == b2.mode) &&
(b1.mode != EncodingMode.NUM || b1.length + b2.length <= MAX_NUMERIC_COMPACTION_BLOCK_SIZE)) {
b1.length += b2.length;
blocks.remove(i);
i--;
}
}
} } | public class class_name {
private static void mergeBlocks(List< Block > blocks) {
for (int i = 1; i < blocks.size(); i++) {
Block b1 = blocks.get(i - 1);
Block b2 = blocks.get(i);
if ((b1.mode == b2.mode) &&
(b1.mode != EncodingMode.NUM || b1.length + b2.length <= MAX_NUMERIC_COMPACTION_BLOCK_SIZE)) {
b1.length += b2.length;
// depends on control dependency: [if], data = [none]
blocks.remove(i);
// depends on control dependency: [if], data = [none]
i--;
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public Map<Object, Object> getSwappableData() {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[GET_SWAPPABLE_DATA]);
}
if (mSwappableData == null) {
if (!isNew() && !usingMultirow && !populatedAppData) {
getSingleRowAppData(); // populate mSwappableData for single row db only, NOT multirow
}
//mSwappableData could have been updated
if (mSwappableData == null) {
mSwappableData = new Hashtable();
if (isNew()) {
//if this is a new session, then we have the updated app data
populatedAppData = true;
}
}
}
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[GET_SWAPPABLE_DATA]);
}
return mSwappableData;
} } | public class class_name {
public Map<Object, Object> getSwappableData() {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[GET_SWAPPABLE_DATA]); // depends on control dependency: [if], data = [none]
}
if (mSwappableData == null) {
if (!isNew() && !usingMultirow && !populatedAppData) {
getSingleRowAppData(); // populate mSwappableData for single row db only, NOT multirow // depends on control dependency: [if], data = [none]
}
//mSwappableData could have been updated
if (mSwappableData == null) {
mSwappableData = new Hashtable(); // depends on control dependency: [if], data = [none]
if (isNew()) {
//if this is a new session, then we have the updated app data
populatedAppData = true; // depends on control dependency: [if], data = [none]
}
}
}
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINER)) {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[GET_SWAPPABLE_DATA]); // depends on control dependency: [if], data = [none]
}
return mSwappableData;
} } |
public class class_name {
double getTmpLatitude(int id) {
if (id == EMPTY_NODE)
return Double.NaN;
if (id < TOWER_NODE) {
// tower node
id = -id - 3;
return nodeAccess.getLatitude(id);
} else if (id > -TOWER_NODE) {
// pillar node
id = id - 3;
return pillarInfo.getLatitude(id);
} else
// e.g. if id is not handled from preparse (e.g. was ignored via isInBounds)
return Double.NaN;
} } | public class class_name {
double getTmpLatitude(int id) {
if (id == EMPTY_NODE)
return Double.NaN;
if (id < TOWER_NODE) {
// tower node
id = -id - 3; // depends on control dependency: [if], data = [none]
return nodeAccess.getLatitude(id); // depends on control dependency: [if], data = [(id]
} else if (id > -TOWER_NODE) {
// pillar node
id = id - 3; // depends on control dependency: [if], data = [none]
return pillarInfo.getLatitude(id); // depends on control dependency: [if], data = [(id]
} else
// e.g. if id is not handled from preparse (e.g. was ignored via isInBounds)
return Double.NaN;
} } |
public class class_name {
protected List<HttpMessage> getSelectedMessages(HttpMessageContainer httpMessageContainer) {
if (httpMessageContainer instanceof SelectableHttpMessagesContainer) {
return ((SelectableHttpMessagesContainer) httpMessageContainer).getSelectedMessages();
} else if (httpMessageContainer instanceof SingleHttpMessageContainer) {
SingleHttpMessageContainer singleMessageContainer = (SingleHttpMessageContainer) httpMessageContainer;
if (!singleMessageContainer.isEmpty()) {
List<HttpMessage> selectedHttpMessages = new ArrayList<>(1);
selectedHttpMessages.add((((SingleHttpMessageContainer) httpMessageContainer).getMessage()));
return selectedHttpMessages;
}
}
return Collections.emptyList();
} } | public class class_name {
protected List<HttpMessage> getSelectedMessages(HttpMessageContainer httpMessageContainer) {
if (httpMessageContainer instanceof SelectableHttpMessagesContainer) {
return ((SelectableHttpMessagesContainer) httpMessageContainer).getSelectedMessages(); // depends on control dependency: [if], data = [none]
} else if (httpMessageContainer instanceof SingleHttpMessageContainer) {
SingleHttpMessageContainer singleMessageContainer = (SingleHttpMessageContainer) httpMessageContainer;
if (!singleMessageContainer.isEmpty()) {
List<HttpMessage> selectedHttpMessages = new ArrayList<>(1);
selectedHttpMessages.add((((SingleHttpMessageContainer) httpMessageContainer).getMessage())); // depends on control dependency: [if], data = [none]
return selectedHttpMessages; // depends on control dependency: [if], data = [none]
}
}
return Collections.emptyList();
} } |
public class class_name {
private boolean isAbandoned(final SubmittedPrintJob printJob) {
final long duration = ThreadPoolJobManager.this.jobQueue.timeSinceLastStatusCheck(
printJob.getEntry().getReferenceId());
final boolean abandoned =
duration > TimeUnit.SECONDS.toMillis(ThreadPoolJobManager.this.abandonedTimeout);
if (abandoned) {
LOGGER.info("Job {} is abandoned (no status check within the last {} seconds)",
printJob.getEntry().getReferenceId(), ThreadPoolJobManager.this.abandonedTimeout);
}
return abandoned;
} } | public class class_name {
private boolean isAbandoned(final SubmittedPrintJob printJob) {
final long duration = ThreadPoolJobManager.this.jobQueue.timeSinceLastStatusCheck(
printJob.getEntry().getReferenceId());
final boolean abandoned =
duration > TimeUnit.SECONDS.toMillis(ThreadPoolJobManager.this.abandonedTimeout);
if (abandoned) {
LOGGER.info("Job {} is abandoned (no status check within the last {} seconds)",
printJob.getEntry().getReferenceId(), ThreadPoolJobManager.this.abandonedTimeout); // depends on control dependency: [if], data = [none]
}
return abandoned;
} } |
public class class_name {
public float getSaturationLevel() {
if (RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.Q) {
ShadowColorDisplayManager shadowCdm =
extract(context.getSystemService(Context.COLOR_DISPLAY_SERVICE));
return shadowCdm.getSaturationLevel() / 100f;
}
return getShadowDisplayManagerGlobal().getSaturationLevel();
} } | public class class_name {
public float getSaturationLevel() {
if (RuntimeEnvironment.getApiLevel() >= Build.VERSION_CODES.Q) {
ShadowColorDisplayManager shadowCdm =
extract(context.getSystemService(Context.COLOR_DISPLAY_SERVICE));
return shadowCdm.getSaturationLevel() / 100f; // depends on control dependency: [if], data = [none]
}
return getShadowDisplayManagerGlobal().getSaturationLevel();
} } |
public class class_name {
public boolean isValidForMemcached(final String sessionId) {
if ( isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId( sessionId );
if ( nodeId == null ) {
LOG.debug( "The sessionId does not contain a nodeId so that the memcached node could not be identified." );
return false;
}
}
return true;
} } | public class class_name {
public boolean isValidForMemcached(final String sessionId) {
if ( isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId( sessionId );
if ( nodeId == null ) {
LOG.debug( "The sessionId does not contain a nodeId so that the memcached node could not be identified." ); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static void typeCheck(INode classdef, Interpreter interpreter,
CallSequence test, Environment outer) throws AnalysisException,
Exception
{
FlatEnvironment env = null;
if (classdef instanceof SClassDefinition)
{
env = new FlatEnvironment(interpreter.getAssistantFactory(), classdef.apply(interpreter.getAssistantFactory().getSelfDefinitionFinder()), outer);
} else
{
List<PDefinition> defs = new Vector<>();
if(classdef instanceof AModuleModules)
{
defs.addAll(((AModuleModules) classdef).getDefs());
}
env = new FlatEnvironment(interpreter.getAssistantFactory(), defs, outer);
}
for (int i = 0; i < test.size(); i++)
{
PStm statement = test.get(i);
if (statement instanceof TraceVariableStatement)
{
((TraceVariableStatement) statement).typeCheck(env, NameScope.NAMESANDSTATE);
} else
{
statement = statement.clone();
test.set(i, statement);
interpreter.typeCheck(statement, env);
}
}
} } | public class class_name {
public static void typeCheck(INode classdef, Interpreter interpreter,
CallSequence test, Environment outer) throws AnalysisException,
Exception
{
FlatEnvironment env = null;
if (classdef instanceof SClassDefinition)
{
env = new FlatEnvironment(interpreter.getAssistantFactory(), classdef.apply(interpreter.getAssistantFactory().getSelfDefinitionFinder()), outer);
} else
{
List<PDefinition> defs = new Vector<>();
if(classdef instanceof AModuleModules)
{
defs.addAll(((AModuleModules) classdef).getDefs()); // depends on control dependency: [if], data = [none]
}
env = new FlatEnvironment(interpreter.getAssistantFactory(), defs, outer);
}
for (int i = 0; i < test.size(); i++)
{
PStm statement = test.get(i);
if (statement instanceof TraceVariableStatement)
{
((TraceVariableStatement) statement).typeCheck(env, NameScope.NAMESANDSTATE);
} else
{
statement = statement.clone();
test.set(i, statement);
interpreter.typeCheck(statement, env);
}
}
} } |
public class class_name {
public KeyRestoreParameters withKeyBundleBackup(byte[] keyBundleBackup) {
if (keyBundleBackup == null) {
this.keyBundleBackup = null;
} else {
this.keyBundleBackup = Base64Url.encode(keyBundleBackup);
}
return this;
} } | public class class_name {
public KeyRestoreParameters withKeyBundleBackup(byte[] keyBundleBackup) {
if (keyBundleBackup == null) {
this.keyBundleBackup = null; // depends on control dependency: [if], data = [none]
} else {
this.keyBundleBackup = Base64Url.encode(keyBundleBackup); // depends on control dependency: [if], data = [(keyBundleBackup]
}
return this;
} } |
public class class_name {
private void initListViewItems() {
lvMessages = (ListView) findViewById(R.id.lvMessages);
//creating your adapter, it could be a custom adapter as well
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1);
//your test devices' ids
String[] testDevicesIds = new String[]{getString(R.string.testDeviceID),AdRequest.DEVICE_ID_EMULATOR};
//when you'll be ready for release please use another ctor with admobReleaseUnitId instead.
adapterWrapper = AdmobExpressAdapterWrapper.builder(this)
.setLimitOfAds(10)
.setFirstAdIndex(2)
.setNoOfDataBetweenAds(10)
.setTestDeviceIds(testDevicesIds)
.setAdapter(adapter)
.setAdViewWrappingStrategy(new AdViewWrappingStrategyBase() {
@NonNull
@Override
protected ViewGroup getAdViewWrapper(ViewGroup parent) {
return (ViewGroup) LayoutInflater.from(parent.getContext()).inflate(R.layout.web_ad_container,
parent, false);
}
@Override
protected void recycleAdViewWrapper(@NonNull ViewGroup wrapper, @NonNull NativeExpressAdView ad) {
//get the view which directly will contain ad
ViewGroup container = (ViewGroup) wrapper.findViewById(R.id.ad_container);
//iterating through all children of the container view and remove the first occured {@link NativeExpressAdView}. It could be different with {@param ad}!!!*//*
for (int i = 0; i < container.getChildCount(); i++) {
View v = container.getChildAt(i);
if (v instanceof NativeExpressAdView) {
container.removeViewAt(i);
break;
}
}
}
@Override
protected void addAdViewToWrapper(@NonNull ViewGroup wrapper, @NonNull NativeExpressAdView ad) {
//get the view which directly will contain ad
ViewGroup container = (ViewGroup) wrapper.findViewById(R.id.ad_container);
//add the {@param ad} directly to the end of container*//*
container.addView(ad);
}
})
.build();
lvMessages.setAdapter(adapterWrapper); // setting an AdmobAdapterWrapper to a ListView
//preparing the collection of data
final String sItem = "item #";
ArrayList<String> lst = new ArrayList<String>(100);
for(int i=1;i<=100;i++)
lst.add(sItem.concat(Integer.toString(i)));
//adding a collection of data to your adapter and rising the data set changed event
adapter.addAll(lst);
adapter.notifyDataSetChanged();
} } | public class class_name {
private void initListViewItems() {
lvMessages = (ListView) findViewById(R.id.lvMessages);
//creating your adapter, it could be a custom adapter as well
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1);
//your test devices' ids
String[] testDevicesIds = new String[]{getString(R.string.testDeviceID),AdRequest.DEVICE_ID_EMULATOR};
//when you'll be ready for release please use another ctor with admobReleaseUnitId instead.
adapterWrapper = AdmobExpressAdapterWrapper.builder(this)
.setLimitOfAds(10)
.setFirstAdIndex(2)
.setNoOfDataBetweenAds(10)
.setTestDeviceIds(testDevicesIds)
.setAdapter(adapter)
.setAdViewWrappingStrategy(new AdViewWrappingStrategyBase() {
@NonNull
@Override
protected ViewGroup getAdViewWrapper(ViewGroup parent) {
return (ViewGroup) LayoutInflater.from(parent.getContext()).inflate(R.layout.web_ad_container,
parent, false);
}
@Override
protected void recycleAdViewWrapper(@NonNull ViewGroup wrapper, @NonNull NativeExpressAdView ad) {
//get the view which directly will contain ad
ViewGroup container = (ViewGroup) wrapper.findViewById(R.id.ad_container);
//iterating through all children of the container view and remove the first occured {@link NativeExpressAdView}. It could be different with {@param ad}!!!*//*
for (int i = 0; i < container.getChildCount(); i++) {
View v = container.getChildAt(i);
if (v instanceof NativeExpressAdView) {
container.removeViewAt(i); // depends on control dependency: [if], data = [none]
break;
}
}
}
@Override
protected void addAdViewToWrapper(@NonNull ViewGroup wrapper, @NonNull NativeExpressAdView ad) {
//get the view which directly will contain ad
ViewGroup container = (ViewGroup) wrapper.findViewById(R.id.ad_container);
//add the {@param ad} directly to the end of container*//*
container.addView(ad);
}
})
.build();
lvMessages.setAdapter(adapterWrapper); // setting an AdmobAdapterWrapper to a ListView
//preparing the collection of data
final String sItem = "item #";
ArrayList<String> lst = new ArrayList<String>(100);
for(int i=1;i<=100;i++)
lst.add(sItem.concat(Integer.toString(i)));
//adding a collection of data to your adapter and rising the data set changed event
adapter.addAll(lst);
adapter.notifyDataSetChanged();
} } |
public class class_name {
@SuppressWarnings({"rawtypes", "unchecked"})
protected void toggleOwnFile(Logger logchannel) {
String filepath = "";
Layout layout = null;
// if the button is activated check the value of the button
// the button was active
if (isloggingactivated(logchannel)) {
// remove the private Appender from logger
for (Appender appender : logchannel.getAppenders().values()) {
logchannel.removeAppender(appender);
}
// activate the heredity so the logger get the appender from parent logger
logchannel.setAdditive(true);
}
// the button was inactive
else {
// get the layout and file path from root logger
for (Appender appender : ((Logger)LogManager.getRootLogger()).getAppenders().values()) {
if (CmsLogFileApp.isFileAppender(appender)) {
String fileName = CmsLogFileApp.getFileName(appender);
filepath = fileName.substring(0, fileName.lastIndexOf(File.separatorChar));
layout = appender.getLayout();
break;
}
}
// check if the logger has an Appender get his layout
for (Appender appender : logchannel.getAppenders().values()) {
if (CmsLogFileApp.isFileAppender(appender)) {
layout = appender.getLayout();
break;
}
}
String logfilename = "";
String temp = logchannel.getName();
// check if the logger name begins with "org.opencms"
if (logchannel.getName().contains(OPENCMS_CLASS_PREFIX)) {
// remove the prefix "org.opencms" from logger name to generate the file name
temp = temp.replace(OPENCMS_CLASS_PREFIX, "");
// if the name has suffix
if (temp.length() >= 1) {
logfilename = filepath + File.separator + "opencms-" + temp.substring(1).replace(".", "-") + ".log";
}
// if the name has no suffix
else {
logfilename = filepath + File.separator + "opencms" + temp.replace(".", "-") + ".log";
}
}
// if the logger name not begins with "org.opencms"
else {
logfilename = filepath + File.separator + "opencms-" + temp.replace(".", "-") + ".log";
}
FileAppender fapp = ((Builder)FileAppender.<FileAppender.Builder> newBuilder().withFileName(
logfilename).withLayout(layout).withName(logchannel.getName())).build();
// deactivate the heredity so the logger get no longer the appender from parent logger
logchannel.setAdditive(false);
// remove all active Appenders from logger
for (Appender appender : logchannel.getAppenders().values()) {
logchannel.removeAppender(appender);
}
// add the new created Appender to the logger
logchannel.addAppender(fapp);
}
updateFile();
} } | public class class_name {
@SuppressWarnings({"rawtypes", "unchecked"})
protected void toggleOwnFile(Logger logchannel) {
String filepath = "";
Layout layout = null;
// if the button is activated check the value of the button
// the button was active
if (isloggingactivated(logchannel)) {
// remove the private Appender from logger
for (Appender appender : logchannel.getAppenders().values()) {
logchannel.removeAppender(appender); // depends on control dependency: [for], data = [appender]
}
// activate the heredity so the logger get the appender from parent logger
logchannel.setAdditive(true); // depends on control dependency: [if], data = [none]
}
// the button was inactive
else {
// get the layout and file path from root logger
for (Appender appender : ((Logger)LogManager.getRootLogger()).getAppenders().values()) {
if (CmsLogFileApp.isFileAppender(appender)) {
String fileName = CmsLogFileApp.getFileName(appender);
filepath = fileName.substring(0, fileName.lastIndexOf(File.separatorChar)); // depends on control dependency: [if], data = [none]
layout = appender.getLayout(); // depends on control dependency: [if], data = [none]
break;
}
}
// check if the logger has an Appender get his layout
for (Appender appender : logchannel.getAppenders().values()) {
if (CmsLogFileApp.isFileAppender(appender)) {
layout = appender.getLayout(); // depends on control dependency: [if], data = [none]
break;
}
}
String logfilename = "";
String temp = logchannel.getName();
// check if the logger name begins with "org.opencms"
if (logchannel.getName().contains(OPENCMS_CLASS_PREFIX)) {
// remove the prefix "org.opencms" from logger name to generate the file name
temp = temp.replace(OPENCMS_CLASS_PREFIX, ""); // depends on control dependency: [if], data = [none]
// if the name has suffix
if (temp.length() >= 1) {
logfilename = filepath + File.separator + "opencms-" + temp.substring(1).replace(".", "-") + ".log"; // depends on control dependency: [if], data = [none]
}
// if the name has no suffix
else {
logfilename = filepath + File.separator + "opencms" + temp.replace(".", "-") + ".log"; // depends on control dependency: [if], data = [none]
}
}
// if the logger name not begins with "org.opencms"
else {
logfilename = filepath + File.separator + "opencms-" + temp.replace(".", "-") + ".log"; // depends on control dependency: [if], data = [none]
}
FileAppender fapp = ((Builder)FileAppender.<FileAppender.Builder> newBuilder().withFileName(
logfilename).withLayout(layout).withName(logchannel.getName())).build();
// deactivate the heredity so the logger get no longer the appender from parent logger
logchannel.setAdditive(false); // depends on control dependency: [if], data = [none]
// remove all active Appenders from logger
for (Appender appender : logchannel.getAppenders().values()) {
logchannel.removeAppender(appender); // depends on control dependency: [for], data = [appender]
}
// add the new created Appender to the logger
logchannel.addAppender(fapp); // depends on control dependency: [if], data = [none]
}
updateFile();
} } |
public class class_name {
@Override
public QStringValue appendSQL(final SQLSelect _sql)
{
if (this.noEscape) {
_sql.addValuePart(this.value);
} else {
_sql.addEscapedValuePart(this.value);
}
return this;
} } | public class class_name {
@Override
public QStringValue appendSQL(final SQLSelect _sql)
{
if (this.noEscape) {
_sql.addValuePart(this.value); // depends on control dependency: [if], data = [none]
} else {
_sql.addEscapedValuePart(this.value); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
@Override
@SuppressLint("NewApi")
public void setTintList(@Nullable ColorStateList tint) {
ColorStateList backgroundTint;
if (tint != null) {
if (!tint.isOpaque()) {
Log.w(getClass().getSimpleName(), "setTintList() called with a non-opaque" +
" ColorStateList, its original alpha will be discarded");
}
backgroundTint = tint.withAlpha(Math.round(mBackgroundAlpha * 255));
} else {
backgroundTint = null;
}
mBackgroundDrawable.setTintList(backgroundTint);
mSecondaryProgressDrawable.setTintList(backgroundTint);
mProgressDrawable.setTintList(tint);
} } | public class class_name {
@Override
@SuppressLint("NewApi")
public void setTintList(@Nullable ColorStateList tint) {
ColorStateList backgroundTint;
if (tint != null) {
if (!tint.isOpaque()) {
Log.w(getClass().getSimpleName(), "setTintList() called with a non-opaque" +
" ColorStateList, its original alpha will be discarded"); // depends on control dependency: [if], data = [none]
}
backgroundTint = tint.withAlpha(Math.round(mBackgroundAlpha * 255)); // depends on control dependency: [if], data = [none]
} else {
backgroundTint = null; // depends on control dependency: [if], data = [none]
}
mBackgroundDrawable.setTintList(backgroundTint);
mSecondaryProgressDrawable.setTintList(backgroundTint);
mProgressDrawable.setTintList(tint);
} } |
public class class_name {
@Override
public Epic getEpic(String epicKey, Map<String, Epic> epicMap) {
try {
String url = featureSettings.getJiraBaseUrl() + (featureSettings.getJiraBaseUrl().endsWith("/") ? "" : "/") + String.format(EPIC_REST_SUFFIX, epicKey);
ResponseEntity<String> responseEntity = makeRestCall(url);
String responseBody = responseEntity.getBody();
JSONObject issue = (JSONObject) parser.parse(responseBody);
if (issue == null) {
return null;
}
return saveEpic(issue, epicMap, false);
} catch (ParseException pe) {
LOGGER.error("Parser exception when parsing teams", pe);
} catch (HygieiaException e) {
LOGGER.error("Error in calling JIRA API", e);
}
return null;
} } | public class class_name {
@Override
public Epic getEpic(String epicKey, Map<String, Epic> epicMap) {
try {
String url = featureSettings.getJiraBaseUrl() + (featureSettings.getJiraBaseUrl().endsWith("/") ? "" : "/") + String.format(EPIC_REST_SUFFIX, epicKey);
ResponseEntity<String> responseEntity = makeRestCall(url);
String responseBody = responseEntity.getBody();
JSONObject issue = (JSONObject) parser.parse(responseBody);
if (issue == null) {
return null; // depends on control dependency: [if], data = [none]
}
return saveEpic(issue, epicMap, false); // depends on control dependency: [try], data = [none]
} catch (ParseException pe) {
LOGGER.error("Parser exception when parsing teams", pe);
} catch (HygieiaException e) { // depends on control dependency: [catch], data = [none]
LOGGER.error("Error in calling JIRA API", e);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
protected boolean processQueryParameters(Trace trace, Node node) {
boolean ret = false;
// Translate query string into a map
Set<Property> queryString = node.getProperties(Constants.PROP_HTTP_QUERY);
if (!queryString.isEmpty()) {
StringTokenizer st = new StringTokenizer(queryString.iterator().next().getValue(), "&");
while (st.hasMoreTokens()) {
String token = st.nextToken();
String[] namevalue = token.split("=");
if (namevalue.length == 2) {
if (queryParameters.contains(namevalue[0])) {
try {
node.getProperties().add(new Property(namevalue[0],
URLDecoder.decode(namevalue[1], "UTF-8")));
ret = true;
} catch (UnsupportedEncodingException e) {
if (log.isLoggable(Level.FINEST)) {
log.finest("Failed to decode value '" + namevalue[1] + "': " + e);
}
}
} else if (log.isLoggable(Level.FINEST)) {
log.finest("Ignoring query parameter '" + namevalue[0] + "'");
}
} else if (log.isLoggable(Level.FINEST)) {
log.finest("Query string part does not include name/value pair: " + token);
}
}
}
return ret;
} } | public class class_name {
protected boolean processQueryParameters(Trace trace, Node node) {
boolean ret = false;
// Translate query string into a map
Set<Property> queryString = node.getProperties(Constants.PROP_HTTP_QUERY);
if (!queryString.isEmpty()) {
StringTokenizer st = new StringTokenizer(queryString.iterator().next().getValue(), "&");
while (st.hasMoreTokens()) {
String token = st.nextToken();
String[] namevalue = token.split("=");
if (namevalue.length == 2) {
if (queryParameters.contains(namevalue[0])) {
try {
node.getProperties().add(new Property(namevalue[0],
URLDecoder.decode(namevalue[1], "UTF-8"))); // depends on control dependency: [try], data = [none]
ret = true; // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
if (log.isLoggable(Level.FINEST)) {
log.finest("Failed to decode value '" + namevalue[1] + "': " + e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} else if (log.isLoggable(Level.FINEST)) {
log.finest("Ignoring query parameter '" + namevalue[0] + "'"); // depends on control dependency: [if], data = [none]
}
} else if (log.isLoggable(Level.FINEST)) {
log.finest("Query string part does not include name/value pair: " + token); // depends on control dependency: [if], data = [none]
}
}
}
return ret;
} } |
public class class_name {
public static void addDatatablesResourceIfNecessary(String defaultFilename, String type) {
boolean loadDatatables = shouldLibraryBeLoaded(P_GET_DATATABLE_FROM_CDN, true);
// Do we have to add datatables.min.{css|js}, or are the resources already there?
FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot root = context.getViewRoot();
String[] positions = { "head", "body", "form" };
for (String position : positions) {
if (loadDatatables) {
List<UIComponent> availableResources = root.getComponentResources(context, position);
for (UIComponent ava : availableResources) {
if (ava.isRendered()) {
String name = (String) ava.getAttributes().get("name");
if (null != name) {
name = name.toLowerCase();
if (name.contains("datatables") && name.endsWith("." + type)) {
loadDatatables = false;
break;
}
}
}
}
}
}
if (loadDatatables) {
addResourceIfNecessary(defaultFilename);
}
} } | public class class_name {
public static void addDatatablesResourceIfNecessary(String defaultFilename, String type) {
boolean loadDatatables = shouldLibraryBeLoaded(P_GET_DATATABLE_FROM_CDN, true);
// Do we have to add datatables.min.{css|js}, or are the resources already there?
FacesContext context = FacesContext.getCurrentInstance();
UIViewRoot root = context.getViewRoot();
String[] positions = { "head", "body", "form" };
for (String position : positions) {
if (loadDatatables) {
List<UIComponent> availableResources = root.getComponentResources(context, position);
for (UIComponent ava : availableResources) {
if (ava.isRendered()) {
String name = (String) ava.getAttributes().get("name");
if (null != name) {
name = name.toLowerCase(); // depends on control dependency: [if], data = [none]
if (name.contains("datatables") && name.endsWith("." + type)) {
loadDatatables = false; // depends on control dependency: [if], data = [none]
break;
}
}
}
}
}
}
if (loadDatatables) {
addResourceIfNecessary(defaultFilename); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public EClass getIfcPipeSegmentType() {
if (ifcPipeSegmentTypeEClass == null) {
ifcPipeSegmentTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(356);
}
return ifcPipeSegmentTypeEClass;
} } | public class class_name {
public EClass getIfcPipeSegmentType() {
if (ifcPipeSegmentTypeEClass == null) {
ifcPipeSegmentTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(356);
// depends on control dependency: [if], data = [none]
}
return ifcPipeSegmentTypeEClass;
} } |
public class class_name {
public java.lang.String getCallerIp() {
java.lang.Object ref = callerIp_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
callerIp_ = s;
return s;
}
} } | public class class_name {
public java.lang.String getCallerIp() {
java.lang.Object ref = callerIp_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref; // depends on control dependency: [if], data = [none]
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
callerIp_ = s; // depends on control dependency: [if], data = [none]
return s; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Matcher getMatcher(String pattern, CharSequence input) {
if (pattern == null) {
throw new IllegalArgumentException("String 'pattern' must not be null");
}
input = new InterruptibleCharSequence(input);
final Map<String,Matcher> matchers = TL_MATCHER_MAP.get();
Matcher m = (Matcher)matchers.get(pattern);
if(m == null) {
m = PATTERNS.getUnchecked(pattern).matcher(input);
} else {
matchers.put(pattern,null);
m.reset(input);
}
return m;
} } | public class class_name {
public static Matcher getMatcher(String pattern, CharSequence input) {
if (pattern == null) {
throw new IllegalArgumentException("String 'pattern' must not be null");
}
input = new InterruptibleCharSequence(input);
final Map<String,Matcher> matchers = TL_MATCHER_MAP.get();
Matcher m = (Matcher)matchers.get(pattern);
if(m == null) {
m = PATTERNS.getUnchecked(pattern).matcher(input); // depends on control dependency: [if], data = [none]
} else {
matchers.put(pattern,null); // depends on control dependency: [if], data = [null)]
m.reset(input); // depends on control dependency: [if], data = [none]
}
return m;
} } |
public class class_name {
public boolean apply() {
// FIXME: need to make this incremental
// Create initial set of patches.
List<Patch> patches = resolver.apply(target);
// Keep iterating until all patches are resolved
while (patches.size() > 0) {
// Create importer
Importer importer = new Importer(target, true);
// Now continue importing until patches all resolved.
for (int i = 0; i != patches.size(); ++i) {
// Import and link the given patch
patches.get(i).apply(importer);
}
// Switch over to the next set of patches
patches = importer.getPatches();
}
// Consolidate any imported declarations as externals.
symbolTable.consolidate();
//
return status;
} } | public class class_name {
public boolean apply() {
// FIXME: need to make this incremental
// Create initial set of patches.
List<Patch> patches = resolver.apply(target);
// Keep iterating until all patches are resolved
while (patches.size() > 0) {
// Create importer
Importer importer = new Importer(target, true);
// Now continue importing until patches all resolved.
for (int i = 0; i != patches.size(); ++i) {
// Import and link the given patch
patches.get(i).apply(importer); // depends on control dependency: [for], data = [i]
}
// Switch over to the next set of patches
patches = importer.getPatches(); // depends on control dependency: [while], data = [none]
}
// Consolidate any imported declarations as externals.
symbolTable.consolidate();
//
return status;
} } |
public class class_name {
public void marshall(OfferingStatus offeringStatus, ProtocolMarshaller protocolMarshaller) {
if (offeringStatus == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(offeringStatus.getType(), TYPE_BINDING);
protocolMarshaller.marshall(offeringStatus.getOffering(), OFFERING_BINDING);
protocolMarshaller.marshall(offeringStatus.getQuantity(), QUANTITY_BINDING);
protocolMarshaller.marshall(offeringStatus.getEffectiveOn(), EFFECTIVEON_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(OfferingStatus offeringStatus, ProtocolMarshaller protocolMarshaller) {
if (offeringStatus == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(offeringStatus.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(offeringStatus.getOffering(), OFFERING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(offeringStatus.getQuantity(), QUANTITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(offeringStatus.getEffectiveOn(), EFFECTIVEON_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected boolean readStationsAndTimes(boolean uniqueTimes) {
for (DMPart apart : parts) {
List<GempakParameter> params = makeParams(apart);
partParamMap.put(apart.kprtnm, params);
}
// get the date/time keys
dateTimeKeys = getDateTimeKeys();
if ((dateTimeKeys == null) || dateTimeKeys.isEmpty()) {
return false;
}
// get the station info
stationKeys = findStationKeys();
if ((stationKeys == null) || stationKeys.isEmpty()) {
return false;
}
stations = getStationList();
makeFileSubType();
// null out the old cached list
dates = null;
dateList = makeDateList(uniqueTimes);
return true;
} } | public class class_name {
protected boolean readStationsAndTimes(boolean uniqueTimes) {
for (DMPart apart : parts) {
List<GempakParameter> params = makeParams(apart);
partParamMap.put(apart.kprtnm, params); // depends on control dependency: [for], data = [apart]
}
// get the date/time keys
dateTimeKeys = getDateTimeKeys();
if ((dateTimeKeys == null) || dateTimeKeys.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
// get the station info
stationKeys = findStationKeys();
if ((stationKeys == null) || stationKeys.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
stations = getStationList();
makeFileSubType();
// null out the old cached list
dates = null;
dateList = makeDateList(uniqueTimes);
return true;
} } |
public class class_name {
boolean canCopyMethodAttributes(
final int methodInfoOffset,
final int methodInfoLength,
final boolean hasSyntheticAttribute,
final boolean hasDeprecatedAttribute,
final int signatureIndex,
final int exceptionsOffset) {
boolean needSyntheticAttribute =
symbolTable.getMajorVersion() < Opcodes.V1_5 && (accessFlags & Opcodes.ACC_SYNTHETIC) != 0;
if (hasSyntheticAttribute != needSyntheticAttribute) {
return false;
}
if (exceptionsOffset == 0) {
if (numberOfExceptions != 0) {
return false;
}
}
// Don't copy the attributes yet, instead store their location in the source class reader so
// they can be copied later, in {@link #putMethodInfo}. Note that we skip the 6 header bytes
// of the method_info JVMS structure.
this.sourceOffset = methodInfoOffset + 6;
this.sourceLength = methodInfoLength - 6;
return true;
} } | public class class_name {
boolean canCopyMethodAttributes(
final int methodInfoOffset,
final int methodInfoLength,
final boolean hasSyntheticAttribute,
final boolean hasDeprecatedAttribute,
final int signatureIndex,
final int exceptionsOffset) {
boolean needSyntheticAttribute =
symbolTable.getMajorVersion() < Opcodes.V1_5 && (accessFlags & Opcodes.ACC_SYNTHETIC) != 0;
if (hasSyntheticAttribute != needSyntheticAttribute) {
return false; // depends on control dependency: [if], data = [none]
}
if (exceptionsOffset == 0) {
if (numberOfExceptions != 0) {
return false; // depends on control dependency: [if], data = [none]
}
}
// Don't copy the attributes yet, instead store their location in the source class reader so
// they can be copied later, in {@link #putMethodInfo}. Note that we skip the 6 header bytes
// of the method_info JVMS structure.
this.sourceOffset = methodInfoOffset + 6;
this.sourceLength = methodInfoLength - 6;
return true;
} } |
public class class_name {
public static InetAddress getLocalIpAddress(String iface) throws RuntimeException
{
try
{
NetworkInterface nic = NetworkInterface.getByName(iface);
Enumeration<InetAddress> ips = nic.getInetAddresses();
InetAddress firstIP = null;
while (ips != null && ips.hasMoreElements())
{
InetAddress ip = ips.nextElement();
if (firstIP == null)
firstIP = ip;
if (log.isDebugEnabled())
log.debug("[IpHelper] {getLocalIpAddress} Considering locality: " + ip.getHostAddress());
if (!ip.isAnyLocalAddress())
{
return ip;
}
}
// Return the first IP (or null if no IPs were returned)
return firstIP;
}
catch (SocketException e)
{
throw new RuntimeException("[IpHelper] {getLocalIpAddress}: Unable to acquire an IP", e);
}
} } | public class class_name {
public static InetAddress getLocalIpAddress(String iface) throws RuntimeException
{
try
{
NetworkInterface nic = NetworkInterface.getByName(iface);
Enumeration<InetAddress> ips = nic.getInetAddresses();
InetAddress firstIP = null;
while (ips != null && ips.hasMoreElements())
{
InetAddress ip = ips.nextElement();
if (firstIP == null)
firstIP = ip;
if (log.isDebugEnabled())
log.debug("[IpHelper] {getLocalIpAddress} Considering locality: " + ip.getHostAddress());
if (!ip.isAnyLocalAddress())
{
return ip; // depends on control dependency: [if], data = [none]
}
}
// Return the first IP (or null if no IPs were returned)
return firstIP;
}
catch (SocketException e)
{
throw new RuntimeException("[IpHelper] {getLocalIpAddress}: Unable to acquire an IP", e);
}
} } |
public class class_name {
public Context debug(final Vars vars, final Out out, final BreakpointListener listener) {
try {
return Parser.parse(this, listener)
.execute(this, out, vars);
} catch (Exception e) {
throw completeException(e);
}
} } | public class class_name {
public Context debug(final Vars vars, final Out out, final BreakpointListener listener) {
try {
return Parser.parse(this, listener)
.execute(this, out, vars); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw completeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.