code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public static Supplier<Type> genericTypeOfType(final Supplier<Type> typeSupplier, final int n) {
return new Supplier<Type>() {
@Override
public Type get(VisitorState state) {
Type type = typeSupplier.get(state);
if (type.getTypeArguments().size() <= n) {
return state.getSymtab().objectType;
}
return type.getTypeArguments().get(n);
}
};
} } | public class class_name {
public static Supplier<Type> genericTypeOfType(final Supplier<Type> typeSupplier, final int n) {
return new Supplier<Type>() {
@Override
public Type get(VisitorState state) {
Type type = typeSupplier.get(state);
if (type.getTypeArguments().size() <= n) {
return state.getSymtab().objectType; // depends on control dependency: [if], data = [none]
}
return type.getTypeArguments().get(n);
}
};
} } |
public class class_name {
public String substituteLinkForUnknownTarget(
CmsObject cms,
String link,
String targetDetailPage,
boolean forceSecure) {
if (CmsStringUtil.isEmpty(link)) {
return "";
}
String sitePath = link;
String siteRoot = null;
if (hasScheme(link)) {
// the link has a scheme, that is starts with something like "http://"
// usually this should be a link to an external resource, but check anyway
sitePath = getRootPath(cms, link);
if (sitePath == null) {
// probably an external link, don't touch this
return link;
}
}
// check if we can find a site from the link
siteRoot = OpenCms.getSiteManager().getSiteRoot(sitePath);
if (siteRoot == null) {
// use current site root in case no valid site root is available
// this will also be the case if a "/system" link is used
siteRoot = cms.getRequestContext().getSiteRoot();
} else {
// we found a site root, cut this from the resource path
sitePath = sitePath.substring(siteRoot.length());
}
return substituteLink(cms, sitePath, siteRoot, targetDetailPage, forceSecure);
} } | public class class_name {
public String substituteLinkForUnknownTarget(
CmsObject cms,
String link,
String targetDetailPage,
boolean forceSecure) {
if (CmsStringUtil.isEmpty(link)) {
return ""; // depends on control dependency: [if], data = [none]
}
String sitePath = link;
String siteRoot = null;
if (hasScheme(link)) {
// the link has a scheme, that is starts with something like "http://"
// usually this should be a link to an external resource, but check anyway
sitePath = getRootPath(cms, link); // depends on control dependency: [if], data = [none]
if (sitePath == null) {
// probably an external link, don't touch this
return link; // depends on control dependency: [if], data = [none]
}
}
// check if we can find a site from the link
siteRoot = OpenCms.getSiteManager().getSiteRoot(sitePath);
if (siteRoot == null) {
// use current site root in case no valid site root is available
// this will also be the case if a "/system" link is used
siteRoot = cms.getRequestContext().getSiteRoot(); // depends on control dependency: [if], data = [none]
} else {
// we found a site root, cut this from the resource path
sitePath = sitePath.substring(siteRoot.length()); // depends on control dependency: [if], data = [(siteRoot]
}
return substituteLink(cms, sitePath, siteRoot, targetDetailPage, forceSecure);
} } |
public class class_name {
public void marshall(DeviceSelectionResult deviceSelectionResult, ProtocolMarshaller protocolMarshaller) {
if (deviceSelectionResult == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deviceSelectionResult.getFilters(), FILTERS_BINDING);
protocolMarshaller.marshall(deviceSelectionResult.getMatchedDevicesCount(), MATCHEDDEVICESCOUNT_BINDING);
protocolMarshaller.marshall(deviceSelectionResult.getMaxDevices(), MAXDEVICES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeviceSelectionResult deviceSelectionResult, ProtocolMarshaller protocolMarshaller) {
if (deviceSelectionResult == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deviceSelectionResult.getFilters(), FILTERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceSelectionResult.getMatchedDevicesCount(), MATCHEDDEVICESCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceSelectionResult.getMaxDevices(), MAXDEVICES_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 String getServerName() {
String name = this.request.getVirtualHost();
if (null == name) {
name = "localhost";
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getServerName: " + name);
}
return name;
} } | public class class_name {
@Override
public String getServerName() {
String name = this.request.getVirtualHost();
if (null == name) {
name = "localhost"; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getServerName: " + name); // depends on control dependency: [if], data = [none]
}
return name;
} } |
public class class_name {
public Writable[] call(Writable[] params, InetSocketAddress[] addresses,
Class<?> protocol, UserGroupInformation ticket)
throws IOException {
if (addresses.length == 0) return new Writable[0];
ParallelResults results = new ParallelResults(params.length);
synchronized (results) {
for (int i = 0; i < params.length; i++) {
ParallelCall call = new ParallelCall(params[i], results, i);
try {
Connection connection =
getConnection(addresses[i], protocol, ticket, 0, call);
connection.sendParam(call, false); // send each parameter
} catch (RejectedExecutionException e) {
throw new IOException("connection has been closed", e);
} catch (IOException e) {
// log errors
LOG.info("Calling "+addresses[i]+" caught: " +
e.getMessage(),e);
results.size--; // wait for one fewer result
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
LOG.warn("interrupted waiting to send params to server", e);
throw new IOException(e);
}
}
while (results.count != results.size) {
try {
results.wait(); // wait for all results
} catch (InterruptedException e) {}
}
return results.values;
}
} } | public class class_name {
public Writable[] call(Writable[] params, InetSocketAddress[] addresses,
Class<?> protocol, UserGroupInformation ticket)
throws IOException {
if (addresses.length == 0) return new Writable[0];
ParallelResults results = new ParallelResults(params.length);
synchronized (results) {
for (int i = 0; i < params.length; i++) {
ParallelCall call = new ParallelCall(params[i], results, i);
try {
Connection connection =
getConnection(addresses[i], protocol, ticket, 0, call);
connection.sendParam(call, false); // send each parameter // depends on control dependency: [try], data = [none]
} catch (RejectedExecutionException e) {
throw new IOException("connection has been closed", e);
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
// log errors
LOG.info("Calling "+addresses[i]+" caught: " +
e.getMessage(),e);
results.size--; // wait for one fewer result
} catch (InterruptedException e) { // depends on control dependency: [catch], data = [none]
Thread.currentThread().interrupt();
LOG.warn("interrupted waiting to send params to server", e);
throw new IOException(e);
} // depends on control dependency: [catch], data = [none]
}
while (results.count != results.size) {
try {
results.wait(); // wait for all results // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {} // depends on control dependency: [catch], data = [none]
}
return results.values;
}
} } |
public class class_name {
@Override
protected IIOMetadataNode getStandardTextNode() {
if (!header.getComments().isEmpty()) {
IIOMetadataNode text = new IIOMetadataNode("Text");
for (String comment : header.getComments()) {
IIOMetadataNode textEntry = new IIOMetadataNode("TextEntry");
textEntry.setAttribute("keyword", "comment");
textEntry.setAttribute("value", comment);
text.appendChild(textEntry);
}
return text;
}
return null;
} } | public class class_name {
@Override
protected IIOMetadataNode getStandardTextNode() {
if (!header.getComments().isEmpty()) {
IIOMetadataNode text = new IIOMetadataNode("Text");
for (String comment : header.getComments()) {
IIOMetadataNode textEntry = new IIOMetadataNode("TextEntry");
textEntry.setAttribute("keyword", "comment"); // depends on control dependency: [for], data = [comment]
textEntry.setAttribute("value", comment); // depends on control dependency: [for], data = [comment]
text.appendChild(textEntry); // depends on control dependency: [for], data = [none]
}
return text; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void start( Class<? extends Easing> clazz, EaseType type, double fromValue, double endValue, int durationMillis, long delayMillis ) {
if ( !mRunning ) {
mEasing = createInstance( clazz );
if( null == mEasing ){
return;
}
mMethod = getEasingMethod( mEasing, type );
if( mMethod == null ){
return;
}
mInverted = fromValue > endValue;
if( mInverted ){
mStartValue = endValue;
mEndValue = fromValue;
} else {
mStartValue = fromValue;
mEndValue = endValue;
}
mValue = mStartValue;
mDuration = durationMillis;
mBase = SystemClock.uptimeMillis() + delayMillis;
mRunning = true;
mTicker = new Ticker();
long next = SystemClock.uptimeMillis() + FRAME_TIME + delayMillis;
if( delayMillis == 0 ) {
mEasingCallback.onEasingStarted( fromValue );
} else {
mHandler.postAtTime( new TickerStart( fromValue ), mToken, next - FRAME_TIME );
}
mHandler.postAtTime( mTicker, mToken, next );
}
} } | public class class_name {
public void start( Class<? extends Easing> clazz, EaseType type, double fromValue, double endValue, int durationMillis, long delayMillis ) {
if ( !mRunning ) {
mEasing = createInstance( clazz ); // depends on control dependency: [if], data = [none]
if( null == mEasing ){
return; // depends on control dependency: [if], data = [none]
}
mMethod = getEasingMethod( mEasing, type ); // depends on control dependency: [if], data = [none]
if( mMethod == null ){
return; // depends on control dependency: [if], data = [none]
}
mInverted = fromValue > endValue; // depends on control dependency: [if], data = [none]
if( mInverted ){
mStartValue = endValue; // depends on control dependency: [if], data = [none]
mEndValue = fromValue; // depends on control dependency: [if], data = [none]
} else {
mStartValue = fromValue; // depends on control dependency: [if], data = [none]
mEndValue = endValue; // depends on control dependency: [if], data = [none]
}
mValue = mStartValue; // depends on control dependency: [if], data = [none]
mDuration = durationMillis; // depends on control dependency: [if], data = [none]
mBase = SystemClock.uptimeMillis() + delayMillis; // depends on control dependency: [if], data = [none]
mRunning = true; // depends on control dependency: [if], data = [none]
mTicker = new Ticker(); // depends on control dependency: [if], data = [none]
long next = SystemClock.uptimeMillis() + FRAME_TIME + delayMillis;
if( delayMillis == 0 ) {
mEasingCallback.onEasingStarted( fromValue ); // depends on control dependency: [if], data = [none]
} else {
mHandler.postAtTime( new TickerStart( fromValue ), mToken, next - FRAME_TIME ); // depends on control dependency: [if], data = [none]
}
mHandler.postAtTime( mTicker, mToken, next ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private List<File> scanFileSets() {
final List<File> list = new ArrayList<File>();
for (int i = 0; i < fileSets.size(); i++) {
FileSet fs = fileSets.get(i);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
ds.scan();
String[] names = ds.getIncludedFiles();
for (String element : names) {
list.add(new File(ds.getBasedir(), element));
}
}
return list;
} } | public class class_name {
private List<File> scanFileSets() {
final List<File> list = new ArrayList<File>();
for (int i = 0; i < fileSets.size(); i++) {
FileSet fs = fileSets.get(i);
DirectoryScanner ds = fs.getDirectoryScanner(getProject());
ds.scan(); // depends on control dependency: [for], data = [none]
String[] names = ds.getIncludedFiles();
for (String element : names) {
list.add(new File(ds.getBasedir(), element)); // depends on control dependency: [for], data = [element]
}
}
return list;
} } |
public class class_name {
private String getPatternCode(final List<Token> tokens) {
final StringBuilder sb = new StringBuilder();
sb.append(tokens.size());
for (final Token token : tokens) {
sb.append(token.getType().ordinal());
}
return sb.toString();
} } | public class class_name {
private String getPatternCode(final List<Token> tokens) {
final StringBuilder sb = new StringBuilder();
sb.append(tokens.size());
for (final Token token : tokens) {
sb.append(token.getType().ordinal()); // depends on control dependency: [for], data = [token]
}
return sb.toString();
} } |
public class class_name {
private boolean notifyPersistentConnectionListener(HttpMessage httpMessage, Socket inSocket, ZapGetMethod method) {
boolean keepSocketOpen = false;
PersistentConnectionListener listener = null;
synchronized (persistentConnectionListener) {
for (int i = 0; i < persistentConnectionListener.size(); i++) {
listener = persistentConnectionListener.get(i);
try {
if (listener.onHandshakeResponse(httpMessage, inSocket, method)) {
// inform as long as one listener wishes to overtake the connection
keepSocketOpen = true;
break;
}
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
}
}
return keepSocketOpen;
} } | public class class_name {
private boolean notifyPersistentConnectionListener(HttpMessage httpMessage, Socket inSocket, ZapGetMethod method) {
boolean keepSocketOpen = false;
PersistentConnectionListener listener = null;
synchronized (persistentConnectionListener) {
for (int i = 0; i < persistentConnectionListener.size(); i++) {
listener = persistentConnectionListener.get(i);
// depends on control dependency: [for], data = [i]
try {
if (listener.onHandshakeResponse(httpMessage, inSocket, method)) {
// inform as long as one listener wishes to overtake the connection
keepSocketOpen = true;
// depends on control dependency: [if], data = [none]
break;
}
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
// depends on control dependency: [catch], data = [none]
}
}
return keepSocketOpen;
} } |
public class class_name {
private void waitForConnected() {
debug("GuestNode#waitForConnected(): Waiting for all the clusters connected");
while (true) {
boolean connected = true;
for (Object fromKey : clustersProperties.keySet()) {
String fromClusterName = (String) fromKey;
for (Object toKey : clustersProperties.keySet()) {
String toClusterName = (String) toKey;
if (fromClusterName.equals(toClusterName)) {
continue;
}
Long receivedAt = region.get(createReceivedAtKey(
fromClusterName, toClusterName));
if (receivedAt == null) {
connected = false;
break;
}
}
}
if (connected) {
break;
}
try {
TimeUnit.MILLISECONDS.sleep(CHECK_PERIOD);
} catch (InterruptedException e) {
}
}
debug("GuestNode#waitForConnected(): All the clusters connected");
} } | public class class_name {
private void waitForConnected() {
debug("GuestNode#waitForConnected(): Waiting for all the clusters connected");
while (true) {
boolean connected = true;
for (Object fromKey : clustersProperties.keySet()) {
String fromClusterName = (String) fromKey;
for (Object toKey : clustersProperties.keySet()) {
String toClusterName = (String) toKey;
if (fromClusterName.equals(toClusterName)) {
continue;
}
Long receivedAt = region.get(createReceivedAtKey(
fromClusterName, toClusterName));
if (receivedAt == null) {
connected = false; // depends on control dependency: [if], data = [none]
break;
}
}
}
if (connected) {
break;
}
try {
TimeUnit.MILLISECONDS.sleep(CHECK_PERIOD); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
} // depends on control dependency: [catch], data = [none]
}
debug("GuestNode#waitForConnected(): All the clusters connected");
} } |
public class class_name {
public String getOwnerName(CmsObject cms) {
try {
return CmsPrincipal.readPrincipalIncludingHistory(cms, getOwnerId()).getName();
} catch (CmsException e) {
return getOwnerId().toString();
}
} } | public class class_name {
public String getOwnerName(CmsObject cms) {
try {
return CmsPrincipal.readPrincipalIncludingHistory(cms, getOwnerId()).getName(); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
return getOwnerId().toString();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static void append(Appendable outputBuf, SoyValue value, SoyNode node) {
try {
value.render(outputBuf);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (RenderException e) {
throw e.addStackTraceElement(node);
}
} } | public class class_name {
static void append(Appendable outputBuf, SoyValue value, SoyNode node) {
try {
value.render(outputBuf); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} catch (RenderException e) { // depends on control dependency: [catch], data = [none]
throw e.addStackTraceElement(node);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
if (this.sarlAnnotationType == null) {
this.container = container;
this.sarlAnnotationType = SarlFactory.eINSTANCE.createSarlAnnotationType();
container.getMembers().add(this.sarlAnnotationType);
if (!Strings.isEmpty(name)) {
this.sarlAnnotationType.setName(name);
}
}
} } | public class class_name {
public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
if (this.sarlAnnotationType == null) {
this.container = container; // depends on control dependency: [if], data = [none]
this.sarlAnnotationType = SarlFactory.eINSTANCE.createSarlAnnotationType(); // depends on control dependency: [if], data = [none]
container.getMembers().add(this.sarlAnnotationType); // depends on control dependency: [if], data = [(this.sarlAnnotationType]
if (!Strings.isEmpty(name)) {
this.sarlAnnotationType.setName(name); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected Class<?> getSubClass(Class<?> ancestor, Class<?> descendant) {
if (ancestor == descendant) {
return null;
}
if (!ancestor.isAssignableFrom(descendant)) {
return null;
}
Class<?> child = descendant;
if (ancestor.isInterface()) {
while (true) {
for (Class<?> childInterface : child.getInterfaces()) {
if (childInterface == ancestor) {
return child;
} else if (ancestor.isAssignableFrom(childInterface)) {
child = childInterface;
break;
}
}
}
} else {
Class<?> parent = child.getSuperclass();
while (parent != ancestor) {
child = parent;
parent = child.getSuperclass();
}
return child;
}
} } | public class class_name {
protected Class<?> getSubClass(Class<?> ancestor, Class<?> descendant) {
if (ancestor == descendant) {
return null;
}
if (!ancestor.isAssignableFrom(descendant)) {
return null;
}
Class<?> child = descendant;
if (ancestor.isInterface()) {
while (true) {
for (Class<?> childInterface : child.getInterfaces()) {
if (childInterface == ancestor) {
return child; // depends on control dependency: [if], data = [none]
} else if (ancestor.isAssignableFrom(childInterface)) {
child = childInterface; // depends on control dependency: [if], data = [none]
break;
}
}
}
} else {
Class<?> parent = child.getSuperclass();
while (parent != ancestor) {
child = parent; // depends on control dependency: [while], data = [none]
parent = child.getSuperclass(); // depends on control dependency: [while], data = [none]
}
return child;
}
} } |
public class class_name {
protected Paint getPolygonFillPaint(FeatureStyle featureStyle) {
Paint paint = null;
boolean hasStyleColor = false;
if (featureStyle != null) {
StyleRow style = featureStyle.getStyle();
if (style != null) {
if (style.hasFillColor()) {
paint = getStylePaint(style, FeatureDrawType.FILL);
} else {
hasStyleColor = style.hasColor();
}
}
}
if (paint == null && !hasStyleColor && fillPolygon) {
paint = polygonFillPaint;
}
return paint;
} } | public class class_name {
protected Paint getPolygonFillPaint(FeatureStyle featureStyle) {
Paint paint = null;
boolean hasStyleColor = false;
if (featureStyle != null) {
StyleRow style = featureStyle.getStyle();
if (style != null) {
if (style.hasFillColor()) {
paint = getStylePaint(style, FeatureDrawType.FILL); // depends on control dependency: [if], data = [none]
} else {
hasStyleColor = style.hasColor(); // depends on control dependency: [if], data = [none]
}
}
}
if (paint == null && !hasStyleColor && fillPolygon) {
paint = polygonFillPaint; // depends on control dependency: [if], data = [none]
}
return paint;
} } |
public class class_name {
public String urlDecode(String original)
{
try
{
return URLDecoder.decode(original, _characterEncoding);
}
catch(UnsupportedEncodingException e)
{
throw new RuntimeException(e);
}
} } | public class class_name {
public String urlDecode(String original)
{
try
{
return URLDecoder.decode(original, _characterEncoding); // depends on control dependency: [try], data = [none]
}
catch(UnsupportedEncodingException e)
{
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
protected void doStop() {
try {
KieScanner scanner = ((KieScanner)(_perRequestRuntimeManager.getRuntimeEngine().getKieSession().getEnvironment().get("KieScanner")));
if (scanner != null) {
try {
scanner.stop();
scanner.shutdown();
} catch (Throwable t) {
CommonKnowledgeLogger.ROOT_LOGGER.problemStopppingKieScanner(t.getMessage());
} finally {
String releaseId = super.getModel().getManifest().getContainer().getReleaseId();
if (releaseId != null && !releaseId.trim().equals("")) {
KieServices _kieServices = KieServices.Factory.get();
// fix for SWITCHYARD-2241
_kieServices.getRepository().removeKieModule(ContainerManifest.toReleaseId(releaseId));
}
}
}
_perRequestRuntimeManager.close();
} finally {
try {
disposeSingletonRuntimeEngine();
} finally {
super.doStop();
}
}
} } | public class class_name {
@Override
protected void doStop() {
try {
KieScanner scanner = ((KieScanner)(_perRequestRuntimeManager.getRuntimeEngine().getKieSession().getEnvironment().get("KieScanner")));
if (scanner != null) {
try {
scanner.stop(); // depends on control dependency: [try], data = [none]
scanner.shutdown(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
CommonKnowledgeLogger.ROOT_LOGGER.problemStopppingKieScanner(t.getMessage());
} finally { // depends on control dependency: [catch], data = [none]
String releaseId = super.getModel().getManifest().getContainer().getReleaseId();
if (releaseId != null && !releaseId.trim().equals("")) {
KieServices _kieServices = KieServices.Factory.get();
// fix for SWITCHYARD-2241
_kieServices.getRepository().removeKieModule(ContainerManifest.toReleaseId(releaseId)); // depends on control dependency: [if], data = [(releaseId]
}
}
}
_perRequestRuntimeManager.close(); // depends on control dependency: [try], data = [none]
} finally {
try {
disposeSingletonRuntimeEngine(); // depends on control dependency: [try], data = [none]
} finally {
super.doStop();
}
}
} } |
public class class_name {
@Override
public synchronized Map<URI, MatchResult> listMatchesWithinRange(URI origin, MatchType minType, MatchType maxType) {
if (origin == null || minType == null | maxType == null) {
return ImmutableMap.of();
}
Function<MatchResult, MatchType> getTypeFunction = new Function<MatchResult, MatchType>() {
@Override
public MatchType apply(@Nullable MatchResult matchResult) {
if (matchResult != null) {
return matchResult.getMatchType();
}
return null;
}
};
// Get all the matches
Map<URI, MatchResult> matches = this.indexedMatches.get(origin);
// Return an immutable map out of the filtered view. Drop copyOf to obtain a live view
if (matches != null) {
return ImmutableMap.copyOf(Maps.filterValues(matches, MatchResultPredicates.withinRange(minType, BoundType.CLOSED, maxType, BoundType.CLOSED)));
} else {
return ImmutableMap.of();
}
} } | public class class_name {
@Override
public synchronized Map<URI, MatchResult> listMatchesWithinRange(URI origin, MatchType minType, MatchType maxType) {
if (origin == null || minType == null | maxType == null) {
return ImmutableMap.of(); // depends on control dependency: [if], data = [none]
}
Function<MatchResult, MatchType> getTypeFunction = new Function<MatchResult, MatchType>() {
@Override
public MatchType apply(@Nullable MatchResult matchResult) {
if (matchResult != null) {
return matchResult.getMatchType(); // depends on control dependency: [if], data = [none]
}
return null;
}
};
// Get all the matches
Map<URI, MatchResult> matches = this.indexedMatches.get(origin);
// Return an immutable map out of the filtered view. Drop copyOf to obtain a live view
if (matches != null) {
return ImmutableMap.copyOf(Maps.filterValues(matches, MatchResultPredicates.withinRange(minType, BoundType.CLOSED, maxType, BoundType.CLOSED))); // depends on control dependency: [if], data = [(matches]
} else {
return ImmutableMap.of(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("WeakerAccess")
@Internal
protected final Collection getBeansOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, MethodInjectionPoint injectionPoint, Argument argument) {
return resolveBeanWithGenericsFromMethodArgument(resolutionContext, injectionPoint, argument, (beanType, qualifier) -> {
boolean hasNoGenerics = !argument.getType().isArray() && argument.getTypeVariables().isEmpty();
if (hasNoGenerics) {
return ((DefaultBeanContext) context).getBean(resolutionContext, beanType, qualifier);
} else {
return ((DefaultBeanContext) context).getBeansOfType(resolutionContext, beanType, qualifier);
}
}
);
} } | public class class_name {
@SuppressWarnings("WeakerAccess")
@Internal
protected final Collection getBeansOfTypeForMethodArgument(BeanResolutionContext resolutionContext, BeanContext context, MethodInjectionPoint injectionPoint, Argument argument) {
return resolveBeanWithGenericsFromMethodArgument(resolutionContext, injectionPoint, argument, (beanType, qualifier) -> {
boolean hasNoGenerics = !argument.getType().isArray() && argument.getTypeVariables().isEmpty();
if (hasNoGenerics) {
return ((DefaultBeanContext) context).getBean(resolutionContext, beanType, qualifier); // depends on control dependency: [if], data = [none]
} else {
return ((DefaultBeanContext) context).getBeansOfType(resolutionContext, beanType, qualifier); // depends on control dependency: [if], data = [none]
}
}
);
} } |
public class class_name {
public static <T extends GraphNode<T>, C extends Collection<T>> C collectAllNodes(T node, C collection) {
// we don't recurse if the collecion already contains the node
// this costs a bit of performance but prevents infinite recursion in the case of graph cycles
checkArgNotNull(collection, "collection");
if (node != null && !collection.contains(node)) {
collection.add(node);
for (T child : node.getChildren()) {
collectAllNodes(child, collection);
}
}
return collection;
} } | public class class_name {
public static <T extends GraphNode<T>, C extends Collection<T>> C collectAllNodes(T node, C collection) {
// we don't recurse if the collecion already contains the node
// this costs a bit of performance but prevents infinite recursion in the case of graph cycles
checkArgNotNull(collection, "collection");
if (node != null && !collection.contains(node)) {
collection.add(node); // depends on control dependency: [if], data = [(node]
for (T child : node.getChildren()) {
collectAllNodes(child, collection); // depends on control dependency: [for], data = [child]
}
}
return collection;
} } |
public class class_name {
public TypeQualifierAnnotation getReturnValue(MethodDescriptor methodDesc, TypeQualifierValue<?> tqv) {
//
// TODO: handling of overridden methods?
//
Map<TypeQualifierValue<?>, TypeQualifierAnnotation> map = returnValueMap.get(methodDesc);
if (map == null) {
return null;
}
return map.get(tqv);
} } | public class class_name {
public TypeQualifierAnnotation getReturnValue(MethodDescriptor methodDesc, TypeQualifierValue<?> tqv) {
//
// TODO: handling of overridden methods?
//
Map<TypeQualifierValue<?>, TypeQualifierAnnotation> map = returnValueMap.get(methodDesc);
if (map == null) {
return null; // depends on control dependency: [if], data = [none]
}
return map.get(tqv);
} } |
public class class_name {
private Set<GraphQLType> buildAdditionalTypes(BuildContext buildCtx) {
Set<GraphQLType> additionalTypes = new LinkedHashSet<>();
TypeDefinitionRegistry typeRegistry = buildCtx.getTypeRegistry();
typeRegistry.types().values().forEach(typeDefinition -> {
TypeName typeName = TypeName.newTypeName().name(typeDefinition.getName()).build();
if (typeDefinition instanceof InputObjectTypeDefinition) {
if (buildCtx.hasInputType(typeDefinition) == null) {
additionalTypes.add(buildInputType(buildCtx, typeName));
}
} else {
if (buildCtx.hasOutputType(typeDefinition) == null) {
additionalTypes.add(buildOutputType(buildCtx, typeName));
}
}
});
return additionalTypes;
} } | public class class_name {
private Set<GraphQLType> buildAdditionalTypes(BuildContext buildCtx) {
Set<GraphQLType> additionalTypes = new LinkedHashSet<>();
TypeDefinitionRegistry typeRegistry = buildCtx.getTypeRegistry();
typeRegistry.types().values().forEach(typeDefinition -> {
TypeName typeName = TypeName.newTypeName().name(typeDefinition.getName()).build();
if (typeDefinition instanceof InputObjectTypeDefinition) {
if (buildCtx.hasInputType(typeDefinition) == null) {
additionalTypes.add(buildInputType(buildCtx, typeName)); // depends on control dependency: [if], data = [none]
}
} else {
if (buildCtx.hasOutputType(typeDefinition) == null) {
additionalTypes.add(buildOutputType(buildCtx, typeName)); // depends on control dependency: [if], data = [none]
}
}
});
return additionalTypes;
} } |
public class class_name {
void addClassAnnotation(final AnnotationInfo classAnnotationInfo,
final Map<String, ClassInfo> classNameToClassInfo) {
final ClassInfo annotationClassInfo = getOrCreateClassInfo(classAnnotationInfo.getName(),
ANNOTATION_CLASS_MODIFIER, classNameToClassInfo);
if (this.annotationInfo == null) {
this.annotationInfo = new AnnotationInfoList(2);
}
this.annotationInfo.add(classAnnotationInfo);
this.addRelatedClass(RelType.CLASS_ANNOTATIONS, annotationClassInfo);
annotationClassInfo.addRelatedClass(RelType.CLASSES_WITH_ANNOTATION, this);
// Record use of @Inherited meta-annotation
if (classAnnotationInfo.getName().equals(Inherited.class.getName())) {
isInherited = true;
}
} } | public class class_name {
void addClassAnnotation(final AnnotationInfo classAnnotationInfo,
final Map<String, ClassInfo> classNameToClassInfo) {
final ClassInfo annotationClassInfo = getOrCreateClassInfo(classAnnotationInfo.getName(),
ANNOTATION_CLASS_MODIFIER, classNameToClassInfo);
if (this.annotationInfo == null) {
this.annotationInfo = new AnnotationInfoList(2); // depends on control dependency: [if], data = [none]
}
this.annotationInfo.add(classAnnotationInfo);
this.addRelatedClass(RelType.CLASS_ANNOTATIONS, annotationClassInfo);
annotationClassInfo.addRelatedClass(RelType.CLASSES_WITH_ANNOTATION, this);
// Record use of @Inherited meta-annotation
if (classAnnotationInfo.getName().equals(Inherited.class.getName())) {
isInherited = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setValue(String newStyle) {
for (UIObject ui : m_uis) {
if (m_style != null) {
ui.removeStyleName(m_style);
}
if (newStyle != null) {
ui.addStyleName(newStyle);
}
}
m_style = newStyle;
} } | public class class_name {
public void setValue(String newStyle) {
for (UIObject ui : m_uis) {
if (m_style != null) {
ui.removeStyleName(m_style); // depends on control dependency: [if], data = [(m_style]
}
if (newStyle != null) {
ui.addStyleName(newStyle); // depends on control dependency: [if], data = [(newStyle]
}
}
m_style = newStyle;
} } |
public class class_name {
public void resetEditButtons() {
removeEditButtonsPositionTimer();
m_editButtonsPositionTimer = new Timer() {
/** Timer run counter. */
private int m_timerRuns;
@Override
public void run() {
for (org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer container : m_targetContainers.values()) {
container.showEditableListButtons();
container.updateOptionBars();
}
if (m_timerRuns > 3) {
cancel();
}
m_timerRuns++;
}
};
m_editButtonsPositionTimer.scheduleRepeating(100);
} } | public class class_name {
public void resetEditButtons() {
removeEditButtonsPositionTimer();
m_editButtonsPositionTimer = new Timer() {
/** Timer run counter. */
private int m_timerRuns;
@Override
public void run() {
for (org.opencms.ade.containerpage.client.ui.CmsContainerPageContainer container : m_targetContainers.values()) {
container.showEditableListButtons(); // depends on control dependency: [for], data = [container]
container.updateOptionBars(); // depends on control dependency: [for], data = [container]
}
if (m_timerRuns > 3) {
cancel(); // depends on control dependency: [if], data = [none]
}
m_timerRuns++;
}
};
m_editButtonsPositionTimer.scheduleRepeating(100);
} } |
public class class_name {
@NotNull
String getPartialPath() {
if (pos == -1 || pos > pathEnd) {
return "/";
}
return raw.substring(pos, pathEnd);
} } | public class class_name {
@NotNull
String getPartialPath() {
if (pos == -1 || pos > pathEnd) {
return "/"; // depends on control dependency: [if], data = [none]
}
return raw.substring(pos, pathEnd);
} } |
public class class_name {
public static String getClassConstantFieldName(Class<?> klass) // d676434
{
String dollarName = klass.getName().replace('.', '$');
if (dollarName.startsWith("["))
{
if (dollarName.endsWith(";"))
{
// Remove trailing ";" from "[Ljava$lang$String;".
dollarName = dollarName.substring(0, dollarName.length() - 1);
}
return "array" + dollarName.replace('[', '$');
}
return "class$" + dollarName;
} } | public class class_name {
public static String getClassConstantFieldName(Class<?> klass) // d676434
{
String dollarName = klass.getName().replace('.', '$');
if (dollarName.startsWith("["))
{
if (dollarName.endsWith(";"))
{
// Remove trailing ";" from "[Ljava$lang$String;".
dollarName = dollarName.substring(0, dollarName.length() - 1); // depends on control dependency: [if], data = [none]
}
return "array" + dollarName.replace('[', '$'); // depends on control dependency: [if], data = [none]
}
return "class$" + dollarName;
} } |
public class class_name {
public static <K,V> Map<V,K> array_flip(Map<K,V> map) {
Map<V,K> flipped = new HashMap<>();
for(Map.Entry<K,V> entry : map.entrySet()) {
flipped.put(entry.getValue(), entry.getKey());
}
return flipped;
} } | public class class_name {
public static <K,V> Map<V,K> array_flip(Map<K,V> map) {
Map<V,K> flipped = new HashMap<>();
for(Map.Entry<K,V> entry : map.entrySet()) {
flipped.put(entry.getValue(), entry.getKey()); // depends on control dependency: [for], data = [entry]
}
return flipped;
} } |
public class class_name {
public static LocationModel getLocationByCoordinates(Double latitude, Double longitude ){
try {
Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(QuickUtils.getContext());
addresses = geocoder.getFromLocation(latitude, longitude, 1);
LocationModel locationModel = new LocationModel();
locationModel.latitude = latitude;
locationModel.longitude = longitude;
try{
locationModel.address = addresses.get(0).getAddressLine(0);
}catch(Exception ex){
QuickUtils.log.e("empty address");
}
try{
locationModel.city = addresses.get(0).getAddressLine(1);
}catch(Exception ex){
QuickUtils.log.e("empty city");
}
try{
locationModel.country = addresses.get(0).getAddressLine(2);
}catch(Exception ex){
QuickUtils.log.e("empty country");
}
return locationModel;
} catch (IOException e) {
QuickUtils.log.e("empty location");
return new LocationModel();
}
} } | public class class_name {
public static LocationModel getLocationByCoordinates(Double latitude, Double longitude ){
try {
Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(QuickUtils.getContext()); // depends on control dependency: [try], data = [none]
addresses = geocoder.getFromLocation(latitude, longitude, 1); // depends on control dependency: [try], data = [none]
LocationModel locationModel = new LocationModel();
locationModel.latitude = latitude; // depends on control dependency: [try], data = [none]
locationModel.longitude = longitude; // depends on control dependency: [try], data = [none]
try{
locationModel.address = addresses.get(0).getAddressLine(0); // depends on control dependency: [try], data = [none]
}catch(Exception ex){
QuickUtils.log.e("empty address");
} // depends on control dependency: [catch], data = [none]
try{
locationModel.city = addresses.get(0).getAddressLine(1); // depends on control dependency: [try], data = [none]
}catch(Exception ex){
QuickUtils.log.e("empty city");
} // depends on control dependency: [catch], data = [none]
try{
locationModel.country = addresses.get(0).getAddressLine(2); // depends on control dependency: [try], data = [none]
}catch(Exception ex){
QuickUtils.log.e("empty country");
} // depends on control dependency: [catch], data = [none]
return locationModel; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
QuickUtils.log.e("empty location");
return new LocationModel();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static Image imageFromMatrix(BitMatrix matrix) {
int height = matrix.getHeight();
int width = matrix.getWidth();
WritableImage image = new WritableImage(width, height);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
Color color = matrix.get(x,y) ? Color.BLACK : Color.WHITE;
image.getPixelWriter().setColor(x, y, color);
}
}
return image;
} } | public class class_name {
private static Image imageFromMatrix(BitMatrix matrix) {
int height = matrix.getHeight();
int width = matrix.getWidth();
WritableImage image = new WritableImage(width, height);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
Color color = matrix.get(x,y) ? Color.BLACK : Color.WHITE;
image.getPixelWriter().setColor(x, y, color); // depends on control dependency: [for], data = [x]
}
}
return image;
} } |
public class class_name {
private SupertypeQueryResults computeSupertypes(ClassDescriptor classDescriptor) // throws
// ClassNotFoundException
{
if (DEBUG_QUERIES) {
System.out.println("Computing supertypes for " + classDescriptor.toDottedClassName());
}
// Try to fully resolve the class and its superclasses/superinterfaces.
ClassVertex typeVertex = optionallyResolveClassVertex(classDescriptor);
// Create new empty SupertypeQueryResults.
SupertypeQueryResults supertypeSet = new SupertypeQueryResults();
// Add all known superclasses/superinterfaces.
// The ClassVertexes for all of them should be in the
// InheritanceGraph by now.
LinkedList<ClassVertex> workList = new LinkedList<>();
workList.addLast(typeVertex);
while (!workList.isEmpty()) {
ClassVertex vertex = workList.removeFirst();
supertypeSet.addSupertype(vertex.getClassDescriptor());
if (vertex.isResolved()) {
if (DEBUG_QUERIES) {
System.out.println(" Adding supertype " + vertex.getClassDescriptor().toDottedClassName());
}
} else {
if (DEBUG_QUERIES) {
System.out.println(" Encountered unresolved class " + vertex.getClassDescriptor().toDottedClassName()
+ " in supertype query");
}
supertypeSet.setEncounteredMissingClasses(true);
}
Iterator<InheritanceEdge> i = graph.outgoingEdgeIterator(vertex);
while (i.hasNext()) {
InheritanceEdge edge = i.next();
workList.addLast(edge.getTarget());
}
}
return supertypeSet;
} } | public class class_name {
private SupertypeQueryResults computeSupertypes(ClassDescriptor classDescriptor) // throws
// ClassNotFoundException
{
if (DEBUG_QUERIES) {
System.out.println("Computing supertypes for " + classDescriptor.toDottedClassName()); // depends on control dependency: [if], data = [none]
}
// Try to fully resolve the class and its superclasses/superinterfaces.
ClassVertex typeVertex = optionallyResolveClassVertex(classDescriptor);
// Create new empty SupertypeQueryResults.
SupertypeQueryResults supertypeSet = new SupertypeQueryResults();
// Add all known superclasses/superinterfaces.
// The ClassVertexes for all of them should be in the
// InheritanceGraph by now.
LinkedList<ClassVertex> workList = new LinkedList<>();
workList.addLast(typeVertex);
while (!workList.isEmpty()) {
ClassVertex vertex = workList.removeFirst();
supertypeSet.addSupertype(vertex.getClassDescriptor()); // depends on control dependency: [while], data = [none]
if (vertex.isResolved()) {
if (DEBUG_QUERIES) {
System.out.println(" Adding supertype " + vertex.getClassDescriptor().toDottedClassName()); // depends on control dependency: [if], data = [none]
}
} else {
if (DEBUG_QUERIES) {
System.out.println(" Encountered unresolved class " + vertex.getClassDescriptor().toDottedClassName()
+ " in supertype query"); // depends on control dependency: [if], data = [none]
}
supertypeSet.setEncounteredMissingClasses(true); // depends on control dependency: [if], data = [none]
}
Iterator<InheritanceEdge> i = graph.outgoingEdgeIterator(vertex);
while (i.hasNext()) {
InheritanceEdge edge = i.next();
workList.addLast(edge.getTarget()); // depends on control dependency: [while], data = [none]
}
}
return supertypeSet;
} } |
public class class_name {
public PactDslRequestWithPath bodyWithSingleQuotes(String body) {
if (body != null) {
body = QuoteUtil.convert(body);
}
return body(body);
} } | public class class_name {
public PactDslRequestWithPath bodyWithSingleQuotes(String body) {
if (body != null) {
body = QuoteUtil.convert(body); // depends on control dependency: [if], data = [(body]
}
return body(body);
} } |
public class class_name {
private boolean closeAllWindows(SwingFrame navigationFrameView) {
// Die umgekehrte Reihenfolge fühlt sich beim Schliessen natürlicher an
for (int i = navigationFrames.size()-1; i>= 0; i--) {
SwingFrame frameView = navigationFrames.get(i);
if (!frameView.tryToCloseWindow()) return false;
removeNavigationFrameView(frameView);
}
return true;
} } | public class class_name {
private boolean closeAllWindows(SwingFrame navigationFrameView) {
// Die umgekehrte Reihenfolge fühlt sich beim Schliessen natürlicher an
for (int i = navigationFrames.size()-1; i>= 0; i--) {
SwingFrame frameView = navigationFrames.get(i);
if (!frameView.tryToCloseWindow()) return false;
removeNavigationFrameView(frameView); // depends on control dependency: [for], data = [none]
}
return true;
} } |
public class class_name {
public MetricDatum withValues(Double... values) {
if (this.values == null) {
setValues(new com.amazonaws.internal.SdkInternalList<Double>(values.length));
}
for (Double ele : values) {
this.values.add(ele);
}
return this;
} } | public class class_name {
public MetricDatum withValues(Double... values) {
if (this.values == null) {
setValues(new com.amazonaws.internal.SdkInternalList<Double>(values.length)); // depends on control dependency: [if], data = [none]
}
for (Double ele : values) {
this.values.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public double distance(Synset synset1, Synset synset2) {
Preconditions.checkNotNull(synset1);
Preconditions.checkNotNull(synset2);
if (synset1.equals(synset2)) {
return 0d;
}
List<Synset> path = shortestPath(synset1, synset2);
return path.isEmpty() ? Double.POSITIVE_INFINITY : path.size() - 1;
} } | public class class_name {
public double distance(Synset synset1, Synset synset2) {
Preconditions.checkNotNull(synset1);
Preconditions.checkNotNull(synset2);
if (synset1.equals(synset2)) {
return 0d; // depends on control dependency: [if], data = [none]
}
List<Synset> path = shortestPath(synset1, synset2);
return path.isEmpty() ? Double.POSITIVE_INFINITY : path.size() - 1;
} } |
public class class_name {
public void register(ICalPropertyScribe<? extends ICalProperty> scribe) {
for (ICalVersion version : ICalVersion.values()) {
experimentalPropByName.put(propertyNameKey(scribe, version), scribe);
}
experimentalPropByClass.put(scribe.getPropertyClass(), scribe);
experimentalPropByQName.put(scribe.getQName(), scribe);
} } | public class class_name {
public void register(ICalPropertyScribe<? extends ICalProperty> scribe) {
for (ICalVersion version : ICalVersion.values()) {
experimentalPropByName.put(propertyNameKey(scribe, version), scribe); // depends on control dependency: [for], data = [version]
}
experimentalPropByClass.put(scribe.getPropertyClass(), scribe);
experimentalPropByQName.put(scribe.getQName(), scribe);
} } |
public class class_name {
@Override
public Cipher encrypt() {
try {
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, getKey());
return cipher;
} catch (GeneralSecurityException e) {
throw new AssertionError(e);
}
} } | public class class_name {
@Override
public Cipher encrypt() {
try {
Cipher cipher = Cipher.getInstance(ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, getKey()); // depends on control dependency: [try], data = [none]
return cipher; // depends on control dependency: [try], data = [none]
} catch (GeneralSecurityException e) {
throw new AssertionError(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean isPreviewSessionExpired(){
Long urlCreationTime = getUrlCreationTime();
if (urlCreationTime == null){
return true;
}
return (System.currentTimeMillis() - urlCreationTime) < (60 * 60 * 1000);
} } | public class class_name {
public boolean isPreviewSessionExpired(){
Long urlCreationTime = getUrlCreationTime();
if (urlCreationTime == null){
return true; // depends on control dependency: [if], data = [none]
}
return (System.currentTimeMillis() - urlCreationTime) < (60 * 60 * 1000);
} } |
public class class_name {
protected Object[] waitForValues(String[] filterProps, String[] endWaitProps, Object[][] expectedVals) throws InvalidProperty, RuntimeFault, RemoteException {
String version = "";
Object[] endVals = new Object[endWaitProps.length];
Object[] filterVals = new Object[filterProps.length];
ObjectSpec oSpec = PropertyCollectorUtil.creatObjectSpec(
getMOR(), Boolean.FALSE, null);
PropertySpec pSpec = PropertyCollectorUtil.createPropertySpec(
getMOR().getType(),
filterProps == null || filterProps.length == 0, //if true, all props of this obj are to be read regardless of propName
filterProps);
PropertyFilterSpec spec = new PropertyFilterSpec();
spec.setObjectSet(new ObjectSpec[]{oSpec});
spec.setPropSet(new PropertySpec[]{pSpec});
PropertyCollector pc = serverConnection.getServiceInstance().getPropertyCollector();
PropertyFilter pf = pc.createFilter(spec, true);
boolean reached = false;
while (!reached) {
// Updated to waitForUpdatesEx as of 5.5.06-dev
UpdateSet updateset = pc.waitForUpdatesEx(version, null);
if (updateset == null) {
continue;
}
version = updateset.getVersion();
PropertyFilterUpdate[] filtupary = updateset.getFilterSet();
if (filtupary == null) {
continue;
}
// Make this code more general purpose when PropCol changes later.
for (PropertyFilterUpdate filtup : filtupary) {
if (filtup == null) {
continue;
}
ObjectUpdate[] objupary = filtup.getObjectSet();
for (int j = 0; objupary != null && j < objupary.length; j++) {
ObjectUpdate objup = objupary[j];
if (objup == null) {
continue;
}
PropertyChange[] propchgary = objup.getChangeSet();
for (int k = 0; propchgary != null && k < propchgary.length; k++) {
PropertyChange propchg = propchgary[k];
updateValues(endWaitProps, endVals, propchg);
updateValues(filterProps, filterVals, propchg);
}
}
}
// Check if the expected values have been reached and exit the loop if done.
// Also exit the WaitForUpdates loop if this is the case.
for (int chgi = 0; chgi < endVals.length && !reached; chgi++) {
for (int vali = 0; vali < expectedVals[chgi].length && !reached; vali++) {
Object expctdval = expectedVals[chgi][vali];
reached = expctdval.equals(endVals[chgi]) || reached;
}
}
}
pf.destroyPropertyFilter();
return filterVals;
} } | public class class_name {
protected Object[] waitForValues(String[] filterProps, String[] endWaitProps, Object[][] expectedVals) throws InvalidProperty, RuntimeFault, RemoteException {
String version = "";
Object[] endVals = new Object[endWaitProps.length];
Object[] filterVals = new Object[filterProps.length];
ObjectSpec oSpec = PropertyCollectorUtil.creatObjectSpec(
getMOR(), Boolean.FALSE, null);
PropertySpec pSpec = PropertyCollectorUtil.createPropertySpec(
getMOR().getType(),
filterProps == null || filterProps.length == 0, //if true, all props of this obj are to be read regardless of propName
filterProps);
PropertyFilterSpec spec = new PropertyFilterSpec();
spec.setObjectSet(new ObjectSpec[]{oSpec});
spec.setPropSet(new PropertySpec[]{pSpec});
PropertyCollector pc = serverConnection.getServiceInstance().getPropertyCollector();
PropertyFilter pf = pc.createFilter(spec, true);
boolean reached = false;
while (!reached) {
// Updated to waitForUpdatesEx as of 5.5.06-dev
UpdateSet updateset = pc.waitForUpdatesEx(version, null);
if (updateset == null) {
continue;
}
version = updateset.getVersion();
PropertyFilterUpdate[] filtupary = updateset.getFilterSet();
if (filtupary == null) {
continue;
}
// Make this code more general purpose when PropCol changes later.
for (PropertyFilterUpdate filtup : filtupary) {
if (filtup == null) {
continue;
}
ObjectUpdate[] objupary = filtup.getObjectSet();
for (int j = 0; objupary != null && j < objupary.length; j++) {
ObjectUpdate objup = objupary[j];
if (objup == null) {
continue;
}
PropertyChange[] propchgary = objup.getChangeSet();
for (int k = 0; propchgary != null && k < propchgary.length; k++) {
PropertyChange propchg = propchgary[k];
updateValues(endWaitProps, endVals, propchg);
// depends on control dependency: [for], data = [none]
updateValues(filterProps, filterVals, propchg);
// depends on control dependency: [for], data = [none]
}
}
}
// Check if the expected values have been reached and exit the loop if done.
// Also exit the WaitForUpdates loop if this is the case.
for (int chgi = 0; chgi < endVals.length && !reached; chgi++) {
for (int vali = 0; vali < expectedVals[chgi].length && !reached; vali++) {
Object expctdval = expectedVals[chgi][vali];
reached = expctdval.equals(endVals[chgi]) || reached;
// depends on control dependency: [for], data = [none]
}
}
}
pf.destroyPropertyFilter();
return filterVals;
} } |
public class class_name {
public static Type createInlineType(Type type, String name, String uniqueName, List<ObjectType> inlineDefinitions) {
if (type instanceof ObjectType) {
return createInlineObjectType(type, name, uniqueName, inlineDefinitions);
} else if (type instanceof ArrayType) {
ArrayType arrayType = (ArrayType) type;
arrayType.setOfType(createInlineType(arrayType.getOfType(), name, uniqueName, inlineDefinitions));
return arrayType;
} else if (type instanceof MapType) {
MapType mapType = (MapType) type;
if (mapType.getValueType() instanceof ObjectType)
mapType.setValueType(createInlineType(mapType.getValueType(), name, uniqueName, inlineDefinitions));
return mapType;
} else {
return type;
}
} } | public class class_name {
public static Type createInlineType(Type type, String name, String uniqueName, List<ObjectType> inlineDefinitions) {
if (type instanceof ObjectType) {
return createInlineObjectType(type, name, uniqueName, inlineDefinitions); // depends on control dependency: [if], data = [none]
} else if (type instanceof ArrayType) {
ArrayType arrayType = (ArrayType) type;
arrayType.setOfType(createInlineType(arrayType.getOfType(), name, uniqueName, inlineDefinitions)); // depends on control dependency: [if], data = [none]
return arrayType; // depends on control dependency: [if], data = [none]
} else if (type instanceof MapType) {
MapType mapType = (MapType) type;
if (mapType.getValueType() instanceof ObjectType)
mapType.setValueType(createInlineType(mapType.getValueType(), name, uniqueName, inlineDefinitions));
return mapType; // depends on control dependency: [if], data = [none]
} else {
return type; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public Set<byte[]> hKeys(byte[] key) {
try {
if (isPipelined()) {
pipeline(new JedisResult(pipeline.hkeys(key)));
return null;
}
return client.hkeys(key);
} catch (Exception ex) {
throw convertException(ex);
}
} } | public class class_name {
@Override
public Set<byte[]> hKeys(byte[] key) {
try {
if (isPipelined()) {
pipeline(new JedisResult(pipeline.hkeys(key))); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return client.hkeys(key); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw convertException(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static CcgBinaryRule parseFrom(String line) {
String[] chunks = new CsvParser(',', CsvParser.DEFAULT_QUOTE,
CsvParser.NULL_ESCAPE).parseLine(line.trim());
Preconditions.checkArgument(chunks.length >= 1);
String[] syntacticParts = chunks[0].split(" ");
Preconditions.checkArgument(syntacticParts.length == 3);
HeadedSyntacticCategory leftSyntax = HeadedSyntacticCategory.parseFrom(syntacticParts[0]);
HeadedSyntacticCategory rightSyntax = HeadedSyntacticCategory.parseFrom(syntacticParts[1]);
HeadedSyntacticCategory returnSyntax = HeadedSyntacticCategory.parseFrom(syntacticParts[2]);
Expression2 logicalForm = null;
if (chunks.length >= 2 && chunks[1].trim().length() > 0) {
logicalForm = ExpressionParser.expression2().parse(chunks[1]);
}
// Parse the type of combinator, if one is given.
Combinator.Type type = Combinator.Type.OTHER;
if (chunks.length >= 3) {
type = Combinator.Type.valueOf(chunks[2]);
}
// Parse any dependencies, if given.
List<String> subjects = Lists.newArrayList();
List<HeadedSyntacticCategory> subjectSyntacticCategories = Lists.newArrayList();
List<Integer> argNums = Lists.newArrayList();
List<Integer> objects = Lists.newArrayList();
if (chunks.length >= 4) {
for (int i = 3; i < chunks.length; i++) {
String[] newDeps = chunks[i].split(" ");
Preconditions.checkArgument(newDeps.length == 3);
subjects.add(newDeps[0]);
subjectSyntacticCategories.add(rightSyntax.getCanonicalForm());
argNums.add(Integer.parseInt(newDeps[1]));
objects.add(Integer.parseInt(newDeps[2]));
}
}
return new CcgBinaryRule(leftSyntax, rightSyntax, returnSyntax, logicalForm,
subjects, subjectSyntacticCategories, argNums, objects, type);
} } | public class class_name {
public static CcgBinaryRule parseFrom(String line) {
String[] chunks = new CsvParser(',', CsvParser.DEFAULT_QUOTE,
CsvParser.NULL_ESCAPE).parseLine(line.trim());
Preconditions.checkArgument(chunks.length >= 1);
String[] syntacticParts = chunks[0].split(" ");
Preconditions.checkArgument(syntacticParts.length == 3);
HeadedSyntacticCategory leftSyntax = HeadedSyntacticCategory.parseFrom(syntacticParts[0]);
HeadedSyntacticCategory rightSyntax = HeadedSyntacticCategory.parseFrom(syntacticParts[1]);
HeadedSyntacticCategory returnSyntax = HeadedSyntacticCategory.parseFrom(syntacticParts[2]);
Expression2 logicalForm = null;
if (chunks.length >= 2 && chunks[1].trim().length() > 0) {
logicalForm = ExpressionParser.expression2().parse(chunks[1]); // depends on control dependency: [if], data = [none]
}
// Parse the type of combinator, if one is given.
Combinator.Type type = Combinator.Type.OTHER;
if (chunks.length >= 3) {
type = Combinator.Type.valueOf(chunks[2]); // depends on control dependency: [if], data = [none]
}
// Parse any dependencies, if given.
List<String> subjects = Lists.newArrayList();
List<HeadedSyntacticCategory> subjectSyntacticCategories = Lists.newArrayList();
List<Integer> argNums = Lists.newArrayList();
List<Integer> objects = Lists.newArrayList();
if (chunks.length >= 4) {
for (int i = 3; i < chunks.length; i++) {
String[] newDeps = chunks[i].split(" ");
Preconditions.checkArgument(newDeps.length == 3); // depends on control dependency: [for], data = [none]
subjects.add(newDeps[0]); // depends on control dependency: [for], data = [none]
subjectSyntacticCategories.add(rightSyntax.getCanonicalForm()); // depends on control dependency: [for], data = [none]
argNums.add(Integer.parseInt(newDeps[1])); // depends on control dependency: [for], data = [none]
objects.add(Integer.parseInt(newDeps[2])); // depends on control dependency: [for], data = [none]
}
}
return new CcgBinaryRule(leftSyntax, rightSyntax, returnSyntax, logicalForm,
subjects, subjectSyntacticCategories, argNums, objects, type);
} } |
public class class_name {
public static String getStackTraceLog(String msg, Throwable e) {
StringBuilder b = new StringBuilder();
b.append(msg).append("\n");
if (e != null) {
b.append(e.toString()).append("\n");
StackTraceElement[] elements = e.getStackTrace();
StackTraceElement element;
if (elements != null) {
for (int i = 0; i < elements.length && i < STACKTRACE_LIMIT; i++) {
element = elements[i];
if (element != null) {
b.append("\tat ").append(element.toString()).append("\n");
}
}
int more = elements.length - STACKTRACE_LIMIT;
if (more > 0) {
b.append("\t... ").append(more).append(" more").append("\n");
}
}
}
return b.toString();
} } | public class class_name {
public static String getStackTraceLog(String msg, Throwable e) {
StringBuilder b = new StringBuilder();
b.append(msg).append("\n");
if (e != null) {
b.append(e.toString()).append("\n"); // depends on control dependency: [if], data = [(e]
StackTraceElement[] elements = e.getStackTrace();
StackTraceElement element;
if (elements != null) {
for (int i = 0; i < elements.length && i < STACKTRACE_LIMIT; i++) {
element = elements[i]; // depends on control dependency: [for], data = [i]
if (element != null) {
b.append("\tat ").append(element.toString()).append("\n"); // depends on control dependency: [if], data = [(element]
}
}
int more = elements.length - STACKTRACE_LIMIT;
if (more > 0) {
b.append("\t... ").append(more).append(" more").append("\n"); // depends on control dependency: [if], data = [(more]
}
}
}
return b.toString();
} } |
public class class_name {
public ClientVpnEndpoint withAuthenticationOptions(ClientVpnAuthentication... authenticationOptions) {
if (this.authenticationOptions == null) {
setAuthenticationOptions(new com.amazonaws.internal.SdkInternalList<ClientVpnAuthentication>(authenticationOptions.length));
}
for (ClientVpnAuthentication ele : authenticationOptions) {
this.authenticationOptions.add(ele);
}
return this;
} } | public class class_name {
public ClientVpnEndpoint withAuthenticationOptions(ClientVpnAuthentication... authenticationOptions) {
if (this.authenticationOptions == null) {
setAuthenticationOptions(new com.amazonaws.internal.SdkInternalList<ClientVpnAuthentication>(authenticationOptions.length)); // depends on control dependency: [if], data = [none]
}
for (ClientVpnAuthentication ele : authenticationOptions) {
this.authenticationOptions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private LightweightTypeReference getSuperTypeByName(String typeName, boolean interfaceType) {
JvmTypeReference superType = getSuperTypeByName(typeName, interfaceType, type, new RecursionGuard<JvmType>());
if (superType != null) {
JvmType rawType = superType.getType();
if (isRawType()) {
return createRawTypeReference(rawType);
}
if (superType.eClass() == TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE) {
if (((JvmParameterizedTypeReference) superType).getArguments().isEmpty()) {
return getOwner().newParameterizedTypeReference(rawType);
}
}
LightweightTypeReference unresolved = getOwner().toLightweightTypeReference(rawType);
TypeParameterSubstitutor<?> substitutor = createSubstitutor();
LightweightTypeReference result = substitutor.substitute(unresolved);
return result;
}
return null;
} } | public class class_name {
private LightweightTypeReference getSuperTypeByName(String typeName, boolean interfaceType) {
JvmTypeReference superType = getSuperTypeByName(typeName, interfaceType, type, new RecursionGuard<JvmType>());
if (superType != null) {
JvmType rawType = superType.getType();
if (isRawType()) {
return createRawTypeReference(rawType); // depends on control dependency: [if], data = [none]
}
if (superType.eClass() == TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE) {
if (((JvmParameterizedTypeReference) superType).getArguments().isEmpty()) {
return getOwner().newParameterizedTypeReference(rawType); // depends on control dependency: [if], data = [none]
}
}
LightweightTypeReference unresolved = getOwner().toLightweightTypeReference(rawType);
TypeParameterSubstitutor<?> substitutor = createSubstitutor();
LightweightTypeReference result = substitutor.substitute(unresolved);
return result; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
public String getDateLiteral(String isoDate) {
String normalLiteral = super.getDateLiteral(isoDate);
if (isDateOnly(isoDate)) {
StringBuffer val = new StringBuffer();
//noinspection HardCodedStringLiteral
val.append("TO_DATE(");
val.append(normalLiteral);
//noinspection HardCodedStringLiteral
val.append(", 'YYYY-MM-DD')");
return val.toString();
} else if (isTimeOnly(isoDate)) {
StringBuffer val = new StringBuffer();
//noinspection HardCodedStringLiteral
val.append("TO_DATE(");
val.append(normalLiteral);
//noinspection HardCodedStringLiteral
val.append(", 'HH24:MI:SS')");
return val.toString();
} else if (isTimestamp(isoDate)) {
StringBuffer val = new StringBuffer(26);
//noinspection HardCodedStringLiteral
val.append("TO_TIMESTAMP(");
val.append(normalLiteral);
//noinspection HardCodedStringLiteral
val.append(", 'YYYY-MM-DD HH24:MI:SS.FF')");
return val.toString();
} else if (isDateTime(isoDate)) {
int seppos = normalLiteral.lastIndexOf('.');
if (seppos != -1) {
normalLiteral = normalLiteral.substring(0, seppos) + "'";
}
StringBuffer val = new StringBuffer(26);
//noinspection HardCodedStringLiteral
val.append("TO_DATE(");
val.append(normalLiteral);
//noinspection HardCodedStringLiteral
val.append(", 'YYYY-MM-DD HH24:MI:SS')");
return val.toString();
}
//noinspection HardCodedStringLiteral
return "UNSUPPORTED:" + isoDate;
} } | public class class_name {
@Override
public String getDateLiteral(String isoDate) {
String normalLiteral = super.getDateLiteral(isoDate);
if (isDateOnly(isoDate)) {
StringBuffer val = new StringBuffer();
//noinspection HardCodedStringLiteral
val.append("TO_DATE(");
val.append(normalLiteral); // depends on control dependency: [if], data = [none]
//noinspection HardCodedStringLiteral
val.append(", 'YYYY-MM-DD')");
return val.toString();
} else if (isTimeOnly(isoDate)) {
StringBuffer val = new StringBuffer();
//noinspection HardCodedStringLiteral
val.append("TO_DATE(");
val.append(normalLiteral);
//noinspection HardCodedStringLiteral
val.append(", 'HH24:MI:SS')"); // depends on control dependency: [if], data = [none]
return val.toString(); // depends on control dependency: [if], data = [none]
} else if (isTimestamp(isoDate)) {
StringBuffer val = new StringBuffer(26);
//noinspection HardCodedStringLiteral
val.append("TO_TIMESTAMP(");
val.append(normalLiteral); // depends on control dependency: [if], data = [none]
//noinspection HardCodedStringLiteral
val.append(", 'YYYY-MM-DD HH24:MI:SS.FF')"); // depends on control dependency: [if], data = [none]
return val.toString(); // depends on control dependency: [if], data = [none]
} else if (isDateTime(isoDate)) {
int seppos = normalLiteral.lastIndexOf('.');
if (seppos != -1) {
normalLiteral = normalLiteral.substring(0, seppos) + "'"; // depends on control dependency: [if], data = [none]
}
StringBuffer val = new StringBuffer(26);
//noinspection HardCodedStringLiteral
val.append("TO_DATE(");
val.append(normalLiteral); // depends on control dependency: [if], data = [none]
//noinspection HardCodedStringLiteral
val.append(", 'YYYY-MM-DD HH24:MI:SS')"); // depends on control dependency: [if], data = [none]
return val.toString(); // depends on control dependency: [if], data = [none]
}
//noinspection HardCodedStringLiteral
return "UNSUPPORTED:" + isoDate;
} } |
public class class_name {
private static Optional<String> sanitizeRedirectUrl(@Nullable String url) {
if (Strings.isNullOrEmpty(url)) {
return empty();
}
if (url.startsWith("//") || url.startsWith("/\\")) {
return empty();
}
if (!url.startsWith("/")) {
return empty();
}
return Optional.of(url);
} } | public class class_name {
private static Optional<String> sanitizeRedirectUrl(@Nullable String url) {
if (Strings.isNullOrEmpty(url)) {
return empty(); // depends on control dependency: [if], data = [none]
}
if (url.startsWith("//") || url.startsWith("/\\")) {
return empty();
}
if (!url.startsWith("/")) {
return empty();
}
return Optional.of(url);
} } |
public class class_name {
public CoordinateAxis addCoordinateAxis(VariableDS v) {
if (v == null) return null;
CoordinateAxis oldVar = findCoordinateAxis(v.getFullName());
if (oldVar != null)
coordAxes.remove(oldVar);
CoordinateAxis ca = (v instanceof CoordinateAxis) ? (CoordinateAxis) v : CoordinateAxis.factory(this, v);
coordAxes.add(ca);
if (v.isMemberOfStructure()) {
Structure parentOrg = v.getParentStructure(); // gotta be careful to get the wrapping parent
Structure parent = (Structure) findVariable(parentOrg.getFullNameEscaped());
parent.replaceMemberVariable(ca);
} else {
removeVariable(v.getParentGroup(), v.getShortName()); // remove by short name if it exists
addVariable(ca.getParentGroup(), ca);
}
return ca;
} } | public class class_name {
public CoordinateAxis addCoordinateAxis(VariableDS v) {
if (v == null) return null;
CoordinateAxis oldVar = findCoordinateAxis(v.getFullName());
if (oldVar != null)
coordAxes.remove(oldVar);
CoordinateAxis ca = (v instanceof CoordinateAxis) ? (CoordinateAxis) v : CoordinateAxis.factory(this, v);
coordAxes.add(ca);
if (v.isMemberOfStructure()) {
Structure parentOrg = v.getParentStructure(); // gotta be careful to get the wrapping parent
Structure parent = (Structure) findVariable(parentOrg.getFullNameEscaped());
parent.replaceMemberVariable(ca); // depends on control dependency: [if], data = [none]
} else {
removeVariable(v.getParentGroup(), v.getShortName()); // remove by short name if it exists // depends on control dependency: [if], data = [none]
addVariable(ca.getParentGroup(), ca); // depends on control dependency: [if], data = [none]
}
return ca;
} } |
public class class_name {
private static String getPath(final Object classpath) {
final Object container = ReflectionUtils.getFieldVal(classpath, "container", false);
if (container == null) {
return "";
}
final Object delegate = ReflectionUtils.getFieldVal(container, "delegate", false);
if (delegate == null) {
return "";
}
final String path = (String) ReflectionUtils.getFieldVal(delegate, "path", false);
if (path != null && path.length() > 0) {
return path;
}
final Object base = ReflectionUtils.getFieldVal(delegate, "base", false);
if (base == null) {
// giving up.
return "";
}
final Object archiveFile = ReflectionUtils.getFieldVal(base, "archiveFile", false);
if (archiveFile != null) {
final File file = (File) archiveFile;
return file.getAbsolutePath();
}
return "";
} } | public class class_name {
private static String getPath(final Object classpath) {
final Object container = ReflectionUtils.getFieldVal(classpath, "container", false);
if (container == null) {
return ""; // depends on control dependency: [if], data = [none]
}
final Object delegate = ReflectionUtils.getFieldVal(container, "delegate", false);
if (delegate == null) {
return ""; // depends on control dependency: [if], data = [none]
}
final String path = (String) ReflectionUtils.getFieldVal(delegate, "path", false);
if (path != null && path.length() > 0) {
return path; // depends on control dependency: [if], data = [none]
}
final Object base = ReflectionUtils.getFieldVal(delegate, "base", false);
if (base == null) {
// giving up.
return ""; // depends on control dependency: [if], data = [none]
}
final Object archiveFile = ReflectionUtils.getFieldVal(base, "archiveFile", false);
if (archiveFile != null) {
final File file = (File) archiveFile;
return file.getAbsolutePath(); // depends on control dependency: [if], data = [none]
}
return "";
} } |
public class class_name {
@RequestMapping(path = "/{orderId}", method = {RequestMethod.GET, RequestMethod.POST})
public ResponseEntity<Order> getOrder(@PathVariable("orderId") Long orderId) {
Order order = orderService.getOrder(orderId);
if(order != null){
return new ResponseEntity(order, HttpStatus.OK);
}
return new ResponseEntity<Order>(HttpStatus.NOT_FOUND);
} } | public class class_name {
@RequestMapping(path = "/{orderId}", method = {RequestMethod.GET, RequestMethod.POST})
public ResponseEntity<Order> getOrder(@PathVariable("orderId") Long orderId) {
Order order = orderService.getOrder(orderId);
if(order != null){
return new ResponseEntity(order, HttpStatus.OK); // depends on control dependency: [if], data = [(order]
}
return new ResponseEntity<Order>(HttpStatus.NOT_FOUND);
} } |
public class class_name {
public Request acceptEncoding(String encoding){
final String acceptEncoding = RequestHeaderFields.ACCEPT_ENCODING.getName();
String encodingValue = headers.get(acceptEncoding);
if (encodingValue == null){
encodingValue = encoding;
} else {
encodingValue = encodingValue + ", " + encoding;
}
return this.setHeader(acceptEncoding, encodingValue);
} } | public class class_name {
public Request acceptEncoding(String encoding){
final String acceptEncoding = RequestHeaderFields.ACCEPT_ENCODING.getName();
String encodingValue = headers.get(acceptEncoding);
if (encodingValue == null){
encodingValue = encoding; // depends on control dependency: [if], data = [none]
} else {
encodingValue = encodingValue + ", " + encoding; // depends on control dependency: [if], data = [none]
}
return this.setHeader(acceptEncoding, encodingValue);
} } |
public class class_name {
public MultiPolygon createMultiPolygon(Polygon[] polygons) {
if (polygons == null) {
return new MultiPolygon(srid, precision);
}
Polygon[] clones = new Polygon[polygons.length];
for (int i = 0; i < polygons.length; i++) {
clones[i] = (Polygon) polygons[i].clone();
}
return new MultiPolygon(srid, precision, clones);
} } | public class class_name {
public MultiPolygon createMultiPolygon(Polygon[] polygons) {
if (polygons == null) {
return new MultiPolygon(srid, precision); // depends on control dependency: [if], data = [none]
}
Polygon[] clones = new Polygon[polygons.length];
for (int i = 0; i < polygons.length; i++) {
clones[i] = (Polygon) polygons[i].clone(); // depends on control dependency: [for], data = [i]
}
return new MultiPolygon(srid, precision, clones);
} } |
public class class_name {
@GuardedBy("lock")
public void forEach(long from, long to, Visitor<T> visitor) {
if(from - to > 0) // same as if(from > to), but prevents long overflow
return;
int row=computeRow(from), column=computeIndex(from);
int distance=(int)(to - from +1);
T[] current_row=row+1 > matrix.length? null : matrix[row];
for(int i=0; i < distance; i++) {
T element=current_row == null? null : current_row[column];
if(!visitor.visit(from, element, row, column))
break;
from++;
if(++column >= elements_per_row) {
column=0;
row++;
current_row=row+1 > matrix.length? null : matrix[row];
}
}
} } | public class class_name {
@GuardedBy("lock")
public void forEach(long from, long to, Visitor<T> visitor) {
if(from - to > 0) // same as if(from > to), but prevents long overflow
return;
int row=computeRow(from), column=computeIndex(from);
int distance=(int)(to - from +1);
T[] current_row=row+1 > matrix.length? null : matrix[row];
for(int i=0; i < distance; i++) {
T element=current_row == null? null : current_row[column];
if(!visitor.visit(from, element, row, column))
break;
from++; // depends on control dependency: [for], data = [none]
if(++column >= elements_per_row) {
column=0; // depends on control dependency: [if], data = [none]
row++; // depends on control dependency: [if], data = [none]
current_row=row+1 > matrix.length? null : matrix[row]; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void save(QNetworkReply reply) {
if (m_download) {
String fn = QFileDialog.getSaveFileName();
if (fn != null && fn.length()>0) {
m_logger.info("File name : " + fn);
try {
URL u = new URL(reply.url().toString());
FileOutputStream out = new FileOutputStream(new File(fn));
InputStream in = u.openStream();
write(in, out);
} catch (IOException e) {
m_logger.error("Cannot download file " + e.getMessage(), e);
}
} else {
m_logger.warn("No File Name - Download request cancelled");
}
} else {
m_logger.warn("Download disabled");
}
} } | public class class_name {
public void save(QNetworkReply reply) {
if (m_download) {
String fn = QFileDialog.getSaveFileName();
if (fn != null && fn.length()>0) {
m_logger.info("File name : " + fn); // depends on control dependency: [if], data = [none]
try {
URL u = new URL(reply.url().toString());
FileOutputStream out = new FileOutputStream(new File(fn));
InputStream in = u.openStream();
write(in, out); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
m_logger.error("Cannot download file " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} else {
m_logger.warn("No File Name - Download request cancelled"); // depends on control dependency: [if], data = [none]
}
} else {
m_logger.warn("Download disabled"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void doRunImpl(Job job, String originalBody) {
if (job instanceof AbstractProject) {
AbstractProject project = (AbstractProject) job;
int delay = project.getQuietPeriod();
ParametersAction parametersAction = new ParametersAction();
if (originalBody != null && !originalBody.isEmpty()) {
JSONObject bodyJSON = JSONObject.fromObject(originalBody);
// delay
if (bodyJSON.has("delay") && bodyJSON.get("delay") != null) {
delay = bodyJSON.getInt("delay");
}
// parameters
if (bodyJSON.has("parameters") && bodyJSON.get("parameters") != null) {
JSONArray paramsJSON = bodyJSON.getJSONArray("parameters");
parametersAction = new ParametersAction(createParameters(project, paramsJSON));
}
}
project.scheduleBuild(delay, new Cause.RemoteCause(getOctaneConfiguration() == null ? "non available URL" : getOctaneConfiguration().getUrl(), "octane driven execution"), parametersAction);
} else if (job.getClass().getName().equals("org.jenkinsci.plugins.workflow.job.WorkflowJob")) {
AbstractProjectProcessor workFlowJobProcessor = JobProcessorFactory.getFlowProcessor(job);
workFlowJobProcessor.scheduleBuild(originalBody);
}
} } | public class class_name {
private void doRunImpl(Job job, String originalBody) {
if (job instanceof AbstractProject) {
AbstractProject project = (AbstractProject) job;
int delay = project.getQuietPeriod();
ParametersAction parametersAction = new ParametersAction();
if (originalBody != null && !originalBody.isEmpty()) {
JSONObject bodyJSON = JSONObject.fromObject(originalBody);
// delay
if (bodyJSON.has("delay") && bodyJSON.get("delay") != null) {
delay = bodyJSON.getInt("delay"); // depends on control dependency: [if], data = [none]
}
// parameters
if (bodyJSON.has("parameters") && bodyJSON.get("parameters") != null) {
JSONArray paramsJSON = bodyJSON.getJSONArray("parameters");
parametersAction = new ParametersAction(createParameters(project, paramsJSON)); // depends on control dependency: [if], data = [none]
}
}
project.scheduleBuild(delay, new Cause.RemoteCause(getOctaneConfiguration() == null ? "non available URL" : getOctaneConfiguration().getUrl(), "octane driven execution"), parametersAction);
} else if (job.getClass().getName().equals("org.jenkinsci.plugins.workflow.job.WorkflowJob")) {
AbstractProjectProcessor workFlowJobProcessor = JobProcessorFactory.getFlowProcessor(job);
workFlowJobProcessor.scheduleBuild(originalBody);
}
} } |
public class class_name {
public InjectableStepsFactory buildStepsFactory(Configuration configuration) {
List<Object> stepsInstances = new ArrayList<>();
InjectableStepsFactory factory = null;
if (finder.isAnnotationPresent(UsingSteps.class)) {
List<Class<Object>> stepsClasses = finder.getAnnotatedClasses(
UsingSteps.class, Object.class, "instances");
if (!stepsClasses.isEmpty()) {
for (Class<Object> stepsClass : stepsClasses) {
stepsInstances.add(instanceOf(Object.class, stepsClass));
}
factory = new InstanceStepsFactory(configuration,
stepsInstances);
}
List<String> packages = finder.getAnnotatedValues(UsingSteps.class,
String.class, "packages");
if (!packages.isEmpty()) {
String matchingNames = finder.getAnnotatedValue(UsingSteps.class,
String.class, "matchingNames");
String notMatchingNames = finder.getAnnotatedValue(UsingSteps.class,
String.class, "notMatchingNames");
factory = new ScanningStepsFactory(configuration,
packages.toArray(new String[packages.size()]))
.matchingNames(matchingNames).notMatchingNames(notMatchingNames);
}
} else {
annotationMonitor.annotationNotFound(UsingSteps.class, annotatedClass);
}
if (factory == null) {
factory = new InstanceStepsFactory(configuration);
}
return factory;
} } | public class class_name {
public InjectableStepsFactory buildStepsFactory(Configuration configuration) {
List<Object> stepsInstances = new ArrayList<>();
InjectableStepsFactory factory = null;
if (finder.isAnnotationPresent(UsingSteps.class)) {
List<Class<Object>> stepsClasses = finder.getAnnotatedClasses(
UsingSteps.class, Object.class, "instances");
if (!stepsClasses.isEmpty()) {
for (Class<Object> stepsClass : stepsClasses) {
stepsInstances.add(instanceOf(Object.class, stepsClass)); // depends on control dependency: [for], data = [stepsClass]
}
factory = new InstanceStepsFactory(configuration,
stepsInstances); // depends on control dependency: [if], data = [none]
}
List<String> packages = finder.getAnnotatedValues(UsingSteps.class,
String.class, "packages");
if (!packages.isEmpty()) {
String matchingNames = finder.getAnnotatedValue(UsingSteps.class,
String.class, "matchingNames");
String notMatchingNames = finder.getAnnotatedValue(UsingSteps.class,
String.class, "notMatchingNames");
factory = new ScanningStepsFactory(configuration,
packages.toArray(new String[packages.size()]))
.matchingNames(matchingNames).notMatchingNames(notMatchingNames); // depends on control dependency: [if], data = [none]
}
} else {
annotationMonitor.annotationNotFound(UsingSteps.class, annotatedClass); // depends on control dependency: [if], data = [none]
}
if (factory == null) {
factory = new InstanceStepsFactory(configuration); // depends on control dependency: [if], data = [none]
}
return factory;
} } |
public class class_name {
public void setCenter(Point2D center)
{
Point2D old = this.getCenter();
double centerX = center.getX();
double centerY = center.getY();
Dimension mapSize = getTileFactory().getMapSize(getZoom());
int mapHeight = (int) mapSize.getHeight() * getTileFactory().getTileSize(getZoom());
int mapWidth = (int) mapSize.getWidth() * getTileFactory().getTileSize(getZoom());
if (isRestrictOutsidePanning())
{
Insets insets = getInsets();
int viewportHeight = getHeight() - insets.top - insets.bottom;
int viewportWidth = getWidth() - insets.left - insets.right;
// don't let the user pan over the top edge
Rectangle newVP = calculateViewportBounds(center);
if (newVP.getY() < 0)
{
centerY = viewportHeight / 2;
}
// don't let the user pan over the left edge
if (!isHorizontalWrapped() && newVP.getX() < 0)
{
centerX = viewportWidth / 2;
}
// don't let the user pan over the bottom edge
if (newVP.getY() + newVP.getHeight() > mapHeight)
{
centerY = mapHeight - viewportHeight / 2;
}
// don't let the user pan over the right edge
if (!isHorizontalWrapped() && (newVP.getX() + newVP.getWidth() > mapWidth))
{
centerX = mapWidth - viewportWidth / 2;
}
// if map is to small then just center it vert
if (mapHeight < newVP.getHeight())
{
centerY = mapHeight / 2;// viewportHeight/2;// - mapHeight/2;
}
// if map is too small then just center it horiz
if (!isHorizontalWrapped() && mapWidth < newVP.getWidth())
{
centerX = mapWidth / 2;
}
}
// If center is outside (0, 0,mapWidth, mapHeight)
// compute modulo to get it back in.
{
centerX = centerX % mapWidth;
centerY = centerY % mapHeight;
if (centerX < 0)
centerX += mapWidth;
if (centerY < 0)
centerY += mapHeight;
}
GeoPosition oldGP = this.getCenterPosition();
this.center = new Point2D.Double(centerX, centerY);
firePropertyChange("center", old, this.center);
firePropertyChange("centerPosition", oldGP, this.getCenterPosition());
repaint();
} } | public class class_name {
public void setCenter(Point2D center)
{
Point2D old = this.getCenter();
double centerX = center.getX();
double centerY = center.getY();
Dimension mapSize = getTileFactory().getMapSize(getZoom());
int mapHeight = (int) mapSize.getHeight() * getTileFactory().getTileSize(getZoom());
int mapWidth = (int) mapSize.getWidth() * getTileFactory().getTileSize(getZoom());
if (isRestrictOutsidePanning())
{
Insets insets = getInsets();
int viewportHeight = getHeight() - insets.top - insets.bottom;
int viewportWidth = getWidth() - insets.left - insets.right;
// don't let the user pan over the top edge
Rectangle newVP = calculateViewportBounds(center);
if (newVP.getY() < 0)
{
centerY = viewportHeight / 2;
// depends on control dependency: [if], data = [none]
}
// don't let the user pan over the left edge
if (!isHorizontalWrapped() && newVP.getX() < 0)
{
centerX = viewportWidth / 2;
// depends on control dependency: [if], data = [none]
}
// don't let the user pan over the bottom edge
if (newVP.getY() + newVP.getHeight() > mapHeight)
{
centerY = mapHeight - viewportHeight / 2;
// depends on control dependency: [if], data = [none]
}
// don't let the user pan over the right edge
if (!isHorizontalWrapped() && (newVP.getX() + newVP.getWidth() > mapWidth))
{
centerX = mapWidth - viewportWidth / 2;
// depends on control dependency: [if], data = [none]
}
// if map is to small then just center it vert
if (mapHeight < newVP.getHeight())
{
centerY = mapHeight / 2;// viewportHeight/2;// - mapHeight/2;
// depends on control dependency: [if], data = [none]
}
// if map is too small then just center it horiz
if (!isHorizontalWrapped() && mapWidth < newVP.getWidth())
{
centerX = mapWidth / 2;
// depends on control dependency: [if], data = [none]
}
}
// If center is outside (0, 0,mapWidth, mapHeight)
// compute modulo to get it back in.
{
centerX = centerX % mapWidth;
centerY = centerY % mapHeight;
if (centerX < 0)
centerX += mapWidth;
if (centerY < 0)
centerY += mapHeight;
}
GeoPosition oldGP = this.getCenterPosition();
this.center = new Point2D.Double(centerX, centerY);
firePropertyChange("center", old, this.center);
firePropertyChange("centerPosition", oldGP, this.getCenterPosition());
repaint();
} } |
public class class_name {
public List<SPFTrigger> listTrigger() {
try {
SPFError err = new SPFError(SPFError.NONE_ERROR_CODE);
List<SPFTrigger> trgs = getService().listTrigger(getAccessToken(), err);
if (!err.codeEquals(SPFError.NONE_ERROR_CODE)) {
handleError(err);
}
return trgs;
} catch (RemoteException e) {
catchRemoteException(e);
return new ArrayList<SPFTrigger>(0);
}
} } | public class class_name {
public List<SPFTrigger> listTrigger() {
try {
SPFError err = new SPFError(SPFError.NONE_ERROR_CODE);
List<SPFTrigger> trgs = getService().listTrigger(getAccessToken(), err);
if (!err.codeEquals(SPFError.NONE_ERROR_CODE)) {
handleError(err); // depends on control dependency: [if], data = [none]
}
return trgs; // depends on control dependency: [try], data = [none]
} catch (RemoteException e) {
catchRemoteException(e);
return new ArrayList<SPFTrigger>(0);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public boolean accept(final Node aNode) {
// Only deal with Element nodes with "name" attributes.
if (!DomHelper.isNamedElement(aNode)) {
return false;
}
/*
<xs:complexType name="somewhatNamedPerson">
<!-- ClassLocation JavaDocData insertion point -->
<xs:sequence>
<!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
<xs:element name="firstName" type="xs:string" nillable="true" minOccurs="0"/>
<!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
<xs:element name="lastName" type="xs:string"/>
</xs:sequence>
<!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
<xs:attribute name="age" type="xs:int" use="required"/>
</xs:complexType>
*/
// Only process nodes corresponding to Types we have any JavaDoc for.
// TODO: How should we handle PackageLocations and package documentation?
boolean toReturn = false;
if (DomHelper.getMethodLocation(aNode, methodJavaDocs.keySet()) != null) {
toReturn = true;
} else if (DomHelper.getFieldLocation(aNode, fieldJavaDocs.keySet()) != null) {
toReturn = true;
} else if (DomHelper.getClassLocation(aNode, classJavaDocs.keySet()) != null) {
toReturn = true;
}
// All done.
return toReturn;
} } | public class class_name {
@Override
public boolean accept(final Node aNode) {
// Only deal with Element nodes with "name" attributes.
if (!DomHelper.isNamedElement(aNode)) {
return false; // depends on control dependency: [if], data = [none]
}
/*
<xs:complexType name="somewhatNamedPerson">
<!-- ClassLocation JavaDocData insertion point -->
<xs:sequence>
<!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
<xs:element name="firstName" type="xs:string" nillable="true" minOccurs="0"/>
<!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
<xs:element name="lastName" type="xs:string"/>
</xs:sequence>
<!-- FieldLocation or MethodLocation JavaDocData insertion point (within child) -->
<xs:attribute name="age" type="xs:int" use="required"/>
</xs:complexType>
*/
// Only process nodes corresponding to Types we have any JavaDoc for.
// TODO: How should we handle PackageLocations and package documentation?
boolean toReturn = false;
if (DomHelper.getMethodLocation(aNode, methodJavaDocs.keySet()) != null) {
toReturn = true; // depends on control dependency: [if], data = [none]
} else if (DomHelper.getFieldLocation(aNode, fieldJavaDocs.keySet()) != null) {
toReturn = true; // depends on control dependency: [if], data = [none]
} else if (DomHelper.getClassLocation(aNode, classJavaDocs.keySet()) != null) {
toReturn = true; // depends on control dependency: [if], data = [none]
}
// All done.
return toReturn;
} } |
public class class_name {
public static Type getUpperBound(Type type, Types types) {
if (type.hasTag(TypeTag.WILDCARD)) {
return types.wildUpperBound(type);
}
if (type.hasTag(TypeTag.TYPEVAR) && ((TypeVar) type).isCaptured()) {
return types.cvarUpperBound(type);
}
if (type.getUpperBound() != null) {
return type.getUpperBound();
}
// concrete type, e.g. java.lang.String, or a case we haven't considered
return type;
} } | public class class_name {
public static Type getUpperBound(Type type, Types types) {
if (type.hasTag(TypeTag.WILDCARD)) {
return types.wildUpperBound(type); // depends on control dependency: [if], data = [none]
}
if (type.hasTag(TypeTag.TYPEVAR) && ((TypeVar) type).isCaptured()) {
return types.cvarUpperBound(type); // depends on control dependency: [if], data = [none]
}
if (type.getUpperBound() != null) {
return type.getUpperBound(); // depends on control dependency: [if], data = [none]
}
// concrete type, e.g. java.lang.String, or a case we haven't considered
return type;
} } |
public class class_name {
public final boolean isViewSufficientlyShown(View view){
final int[] xyView = new int[2];
final int[] xyParent = new int[2];
if(view == null)
return false;
final float viewHeight = view.getHeight();
final View parent = getScrollOrListParent(view);
view.getLocationOnScreen(xyView);
if(parent == null){
xyParent[1] = 0;
}
else{
parent.getLocationOnScreen(xyParent);
}
if(xyView[1] + (viewHeight/2.0f) > getScrollListWindowHeight(view))
return false;
else if(xyView[1] + (viewHeight/2.0f) < xyParent[1])
return false;
return true;
} } | public class class_name {
public final boolean isViewSufficientlyShown(View view){
final int[] xyView = new int[2];
final int[] xyParent = new int[2];
if(view == null)
return false;
final float viewHeight = view.getHeight();
final View parent = getScrollOrListParent(view);
view.getLocationOnScreen(xyView);
if(parent == null){
xyParent[1] = 0; // depends on control dependency: [if], data = [none]
}
else{
parent.getLocationOnScreen(xyParent); // depends on control dependency: [if], data = [none]
}
if(xyView[1] + (viewHeight/2.0f) > getScrollListWindowHeight(view))
return false;
else if(xyView[1] + (viewHeight/2.0f) < xyParent[1])
return false;
return true;
} } |
public class class_name {
public static Map<String, CmsProperty> getPropertyMap(List<CmsProperty> list) {
Map<String, CmsProperty> result = null;
String key = null;
CmsProperty property = null;
if ((list == null) || (list.size() == 0)) {
return Collections.emptyMap();
}
result = new HashMap<String, CmsProperty>();
// choose the fastest method to iterate the list
if (list instanceof RandomAccess) {
for (int i = 0, n = list.size(); i < n; i++) {
property = list.get(i);
key = property.getName();
result.put(key, property);
}
} else {
Iterator<CmsProperty> i = list.iterator();
while (i.hasNext()) {
property = i.next();
key = property.getName();
result.put(key, property);
}
}
return result;
} } | public class class_name {
public static Map<String, CmsProperty> getPropertyMap(List<CmsProperty> list) {
Map<String, CmsProperty> result = null;
String key = null;
CmsProperty property = null;
if ((list == null) || (list.size() == 0)) {
return Collections.emptyMap(); // depends on control dependency: [if], data = [none]
}
result = new HashMap<String, CmsProperty>();
// choose the fastest method to iterate the list
if (list instanceof RandomAccess) {
for (int i = 0, n = list.size(); i < n; i++) {
property = list.get(i); // depends on control dependency: [for], data = [i]
key = property.getName(); // depends on control dependency: [for], data = [none]
result.put(key, property); // depends on control dependency: [for], data = [none]
}
} else {
Iterator<CmsProperty> i = list.iterator();
while (i.hasNext()) {
property = i.next(); // depends on control dependency: [while], data = [none]
key = property.getName(); // depends on control dependency: [while], data = [none]
result.put(key, property); // depends on control dependency: [while], data = [none]
}
}
return result;
} } |
public class class_name {
public static Hyperlink getHyperlink(final Cell cell) {
ArgUtils.notNull(cell, "cell");
Hyperlink link = cell.getHyperlink();
if(link != null) {
return link;
}
final Sheet sheet = cell.getSheet();
CellRangeAddress mergedRange = getMergedRegion(sheet, cell.getRowIndex(), cell.getColumnIndex());
if(mergedRange == null) {
return null;
}
for(Hyperlink item : sheet.getHyperlinkList()) {
if(item.getFirstRow() == mergedRange.getFirstRow()
&& item.getFirstColumn() == mergedRange.getFirstColumn()) {
return item;
}
}
return null;
} } | public class class_name {
public static Hyperlink getHyperlink(final Cell cell) {
ArgUtils.notNull(cell, "cell");
Hyperlink link = cell.getHyperlink();
if(link != null) {
return link;
// depends on control dependency: [if], data = [none]
}
final Sheet sheet = cell.getSheet();
CellRangeAddress mergedRange = getMergedRegion(sheet, cell.getRowIndex(), cell.getColumnIndex());
if(mergedRange == null) {
return null;
// depends on control dependency: [if], data = [none]
}
for(Hyperlink item : sheet.getHyperlinkList()) {
if(item.getFirstRow() == mergedRange.getFirstRow()
&& item.getFirstColumn() == mergedRange.getFirstColumn()) {
return item;
// depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public MethodDoc[] serializationMethods() {
if (serializedForm == null) {
serializedForm = new SerializedForm(env, tsym, this);
}
//### Clone this?
return serializedForm.methods();
} } | public class class_name {
public MethodDoc[] serializationMethods() {
if (serializedForm == null) {
serializedForm = new SerializedForm(env, tsym, this); // depends on control dependency: [if], data = [none]
}
//### Clone this?
return serializedForm.methods();
} } |
public class class_name {
public char[] toCharacterArray() {
char[] copy = new char[size];
for (int i = 0; i < size; i++) {
copy[i] = elements[i];
}
return copy;
} } | public class class_name {
public char[] toCharacterArray() {
char[] copy = new char[size];
for (int i = 0; i < size; i++) {
copy[i] = elements[i]; // depends on control dependency: [for], data = [i]
}
return copy;
} } |
public class class_name {
public Coin parse(String source, ParsePosition pos) {
DecimalFormatSymbols anteSigns = null;
int parseScale = COIN_SCALE; // default
Coin coin = null;
synchronized (numberFormat) {
if (numberFormat.toPattern().contains("¤")) {
for(ScaleMatcher d : denomMatchers()) {
Matcher matcher = d.pattern.matcher(source);
if (matcher.find()) {
anteSigns = setSymbolAndCode(numberFormat, matcher.group());
parseScale = d.scale;
break;
}
}
if (parseScale == COIN_SCALE) {
Matcher matcher = coinPattern.matcher(source);
matcher.find();
anteSigns = setSymbolAndCode(numberFormat, matcher.group());
}
} else parseScale = scale();
Number number = numberFormat.parse(source, pos);
if (number != null) try {
coin = Coin.valueOf(
((BigDecimal)number).movePointRight(offSatoshis(parseScale)).setScale(0, HALF_UP).longValue()
);
} catch (IllegalArgumentException e) {
pos.setIndex(0);
}
if (anteSigns != null) numberFormat.setDecimalFormatSymbols(anteSigns);
}
return coin;
} } | public class class_name {
public Coin parse(String source, ParsePosition pos) {
DecimalFormatSymbols anteSigns = null;
int parseScale = COIN_SCALE; // default
Coin coin = null;
synchronized (numberFormat) {
if (numberFormat.toPattern().contains("¤")) {
for(ScaleMatcher d : denomMatchers()) {
Matcher matcher = d.pattern.matcher(source);
if (matcher.find()) {
anteSigns = setSymbolAndCode(numberFormat, matcher.group()); // depends on control dependency: [if], data = [none]
parseScale = d.scale; // depends on control dependency: [if], data = [none]
break;
}
}
if (parseScale == COIN_SCALE) {
Matcher matcher = coinPattern.matcher(source);
matcher.find(); // depends on control dependency: [if], data = [none]
anteSigns = setSymbolAndCode(numberFormat, matcher.group()); // depends on control dependency: [if], data = [none]
}
} else parseScale = scale();
Number number = numberFormat.parse(source, pos);
if (number != null) try {
coin = Coin.valueOf(
((BigDecimal)number).movePointRight(offSatoshis(parseScale)).setScale(0, HALF_UP).longValue()
); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
pos.setIndex(0);
} // depends on control dependency: [catch], data = [none]
if (anteSigns != null) numberFormat.setDecimalFormatSymbols(anteSigns);
}
return coin;
} } |
public class class_name {
private static Iterable<List<Map.Entry<Symbol, File>>> splitToNChunks(
final ImmutableMap<Symbol, File> inputMap, int numChunks) {
checkArgument(numChunks > 0);
final List<Map.Entry<Symbol, File>> emptyChunk = ImmutableList.of();
if (inputMap.isEmpty()) {
return Collections.nCopies(numChunks, emptyChunk);
}
final int chunkSize = IntMath.divide(inputMap.size(), numChunks, RoundingMode.UP);
final ImmutableList<List<Map.Entry<Symbol, File>>> chunks =
ImmutableList.copyOf(splitToChunksOfFixedSize(inputMap, chunkSize));
if (chunks.size() == numChunks) {
return chunks;
} else {
// there weren't enough elements to make the desired number of chunks, so we need to
// pad with empty chunks
final int shortage = numChunks - chunks.size();
final List<List<Map.Entry<Symbol, File>>> padding = Collections.nCopies(shortage, emptyChunk);
return Iterables.concat(chunks, padding);
}
} } | public class class_name {
private static Iterable<List<Map.Entry<Symbol, File>>> splitToNChunks(
final ImmutableMap<Symbol, File> inputMap, int numChunks) {
checkArgument(numChunks > 0);
final List<Map.Entry<Symbol, File>> emptyChunk = ImmutableList.of();
if (inputMap.isEmpty()) {
return Collections.nCopies(numChunks, emptyChunk); // depends on control dependency: [if], data = [none]
}
final int chunkSize = IntMath.divide(inputMap.size(), numChunks, RoundingMode.UP);
final ImmutableList<List<Map.Entry<Symbol, File>>> chunks =
ImmutableList.copyOf(splitToChunksOfFixedSize(inputMap, chunkSize));
if (chunks.size() == numChunks) {
return chunks; // depends on control dependency: [if], data = [none]
} else {
// there weren't enough elements to make the desired number of chunks, so we need to
// pad with empty chunks
final int shortage = numChunks - chunks.size();
final List<List<Map.Entry<Symbol, File>>> padding = Collections.nCopies(shortage, emptyChunk);
return Iterables.concat(chunks, padding); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public EClass getModelCheckerResult() {
if (modelCheckerResultEClass == null) {
modelCheckerResultEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(96);
}
return modelCheckerResultEClass;
} } | public class class_name {
@Override
public EClass getModelCheckerResult() {
if (modelCheckerResultEClass == null) {
modelCheckerResultEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(96);
// depends on control dependency: [if], data = [none]
}
return modelCheckerResultEClass;
} } |
public class class_name {
@VisibleForTesting
boolean isIntact() {
for (int i = 1; i < size; i++) {
if (!heapForIndex(i).verifyIndex(i)) {
return false;
}
}
return true;
} } | public class class_name {
@VisibleForTesting
boolean isIntact() {
for (int i = 1; i < size; i++) {
if (!heapForIndex(i).verifyIndex(i)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
private void addWord(final String word) {
final int length = word.length();
if (length >= wordMinLength && length <= wordMaxLength) {
words.add(word);
wordCount++;
}
} } | public class class_name {
private void addWord(final String word) {
final int length = word.length();
if (length >= wordMinLength && length <= wordMaxLength) {
words.add(word); // depends on control dependency: [if], data = [none]
wordCount++; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
Status initArgs(String[] args, DispatchCallback callback) {
List<String> commands = new LinkedList<>();
List<String> files = new LinkedList<>();
String driver = null;
String user = null;
String pass = null;
String url = null;
String nickname = null;
String logFile = null;
String commandHandler = null;
String appConfig = null;
String promptHandler = null;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("--help") || args[i].equals("-h")) {
return Status.ARGS;
}
// -- arguments are treated as properties
if (args[i].startsWith("--")) {
String[] parts = split(args[i].substring(2), "=");
debug(loc("setting-prop", Arrays.asList(parts)));
if (parts.length > 0) {
boolean ret;
if (parts.length >= 2) {
ret = getOpts().set(parts[0], parts[1], true);
} else {
ret = getOpts().set(parts[0], "true", true);
}
if (!ret) {
return Status.ARGS;
}
}
continue;
}
if (args[i].charAt(0) == '-') {
if (i == args.length - 1) {
return Status.ARGS;
}
if (args[i].equals("-d")) {
driver = args[++i];
} else if (args[i].equals("-ch")) {
commandHandler = args[++i];
} else if (args[i].equals("-n")) {
user = args[++i];
} else if (args[i].equals("-p")) {
pass = args[++i];
} else if (args[i].equals("-u")) {
url = args[++i];
} else if (args[i].equals("-e")) {
commands.add(args[++i]);
} else if (args[i].equals("-f")) {
getOpts().setRun(args[++i]);
} else if (args[i].equals("-log")) {
logFile = args[++i];
} else if (args[i].equals("-nn")) {
nickname = args[++i];
} else if (args[i].equals("-ac")) {
appConfig = args[++i];
} else if (args[i].equals("-ph")) {
promptHandler = args[++i];
} else {
return Status.ARGS;
}
} else {
files.add(args[i]);
}
}
if (appConfig != null) {
dispatch(COMMAND_PREFIX + "appconfig " + appConfig,
new DispatchCallback());
}
if (url != null || user != null || pass != null || driver != null) {
String com =
COMMAND_PREFIX + "connect "
+ (url == null ? "\"\"" : url) + " "
+ (user == null || user.length() == 0 ? "''" : user) + " "
+ (pass == null || pass.length() == 0 ? "''" : pass) + " "
+ (driver == null ? "" : driver);
debug("issuing: " + com);
dispatch(com, new DispatchCallback());
}
if (nickname != null) {
dispatch(COMMAND_PREFIX + "nickname " + nickname, new DispatchCallback());
}
if (logFile != null) {
dispatch(COMMAND_PREFIX + "record " + logFile, new DispatchCallback());
}
if (commandHandler != null) {
StringBuilder sb = new StringBuilder();
for (String chElem : commandHandler.split(",")) {
sb.append(chElem).append(" ");
}
dispatch(COMMAND_PREFIX + "commandhandler " + sb.toString(),
new DispatchCallback());
}
if (promptHandler != null) {
dispatch(COMMAND_PREFIX + "prompthandler "
+ promptHandler, new DispatchCallback());
}
// now load properties files
for (String file : files) {
dispatch(COMMAND_PREFIX + "properties " + file, new DispatchCallback());
}
if (commands.size() > 0) {
// for single command execute, disable color
getOpts().set(BuiltInProperty.COLOR, false);
getOpts().set(BuiltInProperty.HEADER_INTERVAL, -1);
for (String command : commands) {
debug(loc("executing-command", command));
dispatch(command, new DispatchCallback());
}
exit = true; // execute and exit
}
Status status = Status.OK;
// if a script file was specified, run the file and quit
if (getOpts().getRun() != null) {
dispatch(COMMAND_PREFIX + "run \"" + getOpts().getRun() + "\"", callback);
if (callback.isFailure()) {
status = Status.OTHER;
}
dispatch(COMMAND_PREFIX + "quit", new DispatchCallback());
}
return status;
} } | public class class_name {
Status initArgs(String[] args, DispatchCallback callback) {
List<String> commands = new LinkedList<>();
List<String> files = new LinkedList<>();
String driver = null;
String user = null;
String pass = null;
String url = null;
String nickname = null;
String logFile = null;
String commandHandler = null;
String appConfig = null;
String promptHandler = null;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("--help") || args[i].equals("-h")) {
return Status.ARGS; // depends on control dependency: [if], data = [none]
}
// -- arguments are treated as properties
if (args[i].startsWith("--")) {
String[] parts = split(args[i].substring(2), "=");
debug(loc("setting-prop", Arrays.asList(parts))); // depends on control dependency: [if], data = [none]
if (parts.length > 0) {
boolean ret;
if (parts.length >= 2) {
ret = getOpts().set(parts[0], parts[1], true); // depends on control dependency: [if], data = [none]
} else {
ret = getOpts().set(parts[0], "true", true); // depends on control dependency: [if], data = [none]
}
if (!ret) {
return Status.ARGS; // depends on control dependency: [if], data = [none]
}
}
continue;
}
if (args[i].charAt(0) == '-') {
if (i == args.length - 1) {
return Status.ARGS; // depends on control dependency: [if], data = [none]
}
if (args[i].equals("-d")) {
driver = args[++i]; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-ch")) {
commandHandler = args[++i]; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-n")) {
user = args[++i]; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-p")) {
pass = args[++i]; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-u")) {
url = args[++i]; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-e")) {
commands.add(args[++i]); // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-f")) {
getOpts().setRun(args[++i]); // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-log")) {
logFile = args[++i]; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-nn")) {
nickname = args[++i]; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-ac")) {
appConfig = args[++i]; // depends on control dependency: [if], data = [none]
} else if (args[i].equals("-ph")) {
promptHandler = args[++i]; // depends on control dependency: [if], data = [none]
} else {
return Status.ARGS; // depends on control dependency: [if], data = [none]
}
} else {
files.add(args[i]); // depends on control dependency: [if], data = [none]
}
}
if (appConfig != null) {
dispatch(COMMAND_PREFIX + "appconfig " + appConfig,
new DispatchCallback()); // depends on control dependency: [if], data = [none]
}
if (url != null || user != null || pass != null || driver != null) {
String com =
COMMAND_PREFIX + "connect "
+ (url == null ? "\"\"" : url) + " "
+ (user == null || user.length() == 0 ? "''" : user) + " "
+ (pass == null || pass.length() == 0 ? "''" : pass) + " "
+ (driver == null ? "" : driver);
debug("issuing: " + com); // depends on control dependency: [if], data = [none]
dispatch(com, new DispatchCallback()); // depends on control dependency: [if], data = [none]
}
if (nickname != null) {
dispatch(COMMAND_PREFIX + "nickname " + nickname, new DispatchCallback()); // depends on control dependency: [if], data = [none]
}
if (logFile != null) {
dispatch(COMMAND_PREFIX + "record " + logFile, new DispatchCallback()); // depends on control dependency: [if], data = [none]
}
if (commandHandler != null) {
StringBuilder sb = new StringBuilder();
for (String chElem : commandHandler.split(",")) {
sb.append(chElem).append(" "); // depends on control dependency: [for], data = [chElem]
}
dispatch(COMMAND_PREFIX + "commandhandler " + sb.toString(),
new DispatchCallback()); // depends on control dependency: [if], data = [none]
}
if (promptHandler != null) {
dispatch(COMMAND_PREFIX + "prompthandler "
+ promptHandler, new DispatchCallback()); // depends on control dependency: [if], data = [none]
}
// now load properties files
for (String file : files) {
dispatch(COMMAND_PREFIX + "properties " + file, new DispatchCallback()); // depends on control dependency: [for], data = [file]
}
if (commands.size() > 0) {
// for single command execute, disable color
getOpts().set(BuiltInProperty.COLOR, false); // depends on control dependency: [if], data = [none]
getOpts().set(BuiltInProperty.HEADER_INTERVAL, -1); // depends on control dependency: [if], data = [none]
for (String command : commands) {
debug(loc("executing-command", command)); // depends on control dependency: [for], data = [command]
dispatch(command, new DispatchCallback()); // depends on control dependency: [for], data = [command]
}
exit = true; // execute and exit // depends on control dependency: [if], data = [none]
}
Status status = Status.OK;
// if a script file was specified, run the file and quit
if (getOpts().getRun() != null) {
dispatch(COMMAND_PREFIX + "run \"" + getOpts().getRun() + "\"", callback); // depends on control dependency: [if], data = [none]
if (callback.isFailure()) {
status = Status.OTHER; // depends on control dependency: [if], data = [none]
}
dispatch(COMMAND_PREFIX + "quit", new DispatchCallback()); // depends on control dependency: [if], data = [none]
}
return status;
} } |
public class class_name {
public static dnszone_binding[] get(nitro_service service, String zonename[]) throws Exception{
if (zonename !=null && zonename.length>0) {
dnszone_binding response[] = new dnszone_binding[zonename.length];
dnszone_binding obj[] = new dnszone_binding[zonename.length];
for (int i=0;i<zonename.length;i++) {
obj[i] = new dnszone_binding();
obj[i].set_zonename(zonename[i]);
response[i] = (dnszone_binding) obj[i].get_resource(service);
}
return response;
}
return null;
} } | public class class_name {
public static dnszone_binding[] get(nitro_service service, String zonename[]) throws Exception{
if (zonename !=null && zonename.length>0) {
dnszone_binding response[] = new dnszone_binding[zonename.length];
dnszone_binding obj[] = new dnszone_binding[zonename.length];
for (int i=0;i<zonename.length;i++) {
obj[i] = new dnszone_binding(); // depends on control dependency: [for], data = [i]
obj[i].set_zonename(zonename[i]); // depends on control dependency: [for], data = [i]
response[i] = (dnszone_binding) obj[i].get_resource(service); // depends on control dependency: [for], data = [i]
}
return response;
}
return null;
} } |
public class class_name {
protected ExtensionHttpSessions getExtensionHttpSessions() {
if (extensionHttpSessions == null) {
extensionHttpSessions = Control.getSingleton().getExtensionLoader().getExtension(ExtensionHttpSessions.class);
if (extensionHttpSessions == null)
log.error("Http Sessions Extension should be enabled for the "
+ ExtensionUserManagement.class.getSimpleName() + " to work.");
}
return extensionHttpSessions;
} } | public class class_name {
protected ExtensionHttpSessions getExtensionHttpSessions() {
if (extensionHttpSessions == null) {
extensionHttpSessions = Control.getSingleton().getExtensionLoader().getExtension(ExtensionHttpSessions.class); // depends on control dependency: [if], data = [none]
if (extensionHttpSessions == null)
log.error("Http Sessions Extension should be enabled for the "
+ ExtensionUserManagement.class.getSimpleName() + " to work.");
}
return extensionHttpSessions;
} } |
public class class_name {
public synchronized Set<ProbeListener> getInterestedByClass(Class<?> clazz) {
Set<ProbeListener> listeners = listenersByClass.get(clazz);
if (listeners == null) {
listeners = Collections.emptySet();
}
// Make copy to allow caller to iterate over contents
return new HashSet<ProbeListener>(listeners);
} } | public class class_name {
public synchronized Set<ProbeListener> getInterestedByClass(Class<?> clazz) {
Set<ProbeListener> listeners = listenersByClass.get(clazz);
if (listeners == null) {
listeners = Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
// Make copy to allow caller to iterate over contents
return new HashSet<ProbeListener>(listeners);
} } |
public class class_name {
public EEnum getIfcSurfaceTextureEnum() {
if (ifcSurfaceTextureEnumEEnum == null) {
ifcSurfaceTextureEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(909);
}
return ifcSurfaceTextureEnumEEnum;
} } | public class class_name {
public EEnum getIfcSurfaceTextureEnum() {
if (ifcSurfaceTextureEnumEEnum == null) {
ifcSurfaceTextureEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(909);
// depends on control dependency: [if], data = [none]
}
return ifcSurfaceTextureEnumEEnum;
} } |
public class class_name {
protected boolean doesQueueContainConversation (final Conversation conversation) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "doesQueueContainConversation", conversation);
boolean rc = false;
synchronized (barrier) {
for (int i = 0; i < queue.size(); i++) {
final AbstractInvocation invocation = queue.get(i);
if (invocation.getConversation().equals(conversation)) {
rc = true;
break;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "doesQueueContainConversation", rc);
return rc;
} } | public class class_name {
protected boolean doesQueueContainConversation (final Conversation conversation) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "doesQueueContainConversation", conversation);
boolean rc = false;
synchronized (barrier) {
for (int i = 0; i < queue.size(); i++) {
final AbstractInvocation invocation = queue.get(i);
if (invocation.getConversation().equals(conversation)) {
rc = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "doesQueueContainConversation", rc);
return rc;
} } |
public class class_name {
public void handleRestorationCalculation() {
if(nextExpiration == null) {
return;
}
//next expiration in the future, we don't care
if(nextExpiration.getTime() >= System.currentTimeMillis()) {
return;
}
//just set the next expiration to 1ms in the past
//this means it will run to catch up the missed expiration
//and then the next calculated expiration will be in the future
nextExpiration = new Date(System.currentTimeMillis() - 1);
} } | public class class_name {
public void handleRestorationCalculation() {
if(nextExpiration == null) {
return; // depends on control dependency: [if], data = [none]
}
//next expiration in the future, we don't care
if(nextExpiration.getTime() >= System.currentTimeMillis()) {
return; // depends on control dependency: [if], data = [none]
}
//just set the next expiration to 1ms in the past
//this means it will run to catch up the missed expiration
//and then the next calculated expiration will be in the future
nextExpiration = new Date(System.currentTimeMillis() - 1);
} } |
public class class_name {
public void writeObject(@NonNull ObjectOutputStream stream) throws IOException {
stream.writeObject(id);
stream.writeLong(createdTime);
stream.writeLong(lastAccessedTime);
stream.writeInt(maxInactiveInterval);
stream.writeBoolean(isNew);
stream.writeBoolean(isValid);
stream.writeInt(mAttributes.size());
String keys[] = mAttributes.keySet().toArray(EMPTY_ARRAY);
for (String key : keys) {
Object value = mAttributes.get(key);
if (value != null && value instanceof Serializable) {
stream.writeObject(key);
stream.writeObject(value);
}
}
} } | public class class_name {
public void writeObject(@NonNull ObjectOutputStream stream) throws IOException {
stream.writeObject(id);
stream.writeLong(createdTime);
stream.writeLong(lastAccessedTime);
stream.writeInt(maxInactiveInterval);
stream.writeBoolean(isNew);
stream.writeBoolean(isValid);
stream.writeInt(mAttributes.size());
String keys[] = mAttributes.keySet().toArray(EMPTY_ARRAY);
for (String key : keys) {
Object value = mAttributes.get(key);
if (value != null && value instanceof Serializable) {
stream.writeObject(key); // depends on control dependency: [if], data = [none]
stream.writeObject(value); // depends on control dependency: [if], data = [(value]
}
}
} } |
public class class_name {
public void setSegments(java.util.Collection<Segment> segments) {
if (segments == null) {
this.segments = null;
return;
}
this.segments = new java.util.ArrayList<Segment>(segments);
} } | public class class_name {
public void setSegments(java.util.Collection<Segment> segments) {
if (segments == null) {
this.segments = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.segments = new java.util.ArrayList<Segment>(segments);
} } |
public class class_name {
private ServiceHandle<S> doRegister(ServiceEndPoint endPoint) {
checkNotNull(endPoint);
ServiceHandle<S> toDelete = null;
ServiceHandle<S> toReturn;
synchronized (this) {
HeavyServiceHandle<S> existingServiceHandle = _instancesPerEndpoint.get(endPoint);
if (existingServiceHandle == null || existingServiceHandle.hasBeenFlaggedForEviction() || existingServiceHandle.isOld()) {
// If there was not an existingServiceHandle, then make a new one.
//
// If existingServiceHandle.hasBeenFlaggedForEviction() is true, that means this EndPoint
// has been "evicted" for being "bad" but has recovered before the Eviction timeout
// process has gotten around to cleaning up this serviceHandle. In this case, we assume
// the "safest" thing to do is to create a new Client for that EndPoint, in case the
// problem was with the "old" client.
//
// If the existingServiceHandle is "new" don't create a new client object due to the
// race condition in HostDiscovery and ServicePool, which can cause a checkOut() to
// occur before its associated ServiceCache.register().
// Thus we want have a short period of time where duplicate "checkouts" and a register
// will not thrash the system creating a series of Client instances.
//
// _serviceFactory.create(endPoint) is a potentially expensive operation, memory, file handles, etc.
// hence we really only want to do it when we have to, preferably via the out-of-band
// ServiceCache.register() method, instead of the high traffic checkOut method.
S service = _serviceFactory.create(endPoint);
_serviceCounter.inc();
HeavyServiceHandle<S> newServiceHandle = new HeavyServiceHandle<>(service, endPoint);
// add the newServiceHandle to a new copy of the _instancesPerEndpoint map
Map<ServiceEndPoint, HeavyServiceHandle<S>> sourceCopy = Maps.newHashMap(_instancesPerEndpoint);
sourceCopy.put(endPoint, newServiceHandle);
_instancesPerEndpoint = sourceCopy;
toDelete = existingServiceHandle;
toReturn = newServiceHandle;
} else {
// The existingServiceHandle was not null, not evicted, and not old, thus we did not recreate it.
toReturn = existingServiceHandle;
}
}
// Destroy instances outside the synchronization, with the idea being it may be an expensive operation
if (toDelete != null) {
destroyService(toDelete);
_serviceCounter.dec();
}
return toReturn;
} } | public class class_name {
private ServiceHandle<S> doRegister(ServiceEndPoint endPoint) {
checkNotNull(endPoint);
ServiceHandle<S> toDelete = null;
ServiceHandle<S> toReturn;
synchronized (this) {
HeavyServiceHandle<S> existingServiceHandle = _instancesPerEndpoint.get(endPoint);
if (existingServiceHandle == null || existingServiceHandle.hasBeenFlaggedForEviction() || existingServiceHandle.isOld()) {
// If there was not an existingServiceHandle, then make a new one.
//
// If existingServiceHandle.hasBeenFlaggedForEviction() is true, that means this EndPoint
// has been "evicted" for being "bad" but has recovered before the Eviction timeout
// process has gotten around to cleaning up this serviceHandle. In this case, we assume
// the "safest" thing to do is to create a new Client for that EndPoint, in case the
// problem was with the "old" client.
//
// If the existingServiceHandle is "new" don't create a new client object due to the
// race condition in HostDiscovery and ServicePool, which can cause a checkOut() to
// occur before its associated ServiceCache.register().
// Thus we want have a short period of time where duplicate "checkouts" and a register
// will not thrash the system creating a series of Client instances.
//
// _serviceFactory.create(endPoint) is a potentially expensive operation, memory, file handles, etc.
// hence we really only want to do it when we have to, preferably via the out-of-band
// ServiceCache.register() method, instead of the high traffic checkOut method.
S service = _serviceFactory.create(endPoint);
_serviceCounter.inc(); // depends on control dependency: [if], data = [none]
HeavyServiceHandle<S> newServiceHandle = new HeavyServiceHandle<>(service, endPoint);
// add the newServiceHandle to a new copy of the _instancesPerEndpoint map
Map<ServiceEndPoint, HeavyServiceHandle<S>> sourceCopy = Maps.newHashMap(_instancesPerEndpoint);
sourceCopy.put(endPoint, newServiceHandle); // depends on control dependency: [if], data = [none]
_instancesPerEndpoint = sourceCopy; // depends on control dependency: [if], data = [none]
toDelete = existingServiceHandle; // depends on control dependency: [if], data = [none]
toReturn = newServiceHandle; // depends on control dependency: [if], data = [none]
} else {
// The existingServiceHandle was not null, not evicted, and not old, thus we did not recreate it.
toReturn = existingServiceHandle; // depends on control dependency: [if], data = [none]
}
}
// Destroy instances outside the synchronization, with the idea being it may be an expensive operation
if (toDelete != null) {
destroyService(toDelete); // depends on control dependency: [if], data = [(toDelete]
_serviceCounter.dec(); // depends on control dependency: [if], data = [none]
}
return toReturn;
} } |
public class class_name {
private void generatePostconditionChecks(WyilFile.Stmt.Return stmt, Expr[] exprs, Context context) {
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
.getParent().enclosingDeclaration;
WyilFile.Tuple<WyilFile.Expr> postcondition = declaration.getEnsures();
Tuple<WyilFile.Decl.Variable> parameters = declaration.getParameters();
Tuple<WyilFile.Decl.Variable> returns = declaration.getReturns();
// First, check whether or not there are any postconditions!
if (postcondition.size() > 0) {
// There is at least one return value and at least one
// postcondition clause. Therefore, we need to check the return
// values against the post condition(s). One of the difficulties
// here is that the postcondition will refer to parameters as
// they were on entry to the function/method, not as they are
// now.
Expr[] arguments = new Expr[parameters.size() + returns.size()];
// Translate parameters as arguments to post-condition
// invocation
for (int i = 0; i != parameters.size(); ++i) {
WyilFile.Decl.Variable var = parameters.get(i);
WyalFile.VariableDeclaration vd = context.readFirst(var);
arguments[i] = new Expr.VariableAccess(vd);
}
// Copy over return expressions as arguments for invocation(s)
System.arraycopy(exprs, 0, arguments, parameters.size(), exprs.length);
//
// Finally, generate an appropriate verification condition to
// check each postcondition clause
for (int i = 0; i != postcondition.size(); ++i) {
Name ident = convert(declaration.getQualifiedName(), "_ensures_" + i, declaration.getName());
Expr clause = new Expr.Invoke(null, ident, null, arguments);
context.emit(new VerificationCondition("postcondition may not be satisfied", context.assumptions,
clause, stmt.getParent(WyilFile.Attribute.Span.class)));
}
}
} } | public class class_name {
private void generatePostconditionChecks(WyilFile.Stmt.Return stmt, Expr[] exprs, Context context) {
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
.getParent().enclosingDeclaration;
WyilFile.Tuple<WyilFile.Expr> postcondition = declaration.getEnsures();
Tuple<WyilFile.Decl.Variable> parameters = declaration.getParameters();
Tuple<WyilFile.Decl.Variable> returns = declaration.getReturns();
// First, check whether or not there are any postconditions!
if (postcondition.size() > 0) {
// There is at least one return value and at least one
// postcondition clause. Therefore, we need to check the return
// values against the post condition(s). One of the difficulties
// here is that the postcondition will refer to parameters as
// they were on entry to the function/method, not as they are
// now.
Expr[] arguments = new Expr[parameters.size() + returns.size()];
// Translate parameters as arguments to post-condition
// invocation
for (int i = 0; i != parameters.size(); ++i) {
WyilFile.Decl.Variable var = parameters.get(i);
WyalFile.VariableDeclaration vd = context.readFirst(var);
arguments[i] = new Expr.VariableAccess(vd); // depends on control dependency: [for], data = [i]
}
// Copy over return expressions as arguments for invocation(s)
System.arraycopy(exprs, 0, arguments, parameters.size(), exprs.length); // depends on control dependency: [if], data = [none]
//
// Finally, generate an appropriate verification condition to
// check each postcondition clause
for (int i = 0; i != postcondition.size(); ++i) {
Name ident = convert(declaration.getQualifiedName(), "_ensures_" + i, declaration.getName());
Expr clause = new Expr.Invoke(null, ident, null, arguments);
context.emit(new VerificationCondition("postcondition may not be satisfied", context.assumptions,
clause, stmt.getParent(WyilFile.Attribute.Span.class))); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public XExtension getByUri(URI uri) {
XExtension extension = extensionMap.get(uri);
if (extension == null) {
try {
extension = XExtensionParser.instance().parse(uri);
register(extension);
XLogging.log("Imported XES extension '" + extension.getUri()
+ "' from remote source", XLogging.Importance.DEBUG);
} catch (IOException e) {
// Now do something if the Internet is down...
} catch (ParserConfigurationException | SAXException e) {
e.printStackTrace();
return null;
}
cacheExtension(uri);
}
return extension;
} } | public class class_name {
public XExtension getByUri(URI uri) {
XExtension extension = extensionMap.get(uri);
if (extension == null) {
try {
extension = XExtensionParser.instance().parse(uri); // depends on control dependency: [try], data = [none]
register(extension); // depends on control dependency: [try], data = [none]
XLogging.log("Imported XES extension '" + extension.getUri()
+ "' from remote source", XLogging.Importance.DEBUG); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// Now do something if the Internet is down...
} catch (ParserConfigurationException | SAXException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
return null;
} // depends on control dependency: [catch], data = [none]
cacheExtension(uri); // depends on control dependency: [if], data = [none]
}
return extension;
} } |
public class class_name {
public String getSitePath(String rootPath) {
String result = null;
if (CmsStringUtil.isNotEmpty(rootPath)) {
if (rootPath.startsWith(m_siteRoot)) {
result = rootPath.substring(m_siteRoot.length());
}
}
return result;
} } | public class class_name {
public String getSitePath(String rootPath) {
String result = null;
if (CmsStringUtil.isNotEmpty(rootPath)) {
if (rootPath.startsWith(m_siteRoot)) {
result = rootPath.substring(m_siteRoot.length()); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
private static String encodeCacheKey(OcspResponseCacheKey ocsp_cache_key)
{
try
{
DigestCalculator digest = new SHA1DigestCalculator();
AlgorithmIdentifier algo = digest.getAlgorithmIdentifier();
ASN1OctetString nameHash = ASN1OctetString.getInstance(ocsp_cache_key.nameHash);
ASN1OctetString keyHash = ASN1OctetString.getInstance(ocsp_cache_key.keyHash);
ASN1Integer snumber = new ASN1Integer(ocsp_cache_key.serialNumber);
CertID cid = new CertID(algo, nameHash, keyHash, snumber);
return Base64.encodeBase64String(cid.toASN1Primitive().getEncoded());
}
catch (Exception ex)
{
LOGGER.debug("Failed to encode cache key to base64 encoded cert id");
}
return null;
} } | public class class_name {
private static String encodeCacheKey(OcspResponseCacheKey ocsp_cache_key)
{
try
{
DigestCalculator digest = new SHA1DigestCalculator();
AlgorithmIdentifier algo = digest.getAlgorithmIdentifier();
ASN1OctetString nameHash = ASN1OctetString.getInstance(ocsp_cache_key.nameHash);
ASN1OctetString keyHash = ASN1OctetString.getInstance(ocsp_cache_key.keyHash);
ASN1Integer snumber = new ASN1Integer(ocsp_cache_key.serialNumber);
CertID cid = new CertID(algo, nameHash, keyHash, snumber);
return Base64.encodeBase64String(cid.toASN1Primitive().getEncoded()); // depends on control dependency: [try], data = [none]
}
catch (Exception ex)
{
LOGGER.debug("Failed to encode cache key to base64 encoded cert id");
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
@SuppressWarnings("PMD.ConfusingTernary")
private void initAudit(final CommonProperties commonProps) {
try {
final String auditClassName = commonProps.getAuditClassName();
// this would be harder to read when following PMD's advice - ignoring the PMD warning
if (!commonProps.isAuditEnabled()) {
final String error = "Auditing has been disabled in the JAAS configuration";
LOG.info(error);
} else if (auditClassName == null) {
final String error =
"Auditing has been enabled in the JAAS configuration, but no audit class has been configured";
LOG.error(error);
throw new IllegalStateException(error);
} else {
if (commonProps.isAuditSingleton()) {
LOG.debug("Requesting singleton audit class instance of '" + auditClassName
+ "' from the audit factory");
this.audit = AuditFactory.getSingleton(auditClassName, commonProps);
} else {
LOG.debug("Requesting non-singleton audit class instance of '" + auditClassName
+ "' from the audit factory");
this.audit = AuditFactory.getInstance(auditClassName, commonProps);
}
}
} catch (FactoryException e) {
final String error = "The audit class cannot be instantiated. This is most likely a configuration"
+ " problem. Is the configured class available in the classpath?";
LOG.error(error, e);
throw new IllegalStateException(error, e);
}
} } | public class class_name {
@SuppressWarnings("PMD.ConfusingTernary")
private void initAudit(final CommonProperties commonProps) {
try {
final String auditClassName = commonProps.getAuditClassName();
// this would be harder to read when following PMD's advice - ignoring the PMD warning
if (!commonProps.isAuditEnabled()) {
final String error = "Auditing has been disabled in the JAAS configuration";
LOG.info(error); // depends on control dependency: [if], data = [none]
} else if (auditClassName == null) {
final String error =
"Auditing has been enabled in the JAAS configuration, but no audit class has been configured";
LOG.error(error);
throw new IllegalStateException(error);
} else {
if (commonProps.isAuditSingleton()) {
LOG.debug("Requesting singleton audit class instance of '" + auditClassName
+ "' from the audit factory"); // depends on control dependency: [if], data = [none]
this.audit = AuditFactory.getSingleton(auditClassName, commonProps); // depends on control dependency: [if], data = [none]
} else {
LOG.debug("Requesting non-singleton audit class instance of '" + auditClassName
+ "' from the audit factory"); // depends on control dependency: [if], data = [none]
this.audit = AuditFactory.getInstance(auditClassName, commonProps); // depends on control dependency: [if], data = [none]
}
}
} catch (FactoryException e) {
final String error = "The audit class cannot be instantiated. This is most likely a configuration"
+ " problem. Is the configured class available in the classpath?";
LOG.error(error, e);
throw new IllegalStateException(error, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private <T> Constructor<T> findFromStringConstructorByType(Class<T> cls) {
try {
return cls.getDeclaredConstructor(String.class);
} catch (NoSuchMethodException ex) {
try {
return cls.getDeclaredConstructor(CharSequence.class);
} catch (NoSuchMethodException ex2) {
throw new IllegalArgumentException("Constructor not found", ex2);
}
}
} } | public class class_name {
private <T> Constructor<T> findFromStringConstructorByType(Class<T> cls) {
try {
return cls.getDeclaredConstructor(String.class);
// depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException ex) {
try {
return cls.getDeclaredConstructor(CharSequence.class);
// depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException ex2) {
throw new IllegalArgumentException("Constructor not found", ex2);
}
// depends on control dependency: [catch], data = [none]
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public List<Peer> findPeersOfAtLeastVersion(long protocolVersion) {
lock.lock();
try {
ArrayList<Peer> results = new ArrayList<>(peers.size());
for (Peer peer : peers)
if (peer.getPeerVersionMessage().clientVersion >= protocolVersion)
results.add(peer);
return results;
} finally {
lock.unlock();
}
} } | public class class_name {
public List<Peer> findPeersOfAtLeastVersion(long protocolVersion) {
lock.lock();
try {
ArrayList<Peer> results = new ArrayList<>(peers.size());
for (Peer peer : peers)
if (peer.getPeerVersionMessage().clientVersion >= protocolVersion)
results.add(peer);
return results; // depends on control dependency: [try], data = [none]
} finally {
lock.unlock();
}
} } |
public class class_name {
@Override
public StringBuffer getRequestURL() {
// strip off any session id from the url here
String rc = SessionInfo.stripURL(this.request.getURL(),
this.sessionData);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getRequestURL: " + rc);
}
return new StringBuffer(rc);
} } | public class class_name {
@Override
public StringBuffer getRequestURL() {
// strip off any session id from the url here
String rc = SessionInfo.stripURL(this.request.getURL(),
this.sessionData);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getRequestURL: " + rc); // depends on control dependency: [if], data = [none]
}
return new StringBuffer(rc);
} } |
public class class_name {
public void setAtoms(Atom[] atoms){
Structure s = new StructureImpl();
Chain c = new ChainImpl();
c.setId("A");
for (Atom a: atoms){
c.addGroup(a.getGroup());
}
s.addChain(c);
setStructure(s);
} } | public class class_name {
public void setAtoms(Atom[] atoms){
Structure s = new StructureImpl();
Chain c = new ChainImpl();
c.setId("A");
for (Atom a: atoms){
c.addGroup(a.getGroup()); // depends on control dependency: [for], data = [a]
}
s.addChain(c);
setStructure(s);
} } |
public class class_name {
public void setUnprocessedStatistics(java.util.Collection<UnprocessedStatistics> unprocessedStatistics) {
if (unprocessedStatistics == null) {
this.unprocessedStatistics = null;
return;
}
this.unprocessedStatistics = new java.util.ArrayList<UnprocessedStatistics>(unprocessedStatistics);
} } | public class class_name {
public void setUnprocessedStatistics(java.util.Collection<UnprocessedStatistics> unprocessedStatistics) {
if (unprocessedStatistics == null) {
this.unprocessedStatistics = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.unprocessedStatistics = new java.util.ArrayList<UnprocessedStatistics>(unprocessedStatistics);
} } |
public class class_name {
private static int getBlockLength(String text, int offset)
{
int startIndex = offset;
boolean finished = false;
char c;
while (finished == false)
{
c = text.charAt(offset);
switch (c)
{
case '\r':
case '\n':
case '}':
{
finished = true;
break;
}
default:
{
++offset;
break;
}
}
}
int length = offset - startIndex;
return (length);
} } | public class class_name {
private static int getBlockLength(String text, int offset)
{
int startIndex = offset;
boolean finished = false;
char c;
while (finished == false)
{
c = text.charAt(offset); // depends on control dependency: [while], data = [none]
switch (c)
{
case '\r':
case '\n':
case '}':
{
finished = true;
break;
}
default:
{
++offset;
break;
}
}
}
int length = offset - startIndex;
return (length);
} } |
public class class_name {
public String getContextConfig(final String configName) {
String configValue = null;
AccessPoint context = getWbRequest().getAccessPoint();
if(context != null) {
Properties configs = context.getConfigs();
if(configs != null) {
configValue = configs.getProperty(configName);
}
}
return configValue;
} } | public class class_name {
public String getContextConfig(final String configName) {
String configValue = null;
AccessPoint context = getWbRequest().getAccessPoint();
if(context != null) {
Properties configs = context.getConfigs();
if(configs != null) {
configValue = configs.getProperty(configName); // depends on control dependency: [if], data = [none]
}
}
return configValue;
} } |
public class class_name {
private CmsType readTypes(CmsXmlContentDefinition xmlContentDefinition, String path) {
String typeName = (CmsStringUtil.isEmptyOrWhitespaceOnly(path) ? "" : (path + ":"))
+ CmsContentService.getTypeUri(xmlContentDefinition);
if (m_registeredTypes.containsKey(typeName)) {
return m_registeredTypes.get(typeName);
}
CmsType type = new CmsType(typeName);
type.setChoiceMaxOccurrence(xmlContentDefinition.getChoiceMaxOccurs());
m_registeredTypes.put(typeName, type);
CmsType choiceType = null;
if (type.isChoice()) {
choiceType = new CmsType(typeName + "/" + CmsType.CHOICE_ATTRIBUTE_NAME);
m_registeredTypes.put(choiceType.getId(), choiceType);
type.addAttribute(CmsType.CHOICE_ATTRIBUTE_NAME, choiceType, 1, xmlContentDefinition.getChoiceMaxOccurs());
}
ArrayList<DisplayTypeEvaluator> evaluators = new ArrayList<DisplayTypeEvaluator>();
for (I_CmsXmlSchemaType subType : xmlContentDefinition.getTypeSequence()) {
String subTypeName = null;
String childPath = path + "/" + subType.getName();
String subAttributeName = CmsContentService.getAttributeName(subType.getName(), typeName);
DisplayTypeEvaluator ev = readConfiguration((A_CmsXmlContentValue)subType, childPath);
ev.setAttributeName(subAttributeName);
evaluators.add(ev);
CmsType subEntityType;
if (subType.isSimpleType()) {
subTypeName = CmsContentService.TYPE_NAME_PREFIX + subType.getTypeName();
if (!m_registeredTypes.containsKey(subTypeName)) {
subEntityType = new CmsType(subTypeName);
m_registeredTypes.put(subTypeName, subEntityType);
} else {
subEntityType = m_registeredTypes.get(subTypeName);
}
} else {
CmsXmlContentDefinition subTypeDefinition = ((CmsXmlNestedContentDefinition)subType).getNestedContentDefinition();
subTypeName = CmsContentService.getTypeUri(subTypeDefinition);
subEntityType = readTypes(subTypeDefinition, childPath);
}
if (choiceType != null) {
choiceType.addAttribute(
subAttributeName,
subEntityType,
subType.getMinOccurs(),
subType.getMaxOccurs());
} else {
type.addAttribute(subAttributeName, subEntityType, subType.getMinOccurs(), subType.getMaxOccurs());
}
}
DisplayType predecessor = null;
for (int i = 0; i < evaluators.size(); i++) {
DisplayTypeEvaluator ev = evaluators.get(i);
DisplayType successor = ((i + 1) < evaluators.size()) ? evaluators.get(i + 1).getProposedType() : null;
CmsAttributeConfiguration evaluated = ev.getEvaluatedConfiguration(predecessor, successor);
m_attributeConfigurations.put(ev.getAttributeName(), evaluated);
if (evaluated.isLocaleSynchronized()) {
m_localeSynchronizations.add(ev.getAttributeName());
}
if (evaluated.isDynamicallyLoaded()) {
m_dynamicallyLoaded.add(ev.getAttributeName());
}
predecessor = DisplayType.valueOf(evaluated.getDisplayType());
}
return type;
} } | public class class_name {
private CmsType readTypes(CmsXmlContentDefinition xmlContentDefinition, String path) {
String typeName = (CmsStringUtil.isEmptyOrWhitespaceOnly(path) ? "" : (path + ":"))
+ CmsContentService.getTypeUri(xmlContentDefinition);
if (m_registeredTypes.containsKey(typeName)) {
return m_registeredTypes.get(typeName);
// depends on control dependency: [if], data = [none]
}
CmsType type = new CmsType(typeName);
type.setChoiceMaxOccurrence(xmlContentDefinition.getChoiceMaxOccurs());
m_registeredTypes.put(typeName, type);
CmsType choiceType = null;
if (type.isChoice()) {
choiceType = new CmsType(typeName + "/" + CmsType.CHOICE_ATTRIBUTE_NAME);
// depends on control dependency: [if], data = [none]
m_registeredTypes.put(choiceType.getId(), choiceType);
// depends on control dependency: [if], data = [none]
type.addAttribute(CmsType.CHOICE_ATTRIBUTE_NAME, choiceType, 1, xmlContentDefinition.getChoiceMaxOccurs());
// depends on control dependency: [if], data = [none]
}
ArrayList<DisplayTypeEvaluator> evaluators = new ArrayList<DisplayTypeEvaluator>();
for (I_CmsXmlSchemaType subType : xmlContentDefinition.getTypeSequence()) {
String subTypeName = null;
String childPath = path + "/" + subType.getName();
String subAttributeName = CmsContentService.getAttributeName(subType.getName(), typeName);
DisplayTypeEvaluator ev = readConfiguration((A_CmsXmlContentValue)subType, childPath);
ev.setAttributeName(subAttributeName);
// depends on control dependency: [for], data = [none]
evaluators.add(ev);
// depends on control dependency: [for], data = [none]
CmsType subEntityType;
if (subType.isSimpleType()) {
subTypeName = CmsContentService.TYPE_NAME_PREFIX + subType.getTypeName();
// depends on control dependency: [if], data = [none]
if (!m_registeredTypes.containsKey(subTypeName)) {
subEntityType = new CmsType(subTypeName);
// depends on control dependency: [if], data = [none]
m_registeredTypes.put(subTypeName, subEntityType);
// depends on control dependency: [if], data = [none]
} else {
subEntityType = m_registeredTypes.get(subTypeName);
// depends on control dependency: [if], data = [none]
}
} else {
CmsXmlContentDefinition subTypeDefinition = ((CmsXmlNestedContentDefinition)subType).getNestedContentDefinition();
subTypeName = CmsContentService.getTypeUri(subTypeDefinition);
// depends on control dependency: [if], data = [none]
subEntityType = readTypes(subTypeDefinition, childPath);
// depends on control dependency: [if], data = [none]
}
if (choiceType != null) {
choiceType.addAttribute(
subAttributeName,
subEntityType,
subType.getMinOccurs(),
subType.getMaxOccurs());
// depends on control dependency: [if], data = [none]
} else {
type.addAttribute(subAttributeName, subEntityType, subType.getMinOccurs(), subType.getMaxOccurs());
// depends on control dependency: [if], data = [none]
}
}
DisplayType predecessor = null;
for (int i = 0; i < evaluators.size(); i++) {
DisplayTypeEvaluator ev = evaluators.get(i);
DisplayType successor = ((i + 1) < evaluators.size()) ? evaluators.get(i + 1).getProposedType() : null;
CmsAttributeConfiguration evaluated = ev.getEvaluatedConfiguration(predecessor, successor);
m_attributeConfigurations.put(ev.getAttributeName(), evaluated);
// depends on control dependency: [for], data = [none]
if (evaluated.isLocaleSynchronized()) {
m_localeSynchronizations.add(ev.getAttributeName());
// depends on control dependency: [if], data = [none]
}
if (evaluated.isDynamicallyLoaded()) {
m_dynamicallyLoaded.add(ev.getAttributeName());
// depends on control dependency: [if], data = [none]
}
predecessor = DisplayType.valueOf(evaluated.getDisplayType());
// depends on control dependency: [for], data = [none]
}
return type;
} } |
public class class_name {
@Override
public IRenderingElement generateRingElements(IBond bond, IRing ring, RendererModel model) {
if (ringIsAromatic(ring) && showAromaticity.getValue()
&& ring.getAtomCount() < maxDrawableAromaticRing.getValue()) {
ElementGroup pair = new ElementGroup();
if (cdkStyleAromaticity.getValue()) {
pair.add(generateBondElement(bond, IBond.Order.SINGLE, model));
super.setOverrideColor(Color.LIGHT_GRAY);
pair.add(generateInnerElement(bond, ring, model));
super.setOverrideColor(null);
} else {
pair.add(generateBondElement(bond, IBond.Order.SINGLE, model));
if (!painted_rings.contains(ring)) {
painted_rings.add(ring);
pair.add(generateRingRingElement(bond, ring, model));
}
}
return pair;
} else {
return super.generateRingElements(bond, ring, model);
}
} } | public class class_name {
@Override
public IRenderingElement generateRingElements(IBond bond, IRing ring, RendererModel model) {
if (ringIsAromatic(ring) && showAromaticity.getValue()
&& ring.getAtomCount() < maxDrawableAromaticRing.getValue()) {
ElementGroup pair = new ElementGroup();
if (cdkStyleAromaticity.getValue()) {
pair.add(generateBondElement(bond, IBond.Order.SINGLE, model)); // depends on control dependency: [if], data = [none]
super.setOverrideColor(Color.LIGHT_GRAY); // depends on control dependency: [if], data = [none]
pair.add(generateInnerElement(bond, ring, model)); // depends on control dependency: [if], data = [none]
super.setOverrideColor(null); // depends on control dependency: [if], data = [none]
} else {
pair.add(generateBondElement(bond, IBond.Order.SINGLE, model)); // depends on control dependency: [if], data = [none]
if (!painted_rings.contains(ring)) {
painted_rings.add(ring); // depends on control dependency: [if], data = [none]
pair.add(generateRingRingElement(bond, ring, model)); // depends on control dependency: [if], data = [none]
}
}
return pair; // depends on control dependency: [if], data = [none]
} else {
return super.generateRingElements(bond, ring, model); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Deprecated
public String get(String path) {
final JsonValue value = this.values.get(this.pathToProperty(path));
if (value == null) {
return null;
}
if (!value.isString()) {
return value.toString();
}
return value.asString();
} } | public class class_name {
@Deprecated
public String get(String path) {
final JsonValue value = this.values.get(this.pathToProperty(path));
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (!value.isString()) {
return value.toString(); // depends on control dependency: [if], data = [none]
}
return value.asString();
} } |
public class class_name {
public java.util.List<PlatformSummary> getPlatformSummaryList() {
if (platformSummaryList == null) {
platformSummaryList = new com.amazonaws.internal.SdkInternalList<PlatformSummary>();
}
return platformSummaryList;
} } | public class class_name {
public java.util.List<PlatformSummary> getPlatformSummaryList() {
if (platformSummaryList == null) {
platformSummaryList = new com.amazonaws.internal.SdkInternalList<PlatformSummary>(); // depends on control dependency: [if], data = [none]
}
return platformSummaryList;
} } |
public class class_name {
public BatchGetJobsResult withJobs(Job... jobs) {
if (this.jobs == null) {
setJobs(new java.util.ArrayList<Job>(jobs.length));
}
for (Job ele : jobs) {
this.jobs.add(ele);
}
return this;
} } | public class class_name {
public BatchGetJobsResult withJobs(Job... jobs) {
if (this.jobs == null) {
setJobs(new java.util.ArrayList<Job>(jobs.length)); // depends on control dependency: [if], data = [none]
}
for (Job ele : jobs) {
this.jobs.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected boolean isMatchingEvent(SearchCriteria criteria, Event event) {
boolean match = false;
User user = criteria.getUser();
DetectionPoint detectionPoint = criteria.getDetectionPoint();
Rule rule = criteria.getRule();
Collection<String> detectionSystemIds = criteria.getDetectionSystemIds();
DateTime earliest = DateUtils.fromString(criteria.getEarliest());
// check user match if user specified
boolean userMatch = (user != null) ? user.equals(event.getUser()) : true;
// check detection system match if detection systems specified
boolean detectionSystemMatch = (detectionSystemIds != null && detectionSystemIds.size() > 0) ?
detectionSystemIds.contains(event.getDetectionSystem().getDetectionSystemId()) : true;
// check detection point match if detection point specified
boolean detectionPointMatch = (detectionPoint != null) ?
detectionPoint.typeAndThresholdMatches(event.getDetectionPoint()) : true;
// check rule match if rule specified
boolean ruleMatch = (rule != null) ?
rule.typeAndThresholdContainsDetectionPoint(event.getDetectionPoint()) : true;
DateTime eventTimestamp = DateUtils.fromString(event.getTimestamp());
boolean earliestMatch = (earliest != null) ?
(earliest.isBefore(eventTimestamp) || earliest.isEqual(eventTimestamp))
: true;
if (userMatch && detectionSystemMatch && detectionPointMatch && ruleMatch && earliestMatch) {
match = true;
}
return match;
} } | public class class_name {
protected boolean isMatchingEvent(SearchCriteria criteria, Event event) {
boolean match = false;
User user = criteria.getUser();
DetectionPoint detectionPoint = criteria.getDetectionPoint();
Rule rule = criteria.getRule();
Collection<String> detectionSystemIds = criteria.getDetectionSystemIds();
DateTime earliest = DateUtils.fromString(criteria.getEarliest());
// check user match if user specified
boolean userMatch = (user != null) ? user.equals(event.getUser()) : true;
// check detection system match if detection systems specified
boolean detectionSystemMatch = (detectionSystemIds != null && detectionSystemIds.size() > 0) ?
detectionSystemIds.contains(event.getDetectionSystem().getDetectionSystemId()) : true;
// check detection point match if detection point specified
boolean detectionPointMatch = (detectionPoint != null) ?
detectionPoint.typeAndThresholdMatches(event.getDetectionPoint()) : true;
// check rule match if rule specified
boolean ruleMatch = (rule != null) ?
rule.typeAndThresholdContainsDetectionPoint(event.getDetectionPoint()) : true;
DateTime eventTimestamp = DateUtils.fromString(event.getTimestamp());
boolean earliestMatch = (earliest != null) ?
(earliest.isBefore(eventTimestamp) || earliest.isEqual(eventTimestamp))
: true;
if (userMatch && detectionSystemMatch && detectionPointMatch && ruleMatch && earliestMatch) {
match = true; // depends on control dependency: [if], data = [none]
}
return match;
} } |
public class class_name {
public String encode(EObject obj, EReference ref, INode node) {
if (isUseIndexFragment(obj.eResource())) {
return getIndexFragment(obj, ref, node);
}
StringBuilder fragment = new StringBuilder(4).append(XTEXT_LINK).append(SEP);
appendShortFragment(obj, fragment);
fragment.append(SEP);
fragment.append(toShortExternalForm(obj.eClass(), ref)).append(SEP);
getRelativePath(fragment, NodeModelUtils.getNode(obj), node);
return fragment.toString();
} } | public class class_name {
public String encode(EObject obj, EReference ref, INode node) {
if (isUseIndexFragment(obj.eResource())) {
return getIndexFragment(obj, ref, node); // depends on control dependency: [if], data = [none]
}
StringBuilder fragment = new StringBuilder(4).append(XTEXT_LINK).append(SEP);
appendShortFragment(obj, fragment);
fragment.append(SEP);
fragment.append(toShortExternalForm(obj.eClass(), ref)).append(SEP);
getRelativePath(fragment, NodeModelUtils.getNode(obj), node);
return fragment.toString();
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.