code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public void fillPrimitiveProperty(Object entity, Set<String> keySet, StructuralProperty property, Field field,
String node, Map<String, Object> map) throws ODataException {
for (String target : keySet) {
if (node.equalsIgnoreCase(target)) {
Object value = getFieldValueByType(property.getTypeName(), target, map, false);
if (value != null) {
setFieldValue(field, entity, value);
break;
} else {
LOG.warn("There is no element with name '{}'", node);
}
}
}
} } | public class class_name {
public void fillPrimitiveProperty(Object entity, Set<String> keySet, StructuralProperty property, Field field,
String node, Map<String, Object> map) throws ODataException {
for (String target : keySet) {
if (node.equalsIgnoreCase(target)) {
Object value = getFieldValueByType(property.getTypeName(), target, map, false);
if (value != null) {
setFieldValue(field, entity, value); // depends on control dependency: [if], data = [none]
break;
} else {
LOG.warn("There is no element with name '{}'", node); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public static FileUtil getInstance() {
if (instance == null) {
synchronized (FileUtilImpl.class) {
if (instance == null) {
FileUtilImpl util = new FileUtilImpl();
util.initialize();
instance = util;
}
}
}
return instance;
} } | public class class_name {
public static FileUtil getInstance() {
if (instance == null) {
synchronized (FileUtilImpl.class) { // depends on control dependency: [if], data = [none]
if (instance == null) {
FileUtilImpl util = new FileUtilImpl();
util.initialize(); // depends on control dependency: [if], data = [none]
instance = util; // depends on control dependency: [if], data = [none]
}
}
}
return instance;
} } |
public class class_name {
@SuppressWarnings({"rawtypes"})
@Override
public void open(Map conf, TopologyContext context)
{
this.taskIndex = context.getThisTaskIndex();
this.fileName = this.baseFileName + "_" + this.taskIndex;
File targetFile = new File(this.dataFilePath, this.fileName);
try
{
this.fileContents = FileUtils.readLines(targetFile);
this.fileContentsSize = this.fileContents.size();
}
catch (IOException ex)
{
// 読込に失敗した場合は例外を投げてフェールオーバーさせる。
throw new RuntimeException(ex);
}
} } | public class class_name {
@SuppressWarnings({"rawtypes"})
@Override
public void open(Map conf, TopologyContext context)
{
this.taskIndex = context.getThisTaskIndex();
this.fileName = this.baseFileName + "_" + this.taskIndex;
File targetFile = new File(this.dataFilePath, this.fileName);
try
{
this.fileContents = FileUtils.readLines(targetFile); // depends on control dependency: [try], data = [none]
this.fileContentsSize = this.fileContents.size(); // depends on control dependency: [try], data = [none]
}
catch (IOException ex)
{
// 読込に失敗した場合は例外を投げてフェールオーバーさせる。
throw new RuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(TraceUser traceUser, ProtocolMarshaller protocolMarshaller) {
if (traceUser == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(traceUser.getUserName(), USERNAME_BINDING);
protocolMarshaller.marshall(traceUser.getServiceIds(), SERVICEIDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(TraceUser traceUser, ProtocolMarshaller protocolMarshaller) {
if (traceUser == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(traceUser.getUserName(), USERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(traceUser.getServiceIds(), SERVICEIDS_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 {
void xLock(Object obj, long txNum) {
Object anchor = getAnchor(obj);
txWaitMap.put(txNum, anchor);
synchronized (anchor) {
Lockers lks = prepareLockers(obj);
if (hasXLock(lks, txNum))
return;
try {
long timestamp = System.currentTimeMillis();
while (!xLockable(lks, txNum) && !waitingTooLong(timestamp)) {
avoidDeadlock(lks, txNum, X_LOCK);
lks.requestSet.add(txNum);
anchor.wait(MAX_TIME);
lks.requestSet.remove(txNum);
}
if (!xLockable(lks, txNum))
throw new LockAbortException();
lks.xLocker = txNum;
getObjectSet(txNum).add(obj);
} catch (InterruptedException e) {
throw new LockAbortException();
}
}
txWaitMap.remove(txNum);
} } | public class class_name {
void xLock(Object obj, long txNum) {
Object anchor = getAnchor(obj);
txWaitMap.put(txNum, anchor);
synchronized (anchor) {
Lockers lks = prepareLockers(obj);
if (hasXLock(lks, txNum))
return;
try {
long timestamp = System.currentTimeMillis();
while (!xLockable(lks, txNum) && !waitingTooLong(timestamp)) {
avoidDeadlock(lks, txNum, X_LOCK);
// depends on control dependency: [while], data = [none]
lks.requestSet.add(txNum);
// depends on control dependency: [while], data = [none]
anchor.wait(MAX_TIME);
// depends on control dependency: [while], data = [none]
lks.requestSet.remove(txNum);
// depends on control dependency: [while], data = [none]
}
if (!xLockable(lks, txNum))
throw new LockAbortException();
lks.xLocker = txNum;
// depends on control dependency: [try], data = [none]
getObjectSet(txNum).add(obj);
// depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
throw new LockAbortException();
}
// depends on control dependency: [catch], data = [none]
}
txWaitMap.remove(txNum);
} } |
public class class_name {
public static DocumentBuilder getValidatingXmlParser(File schemaFile) {
DocumentBuilder db = null;
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(schemaFile);
dbf.setSchema(schema);
db = dbf.newDocumentBuilder();
db.setErrorHandler(new SAXErrorHandler());
} catch (ParserConfigurationException e) {
System.err.printf("%s: Unable to create XML parser\n", XMLUtils.class.getName());
e.printStackTrace();
} catch (SAXException e) {
System.err.printf("%s: XML parsing exception while loading schema %s\n", XMLUtils.class.getName(),schemaFile.getPath());
e.printStackTrace();
} catch(UnsupportedOperationException e) {
System.err.printf("%s: API error while setting up XML parser. Check your JAXP version\n", XMLUtils.class.getName());
e.printStackTrace();
}
return db;
} } | public class class_name {
public static DocumentBuilder getValidatingXmlParser(File schemaFile) {
DocumentBuilder db = null;
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(schemaFile);
dbf.setSchema(schema);
// depends on control dependency: [try], data = [none]
db = dbf.newDocumentBuilder();
// depends on control dependency: [try], data = [none]
db.setErrorHandler(new SAXErrorHandler());
// depends on control dependency: [try], data = [none]
} catch (ParserConfigurationException e) {
System.err.printf("%s: Unable to create XML parser\n", XMLUtils.class.getName());
e.printStackTrace();
} catch (SAXException e) {
// depends on control dependency: [catch], data = [none]
System.err.printf("%s: XML parsing exception while loading schema %s\n", XMLUtils.class.getName(),schemaFile.getPath());
e.printStackTrace();
} catch(UnsupportedOperationException e) {
// depends on control dependency: [catch], data = [none]
System.err.printf("%s: API error while setting up XML parser. Check your JAXP version\n", XMLUtils.class.getName());
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
return db;
} } |
public class class_name {
public static void rotateCW( GrayS32 input , GrayS32 output ) {
if( input.width != output.height || input.height != output.width )
throw new IllegalArgumentException("Incompatible shapes");
int h = input.height-1;
for( int y = 0; y < input.height; y++ ) {
int indexIn = input.startIndex + y*input.stride;
for (int x = 0; x < input.width; x++) {
output.unsafe_set(h-y,x,input.data[indexIn++]);
}
}
} } | public class class_name {
public static void rotateCW( GrayS32 input , GrayS32 output ) {
if( input.width != output.height || input.height != output.width )
throw new IllegalArgumentException("Incompatible shapes");
int h = input.height-1;
for( int y = 0; y < input.height; y++ ) {
int indexIn = input.startIndex + y*input.stride;
for (int x = 0; x < input.width; x++) {
output.unsafe_set(h-y,x,input.data[indexIn++]); // depends on control dependency: [for], data = [x]
}
}
} } |
public class class_name {
public static Object invokeGetter(Object object, String getterName, Object[] args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
int index = getterName.indexOf('.');
if (index > 0) {
String getterName2 = getterName.substring(0, index);
Object o = invokeGetter(object, getterName2);
return invokeGetter(o, getterName.substring(index + 1), args);
} else {
if (!getterName.startsWith("get") && !getterName.startsWith("is")) {
getterName = "get" + getterName.substring(0, 1).toUpperCase(Locale.US) + getterName.substring(1);
}
return invokeMethod(object, getterName, args);
}
} } | public class class_name {
public static Object invokeGetter(Object object, String getterName, Object[] args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
int index = getterName.indexOf('.');
if (index > 0) {
String getterName2 = getterName.substring(0, index);
Object o = invokeGetter(object, getterName2);
return invokeGetter(o, getterName.substring(index + 1), args);
} else {
if (!getterName.startsWith("get") && !getterName.startsWith("is")) {
getterName = "get" + getterName.substring(0, 1).toUpperCase(Locale.US) + getterName.substring(1); // depends on control dependency: [if], data = [none]
}
return invokeMethod(object, getterName, args);
}
} } |
public class class_name {
public void marshall(HttpHeader httpHeader, ProtocolMarshaller protocolMarshaller) {
if (httpHeader == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(httpHeader.getHeaderName(), HEADERNAME_BINDING);
protocolMarshaller.marshall(httpHeader.getHeaderValue(), HEADERVALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(HttpHeader httpHeader, ProtocolMarshaller protocolMarshaller) {
if (httpHeader == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(httpHeader.getHeaderName(), HEADERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(httpHeader.getHeaderValue(), HEADERVALUE_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 boolean validateWithRowColInCurrentPage(final int row, final int col, boolean updateGui) {
//until now passEmptyCheck has one to one relation to submitMode
//e.g. when passEmptyCheck = false, then submitMode = true.
boolean submitMode = parent.getSubmitMode();
boolean passEmptyCheck = !submitMode;
int topRow = parent.getCurrent().getCurrentTopRow();
int leftCol = parent.getCurrent().getCurrentLeftColumn();
boolean pass = true;
FacesRow fRow = CellUtility.getFacesRowFromBodyRow(row, parent.getBodyRows(), topRow);
if (fRow == null) {
return pass;
}
FacesCell cell = CellUtility.getFacesCellFromBodyRow(row, col, parent.getBodyRows(), topRow, leftCol);
if (cell == null) {
return pass;
}
Cell poiCell = parent.getCellHelper().getPoiCellWithRowColFromCurrentPage(row, col);
boolean oldStatus = cell.isInvalid();
String value = CellUtility.getCellValueWithoutFormat(poiCell);
if (value == null) {
value = "";
} else {
value = value.trim();
}
if (passEmptyCheck && value.isEmpty()) {
refreshAfterStatusChanged(oldStatus, false, row - topRow, col - leftCol, cell, updateGui);
return pass;
}
if (((parent.isOnlyValidateInSubmitMode() && submitMode ) || !parent.isOnlyValidateInSubmitMode())
&& !validateByTieWebSheetValidationBean(poiCell, topRow, leftCol, cell, value, updateGui)) {
return false;
}
SheetConfiguration sheetConfig = parent.getSheetConfigMap().get(parent.getCurrent().getCurrentTabName());
List<CellFormAttributes> cellAttributes = CellControlsUtility.findCellValidateAttributes(
parent.getCellAttributesMap().getCellValidateAttributes(), fRow.getOriginRowIndex(), poiCell);
if (parent.isAdvancedContext() && parent.getConfigAdvancedContext().getErrorSuffix() != null
&& !checkErrorMessageFromObjectInContext(row - topRow, col - leftCol, cell, poiCell, value,
sheetConfig, updateGui)) {
return false;
}
if (cellAttributes != null) {
pass = validateAllRulesForSingleCell(row - topRow, col - leftCol, cell, poiCell, value, sheetConfig,
cellAttributes, updateGui);
}
if (pass) {
refreshAfterStatusChanged(oldStatus, false, row - topRow, col - leftCol, cell, updateGui);
}
return pass;
} } | public class class_name {
public boolean validateWithRowColInCurrentPage(final int row, final int col, boolean updateGui) {
//until now passEmptyCheck has one to one relation to submitMode
//e.g. when passEmptyCheck = false, then submitMode = true.
boolean submitMode = parent.getSubmitMode();
boolean passEmptyCheck = !submitMode;
int topRow = parent.getCurrent().getCurrentTopRow();
int leftCol = parent.getCurrent().getCurrentLeftColumn();
boolean pass = true;
FacesRow fRow = CellUtility.getFacesRowFromBodyRow(row, parent.getBodyRows(), topRow);
if (fRow == null) {
return pass;
// depends on control dependency: [if], data = [none]
}
FacesCell cell = CellUtility.getFacesCellFromBodyRow(row, col, parent.getBodyRows(), topRow, leftCol);
if (cell == null) {
return pass;
// depends on control dependency: [if], data = [none]
}
Cell poiCell = parent.getCellHelper().getPoiCellWithRowColFromCurrentPage(row, col);
boolean oldStatus = cell.isInvalid();
String value = CellUtility.getCellValueWithoutFormat(poiCell);
if (value == null) {
value = "";
// depends on control dependency: [if], data = [none]
} else {
value = value.trim();
// depends on control dependency: [if], data = [none]
}
if (passEmptyCheck && value.isEmpty()) {
refreshAfterStatusChanged(oldStatus, false, row - topRow, col - leftCol, cell, updateGui);
// depends on control dependency: [if], data = [none]
return pass;
// depends on control dependency: [if], data = [none]
}
if (((parent.isOnlyValidateInSubmitMode() && submitMode ) || !parent.isOnlyValidateInSubmitMode())
&& !validateByTieWebSheetValidationBean(poiCell, topRow, leftCol, cell, value, updateGui)) {
return false;
// depends on control dependency: [if], data = [none]
}
SheetConfiguration sheetConfig = parent.getSheetConfigMap().get(parent.getCurrent().getCurrentTabName());
List<CellFormAttributes> cellAttributes = CellControlsUtility.findCellValidateAttributes(
parent.getCellAttributesMap().getCellValidateAttributes(), fRow.getOriginRowIndex(), poiCell);
if (parent.isAdvancedContext() && parent.getConfigAdvancedContext().getErrorSuffix() != null
&& !checkErrorMessageFromObjectInContext(row - topRow, col - leftCol, cell, poiCell, value,
sheetConfig, updateGui)) {
return false;
// depends on control dependency: [if], data = [none]
}
if (cellAttributes != null) {
pass = validateAllRulesForSingleCell(row - topRow, col - leftCol, cell, poiCell, value, sheetConfig,
cellAttributes, updateGui);
// depends on control dependency: [if], data = [none]
}
if (pass) {
refreshAfterStatusChanged(oldStatus, false, row - topRow, col - leftCol, cell, updateGui);
// depends on control dependency: [if], data = [none]
}
return pass;
} } |
public class class_name {
public static double refineRoot( Polynomial poly, double root , int maxIterations ) {
// for( int i = 0; i < maxIterations; i++ ) {
//
// double v = poly.c[poly.size-1];
// double d = v*(poly.size-1);
//
// for( int j = poly.size-1; j > 0; j-- ) {
// v = poly.c[j] + v*root;
// d = poly.c[j]*j + d*root;
// }
// v = poly.c[0] + v*root;
//
// if( d == 0 )
// return root;
//
// root -= v/d;
// }
//
// return root;
Polynomial deriv = new Polynomial(poly.size());
derivative(poly,deriv);
for( int i = 0; i < maxIterations; i++ ) {
double v = poly.evaluate(root);
double d = deriv.evaluate(root);
if( d == 0 )
return root;
root -= v/d;
}
return root;
} } | public class class_name {
public static double refineRoot( Polynomial poly, double root , int maxIterations ) {
// for( int i = 0; i < maxIterations; i++ ) {
//
// double v = poly.c[poly.size-1];
// double d = v*(poly.size-1);
//
// for( int j = poly.size-1; j > 0; j-- ) {
// v = poly.c[j] + v*root;
// d = poly.c[j]*j + d*root;
// }
// v = poly.c[0] + v*root;
//
// if( d == 0 )
// return root;
//
// root -= v/d;
// }
//
// return root;
Polynomial deriv = new Polynomial(poly.size());
derivative(poly,deriv);
for( int i = 0; i < maxIterations; i++ ) {
double v = poly.evaluate(root);
double d = deriv.evaluate(root);
if( d == 0 )
return root;
root -= v/d; // depends on control dependency: [for], data = [none]
}
return root;
} } |
public class class_name {
public static void resetOnScheduleHook(String key) {
synchronized (onScheduleHooks) {
onScheduleHooks.remove(key);
if (onScheduleHooks.isEmpty()) {
onScheduleHook = Function.identity();
}
else {
Function<Runnable, Runnable> newHook = null;
for (Function<Runnable, Runnable> function : onScheduleHooks.values()) {
if (newHook == null) {
newHook = function;
}
else {
newHook = newHook.andThen(function);
}
}
onScheduleHook = newHook;
}
}
} } | public class class_name {
public static void resetOnScheduleHook(String key) {
synchronized (onScheduleHooks) {
onScheduleHooks.remove(key);
if (onScheduleHooks.isEmpty()) {
onScheduleHook = Function.identity(); // depends on control dependency: [if], data = [none]
}
else {
Function<Runnable, Runnable> newHook = null;
for (Function<Runnable, Runnable> function : onScheduleHooks.values()) {
if (newHook == null) {
newHook = function; // depends on control dependency: [if], data = [none]
}
else {
newHook = newHook.andThen(function); // depends on control dependency: [if], data = [none]
}
}
onScheduleHook = newHook; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static <T> T executeWithBackOff(AbstractGoogleClientRequest<T> client, String error)
throws IOException, InterruptedException {
Sleeper sleeper = Sleeper.DEFAULT;
BackOff backOff =
BackOffAdapter.toGcpBackOff(
FluentBackoff.DEFAULT
.withMaxRetries(MAX_RETRIES).withInitialBackoff(INITIAL_BACKOFF_TIME).backoff());
T result = null;
while (true) {
try {
result = client.execute();
break;
} catch (IOException e) {
LOG.error("{}", error, e);
if (!BackOffUtils.next(sleeper, backOff)) {
String errorMessage = String.format(
"%s Failing to execute job after %d attempts.", error, MAX_RETRIES + 1);
LOG.error("{}", errorMessage, e);
throw new IOException(errorMessage, e);
}
}
}
return result;
} } | public class class_name {
public static <T> T executeWithBackOff(AbstractGoogleClientRequest<T> client, String error)
throws IOException, InterruptedException {
Sleeper sleeper = Sleeper.DEFAULT;
BackOff backOff =
BackOffAdapter.toGcpBackOff(
FluentBackoff.DEFAULT
.withMaxRetries(MAX_RETRIES).withInitialBackoff(INITIAL_BACKOFF_TIME).backoff());
T result = null;
while (true) {
try {
result = client.execute(); // depends on control dependency: [try], data = [none]
break;
} catch (IOException e) {
LOG.error("{}", error, e);
if (!BackOffUtils.next(sleeper, backOff)) {
String errorMessage = String.format(
"%s Failing to execute job after %d attempts.", error, MAX_RETRIES + 1);
LOG.error("{}", errorMessage, e); // depends on control dependency: [if], data = [none]
throw new IOException(errorMessage, e);
}
} // depends on control dependency: [catch], data = [none]
}
return result;
} } |
public class class_name {
public void marshall(CreateLayerRequest createLayerRequest, ProtocolMarshaller protocolMarshaller) {
if (createLayerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createLayerRequest.getStackId(), STACKID_BINDING);
protocolMarshaller.marshall(createLayerRequest.getType(), TYPE_BINDING);
protocolMarshaller.marshall(createLayerRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(createLayerRequest.getShortname(), SHORTNAME_BINDING);
protocolMarshaller.marshall(createLayerRequest.getAttributes(), ATTRIBUTES_BINDING);
protocolMarshaller.marshall(createLayerRequest.getCloudWatchLogsConfiguration(), CLOUDWATCHLOGSCONFIGURATION_BINDING);
protocolMarshaller.marshall(createLayerRequest.getCustomInstanceProfileArn(), CUSTOMINSTANCEPROFILEARN_BINDING);
protocolMarshaller.marshall(createLayerRequest.getCustomJson(), CUSTOMJSON_BINDING);
protocolMarshaller.marshall(createLayerRequest.getCustomSecurityGroupIds(), CUSTOMSECURITYGROUPIDS_BINDING);
protocolMarshaller.marshall(createLayerRequest.getPackages(), PACKAGES_BINDING);
protocolMarshaller.marshall(createLayerRequest.getVolumeConfigurations(), VOLUMECONFIGURATIONS_BINDING);
protocolMarshaller.marshall(createLayerRequest.getEnableAutoHealing(), ENABLEAUTOHEALING_BINDING);
protocolMarshaller.marshall(createLayerRequest.getAutoAssignElasticIps(), AUTOASSIGNELASTICIPS_BINDING);
protocolMarshaller.marshall(createLayerRequest.getAutoAssignPublicIps(), AUTOASSIGNPUBLICIPS_BINDING);
protocolMarshaller.marshall(createLayerRequest.getCustomRecipes(), CUSTOMRECIPES_BINDING);
protocolMarshaller.marshall(createLayerRequest.getInstallUpdatesOnBoot(), INSTALLUPDATESONBOOT_BINDING);
protocolMarshaller.marshall(createLayerRequest.getUseEbsOptimizedInstances(), USEEBSOPTIMIZEDINSTANCES_BINDING);
protocolMarshaller.marshall(createLayerRequest.getLifecycleEventConfiguration(), LIFECYCLEEVENTCONFIGURATION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateLayerRequest createLayerRequest, ProtocolMarshaller protocolMarshaller) {
if (createLayerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createLayerRequest.getStackId(), STACKID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getShortname(), SHORTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getAttributes(), ATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getCloudWatchLogsConfiguration(), CLOUDWATCHLOGSCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getCustomInstanceProfileArn(), CUSTOMINSTANCEPROFILEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getCustomJson(), CUSTOMJSON_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getCustomSecurityGroupIds(), CUSTOMSECURITYGROUPIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getPackages(), PACKAGES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getVolumeConfigurations(), VOLUMECONFIGURATIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getEnableAutoHealing(), ENABLEAUTOHEALING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getAutoAssignElasticIps(), AUTOASSIGNELASTICIPS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getAutoAssignPublicIps(), AUTOASSIGNPUBLICIPS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getCustomRecipes(), CUSTOMRECIPES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getInstallUpdatesOnBoot(), INSTALLUPDATESONBOOT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getUseEbsOptimizedInstances(), USEEBSOPTIMIZEDINSTANCES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createLayerRequest.getLifecycleEventConfiguration(), LIFECYCLEEVENTCONFIGURATION_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 boolean existsKeyspace(String keyspace, boolean showLog) {
this.metadata = cluster.getMetadata();
if (!(this.metadata.getKeyspaces().isEmpty())) {
for (KeyspaceMetadata k : metadata.getKeyspaces()) {
if (k.getName().equals(keyspace)) {
return true;
}
}
}
return false;
} } | public class class_name {
public boolean existsKeyspace(String keyspace, boolean showLog) {
this.metadata = cluster.getMetadata();
if (!(this.metadata.getKeyspaces().isEmpty())) {
for (KeyspaceMetadata k : metadata.getKeyspaces()) {
if (k.getName().equals(keyspace)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
public EClass getIfcClassification() {
if (ifcClassificationEClass == null) {
ifcClassificationEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(79);
}
return ifcClassificationEClass;
} } | public class class_name {
public EClass getIfcClassification() {
if (ifcClassificationEClass == null) {
ifcClassificationEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(79);
// depends on control dependency: [if], data = [none]
}
return ifcClassificationEClass;
} } |
public class class_name {
public boolean isThrowable() {
if (isEnum() || isInterface() || isAnnotationType()) {
return false;
}
for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
if (t.tsym == env.syms.throwableType.tsym) {
return true;
}
}
return false;
} } | public class class_name {
public boolean isThrowable() {
if (isEnum() || isInterface() || isAnnotationType()) {
return false; // depends on control dependency: [if], data = [none]
}
for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
if (t.tsym == env.syms.throwableType.tsym) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
private Expression createOfType(Expression target, String functionName, @NotNull cqlParser.FunctionContext ctx) {
AliasedQuerySource source = enterQueryContext(target);
try {
checkArgumentCount(ctx, functionName, 1);
Expression typeArgument = (Expression)visitor.visit(ctx.paramList().expression(0));
if (!(typeArgument instanceof Literal)) {
throw new IllegalArgumentException("Expected literal argument");
}
Literal typeLiteral = (Literal)typeArgument;
if (!(DataTypes.equal(typeLiteral.getResultType(), builder.resolveTypeName("System", "String")))) {
throw new IllegalArgumentException("Expected string literal argument");
}
String typeSpecifier = ((Literal)typeArgument).getValue();
DataType isType = builder.resolveTypeSpecifier(typeSpecifier);
AliasRef thisRef = of.createAliasRef().withName(source.getAlias());
boolean isSingular = !(source.getResultType() instanceof ListType);
DataType elementType = isSingular ? source.getResultType() : ((ListType)source.getResultType()).getElementType();
thisRef.setResultType(elementType);
Is is = of.createIs().withOperand(thisRef);
if (isType instanceof NamedType) {
is.setIsType(builder.dataTypeToQName(isType));
}
else {
is.setIsTypeSpecifier(builder.dataTypeToTypeSpecifier(isType));
}
is.setResultType(builder.resolveTypeName("System", "Boolean"));
return createQuery(source, null, is, null);
}
finally {
exitQueryContext();
}
} } | public class class_name {
private Expression createOfType(Expression target, String functionName, @NotNull cqlParser.FunctionContext ctx) {
AliasedQuerySource source = enterQueryContext(target);
try {
checkArgumentCount(ctx, functionName, 1); // depends on control dependency: [try], data = [none]
Expression typeArgument = (Expression)visitor.visit(ctx.paramList().expression(0));
if (!(typeArgument instanceof Literal)) {
throw new IllegalArgumentException("Expected literal argument");
}
Literal typeLiteral = (Literal)typeArgument;
if (!(DataTypes.equal(typeLiteral.getResultType(), builder.resolveTypeName("System", "String")))) {
throw new IllegalArgumentException("Expected string literal argument");
}
String typeSpecifier = ((Literal)typeArgument).getValue();
DataType isType = builder.resolveTypeSpecifier(typeSpecifier);
AliasRef thisRef = of.createAliasRef().withName(source.getAlias());
boolean isSingular = !(source.getResultType() instanceof ListType);
DataType elementType = isSingular ? source.getResultType() : ((ListType)source.getResultType()).getElementType();
thisRef.setResultType(elementType); // depends on control dependency: [try], data = [none]
Is is = of.createIs().withOperand(thisRef);
if (isType instanceof NamedType) {
is.setIsType(builder.dataTypeToQName(isType)); // depends on control dependency: [if], data = [none]
}
else {
is.setIsTypeSpecifier(builder.dataTypeToTypeSpecifier(isType)); // depends on control dependency: [if], data = [none]
}
is.setResultType(builder.resolveTypeName("System", "Boolean")); // depends on control dependency: [try], data = [none]
return createQuery(source, null, is, null); // depends on control dependency: [try], data = [none]
}
finally {
exitQueryContext();
}
} } |
public class class_name {
@Override
public <T> BindingImpl<T> getBinding(Key<T> key) {
Errors errors = new Errors(checkNotNull(key, "key"));
try {
BindingImpl<T> result = getBindingOrThrow(key, errors, JitLimitation.EXISTING_JIT);
errors.throwConfigurationExceptionIfErrorsExist();
return result;
} catch (ErrorsException e) {
throw new ConfigurationException(errors.merge(e.getErrors()).getMessages());
}
} } | public class class_name {
@Override
public <T> BindingImpl<T> getBinding(Key<T> key) {
Errors errors = new Errors(checkNotNull(key, "key"));
try {
BindingImpl<T> result = getBindingOrThrow(key, errors, JitLimitation.EXISTING_JIT);
errors.throwConfigurationExceptionIfErrorsExist(); // depends on control dependency: [try], data = [none]
return result; // depends on control dependency: [try], data = [none]
} catch (ErrorsException e) {
throw new ConfigurationException(errors.merge(e.getErrors()).getMessages());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final EObject ruleNegatedToken() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
EObject lv_terminal_1_0 = null;
enterRule();
try {
// InternalXtext.g:3336:2: ( (otherlv_0= '!' ( (lv_terminal_1_0= ruleTerminalTokenElement ) ) ) )
// InternalXtext.g:3337:2: (otherlv_0= '!' ( (lv_terminal_1_0= ruleTerminalTokenElement ) ) )
{
// InternalXtext.g:3337:2: (otherlv_0= '!' ( (lv_terminal_1_0= ruleTerminalTokenElement ) ) )
// InternalXtext.g:3338:3: otherlv_0= '!' ( (lv_terminal_1_0= ruleTerminalTokenElement ) )
{
otherlv_0=(Token)match(input,41,FollowSets000.FOLLOW_47);
newLeafNode(otherlv_0, grammarAccess.getNegatedTokenAccess().getExclamationMarkKeyword_0());
// InternalXtext.g:3342:3: ( (lv_terminal_1_0= ruleTerminalTokenElement ) )
// InternalXtext.g:3343:4: (lv_terminal_1_0= ruleTerminalTokenElement )
{
// InternalXtext.g:3343:4: (lv_terminal_1_0= ruleTerminalTokenElement )
// InternalXtext.g:3344:5: lv_terminal_1_0= ruleTerminalTokenElement
{
newCompositeNode(grammarAccess.getNegatedTokenAccess().getTerminalTerminalTokenElementParserRuleCall_1_0());
pushFollow(FollowSets000.FOLLOW_2);
lv_terminal_1_0=ruleTerminalTokenElement();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getNegatedTokenRule());
}
set(
current,
"terminal",
lv_terminal_1_0,
"org.eclipse.xtext.Xtext.TerminalTokenElement");
afterParserOrEnumRuleCall();
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleNegatedToken() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
EObject lv_terminal_1_0 = null;
enterRule();
try {
// InternalXtext.g:3336:2: ( (otherlv_0= '!' ( (lv_terminal_1_0= ruleTerminalTokenElement ) ) ) )
// InternalXtext.g:3337:2: (otherlv_0= '!' ( (lv_terminal_1_0= ruleTerminalTokenElement ) ) )
{
// InternalXtext.g:3337:2: (otherlv_0= '!' ( (lv_terminal_1_0= ruleTerminalTokenElement ) ) )
// InternalXtext.g:3338:3: otherlv_0= '!' ( (lv_terminal_1_0= ruleTerminalTokenElement ) )
{
otherlv_0=(Token)match(input,41,FollowSets000.FOLLOW_47);
newLeafNode(otherlv_0, grammarAccess.getNegatedTokenAccess().getExclamationMarkKeyword_0());
// InternalXtext.g:3342:3: ( (lv_terminal_1_0= ruleTerminalTokenElement ) )
// InternalXtext.g:3343:4: (lv_terminal_1_0= ruleTerminalTokenElement )
{
// InternalXtext.g:3343:4: (lv_terminal_1_0= ruleTerminalTokenElement )
// InternalXtext.g:3344:5: lv_terminal_1_0= ruleTerminalTokenElement
{
newCompositeNode(grammarAccess.getNegatedTokenAccess().getTerminalTerminalTokenElementParserRuleCall_1_0());
pushFollow(FollowSets000.FOLLOW_2);
lv_terminal_1_0=ruleTerminalTokenElement();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getNegatedTokenRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"terminal",
lv_terminal_1_0,
"org.eclipse.xtext.Xtext.TerminalTokenElement");
afterParserOrEnumRuleCall();
}
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
public void setElasticGpuSpecification(java.util.Collection<ElasticGpuSpecification> elasticGpuSpecification) {
if (elasticGpuSpecification == null) {
this.elasticGpuSpecification = null;
return;
}
this.elasticGpuSpecification = new com.amazonaws.internal.SdkInternalList<ElasticGpuSpecification>(elasticGpuSpecification);
} } | public class class_name {
public void setElasticGpuSpecification(java.util.Collection<ElasticGpuSpecification> elasticGpuSpecification) {
if (elasticGpuSpecification == null) {
this.elasticGpuSpecification = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.elasticGpuSpecification = new com.amazonaws.internal.SdkInternalList<ElasticGpuSpecification>(elasticGpuSpecification);
} } |
public class class_name {
public void setWeekDateTimeFormatter(DateTimeFormatter formatter) {
if (getFormatterMap().get(ViewType.WEEK_VIEW) == null) {
getFormatterMap().put(ViewType.WEEK_VIEW, formatter);
} else {
getFormatterMap().replace(ViewType.WEEK_VIEW, formatter);
}
} } | public class class_name {
public void setWeekDateTimeFormatter(DateTimeFormatter formatter) {
if (getFormatterMap().get(ViewType.WEEK_VIEW) == null) {
getFormatterMap().put(ViewType.WEEK_VIEW, formatter); // depends on control dependency: [if], data = [none]
} else {
getFormatterMap().replace(ViewType.WEEK_VIEW, formatter); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static UShort[] ushort_a(short... values) {
UShort[] array = new UShort[values.length];
for (int i = 0; i < values.length; i++) {
array[i] = ushort(values[i]);
}
return array;
} } | public class class_name {
public static UShort[] ushort_a(short... values) {
UShort[] array = new UShort[values.length];
for (int i = 0; i < values.length; i++) {
array[i] = ushort(values[i]);
// depends on control dependency: [for], data = [i]
}
return array;
} } |
public class class_name {
private void flush(boolean isEnd)
{
if (_startOffset == _offset && _bufferSize == 0) {
if (! isCommitted() || isEnd) {
flush(null, isEnd);
_startOffset = bufferStart();
_offset = _startOffset;
}
return;
}
int sublen = _offset - _startOffset;
_tBuf.length(_offset);
_contentLength += _offset - _startOffset;
_bufferSize = 0;
if (_startOffset > 0) {
fillChunkHeader(_tBuf, sublen);
}
flush(_tBuf, isEnd);
if (! isEnd) {
_tBuf = TempBuffer.create();
_startOffset = bufferStart();
_offset = _startOffset;
_tBuf.length(_offset);
_buffer = _tBuf.buffer();
}
else {
_tBuf = null;
}
} } | public class class_name {
private void flush(boolean isEnd)
{
if (_startOffset == _offset && _bufferSize == 0) {
if (! isCommitted() || isEnd) {
flush(null, isEnd); // depends on control dependency: [if], data = [isEnd)]
_startOffset = bufferStart(); // depends on control dependency: [if], data = [none]
_offset = _startOffset; // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
int sublen = _offset - _startOffset;
_tBuf.length(_offset);
_contentLength += _offset - _startOffset;
_bufferSize = 0;
if (_startOffset > 0) {
fillChunkHeader(_tBuf, sublen); // depends on control dependency: [if], data = [none]
}
flush(_tBuf, isEnd);
if (! isEnd) {
_tBuf = TempBuffer.create(); // depends on control dependency: [if], data = [none]
_startOffset = bufferStart(); // depends on control dependency: [if], data = [none]
_offset = _startOffset; // depends on control dependency: [if], data = [none]
_tBuf.length(_offset); // depends on control dependency: [if], data = [none]
_buffer = _tBuf.buffer(); // depends on control dependency: [if], data = [none]
}
else {
_tBuf = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void setSpecialHeader(HeaderKeys key, byte[] value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setSpecialHeader(h,b[]): " + key.getName());
}
removeHdrInstances(findHeader(key), FILTER_NO);
HeaderElement elem = getElement(key);
elem.setByteArrayValue(value);
addHeader(elem, FILTER_NO);
} } | public class class_name {
protected void setSpecialHeader(HeaderKeys key, byte[] value) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "setSpecialHeader(h,b[]): " + key.getName()); // depends on control dependency: [if], data = [none]
}
removeHdrInstances(findHeader(key), FILTER_NO);
HeaderElement elem = getElement(key);
elem.setByteArrayValue(value);
addHeader(elem, FILTER_NO);
} } |
public class class_name {
private List<StageOutput> addReportedErrorsIfNeeded(List<StageOutput> snapshotsOfAllStagesOutput) {
synchronized (this.reportedErrors) {
if(reportedErrors.isEmpty()) {
return snapshotsOfAllStagesOutput;
}
try {
return snapshotsOfAllStagesOutput.stream()
.map(so -> new StageOutput(
so.getInstanceName(),
so.getOutput(),
so.getErrorRecords(),
reportedErrors.get(so.getInstanceName()),
so.getEventRecords()
))
.collect(Collectors.toList());
} finally {
reportedErrors.clear();
}
}
} } | public class class_name {
private List<StageOutput> addReportedErrorsIfNeeded(List<StageOutput> snapshotsOfAllStagesOutput) {
synchronized (this.reportedErrors) {
if(reportedErrors.isEmpty()) {
return snapshotsOfAllStagesOutput; // depends on control dependency: [if], data = [none]
}
try {
return snapshotsOfAllStagesOutput.stream()
.map(so -> new StageOutput(
so.getInstanceName(),
so.getOutput(),
so.getErrorRecords(),
reportedErrors.get(so.getInstanceName()),
so.getEventRecords()
))
.collect(Collectors.toList()); // depends on control dependency: [try], data = [none]
} finally {
reportedErrors.clear();
}
}
} } |
public class class_name {
@Override public ImSortedMap<K,V> subMap(K fromKey, K toKey) {
int diff = comp.compare(fromKey, toKey);
if (diff > 0) {
throw new IllegalArgumentException("fromKey is greater than toKey");
}
UnEntry<K,V> last = last();
K lastKey = last.getKey();
int compFromKeyLastKey = comp.compare(fromKey, lastKey);
// If no intersect, return empty. We aren't checking the toKey vs. the firstKey() because
// that's a single pass through the iterator loop which is probably as cheap as checking
// here.
if ( (diff == 0) || (compFromKeyLastKey > 0) ) {
return new PersistentTreeMap<>(comp, null, 0);
}
// If map is entirely contained, just return it.
if ( (comp.compare(fromKey, firstKey()) <= 0) &&
(comp.compare(toKey, lastKey) > 0) ) {
return this;
}
// Don't iterate through entire map for only the last item.
if (compFromKeyLastKey == 0) {
return ofComp(comp, Collections.singletonList(last));
}
ImSortedMap<K,V> ret = new PersistentTreeMap<>(comp, null, 0);
UnmodIterator<UnEntry<K,V>> iter = this.iterator();
while (iter.hasNext()) {
UnEntry<K,V> next = iter.next();
K key = next.getKey();
if (comp.compare(toKey, key) <= 0) {
break;
}
if (comp.compare(fromKey, key) > 0) {
continue;
}
ret = ret.assoc(key, next.getValue());
}
return ret;
} } | public class class_name {
@Override public ImSortedMap<K,V> subMap(K fromKey, K toKey) {
int diff = comp.compare(fromKey, toKey);
if (diff > 0) {
throw new IllegalArgumentException("fromKey is greater than toKey");
}
UnEntry<K,V> last = last();
K lastKey = last.getKey();
int compFromKeyLastKey = comp.compare(fromKey, lastKey);
// If no intersect, return empty. We aren't checking the toKey vs. the firstKey() because
// that's a single pass through the iterator loop which is probably as cheap as checking
// here.
if ( (diff == 0) || (compFromKeyLastKey > 0) ) {
return new PersistentTreeMap<>(comp, null, 0); // depends on control dependency: [if], data = [none]
}
// If map is entirely contained, just return it.
if ( (comp.compare(fromKey, firstKey()) <= 0) &&
(comp.compare(toKey, lastKey) > 0) ) {
return this; // depends on control dependency: [if], data = [none]
}
// Don't iterate through entire map for only the last item.
if (compFromKeyLastKey == 0) {
return ofComp(comp, Collections.singletonList(last)); // depends on control dependency: [if], data = [none]
}
ImSortedMap<K,V> ret = new PersistentTreeMap<>(comp, null, 0);
UnmodIterator<UnEntry<K,V>> iter = this.iterator();
while (iter.hasNext()) {
UnEntry<K,V> next = iter.next();
K key = next.getKey();
if (comp.compare(toKey, key) <= 0) {
break;
}
if (comp.compare(fromKey, key) > 0) {
continue;
}
ret = ret.assoc(key, next.getValue()); // depends on control dependency: [while], data = [none]
}
return ret;
} } |
public class class_name {
@SuppressWarnings("rawtypes")
private static Object getOneLayerClone(Object source) {
if (null == source) {
return null;
}
Object target = null;
try {
Constructor con = source.getClass().getConstructor();
target = con.newInstance();
// 把一个集合类中的数据拷贝到另一集合类中
PropertyUtils.copyProperties(target, source);
} catch (Exception e) {
logger.error("clone object exception object class:" + source.getClass(), e);
}
return target;
} } | public class class_name {
@SuppressWarnings("rawtypes")
private static Object getOneLayerClone(Object source) {
if (null == source) {
return null; // depends on control dependency: [if], data = [none]
}
Object target = null;
try {
Constructor con = source.getClass().getConstructor();
target = con.newInstance(); // depends on control dependency: [try], data = [none]
// 把一个集合类中的数据拷贝到另一集合类中
PropertyUtils.copyProperties(target, source); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("clone object exception object class:" + source.getClass(), e);
} // depends on control dependency: [catch], data = [none]
return target;
} } |
public class class_name {
public String polymerToHELM2() {
StringBuilder notation = new StringBuilder();
for (int i = 0; i < listOfPolymers.size(); i++) {
if (listOfPolymers.get(i).isAnnotationHere()) {
notation.append(listOfPolymers.get(i).getPolymerID() + "{" + listOfPolymers.get(i).toHELM2() + "}\""
+ listOfPolymers.get(i).getAnnotation() + "\"|");
} else {
notation.append(listOfPolymers.get(i).getPolymerID() + "{" + listOfPolymers.get(i).toHELM2() + "}" + "|");
}
}
notation.setLength(notation.length() - 1);
return notation.toString();
} } | public class class_name {
public String polymerToHELM2() {
StringBuilder notation = new StringBuilder();
for (int i = 0; i < listOfPolymers.size(); i++) {
if (listOfPolymers.get(i).isAnnotationHere()) {
notation.append(listOfPolymers.get(i).getPolymerID() + "{" + listOfPolymers.get(i).toHELM2() + "}\""
+ listOfPolymers.get(i).getAnnotation() + "\"|");
// depends on control dependency: [if], data = [none]
} else {
notation.append(listOfPolymers.get(i).getPolymerID() + "{" + listOfPolymers.get(i).toHELM2() + "}" + "|");
// depends on control dependency: [if], data = [none]
}
}
notation.setLength(notation.length() - 1);
return notation.toString();
} } |
public class class_name {
public void setWorkspaces(java.util.Collection<Workspace> workspaces) {
if (workspaces == null) {
this.workspaces = null;
return;
}
this.workspaces = new com.amazonaws.internal.SdkInternalList<Workspace>(workspaces);
} } | public class class_name {
public void setWorkspaces(java.util.Collection<Workspace> workspaces) {
if (workspaces == null) {
this.workspaces = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.workspaces = new com.amazonaws.internal.SdkInternalList<Workspace>(workspaces);
} } |
public class class_name {
public void type(String text) {
String action = "Typing text '" + text + IN + prettyOutput();
String expected = prettyOutputStart() + " is present, displayed, and enabled to have text " + text + " typed in";
boolean warning = false;
try {
if (isNotPresentEnabledInput(action, expected)) {
return;
}
if (!is.displayed()) {
warning = true;
}
WebElement webElement = getWebElement();
webElement.sendKeys(text);
} catch (Exception e) {
log.warn(e);
reporter.fail(action, expected, CANT_TYPE + prettyOutputEnd() + e.getMessage());
return;
}
if (warning) {
reporter.check(action, expected, TYPED + text + IN + prettyOutput() +
". <b>THIS ELEMENT WAS NOT DISPLAYED. THIS MIGHT BE AN ISSUE.</b>");
} else {
reporter.pass(action, expected, TYPED + text + IN + prettyOutputEnd().trim());
}
} } | public class class_name {
public void type(String text) {
String action = "Typing text '" + text + IN + prettyOutput();
String expected = prettyOutputStart() + " is present, displayed, and enabled to have text " + text + " typed in";
boolean warning = false;
try {
if (isNotPresentEnabledInput(action, expected)) {
return; // depends on control dependency: [if], data = [none]
}
if (!is.displayed()) {
warning = true; // depends on control dependency: [if], data = [none]
}
WebElement webElement = getWebElement();
webElement.sendKeys(text); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.warn(e);
reporter.fail(action, expected, CANT_TYPE + prettyOutputEnd() + e.getMessage());
return;
} // depends on control dependency: [catch], data = [none]
if (warning) {
reporter.check(action, expected, TYPED + text + IN + prettyOutput() +
". <b>THIS ELEMENT WAS NOT DISPLAYED. THIS MIGHT BE AN ISSUE.</b>"); // depends on control dependency: [if], data = [none]
} else {
reporter.pass(action, expected, TYPED + text + IN + prettyOutputEnd().trim()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static ProviderList getProviderList() {
ProviderList list = getThreadProviderList();
if (list == null) {
list = getSystemProviderList();
}
return list;
} } | public class class_name {
public static ProviderList getProviderList() {
ProviderList list = getThreadProviderList();
if (list == null) {
list = getSystemProviderList(); // depends on control dependency: [if], data = [none]
}
return list;
} } |
public class class_name {
public String doAddRunner()
{
try
{
selectedRunner = Runner.newInstance(newRunnerName);
selectedRunner.setCmdLineTemplate(newCmdLineTemplate);
selectedRunner.setMainClass(newMainClass);
selectedRunner.setServerName(newServerName);
selectedRunner.setServerPort(newServerPort);
selectedRunner.setEnvironmentType(EnvironmentType.newInstance(newEnvType));
selectedRunner.setSecured(secured);
getService().createRunner(selectedRunner);
successfullAction();
}
catch (GreenPepperServerException e)
{
addActionError(e.getId());
}
return doGetRunners();
} } | public class class_name {
public String doAddRunner()
{
try
{
selectedRunner = Runner.newInstance(newRunnerName); // depends on control dependency: [try], data = [none]
selectedRunner.setCmdLineTemplate(newCmdLineTemplate); // depends on control dependency: [try], data = [none]
selectedRunner.setMainClass(newMainClass); // depends on control dependency: [try], data = [none]
selectedRunner.setServerName(newServerName); // depends on control dependency: [try], data = [none]
selectedRunner.setServerPort(newServerPort); // depends on control dependency: [try], data = [none]
selectedRunner.setEnvironmentType(EnvironmentType.newInstance(newEnvType)); // depends on control dependency: [try], data = [none]
selectedRunner.setSecured(secured); // depends on control dependency: [try], data = [none]
getService().createRunner(selectedRunner); // depends on control dependency: [try], data = [none]
successfullAction(); // depends on control dependency: [try], data = [none]
}
catch (GreenPepperServerException e)
{
addActionError(e.getId());
} // depends on control dependency: [catch], data = [none]
return doGetRunners();
} } |
public class class_name {
private static void formalTypeParameters(Result sb, List<? extends TypeParameterElement> typeParameters) throws IOException
{
if (!typeParameters.isEmpty())
{
sb.setNeedsSignature(true);
sb.append('<');
for (TypeParameterElement typeParameter : typeParameters)
{
formalTypeParameter(sb, typeParameter);
}
sb.append('>');
}
} } | public class class_name {
private static void formalTypeParameters(Result sb, List<? extends TypeParameterElement> typeParameters) throws IOException
{
if (!typeParameters.isEmpty())
{
sb.setNeedsSignature(true);
sb.append('<');
for (TypeParameterElement typeParameter : typeParameters)
{
formalTypeParameter(sb, typeParameter); // depends on control dependency: [for], data = [typeParameter]
}
sb.append('>');
}
} } |
public class class_name {
public static String getLoadableName( TypeDeclaration jclass )
{
TypeDeclaration containingClass = jclass.getDeclaringType();
if ( containingClass == null )
{
return jclass.getQualifiedName();
}
else
{
return getLoadableName( containingClass ) + '$' + jclass.getSimpleName();
}
} } | public class class_name {
public static String getLoadableName( TypeDeclaration jclass )
{
TypeDeclaration containingClass = jclass.getDeclaringType();
if ( containingClass == null )
{
return jclass.getQualifiedName(); // depends on control dependency: [if], data = [none]
}
else
{
return getLoadableName( containingClass ) + '$' + jclass.getSimpleName(); // depends on control dependency: [if], data = [( containingClass]
}
} } |
public class class_name {
private Collection<? extends String> recursiveCollect(String refId,
Map<String, SortedSet<String>> relationKeyMap, int maxRecursion) {
Set<String> list = new HashSet<>();
if (maxRecursion > 0 && relationKeyMap.containsKey(refId)) {
SortedSet<String> subList = relationKeyMap.get(refId);
for (String subRefId : subList) {
list.add(subRefId);
list.addAll(
recursiveCollect(subRefId, relationKeyMap, maxRecursion - 1));
}
}
return list;
} } | public class class_name {
private Collection<? extends String> recursiveCollect(String refId,
Map<String, SortedSet<String>> relationKeyMap, int maxRecursion) {
Set<String> list = new HashSet<>();
if (maxRecursion > 0 && relationKeyMap.containsKey(refId)) {
SortedSet<String> subList = relationKeyMap.get(refId);
for (String subRefId : subList) {
list.add(subRefId); // depends on control dependency: [for], data = [subRefId]
list.addAll(
recursiveCollect(subRefId, relationKeyMap, maxRecursion - 1)); // depends on control dependency: [for], data = [none]
}
}
return list;
} } |
public class class_name {
static public void main(String[] args) {
if (args.length == 0) {
System.out.println("Supply a Base32-encoded argument.");
return;
}
System.out.println(" Original: " + args[0]);
byte[] decoded = Base32.decode(args[0]);
System.out.print(" Hex: ");
for (int i = 0; i < decoded.length; i++) {
int b = decoded[i];
if (b < 0) {
b += 256;
}
System.out.print((Integer.toHexString(b + 256)).substring(1));
}
System.out.println();
System.out.println("Reencoded: " + Base32.encode(decoded));
} } | public class class_name {
static public void main(String[] args) {
if (args.length == 0) {
System.out.println("Supply a Base32-encoded argument."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
System.out.println(" Original: " + args[0]);
byte[] decoded = Base32.decode(args[0]);
System.out.print(" Hex: ");
for (int i = 0; i < decoded.length; i++) {
int b = decoded[i];
if (b < 0) {
b += 256; // depends on control dependency: [if], data = [none]
}
System.out.print((Integer.toHexString(b + 256)).substring(1)); // depends on control dependency: [for], data = [none]
}
System.out.println();
System.out.println("Reencoded: " + Base32.encode(decoded));
} } |
public class class_name {
public Optional<Identification> getIdentificationFor(X x) {
Identification identification = map.get(x);
if (identification == null || identification.equals(placeholder)) {
return Optional.empty();
} else {
return Optional.of(identification);
}
} } | public class class_name {
public Optional<Identification> getIdentificationFor(X x) {
Identification identification = map.get(x);
if (identification == null || identification.equals(placeholder)) {
return Optional.empty(); // depends on control dependency: [if], data = [none]
} else {
return Optional.of(identification); // depends on control dependency: [if], data = [(identification]
}
} } |
public class class_name {
public T evaluate(Object target, Map<String, Object> variables) {
Expression expression = getParsedExpression();
context.setRootObject(target);
if (variables != null) {
context.setVariables(variables);
}
try {
return (T) expression.getValue(context);
}
catch (EvaluationException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public T evaluate(Object target, Map<String, Object> variables) {
Expression expression = getParsedExpression();
context.setRootObject(target);
if (variables != null) {
context.setVariables(variables);
// depends on control dependency: [if], data = [(variables]
}
try {
return (T) expression.getValue(context);
// depends on control dependency: [try], data = [none]
}
catch (EvaluationException e) {
throw new RuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean isDBCCase(String str)
{
if (str != null)
{
str += " ";
for (int i = 0; i < str.length(); i++)
{
String s = str.substring(i, i + 1);
int length = 0;
try
{
length = s.getBytes("GBK").length;
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
length = s.getBytes().length;
}
if (length != 1)
return false;
}
return true;
}
return false;
} } | public class class_name {
public static boolean isDBCCase(String str)
{
if (str != null)
{
str += " "; // depends on control dependency: [if], data = [none]
for (int i = 0; i < str.length(); i++)
{
String s = str.substring(i, i + 1);
int length = 0;
try
{
length = s.getBytes("GBK").length; // depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
length = s.getBytes().length;
} // depends on control dependency: [catch], data = [none]
if (length != 1)
return false;
}
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static boolean checkUri(String uri) {
QueryStringDecoder queryStringDecoder = new QueryStringDecoder(uri, true);
String path = queryStringDecoder.path();
int groupIndex = path.indexOf('/') + 1,
unitIndex = path.indexOf('/', groupIndex) + 1;
if (groupIndex == 0 || unitIndex == 0) {
LOG.warn("URI is illegal: " + uri);
return false;
}
return true;
} } | public class class_name {
public static boolean checkUri(String uri) {
QueryStringDecoder queryStringDecoder = new QueryStringDecoder(uri, true);
String path = queryStringDecoder.path();
int groupIndex = path.indexOf('/') + 1,
unitIndex = path.indexOf('/', groupIndex) + 1;
if (groupIndex == 0 || unitIndex == 0) {
LOG.warn("URI is illegal: " + uri); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
@Override
public int compareTo(org.apache.hadoop.mapreduce.ID o) {
JVMId that = (JVMId)o;
int jobComp = this.jobId.compareTo(that.jobId);
if(jobComp == 0) {
if(this.isMap == that.isMap) {
return this.id - that.id;
} else {
return this.isMap ? -1 : 1;
}
} else {
return jobComp;
}
} } | public class class_name {
@Override
public int compareTo(org.apache.hadoop.mapreduce.ID o) {
JVMId that = (JVMId)o;
int jobComp = this.jobId.compareTo(that.jobId);
if(jobComp == 0) {
if(this.isMap == that.isMap) {
return this.id - that.id; // depends on control dependency: [if], data = [none]
} else {
return this.isMap ? -1 : 1; // depends on control dependency: [if], data = [none]
}
} else {
return jobComp; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean prefixEquals(IPAddressString other) {
// getting the prefix
Integer prefixLength = getNetworkPrefixLength();
if(prefixLength == null) {
return false;
}
if(other == this && !isPrefixOnly()) {
return true;
}
if(other.addressProvider.isUninitialized()) { // other not yet validated - if other is validated no need for this quick contains
// do the quick check that uses only the String of the other, matching til the end of the prefix length, for performance
Boolean directResult = addressProvider.prefixEquals(other.fullAddr);
if(directResult != null) {
return directResult.booleanValue();
}
}
if(other.isValid()) {
Boolean directResult = addressProvider.prefixEquals(other.addressProvider);
if(directResult != null) {
return directResult.booleanValue();
}
IPAddress thisAddress = getAddress();
IPAddress otherAddress = other.getAddress();
if(thisAddress != null) {
return otherAddress != null && prefixLength <= otherAddress.getBitCount() &&
thisAddress.prefixEquals(otherAddress);
}
// one or both addresses are null, so there is no prefix to speak of
}
return false;
} } | public class class_name {
public boolean prefixEquals(IPAddressString other) {
// getting the prefix
Integer prefixLength = getNetworkPrefixLength();
if(prefixLength == null) {
return false; // depends on control dependency: [if], data = [none]
}
if(other == this && !isPrefixOnly()) {
return true; // depends on control dependency: [if], data = [none]
}
if(other.addressProvider.isUninitialized()) { // other not yet validated - if other is validated no need for this quick contains
// do the quick check that uses only the String of the other, matching til the end of the prefix length, for performance
Boolean directResult = addressProvider.prefixEquals(other.fullAddr);
if(directResult != null) {
return directResult.booleanValue(); // depends on control dependency: [if], data = [none]
}
}
if(other.isValid()) {
Boolean directResult = addressProvider.prefixEquals(other.addressProvider);
if(directResult != null) {
return directResult.booleanValue(); // depends on control dependency: [if], data = [none]
}
IPAddress thisAddress = getAddress();
IPAddress otherAddress = other.getAddress();
if(thisAddress != null) {
return otherAddress != null && prefixLength <= otherAddress.getBitCount() &&
thisAddress.prefixEquals(otherAddress); // depends on control dependency: [if], data = [none]
}
// one or both addresses are null, so there is no prefix to speak of
}
return false;
} } |
public class class_name {
public void setConfigurationProperty(final String name, final Object value)
{
if (XIncProcConfiguration.ALLOW_FIXUP_BASE_URIS.equals(name))
{
if (value instanceof Boolean)
{
this.baseUrisFixup = (Boolean) value;
}
else if (value instanceof String)
{
this.baseUrisFixup = Boolean.valueOf((String) value);
}
}
if (XIncProcConfiguration.ALLOW_FIXUP_LANGUAGE.equals(name))
{
if (value instanceof Boolean)
{
this.languageFixup = (Boolean) value;
}
else if (value instanceof String)
{
this.languageFixup = Boolean.valueOf((String) value);
}
}
} } | public class class_name {
public void setConfigurationProperty(final String name, final Object value)
{
if (XIncProcConfiguration.ALLOW_FIXUP_BASE_URIS.equals(name))
{
if (value instanceof Boolean)
{
this.baseUrisFixup = (Boolean) value; // depends on control dependency: [if], data = [none]
}
else if (value instanceof String)
{
this.baseUrisFixup = Boolean.valueOf((String) value); // depends on control dependency: [if], data = [none]
}
}
if (XIncProcConfiguration.ALLOW_FIXUP_LANGUAGE.equals(name))
{
if (value instanceof Boolean)
{
this.languageFixup = (Boolean) value; // depends on control dependency: [if], data = [none]
}
else if (value instanceof String)
{
this.languageFixup = Boolean.valueOf((String) value); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
void constructA678() {
final int N = X1.numRows;
// Pseudo-inverse of hat(p)
computePseudo(X1,P_plus);
DMatrixRMaj PPpXP = new DMatrixRMaj(1,1);
DMatrixRMaj PPpYP = new DMatrixRMaj(1,1);
computePPXP(X1,P_plus,X2,0,PPpXP);
computePPXP(X1,P_plus,X2,1,PPpYP);
DMatrixRMaj PPpX = new DMatrixRMaj(1,1);
DMatrixRMaj PPpY = new DMatrixRMaj(1,1);
computePPpX(X1,P_plus,X2,0,PPpX);
computePPpX(X1,P_plus,X2,1,PPpY);
//============ Equations 20
computeEq20(X2,X1,XP_bar);
//============ Equation 21
A.reshape(N *2,3);
double XP_bar_x = XP_bar[0];
double XP_bar_y = XP_bar[1];
double YP_bar_x = XP_bar[2];
double YP_bar_y = XP_bar[3];
// Compute the top half of A
for (int i = 0, index = 0, indexA = 0; i < N; i++, index+=2) {
double x = -X2.data[i*2]; // X'
double P_hat_x = X1.data[index]; // hat{P}[0]
double P_hat_y = X1.data[index+1]; // hat{P}[1]
// x'*hat{p} - bar{X*P} - PPpXP
A.data[indexA++] = x*P_hat_x - XP_bar_x - PPpXP.data[index];
A.data[indexA++] = x*P_hat_y - XP_bar_y - PPpXP.data[index+1];
// X'*1 - PPx1
A.data[indexA++] = x - PPpX.data[i];
}
// Compute the bottom half of A
for (int i = 0, index = 0, indexA = N*3; i < N; i++, index+=2) {
double x = -X2.data[i*2+1];
double P_hat_x = X1.data[index];
double P_hat_y = X1.data[index+1];
// x'*hat{p} - bar{X*P} - PPpXP
A.data[indexA++] = x*P_hat_x - YP_bar_x - PPpYP.data[index];
A.data[indexA++] = x*P_hat_y - YP_bar_y - PPpYP.data[index+1];
// X'*1 - PPx1
A.data[indexA++] = x - PPpY.data[i];
}
} } | public class class_name {
void constructA678() {
final int N = X1.numRows;
// Pseudo-inverse of hat(p)
computePseudo(X1,P_plus);
DMatrixRMaj PPpXP = new DMatrixRMaj(1,1);
DMatrixRMaj PPpYP = new DMatrixRMaj(1,1);
computePPXP(X1,P_plus,X2,0,PPpXP);
computePPXP(X1,P_plus,X2,1,PPpYP);
DMatrixRMaj PPpX = new DMatrixRMaj(1,1);
DMatrixRMaj PPpY = new DMatrixRMaj(1,1);
computePPpX(X1,P_plus,X2,0,PPpX);
computePPpX(X1,P_plus,X2,1,PPpY);
//============ Equations 20
computeEq20(X2,X1,XP_bar);
//============ Equation 21
A.reshape(N *2,3);
double XP_bar_x = XP_bar[0];
double XP_bar_y = XP_bar[1];
double YP_bar_x = XP_bar[2];
double YP_bar_y = XP_bar[3];
// Compute the top half of A
for (int i = 0, index = 0, indexA = 0; i < N; i++, index+=2) {
double x = -X2.data[i*2]; // X'
double P_hat_x = X1.data[index]; // hat{P}[0]
double P_hat_y = X1.data[index+1]; // hat{P}[1]
// x'*hat{p} - bar{X*P} - PPpXP
A.data[indexA++] = x*P_hat_x - XP_bar_x - PPpXP.data[index]; // depends on control dependency: [for], data = [none]
A.data[indexA++] = x*P_hat_y - XP_bar_y - PPpXP.data[index+1]; // depends on control dependency: [for], data = [none]
// X'*1 - PPx1
A.data[indexA++] = x - PPpX.data[i]; // depends on control dependency: [for], data = [i]
}
// Compute the bottom half of A
for (int i = 0, index = 0, indexA = N*3; i < N; i++, index+=2) {
double x = -X2.data[i*2+1];
double P_hat_x = X1.data[index];
double P_hat_y = X1.data[index+1];
// x'*hat{p} - bar{X*P} - PPpXP
A.data[indexA++] = x*P_hat_x - YP_bar_x - PPpYP.data[index]; // depends on control dependency: [for], data = [none]
A.data[indexA++] = x*P_hat_y - YP_bar_y - PPpYP.data[index+1]; // depends on control dependency: [for], data = [none]
// X'*1 - PPx1
A.data[indexA++] = x - PPpY.data[i]; // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private static AbstractType<?> updateWith(AbstractType<?> type, String keyspace, ByteBuffer toReplace, UserType updated)
{
if (type instanceof UserType)
{
UserType ut = (UserType)type;
// If it's directly the type we've updated, then just use the new one.
if (keyspace.equals(ut.keyspace) && toReplace.equals(ut.name))
return updated;
// Otherwise, check for nesting
List<AbstractType<?>> updatedTypes = updateTypes(ut.fieldTypes(), keyspace, toReplace, updated);
return updatedTypes == null ? null : new UserType(ut.keyspace, ut.name, new ArrayList<>(ut.fieldNames()), updatedTypes);
}
else if (type instanceof CompositeType)
{
CompositeType ct = (CompositeType)type;
List<AbstractType<?>> updatedTypes = updateTypes(ct.types, keyspace, toReplace, updated);
return updatedTypes == null ? null : CompositeType.getInstance(updatedTypes);
}
else if (type instanceof ColumnToCollectionType)
{
ColumnToCollectionType ctct = (ColumnToCollectionType)type;
Map<ByteBuffer, CollectionType> updatedTypes = null;
for (Map.Entry<ByteBuffer, CollectionType> entry : ctct.defined.entrySet())
{
AbstractType<?> t = updateWith(entry.getValue(), keyspace, toReplace, updated);
if (t == null)
continue;
if (updatedTypes == null)
updatedTypes = new HashMap<>(ctct.defined);
updatedTypes.put(entry.getKey(), (CollectionType)t);
}
return updatedTypes == null ? null : ColumnToCollectionType.getInstance(updatedTypes);
}
else if (type instanceof CollectionType)
{
if (type instanceof ListType)
{
AbstractType<?> t = updateWith(((ListType)type).getElementsType(), keyspace, toReplace, updated);
if (t == null)
return null;
return ListType.getInstance(t, type.isMultiCell());
}
else if (type instanceof SetType)
{
AbstractType<?> t = updateWith(((SetType)type).getElementsType(), keyspace, toReplace, updated);
if (t == null)
return null;
return SetType.getInstance(t, type.isMultiCell());
}
else
{
assert type instanceof MapType;
MapType mt = (MapType)type;
AbstractType<?> k = updateWith(mt.getKeysType(), keyspace, toReplace, updated);
AbstractType<?> v = updateWith(mt.getValuesType(), keyspace, toReplace, updated);
if (k == null && v == null)
return null;
return MapType.getInstance(k == null ? mt.getKeysType() : k, v == null ? mt.getValuesType() : v, type.isMultiCell());
}
}
else
{
return null;
}
} } | public class class_name {
private static AbstractType<?> updateWith(AbstractType<?> type, String keyspace, ByteBuffer toReplace, UserType updated)
{
if (type instanceof UserType)
{
UserType ut = (UserType)type;
// If it's directly the type we've updated, then just use the new one.
if (keyspace.equals(ut.keyspace) && toReplace.equals(ut.name))
return updated;
// Otherwise, check for nesting
List<AbstractType<?>> updatedTypes = updateTypes(ut.fieldTypes(), keyspace, toReplace, updated); // depends on control dependency: [if], data = [none]
return updatedTypes == null ? null : new UserType(ut.keyspace, ut.name, new ArrayList<>(ut.fieldNames()), updatedTypes); // depends on control dependency: [if], data = [none]
}
else if (type instanceof CompositeType)
{
CompositeType ct = (CompositeType)type;
List<AbstractType<?>> updatedTypes = updateTypes(ct.types, keyspace, toReplace, updated); // depends on control dependency: [if], data = [none]
return updatedTypes == null ? null : CompositeType.getInstance(updatedTypes); // depends on control dependency: [if], data = [none]
}
else if (type instanceof ColumnToCollectionType)
{
ColumnToCollectionType ctct = (ColumnToCollectionType)type;
Map<ByteBuffer, CollectionType> updatedTypes = null;
for (Map.Entry<ByteBuffer, CollectionType> entry : ctct.defined.entrySet())
{
AbstractType<?> t = updateWith(entry.getValue(), keyspace, toReplace, updated);
if (t == null)
continue;
if (updatedTypes == null)
updatedTypes = new HashMap<>(ctct.defined);
updatedTypes.put(entry.getKey(), (CollectionType)t); // depends on control dependency: [for], data = [entry]
}
return updatedTypes == null ? null : ColumnToCollectionType.getInstance(updatedTypes); // depends on control dependency: [if], data = [none]
}
else if (type instanceof CollectionType)
{
if (type instanceof ListType)
{
AbstractType<?> t = updateWith(((ListType)type).getElementsType(), keyspace, toReplace, updated);
if (t == null)
return null;
return ListType.getInstance(t, type.isMultiCell()); // depends on control dependency: [if], data = [none]
}
else if (type instanceof SetType)
{
AbstractType<?> t = updateWith(((SetType)type).getElementsType(), keyspace, toReplace, updated);
if (t == null)
return null;
return SetType.getInstance(t, type.isMultiCell()); // depends on control dependency: [if], data = [none]
}
else
{
assert type instanceof MapType;
MapType mt = (MapType)type;
AbstractType<?> k = updateWith(mt.getKeysType(), keyspace, toReplace, updated);
AbstractType<?> v = updateWith(mt.getValuesType(), keyspace, toReplace, updated);
if (k == null && v == null)
return null;
return MapType.getInstance(k == null ? mt.getKeysType() : k, v == null ? mt.getValuesType() : v, type.isMultiCell()); // depends on control dependency: [if], data = [none]
}
}
else
{
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected X509CertifiedPublicKey getPublicKey(CertifiedPublicKey publicKey)
{
if (publicKey instanceof X509CertifiedPublicKey) {
return (X509CertifiedPublicKey) publicKey;
}
throw new IllegalArgumentException(String.format("Unsupported certificate [%s], expecting X509 certificates.",
publicKey.getClass().getName()));
} } | public class class_name {
protected X509CertifiedPublicKey getPublicKey(CertifiedPublicKey publicKey)
{
if (publicKey instanceof X509CertifiedPublicKey) {
return (X509CertifiedPublicKey) publicKey; // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException(String.format("Unsupported certificate [%s], expecting X509 certificates.",
publicKey.getClass().getName()));
} } |
public class class_name {
private static boolean isModular(final Path javaHome) {
boolean result;
final List<String> cmd = new ArrayList<>();
cmd.add(resolveJavaCommand(javaHome));
cmd.add("--add-modules=java.se");
cmd.add("-version");
final ProcessBuilder builder = new ProcessBuilder(cmd);
Process process = null;
Path stdout = null;
try {
// Create a temporary file for stdout
stdout = Files.createTempFile("stdout", ".txt");
process = builder.redirectErrorStream(true)
.redirectOutput(stdout.toFile()).start();
if (process.waitFor(1, TimeUnit.SECONDS)) {
result = process.exitValue() == 0;
} else {
result = false;
}
} catch (IOException | InterruptedException e) {
result = false;
} finally {
if (process != null && process.isAlive()) {
process.destroyForcibly();
}
if (stdout != null) {
try {
Files.deleteIfExists(stdout);
} catch (IOException ignore) {
}
}
}
return result;
} } | public class class_name {
private static boolean isModular(final Path javaHome) {
boolean result;
final List<String> cmd = new ArrayList<>();
cmd.add(resolveJavaCommand(javaHome));
cmd.add("--add-modules=java.se");
cmd.add("-version");
final ProcessBuilder builder = new ProcessBuilder(cmd);
Process process = null;
Path stdout = null;
try {
// Create a temporary file for stdout
stdout = Files.createTempFile("stdout", ".txt"); // depends on control dependency: [try], data = [none]
process = builder.redirectErrorStream(true)
.redirectOutput(stdout.toFile()).start(); // depends on control dependency: [try], data = [none]
if (process.waitFor(1, TimeUnit.SECONDS)) {
result = process.exitValue() == 0; // depends on control dependency: [if], data = [none]
} else {
result = false; // depends on control dependency: [if], data = [none]
}
} catch (IOException | InterruptedException e) {
result = false;
} finally { // depends on control dependency: [catch], data = [none]
if (process != null && process.isAlive()) {
process.destroyForcibly(); // depends on control dependency: [if], data = [none]
}
if (stdout != null) {
try {
Files.deleteIfExists(stdout); // depends on control dependency: [try], data = [none]
} catch (IOException ignore) {
} // depends on control dependency: [catch], data = [none]
}
}
return result;
} } |
public class class_name {
public String firstCalledName() {
calledName = hostName.name;
if( Character.isDigit( calledName.charAt( 0 ))) {
int i, len, dots;
char[] data;
i = dots = 0; /* quick IP address validation */
len = calledName.length();
data = calledName.toCharArray();
while( i < len && Character.isDigit( data[i++] )) {
if( i == len && dots == 3 ) {
// probably an IP address
calledName = SMBSERVER_NAME;
break;
}
if( i < len && data[i] == '.' ) {
dots++;
i++;
}
}
} else {
switch (hostName.hexCode) {
case 0x1B:
case 0x1C:
case 0x1D:
calledName = SMBSERVER_NAME;
}
}
return calledName;
} } | public class class_name {
public String firstCalledName() {
calledName = hostName.name;
if( Character.isDigit( calledName.charAt( 0 ))) {
int i, len, dots;
char[] data;
i = dots = 0; /* quick IP address validation */
// depends on control dependency: [if], data = [none]
len = calledName.length();
// depends on control dependency: [if], data = [none]
data = calledName.toCharArray();
// depends on control dependency: [if], data = [none]
while( i < len && Character.isDigit( data[i++] )) {
if( i == len && dots == 3 ) {
// probably an IP address
calledName = SMBSERVER_NAME;
// depends on control dependency: [if], data = [none]
break;
}
if( i < len && data[i] == '.' ) {
dots++;
// depends on control dependency: [if], data = [none]
i++;
// depends on control dependency: [if], data = [none]
}
}
} else {
switch (hostName.hexCode) {
case 0x1B:
case 0x1C:
case 0x1D:
calledName = SMBSERVER_NAME;
}
}
return calledName;
} } |
public class class_name {
private int calculateCapacity(int minimumCapacity) {
int newCapacity = Math.min(Math.max(capacity, 2), minimumCapacity);
while (newCapacity < Math.min(minimumCapacity, maxCapacity)) {
newCapacity <<= 1;
}
return Math.min(newCapacity, maxCapacity);
} } | public class class_name {
private int calculateCapacity(int minimumCapacity) {
int newCapacity = Math.min(Math.max(capacity, 2), minimumCapacity);
while (newCapacity < Math.min(minimumCapacity, maxCapacity)) {
newCapacity <<= 1; // depends on control dependency: [while], data = [none]
}
return Math.min(newCapacity, maxCapacity);
} } |
public class class_name {
public static CmsFlexBucketConfiguration loadFromProperties(Properties properties) {
ArrayListMultimap<String, String> multimap = ArrayListMultimap.create();
List<String> clearAll = Lists.newArrayList();
for (Object keyObj : properties.keySet()) {
String key = (String)keyObj;
key = key.trim();
String value = (String)(properties.get(key));
value = value.trim();
if (key.startsWith(KEY_PREFIX_BUCKET)) {
String bucketName = key.substring(KEY_PREFIX_BUCKET.length());
multimap.putAll(bucketName, Arrays.asList(value.trim().split(" *, *")));
} else if (KEY_CLEAR_ALL.equals(key)) {
clearAll = Arrays.asList(value.trim().split(" *, *"));
}
}
CmsFlexBucketConfiguration result = new CmsFlexBucketConfiguration();
if (!clearAll.isEmpty()) {
result.setClearAll(clearAll);
}
for (String key : multimap.keySet()) {
result.add(key, multimap.get(key));
}
result.freeze();
return result;
} } | public class class_name {
public static CmsFlexBucketConfiguration loadFromProperties(Properties properties) {
ArrayListMultimap<String, String> multimap = ArrayListMultimap.create();
List<String> clearAll = Lists.newArrayList();
for (Object keyObj : properties.keySet()) {
String key = (String)keyObj;
key = key.trim(); // depends on control dependency: [for], data = [none]
String value = (String)(properties.get(key));
value = value.trim(); // depends on control dependency: [for], data = [none]
if (key.startsWith(KEY_PREFIX_BUCKET)) {
String bucketName = key.substring(KEY_PREFIX_BUCKET.length());
multimap.putAll(bucketName, Arrays.asList(value.trim().split(" *, *"))); // depends on control dependency: [if], data = [none]
} else if (KEY_CLEAR_ALL.equals(key)) {
clearAll = Arrays.asList(value.trim().split(" *, *")); // depends on control dependency: [if], data = [none]
}
}
CmsFlexBucketConfiguration result = new CmsFlexBucketConfiguration();
if (!clearAll.isEmpty()) {
result.setClearAll(clearAll); // depends on control dependency: [if], data = [none]
}
for (String key : multimap.keySet()) {
result.add(key, multimap.get(key)); // depends on control dependency: [for], data = [key]
}
result.freeze();
return result;
} } |
public class class_name {
public static <T extends Value> List<List<T>> split(List<T> input, long targetSize) {
Collections.sort(input, new Comparator<Value>() {
public int compare(Value o1, Value o2) {
return new Long(o1.getValue()).compareTo(new Long(o2.getValue()));
}
});
List<T> smaller = new ArrayList<T>();
List<T> bigger = new ArrayList<T>();
for(T v: input) {
if(v.getValue() >= targetSize) {
bigger.add(v);
} else {
smaller.add(v);
}
}
List<List<T>> ret = new ArrayList<List<T>>();
for(T b: bigger) {
List<T> elem = new ArrayList<T>();
elem.add(b);
ret.add(elem);
}
while(smaller.size()>0) {
ret.add(removeBestSubset(smaller, targetSize));
}
return ret;
} } | public class class_name {
public static <T extends Value> List<List<T>> split(List<T> input, long targetSize) {
Collections.sort(input, new Comparator<Value>() {
public int compare(Value o1, Value o2) {
return new Long(o1.getValue()).compareTo(new Long(o2.getValue()));
}
});
List<T> smaller = new ArrayList<T>();
List<T> bigger = new ArrayList<T>();
for(T v: input) {
if(v.getValue() >= targetSize) {
bigger.add(v); // depends on control dependency: [if], data = [none]
} else {
smaller.add(v); // depends on control dependency: [if], data = [none]
}
}
List<List<T>> ret = new ArrayList<List<T>>();
for(T b: bigger) {
List<T> elem = new ArrayList<T>();
elem.add(b); // depends on control dependency: [for], data = [b]
ret.add(elem); // depends on control dependency: [for], data = [none]
}
while(smaller.size()>0) {
ret.add(removeBestSubset(smaller, targetSize)); // depends on control dependency: [while], data = [none]
}
return ret;
} } |
public class class_name {
public void setUnmatchedFaces(java.util.Collection<ComparedFace> unmatchedFaces) {
if (unmatchedFaces == null) {
this.unmatchedFaces = null;
return;
}
this.unmatchedFaces = new java.util.ArrayList<ComparedFace>(unmatchedFaces);
} } | public class class_name {
public void setUnmatchedFaces(java.util.Collection<ComparedFace> unmatchedFaces) {
if (unmatchedFaces == null) {
this.unmatchedFaces = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.unmatchedFaces = new java.util.ArrayList<ComparedFace>(unmatchedFaces);
} } |
public class class_name {
private void sendNotification(Sid accountId, String errMessage, int errCode, String errType, boolean createNotification) {
NotificationsDao notifications = storage.getNotificationsDao();
Notification notification;
if (errType == "warning") {
if (logger.isDebugEnabled()) {
// https://github.com/RestComm/Restcomm-Connect/issues/1419 moved to debug to avoid polluting logs
logger.debug(errMessage); // send message to console
}
if (createNotification) {
notification = notification(accountId, ERROR_NOTIFICATION, errCode, errMessage);
notifications.addNotification(notification);
}
} else if (errType == "error") {
// https://github.com/RestComm/Restcomm-Connect/issues/1419 moved to debug to avoid polluting logs
if (logger.isDebugEnabled()) {
logger.debug(errMessage); // send message to console
}
if (createNotification) {
notification = notification(accountId, ERROR_NOTIFICATION, errCode, errMessage);
notifications.addNotification(notification);
}
} else if (errType == "info") {
// https://github.com/RestComm/Restcomm-Connect/issues/1419 moved to debug to avoid polluting logs
if (logger.isDebugEnabled()) {
logger.debug(errMessage); // send message to console
}
}
} } | public class class_name {
private void sendNotification(Sid accountId, String errMessage, int errCode, String errType, boolean createNotification) {
NotificationsDao notifications = storage.getNotificationsDao();
Notification notification;
if (errType == "warning") {
if (logger.isDebugEnabled()) {
// https://github.com/RestComm/Restcomm-Connect/issues/1419 moved to debug to avoid polluting logs
logger.debug(errMessage); // send message to console // depends on control dependency: [if], data = [none]
}
if (createNotification) {
notification = notification(accountId, ERROR_NOTIFICATION, errCode, errMessage); // depends on control dependency: [if], data = [none]
notifications.addNotification(notification); // depends on control dependency: [if], data = [none]
}
} else if (errType == "error") {
// https://github.com/RestComm/Restcomm-Connect/issues/1419 moved to debug to avoid polluting logs
if (logger.isDebugEnabled()) {
logger.debug(errMessage); // send message to console // depends on control dependency: [if], data = [none]
}
if (createNotification) {
notification = notification(accountId, ERROR_NOTIFICATION, errCode, errMessage); // depends on control dependency: [if], data = [none]
notifications.addNotification(notification); // depends on control dependency: [if], data = [none]
}
} else if (errType == "info") {
// https://github.com/RestComm/Restcomm-Connect/issues/1419 moved to debug to avoid polluting logs
if (logger.isDebugEnabled()) {
logger.debug(errMessage); // send message to console // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static PrivateKey loadPrivateKey(File file) {
FileInputStream inputStream = null;
try {
inputStream = new FileInputStream(file);
return loadPrivateKey(inputStream);
} catch (FileNotFoundException e) {
throw new RuntimeException("文件不存在");
}finally {
try {inputStream.close();} catch (Exception e2) {}
}
} } | public class class_name {
public static PrivateKey loadPrivateKey(File file) {
FileInputStream inputStream = null;
try {
inputStream = new FileInputStream(file); // depends on control dependency: [try], data = [none]
return loadPrivateKey(inputStream); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
throw new RuntimeException("文件不存在");
}finally { // depends on control dependency: [catch], data = [none]
try {inputStream.close();} catch (Exception e2) {} // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public List<B> getOutcomesByProbability(A first) {
if (counts.containsKey(first)) {
Map<B, Double> sortedMap = MapUtils.reverse(MapUtils.sortByValue(counts.get(first)));
return Lists.newArrayList(sortedMap.keySet());
}
return Collections.emptyList();
} } | public class class_name {
public List<B> getOutcomesByProbability(A first) {
if (counts.containsKey(first)) {
Map<B, Double> sortedMap = MapUtils.reverse(MapUtils.sortByValue(counts.get(first)));
return Lists.newArrayList(sortedMap.keySet()); // depends on control dependency: [if], data = [none]
}
return Collections.emptyList();
} } |
public class class_name {
@Override
protected String buildOrderSql(String sql, final String column, final boolean ascending) {
sql += " order by " + column;
if (!ascending) {
sql += " desc";
}
return sql;
} } | public class class_name {
@Override
protected String buildOrderSql(String sql, final String column, final boolean ascending) {
sql += " order by " + column;
if (!ascending) {
sql += " desc"; // depends on control dependency: [if], data = [none]
}
return sql;
} } |
public class class_name {
public void deleteVpc(DeleteVpcRequest deleteVpcRequest) {
checkNotNull(deleteVpcRequest, "request should not be null.");
checkNotNull(deleteVpcRequest.getVpcId(), "request vpcId should not be null.");
if (Strings.isNullOrEmpty(deleteVpcRequest.getClientToken())) {
deleteVpcRequest.setClientToken(this.generateClientToken());
}
InternalRequest internalRequest = this.createRequest(
deleteVpcRequest, HttpMethodName.DELETE, VPC_PREFIX, deleteVpcRequest.getVpcId());
internalRequest.addParameter("clientToken", deleteVpcRequest.getClientToken());
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} } | public class class_name {
public void deleteVpc(DeleteVpcRequest deleteVpcRequest) {
checkNotNull(deleteVpcRequest, "request should not be null.");
checkNotNull(deleteVpcRequest.getVpcId(), "request vpcId should not be null.");
if (Strings.isNullOrEmpty(deleteVpcRequest.getClientToken())) {
deleteVpcRequest.setClientToken(this.generateClientToken()); // depends on control dependency: [if], data = [none]
}
InternalRequest internalRequest = this.createRequest(
deleteVpcRequest, HttpMethodName.DELETE, VPC_PREFIX, deleteVpcRequest.getVpcId());
internalRequest.addParameter("clientToken", deleteVpcRequest.getClientToken());
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} } |
public class class_name {
public EClass getGSCOL() {
if (gscolEClass == null) {
gscolEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(472);
}
return gscolEClass;
} } | public class class_name {
public EClass getGSCOL() {
if (gscolEClass == null) {
gscolEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(472); // depends on control dependency: [if], data = [none]
}
return gscolEClass;
} } |
public class class_name {
public static void closeWindow(Component component) {
Window window = getWindow(component);
if (window != null) {
window.close();
}
} } | public class class_name {
public static void closeWindow(Component component) {
Window window = getWindow(component);
if (window != null) {
window.close(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected synchronized void checkpoint(long forcedLogSequenceNumber)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass
, "checkpoint"
, new Object[] { new Long(forcedLogSequenceNumber), new Boolean(requiresPersistentCheckpoint) });
// TODO If we have a STRATEGY_SAVE_ON_CHECKPOINT store then these objects need to be included here.
// TODO currently STRATEGY_KEEP_UNTIL_NEXT_OPEN are not saved during a checkpoint.
// TODO We will also need to track, nonPersistent,Serialized,and Persistent state in order to figure
// TODO out whether or not to include the transaction in the checkpoint.
// Was data logging required when we started the checkpoint
// and is it still needed for recovery?
if (requiresPersistentCheckpoint) {
// Build subset lists of persistent tokens to recover.
java.util.List persistentTokensToAdd = new java.util.ArrayList();
java.util.List persistentTokensToReplace = new java.util.ArrayList();
java.util.List persistentSerializedBytesToReplace = new java.util.ArrayList();
java.util.List persistentTokensToOptimisticReplace = new java.util.ArrayList();
java.util.List persistentTokensToDelete = new java.util.ArrayList();
// Drive checkpoint for each included MangedObject.
for (java.util.Iterator managedObjectIterator = includedManagedObjects.values().iterator(); managedObjectIterator.hasNext();) {
ManagedObject managedObject = (ManagedObject) managedObjectIterator.next();
if (managedObject.owningToken.getObjectStore()
.getPersistence()) {
// Has the last logged update been Forced to disk?
// If not the normal log record will be after the start of the chekpoint and it will
// cause normal recovery for that ManagedObject.
long logSequenceNumber = ((Long) logSequenceNumbers.get(managedObject.owningToken)).longValue();
if (forcedLogSequenceNumber >= logSequenceNumber) {
// The loggedSerializedBytes we currently have will have had any corrections made at preBackoutTime
// incorporated into them, so they are now the correct ones to write to the ObjectStore.
ObjectManagerByteArrayOutputStream serializedBytes = (ObjectManagerByteArrayOutputStream) loggedSerializedBytes.get(managedObject.owningToken);
long managedObjectSequenceNumber = ((Long) managedObjectSequenceNumbers.get(managedObject.owningToken)).longValue();
managedObject.checkpoint(this,
serializedBytes,
managedObjectSequenceNumber);
// Build the lists of objects to log.
if (managedObject.lockedBy(this)) { // Locking update?
switch (managedObject.getState()) {
case ManagedObject.stateAdded:
persistentTokensToAdd.add(managedObject.owningToken);
break;
case ManagedObject.stateReplaced:
persistentTokensToReplace.add(managedObject.owningToken);
// We have to rewrite the replaced serialized bytes in the log as part of the checkpoint.
persistentSerializedBytesToReplace.add(serializedBytes);
break;
case ManagedObject.stateToBeDeleted:
persistentTokensToDelete.add(managedObject.owningToken);
break;
} // switch.
} else { // OptimisticReplace update.
// A bit pointless as we dont do anything at recovery time.
persistentTokensToOptimisticReplace.add(managedObject.owningToken);
} // if (lockedBy(transaction)).
} // if (forcedLogSequenceNumber >= logSequenceNumber).
} // if (managedObject.owningToken.getObjectStore().getPersistence()).
} // for ... includedMansagedObjects.
// The state indicates if the transaction is prepared, commiting or backing out.
TransactionCheckpointLogRecord transactionCheckpointLogRecord = new TransactionCheckpointLogRecord(this,
persistentTokensToAdd,
persistentTokensToReplace,
persistentSerializedBytesToReplace,
persistentTokensToOptimisticReplace,
persistentTokensToDelete,
allPersistentTokensToNotify);
// TODO Could correct any overestimate of the reserved log file space here.
// We previously reserved some log space for this logRecord to be sure it will fit in the log.
// We do not release it here because w reserved an extra page which we might not be able to get back after the
// checkpoint has completed. Instead we just supress the check on the space used in the log.
objectManagerState.logOutput.writeNext(transactionCheckpointLogRecord,
0,
false
, false);
requiresPersistentCheckpoint = false;
} // if (requiresPersistentCheckpoint).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "checkpoint"
);
} } | public class class_name {
protected synchronized void checkpoint(long forcedLogSequenceNumber)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass
, "checkpoint"
, new Object[] { new Long(forcedLogSequenceNumber), new Boolean(requiresPersistentCheckpoint) });
// TODO If we have a STRATEGY_SAVE_ON_CHECKPOINT store then these objects need to be included here.
// TODO currently STRATEGY_KEEP_UNTIL_NEXT_OPEN are not saved during a checkpoint.
// TODO We will also need to track, nonPersistent,Serialized,and Persistent state in order to figure
// TODO out whether or not to include the transaction in the checkpoint.
// Was data logging required when we started the checkpoint
// and is it still needed for recovery?
if (requiresPersistentCheckpoint) {
// Build subset lists of persistent tokens to recover.
java.util.List persistentTokensToAdd = new java.util.ArrayList();
java.util.List persistentTokensToReplace = new java.util.ArrayList();
java.util.List persistentSerializedBytesToReplace = new java.util.ArrayList();
java.util.List persistentTokensToOptimisticReplace = new java.util.ArrayList();
java.util.List persistentTokensToDelete = new java.util.ArrayList();
// Drive checkpoint for each included MangedObject.
for (java.util.Iterator managedObjectIterator = includedManagedObjects.values().iterator(); managedObjectIterator.hasNext();) {
ManagedObject managedObject = (ManagedObject) managedObjectIterator.next();
if (managedObject.owningToken.getObjectStore()
.getPersistence()) {
// Has the last logged update been Forced to disk?
// If not the normal log record will be after the start of the chekpoint and it will
// cause normal recovery for that ManagedObject.
long logSequenceNumber = ((Long) logSequenceNumbers.get(managedObject.owningToken)).longValue();
if (forcedLogSequenceNumber >= logSequenceNumber) {
// The loggedSerializedBytes we currently have will have had any corrections made at preBackoutTime
// incorporated into them, so they are now the correct ones to write to the ObjectStore.
ObjectManagerByteArrayOutputStream serializedBytes = (ObjectManagerByteArrayOutputStream) loggedSerializedBytes.get(managedObject.owningToken);
long managedObjectSequenceNumber = ((Long) managedObjectSequenceNumbers.get(managedObject.owningToken)).longValue();
managedObject.checkpoint(this,
serializedBytes,
managedObjectSequenceNumber); // depends on control dependency: [if], data = [none]
// Build the lists of objects to log.
if (managedObject.lockedBy(this)) { // Locking update?
switch (managedObject.getState()) {
case ManagedObject.stateAdded:
persistentTokensToAdd.add(managedObject.owningToken);
break;
case ManagedObject.stateReplaced:
persistentTokensToReplace.add(managedObject.owningToken);
// We have to rewrite the replaced serialized bytes in the log as part of the checkpoint.
persistentSerializedBytesToReplace.add(serializedBytes);
break;
case ManagedObject.stateToBeDeleted:
persistentTokensToDelete.add(managedObject.owningToken);
break;
} // switch.
} else { // OptimisticReplace update.
// A bit pointless as we dont do anything at recovery time.
persistentTokensToOptimisticReplace.add(managedObject.owningToken); // depends on control dependency: [if], data = [none]
} // if (lockedBy(transaction)).
} // if (forcedLogSequenceNumber >= logSequenceNumber).
} // if (managedObject.owningToken.getObjectStore().getPersistence()).
} // for ... includedMansagedObjects.
// The state indicates if the transaction is prepared, commiting or backing out.
TransactionCheckpointLogRecord transactionCheckpointLogRecord = new TransactionCheckpointLogRecord(this,
persistentTokensToAdd,
persistentTokensToReplace,
persistentSerializedBytesToReplace,
persistentTokensToOptimisticReplace,
persistentTokensToDelete,
allPersistentTokensToNotify);
// TODO Could correct any overestimate of the reserved log file space here.
// We previously reserved some log space for this logRecord to be sure it will fit in the log.
// We do not release it here because w reserved an extra page which we might not be able to get back after the
// checkpoint has completed. Instead we just supress the check on the space used in the log.
objectManagerState.logOutput.writeNext(transactionCheckpointLogRecord,
0,
false
, false);
requiresPersistentCheckpoint = false;
} // if (requiresPersistentCheckpoint).
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass
, "checkpoint"
);
} } |
public class class_name {
public static byte[] journalIdStringToBytes(String jid) {
byte[] byteArray = new byte[jid.length()];
for (int i = 0; i < jid.length(); i++) {
byteArray[i] = (byte) jid.charAt(i);
}
return byteArray;
} } | public class class_name {
public static byte[] journalIdStringToBytes(String jid) {
byte[] byteArray = new byte[jid.length()];
for (int i = 0; i < jid.length(); i++) {
byteArray[i] = (byte) jid.charAt(i); // depends on control dependency: [for], data = [i]
}
return byteArray;
} } |
public class class_name {
@Override
public By convertToSelector(String identity) {
waitAjaxIsFinished();
By selector = new By.ByCssSelector(identity);
if (identity.matches("^[a-zA-Z][\\w_-]*$")) {
selector = new By.ById(identity);
} else if (identity.startsWith("/") || identity.startsWith("./")) {
selector = new By.ByXPath(identity);
}
return selector;
} } | public class class_name {
@Override
public By convertToSelector(String identity) {
waitAjaxIsFinished();
By selector = new By.ByCssSelector(identity);
if (identity.matches("^[a-zA-Z][\\w_-]*$")) {
selector = new By.ById(identity); // depends on control dependency: [if], data = [none]
} else if (identity.startsWith("/") || identity.startsWith("./")) {
selector = new By.ByXPath(identity); // depends on control dependency: [if], data = [none]
}
return selector;
} } |
public class class_name {
public synchronized void shutdown() {
checkIsRunning();
try {
beanManager().fireEvent(new ContainerBeforeShutdown(id), BeforeDestroyed.Literal.APPLICATION);
} finally {
discard(id);
// Destroy all the dependent beans correctly
creationalContext.release();
beanManager().fireEvent(new ContainerShutdown(id), Destroyed.Literal.APPLICATION);
bootstrap.shutdown();
WeldSELogger.LOG.weldContainerShutdown(id);
}
} } | public class class_name {
public synchronized void shutdown() {
checkIsRunning();
try {
beanManager().fireEvent(new ContainerBeforeShutdown(id), BeforeDestroyed.Literal.APPLICATION); // depends on control dependency: [try], data = [none]
} finally {
discard(id);
// Destroy all the dependent beans correctly
creationalContext.release();
beanManager().fireEvent(new ContainerShutdown(id), Destroyed.Literal.APPLICATION);
bootstrap.shutdown();
WeldSELogger.LOG.weldContainerShutdown(id);
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void commit() {
long index = this.currentIndex;
for (RaftSession session : sessions.getSessions(primitiveId)) {
session.commit(index);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
private void commit() {
long index = this.currentIndex;
for (RaftSession session : sessions.getSessions(primitiveId)) {
session.commit(index); // depends on control dependency: [for], data = [session]
}
} } |
public class class_name {
private String calculateClass(String fieldValue) {
// NOTE; This is just a silly example to illustrate what can be done.
if (fieldValue.startsWith("/1-500e-KWh")) {
return "PowerTick";
}
if (fieldValue.endsWith(".html")) {
return "Page";
}
if (fieldValue.endsWith(".gif")) {
return "Image";
}
if (fieldValue.endsWith(".css")) {
return "StyleSheet";
}
if (fieldValue.endsWith(".js")) {
return "Script";
}
if (fieldValue.endsWith("_form")) {
return "HackAttempt";
}
return "Other";
} } | public class class_name {
private String calculateClass(String fieldValue) {
// NOTE; This is just a silly example to illustrate what can be done.
if (fieldValue.startsWith("/1-500e-KWh")) {
return "PowerTick"; // depends on control dependency: [if], data = [none]
}
if (fieldValue.endsWith(".html")) {
return "Page"; // depends on control dependency: [if], data = [none]
}
if (fieldValue.endsWith(".gif")) {
return "Image"; // depends on control dependency: [if], data = [none]
}
if (fieldValue.endsWith(".css")) {
return "StyleSheet"; // depends on control dependency: [if], data = [none]
}
if (fieldValue.endsWith(".js")) {
return "Script"; // depends on control dependency: [if], data = [none]
}
if (fieldValue.endsWith("_form")) {
return "HackAttempt"; // depends on control dependency: [if], data = [none]
}
return "Other";
} } |
public class class_name {
public String expand(Map<String, ?> variables) {
if (variables == null) {
throw new IllegalArgumentException("variable map is required.");
}
/* resolve all expressions within the template */
StringBuilder resolved = new StringBuilder();
for (TemplateChunk chunk : this.templateChunks) {
if (chunk instanceof Expression) {
String resolvedExpression = this.resolveExpression((Expression) chunk, variables);
if (resolvedExpression != null) {
resolved.append(resolvedExpression);
}
} else {
/* chunk is a literal value */
resolved.append(chunk.getValue());
}
}
return resolved.toString();
} } | public class class_name {
public String expand(Map<String, ?> variables) {
if (variables == null) {
throw new IllegalArgumentException("variable map is required.");
}
/* resolve all expressions within the template */
StringBuilder resolved = new StringBuilder();
for (TemplateChunk chunk : this.templateChunks) {
if (chunk instanceof Expression) {
String resolvedExpression = this.resolveExpression((Expression) chunk, variables);
if (resolvedExpression != null) {
resolved.append(resolvedExpression); // depends on control dependency: [if], data = [(resolvedExpression]
}
} else {
/* chunk is a literal value */
resolved.append(chunk.getValue()); // depends on control dependency: [if], data = [none]
}
}
return resolved.toString();
} } |
public class class_name {
public double score(Instance inst, int sizeLimit)
{
double anomalyScore = 0.0;
if(this.internalNode && this.r > sizeLimit)
{
if(inst.value(this.splitAttribute) > this.splitValue)
anomalyScore = right.score(inst, sizeLimit);
else
anomalyScore = left.score(inst, sizeLimit);
}
else
{
anomalyScore = this.r * Math.pow(2.0, this.depth);
}
return anomalyScore;
} } | public class class_name {
public double score(Instance inst, int sizeLimit)
{
double anomalyScore = 0.0;
if(this.internalNode && this.r > sizeLimit)
{
if(inst.value(this.splitAttribute) > this.splitValue)
anomalyScore = right.score(inst, sizeLimit);
else
anomalyScore = left.score(inst, sizeLimit);
}
else
{
anomalyScore = this.r * Math.pow(2.0, this.depth); // depends on control dependency: [if], data = [none]
}
return anomalyScore;
} } |
public class class_name {
public static ModifiableDBIDs randomSampleExcept(DBIDs source, DBIDRef except, int k, Random random) {
if(k < 0 || k > source.size()) {
throw new IllegalArgumentException("Illegal value for size of random sample: " + k + " > " + source.size() + " or < 0");
}
// Fast, and we're single-threaded here anyway.
random = (random != null) ? random : new FastNonThreadsafeRandom();
// TODO: better balancing for different sizes
// Two methods: constructive vs. destructive
if(k < source.size() >> 2) {
ArrayDBIDs aids = DBIDUtil.ensureArray(source);
DBIDArrayIter iter = aids.iter();
int size = aids.size();
HashSetModifiableDBIDs sample = DBIDUtil.newHashSet(k);
while(sample.size() < k) {
if(!equal(iter.seek(random.nextInt(size)), except)) {
sample.add(iter);
}
}
return sample;
}
else {
ArrayModifiableDBIDs sample = DBIDUtil.newArray(source);
randomShuffle(sample, random, k);
// Avoid excluded object:
for(DBIDArrayIter iter = sample.iter(); iter.valid() && iter.getOffset() < k; iter.advance()) {
if(equal(iter, except)) {
sample.swap(iter.getOffset(), k);
break; // Assuming that except occurrs only once!
}
}
// Delete trailing elements
for(int i = sample.size() - 1; i >= k; i--) {
sample.remove(i);
}
return sample;
}
} } | public class class_name {
public static ModifiableDBIDs randomSampleExcept(DBIDs source, DBIDRef except, int k, Random random) {
if(k < 0 || k > source.size()) {
throw new IllegalArgumentException("Illegal value for size of random sample: " + k + " > " + source.size() + " or < 0");
}
// Fast, and we're single-threaded here anyway.
random = (random != null) ? random : new FastNonThreadsafeRandom();
// TODO: better balancing for different sizes
// Two methods: constructive vs. destructive
if(k < source.size() >> 2) {
ArrayDBIDs aids = DBIDUtil.ensureArray(source);
DBIDArrayIter iter = aids.iter();
int size = aids.size();
HashSetModifiableDBIDs sample = DBIDUtil.newHashSet(k);
while(sample.size() < k) {
if(!equal(iter.seek(random.nextInt(size)), except)) {
sample.add(iter); // depends on control dependency: [if], data = [none]
}
}
return sample; // depends on control dependency: [if], data = [none]
}
else {
ArrayModifiableDBIDs sample = DBIDUtil.newArray(source);
randomShuffle(sample, random, k); // depends on control dependency: [if], data = [none]
// Avoid excluded object:
for(DBIDArrayIter iter = sample.iter(); iter.valid() && iter.getOffset() < k; iter.advance()) {
if(equal(iter, except)) {
sample.swap(iter.getOffset(), k); // depends on control dependency: [if], data = [none]
break; // Assuming that except occurrs only once!
}
}
// Delete trailing elements
for(int i = sample.size() - 1; i >= k; i--) {
sample.remove(i); // depends on control dependency: [for], data = [i]
}
return sample; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected String getBasePath(String rootPath) {
if (rootPath.endsWith(INHERITANCE_CONFIG_FILE_NAME)) {
return rootPath.substring(0, rootPath.length() - INHERITANCE_CONFIG_FILE_NAME.length());
}
return rootPath;
} } | public class class_name {
protected String getBasePath(String rootPath) {
if (rootPath.endsWith(INHERITANCE_CONFIG_FILE_NAME)) {
return rootPath.substring(0, rootPath.length() - INHERITANCE_CONFIG_FILE_NAME.length());
// depends on control dependency: [if], data = [none]
}
return rootPath;
} } |
public class class_name {
public static boolean isValid(int code) {
if (code >= 0 && code <= 999 || code >= 1004 && code <= 1006
|| code >= 1012 && code <= 2999) {
return false;
}
return true;
} } | public class class_name {
public static boolean isValid(int code) {
if (code >= 0 && code <= 999 || code >= 1004 && code <= 1006
|| code >= 1012 && code <= 2999) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
@Override
public CPAttachmentFileEntry fetchByC_C_T_ST_First(long classNameId,
long classPK, int type, int status,
OrderByComparator<CPAttachmentFileEntry> orderByComparator) {
List<CPAttachmentFileEntry> list = findByC_C_T_ST(classNameId, classPK,
type, status, 0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CPAttachmentFileEntry fetchByC_C_T_ST_First(long classNameId,
long classPK, int type, int status,
OrderByComparator<CPAttachmentFileEntry> orderByComparator) {
List<CPAttachmentFileEntry> list = findByC_C_T_ST(classNameId, classPK,
type, status, 0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public ListRepositoriesResult withRepositories(RepositoryNameIdPair... repositories) {
if (this.repositories == null) {
setRepositories(new java.util.ArrayList<RepositoryNameIdPair>(repositories.length));
}
for (RepositoryNameIdPair ele : repositories) {
this.repositories.add(ele);
}
return this;
} } | public class class_name {
public ListRepositoriesResult withRepositories(RepositoryNameIdPair... repositories) {
if (this.repositories == null) {
setRepositories(new java.util.ArrayList<RepositoryNameIdPair>(repositories.length)); // depends on control dependency: [if], data = [none]
}
for (RepositoryNameIdPair ele : repositories) {
this.repositories.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected void clearSubscrips (boolean verbose)
{
for (ClientProxy rec : _subscrips.values()) {
if (verbose) {
log.info("Clearing subscription", "client", this, "obj", rec.object.getOid());
}
rec.unsubscribe();
}
_subscrips.clear();
} } | public class class_name {
protected void clearSubscrips (boolean verbose)
{
for (ClientProxy rec : _subscrips.values()) {
if (verbose) {
log.info("Clearing subscription", "client", this, "obj", rec.object.getOid()); // depends on control dependency: [if], data = [none]
}
rec.unsubscribe(); // depends on control dependency: [for], data = [rec]
}
_subscrips.clear();
} } |
public class class_name {
private static Component getCurrentModal_(RootPaneContainer rootPane) {
synchronized (modals) {
Modal modal = modals.get(rootPane);
if (modal != null) {
if (modal.getSize() > 0) {
return modal.components.get(modal.components.size() - 1);
}
}
return null;
}
} } | public class class_name {
private static Component getCurrentModal_(RootPaneContainer rootPane) {
synchronized (modals) {
Modal modal = modals.get(rootPane);
if (modal != null) {
if (modal.getSize() > 0) {
return modal.components.get(modal.components.size() - 1); // depends on control dependency: [if], data = [none]
}
}
return null;
}
} } |
public class class_name {
public static void avoidDoubleBorders (@Nonnull final PLTable ret)
{
boolean bPreviousRowHasBottomBorder = false;
for (int i = 0; i < ret.getRowCount (); i++)
{
boolean bRowHasBottomBorder = true;
boolean bRowHasTopBorder = true;
final PLTableRow aRow = ret.getRowAtIndex (i);
for (int j = 0; j < aRow.getColumnCount (); j++)
{
final PLTableCell aCell = aRow.getCellAtIndex (j);
if (aCell.getBorderBottomWidth () == 0)
bRowHasBottomBorder = false;
if (aCell.getBorderTopWidth () == 0)
bRowHasTopBorder = false;
}
if (bPreviousRowHasBottomBorder && bRowHasTopBorder)
aRow.setBorderTop (null);
bPreviousRowHasBottomBorder = bRowHasBottomBorder;
}
} } | public class class_name {
public static void avoidDoubleBorders (@Nonnull final PLTable ret)
{
boolean bPreviousRowHasBottomBorder = false;
for (int i = 0; i < ret.getRowCount (); i++)
{
boolean bRowHasBottomBorder = true;
boolean bRowHasTopBorder = true;
final PLTableRow aRow = ret.getRowAtIndex (i);
for (int j = 0; j < aRow.getColumnCount (); j++)
{
final PLTableCell aCell = aRow.getCellAtIndex (j);
if (aCell.getBorderBottomWidth () == 0)
bRowHasBottomBorder = false;
if (aCell.getBorderTopWidth () == 0)
bRowHasTopBorder = false;
}
if (bPreviousRowHasBottomBorder && bRowHasTopBorder)
aRow.setBorderTop (null);
bPreviousRowHasBottomBorder = bRowHasBottomBorder; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static double[] graphNiceRange(double max, double min, int nTick){
if(max == min || !Double.isFinite(max)){
if(max == 0.0 || !Double.isFinite(max)){
return new double[]{0.0, 1.0};
}
return graphNiceRange(1.5 * max, 0.5 * max, nTick);
}
double range = niceNum(max-min, false);
double d = niceNum(range / (nTick-1), true );
double graphMin = Math.floor(min/d)*d;
double graphMax = Math.ceil(max/d)*d;
return new double[]{graphMin, graphMax};
} } | public class class_name {
public static double[] graphNiceRange(double max, double min, int nTick){
if(max == min || !Double.isFinite(max)){
if(max == 0.0 || !Double.isFinite(max)){
return new double[]{0.0, 1.0}; // depends on control dependency: [if], data = [none]
}
return graphNiceRange(1.5 * max, 0.5 * max, nTick); // depends on control dependency: [if], data = [none]
}
double range = niceNum(max-min, false);
double d = niceNum(range / (nTick-1), true );
double graphMin = Math.floor(min/d)*d;
double graphMax = Math.ceil(max/d)*d;
return new double[]{graphMin, graphMax};
} } |
public class class_name {
public void applyModifications(Properties mods)
{
String key;
String value;
for (Iterator it = mods.keySet().iterator(); it.hasNext();)
{
key = (String)it.next();
value = mods.getProperty(key);
setProperty(key, value);
}
} } | public class class_name {
public void applyModifications(Properties mods)
{
String key;
String value;
for (Iterator it = mods.keySet().iterator(); it.hasNext();)
{
key = (String)it.next();
// depends on control dependency: [for], data = [it]
value = mods.getProperty(key);
// depends on control dependency: [for], data = [none]
setProperty(key, value);
// depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static ChainableStatement toggle(JsScope jsScope, JsScope jsScope2, JsScope... jsScopes)
{
CharSequence[] args = null;
if (jsScopes != null && jsScopes.length > 0)
{
args = new CharSequence[jsScopes.length + 2];
args[0] = jsScope.render();
args[1] = jsScope2.render();
Integer index = 2;
for (JsScope scope : jsScopes)
{
args[index] = scope.render();
index++;
}
return new DefaultChainableStatement("toggle", args);
}
return toggle(jsScope, jsScope2);
} } | public class class_name {
public static ChainableStatement toggle(JsScope jsScope, JsScope jsScope2, JsScope... jsScopes)
{
CharSequence[] args = null;
if (jsScopes != null && jsScopes.length > 0)
{
args = new CharSequence[jsScopes.length + 2]; // depends on control dependency: [if], data = [none]
args[0] = jsScope.render(); // depends on control dependency: [if], data = [none]
args[1] = jsScope2.render(); // depends on control dependency: [if], data = [none]
Integer index = 2;
for (JsScope scope : jsScopes)
{
args[index] = scope.render(); // depends on control dependency: [for], data = [scope]
index++; // depends on control dependency: [for], data = [none]
}
return new DefaultChainableStatement("toggle", args); // depends on control dependency: [if], data = [none]
}
return toggle(jsScope, jsScope2);
} } |
public class class_name {
@Override
public final void write(final Map<String, Object> pReqVars,
final List<List<Object>> pData, final CsvMethod pCsvMethod,
final OutputStream pOus) throws Exception {
Map<Long, MatchForeign> mfMap = new HashMap<Long, MatchForeign>();
Map<Integer, SimpleDateFormat> dateFormats =
new HashMap<Integer, SimpleDateFormat>();
Map<Integer, String[]> numericSeps = new HashMap<Integer, String[]>();
for (CsvColumn col : pCsvMethod.getColumns()) {
if (col.getDataFormat() != null) {
if (col.getItsType().equals(ECsvColumnType.DATE)) {
try {
dateFormats.put(col.getItsIndex(),
new SimpleDateFormat(col.getDataFormat()));
} catch (Exception ee) {
throw new ExceptionWithCode(ExceptionWithCode
.CONFIGURATION_MISTAKE, "Wrong date format! Format: "
+ col.getDataFormat(), ee);
}
} else if (col.getItsType().equals(ECsvColumnType.NUMERIC)) {
String[] seps = null;
try {
seps = col.getDataFormat().split(",");
for (int i = 0; i < 2; i++) {
if ("SPACE".equals(seps[i])) {
seps[i] = "\u00A0";
} else if ("COMMA".equals(seps[i])) {
seps[i] = ",";
}
}
numericSeps.put(col.getItsIndex(), seps);
} catch (Exception ee) {
throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
"Wrong amount format! Format: "
+ col.getDataFormat(), ee);
}
}
}
}
Collections.sort(pCsvMethod.getColumns(), new CmprCsvColumn());
OutputStreamWriter writer = null;
try {
writer = new OutputStreamWriter(pOus, Charset
.forName(pCsvMethod.getCharsetName()).newEncoder());
if (pCsvMethod.getHasHeader()) {
for (int i = 0; i < pCsvMethod.getColumns().size(); i++) {
if (i == 0) {
writer.write(pCsvMethod.getColumns().get(i).getItsName());
} else if (i == pCsvMethod.getColumns().size() - 1) {
writer.write(pCsvMethod.getColumnSep() + pCsvMethod.getColumns()
.get(i).getItsName() + "\r\n");
} else {
writer.write(pCsvMethod.getColumnSep()
+ pCsvMethod.getColumns().get(i).getItsName());
}
}
}
for (List<Object> row : pData) {
for (int i = 0; i < pCsvMethod.getColumns().size(); i++) {
String colVal = ""; //null default
if (pCsvMethod.getColumns().get(i).getConstValue() != null) {
colVal = pCsvMethod.getColumns().get(i).getConstValue();
} else if (pCsvMethod.getColumns().get(i).getDataIndex() != null
&& row.get(pCsvMethod.getColumns().get(i).getDataIndex() - 1) != null) {
Object objVal = null;
if (pCsvMethod.getColumns().get(i).getFieldPath() == null) {
objVal = row.get(pCsvMethod.getColumns().get(i)
.getDataIndex() - 1);
} else {
String[] fpa = pCsvMethod.getColumns().get(i).getFieldPath()
.split(",");
Object entity = row.get(pCsvMethod.getColumns().get(i)
.getDataIndex() - 1);
for (int j = 0; j < fpa.length; j++) {
Method getter = this.utlReflection
.retrieveGetterForField(entity.getClass(), fpa[j]);
objVal = getter.invoke(entity);
entity = objVal;
if (entity == null) {
break;
}
}
}
if (objVal != null) {
if (pCsvMethod.getColumns().get(i).getDataFormat() == null) {
if (pCsvMethod.getColumns().get(i).getMatchForeign() != null) {
MatchForeign mf = mfMap.get(pCsvMethod.getColumns()
.get(i).getMatchForeign().getItsId());
if (mf == null) {
mf = this.hldMatchForeign.getFor(pReqVars, pCsvMethod
.getColumns().get(i).getMatchForeign().getItsId());
if (mf == null) {
throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
"Can't find match foreign ID "
+ pCsvMethod.getColumns().get(i).getMatchForeign().getItsId());
}
mfMap.put(pCsvMethod.getColumns().get(i).getMatchForeign()
.getItsId(), mf);
}
String natVal = objVal.toString();
for (MatchForeignLine mfl : mf.getItsLines()) {
if (natVal.equals(mfl.getNativeVal())) {
colVal = mfl.getForeignVal();
break;
}
}
} else {
colVal = objVal.toString();
}
} else {
if (pCsvMethod.getColumns().get(i).getItsType()
.equals(ECsvColumnType.DATE)) {
colVal = dateFormats.get(pCsvMethod.getColumns().get(i)
.getItsIndex()).format((Date) objVal);
} else if (pCsvMethod.getColumns().get(i).getItsType()
.equals(ECsvColumnType.NUMERIC)) {
String[] seps = numericSeps.get(pCsvMethod.getColumns().get(i)
.getItsIndex());
Integer scale = null;
if (seps.length == 3) {
scale = Integer.parseInt(seps[2]);
}
BigDecimal bdv = (BigDecimal) objVal;
if (scale == null) {
scale = bdv.scale();
} else {
bdv = bdv.setScale(scale, RoundingMode.HALF_UP);
}
colVal = this.srvNumberToString.print(objVal.toString(),
seps[0], seps[1], scale);
} else if (pCsvMethod.getColumns().get(i).getItsType()
.equals(ECsvColumnType.BOOLEAN)) {
String[] frm = pCsvMethod.getColumns().get(i)
.getDataFormat().split(",");
Boolean blv = (Boolean) objVal;
if (blv) {
colVal = frm[0];
} else {
colVal = frm[1];
}
} else {
throw new ExceptionWithCode(ExceptionWithCode
.CONFIGURATION_MISTAKE, "data_format_not_yet_implemented");
}
}
}
}
if (pCsvMethod.getColumns().get(i).getTextDelimiter() != null
&& !"".equals(colVal)) {
colVal = pCsvMethod.getColumns().get(i).getTextDelimiter()
+ colVal + pCsvMethod.getColumns().get(i).getTextDelimiter();
}
if (i == 0) {
writer.write(colVal);
} else if (i == pCsvMethod.getColumns().size() - 1) {
writer.write(pCsvMethod.getColumnSep() + colVal + "\r\n");
} else {
writer.write(pCsvMethod.getColumnSep() + colVal);
}
}
}
} finally {
if (writer != null) {
writer.close();
}
}
} } | public class class_name {
@Override
public final void write(final Map<String, Object> pReqVars,
final List<List<Object>> pData, final CsvMethod pCsvMethod,
final OutputStream pOus) throws Exception {
Map<Long, MatchForeign> mfMap = new HashMap<Long, MatchForeign>();
Map<Integer, SimpleDateFormat> dateFormats =
new HashMap<Integer, SimpleDateFormat>();
Map<Integer, String[]> numericSeps = new HashMap<Integer, String[]>();
for (CsvColumn col : pCsvMethod.getColumns()) {
if (col.getDataFormat() != null) {
if (col.getItsType().equals(ECsvColumnType.DATE)) {
try {
dateFormats.put(col.getItsIndex(),
new SimpleDateFormat(col.getDataFormat())); // depends on control dependency: [try], data = [none]
} catch (Exception ee) {
throw new ExceptionWithCode(ExceptionWithCode
.CONFIGURATION_MISTAKE, "Wrong date format! Format: "
+ col.getDataFormat(), ee);
} // depends on control dependency: [catch], data = [none]
} else if (col.getItsType().equals(ECsvColumnType.NUMERIC)) {
String[] seps = null;
try {
seps = col.getDataFormat().split(","); // depends on control dependency: [try], data = [none]
for (int i = 0; i < 2; i++) {
if ("SPACE".equals(seps[i])) {
seps[i] = "\u00A0"; // depends on control dependency: [if], data = [none]
} else if ("COMMA".equals(seps[i])) {
seps[i] = ","; // depends on control dependency: [if], data = [none]
}
}
numericSeps.put(col.getItsIndex(), seps); // depends on control dependency: [try], data = [none]
} catch (Exception ee) {
throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
"Wrong amount format! Format: "
+ col.getDataFormat(), ee);
} // depends on control dependency: [catch], data = [none]
}
}
}
Collections.sort(pCsvMethod.getColumns(), new CmprCsvColumn());
OutputStreamWriter writer = null;
try {
writer = new OutputStreamWriter(pOus, Charset
.forName(pCsvMethod.getCharsetName()).newEncoder());
if (pCsvMethod.getHasHeader()) {
for (int i = 0; i < pCsvMethod.getColumns().size(); i++) {
if (i == 0) {
writer.write(pCsvMethod.getColumns().get(i).getItsName());
} else if (i == pCsvMethod.getColumns().size() - 1) {
writer.write(pCsvMethod.getColumnSep() + pCsvMethod.getColumns()
.get(i).getItsName() + "\r\n");
} else {
writer.write(pCsvMethod.getColumnSep()
+ pCsvMethod.getColumns().get(i).getItsName());
}
}
}
for (List<Object> row : pData) {
for (int i = 0; i < pCsvMethod.getColumns().size(); i++) {
String colVal = ""; //null default
if (pCsvMethod.getColumns().get(i).getConstValue() != null) {
colVal = pCsvMethod.getColumns().get(i).getConstValue();
} else if (pCsvMethod.getColumns().get(i).getDataIndex() != null
&& row.get(pCsvMethod.getColumns().get(i).getDataIndex() - 1) != null) {
Object objVal = null;
if (pCsvMethod.getColumns().get(i).getFieldPath() == null) {
objVal = row.get(pCsvMethod.getColumns().get(i)
.getDataIndex() - 1);
} else {
String[] fpa = pCsvMethod.getColumns().get(i).getFieldPath()
.split(",");
Object entity = row.get(pCsvMethod.getColumns().get(i)
.getDataIndex() - 1);
for (int j = 0; j < fpa.length; j++) {
Method getter = this.utlReflection
.retrieveGetterForField(entity.getClass(), fpa[j]);
objVal = getter.invoke(entity);
entity = objVal;
if (entity == null) {
break;
}
}
}
if (objVal != null) {
if (pCsvMethod.getColumns().get(i).getDataFormat() == null) {
if (pCsvMethod.getColumns().get(i).getMatchForeign() != null) {
MatchForeign mf = mfMap.get(pCsvMethod.getColumns()
.get(i).getMatchForeign().getItsId());
if (mf == null) {
mf = this.hldMatchForeign.getFor(pReqVars, pCsvMethod
.getColumns().get(i).getMatchForeign().getItsId());
if (mf == null) {
throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
"Can't find match foreign ID "
+ pCsvMethod.getColumns().get(i).getMatchForeign().getItsId());
}
mfMap.put(pCsvMethod.getColumns().get(i).getMatchForeign()
.getItsId(), mf);
}
String natVal = objVal.toString();
for (MatchForeignLine mfl : mf.getItsLines()) {
if (natVal.equals(mfl.getNativeVal())) {
colVal = mfl.getForeignVal();
break;
}
}
} else {
colVal = objVal.toString();
}
} else {
if (pCsvMethod.getColumns().get(i).getItsType()
.equals(ECsvColumnType.DATE)) {
colVal = dateFormats.get(pCsvMethod.getColumns().get(i)
.getItsIndex()).format((Date) objVal);
} else if (pCsvMethod.getColumns().get(i).getItsType()
.equals(ECsvColumnType.NUMERIC)) {
String[] seps = numericSeps.get(pCsvMethod.getColumns().get(i)
.getItsIndex());
Integer scale = null;
if (seps.length == 3) {
scale = Integer.parseInt(seps[2]);
}
BigDecimal bdv = (BigDecimal) objVal;
if (scale == null) {
scale = bdv.scale();
} else {
bdv = bdv.setScale(scale, RoundingMode.HALF_UP);
}
colVal = this.srvNumberToString.print(objVal.toString(),
seps[0], seps[1], scale);
} else if (pCsvMethod.getColumns().get(i).getItsType()
.equals(ECsvColumnType.BOOLEAN)) {
String[] frm = pCsvMethod.getColumns().get(i)
.getDataFormat().split(",");
Boolean blv = (Boolean) objVal;
if (blv) {
colVal = frm[0];
} else {
colVal = frm[1];
}
} else {
throw new ExceptionWithCode(ExceptionWithCode
.CONFIGURATION_MISTAKE, "data_format_not_yet_implemented");
}
}
}
}
if (pCsvMethod.getColumns().get(i).getTextDelimiter() != null
&& !"".equals(colVal)) {
colVal = pCsvMethod.getColumns().get(i).getTextDelimiter()
+ colVal + pCsvMethod.getColumns().get(i).getTextDelimiter();
}
if (i == 0) {
writer.write(colVal);
} else if (i == pCsvMethod.getColumns().size() - 1) {
writer.write(pCsvMethod.getColumnSep() + colVal + "\r\n");
} else {
writer.write(pCsvMethod.getColumnSep() + colVal);
}
}
}
} finally {
if (writer != null) {
writer.close();
}
}
} } |
public class class_name {
private JCheckBox getChkProxyOnly() {
if (proxyOnlyCheckbox == null) {
proxyOnlyCheckbox = new JCheckBox();
proxyOnlyCheckbox.setText(Constant.messages.getString("httpsessions.options.label.proxyOnly"));
}
return proxyOnlyCheckbox;
} } | public class class_name {
private JCheckBox getChkProxyOnly() {
if (proxyOnlyCheckbox == null) {
proxyOnlyCheckbox = new JCheckBox();
// depends on control dependency: [if], data = [none]
proxyOnlyCheckbox.setText(Constant.messages.getString("httpsessions.options.label.proxyOnly"));
}
return proxyOnlyCheckbox;
// depends on control dependency: [if], data = [none]
} } |
public class class_name {
private void openFile(final File log) throws IOException
{
SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
@SuppressWarnings("resource")
public Void run() throws Exception
{
// set file size;
if (!log.exists())
{
log.getParentFile().mkdirs();
log.createNewFile();
out = new FileOutputStream(log).getChannel();
out.position(1024 * fileSize - 1);
out.write(ByteBuffer.wrap(new byte[]{0}));
out.position(0);
out.force(false);
}
else
{
out = new FileOutputStream(log, true).getChannel();
}
return null;
}
});
} } | public class class_name {
private void openFile(final File log) throws IOException
{
SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<Void>()
{
@SuppressWarnings("resource")
public Void run() throws Exception
{
// set file size;
if (!log.exists())
{
log.getParentFile().mkdirs();
// depends on control dependency: [if], data = [none]
log.createNewFile();
// depends on control dependency: [if], data = [none]
out = new FileOutputStream(log).getChannel();
// depends on control dependency: [if], data = [none]
out.position(1024 * fileSize - 1);
// depends on control dependency: [if], data = [none]
out.write(ByteBuffer.wrap(new byte[]{0}));
// depends on control dependency: [if], data = [none]
out.position(0);
// depends on control dependency: [if], data = [none]
out.force(false);
// depends on control dependency: [if], data = [none]
}
else
{
out = new FileOutputStream(log, true).getChannel();
// depends on control dependency: [if], data = [none]
}
return null;
}
});
} } |
public class class_name {
public static String getMethodDescriptor(final Type returnType, final Type... argumentTypes) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append('(');
for (int i = 0; i < argumentTypes.length; ++i) {
argumentTypes[i].appendDescriptor(stringBuilder);
}
stringBuilder.append(')');
returnType.appendDescriptor(stringBuilder);
return stringBuilder.toString();
} } | public class class_name {
public static String getMethodDescriptor(final Type returnType, final Type... argumentTypes) {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append('(');
for (int i = 0; i < argumentTypes.length; ++i) {
argumentTypes[i].appendDescriptor(stringBuilder); // depends on control dependency: [for], data = [i]
}
stringBuilder.append(')');
returnType.appendDescriptor(stringBuilder);
return stringBuilder.toString();
} } |
public class class_name {
@DELETE
@Path("/{entryPath:.+}")
public Response removeEntry(@PathParam("entryPath") String entryPath)
{
SessionProvider sessionProvider = sessionProviderService.getSessionProvider(null);
try
{
regService.removeEntry(sessionProvider, normalizePath(entryPath));
return null; // minds status 204 'No content'
}
catch (PathNotFoundException e)
{
return Response.status(Response.Status.NOT_FOUND).build();
}
catch (Exception e)
{
LOG.error("Remove registry entry failed", e);
throw new WebApplicationException(e);
}
} } | public class class_name {
@DELETE
@Path("/{entryPath:.+}")
public Response removeEntry(@PathParam("entryPath") String entryPath)
{
SessionProvider sessionProvider = sessionProviderService.getSessionProvider(null);
try
{
regService.removeEntry(sessionProvider, normalizePath(entryPath)); // depends on control dependency: [try], data = [none]
return null; // minds status 204 'No content' // depends on control dependency: [try], data = [none]
}
catch (PathNotFoundException e)
{
return Response.status(Response.Status.NOT_FOUND).build();
} // depends on control dependency: [catch], data = [none]
catch (Exception e)
{
LOG.error("Remove registry entry failed", e);
throw new WebApplicationException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private <RequestT, ResponseT> ResponseT uploadObject(final InputStream originalStream,
final File file,
final ObjectMetadata metadata,
final ProgressListener listener,
final Request<RequestT> request,
final S3DataSource originalRequest,
final boolean skipServerSideValidation,
final boolean skipClientSideValidationPerRequest,
final UploadObjectStrategy<RequestT, ResponseT> uploadStrategy,
final boolean setContentTypeIfNotProvided) {
InputStream input = getInputStream(originalStream, file, metadata, request,
skipServerSideValidation, setContentTypeIfNotProvided);
final ObjectMetadata returnedMetadata;
MD5DigestCalculatingInputStream md5DigestStream = null;
try {
if (metadata.getContentMD5() == null && !skipClientSideValidationPerRequest) {
/*
* If the user hasn't set the content MD5, then we don't want to buffer the whole
* stream in memory just to calculate it. Instead, we can calculate it on the fly
* and validate it with the returned ETag from the object upload.
*/
input = md5DigestStream = new MD5DigestCalculatingInputStream(input);
}
populateRequestMetadata(request, metadata);
request.setContent(input);
publishProgress(listener, ProgressEventType.TRANSFER_STARTED_EVENT);
try {
returnedMetadata = uploadStrategy.invokeServiceCall(request);
} catch (Throwable t) {
publishProgress(listener, ProgressEventType.TRANSFER_FAILED_EVENT);
throw failure(t);
}
} finally {
cleanupDataSource(originalRequest, file, originalStream, input, log);
}
String contentMd5 = metadata.getContentMD5();
if (md5DigestStream != null) {
contentMd5 = Base64.encodeAsString(md5DigestStream.getMd5Digest());
}
final String etag = returnedMetadata.getETag();
if (contentMd5 != null && !skipMd5CheckStrategy.skipClientSideValidationPerPutResponse(returnedMetadata)) {
byte[] clientSideHash = BinaryUtils.fromBase64(contentMd5);
byte[] serverSideHash = BinaryUtils.fromHex(etag);
if (!Arrays.equals(clientSideHash, serverSideHash)) {
publishProgress(listener, ProgressEventType.TRANSFER_FAILED_EVENT);
throw new SdkClientException(
"Unable to verify integrity of data upload. Client calculated content hash (contentMD5: " + contentMd5
+ " in base 64) didn't match hash (etag: " + etag + " in hex) calculated by Amazon S3. "
+ "You may need to delete the data stored in Amazon S3. (metadata.contentMD5: " + metadata.getContentMD5()
+ ", md5DigestStream: " + md5DigestStream
+ uploadStrategy.md5ValidationErrorSuffix()
+ ")");
}
}
publishProgress(listener, ProgressEventType.TRANSFER_COMPLETED_EVENT);
return uploadStrategy.createResult(returnedMetadata, contentMd5);
} } | public class class_name {
private <RequestT, ResponseT> ResponseT uploadObject(final InputStream originalStream,
final File file,
final ObjectMetadata metadata,
final ProgressListener listener,
final Request<RequestT> request,
final S3DataSource originalRequest,
final boolean skipServerSideValidation,
final boolean skipClientSideValidationPerRequest,
final UploadObjectStrategy<RequestT, ResponseT> uploadStrategy,
final boolean setContentTypeIfNotProvided) {
InputStream input = getInputStream(originalStream, file, metadata, request,
skipServerSideValidation, setContentTypeIfNotProvided);
final ObjectMetadata returnedMetadata;
MD5DigestCalculatingInputStream md5DigestStream = null;
try {
if (metadata.getContentMD5() == null && !skipClientSideValidationPerRequest) {
/*
* If the user hasn't set the content MD5, then we don't want to buffer the whole
* stream in memory just to calculate it. Instead, we can calculate it on the fly
* and validate it with the returned ETag from the object upload.
*/
input = md5DigestStream = new MD5DigestCalculatingInputStream(input); // depends on control dependency: [if], data = [none]
}
populateRequestMetadata(request, metadata); // depends on control dependency: [try], data = [none]
request.setContent(input); // depends on control dependency: [try], data = [none]
publishProgress(listener, ProgressEventType.TRANSFER_STARTED_EVENT); // depends on control dependency: [try], data = [none]
try {
returnedMetadata = uploadStrategy.invokeServiceCall(request); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
publishProgress(listener, ProgressEventType.TRANSFER_FAILED_EVENT);
throw failure(t);
} // depends on control dependency: [catch], data = [none]
} finally {
cleanupDataSource(originalRequest, file, originalStream, input, log);
}
String contentMd5 = metadata.getContentMD5();
if (md5DigestStream != null) {
contentMd5 = Base64.encodeAsString(md5DigestStream.getMd5Digest()); // depends on control dependency: [if], data = [(md5DigestStream]
}
final String etag = returnedMetadata.getETag();
if (contentMd5 != null && !skipMd5CheckStrategy.skipClientSideValidationPerPutResponse(returnedMetadata)) {
byte[] clientSideHash = BinaryUtils.fromBase64(contentMd5);
byte[] serverSideHash = BinaryUtils.fromHex(etag);
if (!Arrays.equals(clientSideHash, serverSideHash)) {
publishProgress(listener, ProgressEventType.TRANSFER_FAILED_EVENT);
throw new SdkClientException(
"Unable to verify integrity of data upload. Client calculated content hash (contentMD5: " + contentMd5
+ " in base 64) didn't match hash (etag: " + etag + " in hex) calculated by Amazon S3. "
+ "You may need to delete the data stored in Amazon S3. (metadata.contentMD5: " + metadata.getContentMD5()
+ ", md5DigestStream: " + md5DigestStream
+ uploadStrategy.md5ValidationErrorSuffix()
+ ")");
}
}
publishProgress(listener, ProgressEventType.TRANSFER_COMPLETED_EVENT);
return uploadStrategy.createResult(returnedMetadata, contentMd5);
} } |
public class class_name {
private boolean validateSize(Object validationObject, Annotation annotate)
{
if (checkNullObject(validationObject))
{
return true;
}
int objectSize = 0;
int minSize = ((Size) annotate).min();
int maxSize = ((Size) annotate).max();
if (validationObject != null)
{
if (String.class.isAssignableFrom(validationObject.getClass()))
{
objectSize = ((String) validationObject).length();
}
else if (Collection.class.isAssignableFrom(validationObject.getClass()))
{
objectSize = ((Collection) validationObject).size();
}
else if (Map.class.isAssignableFrom(validationObject.getClass()))
{
objectSize = ((Map) validationObject).size();
}
else if (ArrayList.class.isAssignableFrom(validationObject.getClass()))
{
objectSize = ((ArrayList) validationObject).size();
}
else
{
throwValidationException(((Size) annotate).message());
}
}
return objectSize <= maxSize && objectSize >= minSize;
} } | public class class_name {
private boolean validateSize(Object validationObject, Annotation annotate)
{
if (checkNullObject(validationObject))
{
return true; // depends on control dependency: [if], data = [none]
}
int objectSize = 0;
int minSize = ((Size) annotate).min();
int maxSize = ((Size) annotate).max();
if (validationObject != null)
{
if (String.class.isAssignableFrom(validationObject.getClass()))
{
objectSize = ((String) validationObject).length(); // depends on control dependency: [if], data = [none]
}
else if (Collection.class.isAssignableFrom(validationObject.getClass()))
{
objectSize = ((Collection) validationObject).size(); // depends on control dependency: [if], data = [none]
}
else if (Map.class.isAssignableFrom(validationObject.getClass()))
{
objectSize = ((Map) validationObject).size(); // depends on control dependency: [if], data = [none]
}
else if (ArrayList.class.isAssignableFrom(validationObject.getClass()))
{
objectSize = ((ArrayList) validationObject).size(); // depends on control dependency: [if], data = [none]
}
else
{
throwValidationException(((Size) annotate).message()); // depends on control dependency: [if], data = [none]
}
}
return objectSize <= maxSize && objectSize >= minSize;
} } |
public class class_name {
public <H extends Annotation> void scanForAnnotation(
Class<H> expectedAnnotation, Listener<T, H> listener) {
BeanInfo beanInfo;
try {
beanInfo = Introspector.getBeanInfo(beanType);
} catch (IntrospectionException e) {
throw new RuntimeException("Can't get bean info of " + beanType);
}
for (PropertyDescriptor desc : beanInfo.getPropertyDescriptors()) {
AccessibleObject access = findAnnotatedAccess(desc, expectedAnnotation);
if (access == null) {
continue;
}
ValueReference<T> reference;
if (access instanceof Field) {
reference = ValueReference.instanceOf((Field) access);
} else {
reference = ValueReference.instanceOf(desc);
}
listener.handleReference(reference, access.getAnnotation(expectedAnnotation), access);
}
for (Field field : beanType.getFields()) {
H annotation = field.getAnnotation(expectedAnnotation);
if (annotation == null) {
continue;
}
ValueReference<T> reference = ValueReference.instanceOf(field);
listener.handleReference(reference, annotation, field);
}
} } | public class class_name {
public <H extends Annotation> void scanForAnnotation(
Class<H> expectedAnnotation, Listener<T, H> listener) {
BeanInfo beanInfo;
try {
beanInfo = Introspector.getBeanInfo(beanType); // depends on control dependency: [try], data = [none]
} catch (IntrospectionException e) {
throw new RuntimeException("Can't get bean info of " + beanType);
} // depends on control dependency: [catch], data = [none]
for (PropertyDescriptor desc : beanInfo.getPropertyDescriptors()) {
AccessibleObject access = findAnnotatedAccess(desc, expectedAnnotation);
if (access == null) {
continue;
}
ValueReference<T> reference;
if (access instanceof Field) {
reference = ValueReference.instanceOf((Field) access); // depends on control dependency: [if], data = [none]
} else {
reference = ValueReference.instanceOf(desc); // depends on control dependency: [if], data = [none]
}
listener.handleReference(reference, access.getAnnotation(expectedAnnotation), access); // depends on control dependency: [for], data = [none]
}
for (Field field : beanType.getFields()) {
H annotation = field.getAnnotation(expectedAnnotation);
if (annotation == null) {
continue;
}
ValueReference<T> reference = ValueReference.instanceOf(field);
listener.handleReference(reference, annotation, field); // depends on control dependency: [for], data = [field]
}
} } |
public class class_name {
public static String escapeAttribute( String string )
{
if( string == null || string.length() == 0 )
{
return string;
}
StringBuilder resultBuffer = null;
for( int i = 0, length = string.length(); i < length; i++ )
{
String entity = null;
char ch = string.charAt( i );
switch( ch )
{
case '"':
entity = """;
break;
case '&':
entity = "&";
break;
default:
break;
}
if( entity != null )
{
if( resultBuffer == null )
{
resultBuffer = new StringBuilder( string );
resultBuffer.setLength( i );
}
resultBuffer.append( entity );
}
else if( resultBuffer != null )
{
resultBuffer.append( ch );
}
}
return (resultBuffer != null) ? resultBuffer.toString() : string;
} } | public class class_name {
public static String escapeAttribute( String string )
{
if( string == null || string.length() == 0 )
{
return string; // depends on control dependency: [if], data = [none]
}
StringBuilder resultBuffer = null;
for( int i = 0, length = string.length(); i < length; i++ )
{
String entity = null;
char ch = string.charAt( i );
switch( ch )
{
case '"':
entity = """;
break;
case '&':
entity = "&";
break;
default:
break;
}
if( entity != null )
{
if( resultBuffer == null )
{
resultBuffer = new StringBuilder( string ); // depends on control dependency: [if], data = [none]
resultBuffer.setLength( i ); // depends on control dependency: [if], data = [none]
}
resultBuffer.append( entity ); // depends on control dependency: [if], data = [( entity]
}
else if( resultBuffer != null )
{
resultBuffer.append( ch ); // depends on control dependency: [if], data = [none]
}
}
return (resultBuffer != null) ? resultBuffer.toString() : string;
} } |
public class class_name {
public static void invokeSetter(Object target, String property, Object parameter) {
Method setter = getSetter(target, property, parameter.getClass());
try {
setter.invoke(target, parameter);
} catch (IllegalAccessException e) {
throw handleException(setter.getName(), e);
} catch (InvocationTargetException e) {
throw handleException(setter.getName(), e);
}
} } | public class class_name {
public static void invokeSetter(Object target, String property, Object parameter) {
Method setter = getSetter(target, property, parameter.getClass());
try {
setter.invoke(target, parameter); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
throw handleException(setter.getName(), e);
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
throw handleException(setter.getName(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public ScheduledInstanceRecurrenceRequest withOccurrenceDays(Integer... occurrenceDays) {
if (this.occurrenceDays == null) {
setOccurrenceDays(new com.amazonaws.internal.SdkInternalList<Integer>(occurrenceDays.length));
}
for (Integer ele : occurrenceDays) {
this.occurrenceDays.add(ele);
}
return this;
} } | public class class_name {
public ScheduledInstanceRecurrenceRequest withOccurrenceDays(Integer... occurrenceDays) {
if (this.occurrenceDays == null) {
setOccurrenceDays(new com.amazonaws.internal.SdkInternalList<Integer>(occurrenceDays.length)); // depends on control dependency: [if], data = [none]
}
for (Integer ele : occurrenceDays) {
this.occurrenceDays.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public SendMessageBatchRequest withEntries(SendMessageBatchRequestEntry... entries) {
if (this.entries == null) {
setEntries(new com.amazonaws.internal.SdkInternalList<SendMessageBatchRequestEntry>(entries.length));
}
for (SendMessageBatchRequestEntry ele : entries) {
this.entries.add(ele);
}
return this;
} } | public class class_name {
public SendMessageBatchRequest withEntries(SendMessageBatchRequestEntry... entries) {
if (this.entries == null) {
setEntries(new com.amazonaws.internal.SdkInternalList<SendMessageBatchRequestEntry>(entries.length)); // depends on control dependency: [if], data = [none]
}
for (SendMessageBatchRequestEntry ele : entries) {
this.entries.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void addClientBehavior(String eventName, ClientBehavior behavior) {
assertClientBehaviorHolder();
// First, make sure that the event is supported. We don't want
// to bother attaching behaviors for unsupported events.
Collection<String> eventNames = getEventNames();
// getClientEventNames() is spec'ed to require a non-null Set.
// If getClientEventNames() returns null, throw an exception
// to indicate that the API in not being used properly.
if (eventNames == null) {
throw new IllegalStateException(
"Attempting to add a Behavior to a component " +
"that does not support any event types. " +
"getEventTypes() must return a non-null Set.");
}
if (eventNames.contains(eventName)) {
if (initialStateMarked()) {
// a Behavior has been added dynamically. Update existing
// Behaviors, if any, to save their full state.
if (behaviors != null) {
for (Entry<String, List<ClientBehavior>> entry : behaviors
.entrySet()) {
for (ClientBehavior b : entry.getValue()) {
if (b instanceof PartialStateHolder) {
((PartialStateHolder) behavior).clearInitialState();
}
}
}
}
}
// We've got an event that we support, create our Map
// if necessary
if (null == behaviors) {
// Typically we only have a small number of behaviors for
// any component - in most cases only 1. Using a very small
// initial capacity so that we keep the footprint to a minimum.
Map<String, List<ClientBehavior>> modifiableMap =
new HashMap<String, List<ClientBehavior>>(5,1.0f);
behaviors = new BehaviorsMap(modifiableMap);
}
List<ClientBehavior> eventBehaviours = behaviors.get(eventName);
if (null == eventBehaviours) {
// Again using small initial capacity - we typically
// only have 1 Behavior per event type.
eventBehaviours = new ArrayList<ClientBehavior>(3);
behaviors.getModifiableMap().put(eventName, eventBehaviours);
}
eventBehaviours.add(behavior);
}
} } | public class class_name {
public void addClientBehavior(String eventName, ClientBehavior behavior) {
assertClientBehaviorHolder();
// First, make sure that the event is supported. We don't want
// to bother attaching behaviors for unsupported events.
Collection<String> eventNames = getEventNames();
// getClientEventNames() is spec'ed to require a non-null Set.
// If getClientEventNames() returns null, throw an exception
// to indicate that the API in not being used properly.
if (eventNames == null) {
throw new IllegalStateException(
"Attempting to add a Behavior to a component " +
"that does not support any event types. " +
"getEventTypes() must return a non-null Set.");
}
if (eventNames.contains(eventName)) {
if (initialStateMarked()) {
// a Behavior has been added dynamically. Update existing
// Behaviors, if any, to save their full state.
if (behaviors != null) {
for (Entry<String, List<ClientBehavior>> entry : behaviors
.entrySet()) {
for (ClientBehavior b : entry.getValue()) {
if (b instanceof PartialStateHolder) {
((PartialStateHolder) behavior).clearInitialState(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
// We've got an event that we support, create our Map
// if necessary
if (null == behaviors) {
// Typically we only have a small number of behaviors for
// any component - in most cases only 1. Using a very small
// initial capacity so that we keep the footprint to a minimum.
Map<String, List<ClientBehavior>> modifiableMap =
new HashMap<String, List<ClientBehavior>>(5,1.0f);
behaviors = new BehaviorsMap(modifiableMap); // depends on control dependency: [if], data = [none]
}
List<ClientBehavior> eventBehaviours = behaviors.get(eventName);
if (null == eventBehaviours) {
// Again using small initial capacity - we typically
// only have 1 Behavior per event type.
eventBehaviours = new ArrayList<ClientBehavior>(3); // depends on control dependency: [if], data = [none]
behaviors.getModifiableMap().put(eventName, eventBehaviours); // depends on control dependency: [if], data = [eventBehaviours)]
}
eventBehaviours.add(behavior); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void addTicketToRegistry(final Ticket ticket, final TicketGrantingTicket ticketGrantingTicket) {
LOGGER.debug("Adding ticket [{}] to registry", ticket);
this.ticketRegistry.addTicket(ticket);
if (ticketGrantingTicket != null) {
LOGGER.debug("Updating parent ticket-granting ticket [{}]", ticketGrantingTicket);
this.ticketRegistry.updateTicket(ticketGrantingTicket);
}
} } | public class class_name {
protected void addTicketToRegistry(final Ticket ticket, final TicketGrantingTicket ticketGrantingTicket) {
LOGGER.debug("Adding ticket [{}] to registry", ticket);
this.ticketRegistry.addTicket(ticket);
if (ticketGrantingTicket != null) {
LOGGER.debug("Updating parent ticket-granting ticket [{}]", ticketGrantingTicket);
this.ticketRegistry.updateTicket(ticketGrantingTicket); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void clean()
throws IOException {
Preconditions.checkArgument(this.state.contains(ComplianceConfigurationKeys.RETENTION_VERSION_FINDER_CLASS_KEY),
"Missing required property " + ComplianceConfigurationKeys.RETENTION_VERSION_FINDER_CLASS_KEY);
Preconditions.checkArgument(this.state.contains(ComplianceConfigurationKeys.RETENTION_SELECTION_POLICY_CLASS_KEY),
"Missing required property " + ComplianceConfigurationKeys.RETENTION_SELECTION_POLICY_CLASS_KEY);
Preconditions.checkArgument(this.state.contains(ComplianceConfigurationKeys.RETENTION_VERSION_CLEANER_CLASS_KEY),
"Missing required property " + ComplianceConfigurationKeys.RETENTION_VERSION_CLEANER_CLASS_KEY);
List<String> patterns = new ArrayList<>();
patterns.add(getCompleteTableName(this) + ComplianceConfigurationKeys.BACKUP);
patterns.add(getCompleteTableName(this) + ComplianceConfigurationKeys.STAGING);
patterns.add(getCompleteTableName(this) + ComplianceConfigurationKeys.TRASH);
HivePartitionVersionFinder versionFinder = GobblinConstructorUtils
.invokeConstructor(HivePartitionVersionFinder.class,
this.state.getProp(ComplianceConfigurationKeys.RETENTION_VERSION_FINDER_CLASS_KEY), this.fs, this.state,
patterns);
List<HivePartitionVersion> versions = new ArrayList<>(versionFinder.findDatasetVersions(this));
HivePartitionVersionPolicy versionPolicy = GobblinConstructorUtils
.invokeConstructor(HivePartitionVersionPolicy.class,
this.state.getProp(ComplianceConfigurationKeys.RETENTION_SELECTION_POLICY_CLASS_KEY), this.state, this);
List<HivePartitionVersion> deletableVersions = new ArrayList<>(versionPolicy.selectedList(versions));
List<String> nonDeletableVersionLocations = getNonDeletableVersionLocations(versions, deletableVersions);
for (HivePartitionVersion hivePartitionDatasetVersion : deletableVersions) {
try {
VersionCleaner versionCleaner = GobblinConstructorUtils
.invokeConstructor(HivePartitionVersionRetentionRunner.class,
this.state.getProp(ComplianceConfigurationKeys.RETENTION_VERSION_CLEANER_CLASS_KEY), this,
hivePartitionDatasetVersion, nonDeletableVersionLocations, this.state);
versionCleaner.clean();
} catch (Exception e) {
log.warn("Caught exception trying to clean version " + hivePartitionDatasetVersion.datasetURN() + "\n" + e
.getMessage());
}
}
} } | public class class_name {
@Override
public void clean()
throws IOException {
Preconditions.checkArgument(this.state.contains(ComplianceConfigurationKeys.RETENTION_VERSION_FINDER_CLASS_KEY),
"Missing required property " + ComplianceConfigurationKeys.RETENTION_VERSION_FINDER_CLASS_KEY);
Preconditions.checkArgument(this.state.contains(ComplianceConfigurationKeys.RETENTION_SELECTION_POLICY_CLASS_KEY),
"Missing required property " + ComplianceConfigurationKeys.RETENTION_SELECTION_POLICY_CLASS_KEY);
Preconditions.checkArgument(this.state.contains(ComplianceConfigurationKeys.RETENTION_VERSION_CLEANER_CLASS_KEY),
"Missing required property " + ComplianceConfigurationKeys.RETENTION_VERSION_CLEANER_CLASS_KEY);
List<String> patterns = new ArrayList<>();
patterns.add(getCompleteTableName(this) + ComplianceConfigurationKeys.BACKUP);
patterns.add(getCompleteTableName(this) + ComplianceConfigurationKeys.STAGING);
patterns.add(getCompleteTableName(this) + ComplianceConfigurationKeys.TRASH);
HivePartitionVersionFinder versionFinder = GobblinConstructorUtils
.invokeConstructor(HivePartitionVersionFinder.class,
this.state.getProp(ComplianceConfigurationKeys.RETENTION_VERSION_FINDER_CLASS_KEY), this.fs, this.state,
patterns);
List<HivePartitionVersion> versions = new ArrayList<>(versionFinder.findDatasetVersions(this));
HivePartitionVersionPolicy versionPolicy = GobblinConstructorUtils
.invokeConstructor(HivePartitionVersionPolicy.class,
this.state.getProp(ComplianceConfigurationKeys.RETENTION_SELECTION_POLICY_CLASS_KEY), this.state, this);
List<HivePartitionVersion> deletableVersions = new ArrayList<>(versionPolicy.selectedList(versions));
List<String> nonDeletableVersionLocations = getNonDeletableVersionLocations(versions, deletableVersions);
for (HivePartitionVersion hivePartitionDatasetVersion : deletableVersions) {
try {
VersionCleaner versionCleaner = GobblinConstructorUtils
.invokeConstructor(HivePartitionVersionRetentionRunner.class,
this.state.getProp(ComplianceConfigurationKeys.RETENTION_VERSION_CLEANER_CLASS_KEY), this,
hivePartitionDatasetVersion, nonDeletableVersionLocations, this.state);
versionCleaner.clean(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.warn("Caught exception trying to clean version " + hivePartitionDatasetVersion.datasetURN() + "\n" + e
.getMessage());
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfBuildingInstallation() {
if (_GenericApplicationPropertyOfBuildingInstallation == null) {
_GenericApplicationPropertyOfBuildingInstallation = new ArrayList<JAXBElement<Object>>();
}
return this._GenericApplicationPropertyOfBuildingInstallation;
} } | public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfBuildingInstallation() {
if (_GenericApplicationPropertyOfBuildingInstallation == null) {
_GenericApplicationPropertyOfBuildingInstallation = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none]
}
return this._GenericApplicationPropertyOfBuildingInstallation;
} } |
public class class_name {
private void loadOptions(final P6LoadableOptions options) {
// make sure to load defaults first
options.load(options.getDefaults());
// load the rest in the right order then
for (P6OptionsSource optionsSource : optionsSources) {
Map<String, String> toLoad = optionsSource.getOptions();
if (null != toLoad) {
options.load(toLoad);
}
}
// register to all the props then
allOptions.put(options.getClass(), options);
} } | public class class_name {
private void loadOptions(final P6LoadableOptions options) {
// make sure to load defaults first
options.load(options.getDefaults());
// load the rest in the right order then
for (P6OptionsSource optionsSource : optionsSources) {
Map<String, String> toLoad = optionsSource.getOptions();
if (null != toLoad) {
options.load(toLoad); // depends on control dependency: [if], data = [toLoad)]
}
}
// register to all the props then
allOptions.put(options.getClass(), options);
} } |
public class class_name {
public void doProcess(Instance carrier) {
try {
if(prePipe!=null)
prePipe.addThruPipe(carrier);
carrier.setSource(carrier.getData());
featurePipe.addThruPipe(carrier);
} catch (Exception e) {
e.printStackTrace();
}
} } | public class class_name {
public void doProcess(Instance carrier) {
try {
if(prePipe!=null)
prePipe.addThruPipe(carrier);
carrier.setSource(carrier.getData());
// depends on control dependency: [try], data = [none]
featurePipe.addThruPipe(carrier);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static long multiplyFraction(long x, long numerator, long denominator) {
if (x == 1) {
return numerator / denominator;
}
long commonDivisor = gcd(x, denominator);
x /= commonDivisor;
denominator /= commonDivisor;
// We know gcd(x, denominator) = 1, and x * numerator / denominator is exact,
// so denominator must be a divisor of numerator.
return x * (numerator / denominator);
} } | public class class_name {
static long multiplyFraction(long x, long numerator, long denominator) {
if (x == 1) {
return numerator / denominator; // depends on control dependency: [if], data = [none]
}
long commonDivisor = gcd(x, denominator);
x /= commonDivisor;
denominator /= commonDivisor;
// We know gcd(x, denominator) = 1, and x * numerator / denominator is exact,
// so denominator must be a divisor of numerator.
return x * (numerator / denominator);
} } |
public class class_name {
private static Key<?> newKey(Type type, Set<? extends Annotation> qualifiers) {
if (qualifiers.isEmpty()) {
return Key.get(type);
}
// There can be only one qualifier.
if (qualifiers.size() == 1) {
for (Annotation first : qualifiers) {
return Key.get(type, first);
}
}
return null;
} } | public class class_name {
private static Key<?> newKey(Type type, Set<? extends Annotation> qualifiers) {
if (qualifiers.isEmpty()) {
return Key.get(type); // depends on control dependency: [if], data = [none]
}
// There can be only one qualifier.
if (qualifiers.size() == 1) {
for (Annotation first : qualifiers) {
return Key.get(type, first); // depends on control dependency: [for], data = [first]
}
}
return null;
} } |
public class class_name {
@SuppressWarnings({"unchecked"})
public static String[] tokenizeToStringArray(
String str, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens) {
if (str == null) {
return null;
}
StringTokenizer st = new StringTokenizer(str, delimiters);
List<String> tokens = new ArrayList();
while (st.hasMoreTokens()) {
String token = st.nextToken();
if (trimTokens) {
token = token.trim();
}
if (!ignoreEmptyTokens || token.length() > 0) {
tokens.add(token);
}
}
return tokens.toArray(new String[0]);
} } | public class class_name {
@SuppressWarnings({"unchecked"})
public static String[] tokenizeToStringArray(
String str, String delimiters, boolean trimTokens, boolean ignoreEmptyTokens) {
if (str == null) {
return null; // depends on control dependency: [if], data = [none]
}
StringTokenizer st = new StringTokenizer(str, delimiters);
List<String> tokens = new ArrayList();
while (st.hasMoreTokens()) {
String token = st.nextToken();
if (trimTokens) {
token = token.trim(); // depends on control dependency: [if], data = [none]
}
if (!ignoreEmptyTokens || token.length() > 0) {
tokens.add(token); // depends on control dependency: [if], data = [none]
}
}
return tokens.toArray(new String[0]);
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.