code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void marshall(UpdateParam updateParam, ProtocolMarshaller protocolMarshaller) {
if (updateParam == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateParam.getType(), TYPE_BINDING);
protocolMarshaller.marshall(updateParam.getValue(), VALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateParam updateParam, ProtocolMarshaller protocolMarshaller) {
if (updateParam == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateParam.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateParam.getValue(), VALUE_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 {
@Nullable
static Integer optInteger(
@NonNull JSONObject jsonObject,
@NonNull @Size(min = 1) String fieldName) {
if (!jsonObject.has(fieldName)) {
return null;
}
return jsonObject.optInt(fieldName);
} } | public class class_name {
@Nullable
static Integer optInteger(
@NonNull JSONObject jsonObject,
@NonNull @Size(min = 1) String fieldName) {
if (!jsonObject.has(fieldName)) {
return null; // depends on control dependency: [if], data = [none]
}
return jsonObject.optInt(fieldName);
} } |
public class class_name {
private void initTopicTree() {
DefaultMutableTreeNode topicTree = getDataAsTree();
if (topicTree != null) {
initTopicTree(rootNode, topicTree.getRoot());
}
} } | public class class_name {
private void initTopicTree() {
DefaultMutableTreeNode topicTree = getDataAsTree();
if (topicTree != null) {
initTopicTree(rootNode, topicTree.getRoot()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void setAndAllocateBuffer(int sizeToAllocate) {
if(_buffer == null){
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "setAndAllocateBuffer, Buffer is null, size to allocate is : " + sizeToAllocate);
}
_buffer = allocateBuffer(sizeToAllocate);
}
configurePreReadBuffer(sizeToAllocate);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "setAndAllocateBuffer, Setting the buffer : " + _buffer );
}
_tcpContext.getReadInterface().setBuffer(_buffer);
} } | public class class_name {
private void setAndAllocateBuffer(int sizeToAllocate) {
if(_buffer == null){
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "setAndAllocateBuffer, Buffer is null, size to allocate is : " + sizeToAllocate); // depends on control dependency: [if], data = [none]
}
_buffer = allocateBuffer(sizeToAllocate); // depends on control dependency: [if], data = [none]
}
configurePreReadBuffer(sizeToAllocate);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "setAndAllocateBuffer, Setting the buffer : " + _buffer ); // depends on control dependency: [if], data = [none]
}
_tcpContext.getReadInterface().setBuffer(_buffer);
} } |
public class class_name {
public static void manage(MBeanServer server, String domain, Injector injector) {
// Register each binding independently.
for (Binding<?> binding : injector.getBindings().values()) {
// Construct the name manually so we can ensure proper ordering of the
// key/value pairs.
StringBuilder name = new StringBuilder();
name.append(domain).append(":");
Key<?> key = binding.getKey();
name.append("type=").append(quote(key.getTypeLiteral().toString()));
Annotation annotation = key.getAnnotation();
if (annotation != null) {
name.append(",annotation=").append(quote(annotation.toString()));
} else {
Class<? extends Annotation> annotationType = key.getAnnotationType();
if (annotationType != null) {
name.append(",annotation=").append(quote("@" + annotationType.getName()));
}
}
try {
server.registerMBean(new ManagedBinding(binding), new ObjectName(name.toString()));
} catch (MalformedObjectNameException e) {
throw new RuntimeException("Bad object name: " + name, e);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} } | public class class_name {
public static void manage(MBeanServer server, String domain, Injector injector) {
// Register each binding independently.
for (Binding<?> binding : injector.getBindings().values()) {
// Construct the name manually so we can ensure proper ordering of the
// key/value pairs.
StringBuilder name = new StringBuilder();
name.append(domain).append(":"); // depends on control dependency: [for], data = [none]
Key<?> key = binding.getKey();
name.append("type=").append(quote(key.getTypeLiteral().toString())); // depends on control dependency: [for], data = [none]
Annotation annotation = key.getAnnotation();
if (annotation != null) {
name.append(",annotation=").append(quote(annotation.toString())); // depends on control dependency: [if], data = [(annotation]
} else {
Class<? extends Annotation> annotationType = key.getAnnotationType();
if (annotationType != null) {
name.append(",annotation=").append(quote("@" + annotationType.getName())); // depends on control dependency: [if], data = [none]
}
}
try {
server.registerMBean(new ManagedBinding(binding), new ObjectName(name.toString())); // depends on control dependency: [try], data = [none]
} catch (MalformedObjectNameException e) {
throw new RuntimeException("Bad object name: " + name, e);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
static public String escape(String x, String okChars) {
StringBuilder newname = new StringBuilder();
for (char c : x.toCharArray()) {
if (c == '%') {
newname.append("%%");
} else if (!Character.isLetterOrDigit(c) && okChars.indexOf(c) < 0) {
newname.append('%');
newname.append(Integer.toHexString((0xFF & (int) c)));
} else
newname.append(c);
}
return newname.toString();
} } | public class class_name {
static public String escape(String x, String okChars) {
StringBuilder newname = new StringBuilder();
for (char c : x.toCharArray()) {
if (c == '%') {
newname.append("%%");
// depends on control dependency: [if], data = [none]
} else if (!Character.isLetterOrDigit(c) && okChars.indexOf(c) < 0) {
newname.append('%');
// depends on control dependency: [if], data = [none]
newname.append(Integer.toHexString((0xFF & (int) c)));
// depends on control dependency: [if], data = [none]
} else
newname.append(c);
}
return newname.toString();
} } |
public class class_name {
public static <E> void swap(List<E> list1, int list1Index, List<E> list2, int list2Index) {
if(list1.get(list1Index) != list2.get(list2Index)) {
E hold = list1.remove(list1Index);
if(list1 != list2 || list1Index > list2Index){
list1.add(list1Index, list2.get(list2Index));
}
else {
list1.add(list1Index, list2.get(list2Index-1));
}
list2.remove(list2Index);
list2.add(list2Index, hold);
}
} } | public class class_name {
public static <E> void swap(List<E> list1, int list1Index, List<E> list2, int list2Index) {
if(list1.get(list1Index) != list2.get(list2Index)) {
E hold = list1.remove(list1Index);
if(list1 != list2 || list1Index > list2Index){
list1.add(list1Index, list2.get(list2Index)); // depends on control dependency: [if], data = [(list1]
}
else {
list1.add(list1Index, list2.get(list2Index-1)); // depends on control dependency: [if], data = [(list1]
}
list2.remove(list2Index); // depends on control dependency: [if], data = [none]
list2.add(list2Index, hold); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void removeHdrInstances(HeaderElement root, boolean bFilter) {
if (null == root) {
return;
}
HeaderKeys key = root.getKey();
if (bFilter && key.useFilters()) {
filterRemove(key, null);
}
HeaderElement elem = root;
while (null != elem) {
elem.remove();
elem = elem.nextInstance;
}
} } | public class class_name {
private void removeHdrInstances(HeaderElement root, boolean bFilter) {
if (null == root) {
return; // depends on control dependency: [if], data = [none]
}
HeaderKeys key = root.getKey();
if (bFilter && key.useFilters()) {
filterRemove(key, null); // depends on control dependency: [if], data = [none]
}
HeaderElement elem = root;
while (null != elem) {
elem.remove(); // depends on control dependency: [while], data = [none]
elem = elem.nextInstance; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public void marshall(SMSChannelResponse sMSChannelResponse, ProtocolMarshaller protocolMarshaller) {
if (sMSChannelResponse == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(sMSChannelResponse.getApplicationId(), APPLICATIONID_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getCreationDate(), CREATIONDATE_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getEnabled(), ENABLED_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getHasCredential(), HASCREDENTIAL_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getId(), ID_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getIsArchived(), ISARCHIVED_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getLastModifiedBy(), LASTMODIFIEDBY_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getPlatform(), PLATFORM_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getPromotionalMessagesPerSecond(), PROMOTIONALMESSAGESPERSECOND_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getSenderId(), SENDERID_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getShortCode(), SHORTCODE_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getTransactionalMessagesPerSecond(), TRANSACTIONALMESSAGESPERSECOND_BINDING);
protocolMarshaller.marshall(sMSChannelResponse.getVersion(), VERSION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(SMSChannelResponse sMSChannelResponse, ProtocolMarshaller protocolMarshaller) {
if (sMSChannelResponse == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(sMSChannelResponse.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getCreationDate(), CREATIONDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getEnabled(), ENABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getHasCredential(), HASCREDENTIAL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getIsArchived(), ISARCHIVED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getLastModifiedBy(), LASTMODIFIEDBY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getPlatform(), PLATFORM_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getPromotionalMessagesPerSecond(), PROMOTIONALMESSAGESPERSECOND_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getSenderId(), SENDERID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getShortCode(), SHORTCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getTransactionalMessagesPerSecond(), TRANSACTIONALMESSAGESPERSECOND_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sMSChannelResponse.getVersion(), VERSION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public DescriptorValue calculate(IAtomContainer container) {
IAtomContainer local = AtomContainerManipulator.removeHydrogens(container);
int natom = local.getAtomCount();
DoubleArrayResult retval = new DoubleArrayResult();
ArrayList<List<?>> pathList = new ArrayList<List<?>>();
// unique paths
for (int i = 0; i < natom - 1; i++) {
IAtom a = local.getAtom(i);
for (int j = i + 1; j < natom; j++) {
IAtom b = local.getAtom(j);
pathList.addAll(PathTools.getAllPaths(local, a, b));
}
}
// heteroatoms
double[] pathWts = getPathWeights(pathList, local);
double mid = 0.0;
for (double pathWt3 : pathWts)
mid += pathWt3;
mid += natom; // since we don't calculate paths of length 0 above
retval.add(mid);
retval.add(mid / (double) natom);
pathList.clear();
int count = 0;
for (int i = 0; i < natom; i++) {
IAtom a = local.getAtom(i);
if (a.getSymbol().equalsIgnoreCase("C")) continue;
count++;
for (int j = 0; j < natom; j++) {
IAtom b = local.getAtom(j);
if (a.equals(b)) continue;
pathList.addAll(PathTools.getAllPaths(local, a, b));
}
}
pathWts = getPathWeights(pathList, local);
mid = 0.0;
for (double pathWt2 : pathWts)
mid += pathWt2;
mid += count;
retval.add(mid);
// oxygens
pathList.clear();
count = 0;
for (int i = 0; i < natom; i++) {
IAtom a = local.getAtom(i);
if (!a.getSymbol().equalsIgnoreCase("O")) continue;
count++;
for (int j = 0; j < natom; j++) {
IAtom b = local.getAtom(j);
if (a.equals(b)) continue;
pathList.addAll(PathTools.getAllPaths(local, a, b));
}
}
pathWts = getPathWeights(pathList, local);
mid = 0.0;
for (double pathWt1 : pathWts)
mid += pathWt1;
mid += count;
retval.add(mid);
// nitrogens
pathList.clear();
count = 0;
for (int i = 0; i < natom; i++) {
IAtom a = local.getAtom(i);
if (!a.getSymbol().equalsIgnoreCase("N")) continue;
count++;
for (int j = 0; j < natom; j++) {
IAtom b = local.getAtom(j);
if (a.equals(b)) continue;
pathList.addAll(PathTools.getAllPaths(local, a, b));
}
}
pathWts = getPathWeights(pathList, local);
mid = 0.0;
for (double pathWt : pathWts)
mid += pathWt;
mid += count;
retval.add(mid);
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval,
getDescriptorNames());
} } | public class class_name {
@Override
public DescriptorValue calculate(IAtomContainer container) {
IAtomContainer local = AtomContainerManipulator.removeHydrogens(container);
int natom = local.getAtomCount();
DoubleArrayResult retval = new DoubleArrayResult();
ArrayList<List<?>> pathList = new ArrayList<List<?>>();
// unique paths
for (int i = 0; i < natom - 1; i++) {
IAtom a = local.getAtom(i);
for (int j = i + 1; j < natom; j++) {
IAtom b = local.getAtom(j);
pathList.addAll(PathTools.getAllPaths(local, a, b)); // depends on control dependency: [for], data = [none]
}
}
// heteroatoms
double[] pathWts = getPathWeights(pathList, local);
double mid = 0.0;
for (double pathWt3 : pathWts)
mid += pathWt3;
mid += natom; // since we don't calculate paths of length 0 above
retval.add(mid);
retval.add(mid / (double) natom);
pathList.clear();
int count = 0;
for (int i = 0; i < natom; i++) {
IAtom a = local.getAtom(i);
if (a.getSymbol().equalsIgnoreCase("C")) continue;
count++; // depends on control dependency: [for], data = [none]
for (int j = 0; j < natom; j++) {
IAtom b = local.getAtom(j);
if (a.equals(b)) continue;
pathList.addAll(PathTools.getAllPaths(local, a, b)); // depends on control dependency: [for], data = [none]
}
}
pathWts = getPathWeights(pathList, local);
mid = 0.0;
for (double pathWt2 : pathWts)
mid += pathWt2;
mid += count;
retval.add(mid);
// oxygens
pathList.clear();
count = 0;
for (int i = 0; i < natom; i++) {
IAtom a = local.getAtom(i);
if (!a.getSymbol().equalsIgnoreCase("O")) continue;
count++; // depends on control dependency: [for], data = [none]
for (int j = 0; j < natom; j++) {
IAtom b = local.getAtom(j);
if (a.equals(b)) continue;
pathList.addAll(PathTools.getAllPaths(local, a, b)); // depends on control dependency: [for], data = [none]
}
}
pathWts = getPathWeights(pathList, local);
mid = 0.0;
for (double pathWt1 : pathWts)
mid += pathWt1;
mid += count;
retval.add(mid);
// nitrogens
pathList.clear();
count = 0;
for (int i = 0; i < natom; i++) {
IAtom a = local.getAtom(i);
if (!a.getSymbol().equalsIgnoreCase("N")) continue;
count++; // depends on control dependency: [for], data = [none]
for (int j = 0; j < natom; j++) {
IAtom b = local.getAtom(j);
if (a.equals(b)) continue;
pathList.addAll(PathTools.getAllPaths(local, a, b)); // depends on control dependency: [for], data = [none]
}
}
pathWts = getPathWeights(pathList, local);
mid = 0.0;
for (double pathWt : pathWts)
mid += pathWt;
mid += count;
retval.add(mid);
return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), retval,
getDescriptorNames());
} } |
public class class_name {
public void process(final T command) {
boolean traceStarted = false;
incrementCommandsProcessed();
DehydratedExecutionContext ctx = null;
try {
validateCommand(command);
CommandResolver<T> resolver = createCommandResolver(command, tracer);
ctx = resolver.resolveExecutionContext();
List<ExecutionCommand> executionCommands = resolver.resolveExecutionCommands();
if (executionCommands.size() > 1) {
throw new CougarFrameworkException("Resolved >1 command in a non-batch call!");
}
ExecutionCommand exec = executionCommands.get(0);
tracer.start(ctx.getRequestUUID(), exec.getOperationKey());
traceStarted = true;
executeCommand(exec, ctx);
} catch(CougarException ce) {
executeError(command, ctx, ce, traceStarted);
} catch (Exception e) {
executeError(command, ctx, new CougarFrameworkException("Unexpected exception while processing transport command", e), traceStarted);
}
} } | public class class_name {
public void process(final T command) {
boolean traceStarted = false;
incrementCommandsProcessed();
DehydratedExecutionContext ctx = null;
try {
validateCommand(command); // depends on control dependency: [try], data = [none]
CommandResolver<T> resolver = createCommandResolver(command, tracer);
ctx = resolver.resolveExecutionContext(); // depends on control dependency: [try], data = [none]
List<ExecutionCommand> executionCommands = resolver.resolveExecutionCommands();
if (executionCommands.size() > 1) {
throw new CougarFrameworkException("Resolved >1 command in a non-batch call!");
}
ExecutionCommand exec = executionCommands.get(0);
tracer.start(ctx.getRequestUUID(), exec.getOperationKey()); // depends on control dependency: [try], data = [none]
traceStarted = true; // depends on control dependency: [try], data = [none]
executeCommand(exec, ctx); // depends on control dependency: [try], data = [none]
} catch(CougarException ce) {
executeError(command, ctx, ce, traceStarted);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
executeError(command, ctx, new CougarFrameworkException("Unexpected exception while processing transport command", e), traceStarted);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String rewriteGeneratedBinaryResourceDebugUrl(String requestPath, String content, String binaryServletMapping) {
// Write the content of the CSS in the Stringwriter
if (binaryServletMapping == null) {
binaryServletMapping = "";
}
// Define the replacement pattern for the generated binary resource
// (like jar:img/myImg.png)
String relativeRootUrlPath = PathNormalizer.getRootRelativePath(requestPath);
String replacementPattern = PathNormalizer
.normalizePath("$1" + relativeRootUrlPath + binaryServletMapping + "/$5_cbDebug/$7$8");
Matcher matcher = GENERATED_BINARY_RESOURCE_PATTERN.matcher(content);
// Rewrite the images define in the classpath, to point to the image
// servlet
StringBuffer result = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(result, replacementPattern);
}
matcher.appendTail(result);
return result.toString();
} } | public class class_name {
public static String rewriteGeneratedBinaryResourceDebugUrl(String requestPath, String content, String binaryServletMapping) {
// Write the content of the CSS in the Stringwriter
if (binaryServletMapping == null) {
binaryServletMapping = ""; // depends on control dependency: [if], data = [none]
}
// Define the replacement pattern for the generated binary resource
// (like jar:img/myImg.png)
String relativeRootUrlPath = PathNormalizer.getRootRelativePath(requestPath);
String replacementPattern = PathNormalizer
.normalizePath("$1" + relativeRootUrlPath + binaryServletMapping + "/$5_cbDebug/$7$8");
Matcher matcher = GENERATED_BINARY_RESOURCE_PATTERN.matcher(content);
// Rewrite the images define in the classpath, to point to the image
// servlet
StringBuffer result = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(result, replacementPattern); // depends on control dependency: [while], data = [none]
}
matcher.appendTail(result);
return result.toString();
} } |
public class class_name {
@Override
public EClass getIfcCostValue() {
if (ifcCostValueEClass == null) {
ifcCostValueEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(151);
}
return ifcCostValueEClass;
} } | public class class_name {
@Override
public EClass getIfcCostValue() {
if (ifcCostValueEClass == null) {
ifcCostValueEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(151);
// depends on control dependency: [if], data = [none]
}
return ifcCostValueEClass;
} } |
public class class_name {
@Override
public CPMeasurementUnit fetchByG_P_T_Last(long groupId, boolean primary,
int type, OrderByComparator<CPMeasurementUnit> orderByComparator) {
int count = countByG_P_T(groupId, primary, type);
if (count == 0) {
return null;
}
List<CPMeasurementUnit> list = findByG_P_T(groupId, primary, type,
count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CPMeasurementUnit fetchByG_P_T_Last(long groupId, boolean primary,
int type, OrderByComparator<CPMeasurementUnit> orderByComparator) {
int count = countByG_P_T(groupId, primary, type);
if (count == 0) {
return null; // depends on control dependency: [if], data = [none]
}
List<CPMeasurementUnit> list = findByG_P_T(groupId, primary, type,
count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static DisplayMode getDisplayMode (
GraphicsDevice gd, int width, int height, int desiredDepth, int minimumDepth)
{
DisplayMode[] modes = gd.getDisplayModes();
final int ddepth = desiredDepth;
// we sort modes in order of desirability
Comparator<DisplayMode> mcomp = new Comparator<DisplayMode>() {
public int compare (DisplayMode m1, DisplayMode m2) {
int bd1 = m1.getBitDepth(), bd2 = m2.getBitDepth();
int rr1 = m1.getRefreshRate(), rr2 = m2.getRefreshRate();
// prefer the desired depth
if (bd1 == ddepth && bd2 != ddepth) {
return -1;
} else if (bd2 == ddepth && bd1 != ddepth) {
return 1;
}
// otherwise prefer higher depths
if (bd1 != bd2) {
return bd2 - bd1;
}
// for same bitrates, prefer higher refresh rates
return rr2 - rr1;
}
};
// but we only add modes that meet our minimum requirements
TreeSet<DisplayMode> mset = new TreeSet<DisplayMode>(mcomp);
for (DisplayMode mode : modes) {
if (mode.getWidth() == width &&
mode.getHeight() == height &&
mode.getBitDepth() >= minimumDepth &&
mode.getRefreshRate() <= 75) {
mset.add(mode);
}
}
return (mset.size() > 0) ? mset.first() : null;
} } | public class class_name {
public static DisplayMode getDisplayMode (
GraphicsDevice gd, int width, int height, int desiredDepth, int minimumDepth)
{
DisplayMode[] modes = gd.getDisplayModes();
final int ddepth = desiredDepth;
// we sort modes in order of desirability
Comparator<DisplayMode> mcomp = new Comparator<DisplayMode>() {
public int compare (DisplayMode m1, DisplayMode m2) {
int bd1 = m1.getBitDepth(), bd2 = m2.getBitDepth();
int rr1 = m1.getRefreshRate(), rr2 = m2.getRefreshRate();
// prefer the desired depth
if (bd1 == ddepth && bd2 != ddepth) {
return -1; // depends on control dependency: [if], data = [none]
} else if (bd2 == ddepth && bd1 != ddepth) {
return 1; // depends on control dependency: [if], data = [none]
}
// otherwise prefer higher depths
if (bd1 != bd2) {
return bd2 - bd1; // depends on control dependency: [if], data = [none]
}
// for same bitrates, prefer higher refresh rates
return rr2 - rr1;
}
};
// but we only add modes that meet our minimum requirements
TreeSet<DisplayMode> mset = new TreeSet<DisplayMode>(mcomp);
for (DisplayMode mode : modes) {
if (mode.getWidth() == width &&
mode.getHeight() == height &&
mode.getBitDepth() >= minimumDepth &&
mode.getRefreshRate() <= 75) {
mset.add(mode); // depends on control dependency: [if], data = [none]
}
}
return (mset.size() > 0) ? mset.first() : null;
} } |
public class class_name {
public DBag difference(DBag otherBag)
{
DBagImpl result = new DBagImpl(getPBKey());
Iterator iter = this.iterator();
while (iter.hasNext())
{
Object candidate = iter.next();
if (!otherBag.contains(candidate))
{
result.add(candidate);
}
}
return result;
} } | public class class_name {
public DBag difference(DBag otherBag)
{
DBagImpl result = new DBagImpl(getPBKey());
Iterator iter = this.iterator();
while (iter.hasNext())
{
Object candidate = iter.next();
if (!otherBag.contains(candidate))
{
result.add(candidate);
// depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
private static double calculate_MDEF_norm(Node sn, Node cg) {
// get the square sum of the counting neighborhoods box counts
long sq = sn.getSquareSum(cg.getLevel() - sn.getLevel());
/*
* if the square sum is equal to box count of the sampling Neighborhood then
* n_hat is equal one, and as cg needs to have at least one Element mdef
* would get zero or lower than zero. This is the case when all of the
* counting Neighborhoods contain one or zero Objects. Additionally, the
* cubic sum, square sum and sampling Neighborhood box count are all equal,
* which leads to sig_n_hat being zero and thus mdef_norm is either negative
* infinite or undefined. As the distribution of the Objects seem quite
* uniform, a mdef_norm value of zero ( = no outlier) is appropriate and
* circumvents the problem of undefined values.
*/
if(sq == sn.getCount()) {
return 0.0;
}
// calculation of mdef according to the paper and standardization as done in
// LOCI
long cb = sn.getCubicSum(cg.getLevel() - sn.getLevel());
double n_hat = (double) sq / sn.getCount();
double sig_n_hat = FastMath.sqrt(cb * sn.getCount() - (sq * sq)) / sn.getCount();
// Avoid NaN - correct result 0.0?
if(sig_n_hat < Double.MIN_NORMAL) {
return 0.0;
}
double mdef = n_hat - cg.getCount();
return mdef / sig_n_hat;
} } | public class class_name {
private static double calculate_MDEF_norm(Node sn, Node cg) {
// get the square sum of the counting neighborhoods box counts
long sq = sn.getSquareSum(cg.getLevel() - sn.getLevel());
/*
* if the square sum is equal to box count of the sampling Neighborhood then
* n_hat is equal one, and as cg needs to have at least one Element mdef
* would get zero or lower than zero. This is the case when all of the
* counting Neighborhoods contain one or zero Objects. Additionally, the
* cubic sum, square sum and sampling Neighborhood box count are all equal,
* which leads to sig_n_hat being zero and thus mdef_norm is either negative
* infinite or undefined. As the distribution of the Objects seem quite
* uniform, a mdef_norm value of zero ( = no outlier) is appropriate and
* circumvents the problem of undefined values.
*/
if(sq == sn.getCount()) {
return 0.0; // depends on control dependency: [if], data = [none]
}
// calculation of mdef according to the paper and standardization as done in
// LOCI
long cb = sn.getCubicSum(cg.getLevel() - sn.getLevel());
double n_hat = (double) sq / sn.getCount();
double sig_n_hat = FastMath.sqrt(cb * sn.getCount() - (sq * sq)) / sn.getCount();
// Avoid NaN - correct result 0.0?
if(sig_n_hat < Double.MIN_NORMAL) {
return 0.0; // depends on control dependency: [if], data = [none]
}
double mdef = n_hat - cg.getCount();
return mdef / sig_n_hat;
} } |
public class class_name {
public Matrix multiply (final float k)
{
final float pv[][] = new float [m_nRows] [m_nCols]; // product values
// Compute values of the product.
for (int r = 0; r < m_nRows; ++r)
{
for (int c = 0; c < m_nCols; ++c)
{
pv[r][c] = k * m_aValues[r][c];
}
}
return new Matrix (pv);
} } | public class class_name {
public Matrix multiply (final float k)
{
final float pv[][] = new float [m_nRows] [m_nCols]; // product values
// Compute values of the product.
for (int r = 0; r < m_nRows; ++r)
{
for (int c = 0; c < m_nCols; ++c)
{
pv[r][c] = k * m_aValues[r][c]; // depends on control dependency: [for], data = [c]
}
}
return new Matrix (pv);
} } |
public class class_name {
public DescribeEcsClustersResult withEcsClusters(EcsCluster... ecsClusters) {
if (this.ecsClusters == null) {
setEcsClusters(new com.amazonaws.internal.SdkInternalList<EcsCluster>(ecsClusters.length));
}
for (EcsCluster ele : ecsClusters) {
this.ecsClusters.add(ele);
}
return this;
} } | public class class_name {
public DescribeEcsClustersResult withEcsClusters(EcsCluster... ecsClusters) {
if (this.ecsClusters == null) {
setEcsClusters(new com.amazonaws.internal.SdkInternalList<EcsCluster>(ecsClusters.length)); // depends on control dependency: [if], data = [none]
}
for (EcsCluster ele : ecsClusters) {
this.ecsClusters.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public PropertyDescriptor getPropertyDescriptor(final String name, final boolean declared) {
PropertyDescriptor propertyDescriptor = getProperties().getPropertyDescriptor(name);
if ((propertyDescriptor != null) && propertyDescriptor.matchDeclared(declared)) {
return propertyDescriptor;
}
return null;
} } | public class class_name {
public PropertyDescriptor getPropertyDescriptor(final String name, final boolean declared) {
PropertyDescriptor propertyDescriptor = getProperties().getPropertyDescriptor(name);
if ((propertyDescriptor != null) && propertyDescriptor.matchDeclared(declared)) {
return propertyDescriptor; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private Collection<JcrProperty> getProperties( String repository, String workspace, String path, Node node ) throws RepositoryException {
ArrayList<PropertyDefinition> names = new ArrayList<>();
NodeType primaryType = node.getPrimaryNodeType();
PropertyDefinition[] defs = primaryType.getPropertyDefinitions();
names.addAll(Arrays.asList(defs));
NodeType[] mixinType = node.getMixinNodeTypes();
for (NodeType type : mixinType) {
defs = type.getPropertyDefinitions();
names.addAll(Arrays.asList(defs));
}
ArrayList<JcrProperty> list = new ArrayList<>();
for (PropertyDefinition def : names) {
String name = def.getName();
String type = PropertyType.nameFromValue(def.getRequiredType());
Property p = null;
try {
p = node.getProperty(def.getName());
} catch (PathNotFoundException e) {
}
String display = values(def, p);
String value = def.isMultiple() ? multiValue(p)
: singleValue(p, def, repository, workspace, path);
list.add(new JcrProperty(name, type, value, display));
}
return list;
} } | public class class_name {
private Collection<JcrProperty> getProperties( String repository, String workspace, String path, Node node ) throws RepositoryException {
ArrayList<PropertyDefinition> names = new ArrayList<>();
NodeType primaryType = node.getPrimaryNodeType();
PropertyDefinition[] defs = primaryType.getPropertyDefinitions();
names.addAll(Arrays.asList(defs));
NodeType[] mixinType = node.getMixinNodeTypes();
for (NodeType type : mixinType) {
defs = type.getPropertyDefinitions();
names.addAll(Arrays.asList(defs));
}
ArrayList<JcrProperty> list = new ArrayList<>();
for (PropertyDefinition def : names) {
String name = def.getName();
String type = PropertyType.nameFromValue(def.getRequiredType());
Property p = null;
try {
p = node.getProperty(def.getName()); // depends on control dependency: [try], data = [none]
} catch (PathNotFoundException e) {
} // depends on control dependency: [catch], data = [none]
String display = values(def, p);
String value = def.isMultiple() ? multiValue(p)
: singleValue(p, def, repository, workspace, path);
list.add(new JcrProperty(name, type, value, display));
}
return list;
} } |
public class class_name {
@Override
public void run() {
if (LOG.isLoggable(Level.INFO)) {
LOG.info("Calling run to start ESB job instance " + job + " for job with name " + name);
}
ClassLoader oldContextCL = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(job.getClass().getClassLoader());
while (true) {
if (Thread.interrupted()) {
return;
}
LOG.info("Starting ESB job instance " + job + " for job with name " + name);
int ret = job.runJobInTOS(arguments);
LOG.info("ESB job instance " + job + " with name " + name + " finished, return code is "
+ ret);
if (ret != 0) {
break;
}
}
} catch (RuntimeException ex) {
ex.printStackTrace();
LOG.log(Level.SEVERE, "RuntimeException when invoking runJobInTOS()", ex);
} finally {
Thread.currentThread().setContextClassLoader(oldContextCL);
}
} } | public class class_name {
@Override
public void run() {
if (LOG.isLoggable(Level.INFO)) {
LOG.info("Calling run to start ESB job instance " + job + " for job with name " + name); // depends on control dependency: [if], data = [none]
}
ClassLoader oldContextCL = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(job.getClass().getClassLoader()); // depends on control dependency: [try], data = [none]
while (true) {
if (Thread.interrupted()) {
return; // depends on control dependency: [if], data = [none]
}
LOG.info("Starting ESB job instance " + job + " for job with name " + name); // depends on control dependency: [while], data = [none]
int ret = job.runJobInTOS(arguments);
LOG.info("ESB job instance " + job + " with name " + name + " finished, return code is "
+ ret); // depends on control dependency: [while], data = [none]
if (ret != 0) {
break;
}
}
} catch (RuntimeException ex) {
ex.printStackTrace();
LOG.log(Level.SEVERE, "RuntimeException when invoking runJobInTOS()", ex);
} finally { // depends on control dependency: [catch], data = [none]
Thread.currentThread().setContextClassLoader(oldContextCL);
}
} } |
public class class_name {
public static boolean print(NetcdfFile nc, Writer out, WantValues showValues, boolean ncml, boolean strict,
String varNames, ucar.nc2.util.CancelTask ct) throws IOException {
boolean headerOnly = (showValues == WantValues.none) && (varNames == null);
try {
if (ncml)
writeNcML(nc, out, showValues, null); // output schema in NcML
else if (headerOnly)
nc.writeCDL(new PrintWriter(out), strict); // output schema in CDL form (like ncdump)
else {
PrintWriter ps = new PrintWriter(out);
nc.toStringStart(ps, strict);
Indent indent = new Indent(2);
indent.incr();
ps.printf("%n%sdata:%n", indent);
indent.incr();
if (showValues == WantValues.all) { // dump all data
for (Variable v : nc.getVariables()) {
printArray(v.read(), v.getFullName(), ps, indent, ct);
if (ct != null && ct.isCancel()) return false;
}
} else if (showValues == WantValues.coordsOnly) { // dump coordVars
for (Variable v : nc.getVariables()) {
if (v.isCoordinateVariable())
printArray(v.read(), v.getFullName(), ps, indent, ct);
if (ct != null && ct.isCancel()) return false;
}
}
if ((showValues != WantValues.all) && (varNames != null)) { // dump the list of variables
StringTokenizer stoke = new StringTokenizer(varNames, ";");
while (stoke.hasMoreTokens()) {
String varSubset = stoke.nextToken(); // variable name and optionally a subset
if (varSubset.indexOf('(') >= 0) { // has a selector
Array data = nc.readSection(varSubset);
printArray(data, varSubset, ps, indent, ct);
} else { // do entire variable
Variable v = nc.findVariable(varSubset);
if (v == null) {
ps.print(" cant find variable: " + varSubset + "\n " + usage);
continue;
}
// dont print coord vars if they are already printed
if ((showValues != WantValues.coordsOnly) || v.isCoordinateVariable())
printArray(v.read(), v.getFullName(), ps, indent, ct);
}
if (ct != null && ct.isCancel()) return false;
}
}
indent.decr();
indent.decr();
nc.toStringEnd(ps);
}
} catch (Exception e) {
e.printStackTrace();
out.write(e.getMessage());
out.flush();
return false;
}
out.flush();
return true;
} } | public class class_name {
public static boolean print(NetcdfFile nc, Writer out, WantValues showValues, boolean ncml, boolean strict,
String varNames, ucar.nc2.util.CancelTask ct) throws IOException {
boolean headerOnly = (showValues == WantValues.none) && (varNames == null);
try {
if (ncml)
writeNcML(nc, out, showValues, null); // output schema in NcML
else if (headerOnly)
nc.writeCDL(new PrintWriter(out), strict); // output schema in CDL form (like ncdump)
else {
PrintWriter ps = new PrintWriter(out);
nc.toStringStart(ps, strict); // depends on control dependency: [if], data = [none]
Indent indent = new Indent(2);
indent.incr(); // depends on control dependency: [if], data = [none]
ps.printf("%n%sdata:%n", indent); // depends on control dependency: [if], data = [none]
indent.incr(); // depends on control dependency: [if], data = [none]
if (showValues == WantValues.all) { // dump all data
for (Variable v : nc.getVariables()) {
printArray(v.read(), v.getFullName(), ps, indent, ct); // depends on control dependency: [for], data = [v]
if (ct != null && ct.isCancel()) return false;
}
} else if (showValues == WantValues.coordsOnly) { // dump coordVars
for (Variable v : nc.getVariables()) {
if (v.isCoordinateVariable())
printArray(v.read(), v.getFullName(), ps, indent, ct);
if (ct != null && ct.isCancel()) return false;
}
}
if ((showValues != WantValues.all) && (varNames != null)) { // dump the list of variables
StringTokenizer stoke = new StringTokenizer(varNames, ";");
while (stoke.hasMoreTokens()) {
String varSubset = stoke.nextToken(); // variable name and optionally a subset
if (varSubset.indexOf('(') >= 0) { // has a selector
Array data = nc.readSection(varSubset);
printArray(data, varSubset, ps, indent, ct); // depends on control dependency: [if], data = [none]
} else { // do entire variable
Variable v = nc.findVariable(varSubset);
if (v == null) {
ps.print(" cant find variable: " + varSubset + "\n " + usage); // depends on control dependency: [if], data = [none]
continue;
}
// dont print coord vars if they are already printed
if ((showValues != WantValues.coordsOnly) || v.isCoordinateVariable())
printArray(v.read(), v.getFullName(), ps, indent, ct);
}
if (ct != null && ct.isCancel()) return false;
}
}
indent.decr(); // depends on control dependency: [if], data = [none]
indent.decr(); // depends on control dependency: [if], data = [none]
nc.toStringEnd(ps); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
e.printStackTrace();
out.write(e.getMessage());
out.flush();
return false;
}
out.flush();
return true;
} } |
public class class_name {
@Override
public List<org.fcrepo.server.types.gen.Datastream> getDatastreams(String pid,
String asOfDateTime,
String dsState) {
assertInitialized();
try {
MessageContext ctx = context.getMessageContext();
org.fcrepo.server.storage.types.Datastream[] intDatastreams =
m_management.getDatastreams(ReadOnlyContext
.getSoapContext(ctx), pid, DateUtility
.parseDateOrNull(asOfDateTime), dsState);
return getGenDatastreams(intDatastreams);
} catch (Throwable th) {
LOG.error("Error getting datastreams", th);
throw CXFUtility.getFault(th);
}
} } | public class class_name {
@Override
public List<org.fcrepo.server.types.gen.Datastream> getDatastreams(String pid,
String asOfDateTime,
String dsState) {
assertInitialized();
try {
MessageContext ctx = context.getMessageContext();
org.fcrepo.server.storage.types.Datastream[] intDatastreams =
m_management.getDatastreams(ReadOnlyContext
.getSoapContext(ctx), pid, DateUtility
.parseDateOrNull(asOfDateTime), dsState);
return getGenDatastreams(intDatastreams); // depends on control dependency: [try], data = [none]
} catch (Throwable th) {
LOG.error("Error getting datastreams", th);
throw CXFUtility.getFault(th);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected boolean updateAssignment(DBIDIter iditer, List<? extends ModifiableDBIDs> clusters, WritableIntegerDataStore assignment, int newA) {
final int oldA = assignment.intValue(iditer);
if(oldA == newA) {
return false;
}
clusters.get(newA).add(iditer);
assignment.putInt(iditer, newA);
if(oldA >= 0) {
clusters.get(oldA).remove(iditer);
}
return true;
} } | public class class_name {
protected boolean updateAssignment(DBIDIter iditer, List<? extends ModifiableDBIDs> clusters, WritableIntegerDataStore assignment, int newA) {
final int oldA = assignment.intValue(iditer);
if(oldA == newA) {
return false; // depends on control dependency: [if], data = [none]
}
clusters.get(newA).add(iditer);
assignment.putInt(iditer, newA);
if(oldA >= 0) {
clusters.get(oldA).remove(iditer); // depends on control dependency: [if], data = [(oldA]
}
return true;
} } |
public class class_name {
private void setPathInfo(String path) {
m_infoPath.setValue(path);
// generate the path bread crumb
m_crumbs.removeAllComponents();
int i = path.indexOf("/");
String openPath = "";
while (i >= 0) {
String fragment = path.substring(0, i + 1);
openPath += fragment;
path = path.substring(i + 1);
i = path.indexOf("/");
Button crumb = new Button(fragment, m_crumbListener);
crumb.setData(openPath);
crumb.addStyleName(ValoTheme.BUTTON_LINK);
m_crumbs.addComponent(crumb);
}
} } | public class class_name {
private void setPathInfo(String path) {
m_infoPath.setValue(path);
// generate the path bread crumb
m_crumbs.removeAllComponents();
int i = path.indexOf("/");
String openPath = "";
while (i >= 0) {
String fragment = path.substring(0, i + 1);
openPath += fragment; // depends on control dependency: [while], data = [none]
path = path.substring(i + 1); // depends on control dependency: [while], data = [(i]
i = path.indexOf("/"); // depends on control dependency: [while], data = [none]
Button crumb = new Button(fragment, m_crumbListener);
crumb.setData(openPath); // depends on control dependency: [while], data = [none]
crumb.addStyleName(ValoTheme.BUTTON_LINK); // depends on control dependency: [while], data = [none]
m_crumbs.addComponent(crumb); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private static String format(String x) {
int z = x.indexOf("."); // 取小数点位置
String lstr = "", rstr = "";
if (z > -1) { // 看是否有小数,如果有,则分别取左边和右边
lstr = x.substring(0, z);
rstr = x.substring(z + 1);
} else {
// 否则就是全部
lstr = x;
}
String lstrrev = StrUtil.reverse(lstr); // 对左边的字串取反
String[] a = new String[5]; // 定义5个字串变量来存放解析出来的叁位一组的字串
switch (lstrrev.length() % 3) {
case 1:
lstrrev += "00";
break;
case 2:
lstrrev += "0";
break;
}
String lm = ""; // 用来存放转换後的整数部分
for (int i = 0; i < lstrrev.length() / 3; i++) {
a[i] = StrUtil.reverse(lstrrev.substring(3 * i, 3 * i + 3)); // 截取第一个叁位
if (!a[i].equals("000")) { // 用来避免这种情况:1000000 = one million
// thousand only
if (i != 0) {
lm = transThree(a[i]) + " " + parseMore(String.valueOf(i)) + " " + lm; // 加:
// thousand、million、billion
} else {
lm = transThree(a[i]); // 防止i=0时, 在多加两个空格.
}
} else {
lm += transThree(a[i]);
}
}
String xs = ""; // 用来存放转换後小数部分
if (z > -1) {
xs = "AND CENTS " + transTwo(rstr) + " "; // 小数部分存在时转换小数
}
return lm.trim() + " " + xs + "ONLY";
} } | public class class_name {
private static String format(String x) {
int z = x.indexOf("."); // 取小数点位置
String lstr = "", rstr = "";
if (z > -1) { // 看是否有小数,如果有,则分别取左边和右边
lstr = x.substring(0, z);
// depends on control dependency: [if], data = [none]
rstr = x.substring(z + 1);
// depends on control dependency: [if], data = [(z]
} else {
// 否则就是全部
lstr = x;
// depends on control dependency: [if], data = [none]
}
String lstrrev = StrUtil.reverse(lstr); // 对左边的字串取反
String[] a = new String[5]; // 定义5个字串变量来存放解析出来的叁位一组的字串
switch (lstrrev.length() % 3) {
case 1:
lstrrev += "00";
break;
case 2:
lstrrev += "0";
break;
}
String lm = ""; // 用来存放转换後的整数部分
for (int i = 0; i < lstrrev.length() / 3; i++) {
a[i] = StrUtil.reverse(lstrrev.substring(3 * i, 3 * i + 3)); // 截取第一个叁位
if (!a[i].equals("000")) { // 用来避免这种情况:1000000 = one million
// thousand only
if (i != 0) {
lm = transThree(a[i]) + " " + parseMore(String.valueOf(i)) + " " + lm; // 加:
// thousand、million、billion
} else {
lm = transThree(a[i]); // 防止i=0时, 在多加两个空格.
}
} else {
lm += transThree(a[i]);
}
}
String xs = ""; // 用来存放转换後小数部分
if (z > -1) {
xs = "AND CENTS " + transTwo(rstr) + " "; // 小数部分存在时转换小数
}
return lm.trim() + " " + xs + "ONLY";
} } |
public class class_name {
@Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!isInitialised()) {
table.setBean(ExampleDataUtil.createExampleData());
setInitialised(true);
}
} } | public class class_name {
@Override
protected void preparePaintComponent(final Request request) {
super.preparePaintComponent(request);
if (!isInitialised()) {
table.setBean(ExampleDataUtil.createExampleData()); // depends on control dependency: [if], data = [none]
setInitialised(true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<WarningsGroup> getByProperty(Class<? extends ICalProperty> propertyClass) {
List<WarningsGroup> warnings = new ArrayList<WarningsGroup>();
for (WarningsGroup group : this.warnings) {
ICalProperty property = group.getProperty();
if (property == null) {
continue;
}
if (propertyClass == property.getClass()) {
warnings.add(group);
}
}
return warnings;
} } | public class class_name {
public List<WarningsGroup> getByProperty(Class<? extends ICalProperty> propertyClass) {
List<WarningsGroup> warnings = new ArrayList<WarningsGroup>();
for (WarningsGroup group : this.warnings) {
ICalProperty property = group.getProperty();
if (property == null) {
continue;
}
if (propertyClass == property.getClass()) {
warnings.add(group); // depends on control dependency: [if], data = [none]
}
}
return warnings;
} } |
public class class_name {
protected void previewNativeEvent(NativePreviewEvent event) {
Event nativeEvent = Event.as(event.getNativeEvent());
if ((nativeEvent.getTypeInt() == Event.ONCLICK) && hasPageChanged()) {
EventTarget target = nativeEvent.getEventTarget();
if (!Element.is(target)) {
return;
}
Element element = Element.as(target);
element = CmsDomUtil.getAncestor(element, CmsDomUtil.Tag.a);
if (element == null) {
return;
}
AnchorElement anc = AnchorElement.as(element);
final String uri = anc.getHref();
// avoid to abort events for date-picker widgets
if (CmsStringUtil.isEmptyOrWhitespaceOnly(uri)
|| (CmsDomUtil.getAncestor(element, "x-date-picker") != null)) {
return;
}
nativeEvent.preventDefault();
nativeEvent.stopPropagation();
m_handler.leavePage(uri);
}
if (event.getTypeInt() == Event.ONKEYDOWN) {
int keyCode = nativeEvent.getKeyCode();
if ((keyCode == KeyCodes.KEY_F5) && hasPageChanged()) {
// user pressed F5
nativeEvent.preventDefault();
nativeEvent.stopPropagation();
m_handler.leavePage(Window.Location.getHref());
}
if (nativeEvent.getCtrlKey() || nativeEvent.getMetaKey()) {
// look for short cuts
if (keyCode == KeyCodes.KEY_E) {
if (nativeEvent.getShiftKey()) {
circleContainerEditLayers();
} else {
openNextElementView();
}
nativeEvent.preventDefault();
nativeEvent.stopPropagation();
}
}
}
} } | public class class_name {
protected void previewNativeEvent(NativePreviewEvent event) {
Event nativeEvent = Event.as(event.getNativeEvent());
if ((nativeEvent.getTypeInt() == Event.ONCLICK) && hasPageChanged()) {
EventTarget target = nativeEvent.getEventTarget();
if (!Element.is(target)) {
return; // depends on control dependency: [if], data = [none]
}
Element element = Element.as(target);
element = CmsDomUtil.getAncestor(element, CmsDomUtil.Tag.a); // depends on control dependency: [if], data = [none]
if (element == null) {
return; // depends on control dependency: [if], data = [none]
}
AnchorElement anc = AnchorElement.as(element);
final String uri = anc.getHref();
// avoid to abort events for date-picker widgets
if (CmsStringUtil.isEmptyOrWhitespaceOnly(uri)
|| (CmsDomUtil.getAncestor(element, "x-date-picker") != null)) {
return; // depends on control dependency: [if], data = [none]
}
nativeEvent.preventDefault(); // depends on control dependency: [if], data = [none]
nativeEvent.stopPropagation(); // depends on control dependency: [if], data = [none]
m_handler.leavePage(uri); // depends on control dependency: [if], data = [none]
}
if (event.getTypeInt() == Event.ONKEYDOWN) {
int keyCode = nativeEvent.getKeyCode();
if ((keyCode == KeyCodes.KEY_F5) && hasPageChanged()) {
// user pressed F5
nativeEvent.preventDefault(); // depends on control dependency: [if], data = [none]
nativeEvent.stopPropagation(); // depends on control dependency: [if], data = [none]
m_handler.leavePage(Window.Location.getHref()); // depends on control dependency: [if], data = [none]
}
if (nativeEvent.getCtrlKey() || nativeEvent.getMetaKey()) {
// look for short cuts
if (keyCode == KeyCodes.KEY_E) {
if (nativeEvent.getShiftKey()) {
circleContainerEditLayers(); // depends on control dependency: [if], data = [none]
} else {
openNextElementView(); // depends on control dependency: [if], data = [none]
}
nativeEvent.preventDefault(); // depends on control dependency: [if], data = [none]
nativeEvent.stopPropagation(); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
private Set<Artifact> determineRelevantPluginDependencies() throws MojoExecutionException {
Set<Artifact> relevantDependencies;
if (this.includePluginDependencies) {
if (this.executableDependency == null) {
getLog().debug("All Plugin Dependencies will be included.");
relevantDependencies = new HashSet<Artifact>(this.pluginDependencies);
} else {
getLog().debug("Selected plugin Dependencies will be included.");
Artifact executableArtifact = this.findExecutableArtifact();
Artifact executablePomArtifact = this.getExecutablePomArtifact(executableArtifact);
relevantDependencies = this.resolveExecutableDependencies(executablePomArtifact, false);
}
} else {
getLog().debug("Only Direct Plugin Dependencies will be included.");
PluginDescriptor descriptor = (PluginDescriptor) getPluginContext().get("pluginDescriptor");
try {
relevantDependencies = artifactResolver
.resolveTransitively(MavenMetadataSource
.createArtifacts(this.artifactFactory,
descriptor.getPlugin().getDependencies(),
null, null, null),
this.project.getArtifact(),
Collections.emptyMap(),
this.localRepository,
this.remoteRepositories,
metadataSource,
new ScopeArtifactFilter(Artifact.SCOPE_RUNTIME),
Collections.emptyList())
.getArtifacts();
} catch (Exception ex) {
throw new MojoExecutionException("Encountered problems resolving dependencies of the plugin "
+ "in preparation for its execution.", ex);
}
}
return relevantDependencies;
} } | public class class_name {
private Set<Artifact> determineRelevantPluginDependencies() throws MojoExecutionException {
Set<Artifact> relevantDependencies;
if (this.includePluginDependencies) {
if (this.executableDependency == null) {
getLog().debug("All Plugin Dependencies will be included."); // depends on control dependency: [if], data = [none]
relevantDependencies = new HashSet<Artifact>(this.pluginDependencies); // depends on control dependency: [if], data = [none]
} else {
getLog().debug("Selected plugin Dependencies will be included."); // depends on control dependency: [if], data = [none]
Artifact executableArtifact = this.findExecutableArtifact();
Artifact executablePomArtifact = this.getExecutablePomArtifact(executableArtifact);
relevantDependencies = this.resolveExecutableDependencies(executablePomArtifact, false); // depends on control dependency: [if], data = [none]
}
} else {
getLog().debug("Only Direct Plugin Dependencies will be included.");
PluginDescriptor descriptor = (PluginDescriptor) getPluginContext().get("pluginDescriptor");
try {
relevantDependencies = artifactResolver
.resolveTransitively(MavenMetadataSource
.createArtifacts(this.artifactFactory,
descriptor.getPlugin().getDependencies(),
null, null, null),
this.project.getArtifact(),
Collections.emptyMap(),
this.localRepository,
this.remoteRepositories,
metadataSource,
new ScopeArtifactFilter(Artifact.SCOPE_RUNTIME),
Collections.emptyList())
.getArtifacts(); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw new MojoExecutionException("Encountered problems resolving dependencies of the plugin "
+ "in preparation for its execution.", ex);
} // depends on control dependency: [catch], data = [none]
}
return relevantDependencies;
} } |
public class class_name {
private Topology createAdHocTopologyFromSuitableOptions(SuitableOptions appInfoSuitableOptions) {
Topology topology = new Topology();
TopologyElement current = null;
TopologyElement previous = null;
for (String moduleName : appInfoSuitableOptions.getStringIterator()) {
if (current == null) {
// first element treated. None of them needs to point at it
current = new TopologyElement(moduleName);
topology.addModule(current);
} else {// There were explored already other modules
previous = current;
current = new TopologyElement(moduleName);
previous.addElementCalled(current);
topology.addModule(current);
}
}
return topology;
} } | public class class_name {
private Topology createAdHocTopologyFromSuitableOptions(SuitableOptions appInfoSuitableOptions) {
Topology topology = new Topology();
TopologyElement current = null;
TopologyElement previous = null;
for (String moduleName : appInfoSuitableOptions.getStringIterator()) {
if (current == null) {
// first element treated. None of them needs to point at it
current = new TopologyElement(moduleName); // depends on control dependency: [if], data = [none]
topology.addModule(current); // depends on control dependency: [if], data = [(current]
} else {// There were explored already other modules
previous = current; // depends on control dependency: [if], data = [none]
current = new TopologyElement(moduleName); // depends on control dependency: [if], data = [none]
previous.addElementCalled(current); // depends on control dependency: [if], data = [(current]
topology.addModule(current); // depends on control dependency: [if], data = [(current]
}
}
return topology;
} } |
public class class_name {
@Override
public EClass getIfcCableCarrierFitting() {
if (ifcCableCarrierFittingEClass == null) {
ifcCableCarrierFittingEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(69);
}
return ifcCableCarrierFittingEClass;
} } | public class class_name {
@Override
public EClass getIfcCableCarrierFitting() {
if (ifcCableCarrierFittingEClass == null) {
ifcCableCarrierFittingEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(69);
// depends on control dependency: [if], data = [none]
}
return ifcCableCarrierFittingEClass;
} } |
public class class_name {
public String getString() {
// check state and initialize buffer
if (fileNameList.size() == 0 || lineData.size() == 0)
return null;
StringBuilder out = new StringBuilder();
// print StratumSection
out.append("*S " + stratumName + "\n");
// print FileSection
out.append("*F\n");
int bound = fileNameList.size();
for (int i = 0; i < bound; i++) {
if (filePathList.get(i) != null) {
out.append("+ " + i + " " + fileNameList.get(i) + "\n");
// Source paths must be relative, not absolute, so we
// remove the leading "/", if one exists.
String filePath = filePathList.get(i);
if (filePath.startsWith("/")) {
filePath = filePath.substring(1);
}
out.append(filePath + "\n");
} else {
out.append(i + " " + fileNameList.get(i) + "\n");
}
}
// print LineSection
out.append("*L\n");
bound = lineData.size();
for (int i = 0; i < bound; i++) {
LineInfo li = lineData.get(i);
out.append(li.getString());
}
return out.toString();
} } | public class class_name {
public String getString() {
// check state and initialize buffer
if (fileNameList.size() == 0 || lineData.size() == 0)
return null;
StringBuilder out = new StringBuilder();
// print StratumSection
out.append("*S " + stratumName + "\n");
// print FileSection
out.append("*F\n");
int bound = fileNameList.size();
for (int i = 0; i < bound; i++) {
if (filePathList.get(i) != null) {
out.append("+ " + i + " " + fileNameList.get(i) + "\n"); // depends on control dependency: [if], data = [none]
// Source paths must be relative, not absolute, so we
// remove the leading "/", if one exists.
String filePath = filePathList.get(i);
if (filePath.startsWith("/")) {
filePath = filePath.substring(1); // depends on control dependency: [if], data = [none]
}
out.append(filePath + "\n"); // depends on control dependency: [if], data = [none]
} else {
out.append(i + " " + fileNameList.get(i) + "\n"); // depends on control dependency: [if], data = [none]
}
}
// print LineSection
out.append("*L\n");
bound = lineData.size();
for (int i = 0; i < bound; i++) {
LineInfo li = lineData.get(i);
out.append(li.getString()); // depends on control dependency: [for], data = [none]
}
return out.toString();
} } |
public class class_name {
public void doNewRecord(boolean bDisplayOption)
{
UserInfo userTemplate = this.getUserTemplate();
if (userTemplate != null)
{
Record userInfo = this.getOwner();
boolean[] fileListenerStates = userInfo.setEnableListeners(false);
Object[] fieldListenerStates = userInfo.setEnableFieldListeners(false);
userInfo.moveFields(userTemplate, null, bDisplayOption, DBConstants.INIT_MOVE, false, false, false, false);
userInfo.getField(UserInfo.ID).initField(bDisplayOption);
userInfo.getField(UserInfo.FIRST_NAME).initField(bDisplayOption);
userInfo.getField(UserInfo.LAST_NAME).initField(bDisplayOption);
userInfo.getField(UserInfo.USER_NAME).initField(bDisplayOption);
userInfo.getField(UserInfo.PASSWORD).initField(bDisplayOption);
userInfo.getField(UserInfo.ID).setModified(false);
userInfo.getField(UserInfo.FIRST_NAME).setModified(false);
userInfo.getField(UserInfo.LAST_NAME).setModified(false);
userInfo.getField(UserInfo.USER_NAME).setModified(false);
userInfo.getField(UserInfo.PASSWORD).setModified(false);
userInfo.setEnableListeners(fileListenerStates);
userInfo.setEnableFieldListeners(fieldListenerStates);
}
super.doNewRecord(bDisplayOption);
} } | public class class_name {
public void doNewRecord(boolean bDisplayOption)
{
UserInfo userTemplate = this.getUserTemplate();
if (userTemplate != null)
{
Record userInfo = this.getOwner();
boolean[] fileListenerStates = userInfo.setEnableListeners(false);
Object[] fieldListenerStates = userInfo.setEnableFieldListeners(false);
userInfo.moveFields(userTemplate, null, bDisplayOption, DBConstants.INIT_MOVE, false, false, false, false); // depends on control dependency: [if], data = [(userTemplate]
userInfo.getField(UserInfo.ID).initField(bDisplayOption); // depends on control dependency: [if], data = [none]
userInfo.getField(UserInfo.FIRST_NAME).initField(bDisplayOption); // depends on control dependency: [if], data = [none]
userInfo.getField(UserInfo.LAST_NAME).initField(bDisplayOption); // depends on control dependency: [if], data = [none]
userInfo.getField(UserInfo.USER_NAME).initField(bDisplayOption); // depends on control dependency: [if], data = [none]
userInfo.getField(UserInfo.PASSWORD).initField(bDisplayOption); // depends on control dependency: [if], data = [none]
userInfo.getField(UserInfo.ID).setModified(false); // depends on control dependency: [if], data = [none]
userInfo.getField(UserInfo.FIRST_NAME).setModified(false); // depends on control dependency: [if], data = [none]
userInfo.getField(UserInfo.LAST_NAME).setModified(false); // depends on control dependency: [if], data = [none]
userInfo.getField(UserInfo.USER_NAME).setModified(false); // depends on control dependency: [if], data = [none]
userInfo.getField(UserInfo.PASSWORD).setModified(false); // depends on control dependency: [if], data = [none]
userInfo.setEnableListeners(fileListenerStates); // depends on control dependency: [if], data = [none]
userInfo.setEnableFieldListeners(fieldListenerStates); // depends on control dependency: [if], data = [none]
}
super.doNewRecord(bDisplayOption);
} } |
public class class_name {
private void addProjectMethods(final List<Instruction> instructions, final Set<ProjectMethod> projectMethods) {
Set<MethodIdentifier> projectMethodIdentifiers = findUnhandledProjectMethodIdentifiers(instructions, projectMethods);
for (MethodIdentifier identifier : projectMethodIdentifiers) {
// TODO cache results -> singleton pool?
final MethodResult methodResult = visitProjectMethod(identifier);
if (methodResult == null) {
continue;
}
final List<Instruction> nestedMethodInstructions = interpretRelevantInstructions(methodResult.getInstructions());
projectMethods.add(new ProjectMethod(identifier, nestedMethodInstructions));
addProjectMethods(nestedMethodInstructions, projectMethods);
}
} } | public class class_name {
private void addProjectMethods(final List<Instruction> instructions, final Set<ProjectMethod> projectMethods) {
Set<MethodIdentifier> projectMethodIdentifiers = findUnhandledProjectMethodIdentifiers(instructions, projectMethods);
for (MethodIdentifier identifier : projectMethodIdentifiers) {
// TODO cache results -> singleton pool?
final MethodResult methodResult = visitProjectMethod(identifier);
if (methodResult == null) {
continue;
}
final List<Instruction> nestedMethodInstructions = interpretRelevantInstructions(methodResult.getInstructions());
projectMethods.add(new ProjectMethod(identifier, nestedMethodInstructions)); // depends on control dependency: [for], data = [identifier]
addProjectMethods(nestedMethodInstructions, projectMethods); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public void marshall(DeleteEventSourceMappingRequest deleteEventSourceMappingRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteEventSourceMappingRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteEventSourceMappingRequest.getUUID(), UUID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteEventSourceMappingRequest deleteEventSourceMappingRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteEventSourceMappingRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteEventSourceMappingRequest.getUUID(), UUID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected Mat centerCropIfNeeded(Mat img) {
int x = 0;
int y = 0;
int height = img.rows();
int width = img.cols();
int diff = Math.abs(width - height) / 2;
if (width > height) {
x = diff;
width = width - diff;
} else if (height > width) {
y = diff;
height = height - diff;
}
return img.apply(new Rect(x, y, width, height));
} } | public class class_name {
protected Mat centerCropIfNeeded(Mat img) {
int x = 0;
int y = 0;
int height = img.rows();
int width = img.cols();
int diff = Math.abs(width - height) / 2;
if (width > height) {
x = diff; // depends on control dependency: [if], data = [none]
width = width - diff; // depends on control dependency: [if], data = [none]
} else if (height > width) {
y = diff; // depends on control dependency: [if], data = [none]
height = height - diff; // depends on control dependency: [if], data = [none]
}
return img.apply(new Rect(x, y, width, height));
} } |
public class class_name {
public static <T> T getDefaultWrapperValue(Class<T> clazz) {
if (clazz == Short.class) {
return (T) Short.valueOf((short) 0);
} else if (clazz == Integer.class) {
return (T) Integer.valueOf(0);
} else if (clazz == Long.class) {
return (T) Long.valueOf(0L);
} else if (clazz == Double.class) {
return (T) Double.valueOf(0d);
} else if (clazz == Float.class) {
return (T) Float.valueOf(0f);
} else if (clazz == Byte.class) {
return (T) Byte.valueOf((byte) 0);
} else if (clazz == Character.class) {
return (T) Character.valueOf((char) 0);
} else if (clazz == Boolean.class) {
return (T) Boolean.FALSE;
}
return null;
} } | public class class_name {
public static <T> T getDefaultWrapperValue(Class<T> clazz) {
if (clazz == Short.class) {
return (T) Short.valueOf((short) 0); // depends on control dependency: [if], data = [none]
} else if (clazz == Integer.class) {
return (T) Integer.valueOf(0); // depends on control dependency: [if], data = [none]
} else if (clazz == Long.class) {
return (T) Long.valueOf(0L); // depends on control dependency: [if], data = [none]
} else if (clazz == Double.class) {
return (T) Double.valueOf(0d); // depends on control dependency: [if], data = [none]
} else if (clazz == Float.class) {
return (T) Float.valueOf(0f); // depends on control dependency: [if], data = [none]
} else if (clazz == Byte.class) {
return (T) Byte.valueOf((byte) 0); // depends on control dependency: [if], data = [none]
} else if (clazz == Character.class) {
return (T) Character.valueOf((char) 0); // depends on control dependency: [if], data = [none]
} else if (clazz == Boolean.class) {
return (T) Boolean.FALSE; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public ByteArrayQueue remove(int len) {
offset += len;
length -= len;
// Release buffer if empty
if (length == 0 && array.length > 1024) {
array = new byte[32];
offset = 0;
shared = false;
}
return this;
} } | public class class_name {
public ByteArrayQueue remove(int len) {
offset += len;
length -= len;
// Release buffer if empty
if (length == 0 && array.length > 1024) {
array = new byte[32];
// depends on control dependency: [if], data = [none]
offset = 0;
// depends on control dependency: [if], data = [none]
shared = false;
// depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
boolean deleteFromBucket(long i1, long tag) {
for (int i = 0; i < CuckooFilter.BUCKET_SIZE; i++) {
if (checkTag(i1, i, tag)) {
deleteTag(i1, i);
return true;
}
}
return false;
} } | public class class_name {
boolean deleteFromBucket(long i1, long tag) {
for (int i = 0; i < CuckooFilter.BUCKET_SIZE; i++) {
if (checkTag(i1, i, tag)) {
deleteTag(i1, i);
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static float[] unbox(final Float[] a, final float valueForNull) {
if (a == null) {
return null;
}
return unbox(a, 0, a.length, valueForNull);
} } | public class class_name {
public static float[] unbox(final Float[] a, final float valueForNull) {
if (a == null) {
return null;
// depends on control dependency: [if], data = [none]
}
return unbox(a, 0, a.length, valueForNull);
} } |
public class class_name {
public static long parseLong(Object val)
{
if (val instanceof String) {
return Long.parseLong((String) val);
} else if (val instanceof Number) {
return ((Number) val).longValue();
} else {
if (val == null) {
throw new NullPointerException("Input is null");
} else {
throw new ISE("Unknown type [%s]", val.getClass());
}
}
} } | public class class_name {
public static long parseLong(Object val)
{
if (val instanceof String) {
return Long.parseLong((String) val); // depends on control dependency: [if], data = [none]
} else if (val instanceof Number) {
return ((Number) val).longValue(); // depends on control dependency: [if], data = [none]
} else {
if (val == null) {
throw new NullPointerException("Input is null");
} else {
throw new ISE("Unknown type [%s]", val.getClass());
}
}
} } |
public class class_name {
public void marshall(DeleteAuthorizerRequest deleteAuthorizerRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteAuthorizerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteAuthorizerRequest.getAuthorizerName(), AUTHORIZERNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteAuthorizerRequest deleteAuthorizerRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteAuthorizerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteAuthorizerRequest.getAuthorizerName(), AUTHORIZERNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public Iterable<PassPoint> getNextPassPoints(PassPoint lastPoint) {
ArrayList<PassPoint> results = new ArrayList<PassPoint>();
for (Direction4 direction : Direction4.values()) {
results.add(new PassPoint(lastPoint, direction, 1));
}
return results;
} } | public class class_name {
@Override
public Iterable<PassPoint> getNextPassPoints(PassPoint lastPoint) {
ArrayList<PassPoint> results = new ArrayList<PassPoint>();
for (Direction4 direction : Direction4.values()) {
results.add(new PassPoint(lastPoint, direction, 1)); // depends on control dependency: [for], data = [direction]
}
return results;
} } |
public class class_name {
@Override
public IFeatureLinkingCandidate getLinkingCandidate(/* @Nullable */ XAbstractFeatureCall featureCall) {
if (!shared.allLinking.contains(featureCall)) {
return null;
}
return (IFeatureLinkingCandidate) doGetCandidate(featureCall);
} } | public class class_name {
@Override
public IFeatureLinkingCandidate getLinkingCandidate(/* @Nullable */ XAbstractFeatureCall featureCall) {
if (!shared.allLinking.contains(featureCall)) {
return null; // depends on control dependency: [if], data = [none]
}
return (IFeatureLinkingCandidate) doGetCandidate(featureCall);
} } |
public class class_name {
public BsonDecimal128 getDecimal128(final Object key, final BsonDecimal128 defaultValue) {
if (!containsKey(key)) {
return defaultValue;
}
return get(key).asDecimal128();
} } | public class class_name {
public BsonDecimal128 getDecimal128(final Object key, final BsonDecimal128 defaultValue) {
if (!containsKey(key)) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
return get(key).asDecimal128();
} } |
public class class_name {
public void setRow(int row, DoubleVector colValues) {
checkIndices(row, colValues.length(), true);
int c = cols.get();
lockRow(row, c);
boolean modified = false;
for (int col = 0; col < c; ++col) {
double val = colValues.get(col);
Entry e = new Entry(row, col);
boolean present = matrixEntries.containsKey(e);
if (val != 0) {
matrixEntries.put(e, val);
// Only invalidate the cache if the number of rows or columns
// containing data has changed
modified = modified || !present;
}
else if (present) {
matrixEntries.remove(e);
modified = true;
}
}
if (modified)
modifications.incrementAndGet();
unlockRow(row, c);
} } | public class class_name {
public void setRow(int row, DoubleVector colValues) {
checkIndices(row, colValues.length(), true);
int c = cols.get();
lockRow(row, c);
boolean modified = false;
for (int col = 0; col < c; ++col) {
double val = colValues.get(col);
Entry e = new Entry(row, col);
boolean present = matrixEntries.containsKey(e);
if (val != 0) {
matrixEntries.put(e, val); // depends on control dependency: [if], data = [none]
// Only invalidate the cache if the number of rows or columns
// containing data has changed
modified = modified || !present; // depends on control dependency: [if], data = [none]
}
else if (present) {
matrixEntries.remove(e); // depends on control dependency: [if], data = [none]
modified = true; // depends on control dependency: [if], data = [none]
}
}
if (modified)
modifications.incrementAndGet();
unlockRow(row, c);
} } |
public class class_name {
protected List<WorkUnit> worstFitDecreasingBinPacking(List<WorkUnit> groups, int numOfMultiWorkUnits) {
// Sort workunit groups by data size desc
Collections.sort(groups, LOAD_DESC_COMPARATOR);
MinMaxPriorityQueue<MultiWorkUnit> pQueue =
MinMaxPriorityQueue.orderedBy(LOAD_ASC_COMPARATOR).expectedSize(numOfMultiWorkUnits).create();
for (int i = 0; i < numOfMultiWorkUnits; i++) {
MultiWorkUnit multiWorkUnit = MultiWorkUnit.createEmpty();
setWorkUnitEstSize(multiWorkUnit, 0);
pQueue.add(multiWorkUnit);
}
for (WorkUnit group : groups) {
MultiWorkUnit lightestMultiWorkUnit = pQueue.poll();
addWorkUnitToMultiWorkUnit(group, lightestMultiWorkUnit);
pQueue.add(lightestMultiWorkUnit);
}
LinkedList<MultiWorkUnit> pQueue_filtered = new LinkedList();
while(!pQueue.isEmpty())
{
MultiWorkUnit multiWorkUnit = pQueue.poll();
if(multiWorkUnit.getWorkUnits().size() != 0)
{
pQueue_filtered.offer(multiWorkUnit);
}
}
logMultiWorkUnitInfo(pQueue_filtered);
double minLoad = getWorkUnitEstLoad(pQueue_filtered.peekFirst());
double maxLoad = getWorkUnitEstLoad(pQueue_filtered.peekLast());
LOG.info(String.format("Min load of multiWorkUnit = %f; Max load of multiWorkUnit = %f; Diff = %f%%", minLoad,
maxLoad, (maxLoad - minLoad) / maxLoad * 100.0));
this.state.setProp(MIN_MULTIWORKUNIT_LOAD, minLoad);
this.state.setProp(MAX_MULTIWORKUNIT_LOAD, maxLoad);
List<WorkUnit> multiWorkUnits = Lists.newArrayList();
multiWorkUnits.addAll(pQueue_filtered);
return multiWorkUnits;
} } | public class class_name {
protected List<WorkUnit> worstFitDecreasingBinPacking(List<WorkUnit> groups, int numOfMultiWorkUnits) {
// Sort workunit groups by data size desc
Collections.sort(groups, LOAD_DESC_COMPARATOR);
MinMaxPriorityQueue<MultiWorkUnit> pQueue =
MinMaxPriorityQueue.orderedBy(LOAD_ASC_COMPARATOR).expectedSize(numOfMultiWorkUnits).create();
for (int i = 0; i < numOfMultiWorkUnits; i++) {
MultiWorkUnit multiWorkUnit = MultiWorkUnit.createEmpty();
setWorkUnitEstSize(multiWorkUnit, 0); // depends on control dependency: [for], data = [none]
pQueue.add(multiWorkUnit); // depends on control dependency: [for], data = [none]
}
for (WorkUnit group : groups) {
MultiWorkUnit lightestMultiWorkUnit = pQueue.poll();
addWorkUnitToMultiWorkUnit(group, lightestMultiWorkUnit); // depends on control dependency: [for], data = [group]
pQueue.add(lightestMultiWorkUnit); // depends on control dependency: [for], data = [none]
}
LinkedList<MultiWorkUnit> pQueue_filtered = new LinkedList();
while(!pQueue.isEmpty())
{
MultiWorkUnit multiWorkUnit = pQueue.poll();
if(multiWorkUnit.getWorkUnits().size() != 0)
{
pQueue_filtered.offer(multiWorkUnit); // depends on control dependency: [if], data = [none]
}
}
logMultiWorkUnitInfo(pQueue_filtered);
double minLoad = getWorkUnitEstLoad(pQueue_filtered.peekFirst());
double maxLoad = getWorkUnitEstLoad(pQueue_filtered.peekLast());
LOG.info(String.format("Min load of multiWorkUnit = %f; Max load of multiWorkUnit = %f; Diff = %f%%", minLoad,
maxLoad, (maxLoad - minLoad) / maxLoad * 100.0));
this.state.setProp(MIN_MULTIWORKUNIT_LOAD, minLoad);
this.state.setProp(MAX_MULTIWORKUNIT_LOAD, maxLoad);
List<WorkUnit> multiWorkUnits = Lists.newArrayList();
multiWorkUnits.addAll(pQueue_filtered);
return multiWorkUnits;
} } |
public class class_name {
@Override
public void removedBundle(Bundle bundle, BundleEvent event, List<I18nExtension> list) {
String current = Long.toString(System.currentTimeMillis());
for (I18nExtension extension : list) {
synchronized (this) {
extensions.remove(extension);
etags.put(extension.locale(), current);
}
}
LOGGER.info("Bundle {} ({}) does not offer the {} resource bundle(s) anymore",
bundle.getSymbolicName(), bundle.getBundleId(), list.size());
} } | public class class_name {
@Override
public void removedBundle(Bundle bundle, BundleEvent event, List<I18nExtension> list) {
String current = Long.toString(System.currentTimeMillis());
for (I18nExtension extension : list) {
synchronized (this) { // depends on control dependency: [for], data = [none]
extensions.remove(extension);
etags.put(extension.locale(), current);
}
}
LOGGER.info("Bundle {} ({}) does not offer the {} resource bundle(s) anymore",
bundle.getSymbolicName(), bundle.getBundleId(), list.size());
} } |
public class class_name {
@NonNull
private OnPreferenceClickListener createOnPreferenceClickListenerWrapper(
@Nullable final OnPreferenceClickListener listener) {
return new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
notifyOnShowFragment();
if (listener != null) {
listener.onPreferenceClick(preference);
}
return true;
}
};
} } | public class class_name {
@NonNull
private OnPreferenceClickListener createOnPreferenceClickListenerWrapper(
@Nullable final OnPreferenceClickListener listener) {
return new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
notifyOnShowFragment();
if (listener != null) {
listener.onPreferenceClick(preference); // depends on control dependency: [if], data = [none]
}
return true;
}
};
} } |
public class class_name {
private void verifyTableExists(BaseDaoImpl<?, ?> dao) {
try {
if (!dao.isTableExists()) {
throw new GeoPackageException(
"Table or view does not exist for: "
+ dao.getDataClass().getSimpleName());
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to detect if table or view exists for dao: "
+ dao.getDataClass().getSimpleName(), e);
}
} } | public class class_name {
private void verifyTableExists(BaseDaoImpl<?, ?> dao) {
try {
if (!dao.isTableExists()) {
throw new GeoPackageException(
"Table or view does not exist for: "
+ dao.getDataClass().getSimpleName());
}
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to detect if table or view exists for dao: "
+ dao.getDataClass().getSimpleName(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void analyzeSelectStmt()
throws EFapsException
{
final Pattern mainPattern = Pattern.compile("[^.]+");
final Pattern attrPattern = Pattern.compile("(?<=\\[)[0-9a-zA-Z_]*(?=\\])");
final Pattern esjpPattern = Pattern.compile("(?<=\\[)[\\w\\d\\s,.\"]*(?=\\])");
final Pattern linkfomPat = Pattern.compile("(?<=\\[)[0-9a-zA-Z_#:]*(?=\\])");
final Pattern formatPat = Pattern.compile("(?<=\\[).*(?=\\])");
final Pattern attrSetPattern = Pattern.compile("(?<=\\[)[0-9a-zA-Z_]+");
final Pattern attrSetWherePattern = Pattern.compile("(?<=\\|).+(?=\\])");
final Matcher mainMatcher = mainPattern.matcher(this.selectStmt);
OneSelect currentSelect = this;
while (mainMatcher.find()) {
final String part = mainMatcher.group();
if (part.startsWith("class[")) {
final Matcher matcher = attrPattern.matcher(part);
if (matcher.find()) {
currentSelect.addClassificationSelectPart(matcher.group());
}
} else if (part.startsWith("linkto")) {
final Matcher matcher = attrPattern.matcher(part);
if (matcher.find()) {
currentSelect.addLinkToSelectPart(matcher.group());
}
} else if (part.startsWith("attributeset")) {
final Matcher matcher = attrSetPattern.matcher(part);
if (matcher.find()) {
currentSelect.addValueSelect(new IDValueSelect(currentSelect));
final Matcher whereMatcher = attrSetWherePattern.matcher(part);
if (whereMatcher.find()) {
currentSelect.addAttributeSetSelectPart(matcher.group(), whereMatcher.group());
} else {
currentSelect.addAttributeSetSelectPart(matcher.group());
}
currentSelect = currentSelect.fromSelect.getMainOneSelect();
}
} else if (part.startsWith("attribute")) {
final Matcher matcher = attrPattern.matcher(part);
if (matcher.find()) {
currentSelect.addValueSelect(new AttributeValueSelect(currentSelect, matcher.group()));
}
} else if (part.startsWith("linkfrom")) {
final Matcher matcher = linkfomPat.matcher(part);
if (matcher.find()) {
currentSelect.addValueSelect(new IDValueSelect(currentSelect));
currentSelect.addLinkFromSelectPart(matcher.group());
currentSelect = currentSelect.fromSelect.getMainOneSelect();
}
} else if (part.startsWith("format")) {
final Matcher matcher = formatPat.matcher(part);
if (matcher.find()) {
currentSelect.addValueSelect(new FormatValueSelect(currentSelect, matcher.group()));
}
} else if (part.startsWith("esjp[")) {
final String esjpPart = this.selectStmt.substring(this.selectStmt.indexOf("esjp["));
final Matcher matcher = esjpPattern.matcher(esjpPart);
if (matcher.find()) {
currentSelect.addValueSelect(new EsjpValueSelect(currentSelect, matcher.group()));
}
} else {
switch (part) {
case "oid":
currentSelect.addValueSelect(new OIDValueSelect(currentSelect));
break;
case "type":
currentSelect.addValueSelect(new TypeValueSelect(currentSelect));
break;
case "instance":
currentSelect.addValueSelect(new InstanceValueSelect(currentSelect));
break;
case "label":
currentSelect.addValueSelect(new LabelValueSelect(currentSelect));
break;
case "id":
currentSelect.addValueSelect(new IDValueSelect(currentSelect));
break;
case "uuid":
currentSelect.addValueSelect(new UUIDValueSelect(currentSelect));
break;
case "name":
currentSelect.addValueSelect(new NameValueSelect(currentSelect));
break;
case "class":
currentSelect.addValueSelect(new ClassificationValueSelect(currentSelect));
break;
case "value":
currentSelect.addValueSelect(new ValueValueSelect(currentSelect));
break;
case "base":
currentSelect.addValueSelect(new BaseValueSelect(currentSelect));
break;
case "uom":
currentSelect.addValueSelect(new UoMValueSelect(currentSelect));
break;
case "file":
currentSelect.addFileSelectPart();
break;
case "length":
currentSelect.addValueSelect(new LengthValueSelect(currentSelect));
break;
case "status":
currentSelect.addValueSelect(new StatusValueSelect(currentSelect));
break;
case "key":
currentSelect.addValueSelect(new KeyValueSelect(currentSelect));
break;
default:
break;
}
}
}
} } | public class class_name {
public void analyzeSelectStmt()
throws EFapsException
{
final Pattern mainPattern = Pattern.compile("[^.]+");
final Pattern attrPattern = Pattern.compile("(?<=\\[)[0-9a-zA-Z_]*(?=\\])");
final Pattern esjpPattern = Pattern.compile("(?<=\\[)[\\w\\d\\s,.\"]*(?=\\])");
final Pattern linkfomPat = Pattern.compile("(?<=\\[)[0-9a-zA-Z_#:]*(?=\\])");
final Pattern formatPat = Pattern.compile("(?<=\\[).*(?=\\])");
final Pattern attrSetPattern = Pattern.compile("(?<=\\[)[0-9a-zA-Z_]+");
final Pattern attrSetWherePattern = Pattern.compile("(?<=\\|).+(?=\\])");
final Matcher mainMatcher = mainPattern.matcher(this.selectStmt);
OneSelect currentSelect = this;
while (mainMatcher.find()) {
final String part = mainMatcher.group();
if (part.startsWith("class[")) {
final Matcher matcher = attrPattern.matcher(part);
if (matcher.find()) {
currentSelect.addClassificationSelectPart(matcher.group()); // depends on control dependency: [if], data = [none]
}
} else if (part.startsWith("linkto")) {
final Matcher matcher = attrPattern.matcher(part);
if (matcher.find()) {
currentSelect.addLinkToSelectPart(matcher.group()); // depends on control dependency: [if], data = [none]
}
} else if (part.startsWith("attributeset")) {
final Matcher matcher = attrSetPattern.matcher(part);
if (matcher.find()) {
currentSelect.addValueSelect(new IDValueSelect(currentSelect)); // depends on control dependency: [if], data = [none]
final Matcher whereMatcher = attrSetWherePattern.matcher(part);
if (whereMatcher.find()) {
currentSelect.addAttributeSetSelectPart(matcher.group(), whereMatcher.group()); // depends on control dependency: [if], data = [none]
} else {
currentSelect.addAttributeSetSelectPart(matcher.group()); // depends on control dependency: [if], data = [none]
}
currentSelect = currentSelect.fromSelect.getMainOneSelect(); // depends on control dependency: [if], data = [none]
}
} else if (part.startsWith("attribute")) {
final Matcher matcher = attrPattern.matcher(part);
if (matcher.find()) {
currentSelect.addValueSelect(new AttributeValueSelect(currentSelect, matcher.group())); // depends on control dependency: [if], data = [none]
}
} else if (part.startsWith("linkfrom")) {
final Matcher matcher = linkfomPat.matcher(part);
if (matcher.find()) {
currentSelect.addValueSelect(new IDValueSelect(currentSelect)); // depends on control dependency: [if], data = [none]
currentSelect.addLinkFromSelectPart(matcher.group()); // depends on control dependency: [if], data = [none]
currentSelect = currentSelect.fromSelect.getMainOneSelect(); // depends on control dependency: [if], data = [none]
}
} else if (part.startsWith("format")) {
final Matcher matcher = formatPat.matcher(part);
if (matcher.find()) {
currentSelect.addValueSelect(new FormatValueSelect(currentSelect, matcher.group()));
}
} else if (part.startsWith("esjp[")) {
final String esjpPart = this.selectStmt.substring(this.selectStmt.indexOf("esjp["));
final Matcher matcher = esjpPattern.matcher(esjpPart);
if (matcher.find()) {
currentSelect.addValueSelect(new EsjpValueSelect(currentSelect, matcher.group())); // depends on control dependency: [if], data = [none]
}
} else {
switch (part) {
case "oid":
currentSelect.addValueSelect(new OIDValueSelect(currentSelect));
break;
case "type":
currentSelect.addValueSelect(new TypeValueSelect(currentSelect));
break;
case "instance":
currentSelect.addValueSelect(new InstanceValueSelect(currentSelect));
break;
case "label":
currentSelect.addValueSelect(new LabelValueSelect(currentSelect));
break;
case "id":
currentSelect.addValueSelect(new IDValueSelect(currentSelect));
break;
case "uuid":
currentSelect.addValueSelect(new UUIDValueSelect(currentSelect));
break;
case "name":
currentSelect.addValueSelect(new NameValueSelect(currentSelect));
break;
case "class":
currentSelect.addValueSelect(new ClassificationValueSelect(currentSelect));
break;
case "value":
currentSelect.addValueSelect(new ValueValueSelect(currentSelect));
break;
case "base":
currentSelect.addValueSelect(new BaseValueSelect(currentSelect));
break;
case "uom":
currentSelect.addValueSelect(new UoMValueSelect(currentSelect));
break;
case "file":
currentSelect.addFileSelectPart();
break;
case "length":
currentSelect.addValueSelect(new LengthValueSelect(currentSelect));
break;
case "status":
currentSelect.addValueSelect(new StatusValueSelect(currentSelect));
break;
case "key":
currentSelect.addValueSelect(new KeyValueSelect(currentSelect));
break;
default:
break;
}
}
}
} } |
public class class_name {
private void addEvents() {
if (clusterEvents != null && clusterEvents.size() > eventCounter) {
ClusterEvent ev = clusterEvents.get(eventCounter);
eventCounter++;
JLabel eventMarker = new JLabel(ev.getType().substring(0, 1));
eventMarker.setPreferredSize(new Dimension(20, y_offset_top));
eventMarker.setSize(new Dimension(20, y_offset_top));
eventMarker.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
int x = (int) (ev.getTimestamp() / processFrequency / x_resolution);
eventMarker.setLocation(x - 10, 0);
eventMarker.setToolTipText(ev.getType() + " at " + ev.getTimestamp() + ": " + ev.getMessage());
eventPanel.add(eventMarker);
eventLabelList.add(eventMarker);
eventPanel.repaint();
}
} } | public class class_name {
private void addEvents() {
if (clusterEvents != null && clusterEvents.size() > eventCounter) {
ClusterEvent ev = clusterEvents.get(eventCounter);
eventCounter++; // depends on control dependency: [if], data = [none]
JLabel eventMarker = new JLabel(ev.getType().substring(0, 1));
eventMarker.setPreferredSize(new Dimension(20, y_offset_top)); // depends on control dependency: [if], data = [none]
eventMarker.setSize(new Dimension(20, y_offset_top)); // depends on control dependency: [if], data = [none]
eventMarker.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); // depends on control dependency: [if], data = [none]
int x = (int) (ev.getTimestamp() / processFrequency / x_resolution);
eventMarker.setLocation(x - 10, 0); // depends on control dependency: [if], data = [none]
eventMarker.setToolTipText(ev.getType() + " at " + ev.getTimestamp() + ": " + ev.getMessage()); // depends on control dependency: [if], data = [none]
eventPanel.add(eventMarker); // depends on control dependency: [if], data = [none]
eventLabelList.add(eventMarker); // depends on control dependency: [if], data = [none]
eventPanel.repaint(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int getSubscribersCount(EventPublisher source) {
GenericEventDispatcher<?> dispatcherObject = dispatchers.get(source);
if (dispatcherObject == null) {
return 0;
} else {
return dispatcherObject.getListenersCount();
}
} } | public class class_name {
public int getSubscribersCount(EventPublisher source) {
GenericEventDispatcher<?> dispatcherObject = dispatchers.get(source);
if (dispatcherObject == null) {
return 0; // depends on control dependency: [if], data = [none]
} else {
return dispatcherObject.getListenersCount(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void clear(CmsObject cms, String siteRoot) {
CmsUser originalUser = m_map.getIfPresent(siteRoot);
if ((originalUser == null) || !originalUser.equals(cms.getRequestContext().getCurrentUser())) {
return;
}
m_map.invalidate(siteRoot);
} } | public class class_name {
public void clear(CmsObject cms, String siteRoot) {
CmsUser originalUser = m_map.getIfPresent(siteRoot);
if ((originalUser == null) || !originalUser.equals(cms.getRequestContext().getCurrentUser())) {
return;
// depends on control dependency: [if], data = [none]
}
m_map.invalidate(siteRoot);
} } |
public class class_name {
@Override
protected boolean computeStep() {
// If first iteration and automatic
if( regionRadius == -1 ) {
// user has selected unconstrained method for initial step size
parameterUpdate.computeUpdate(p, Double.MAX_VALUE);
regionRadius = parameterUpdate.getStepLength();
if( regionRadius == Double.MAX_VALUE || UtilEjml.isUncountable(regionRadius)) {
if( verbose != null )
verbose.println("unconstrained initialization failed. Using Cauchy initialization instead.");
regionRadius = -2;
} else {
if( verbose != null )
verbose.println("unconstrained initialization radius="+regionRadius);
}
}
if( regionRadius == -2 ) {
// User has selected Cauchy method for initial step size
regionRadius = solveCauchyStepLength()*10;
parameterUpdate.computeUpdate(p, regionRadius);
if( verbose != null )
verbose.println("cauchy initialization radius="+regionRadius);
} else {
parameterUpdate.computeUpdate(p, regionRadius);
}
if( config.hessianScaling )
undoHessianScalingOnParameters(p);
CommonOps_DDRM.add(x,p,x_next);
double fx_candidate = cost(x_next);
if( UtilEjml.isUncountable(fx_candidate)) {
throw new OptimizationException("Uncountable candidate cost. "+fx_candidate);
}
// this notes that the cost was computed at x_next for the Hessian calculation.
// This is a relic from a variant on this implementation where another candidate might be considered. I'm
// leaving this code where since it might be useful in the future and doesn't add much complexity
sameStateAsCost = true;
// NOTE: step length was computed using the weighted/scaled version of 'p', which is correct
return considerCandidate(fx_candidate,fx,
parameterUpdate.getPredictedReduction(),
parameterUpdate.getStepLength());
} } | public class class_name {
@Override
protected boolean computeStep() {
// If first iteration and automatic
if( regionRadius == -1 ) {
// user has selected unconstrained method for initial step size
parameterUpdate.computeUpdate(p, Double.MAX_VALUE); // depends on control dependency: [if], data = [none]
regionRadius = parameterUpdate.getStepLength(); // depends on control dependency: [if], data = [none]
if( regionRadius == Double.MAX_VALUE || UtilEjml.isUncountable(regionRadius)) {
if( verbose != null )
verbose.println("unconstrained initialization failed. Using Cauchy initialization instead.");
regionRadius = -2; // depends on control dependency: [if], data = [none]
} else {
if( verbose != null )
verbose.println("unconstrained initialization radius="+regionRadius);
}
}
if( regionRadius == -2 ) {
// User has selected Cauchy method for initial step size
regionRadius = solveCauchyStepLength()*10; // depends on control dependency: [if], data = [none]
parameterUpdate.computeUpdate(p, regionRadius); // depends on control dependency: [if], data = [none]
if( verbose != null )
verbose.println("cauchy initialization radius="+regionRadius);
} else {
parameterUpdate.computeUpdate(p, regionRadius); // depends on control dependency: [if], data = [none]
}
if( config.hessianScaling )
undoHessianScalingOnParameters(p);
CommonOps_DDRM.add(x,p,x_next);
double fx_candidate = cost(x_next);
if( UtilEjml.isUncountable(fx_candidate)) {
throw new OptimizationException("Uncountable candidate cost. "+fx_candidate);
}
// this notes that the cost was computed at x_next for the Hessian calculation.
// This is a relic from a variant on this implementation where another candidate might be considered. I'm
// leaving this code where since it might be useful in the future and doesn't add much complexity
sameStateAsCost = true;
// NOTE: step length was computed using the weighted/scaled version of 'p', which is correct
return considerCandidate(fx_candidate,fx,
parameterUpdate.getPredictedReduction(),
parameterUpdate.getStepLength());
} } |
public class class_name {
public synchronized void remove(Entry entry)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "remove", new Object[] { entry });
super.remove(entry);
DestinationHandler dh = (DestinationHandler) entry.data;
HashMap<String, Entry> busMap = getBusMap(dh.getBus());
DestinationEntry destEntry = (DestinationEntry) busMap.get(dh.getName());
if(destEntry == entry)
{
busMap.remove(dh.getName());
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "remove");
} } | public class class_name {
public synchronized void remove(Entry entry)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "remove", new Object[] { entry });
super.remove(entry);
DestinationHandler dh = (DestinationHandler) entry.data;
HashMap<String, Entry> busMap = getBusMap(dh.getBus());
DestinationEntry destEntry = (DestinationEntry) busMap.get(dh.getName());
if(destEntry == entry)
{
busMap.remove(dh.getName()); // depends on control dependency: [if], data = [none]
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "remove");
} } |
public class class_name {
public int claim(
final HeaderWriter header,
final int length,
final BufferClaim bufferClaim,
final int activeTermId)
{
final int frameLength = length + HEADER_LENGTH;
final int alignedLength = align(frameLength, FRAME_ALIGNMENT);
final UnsafeBuffer termBuffer = this.termBuffer;
final int termLength = termBuffer.capacity();
final long rawTail = getAndAddRawTail(alignedLength);
final int termId = termId(rawTail);
final long termOffset = rawTail & 0xFFFF_FFFFL;
checkTerm(activeTermId, termId);
long resultingOffset = termOffset + alignedLength;
if (resultingOffset > termLength)
{
resultingOffset = handleEndOfLogCondition(termBuffer, termOffset, header, termLength, termId);
}
else
{
final int frameOffset = (int)termOffset;
header.write(termBuffer, frameOffset, frameLength, termId);
bufferClaim.wrap(termBuffer, frameOffset, frameLength);
}
return (int)resultingOffset;
} } | public class class_name {
public int claim(
final HeaderWriter header,
final int length,
final BufferClaim bufferClaim,
final int activeTermId)
{
final int frameLength = length + HEADER_LENGTH;
final int alignedLength = align(frameLength, FRAME_ALIGNMENT);
final UnsafeBuffer termBuffer = this.termBuffer;
final int termLength = termBuffer.capacity();
final long rawTail = getAndAddRawTail(alignedLength);
final int termId = termId(rawTail);
final long termOffset = rawTail & 0xFFFF_FFFFL;
checkTerm(activeTermId, termId);
long resultingOffset = termOffset + alignedLength;
if (resultingOffset > termLength)
{
resultingOffset = handleEndOfLogCondition(termBuffer, termOffset, header, termLength, termId); // depends on control dependency: [if], data = [none]
}
else
{
final int frameOffset = (int)termOffset;
header.write(termBuffer, frameOffset, frameLength, termId); // depends on control dependency: [if], data = [none]
bufferClaim.wrap(termBuffer, frameOffset, frameLength); // depends on control dependency: [if], data = [none]
}
return (int)resultingOffset;
} } |
public class class_name {
protected void writeLine(final String line) {
getContainer().getShell().getDisplay().syncExec(
new Runnable() {
public void run() {
if (statusTextArea != null) {
statusTextArea.setText(line + '\n' + statusTextArea.getText());
}
}
}
);
} } | public class class_name {
protected void writeLine(final String line) {
getContainer().getShell().getDisplay().syncExec(
new Runnable() {
public void run() {
if (statusTextArea != null) {
statusTextArea.setText(line + '\n' + statusTextArea.getText()); // depends on control dependency: [if], data = [none]
}
}
}
);
} } |
public class class_name {
private void convertLink2Record(final Object iKey) {
if (status == MULTIVALUE_CONTENT_TYPE.ALL_RECORDS)
return;
final Object value;
if (iKey instanceof ORID)
value = iKey;
else
value = super.get(iKey);
if (value != null && value instanceof ORID) {
final ORID rid = (ORID) value;
marshalling = true;
try {
try {
// OVERWRITE IT
ORecord record = rid.getRecord();
if(record != null){
ORecordInternal.unTrack(sourceRecord, rid);
ORecordInternal.track(sourceRecord, record);
}
super.put(iKey, record);
} catch (ORecordNotFoundException ignore) {
// IGNORE THIS
}
} finally {
marshalling = false;
}
}
} } | public class class_name {
private void convertLink2Record(final Object iKey) {
if (status == MULTIVALUE_CONTENT_TYPE.ALL_RECORDS)
return;
final Object value;
if (iKey instanceof ORID)
value = iKey;
else
value = super.get(iKey);
if (value != null && value instanceof ORID) {
final ORID rid = (ORID) value;
marshalling = true;
// depends on control dependency: [if], data = [none]
try {
try {
// OVERWRITE IT
ORecord record = rid.getRecord();
if(record != null){
ORecordInternal.unTrack(sourceRecord, rid);
// depends on control dependency: [if], data = [none]
ORecordInternal.track(sourceRecord, record);
// depends on control dependency: [if], data = [none]
}
super.put(iKey, record);
// depends on control dependency: [try], data = [none]
} catch (ORecordNotFoundException ignore) {
// IGNORE THIS
}
// depends on control dependency: [catch], data = [none]
} finally {
marshalling = false;
}
}
} } |
public class class_name {
public void updateIndex(Set<String> addedNodes, Set<String> removedNodes, Set<String> parentAddedNodes,
Set<String> parentRemovedNodes)
{
// pass lists to search manager
if (searchManager != null && (addedNodes.size() > 0 || removedNodes.size() > 0))
{
try
{
searchManager.updateIndex(removedNodes, addedNodes);
}
catch (RepositoryException e)
{
log.error("Error indexing changes " + e, e);
}
catch (IOException e)
{
log.error("Error indexing changes " + e, e);
try
{
handler.logErrorChanges(removedNodes, addedNodes);
}
catch (IOException ioe)
{
log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
}
}
}
// pass lists to parent search manager
if (parentSearchManager != null && (parentAddedNodes.size() > 0 || parentRemovedNodes.size() > 0))
{
try
{
parentSearchManager.updateIndex(parentRemovedNodes, parentAddedNodes);
}
catch (RepositoryException e)
{
log.error("Error indexing changes " + e, e);
}
catch (IOException e)
{
log.error("Error indexing changes " + e, e);
try
{
parentHandler.logErrorChanges(parentRemovedNodes, parentAddedNodes);
}
catch (IOException ioe)
{
log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
}
}
}
} } | public class class_name {
public void updateIndex(Set<String> addedNodes, Set<String> removedNodes, Set<String> parentAddedNodes,
Set<String> parentRemovedNodes)
{
// pass lists to search manager
if (searchManager != null && (addedNodes.size() > 0 || removedNodes.size() > 0))
{
try
{
searchManager.updateIndex(removedNodes, addedNodes); // depends on control dependency: [try], data = [none]
}
catch (RepositoryException e)
{
log.error("Error indexing changes " + e, e);
} // depends on control dependency: [catch], data = [none]
catch (IOException e)
{
log.error("Error indexing changes " + e, e);
try
{
handler.logErrorChanges(removedNodes, addedNodes); // depends on control dependency: [try], data = [none]
}
catch (IOException ioe)
{
log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
}
// pass lists to parent search manager
if (parentSearchManager != null && (parentAddedNodes.size() > 0 || parentRemovedNodes.size() > 0))
{
try
{
parentSearchManager.updateIndex(parentRemovedNodes, parentAddedNodes); // depends on control dependency: [try], data = [none]
}
catch (RepositoryException e)
{
log.error("Error indexing changes " + e, e);
} // depends on control dependency: [catch], data = [none]
catch (IOException e)
{
log.error("Error indexing changes " + e, e);
try
{
parentHandler.logErrorChanges(parentRemovedNodes, parentAddedNodes); // depends on control dependency: [try], data = [none]
}
catch (IOException ioe)
{
log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected void validateEqualString(String s1, String s2, String errorKey, String errorMessage) {
if (s1 == null || s2 == null || (! s1.equals(s2))) {
addError(errorKey, errorMessage);
}
} } | public class class_name {
protected void validateEqualString(String s1, String s2, String errorKey, String errorMessage) {
if (s1 == null || s2 == null || (! s1.equals(s2))) {
addError(errorKey, errorMessage);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void getCredentials(final String code) {
new AsyncTask<Void, Void, Boolean>() {
@Override
protected Boolean doInBackground(Void... params) {
try {
mBootstrapper.getUserCredentials(code);
return true;
} catch (IOException ex) {
LOGGER.error("Error getting oauth credentials", ex);
setResult(RESULT_CANCELED);
finish();
} catch (CStorageException ex) {
LOGGER.error("Error getting oauth credentials", ex);
setResult(RESULT_CANCELED);
finish();
}
// Failure
return false;
}
@Override
protected void onPostExecute(Boolean result) {
if(result) {
setResult(RESULT_OK);
} else {
setResult(RESULT_CANCELED);
}
finish();
}
}.execute();
} } | public class class_name {
private void getCredentials(final String code) {
new AsyncTask<Void, Void, Boolean>() {
@Override
protected Boolean doInBackground(Void... params) {
try {
mBootstrapper.getUserCredentials(code); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
LOGGER.error("Error getting oauth credentials", ex);
setResult(RESULT_CANCELED);
finish();
} catch (CStorageException ex) { // depends on control dependency: [catch], data = [none]
LOGGER.error("Error getting oauth credentials", ex);
setResult(RESULT_CANCELED);
finish();
} // depends on control dependency: [catch], data = [none]
// Failure
return false;
}
@Override
protected void onPostExecute(Boolean result) {
if(result) {
setResult(RESULT_OK); // depends on control dependency: [if], data = [none]
} else {
setResult(RESULT_CANCELED); // depends on control dependency: [if], data = [none]
}
finish();
}
}.execute();
} } |
public class class_name {
public final void setNavigationWidth(@Px final int width) {
Condition.INSTANCE.ensureGreater(width, 0, "The width must be greater than 0");
this.navigationWidth = width;
if (!isNavigationHidden()) {
RelativeLayout.LayoutParams layoutParams =
(RelativeLayout.LayoutParams) toolbar.getLayoutParams();
layoutParams.width = width;
toolbar.requestLayout();
}
} } | public class class_name {
public final void setNavigationWidth(@Px final int width) {
Condition.INSTANCE.ensureGreater(width, 0, "The width must be greater than 0");
this.navigationWidth = width;
if (!isNavigationHidden()) {
RelativeLayout.LayoutParams layoutParams =
(RelativeLayout.LayoutParams) toolbar.getLayoutParams();
layoutParams.width = width; // depends on control dependency: [if], data = [none]
toolbar.requestLayout(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static ReflectedInfo getFieldInfoByName(List<ReflectedInfo> infoList, String name) {
if (infoList == null) {
throw new IllegalArgumentException("infoList cannot be null.");
}
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name cannot be null or empty.");
}
ReflectedInfo result = null;
for (ReflectedInfo info : infoList) {
if (info.getField() == null) {
continue; //should never happen.
}
if (name.equals(info.getField().getName())) {
result = info;
break;
}
}
return result;
} } | public class class_name {
public static ReflectedInfo getFieldInfoByName(List<ReflectedInfo> infoList, String name) {
if (infoList == null) {
throw new IllegalArgumentException("infoList cannot be null.");
}
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("name cannot be null or empty.");
}
ReflectedInfo result = null;
for (ReflectedInfo info : infoList) {
if (info.getField() == null) {
continue; //should never happen.
}
if (name.equals(info.getField().getName())) {
result = info;
// depends on control dependency: [if], data = [none]
break;
}
}
return result;
} } |
public class class_name {
public void setStackStatusFilters(java.util.Collection<String> stackStatusFilters) {
if (stackStatusFilters == null) {
this.stackStatusFilters = null;
return;
}
this.stackStatusFilters = new com.amazonaws.internal.SdkInternalList<String>(stackStatusFilters);
} } | public class class_name {
public void setStackStatusFilters(java.util.Collection<String> stackStatusFilters) {
if (stackStatusFilters == null) {
this.stackStatusFilters = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.stackStatusFilters = new com.amazonaws.internal.SdkInternalList<String>(stackStatusFilters);
} } |
public class class_name {
public static List<BoxTermsOfService.Info> getAllTermsOfServices(final BoxAPIConnection api,
BoxTermsOfService.TermsOfServiceType
termsOfServiceType) {
QueryStringBuilder builder = new QueryStringBuilder();
if (termsOfServiceType != null) {
builder.appendParam("tos_type", termsOfServiceType.toString());
}
URL url = ALL_TERMS_OF_SERVICES_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString());
BoxAPIRequest request = new BoxAPIRequest(api, url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
int totalCount = responseJSON.get("total_count").asInt();
List<BoxTermsOfService.Info> termsOfServices = new ArrayList<BoxTermsOfService.Info>(totalCount);
JsonArray entries = responseJSON.get("entries").asArray();
for (JsonValue value : entries) {
JsonObject termsOfServiceJSON = value.asObject();
BoxTermsOfService termsOfService = new BoxTermsOfService(api, termsOfServiceJSON.get("id").asString());
BoxTermsOfService.Info info = termsOfService.new Info(termsOfServiceJSON);
termsOfServices.add(info);
}
return termsOfServices;
} } | public class class_name {
public static List<BoxTermsOfService.Info> getAllTermsOfServices(final BoxAPIConnection api,
BoxTermsOfService.TermsOfServiceType
termsOfServiceType) {
QueryStringBuilder builder = new QueryStringBuilder();
if (termsOfServiceType != null) {
builder.appendParam("tos_type", termsOfServiceType.toString()); // depends on control dependency: [if], data = [none]
}
URL url = ALL_TERMS_OF_SERVICES_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString());
BoxAPIRequest request = new BoxAPIRequest(api, url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
int totalCount = responseJSON.get("total_count").asInt();
List<BoxTermsOfService.Info> termsOfServices = new ArrayList<BoxTermsOfService.Info>(totalCount);
JsonArray entries = responseJSON.get("entries").asArray();
for (JsonValue value : entries) {
JsonObject termsOfServiceJSON = value.asObject();
BoxTermsOfService termsOfService = new BoxTermsOfService(api, termsOfServiceJSON.get("id").asString());
BoxTermsOfService.Info info = termsOfService.new Info(termsOfServiceJSON);
termsOfServices.add(info); // depends on control dependency: [for], data = [none]
}
return termsOfServices;
} } |
public class class_name {
public List<String> getSortedResources() {
List<String> resources = new ArrayList<>();
try (BufferedReader bf = new BufferedReader(reader)) {
String res;
while ((res = bf.readLine()) != null) {
String name = PathNormalizer.normalizePath(res.trim());
for (String available : availableResources) {
if (PathNormalizer.normalizePath(available).equals(name)) {
if (name.endsWith(".js") || name.endsWith(".css"))
resources.add(PathNormalizer.joinPaths(dirName, name));
else
resources.add(PathNormalizer.joinPaths(dirName, name + "/"));
availableResources.remove(available);
break;
}
}
}
} catch (IOException e) {
throw new BundlingProcessException("Unexpected IOException reading sort file", e);
}
return resources;
} } | public class class_name {
public List<String> getSortedResources() {
List<String> resources = new ArrayList<>();
try (BufferedReader bf = new BufferedReader(reader)) {
String res;
while ((res = bf.readLine()) != null) {
String name = PathNormalizer.normalizePath(res.trim());
for (String available : availableResources) {
if (PathNormalizer.normalizePath(available).equals(name)) {
if (name.endsWith(".js") || name.endsWith(".css"))
resources.add(PathNormalizer.joinPaths(dirName, name));
else
resources.add(PathNormalizer.joinPaths(dirName, name + "/"));
availableResources.remove(available); // depends on control dependency: [if], data = [none]
break;
}
}
}
} catch (IOException e) {
throw new BundlingProcessException("Unexpected IOException reading sort file", e);
}
return resources;
} } |
public class class_name {
public void setArtifactRevisions(java.util.Collection<ArtifactRevision> artifactRevisions) {
if (artifactRevisions == null) {
this.artifactRevisions = null;
return;
}
this.artifactRevisions = new java.util.ArrayList<ArtifactRevision>(artifactRevisions);
} } | public class class_name {
public void setArtifactRevisions(java.util.Collection<ArtifactRevision> artifactRevisions) {
if (artifactRevisions == null) {
this.artifactRevisions = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.artifactRevisions = new java.util.ArrayList<ArtifactRevision>(artifactRevisions);
} } |
public class class_name {
public static String getRelativePath(final String base, final File targetFile) {
try {
//
// remove trailing file separator
//
String canonicalBase = base;
if (base.charAt(base.length() - 1) != File.separatorChar) {
canonicalBase = base + File.separatorChar;
}
//
// get canonical name of target
//
String canonicalTarget;
if (System.getProperty("os.name").equals("OS/400")) {
canonicalTarget = targetFile.getPath();
} else {
canonicalTarget = targetFile.getCanonicalPath();
}
if (canonicalBase.startsWith(canonicalTarget + File.separatorChar)) {
canonicalTarget = canonicalTarget + File.separator;
}
if (canonicalTarget.equals(canonicalBase)) {
return ".";
}
//
// see if the prefixes are the same
//
if (substringMatch(canonicalBase, 0, 2, "\\\\")) {
//
// UNC file name, if target file doesn't also start with same
// server name, don't go there
final int endPrefix = canonicalBase.indexOf('\\', 2);
final String prefix1 = canonicalBase.substring(0, endPrefix);
final String prefix2 = canonicalTarget.substring(0, endPrefix);
if (!prefix1.equals(prefix2)) {
return canonicalTarget;
}
} else {
if (substringMatch(canonicalBase, 1, 3, ":\\")) {
final int endPrefix = 2;
final String prefix1 = canonicalBase.substring(0, endPrefix);
final String prefix2 = canonicalTarget.substring(0, endPrefix);
if (!prefix1.equals(prefix2)) {
return canonicalTarget;
}
} else {
if (canonicalBase.charAt(0) == '/' && canonicalTarget.charAt(0) != '/') {
return canonicalTarget;
}
}
}
final char separator = File.separatorChar;
int lastCommonSeparator = -1;
int minLength = canonicalBase.length();
if (canonicalTarget.length() < minLength) {
minLength = canonicalTarget.length();
}
//
// walk to the shorter of the two paths
// finding the last separator they have in common
for (int i = 0; i < minLength; i++) {
if (canonicalTarget.charAt(i) == canonicalBase.charAt(i)) {
if (canonicalTarget.charAt(i) == separator) {
lastCommonSeparator = i;
}
} else {
break;
}
}
final StringBuffer relativePath = new StringBuffer(50);
//
// walk from the first difference to the end of the base
// adding "../" for each separator encountered
//
for (int i = lastCommonSeparator + 1; i < canonicalBase.length(); i++) {
if (canonicalBase.charAt(i) == separator) {
if (relativePath.length() > 0) {
relativePath.append(separator);
}
relativePath.append("..");
}
}
if (canonicalTarget.length() > lastCommonSeparator + 1) {
if (relativePath.length() > 0) {
relativePath.append(separator);
}
relativePath.append(canonicalTarget.substring(lastCommonSeparator + 1));
}
return relativePath.toString();
} catch (final IOException ex) {
}
return targetFile.toString();
} } | public class class_name {
public static String getRelativePath(final String base, final File targetFile) {
try {
//
// remove trailing file separator
//
String canonicalBase = base;
if (base.charAt(base.length() - 1) != File.separatorChar) {
canonicalBase = base + File.separatorChar; // depends on control dependency: [if], data = [none]
}
//
// get canonical name of target
//
String canonicalTarget;
if (System.getProperty("os.name").equals("OS/400")) {
canonicalTarget = targetFile.getPath(); // depends on control dependency: [if], data = [none]
} else {
canonicalTarget = targetFile.getCanonicalPath(); // depends on control dependency: [if], data = [none]
}
if (canonicalBase.startsWith(canonicalTarget + File.separatorChar)) {
canonicalTarget = canonicalTarget + File.separator; // depends on control dependency: [if], data = [none]
}
if (canonicalTarget.equals(canonicalBase)) {
return "."; // depends on control dependency: [if], data = [none]
}
//
// see if the prefixes are the same
//
if (substringMatch(canonicalBase, 0, 2, "\\\\")) {
//
// UNC file name, if target file doesn't also start with same
// server name, don't go there
final int endPrefix = canonicalBase.indexOf('\\', 2);
final String prefix1 = canonicalBase.substring(0, endPrefix);
final String prefix2 = canonicalTarget.substring(0, endPrefix);
if (!prefix1.equals(prefix2)) {
return canonicalTarget; // depends on control dependency: [if], data = [none]
}
} else {
if (substringMatch(canonicalBase, 1, 3, ":\\")) {
final int endPrefix = 2;
final String prefix1 = canonicalBase.substring(0, endPrefix);
final String prefix2 = canonicalTarget.substring(0, endPrefix);
if (!prefix1.equals(prefix2)) {
return canonicalTarget; // depends on control dependency: [if], data = [none]
}
} else {
if (canonicalBase.charAt(0) == '/' && canonicalTarget.charAt(0) != '/') {
return canonicalTarget; // depends on control dependency: [if], data = [none]
}
}
}
final char separator = File.separatorChar;
int lastCommonSeparator = -1;
int minLength = canonicalBase.length();
if (canonicalTarget.length() < minLength) {
minLength = canonicalTarget.length(); // depends on control dependency: [if], data = [none]
}
//
// walk to the shorter of the two paths
// finding the last separator they have in common
for (int i = 0; i < minLength; i++) {
if (canonicalTarget.charAt(i) == canonicalBase.charAt(i)) {
if (canonicalTarget.charAt(i) == separator) {
lastCommonSeparator = i; // depends on control dependency: [if], data = [none]
}
} else {
break;
}
}
final StringBuffer relativePath = new StringBuffer(50);
//
// walk from the first difference to the end of the base
// adding "../" for each separator encountered
//
for (int i = lastCommonSeparator + 1; i < canonicalBase.length(); i++) {
if (canonicalBase.charAt(i) == separator) {
if (relativePath.length() > 0) {
relativePath.append(separator); // depends on control dependency: [if], data = [none]
}
relativePath.append(".."); // depends on control dependency: [if], data = [none]
}
}
if (canonicalTarget.length() > lastCommonSeparator + 1) {
if (relativePath.length() > 0) {
relativePath.append(separator); // depends on control dependency: [if], data = [none]
}
relativePath.append(canonicalTarget.substring(lastCommonSeparator + 1)); // depends on control dependency: [if], data = [lastCommonSeparator + 1)]
}
return relativePath.toString(); // depends on control dependency: [try], data = [none]
} catch (final IOException ex) {
} // depends on control dependency: [catch], data = [none]
return targetFile.toString();
} } |
public class class_name {
private void initRecordBuilderFactories() {
for (FieldMapping fieldMapping : avroSchema.getColumnMappingDescriptor().getFieldMappings()) {
if (fieldMapping.getMappingType() == MappingType.KEY_AS_COLUMN) {
String fieldName = fieldMapping.getFieldName();
Schema fieldSchema = avroSchema.getAvroSchema().getField(fieldName)
.schema();
Schema.Type fieldSchemaType = fieldSchema.getType();
if (fieldSchemaType == Schema.Type.RECORD) {
AvroRecordBuilderFactory<E> factory = buildAvroRecordBuilderFactory(fieldSchema);
kacRecordBuilderFactories.put(fieldName, factory);
}
}
}
} } | public class class_name {
private void initRecordBuilderFactories() {
for (FieldMapping fieldMapping : avroSchema.getColumnMappingDescriptor().getFieldMappings()) {
if (fieldMapping.getMappingType() == MappingType.KEY_AS_COLUMN) {
String fieldName = fieldMapping.getFieldName();
Schema fieldSchema = avroSchema.getAvroSchema().getField(fieldName)
.schema();
Schema.Type fieldSchemaType = fieldSchema.getType();
if (fieldSchemaType == Schema.Type.RECORD) {
AvroRecordBuilderFactory<E> factory = buildAvroRecordBuilderFactory(fieldSchema);
kacRecordBuilderFactories.put(fieldName, factory); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public static int len(String list, String delimiter, boolean ignoreEmpty) {
if (delimiter.length() == 1) return len(list, delimiter.charAt(0), ignoreEmpty);
char[] del = delimiter.toCharArray();
int len = StringUtil.length(list);
if (len == 0) return 0;
int count = 0;
int last = 0;
char c;
for (int i = 0; i < len; i++) {
c = list.charAt(i);
for (int y = 0; y < del.length; y++) {
if (c == del[y]) {
if (!ignoreEmpty || last < i) count++;
last = i + 1;
break;
}
}
}
if (!ignoreEmpty || last < len) count++;
return count;
} } | public class class_name {
public static int len(String list, String delimiter, boolean ignoreEmpty) {
if (delimiter.length() == 1) return len(list, delimiter.charAt(0), ignoreEmpty);
char[] del = delimiter.toCharArray();
int len = StringUtil.length(list);
if (len == 0) return 0;
int count = 0;
int last = 0;
char c;
for (int i = 0; i < len; i++) {
c = list.charAt(i); // depends on control dependency: [for], data = [i]
for (int y = 0; y < del.length; y++) {
if (c == del[y]) {
if (!ignoreEmpty || last < i) count++;
last = i + 1; // depends on control dependency: [if], data = [none]
break;
}
}
}
if (!ignoreEmpty || last < len) count++;
return count;
} } |
public class class_name {
public JvmTypeReference cloneWithProxies(/* @Nullable */ JvmTypeReference typeRef) {
if(typeRef == null)
return null;
if (typeRef instanceof JvmParameterizedTypeReference && !typeRef.eIsProxy()
&& !typeRef.eIsSet(TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE)) {
JvmUnknownTypeReference unknownTypeReference = typesFactory.createJvmUnknownTypeReference();
return unknownTypeReference;
}
return cloneAndAssociate(typeRef);
} } | public class class_name {
public JvmTypeReference cloneWithProxies(/* @Nullable */ JvmTypeReference typeRef) {
if(typeRef == null)
return null;
if (typeRef instanceof JvmParameterizedTypeReference && !typeRef.eIsProxy()
&& !typeRef.eIsSet(TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE)) {
JvmUnknownTypeReference unknownTypeReference = typesFactory.createJvmUnknownTypeReference();
return unknownTypeReference; // depends on control dependency: [if], data = [none]
}
return cloneAndAssociate(typeRef);
} } |
public class class_name {
public static SpreadsheetVersion getVersion(final Sheet sheet) {
ArgUtils.notNull(sheet, "sheet");
if(sheet instanceof HSSFSheet) {
return SpreadsheetVersion.EXCEL97;
} else if(sheet instanceof XSSFSheet) {
return SpreadsheetVersion.EXCEL2007;
}
return null;
} } | public class class_name {
public static SpreadsheetVersion getVersion(final Sheet sheet) {
ArgUtils.notNull(sheet, "sheet");
if(sheet instanceof HSSFSheet) {
return SpreadsheetVersion.EXCEL97;
// depends on control dependency: [if], data = [none]
} else if(sheet instanceof XSSFSheet) {
return SpreadsheetVersion.EXCEL2007;
// depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public Geometry toGeometry(String wkt) {
try {
return WktService.toGeometry(wkt);
} catch (WktException e) {
return null;
}
} } | public class class_name {
public Geometry toGeometry(String wkt) {
try {
return WktService.toGeometry(wkt); // depends on control dependency: [try], data = [none]
} catch (WktException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void selectByValue(String value) {
getDispatcher().beforeSelect(this, value);
new Select(getElement()).selectByValue(value);
if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) {
logUIActions(UIActions.SELECTED, value);
}
getDispatcher().afterSelect(this, value);
} } | public class class_name {
public void selectByValue(String value) {
getDispatcher().beforeSelect(this, value);
new Select(getElement()).selectByValue(value);
if (Config.getBoolConfigProperty(ConfigProperty.ENABLE_GUI_LOGGING)) {
logUIActions(UIActions.SELECTED, value); // depends on control dependency: [if], data = [none]
}
getDispatcher().afterSelect(this, value);
} } |
public class class_name {
@POST
@Path("/probeResponse")
@Consumes("application/json")
public String handleJSONProbeResponse(String probeResponseJSON) {
JSONSerializer serializer = new JSONSerializer();
ResponseWrapper response;
try {
response = serializer.unmarshal(probeResponseJSON);
} catch (ResponseParseException e) {
String errorResponseString = "Incoming Response could not be parsed. Error message is: " + e.getMessage();
Console.error(errorResponseString);
Console.error("Wireline message that could no be parsed is:");
Console.error(probeResponseJSON);
return errorResponseString;
}
for (ServiceWrapper service : response.getServices()) {
service.setResponseID(response.getResponseID());
service.setProbeID(response.getProbeID());
cache.cache(new ExpiringService(service));
}
String statusString = "Successfully cached " + response.getServices().size() + " services";
updateCacheListener(statusString);
return statusString;
} } | public class class_name {
@POST
@Path("/probeResponse")
@Consumes("application/json")
public String handleJSONProbeResponse(String probeResponseJSON) {
JSONSerializer serializer = new JSONSerializer();
ResponseWrapper response;
try {
response = serializer.unmarshal(probeResponseJSON); // depends on control dependency: [try], data = [none]
} catch (ResponseParseException e) {
String errorResponseString = "Incoming Response could not be parsed. Error message is: " + e.getMessage();
Console.error(errorResponseString);
Console.error("Wireline message that could no be parsed is:");
Console.error(probeResponseJSON);
return errorResponseString;
} // depends on control dependency: [catch], data = [none]
for (ServiceWrapper service : response.getServices()) {
service.setResponseID(response.getResponseID()); // depends on control dependency: [for], data = [service]
service.setProbeID(response.getProbeID()); // depends on control dependency: [for], data = [service]
cache.cache(new ExpiringService(service)); // depends on control dependency: [for], data = [service]
}
String statusString = "Successfully cached " + response.getServices().size() + " services";
updateCacheListener(statusString);
return statusString;
} } |
public class class_name {
@SuppressWarnings("unchecked")
protected final <E extends Event> EventHandler<E> getHandler(final EventType<E> eventType) throws CoreException {
EventType<?> temp = eventType;
EventHandler<E> handler = null;
while (temp != null && handler == null) {
handler = (EventHandler<E>) this.eventHandlerMap.get(temp);
temp = temp.getSuperType();
}
// // Check supertype (ANY)
// if (handler == null) {
//
// handler = (EventHandler<E>) this.eventHandlerMap.get();
// }
// Check if the handler has been created or not
if (handler == null) {
for (final EventAdapter.Linker linker : EventAdapter.Linker.values()) {
if (isEventType(eventType, linker.eventType())) {
handler = buildEventHandler(linker.adapterClass(), (Class<? extends EventHandler<E>>) linker.handlerClass());
}
}
if (handler != null) {
// store the handler
this.eventHandlerMap.put(eventType, handler);
}
}
return handler;
} } | public class class_name {
@SuppressWarnings("unchecked")
protected final <E extends Event> EventHandler<E> getHandler(final EventType<E> eventType) throws CoreException {
EventType<?> temp = eventType;
EventHandler<E> handler = null;
while (temp != null && handler == null) {
handler = (EventHandler<E>) this.eventHandlerMap.get(temp);
temp = temp.getSuperType();
}
// // Check supertype (ANY)
// if (handler == null) {
//
// handler = (EventHandler<E>) this.eventHandlerMap.get();
// }
// Check if the handler has been created or not
if (handler == null) {
for (final EventAdapter.Linker linker : EventAdapter.Linker.values()) {
if (isEventType(eventType, linker.eventType())) {
handler = buildEventHandler(linker.adapterClass(), (Class<? extends EventHandler<E>>) linker.handlerClass());
}
}
if (handler != null) {
// store the handler
this.eventHandlerMap.put(eventType, handler); // depends on control dependency: [if], data = [none]
}
}
return handler;
} } |
public class class_name {
@Override
public void play2(Number streamId, Map<String, ?> playOptions) {
log.debug("play2 options: {}", playOptions.toString());
/* { streamName=streams/new.flv,
oldStreamName=streams/old.flv,
start=0, len=-1,
offset=12.195,
transition=switch } */
// get the transition type
String transition = (String) playOptions.get("transition");
if (conn != null) {
if ("NetStreamPlayTransitions.STOP".equals(transition)) {
PendingCall pendingCall = new PendingCall("play", new Object[] { Boolean.FALSE });
conn.invoke(pendingCall, getChannelForStreamId(streamId));
} else if ("NetStreamPlayTransitions.RESET".equals(transition)) {
// just reset the currently playing stream
} else {
Object[] params = new Object[6];
params[0] = playOptions.get("streamName").toString();
Object o = playOptions.get("start");
params[1] = o instanceof Integer ? (Integer) o : Integer.valueOf((String) o);
o = playOptions.get("len");
params[2] = o instanceof Integer ? (Integer) o : Integer.valueOf((String) o);
// new parameters for playback
params[3] = transition;
params[4] = playOptions.get("offset");
params[5] = playOptions.get("oldStreamName");
// do call
PendingCall pendingCall = new PendingCall("play2", params);
conn.invoke(pendingCall, getChannelForStreamId(streamId));
}
} else {
log.info("Connection was null ?");
}
} } | public class class_name {
@Override
public void play2(Number streamId, Map<String, ?> playOptions) {
log.debug("play2 options: {}", playOptions.toString());
/* { streamName=streams/new.flv,
oldStreamName=streams/old.flv,
start=0, len=-1,
offset=12.195,
transition=switch } */
// get the transition type
String transition = (String) playOptions.get("transition");
if (conn != null) {
if ("NetStreamPlayTransitions.STOP".equals(transition)) {
PendingCall pendingCall = new PendingCall("play", new Object[] { Boolean.FALSE });
conn.invoke(pendingCall, getChannelForStreamId(streamId));
// depends on control dependency: [if], data = [none]
} else if ("NetStreamPlayTransitions.RESET".equals(transition)) {
// just reset the currently playing stream
} else {
Object[] params = new Object[6];
params[0] = playOptions.get("streamName").toString();
// depends on control dependency: [if], data = [none]
Object o = playOptions.get("start");
params[1] = o instanceof Integer ? (Integer) o : Integer.valueOf((String) o);
// depends on control dependency: [if], data = [none]
o = playOptions.get("len");
// depends on control dependency: [if], data = [none]
params[2] = o instanceof Integer ? (Integer) o : Integer.valueOf((String) o);
// depends on control dependency: [if], data = [none]
// new parameters for playback
params[3] = transition;
// depends on control dependency: [if], data = [none]
params[4] = playOptions.get("offset");
// depends on control dependency: [if], data = [none]
params[5] = playOptions.get("oldStreamName");
// depends on control dependency: [if], data = [none]
// do call
PendingCall pendingCall = new PendingCall("play2", params);
conn.invoke(pendingCall, getChannelForStreamId(streamId));
// depends on control dependency: [if], data = [none]
}
} else {
log.info("Connection was null ?");
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static int[] getViewToHeaderPositionImpl(JTextArea view, int start, int end) {
int finalStartPos = start;
try {
finalStartPos += view.getLineOfOffset(finalStartPos);
} catch (BadLocationException e) {
// Shouldn't happen, position was already validated.
LOGGER.error(e.getMessage(), e);
return INVALID_POSITION;
}
int finalEndPos = end;
try {
finalEndPos += view.getLineOfOffset(finalEndPos);
} catch (BadLocationException e) {
// Shouldn't happen, position was already validated.
LOGGER.error(e.getMessage(), e);
return INVALID_POSITION;
}
return new int[] { finalStartPos, finalEndPos };
} } | public class class_name {
private static int[] getViewToHeaderPositionImpl(JTextArea view, int start, int end) {
int finalStartPos = start;
try {
finalStartPos += view.getLineOfOffset(finalStartPos); // depends on control dependency: [try], data = [none]
} catch (BadLocationException e) {
// Shouldn't happen, position was already validated.
LOGGER.error(e.getMessage(), e);
return INVALID_POSITION;
} // depends on control dependency: [catch], data = [none]
int finalEndPos = end;
try {
finalEndPos += view.getLineOfOffset(finalEndPos); // depends on control dependency: [try], data = [none]
} catch (BadLocationException e) {
// Shouldn't happen, position was already validated.
LOGGER.error(e.getMessage(), e);
return INVALID_POSITION;
} // depends on control dependency: [catch], data = [none]
return new int[] { finalStartPos, finalEndPos };
} } |
public class class_name {
public Flowable<Collection<Transformed>> all() {
return baseQuery()
.all()
.map(
new Function<CDAArray, Collection<Transformed>>() {
@Override
public Collection<Transformed> apply(CDAArray array) {
final ArrayList<Transformed> result = new ArrayList<>(array.total());
for (final CDAResource resource : array.items) {
if (resource instanceof CDAEntry
&& ((CDAEntry) resource).contentType().id().equals(contentTypeId)) {
result.add(TransformQuery.this.transform((CDAEntry) resource));
}
}
return result;
}
}
);
} } | public class class_name {
public Flowable<Collection<Transformed>> all() {
return baseQuery()
.all()
.map(
new Function<CDAArray, Collection<Transformed>>() {
@Override
public Collection<Transformed> apply(CDAArray array) {
final ArrayList<Transformed> result = new ArrayList<>(array.total());
for (final CDAResource resource : array.items) {
if (resource instanceof CDAEntry
&& ((CDAEntry) resource).contentType().id().equals(contentTypeId)) {
result.add(TransformQuery.this.transform((CDAEntry) resource)); // depends on control dependency: [if], data = [none]
}
}
return result;
}
}
);
} } |
public class class_name {
protected void executeSQL(String sql){
Connection conn = null;
Statement stmt = null;
if (useAnt){
try{
AntSqlExec sqlExec = new AntSqlExec(dataSource, sql, delimiter, delimiterType);
sqlExec.execute();
log.info("SQL executed with Ant: " + sql);
}catch(BuildException be){
throw new RuntimeException("Failed to execute SQL with Ant (" + be.getMessage() + "): " + sql, be);
}
}else{
try {
conn = dataSource.getConnection();
stmt = conn.createStatement();
stmt.execute(sql);
log.info("SQL executed: " + sql);
}catch(SQLException sqle){
throw new RuntimeException("Failed to execute SQL (" + sqle.getMessage() + "): " + sql, sqle);
}finally{
ConnectionUtility.closeConnection(conn, stmt);
}
}
} } | public class class_name {
protected void executeSQL(String sql){
Connection conn = null;
Statement stmt = null;
if (useAnt){
try{
AntSqlExec sqlExec = new AntSqlExec(dataSource, sql, delimiter, delimiterType);
sqlExec.execute();
// depends on control dependency: [try], data = [none]
log.info("SQL executed with Ant: " + sql);
// depends on control dependency: [try], data = [none]
}catch(BuildException be){
throw new RuntimeException("Failed to execute SQL with Ant (" + be.getMessage() + "): " + sql, be);
}
// depends on control dependency: [catch], data = [none]
}else{
try {
conn = dataSource.getConnection();
// depends on control dependency: [try], data = [none]
stmt = conn.createStatement();
// depends on control dependency: [try], data = [none]
stmt.execute(sql);
// depends on control dependency: [try], data = [none]
log.info("SQL executed: " + sql);
// depends on control dependency: [try], data = [none]
}catch(SQLException sqle){
throw new RuntimeException("Failed to execute SQL (" + sqle.getMessage() + "): " + sql, sqle);
}finally{
// depends on control dependency: [catch], data = [none]
ConnectionUtility.closeConnection(conn, stmt);
}
}
} } |
public class class_name {
@NonNull
public Crossfade setResizeBehavior(int resizeBehavior) {
if (resizeBehavior >= RESIZE_BEHAVIOR_NONE && resizeBehavior <= RESIZE_BEHAVIOR_SCALE) {
mResizeBehavior = resizeBehavior;
}
return this;
} } | public class class_name {
@NonNull
public Crossfade setResizeBehavior(int resizeBehavior) {
if (resizeBehavior >= RESIZE_BEHAVIOR_NONE && resizeBehavior <= RESIZE_BEHAVIOR_SCALE) {
mResizeBehavior = resizeBehavior; // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public static Configuration cloneConfiguration(Configuration configuration) {
final Configuration clonedConfiguration = new Configuration(configuration);
if (clonedConfiguration.getBoolean(USE_LOCAL_DEFAULT_TMP_DIRS)){
clonedConfiguration.removeConfig(CoreOptions.TMP_DIRS);
clonedConfiguration.removeConfig(USE_LOCAL_DEFAULT_TMP_DIRS);
}
return clonedConfiguration;
} } | public class class_name {
public static Configuration cloneConfiguration(Configuration configuration) {
final Configuration clonedConfiguration = new Configuration(configuration);
if (clonedConfiguration.getBoolean(USE_LOCAL_DEFAULT_TMP_DIRS)){
clonedConfiguration.removeConfig(CoreOptions.TMP_DIRS); // depends on control dependency: [if], data = [none]
clonedConfiguration.removeConfig(USE_LOCAL_DEFAULT_TMP_DIRS); // depends on control dependency: [if], data = [none]
}
return clonedConfiguration;
} } |
public class class_name {
public static String arrayToList(String[] array, String delimiter) {
if (ArrayUtil.isEmpty(array)) return "";
StringBuilder sb = new StringBuilder(array[0]);
if (delimiter.length() == 1) {
char c = delimiter.charAt(0);
for (int i = 1; i < array.length; i++) {
sb.append(c);
sb.append(array[i]);
}
}
else {
for (int i = 1; i < array.length; i++) {
sb.append(delimiter);
sb.append(array[i]);
}
}
return sb.toString();
} } | public class class_name {
public static String arrayToList(String[] array, String delimiter) {
if (ArrayUtil.isEmpty(array)) return "";
StringBuilder sb = new StringBuilder(array[0]);
if (delimiter.length() == 1) {
char c = delimiter.charAt(0);
for (int i = 1; i < array.length; i++) {
sb.append(c); // depends on control dependency: [for], data = [none]
sb.append(array[i]); // depends on control dependency: [for], data = [i]
}
}
else {
for (int i = 1; i < array.length; i++) {
sb.append(delimiter); // depends on control dependency: [for], data = [none]
sb.append(array[i]); // depends on control dependency: [for], data = [i]
}
}
return sb.toString();
} } |
public class class_name {
@Override
protected boolean hasOverflow(FlatRStarTreeNode node) {
if(node.isLeaf()) {
return node.getNumEntries() == leafCapacity;
}
else if(node.getNumEntries() == node.getCapacity()) {
node.increaseEntries();
}
return false;
} } | public class class_name {
@Override
protected boolean hasOverflow(FlatRStarTreeNode node) {
if(node.isLeaf()) {
return node.getNumEntries() == leafCapacity; // depends on control dependency: [if], data = [none]
}
else if(node.getNumEntries() == node.getCapacity()) {
node.increaseEntries(); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
private void startLoadingAnimation(final String msg, int delayMillis) {
m_loadingTimer = new Timer() {
@Override
public void run() {
m_mainPanel.showLoadingAnimation(msg);
}
};
if (delayMillis > 0) {
m_loadingTimer.schedule(delayMillis);
} else {
m_loadingTimer.run();
}
} } | public class class_name {
private void startLoadingAnimation(final String msg, int delayMillis) {
m_loadingTimer = new Timer() {
@Override
public void run() {
m_mainPanel.showLoadingAnimation(msg);
}
};
if (delayMillis > 0) {
m_loadingTimer.schedule(delayMillis);
// depends on control dependency: [if], data = [(delayMillis]
} else {
m_loadingTimer.run();
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setDecoratedZOS() { // 331761A
if (xMemSetupThread == null) {
try {
final Class xMemCRBridgeClass = Class.forName("com.ibm.ws390.xmem.XMemCRBridgeImpl");
xMemSetupThread = xMemCRBridgeClass.getMethod("setupThreadStub", new Class[] { java.lang.Object.class });
} catch (Throwable t) {
if (tc.isEventEnabled())
Tr.event(tc, "Unexpected exception caught accessing XMemCRBridgeImpl.setupThreadStub", t);
// Alex Ffdc.log(t, this, "com.ibm.ws.util.ThreadPool.setDecoratedZOS",
// "893"); // D477704.2
}
}
if (xMemSetupThread != null) {
_isDecoratedZOS = true;
}
} } | public class class_name {
public void setDecoratedZOS() { // 331761A
if (xMemSetupThread == null) {
try {
final Class xMemCRBridgeClass = Class.forName("com.ibm.ws390.xmem.XMemCRBridgeImpl");
xMemSetupThread = xMemCRBridgeClass.getMethod("setupThreadStub", new Class[] { java.lang.Object.class }); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
if (tc.isEventEnabled())
Tr.event(tc, "Unexpected exception caught accessing XMemCRBridgeImpl.setupThreadStub", t);
// Alex Ffdc.log(t, this, "com.ibm.ws.util.ThreadPool.setDecoratedZOS",
// "893"); // D477704.2
} // depends on control dependency: [catch], data = [none]
}
if (xMemSetupThread != null) {
_isDecoratedZOS = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static double optionalDoubleAttribute(
final XMLStreamReader reader,
final String namespace,
final String localName,
final double defaultValue) {
final String value = reader.getAttributeValue(namespace, localName);
if (value != null) {
return Double.parseDouble(value);
}
return defaultValue;
} } | public class class_name {
public static double optionalDoubleAttribute(
final XMLStreamReader reader,
final String namespace,
final String localName,
final double defaultValue) {
final String value = reader.getAttributeValue(namespace, localName);
if (value != null) {
return Double.parseDouble(value); // depends on control dependency: [if], data = [(value]
}
return defaultValue;
} } |
public class class_name {
void setInstallOrOpenCallback(Branch.BranchReferralInitListener callback) {
synchronized (reqQueueLockObject) {
for (ServerRequest req : queue) {
if (req != null) {
if (req instanceof ServerRequestRegisterInstall) {
((ServerRequestRegisterInstall) req).setInitFinishedCallback(callback);
} else if (req instanceof ServerRequestRegisterOpen) {
((ServerRequestRegisterOpen) req).setInitFinishedCallback(callback);
}
}
}
}
} } | public class class_name {
void setInstallOrOpenCallback(Branch.BranchReferralInitListener callback) {
synchronized (reqQueueLockObject) {
for (ServerRequest req : queue) {
if (req != null) {
if (req instanceof ServerRequestRegisterInstall) {
((ServerRequestRegisterInstall) req).setInitFinishedCallback(callback); // depends on control dependency: [if], data = [none]
} else if (req instanceof ServerRequestRegisterOpen) {
((ServerRequestRegisterOpen) req).setInitFinishedCallback(callback); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public void marshall(UpdateIdentityProviderConfigurationRequest updateIdentityProviderConfigurationRequest, ProtocolMarshaller protocolMarshaller) {
if (updateIdentityProviderConfigurationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateIdentityProviderConfigurationRequest.getFleetArn(), FLEETARN_BINDING);
protocolMarshaller.marshall(updateIdentityProviderConfigurationRequest.getIdentityProviderType(), IDENTITYPROVIDERTYPE_BINDING);
protocolMarshaller.marshall(updateIdentityProviderConfigurationRequest.getIdentityProviderSamlMetadata(), IDENTITYPROVIDERSAMLMETADATA_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateIdentityProviderConfigurationRequest updateIdentityProviderConfigurationRequest, ProtocolMarshaller protocolMarshaller) {
if (updateIdentityProviderConfigurationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateIdentityProviderConfigurationRequest.getFleetArn(), FLEETARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateIdentityProviderConfigurationRequest.getIdentityProviderType(), IDENTITYPROVIDERTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateIdentityProviderConfigurationRequest.getIdentityProviderSamlMetadata(), IDENTITYPROVIDERSAMLMETADATA_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private synchronized void reloadFromUserControlledList() {
File file = getConfigFile();
if (!file.exists()) {
if ((whitelistSignaturesFromUserControlledList != null && whitelistSignaturesFromUserControlledList.isEmpty()) ||
(blacklistSignaturesFromUserControlledList != null && blacklistSignaturesFromUserControlledList.isEmpty())) {
LOGGER.log(Level.INFO, "No whitelist source file found at " + file + " so resetting user-controlled whitelist");
}
whitelistSignaturesFromUserControlledList = new HashSet<>();
blacklistSignaturesFromUserControlledList = new HashSet<>();
return;
}
LOGGER.log(Level.INFO, "Whitelist source file found at " + file);
try {
whitelistSignaturesFromUserControlledList = new HashSet<>();
blacklistSignaturesFromUserControlledList = new HashSet<>();
parseFileIntoList(
FileUtils.readLines(file, StandardCharsets.UTF_8),
whitelistSignaturesFromUserControlledList,
blacklistSignaturesFromUserControlledList
);
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to load " + file.getAbsolutePath(), e);
}
} } | public class class_name {
private synchronized void reloadFromUserControlledList() {
File file = getConfigFile();
if (!file.exists()) {
if ((whitelistSignaturesFromUserControlledList != null && whitelistSignaturesFromUserControlledList.isEmpty()) ||
(blacklistSignaturesFromUserControlledList != null && blacklistSignaturesFromUserControlledList.isEmpty())) {
LOGGER.log(Level.INFO, "No whitelist source file found at " + file + " so resetting user-controlled whitelist"); // depends on control dependency: [if], data = [none]
}
whitelistSignaturesFromUserControlledList = new HashSet<>(); // depends on control dependency: [if], data = [none]
blacklistSignaturesFromUserControlledList = new HashSet<>(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
LOGGER.log(Level.INFO, "Whitelist source file found at " + file);
try {
whitelistSignaturesFromUserControlledList = new HashSet<>(); // depends on control dependency: [try], data = [none]
blacklistSignaturesFromUserControlledList = new HashSet<>(); // depends on control dependency: [try], data = [none]
parseFileIntoList(
FileUtils.readLines(file, StandardCharsets.UTF_8),
whitelistSignaturesFromUserControlledList,
blacklistSignaturesFromUserControlledList
); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to load " + file.getAbsolutePath(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public final Iterable<HeadDocument> findAll(
final RootDocument rootDocument) {
final Iterable<HeadDocument> headDocuments =
findAll(rootDocument.getFilename());
if (headDocuments == null) {
return null;
}
for (final HeadDocument headDocument : headDocuments) {
final Head head = headDocument.getGedObject();
head.setParent(rootDocument.getGedObject());
}
return headDocuments;
} } | public class class_name {
@Override
public final Iterable<HeadDocument> findAll(
final RootDocument rootDocument) {
final Iterable<HeadDocument> headDocuments =
findAll(rootDocument.getFilename());
if (headDocuments == null) {
return null; // depends on control dependency: [if], data = [none]
}
for (final HeadDocument headDocument : headDocuments) {
final Head head = headDocument.getGedObject();
head.setParent(rootDocument.getGedObject()); // depends on control dependency: [for], data = [none]
}
return headDocuments;
} } |
public class class_name {
public JSONObject invokeJson() throws InternalException, CloudException {
ClientAndResponse clientAndResponse = null;
String content;
try {
clientAndResponse = invokeInternal();
Header contentType = clientAndResponse.response.getFirstHeader("content-type");
if (!"application/json".equalsIgnoreCase(contentType.getValue())) {
throw new CloudException("Invalid Glacier response: expected JSON");
}
final HttpEntity entity = clientAndResponse.response.getEntity();
content = EntityUtils.toString(entity);
if (content == null) {
return null;
}
return new JSONObject(content);
} catch (IOException e) {
throw new CloudException(e);
} catch (JSONException e) {
throw new CloudException(e);
} finally {
if (clientAndResponse != null) {
clientAndResponse.client.getConnectionManager().shutdown();
}
}
} } | public class class_name {
public JSONObject invokeJson() throws InternalException, CloudException {
ClientAndResponse clientAndResponse = null;
String content;
try {
clientAndResponse = invokeInternal();
Header contentType = clientAndResponse.response.getFirstHeader("content-type");
if (!"application/json".equalsIgnoreCase(contentType.getValue())) {
throw new CloudException("Invalid Glacier response: expected JSON");
}
final HttpEntity entity = clientAndResponse.response.getEntity();
content = EntityUtils.toString(entity);
if (content == null) {
return null;
}
return new JSONObject(content);
} catch (IOException e) {
throw new CloudException(e);
} catch (JSONException e) {
throw new CloudException(e);
} finally {
if (clientAndResponse != null) {
clientAndResponse.client.getConnectionManager().shutdown(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@InternalFunction(operator="==", precedence=10)
public Boolean eq(Object value, Object value2)
{
if (value == null && value2 == null)
{
return Boolean.TRUE;
}
if (value != null)
{
return new Boolean((value.equals(value2)));
}
return Boolean.FALSE;
} } | public class class_name {
@InternalFunction(operator="==", precedence=10)
public Boolean eq(Object value, Object value2)
{
if (value == null && value2 == null)
{
return Boolean.TRUE; // depends on control dependency: [if], data = [none]
}
if (value != null)
{
return new Boolean((value.equals(value2))); // depends on control dependency: [if], data = [(value]
}
return Boolean.FALSE;
} } |
public class class_name {
public List<V> reverseTopologicalSort() {
List<V> list = topologicalSort();
if (list == null) {
return null;
}
Collections.reverse(list);
return list;
} } | public class class_name {
public List<V> reverseTopologicalSort() {
List<V> list = topologicalSort();
if (list == null) {
return null; // depends on control dependency: [if], data = [none]
}
Collections.reverse(list);
return list;
} } |
public class class_name {
private void filter(ValueSet filterValueSet, HashMap hashmap) {
if (filterValueSet != null && hashmap != null && !filterValueSet.isEmpty() && !hashmap.isEmpty()) {
Iterator it = filterValueSet.iterator();
while (it.hasNext()) {
Object o = it.next();
if (hashmap.containsKey(o)) {
it.remove();
}
}
}
} } | public class class_name {
private void filter(ValueSet filterValueSet, HashMap hashmap) {
if (filterValueSet != null && hashmap != null && !filterValueSet.isEmpty() && !hashmap.isEmpty()) {
Iterator it = filterValueSet.iterator();
while (it.hasNext()) {
Object o = it.next();
if (hashmap.containsKey(o)) {
it.remove(); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
static Node getRootOfQualifiedName(Node qName) {
for (Node current = qName; true; current = current.getFirstChild()) {
if (current.isName() || current.isThis() || current.isSuper()) {
return current;
}
checkState(current.isGetProp(), "Not a getprop node: ", current);
}
} } | public class class_name {
static Node getRootOfQualifiedName(Node qName) {
for (Node current = qName; true; current = current.getFirstChild()) {
if (current.isName() || current.isThis() || current.isSuper()) {
return current; // depends on control dependency: [if], data = [none]
}
checkState(current.isGetProp(), "Not a getprop node: ", current); // depends on control dependency: [for], data = [current]
}
} } |
public class class_name {
public static String getConfPath() {
String classpath = CommonUtils.class.getResource("/").getPath();
String confPath = classpath + "../conf/";
if (new File(confPath).exists()) {
return confPath;
} else {
return classpath;
}
} } | public class class_name {
public static String getConfPath() {
String classpath = CommonUtils.class.getResource("/").getPath();
String confPath = classpath + "../conf/";
if (new File(confPath).exists()) {
return confPath; // depends on control dependency: [if], data = [none]
} else {
return classpath; // depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.