code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public InetAddress
getAddress() {
try {
if (name == null)
return InetAddress.getByAddress(toArray(addr));
else
return InetAddress.getByAddress(name.toString(),
toArray(addr));
} catch (UnknownHostException e) {
return null;
}
} } | public class class_name {
public InetAddress
getAddress() {
try {
if (name == null)
return InetAddress.getByAddress(toArray(addr));
else
return InetAddress.getByAddress(name.toString(),
toArray(addr));
} catch (UnknownHostException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings("all")
public SynthPainter getPainter() {
SynthPainter painter = getStyle().getPainter(this);
if (painter != null) {
return painter;
}
return EMPTY_PAINTER;
} } | public class class_name {
@SuppressWarnings("all")
public SynthPainter getPainter() {
SynthPainter painter = getStyle().getPainter(this);
if (painter != null) {
return painter; // depends on control dependency: [if], data = [none]
}
return EMPTY_PAINTER;
} } |
public class class_name {
public CacheEntry getEntry(String cacheName, Object id, boolean ignoreCounting ) {
if (tc.isEntryEnabled())
Tr.entry(tc, "getEntry: {0}", id);
DCache cache = ServerCache.getCache(cacheName);
CacheEntry cacheEntry = null;
if ( cache != null ) {
cacheEntry = (CacheEntry) cache.getEntry(id, CachePerf.REMOTE, ignoreCounting, DCacheBase.INCREMENT_REFF_COUNT);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "getEntry: {0}", id);
return cacheEntry;
} } | public class class_name {
public CacheEntry getEntry(String cacheName, Object id, boolean ignoreCounting ) {
if (tc.isEntryEnabled())
Tr.entry(tc, "getEntry: {0}", id);
DCache cache = ServerCache.getCache(cacheName);
CacheEntry cacheEntry = null;
if ( cache != null ) {
cacheEntry = (CacheEntry) cache.getEntry(id, CachePerf.REMOTE, ignoreCounting, DCacheBase.INCREMENT_REFF_COUNT); // depends on control dependency: [if], data = [none]
}
if (tc.isEntryEnabled())
Tr.exit(tc, "getEntry: {0}", id);
return cacheEntry;
} } |
public class class_name {
public void marshall(GetExportJobsRequest getExportJobsRequest, ProtocolMarshaller protocolMarshaller) {
if (getExportJobsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getExportJobsRequest.getApplicationId(), APPLICATIONID_BINDING);
protocolMarshaller.marshall(getExportJobsRequest.getPageSize(), PAGESIZE_BINDING);
protocolMarshaller.marshall(getExportJobsRequest.getToken(), TOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetExportJobsRequest getExportJobsRequest, ProtocolMarshaller protocolMarshaller) {
if (getExportJobsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getExportJobsRequest.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getExportJobsRequest.getPageSize(), PAGESIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getExportJobsRequest.getToken(), TOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private int[][] houghTransformation(boolean[][] mat) {
final int xres = mat.length, yres = mat[0].length;
final double tscale = STEPS * .66 / (xres + yres);
final int[][] ret = new int[STEPS][STEPS];
for(int x = 0; x < mat.length; x++) {
final boolean[] row = mat[x];
for(int y = 0; y < mat[0].length; y++) {
if(row[y]) {
for(int i = 0; i < STEPS; i++) {
final int d = (STEPS >> 1) + (int) (tscale * (x * table.cos(i) + y * table.sin(i)));
if(d > 0 && d < STEPS) {
ret[d][i]++;
}
}
}
}
}
return ret;
} } | public class class_name {
private int[][] houghTransformation(boolean[][] mat) {
final int xres = mat.length, yres = mat[0].length;
final double tscale = STEPS * .66 / (xres + yres);
final int[][] ret = new int[STEPS][STEPS];
for(int x = 0; x < mat.length; x++) {
final boolean[] row = mat[x];
for(int y = 0; y < mat[0].length; y++) {
if(row[y]) {
for(int i = 0; i < STEPS; i++) {
final int d = (STEPS >> 1) + (int) (tscale * (x * table.cos(i) + y * table.sin(i)));
if(d > 0 && d < STEPS) {
ret[d][i]++; // depends on control dependency: [if], data = [none]
}
}
}
}
}
return ret;
} } |
public class class_name {
@Override
public void cacheResult(
List<CommerceAvailabilityEstimate> commerceAvailabilityEstimates) {
for (CommerceAvailabilityEstimate commerceAvailabilityEstimate : commerceAvailabilityEstimates) {
if (entityCache.getResult(
CommerceAvailabilityEstimateModelImpl.ENTITY_CACHE_ENABLED,
CommerceAvailabilityEstimateImpl.class,
commerceAvailabilityEstimate.getPrimaryKey()) == null) {
cacheResult(commerceAvailabilityEstimate);
}
else {
commerceAvailabilityEstimate.resetOriginalValues();
}
}
} } | public class class_name {
@Override
public void cacheResult(
List<CommerceAvailabilityEstimate> commerceAvailabilityEstimates) {
for (CommerceAvailabilityEstimate commerceAvailabilityEstimate : commerceAvailabilityEstimates) {
if (entityCache.getResult(
CommerceAvailabilityEstimateModelImpl.ENTITY_CACHE_ENABLED,
CommerceAvailabilityEstimateImpl.class,
commerceAvailabilityEstimate.getPrimaryKey()) == null) {
cacheResult(commerceAvailabilityEstimate); // depends on control dependency: [if], data = [none]
}
else {
commerceAvailabilityEstimate.resetOriginalValues(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
void trimWhitespaceFromFunctionEnd() {
assert (callStack.getCurrentElement().type == PushPopType.Function);
int functionStartPoint = callStack.getCurrentElement().functionStartInOuputStream;
// If the start point has become -1, it means that some non-whitespace
// text has been pushed, so it's safe to go as far back as we're able.
if (functionStartPoint == -1) {
functionStartPoint = 0;
}
// Trim whitespace from END of function call
for (int i = outputStream.size() - 1; i >= functionStartPoint; i--) {
RTObject obj = outputStream.get(i);
if (!(obj instanceof StringValue))
continue;
StringValue txt = (StringValue) obj;
if (obj instanceof ControlCommand)
break;
if (txt.isNewline() || txt.isInlineWhitespace()) {
outputStream.remove(i);
outputStreamDirty();
} else {
break;
}
}
} } | public class class_name {
void trimWhitespaceFromFunctionEnd() {
assert (callStack.getCurrentElement().type == PushPopType.Function);
int functionStartPoint = callStack.getCurrentElement().functionStartInOuputStream;
// If the start point has become -1, it means that some non-whitespace
// text has been pushed, so it's safe to go as far back as we're able.
if (functionStartPoint == -1) {
functionStartPoint = 0; // depends on control dependency: [if], data = [none]
}
// Trim whitespace from END of function call
for (int i = outputStream.size() - 1; i >= functionStartPoint; i--) {
RTObject obj = outputStream.get(i);
if (!(obj instanceof StringValue))
continue;
StringValue txt = (StringValue) obj;
if (obj instanceof ControlCommand)
break;
if (txt.isNewline() || txt.isInlineWhitespace()) {
outputStream.remove(i); // depends on control dependency: [if], data = [none]
outputStreamDirty(); // depends on control dependency: [if], data = [none]
} else {
break;
}
}
} } |
public class class_name {
public static void Swap(ComplexNumber[][] z) {
for (int i = 0; i < z.length; i++) {
for (int j = 0; j < z[0].length; j++) {
z[i][j] = new ComplexNumber(z[i][j].imaginary, z[i][j].real);
}
}
} } | public class class_name {
public static void Swap(ComplexNumber[][] z) {
for (int i = 0; i < z.length; i++) {
for (int j = 0; j < z[0].length; j++) {
z[i][j] = new ComplexNumber(z[i][j].imaginary, z[i][j].real);
// depends on control dependency: [for], data = [j]
}
}
} } |
public class class_name {
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
@Override public void run()
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
ProjectExplorer window = new ProjectExplorer();
window.m_frame.setVisible(true);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
} } | public class class_name {
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
@Override public void run()
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // depends on control dependency: [try], data = [none]
ProjectExplorer window = new ProjectExplorer();
window.m_frame.setVisible(true); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
@Override
public void incrementItem(final String name, final String key, final int amount) {
try {
final IncrementCacheResponse response = objectMapper.readValue(
requestFactory
.buildPostRequest(new IncrementCacheItemUrl(hostName, projectId, name, key),
new JsonHttpContent(JSON_FACTORY, new Increment().amount(amount))).execute()
.getContent(), IncrementCacheResponse.class);
// Validate an increment, presence of a value is validation
if (null == response.getValue()) {
String message = MoreObjects.firstNonNull(
response.getMessage(), "Increment value returned NULL");
throw new IllegalArgumentException(message);
}
} catch (final Exception e) {
throw Throwables.propagate(e);
}
} } | public class class_name {
@Override
public void incrementItem(final String name, final String key, final int amount) {
try {
final IncrementCacheResponse response = objectMapper.readValue(
requestFactory
.buildPostRequest(new IncrementCacheItemUrl(hostName, projectId, name, key),
new JsonHttpContent(JSON_FACTORY, new Increment().amount(amount))).execute()
.getContent(), IncrementCacheResponse.class);
// Validate an increment, presence of a value is validation
if (null == response.getValue()) {
String message = MoreObjects.firstNonNull(
response.getMessage(), "Increment value returned NULL");
throw new IllegalArgumentException(message);
}
} catch (final Exception e) {
throw Throwables.propagate(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void setQuota(String src, long nsQuota, long dsQuota)
throws FileNotFoundException, QuotaExceededException {
writeLock();
try {
INodeDirectory dir = unprotectedSetQuota(src, nsQuota, dsQuota);
if (dir != null) {
fsImage.getEditLog().logSetQuota(src, dir.getNsQuota(),
dir.getDsQuota());
}
} finally {
writeUnlock();
}
} } | public class class_name {
void setQuota(String src, long nsQuota, long dsQuota)
throws FileNotFoundException, QuotaExceededException {
writeLock();
try {
INodeDirectory dir = unprotectedSetQuota(src, nsQuota, dsQuota);
if (dir != null) {
fsImage.getEditLog().logSetQuota(src, dir.getNsQuota(),
dir.getDsQuota()); // depends on control dependency: [if], data = [none]
}
} finally {
writeUnlock();
}
} } |
public class class_name {
private TrackMetadata requestMetadataInternal(final DataReference track, final CdjStatus.TrackType trackType,
final boolean failIfPassive) {
// First check if we are using cached data for this request.
MetadataCache cache = getMetadataCache(SlotReference.getSlotReference(track));
if (cache != null && trackType == CdjStatus.TrackType.REKORDBOX) {
return cache.getTrackMetadata(null, track);
}
// Then see if any registered metadata providers can offer it for us.
final MediaDetails sourceDetails = getMediaDetailsFor(track.getSlotReference());
if (sourceDetails != null) {
final TrackMetadata provided = allMetadataProviders.getTrackMetadata(sourceDetails, track);
if (provided != null) {
return provided;
}
}
// At this point, unless we are allowed to actively request the data, we are done. We can always actively
// request tracks from rekordbox.
if (passive.get() && failIfPassive && track.slot != CdjStatus.TrackSourceSlot.COLLECTION) {
return null;
}
// Use the dbserver protocol implementation to request the metadata.
ConnectionManager.ClientTask<TrackMetadata> task = new ConnectionManager.ClientTask<TrackMetadata>() {
@Override
public TrackMetadata useClient(Client client) throws Exception {
return queryMetadata(track, trackType, client);
}
};
try {
return ConnectionManager.getInstance().invokeWithClientSession(track.player, task, "requesting metadata");
} catch (Exception e) {
logger.error("Problem requesting metadata, returning null", e);
}
return null;
} } | public class class_name {
private TrackMetadata requestMetadataInternal(final DataReference track, final CdjStatus.TrackType trackType,
final boolean failIfPassive) {
// First check if we are using cached data for this request.
MetadataCache cache = getMetadataCache(SlotReference.getSlotReference(track));
if (cache != null && trackType == CdjStatus.TrackType.REKORDBOX) {
return cache.getTrackMetadata(null, track); // depends on control dependency: [if], data = [none]
}
// Then see if any registered metadata providers can offer it for us.
final MediaDetails sourceDetails = getMediaDetailsFor(track.getSlotReference());
if (sourceDetails != null) {
final TrackMetadata provided = allMetadataProviders.getTrackMetadata(sourceDetails, track);
if (provided != null) {
return provided; // depends on control dependency: [if], data = [none]
}
}
// At this point, unless we are allowed to actively request the data, we are done. We can always actively
// request tracks from rekordbox.
if (passive.get() && failIfPassive && track.slot != CdjStatus.TrackSourceSlot.COLLECTION) {
return null; // depends on control dependency: [if], data = [none]
}
// Use the dbserver protocol implementation to request the metadata.
ConnectionManager.ClientTask<TrackMetadata> task = new ConnectionManager.ClientTask<TrackMetadata>() {
@Override
public TrackMetadata useClient(Client client) throws Exception {
return queryMetadata(track, trackType, client);
}
};
try {
return ConnectionManager.getInstance().invokeWithClientSession(track.player, task, "requesting metadata"); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("Problem requesting metadata, returning null", e);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
private HttpAction generateRequest(int[] namespace, String orstart, String orend) {
RequestBuilder requestBuilder =
new ApiRequestBuilder() //
.action("query") //
.formatXml() //
.param("list", "oldreviewedpages") //
.param("orlimit", LIMIT) //
;
if (namespace != null) {
String ornamespace = MediaWiki.urlEncode(MWAction.createNsString(namespace));
requestBuilder.param("ornamespace", ornamespace);
}
if (orstart.length() > 0) {
requestBuilder.param("orstart", orstart);
}
if (orend.length() > 0) {
requestBuilder.param("orend", orend);
}
return requestBuilder.buildGet();
} } | public class class_name {
private HttpAction generateRequest(int[] namespace, String orstart, String orend) {
RequestBuilder requestBuilder =
new ApiRequestBuilder() //
.action("query") //
.formatXml() //
.param("list", "oldreviewedpages") //
.param("orlimit", LIMIT) //
;
if (namespace != null) {
String ornamespace = MediaWiki.urlEncode(MWAction.createNsString(namespace));
requestBuilder.param("ornamespace", ornamespace); // depends on control dependency: [if], data = [none]
}
if (orstart.length() > 0) {
requestBuilder.param("orstart", orstart); // depends on control dependency: [if], data = [none]
}
if (orend.length() > 0) {
requestBuilder.param("orend", orend); // depends on control dependency: [if], data = [none]
}
return requestBuilder.buildGet();
} } |
public class class_name {
public ClassScanner includeEntries(final String... includedEntries) {
for (final String includedEntry : includedEntries) {
rulesEntries.include(includedEntry);
}
return this;
} } | public class class_name {
public ClassScanner includeEntries(final String... includedEntries) {
for (final String includedEntry : includedEntries) {
rulesEntries.include(includedEntry); // depends on control dependency: [for], data = [includedEntry]
}
return this;
} } |
public class class_name {
@SuppressWarnings({"JavaDoc"}) @NotNull
private <N extends Node> Renderable widgetize(PageCompilingContext pc, N node, WidgetChain childsChildren) {
if (node instanceof XmlDeclaration) {
try {
XmlDeclaration decl = (XmlDeclaration)node;
return registry.xmlDirectiveWidget(decl.getWholeDeclaration(), pc.lexicalScopes.peek());
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
}
}
// Header widget is a special case, where we match by the name of the tag =(
if ("head".equals(node.nodeName())) {
try {
return registry.headWidget(childsChildren, parseAttribs(node.attributes()), pc.lexicalScopes.peek());
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
}
}
String annotation = node.attr(ANNOTATION);
//if there is no annotation, treat as a raw xml-widget (i.e. tag)
if ((null == annotation) || 0 == annotation.trim().length())
try {
checkUriConsistency(pc, node);
checkFormFields(pc, node);
return registry.xmlWidget(childsChildren, node.nodeName(), parseAttribs(node.attributes()),
pc.lexicalScopes.peek());
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
return Chains.terminal();
}
// Special case: is this annotated with @Require
// if so, tags in head need to be promoted to head of enclosing page.
if (REQUIRE_WIDGET.equalsIgnoreCase(annotation.trim()))
try {
return registry.requireWidget(registry.xmlWidget(childsChildren, node.nodeName(),
parseAttribs(node.attributes()), pc.lexicalScopes.peek()));
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
return Chains.terminal();
}
// If this is NOT a self-rendering widget, give it a child.
// final String widgetName = node.attr(ANNOTATION_KEY).trim().toLowerCase());
final String widgetName = node.attr(ANNOTATION_KEY).toLowerCase();
if (!registry.isSelfRendering(widgetName))
try {
childsChildren = Chains.singleton(registry.xmlWidget(childsChildren, node.nodeName(),
parseAttribs(node.attributes()), pc.lexicalScopes.peek()));
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
}
// Recursively build widget from [Key, expression, child widgets].
try {
return registry.newWidget(widgetName, node.attr(ANNOTATION_CONTENT), childsChildren, pc.lexicalScopes.peek());
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
// This should never be used.
return Chains.terminal();
}
} } | public class class_name {
@SuppressWarnings({"JavaDoc"}) @NotNull
private <N extends Node> Renderable widgetize(PageCompilingContext pc, N node, WidgetChain childsChildren) {
if (node instanceof XmlDeclaration) {
try {
XmlDeclaration decl = (XmlDeclaration)node;
return registry.xmlDirectiveWidget(decl.getWholeDeclaration(), pc.lexicalScopes.peek()); // depends on control dependency: [try], data = [none]
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
} // depends on control dependency: [catch], data = [none]
}
// Header widget is a special case, where we match by the name of the tag =(
if ("head".equals(node.nodeName())) {
try {
return registry.headWidget(childsChildren, parseAttribs(node.attributes()), pc.lexicalScopes.peek()); // depends on control dependency: [try], data = [none]
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
} // depends on control dependency: [catch], data = [none]
}
String annotation = node.attr(ANNOTATION);
//if there is no annotation, treat as a raw xml-widget (i.e. tag)
if ((null == annotation) || 0 == annotation.trim().length())
try {
checkUriConsistency(pc, node); // depends on control dependency: [try], data = [none]
checkFormFields(pc, node); // depends on control dependency: [try], data = [none]
return registry.xmlWidget(childsChildren, node.nodeName(), parseAttribs(node.attributes()),
pc.lexicalScopes.peek()); // depends on control dependency: [try], data = [none]
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
return Chains.terminal();
} // depends on control dependency: [catch], data = [none]
// Special case: is this annotated with @Require
// if so, tags in head need to be promoted to head of enclosing page.
if (REQUIRE_WIDGET.equalsIgnoreCase(annotation.trim()))
try {
return registry.requireWidget(registry.xmlWidget(childsChildren, node.nodeName(),
parseAttribs(node.attributes()), pc.lexicalScopes.peek())); // depends on control dependency: [try], data = [none]
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
return Chains.terminal();
} // depends on control dependency: [catch], data = [none]
// If this is NOT a self-rendering widget, give it a child.
// final String widgetName = node.attr(ANNOTATION_KEY).trim().toLowerCase());
final String widgetName = node.attr(ANNOTATION_KEY).toLowerCase();
if (!registry.isSelfRendering(widgetName))
try {
childsChildren = Chains.singleton(registry.xmlWidget(childsChildren, node.nodeName(),
parseAttribs(node.attributes()), pc.lexicalScopes.peek())); // depends on control dependency: [try], data = [none]
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
} // depends on control dependency: [catch], data = [none]
// Recursively build widget from [Key, expression, child widgets].
try {
return registry.newWidget(widgetName, node.attr(ANNOTATION_CONTENT), childsChildren, pc.lexicalScopes.peek()); // depends on control dependency: [try], data = [none]
} catch (ExpressionCompileException e) {
pc.errors.add(
CompileError.in(node.outerHtml())
.near(line(node))
.causedBy(e)
);
// This should never be used.
return Chains.terminal();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static SortedMap<Short, List<MappeableContainer>> groupByKey(
ImmutableRoaringBitmap... bitmaps) {
Map<Short, List<MappeableContainer>> grouped = new HashMap<>();
for (ImmutableRoaringBitmap bitmap : bitmaps) {
MappeableContainerPointer it = bitmap.highLowContainer.getContainerPointer();
while (null != it.getContainer()) {
MappeableContainer container = it.getContainer();
Short key = it.key();
List<MappeableContainer> slice = grouped.get(key);
if (null == slice) {
slice = new ArrayList<>();
grouped.put(key, slice);
}
slice.add(container);
it.advance();
}
}
SortedMap<Short, List<MappeableContainer>> sorted = new TreeMap<>(BufferUtil::compareUnsigned);
sorted.putAll(grouped);
return sorted;
} } | public class class_name {
public static SortedMap<Short, List<MappeableContainer>> groupByKey(
ImmutableRoaringBitmap... bitmaps) {
Map<Short, List<MappeableContainer>> grouped = new HashMap<>();
for (ImmutableRoaringBitmap bitmap : bitmaps) {
MappeableContainerPointer it = bitmap.highLowContainer.getContainerPointer();
while (null != it.getContainer()) {
MappeableContainer container = it.getContainer();
Short key = it.key();
List<MappeableContainer> slice = grouped.get(key);
if (null == slice) {
slice = new ArrayList<>(); // depends on control dependency: [if], data = [none]
grouped.put(key, slice); // depends on control dependency: [if], data = [slice)]
}
slice.add(container); // depends on control dependency: [while], data = [none]
it.advance(); // depends on control dependency: [while], data = [none]
}
}
SortedMap<Short, List<MappeableContainer>> sorted = new TreeMap<>(BufferUtil::compareUnsigned);
sorted.putAll(grouped);
return sorted;
} } |
public class class_name {
public void marshall(CancellationReason cancellationReason, ProtocolMarshaller protocolMarshaller) {
if (cancellationReason == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cancellationReason.getItem(), ITEM_BINDING);
protocolMarshaller.marshall(cancellationReason.getCode(), CODE_BINDING);
protocolMarshaller.marshall(cancellationReason.getMessage(), MESSAGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CancellationReason cancellationReason, ProtocolMarshaller protocolMarshaller) {
if (cancellationReason == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cancellationReason.getItem(), ITEM_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(cancellationReason.getCode(), CODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(cancellationReason.getMessage(), MESSAGE_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 {
@SuppressWarnings("unchecked")
private static LogAdapterFactory createAdapterFactory()
{
List<LogAdapterFactory> factories = Iterators.asList(ServiceLoader.load(LogAdapterFactory.class));
if (factories.isEmpty())
{
/*
* Always fall back to the JDK, even if our service loading mechanism is hosed for some reason.
*/
factories = Arrays.asList((LogAdapterFactory) new JDKLogAdapterFactory());
}
/*
* Sort factories by priority.
*/
Collections.sort(factories, new WeightedComparator());
/*
* Use the factory with the highest priority.
*/
return factories.get(0);
} } | public class class_name {
@SuppressWarnings("unchecked")
private static LogAdapterFactory createAdapterFactory()
{
List<LogAdapterFactory> factories = Iterators.asList(ServiceLoader.load(LogAdapterFactory.class));
if (factories.isEmpty())
{
/*
* Always fall back to the JDK, even if our service loading mechanism is hosed for some reason.
*/
factories = Arrays.asList((LogAdapterFactory) new JDKLogAdapterFactory()); // depends on control dependency: [if], data = [none]
}
/*
* Sort factories by priority.
*/
Collections.sort(factories, new WeightedComparator());
/*
* Use the factory with the highest priority.
*/
return factories.get(0);
} } |
public class class_name {
public ComputationGraph fitMultiDataSet(String path) {
if (Nd4j.getExecutioner() instanceof GridExecutioner)
((GridExecutioner) Nd4j.getExecutioner()).flushQueue();
JavaRDD<String> paths;
try {
paths = SparkUtils.listPaths(sc, path);
} catch (IOException e) {
throw new RuntimeException("Error listing paths in directory", e);
}
return fitPathsMultiDataSet(paths);
} } | public class class_name {
public ComputationGraph fitMultiDataSet(String path) {
if (Nd4j.getExecutioner() instanceof GridExecutioner)
((GridExecutioner) Nd4j.getExecutioner()).flushQueue();
JavaRDD<String> paths;
try {
paths = SparkUtils.listPaths(sc, path); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException("Error listing paths in directory", e);
} // depends on control dependency: [catch], data = [none]
return fitPathsMultiDataSet(paths);
} } |
public class class_name {
public void marshall(UpdateCoreDefinitionRequest updateCoreDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (updateCoreDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateCoreDefinitionRequest.getCoreDefinitionId(), COREDEFINITIONID_BINDING);
protocolMarshaller.marshall(updateCoreDefinitionRequest.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateCoreDefinitionRequest updateCoreDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (updateCoreDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateCoreDefinitionRequest.getCoreDefinitionId(), COREDEFINITIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateCoreDefinitionRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public List getFailureReason() {
List fr = (List)jmo.getField(TrmFirstContactAccess.BODY_CLIENTATTACHREPLY_FAILUREREASON);
if (fr != null) {
return new ArrayList(fr);
} else {
return null;
}
} } | public class class_name {
public List getFailureReason() {
List fr = (List)jmo.getField(TrmFirstContactAccess.BODY_CLIENTATTACHREPLY_FAILUREREASON);
if (fr != null) {
return new ArrayList(fr); // depends on control dependency: [if], data = [(fr]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String formatNodeLabel(PatriciaTrie.PatriciaNode<V> node, KeyMapper<String> keyMapper,
boolean formatBitString) {
StringBuilder builder = new StringBuilder();
builder.append("<<table border=\"0\" cellborder=\"0\">");
// Key
builder.append("<tr><td>");
builder.append("key: <font color=\"#00a000\">");
builder.append(getNodeLabel(node));
builder.append("</font> </td></tr>");
// Critical bit
builder.append("<tr><td>");
builder.append("bit: <font color=\"blue\">");
builder.append(node.getBit());
builder.append("</font> </td></tr>");
// Bit string
if (formatBitString) {
builder.append("<tr><td>");
builder.append("bitString: <font color=\"blue\">");
String bitString = keyMapper.toBitString(node.getKey());
int c = node.getBit() + node.getBit() / 4;
builder.append(bitString.substring(0, c));
builder.append("<font color=\"red\">");
builder.append(bitString.charAt(c));
builder.append("</font>");
builder.append(bitString.substring(c + 1));
builder.append("</font> </td></tr>");
}
// Value
builder.append("<tr><td>");
builder.append("value: <font color=\"#00a0a0\">");
builder.append(node.getValue());
builder.append("</font> </td></tr>");
builder.append("</table>>");
return builder.toString();
} } | public class class_name {
private String formatNodeLabel(PatriciaTrie.PatriciaNode<V> node, KeyMapper<String> keyMapper,
boolean formatBitString) {
StringBuilder builder = new StringBuilder();
builder.append("<<table border=\"0\" cellborder=\"0\">");
// Key
builder.append("<tr><td>");
builder.append("key: <font color=\"#00a000\">");
builder.append(getNodeLabel(node));
builder.append("</font> </td></tr>");
// Critical bit
builder.append("<tr><td>");
builder.append("bit: <font color=\"blue\">");
builder.append(node.getBit());
builder.append("</font> </td></tr>");
// Bit string
if (formatBitString) {
builder.append("<tr><td>"); // depends on control dependency: [if], data = [none]
builder.append("bitString: <font color=\"blue\">"); // depends on control dependency: [if], data = [none]
String bitString = keyMapper.toBitString(node.getKey());
int c = node.getBit() + node.getBit() / 4;
builder.append(bitString.substring(0, c)); // depends on control dependency: [if], data = [none]
builder.append("<font color=\"red\">"); // depends on control dependency: [if], data = [none]
builder.append(bitString.charAt(c)); // depends on control dependency: [if], data = [none]
builder.append("</font>"); // depends on control dependency: [if], data = [none]
builder.append(bitString.substring(c + 1)); // depends on control dependency: [if], data = [none]
builder.append("</font> </td></tr>"); // depends on control dependency: [if], data = [none]
}
// Value
builder.append("<tr><td>");
builder.append("value: <font color=\"#00a0a0\">");
builder.append(node.getValue());
builder.append("</font> </td></tr>");
builder.append("</table>>");
return builder.toString();
} } |
public class class_name {
public void unregisterPropertyExclusion( Class target, String propertyName ) {
if( target != null && propertyName != null ) {
Set set = (Set) exclusionMap.get( target );
if( set == null ) {
set = new HashSet();
exclusionMap.put( target, set );
}
set.remove( propertyName );
}
} } | public class class_name {
public void unregisterPropertyExclusion( Class target, String propertyName ) {
if( target != null && propertyName != null ) {
Set set = (Set) exclusionMap.get( target );
if( set == null ) {
set = new HashSet(); // depends on control dependency: [if], data = [none]
exclusionMap.put( target, set ); // depends on control dependency: [if], data = [none]
}
set.remove( propertyName ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static String getContentPath(HttpServletRequest request) {
String contentPath = (String)request.getAttribute(Value.CONTENTPATH_ATTRIBUTE);
if (contentPath == null) {
// fallback to suffix if CONTENTPATH_ATTRIBUTE is not set
// (e.g. in inside a /libs/granite/ui/components/foundation/form/multifield component)
contentPath = ((SlingHttpServletRequest)request).getRequestPathInfo().getSuffix();
}
return contentPath;
} } | public class class_name {
private static String getContentPath(HttpServletRequest request) {
String contentPath = (String)request.getAttribute(Value.CONTENTPATH_ATTRIBUTE);
if (contentPath == null) {
// fallback to suffix if CONTENTPATH_ATTRIBUTE is not set
// (e.g. in inside a /libs/granite/ui/components/foundation/form/multifield component)
contentPath = ((SlingHttpServletRequest)request).getRequestPathInfo().getSuffix(); // depends on control dependency: [if], data = [none]
}
return contentPath;
} } |
public class class_name {
public boolean isAvailable (String resource){
Container c = _webapp.getModuleContainer();
if(c != null){
Entry entry = c.getEntry(resource);
if(entry != null){
return true;
}
return isAvailableInDocumentRoot(resource,WCCustomProperties.SERVE_WELCOME_FILE_FROM_EDR);
}
String tempFileString = _webapp.getRealPath(resource);
boolean available = false;
if (tempFileString != null) {
File caseFile = new Java2SecurityFile(tempFileString);
available = caseFile.exists();
if (available && com.ibm.ws.util.FileSystem.isCaseInsensitive) {
try{
available = com.ibm.ws.util.FileSystem.uriCaseCheck(caseFile, resource);
}catch (IOException io){
available = false;
}
}
}
if (!available)
available = isAvailableInDocumentRoot(resource,WCCustomProperties.SERVE_WELCOME_FILE_FROM_EDR);
return available;
} } | public class class_name {
public boolean isAvailable (String resource){
Container c = _webapp.getModuleContainer();
if(c != null){
Entry entry = c.getEntry(resource);
if(entry != null){
return true; // depends on control dependency: [if], data = [none]
}
return isAvailableInDocumentRoot(resource,WCCustomProperties.SERVE_WELCOME_FILE_FROM_EDR); // depends on control dependency: [if], data = [none]
}
String tempFileString = _webapp.getRealPath(resource);
boolean available = false;
if (tempFileString != null) {
File caseFile = new Java2SecurityFile(tempFileString);
available = caseFile.exists(); // depends on control dependency: [if], data = [none]
if (available && com.ibm.ws.util.FileSystem.isCaseInsensitive) {
try{
available = com.ibm.ws.util.FileSystem.uriCaseCheck(caseFile, resource); // depends on control dependency: [try], data = [none]
}catch (IOException io){
available = false;
} // depends on control dependency: [catch], data = [none]
}
}
if (!available)
available = isAvailableInDocumentRoot(resource,WCCustomProperties.SERVE_WELCOME_FILE_FROM_EDR);
return available;
} } |
public class class_name {
static SafeHtml memberItem(final String css, final Principal principal) {
String principalTypeCss = principal.getType() == Principal.Type.USER ? "icon-user" : "icon-group";
StringBuilder title = new StringBuilder();
title.append(principal.getName());
if (principal.getRealm() != null) {
title.append(" (at) ").append(principal.getRealm());
}
if (principal.getRealm() == null) {
return ITEMS.member(css, principal.getName(), title.toString(), principalTypeCss);
} else {
return ITEMS.memberWithRealm(css, principal.getName(), title.toString(), principalTypeCss,
principal.getRealm());
}
} } | public class class_name {
static SafeHtml memberItem(final String css, final Principal principal) {
String principalTypeCss = principal.getType() == Principal.Type.USER ? "icon-user" : "icon-group";
StringBuilder title = new StringBuilder();
title.append(principal.getName());
if (principal.getRealm() != null) {
title.append(" (at) ").append(principal.getRealm()); // depends on control dependency: [if], data = [(principal.getRealm()]
}
if (principal.getRealm() == null) {
return ITEMS.member(css, principal.getName(), title.toString(), principalTypeCss); // depends on control dependency: [if], data = [none]
} else {
return ITEMS.memberWithRealm(css, principal.getName(), title.toString(), principalTypeCss,
principal.getRealm()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static base_responses disable(nitro_service client, String acl6name[]) throws Exception {
base_responses result = null;
if (acl6name != null && acl6name.length > 0) {
nsacl6 disableresources[] = new nsacl6[acl6name.length];
for (int i=0;i<acl6name.length;i++){
disableresources[i] = new nsacl6();
disableresources[i].acl6name = acl6name[i];
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} } | public class class_name {
public static base_responses disable(nitro_service client, String acl6name[]) throws Exception {
base_responses result = null;
if (acl6name != null && acl6name.length > 0) {
nsacl6 disableresources[] = new nsacl6[acl6name.length];
for (int i=0;i<acl6name.length;i++){
disableresources[i] = new nsacl6(); // depends on control dependency: [for], data = [i]
disableresources[i].acl6name = acl6name[i]; // depends on control dependency: [for], data = [i]
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} } |
public class class_name {
public void setEthnologue(String ethnologue) {
if(ethnologue != null) {
ethnologue = ethnologue.trim();
}
this.ethnologue = ethnologue;
} } | public class class_name {
public void setEthnologue(String ethnologue) {
if(ethnologue != null) {
ethnologue = ethnologue.trim(); // depends on control dependency: [if], data = [none]
}
this.ethnologue = ethnologue;
} } |
public class class_name {
protected void extractBeanValues(final Object source, final String[] nameMapping) throws SuperCsvReflectionException {
Objects.requireNonNull(nameMapping, "the nameMapping array can't be null as it's used to map from fields to columns");
beanValues.clear();
for( int i = 0; i < nameMapping.length; i++ ) {
final String fieldName = nameMapping[i];
if( fieldName == null ) {
beanValues.add(null); // assume they always want a blank column
} else {
Method getMethod = cache.getGetMethod(source, fieldName);
try {
beanValues.add(getMethod.invoke(source));
}
catch(final Exception e) {
throw new SuperCsvReflectionException(String.format("error extracting bean value for field %s",
fieldName), e);
}
}
}
} } | public class class_name {
protected void extractBeanValues(final Object source, final String[] nameMapping) throws SuperCsvReflectionException {
Objects.requireNonNull(nameMapping, "the nameMapping array can't be null as it's used to map from fields to columns");
beanValues.clear();
for( int i = 0; i < nameMapping.length; i++ ) {
final String fieldName = nameMapping[i];
if( fieldName == null ) {
beanValues.add(null); // assume they always want a blank column
} else {
Method getMethod = cache.getGetMethod(source, fieldName);
try {
beanValues.add(getMethod.invoke(source));
// depends on control dependency: [try], data = [none]
}
catch(final Exception e) {
throw new SuperCsvReflectionException(String.format("error extracting bean value for field %s",
fieldName), e);
}
// depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public void marshall(PipelineActivity pipelineActivity, ProtocolMarshaller protocolMarshaller) {
if (pipelineActivity == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(pipelineActivity.getChannel(), CHANNEL_BINDING);
protocolMarshaller.marshall(pipelineActivity.getLambda(), LAMBDA_BINDING);
protocolMarshaller.marshall(pipelineActivity.getDatastore(), DATASTORE_BINDING);
protocolMarshaller.marshall(pipelineActivity.getAddAttributes(), ADDATTRIBUTES_BINDING);
protocolMarshaller.marshall(pipelineActivity.getRemoveAttributes(), REMOVEATTRIBUTES_BINDING);
protocolMarshaller.marshall(pipelineActivity.getSelectAttributes(), SELECTATTRIBUTES_BINDING);
protocolMarshaller.marshall(pipelineActivity.getFilter(), FILTER_BINDING);
protocolMarshaller.marshall(pipelineActivity.getMath(), MATH_BINDING);
protocolMarshaller.marshall(pipelineActivity.getDeviceRegistryEnrich(), DEVICEREGISTRYENRICH_BINDING);
protocolMarshaller.marshall(pipelineActivity.getDeviceShadowEnrich(), DEVICESHADOWENRICH_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PipelineActivity pipelineActivity, ProtocolMarshaller protocolMarshaller) {
if (pipelineActivity == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(pipelineActivity.getChannel(), CHANNEL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pipelineActivity.getLambda(), LAMBDA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pipelineActivity.getDatastore(), DATASTORE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pipelineActivity.getAddAttributes(), ADDATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pipelineActivity.getRemoveAttributes(), REMOVEATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pipelineActivity.getSelectAttributes(), SELECTATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pipelineActivity.getFilter(), FILTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pipelineActivity.getMath(), MATH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pipelineActivity.getDeviceRegistryEnrich(), DEVICEREGISTRYENRICH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pipelineActivity.getDeviceShadowEnrich(), DEVICESHADOWENRICH_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void writeRawVarint64(long value) throws IOException {
while (true) {
if ((value & ~0x7FL) == 0) {
writeRawByte((int)value);
return;
} else {
writeRawByte(((int)value & 0x7F) | 0x80);
value >>>= 7;
}
}
} } | public class class_name {
public void writeRawVarint64(long value) throws IOException {
while (true) {
if ((value & ~0x7FL) == 0) {
writeRawByte((int)value); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else {
writeRawByte(((int)value & 0x7F) | 0x80); // depends on control dependency: [if], data = [0)]
value >>>= 7; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public final void makeEntries(final Map<String, Object> pAddParam,
final IDoc pEntity) throws Exception {
Calendar calCurrYear = Calendar.getInstance(new Locale("en", "US"));
calCurrYear.setTime(getSrvAccSettings().lazyGetAccSettings(pAddParam)
.getCurrentAccYear());
calCurrYear.set(Calendar.MONTH, 0);
calCurrYear.set(Calendar.DAY_OF_MONTH, 1);
calCurrYear.set(Calendar.HOUR_OF_DAY, 0);
calCurrYear.set(Calendar.MINUTE, 0);
calCurrYear.set(Calendar.SECOND, 0);
calCurrYear.set(Calendar.MILLISECOND, 0);
Calendar calDoc = Calendar.getInstance(new Locale("en", "US"));
calDoc.setTime(pEntity.getItsDate());
calDoc.set(Calendar.MONTH, 0);
calDoc.set(Calendar.DAY_OF_MONTH, 1);
calDoc.set(Calendar.HOUR_OF_DAY, 0);
calDoc.set(Calendar.MINUTE, 0);
calDoc.set(Calendar.SECOND, 0);
calDoc.set(Calendar.MILLISECOND, 0);
if (calCurrYear.getTime().getTime() != calDoc.getTime().getTime()) {
throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
"wrong_year");
}
StringBuffer sb = new StringBuffer();
List<AccEntriesSourcesLine> sourcesLines = srvAccSettings
.lazyGetAccSettings(pAddParam).getAccEntriesSources();
java.util.Collections.sort(sourcesLines, this.cmprAccSourcesByType);
int i = 0;
for (AccEntriesSourcesLine sourcesLine : sourcesLines) {
if (sourcesLine.getIsUsed()
&& sourcesLine.getSourceType().equals(pEntity.constTypeCode())) {
String query = lazyGetQuery(sourcesLine.getFileName());
String idName = "ITSID";
if (pEntity.getIdBirth() != null) {
idName = "IDBIRTH";
}
query = query.replace(":IDNAME", idName);
//for foreign document this algorithm is also right:
String strWhereDocId = sourcesLine.getSourceIdName() + " = "
+ pEntity.getItsId().toString();
if (query.contains(":WHEREADD")) {
query = query.replace(":WHEREADD", " and " + strWhereDocId);
} else if (query.contains(":WHERE")) {
query = query.replace(":WHERE", " where " + strWhereDocId);
}
if (i++ > 0) {
sb.append("\nunion all\n\n");
}
sb.append(query);
}
}
String langDef = (String) pAddParam.get("langDef");
DateFormat dateFormat = DateFormat.getDateTimeInstance(
DateFormat.MEDIUM, DateFormat.SHORT, new Locale(langDef));
String query = sb.toString();
if (query.trim().length() == 0) {
throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
"there_is_no_accounting_sources");
}
IRecordSet<RS> recordSet = null;
try {
recordSet = getSrvDatabase().retrieveRecords(query);
if (recordSet.moveToFirst()) {
Long itsDateLong = null;
do {
AccountingEntry accEntry = new AccountingEntry();
accEntry.setIdDatabaseBirth(getSrvDatabase().getIdDatabase());
if (itsDateLong == null) {
itsDateLong = pEntity.getItsDate().getTime();
getSrvBalance().handleNewAccountEntry(pAddParam, null, null,
new Date(itsDateLong)); //This is for SrvBalanceStd only!!!
}
Date itsDate = new Date(itsDateLong++);
accEntry.setItsDate(itsDate);
accEntry.setSourceType(pEntity.constTypeCode());
if (pEntity.getIdBirth() != null) { //accounting foreign document
accEntry.setSourceId(pEntity.getIdBirth());
} else {
accEntry.setSourceId(pEntity.getItsId());
}
accEntry.setSourceDatabaseBirth(pEntity.getIdDatabaseBirth());
String accDebitId = recordSet.getString("ACCDEBIT");
Account accDebit = new Account();
accDebit.setItsId(accDebitId);
accEntry.setAccDebit(accDebit);
accEntry.setSubaccDebitType(recordSet.getInteger("SUBACCDEBITTYPE"));
accEntry.setSubaccDebitId(recordSet.getLong("SUBACCDEBITID"));
accEntry.setSubaccDebit(recordSet.getString("SUBACCDEBIT"));
accEntry.setDebit(BigDecimal.valueOf(recordSet.getDouble("DEBIT"))
.setScale(getSrvAccSettings().lazyGetAccSettings(pAddParam)
.getCostPrecision(), getSrvAccSettings()
.lazyGetAccSettings(pAddParam).getRoundingMode()));
String accCreditId = recordSet.getString("ACCCREDIT");
Account accCredit = new Account();
accCredit.setItsId(accCreditId);
accEntry.setAccCredit(accCredit);
accEntry
.setSubaccCreditType(recordSet.getInteger("SUBACCCREDITTYPE"));
accEntry.setSubaccCreditId(recordSet.getLong("SUBACCCREDITID"));
accEntry.setSubaccCredit(recordSet.getString("SUBACCCREDIT"));
accEntry.setCredit(BigDecimal
.valueOf(recordSet.getDouble("CREDIT")).setScale(
getSrvAccSettings().lazyGetAccSettings(pAddParam)
.getCostPrecision(), getSrvAccSettings()
.lazyGetAccSettings(pAddParam).getRoundingMode()));
String docId = pEntity.getItsId().toString();
if (pEntity.getIdBirth() != null) {
docId = pEntity.getIdBirth().toString();
}
String descr = "";
if (pEntity.getDescription() != null) {
descr = " " + pEntity.getDescription();
}
accEntry.setDescription(getSrvI18n().getMsg(pEntity.getClass().
getSimpleName() + "short", langDef) + " #" + pEntity.getIdDatabaseBirth()
+ "-" + docId + ", " + dateFormat.format(pEntity.getItsDate()) + descr);
this.srvOrm.insertEntity(pAddParam, accEntry);
accEntry.setIsNew(false);
} while (recordSet.moveToNext());
}
} finally {
if (recordSet != null) {
recordSet.close();
}
}
pEntity.setHasMadeAccEntries(true);
srvOrm.updateEntity(pAddParam, pEntity);
} } | public class class_name {
@Override
public final void makeEntries(final Map<String, Object> pAddParam,
final IDoc pEntity) throws Exception {
Calendar calCurrYear = Calendar.getInstance(new Locale("en", "US"));
calCurrYear.setTime(getSrvAccSettings().lazyGetAccSettings(pAddParam)
.getCurrentAccYear());
calCurrYear.set(Calendar.MONTH, 0);
calCurrYear.set(Calendar.DAY_OF_MONTH, 1);
calCurrYear.set(Calendar.HOUR_OF_DAY, 0);
calCurrYear.set(Calendar.MINUTE, 0);
calCurrYear.set(Calendar.SECOND, 0);
calCurrYear.set(Calendar.MILLISECOND, 0);
Calendar calDoc = Calendar.getInstance(new Locale("en", "US"));
calDoc.setTime(pEntity.getItsDate());
calDoc.set(Calendar.MONTH, 0);
calDoc.set(Calendar.DAY_OF_MONTH, 1);
calDoc.set(Calendar.HOUR_OF_DAY, 0);
calDoc.set(Calendar.MINUTE, 0);
calDoc.set(Calendar.SECOND, 0);
calDoc.set(Calendar.MILLISECOND, 0);
if (calCurrYear.getTime().getTime() != calDoc.getTime().getTime()) {
throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
"wrong_year");
}
StringBuffer sb = new StringBuffer();
List<AccEntriesSourcesLine> sourcesLines = srvAccSettings
.lazyGetAccSettings(pAddParam).getAccEntriesSources();
java.util.Collections.sort(sourcesLines, this.cmprAccSourcesByType);
int i = 0;
for (AccEntriesSourcesLine sourcesLine : sourcesLines) {
if (sourcesLine.getIsUsed()
&& sourcesLine.getSourceType().equals(pEntity.constTypeCode())) {
String query = lazyGetQuery(sourcesLine.getFileName());
String idName = "ITSID";
if (pEntity.getIdBirth() != null) {
idName = "IDBIRTH"; // depends on control dependency: [if], data = [none]
}
query = query.replace(":IDNAME", idName); // depends on control dependency: [if], data = [none]
//for foreign document this algorithm is also right:
String strWhereDocId = sourcesLine.getSourceIdName() + " = "
+ pEntity.getItsId().toString();
if (query.contains(":WHEREADD")) {
query = query.replace(":WHEREADD", " and " + strWhereDocId); // depends on control dependency: [if], data = [none]
} else if (query.contains(":WHERE")) {
query = query.replace(":WHERE", " where " + strWhereDocId); // depends on control dependency: [if], data = [none]
}
if (i++ > 0) {
sb.append("\nunion all\n\n"); // depends on control dependency: [if], data = [none]
}
sb.append(query); // depends on control dependency: [if], data = [none]
}
}
String langDef = (String) pAddParam.get("langDef");
DateFormat dateFormat = DateFormat.getDateTimeInstance(
DateFormat.MEDIUM, DateFormat.SHORT, new Locale(langDef));
String query = sb.toString();
if (query.trim().length() == 0) {
throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
"there_is_no_accounting_sources");
}
IRecordSet<RS> recordSet = null;
try {
recordSet = getSrvDatabase().retrieveRecords(query);
if (recordSet.moveToFirst()) {
Long itsDateLong = null;
do {
AccountingEntry accEntry = new AccountingEntry();
accEntry.setIdDatabaseBirth(getSrvDatabase().getIdDatabase());
if (itsDateLong == null) {
itsDateLong = pEntity.getItsDate().getTime(); // depends on control dependency: [if], data = [none]
getSrvBalance().handleNewAccountEntry(pAddParam, null, null,
new Date(itsDateLong)); //This is for SrvBalanceStd only!!! // depends on control dependency: [if], data = [none]
}
Date itsDate = new Date(itsDateLong++);
accEntry.setItsDate(itsDate);
accEntry.setSourceType(pEntity.constTypeCode());
if (pEntity.getIdBirth() != null) { //accounting foreign document
accEntry.setSourceId(pEntity.getIdBirth()); // depends on control dependency: [if], data = [(pEntity.getIdBirth()]
} else {
accEntry.setSourceId(pEntity.getItsId()); // depends on control dependency: [if], data = [none]
}
accEntry.setSourceDatabaseBirth(pEntity.getIdDatabaseBirth());
String accDebitId = recordSet.getString("ACCDEBIT");
Account accDebit = new Account();
accDebit.setItsId(accDebitId);
accEntry.setAccDebit(accDebit);
accEntry.setSubaccDebitType(recordSet.getInteger("SUBACCDEBITTYPE"));
accEntry.setSubaccDebitId(recordSet.getLong("SUBACCDEBITID"));
accEntry.setSubaccDebit(recordSet.getString("SUBACCDEBIT"));
accEntry.setDebit(BigDecimal.valueOf(recordSet.getDouble("DEBIT"))
.setScale(getSrvAccSettings().lazyGetAccSettings(pAddParam)
.getCostPrecision(), getSrvAccSettings()
.lazyGetAccSettings(pAddParam).getRoundingMode()));
String accCreditId = recordSet.getString("ACCCREDIT");
Account accCredit = new Account();
accCredit.setItsId(accCreditId);
accEntry.setAccCredit(accCredit);
accEntry
.setSubaccCreditType(recordSet.getInteger("SUBACCCREDITTYPE"));
accEntry.setSubaccCreditId(recordSet.getLong("SUBACCCREDITID"));
accEntry.setSubaccCredit(recordSet.getString("SUBACCCREDIT"));
accEntry.setCredit(BigDecimal
.valueOf(recordSet.getDouble("CREDIT")).setScale(
getSrvAccSettings().lazyGetAccSettings(pAddParam)
.getCostPrecision(), getSrvAccSettings()
.lazyGetAccSettings(pAddParam).getRoundingMode()));
String docId = pEntity.getItsId().toString();
if (pEntity.getIdBirth() != null) {
docId = pEntity.getIdBirth().toString(); // depends on control dependency: [if], data = [none]
}
String descr = "";
if (pEntity.getDescription() != null) {
descr = " " + pEntity.getDescription(); // depends on control dependency: [if], data = [none]
}
accEntry.setDescription(getSrvI18n().getMsg(pEntity.getClass().
getSimpleName() + "short", langDef) + " #" + pEntity.getIdDatabaseBirth()
+ "-" + docId + ", " + dateFormat.format(pEntity.getItsDate()) + descr);
this.srvOrm.insertEntity(pAddParam, accEntry);
accEntry.setIsNew(false);
} while (recordSet.moveToNext());
}
} finally {
if (recordSet != null) {
recordSet.close(); // depends on control dependency: [if], data = [none]
}
}
pEntity.setHasMadeAccEntries(true);
srvOrm.updateEntity(pAddParam, pEntity);
} } |
public class class_name {
public void clear() {
@SuppressWarnings("unchecked") SparseArray<BaseNotificationItem> cloneArray =
(SparseArray<BaseNotificationItem>) notificationArray.clone();
notificationArray.clear();
for (int i = 0; i < cloneArray.size(); i++) {
final BaseNotificationItem n = cloneArray.get(cloneArray.keyAt(i));
n.cancel();
}
} } | public class class_name {
public void clear() {
@SuppressWarnings("unchecked") SparseArray<BaseNotificationItem> cloneArray =
(SparseArray<BaseNotificationItem>) notificationArray.clone();
notificationArray.clear();
for (int i = 0; i < cloneArray.size(); i++) {
final BaseNotificationItem n = cloneArray.get(cloneArray.keyAt(i));
n.cancel(); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public List<Statement> getAllStatements() {
List<Statement> ret = new ArrayList<Statement>();
// Statements within this group
if (statements != null) {
ret.addAll(statements);
}
// Statements within nested statement groups
if (statementGroups != null) {
for (final StatementGroup sg : statementGroups)
ret.addAll(sg.getAllStatements());
}
return ret;
} } | public class class_name {
public List<Statement> getAllStatements() {
List<Statement> ret = new ArrayList<Statement>();
// Statements within this group
if (statements != null) {
ret.addAll(statements); // depends on control dependency: [if], data = [(statements]
}
// Statements within nested statement groups
if (statementGroups != null) {
for (final StatementGroup sg : statementGroups)
ret.addAll(sg.getAllStatements());
}
return ret;
} } |
public class class_name {
@Override
public Set<Integer> find(long[] invariants, IAtomContainer container, int[][] graph) {
int n = invariants.length;
// find cyclic vertices using DFS
RingSearch ringSearch = new RingSearch(container, graph);
// ordered map of the set of vertices for each value
Map<Long, Set<Integer>> equivalent = new TreeMap<Long, Set<Integer>>();
// divide the invariants into equivalent indexed and ordered sets
for (int i = 0; i < invariants.length; i++) {
Long invariant = invariants[i];
Set<Integer> set = equivalent.get(invariant);
if (set == null) {
if (ringSearch.cyclic(i)) {
set = new HashSet<Integer>(n / 2);
set.add(i);
equivalent.put(invariant, set);
}
} else {
set.add(i);
}
}
// find the smallest set of equivalent cyclic vertices
int minSize = Integer.MAX_VALUE;
Set<Integer> min = Collections.emptySet();
for (Map.Entry<Long, Set<Integer>> e : equivalent.entrySet()) {
Set<Integer> vertices = e.getValue();
if (vertices.size() < minSize && vertices.size() > 1) {
min = vertices;
minSize = vertices.size();
} else if (vertices.size() == minSize) {
min.addAll(vertices);
}
}
return min;
} } | public class class_name {
@Override
public Set<Integer> find(long[] invariants, IAtomContainer container, int[][] graph) {
int n = invariants.length;
// find cyclic vertices using DFS
RingSearch ringSearch = new RingSearch(container, graph);
// ordered map of the set of vertices for each value
Map<Long, Set<Integer>> equivalent = new TreeMap<Long, Set<Integer>>();
// divide the invariants into equivalent indexed and ordered sets
for (int i = 0; i < invariants.length; i++) {
Long invariant = invariants[i];
Set<Integer> set = equivalent.get(invariant);
if (set == null) {
if (ringSearch.cyclic(i)) {
set = new HashSet<Integer>(n / 2); // depends on control dependency: [if], data = [none]
set.add(i); // depends on control dependency: [if], data = [none]
equivalent.put(invariant, set); // depends on control dependency: [if], data = [none]
}
} else {
set.add(i); // depends on control dependency: [if], data = [none]
}
}
// find the smallest set of equivalent cyclic vertices
int minSize = Integer.MAX_VALUE;
Set<Integer> min = Collections.emptySet();
for (Map.Entry<Long, Set<Integer>> e : equivalent.entrySet()) {
Set<Integer> vertices = e.getValue();
if (vertices.size() < minSize && vertices.size() > 1) {
min = vertices; // depends on control dependency: [if], data = [none]
minSize = vertices.size(); // depends on control dependency: [if], data = [none]
} else if (vertices.size() == minSize) {
min.addAll(vertices); // depends on control dependency: [if], data = [none]
}
}
return min;
} } |
public class class_name {
private List<Row> getRows(String sql) throws SQLException
{
allocateConnection();
try
{
List<Row> result = new LinkedList<Row>();
m_ps = m_connection.prepareStatement(sql);
m_rs = m_ps.executeQuery();
populateMetaData();
while (m_rs.next())
{
result.add(new MpdResultSetRow(m_rs, m_meta));
}
return (result);
}
finally
{
releaseConnection();
}
} } | public class class_name {
private List<Row> getRows(String sql) throws SQLException
{
allocateConnection();
try
{
List<Row> result = new LinkedList<Row>();
m_ps = m_connection.prepareStatement(sql);
m_rs = m_ps.executeQuery();
populateMetaData();
while (m_rs.next())
{
result.add(new MpdResultSetRow(m_rs, m_meta)); // depends on control dependency: [while], data = [none]
}
return (result);
}
finally
{
releaseConnection();
}
} } |
public class class_name {
public static <E> List<E> deleteOutofRange(Counter<E> c, int top, int bottom) {
List<E> purgedItems = new ArrayList<E>();
int numToPurge = top + bottom;
if (numToPurge <= 0) {
return purgedItems;
}
List<E> l = Counters.toSortedList(c);
for (int i = 0; i < top; i++) {
E item = l.get(i);
purgedItems.add(item);
c.remove(item);
}
int size = c.size();
for (int i = c.size() - 1; i >= (size - bottom); i--) {
E item = l.get(i);
purgedItems.add(item);
c.remove(item);
}
return purgedItems;
} } | public class class_name {
public static <E> List<E> deleteOutofRange(Counter<E> c, int top, int bottom) {
List<E> purgedItems = new ArrayList<E>();
int numToPurge = top + bottom;
if (numToPurge <= 0) {
return purgedItems;
// depends on control dependency: [if], data = [none]
}
List<E> l = Counters.toSortedList(c);
for (int i = 0; i < top; i++) {
E item = l.get(i);
purgedItems.add(item);
// depends on control dependency: [for], data = [none]
c.remove(item);
// depends on control dependency: [for], data = [none]
}
int size = c.size();
for (int i = c.size() - 1; i >= (size - bottom); i--) {
E item = l.get(i);
purgedItems.add(item);
// depends on control dependency: [for], data = [none]
c.remove(item);
// depends on control dependency: [for], data = [none]
}
return purgedItems;
} } |
public class class_name {
public void setEbsBlockDevices(java.util.Collection<EbsBlockDevice> ebsBlockDevices) {
if (ebsBlockDevices == null) {
this.ebsBlockDevices = null;
return;
}
this.ebsBlockDevices = new com.amazonaws.internal.SdkInternalList<EbsBlockDevice>(ebsBlockDevices);
} } | public class class_name {
public void setEbsBlockDevices(java.util.Collection<EbsBlockDevice> ebsBlockDevices) {
if (ebsBlockDevices == null) {
this.ebsBlockDevices = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.ebsBlockDevices = new com.amazonaws.internal.SdkInternalList<EbsBlockDevice>(ebsBlockDevices);
} } |
public class class_name {
@Override
public int read() throws IOException {
if (pos >= limit)
return -1;
try {
int c = buf[pos] & 0xff;
if (c < 0x80) {
pos++;
} else if (c < 0xE0) {
c = (char) ((c & 0x1F) << 6 | buf[pos + 1] & 0x3F);
pos += 2;
} else {
c = (char) ((c & 0x0F) << 12 | (buf[pos + 1] & 0x3F) << 6 | (buf[pos + 2] & 0x3F));
pos += 3;
}
if (pos > limit)
throw new IOException();
return c;
} catch (ArrayIndexOutOfBoundsException e) {
throw new IOException(e);
}
} } | public class class_name {
@Override
public int read() throws IOException {
if (pos >= limit)
return -1;
try {
int c = buf[pos] & 0xff;
if (c < 0x80) {
pos++; // depends on control dependency: [if], data = [none]
} else if (c < 0xE0) {
c = (char) ((c & 0x1F) << 6 | buf[pos + 1] & 0x3F); // depends on control dependency: [if], data = [(c]
pos += 2; // depends on control dependency: [if], data = [none]
} else {
c = (char) ((c & 0x0F) << 12 | (buf[pos + 1] & 0x3F) << 6 | (buf[pos + 2] & 0x3F)); // depends on control dependency: [if], data = [(c]
pos += 3; // depends on control dependency: [if], data = [none]
}
if (pos > limit)
throw new IOException();
return c;
} catch (ArrayIndexOutOfBoundsException e) {
throw new IOException(e);
}
} } |
public class class_name {
@Override
public void set(String key, Object entry, long expireAfterWrite, long expireAfterAccess) {
long ttl = TTL_NO_CHANGE;
if (!(entry instanceof CacheEntry)) {
CacheEntry ce = new CacheEntry(key, entry, expireAfterWrite, expireAfterAccess);
entry = ce;
ttl = expireAfterAccess > 0 ? expireAfterAccess
: (expireAfterWrite > 0 ? expireAfterWrite
: (timeToLiveSeconds > 0 ? timeToLiveSeconds : 0));
} else {
CacheEntry ce = (CacheEntry) entry;
ttl = ce.getExpireAfterAccess();
}
byte[] _data = serializeCacheEntry((CacheEntry) entry);
String data = Base64.encodeBase64String(_data);
final int TTL = (int) ttl;
switch (keyMode) {
case MONOPOLISTIC:
case NAMESPACE: {
final String KEY = keyMode == KeyMode.MONOPOLISTIC ? key : calcCacheKeyNamespace(key);
try {
getMemcachedClient().set(KEY, TTL, data);
} catch (Exception e) {
throw e instanceof CacheException ? (CacheException) e : new CacheException(e);
}
break;
}
case XNAMESPACE: {
try {
getMemcachedClient().withNamespace(getName(), new MemcachedClientCallable<Void>() {
@Override
public Void call(MemcachedClient client)
throws MemcachedException, InterruptedException, TimeoutException {
client.set(key, TTL, data);
return null;
}
});
} catch (Exception e) {
throw e instanceof CacheException ? (CacheException) e : new CacheException(e);
}
break;
}
default:
throw new IllegalStateException("Invalid key mode: " + keyMode);
}
} } | public class class_name {
@Override
public void set(String key, Object entry, long expireAfterWrite, long expireAfterAccess) {
long ttl = TTL_NO_CHANGE;
if (!(entry instanceof CacheEntry)) {
CacheEntry ce = new CacheEntry(key, entry, expireAfterWrite, expireAfterAccess);
entry = ce; // depends on control dependency: [if], data = [none]
ttl = expireAfterAccess > 0 ? expireAfterAccess
: (expireAfterWrite > 0 ? expireAfterWrite
: (timeToLiveSeconds > 0 ? timeToLiveSeconds : 0)); // depends on control dependency: [if], data = [none]
} else {
CacheEntry ce = (CacheEntry) entry;
ttl = ce.getExpireAfterAccess(); // depends on control dependency: [if], data = [none]
}
byte[] _data = serializeCacheEntry((CacheEntry) entry);
String data = Base64.encodeBase64String(_data);
final int TTL = (int) ttl;
switch (keyMode) {
case MONOPOLISTIC:
case NAMESPACE: {
final String KEY = keyMode == KeyMode.MONOPOLISTIC ? key : calcCacheKeyNamespace(key);
try {
getMemcachedClient().set(KEY, TTL, data); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw e instanceof CacheException ? (CacheException) e : new CacheException(e);
} // depends on control dependency: [catch], data = [none]
break;
}
case XNAMESPACE: {
try {
getMemcachedClient().withNamespace(getName(), new MemcachedClientCallable<Void>() {
@Override
public Void call(MemcachedClient client)
throws MemcachedException, InterruptedException, TimeoutException {
client.set(key, TTL, data);
return null;
}
}); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw e instanceof CacheException ? (CacheException) e : new CacheException(e);
} // depends on control dependency: [catch], data = [none]
break;
}
default:
throw new IllegalStateException("Invalid key mode: " + keyMode);
}
} } |
public class class_name {
private void deliverMountUpdate(SlotReference slot, boolean mounted) {
if (mounted) {
logger.info("Reporting media mounted in " + slot);
} else {
logger.info("Reporting media removed from " + slot);
}
for (final MountListener listener : getMountListeners()) {
try {
if (mounted) {
listener.mediaMounted(slot);
} else {
listener.mediaUnmounted(slot);
}
} catch (Throwable t) {
logger.warn("Problem delivering mount update to listener", t);
}
}
if (mounted) {
MetadataCache.tryAutoAttaching(slot);
}
} } | public class class_name {
private void deliverMountUpdate(SlotReference slot, boolean mounted) {
if (mounted) {
logger.info("Reporting media mounted in " + slot); // depends on control dependency: [if], data = [none]
} else {
logger.info("Reporting media removed from " + slot); // depends on control dependency: [if], data = [none]
}
for (final MountListener listener : getMountListeners()) {
try {
if (mounted) {
listener.mediaMounted(slot); // depends on control dependency: [if], data = [none]
} else {
listener.mediaUnmounted(slot); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
logger.warn("Problem delivering mount update to listener", t);
} // depends on control dependency: [catch], data = [none]
}
if (mounted) {
MetadataCache.tryAutoAttaching(slot); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected <T> void setEventNotifier(Class<T> eventSet, T notifier)
{
_notifiers.put(eventSet,notifier);
//
// Register this notifier for all EventSet interfaces up the interface inheritance
// hiearachy as well
//
List<Class> superEventSets = new ArrayList<Class>();
getSuperEventSets(eventSet, superEventSets);
Iterator<Class> i = superEventSets.iterator();
while (i.hasNext())
{
Class superEventSet = i.next();
_notifiers.put(superEventSet,notifier);
}
} } | public class class_name {
protected <T> void setEventNotifier(Class<T> eventSet, T notifier)
{
_notifiers.put(eventSet,notifier);
//
// Register this notifier for all EventSet interfaces up the interface inheritance
// hiearachy as well
//
List<Class> superEventSets = new ArrayList<Class>();
getSuperEventSets(eventSet, superEventSets);
Iterator<Class> i = superEventSets.iterator();
while (i.hasNext())
{
Class superEventSet = i.next();
_notifiers.put(superEventSet,notifier); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private static Locale getLocaleForRequest(HttpServletRequest req) {
CmsAcceptLanguageHeaderParser parser = new CmsAcceptLanguageHeaderParser(
req,
OpenCms.getWorkplaceManager().getDefaultLocale());
List<Locale> acceptedLocales = parser.getAcceptedLocales();
List<Locale> workplaceLocales = OpenCms.getWorkplaceManager().getLocales();
Locale locale = OpenCms.getLocaleManager().getFirstMatchingLocale(acceptedLocales, workplaceLocales);
if (locale == null) {
// no match found - use OpenCms default locale
locale = OpenCms.getWorkplaceManager().getDefaultLocale();
}
return locale;
} } | public class class_name {
private static Locale getLocaleForRequest(HttpServletRequest req) {
CmsAcceptLanguageHeaderParser parser = new CmsAcceptLanguageHeaderParser(
req,
OpenCms.getWorkplaceManager().getDefaultLocale());
List<Locale> acceptedLocales = parser.getAcceptedLocales();
List<Locale> workplaceLocales = OpenCms.getWorkplaceManager().getLocales();
Locale locale = OpenCms.getLocaleManager().getFirstMatchingLocale(acceptedLocales, workplaceLocales);
if (locale == null) {
// no match found - use OpenCms default locale
locale = OpenCms.getWorkplaceManager().getDefaultLocale(); // depends on control dependency: [if], data = [none]
}
return locale;
} } |
public class class_name {
public boolean redeliverLocked( TransactionItem[] items , MessageLockSet locks ) throws JMSException
{
checkNotClosed();
checkTransactionLock();
int volatileRollbacked = 0;
int persistentRollbacked = 0;
synchronized (storeLock)
{
for (int n = 0 ; n < items.length ; n++)
{
TransactionItem transactionItem = items[n];
if (transactionItem.getDestination() != this)
continue; // Not for us
MessageStore store = transactionItem.getDeliveryMode() == DeliveryMode.PERSISTENT ? persistentStore : volatileStore;
int handle = transactionItem.getHandle();
// Retrieve message content
AbstractMessage msg = store.retrieve(handle);
// Update redelivered flag both in memory and message store
msg.setJMSRedelivered(true);
handle = store.replace(handle, msg);
if (redeliveryDelay > 0)
{
// Keep the message locked so it cannot be re-consumed immediately
// and schedule message unlock after redeliveryDelay milliseconds
redeliveryTimer.schedule(new RedeliveryTask(msg,store,handle),
redeliveryDelay);
}
else
{
// Store lock for later release
locks.add(handle, store.getDeliveryMode(), this, msg);
}
if (transactionItem.getDeliveryMode() == DeliveryMode.PERSISTENT)
persistentRollbacked++;
else
volatileRollbacked++;
}
}
rollbackedGetCount.addAndGet(volatileRollbacked + persistentRollbacked);
if (persistentRollbacked > 0 && requiresTransactionalUpdate())
{
pendingChanges = true;
return true;
}
else
return false;
} } | public class class_name {
public boolean redeliverLocked( TransactionItem[] items , MessageLockSet locks ) throws JMSException
{
checkNotClosed();
checkTransactionLock();
int volatileRollbacked = 0;
int persistentRollbacked = 0;
synchronized (storeLock)
{
for (int n = 0 ; n < items.length ; n++)
{
TransactionItem transactionItem = items[n];
if (transactionItem.getDestination() != this)
continue; // Not for us
MessageStore store = transactionItem.getDeliveryMode() == DeliveryMode.PERSISTENT ? persistentStore : volatileStore;
int handle = transactionItem.getHandle();
// Retrieve message content
AbstractMessage msg = store.retrieve(handle);
// Update redelivered flag both in memory and message store
msg.setJMSRedelivered(true); // depends on control dependency: [for], data = [none]
handle = store.replace(handle, msg); // depends on control dependency: [for], data = [none]
if (redeliveryDelay > 0)
{
// Keep the message locked so it cannot be re-consumed immediately
// and schedule message unlock after redeliveryDelay milliseconds
redeliveryTimer.schedule(new RedeliveryTask(msg,store,handle),
redeliveryDelay); // depends on control dependency: [if], data = [none]
}
else
{
// Store lock for later release
locks.add(handle, store.getDeliveryMode(), this, msg); // depends on control dependency: [if], data = [none]
}
if (transactionItem.getDeliveryMode() == DeliveryMode.PERSISTENT)
persistentRollbacked++;
else
volatileRollbacked++;
}
}
rollbackedGetCount.addAndGet(volatileRollbacked + persistentRollbacked);
if (persistentRollbacked > 0 && requiresTransactionalUpdate())
{
pendingChanges = true;
return true;
}
else
return false;
} } |
public class class_name {
private int buildLookUpTable() {
int i = 0;
int incDen = Math.round(8F * radiusMinPixel); // increment denominator
lut = new int[2][incDen][depth];
for( int radius = radiusMinPixel; radius <= radiusMaxPixel; radius = radius + radiusIncPixel ) {
i = 0;
for( int incNun = 0; incNun < incDen; incNun++ ) {
double angle = (2 * Math.PI * (double) incNun) / (double) incDen;
int indexR = (radius - radiusMinPixel) / radiusIncPixel;
int rcos = (int) Math.round((double) radius * Math.cos(angle));
int rsin = (int) Math.round((double) radius * Math.sin(angle));
if ((i == 0) | (rcos != lut[0][i][indexR]) & (rsin != lut[1][i][indexR])) {
lut[0][i][indexR] = rcos;
lut[1][i][indexR] = rsin;
i++;
}
}
}
return i;
} } | public class class_name {
private int buildLookUpTable() {
int i = 0;
int incDen = Math.round(8F * radiusMinPixel); // increment denominator
lut = new int[2][incDen][depth];
for( int radius = radiusMinPixel; radius <= radiusMaxPixel; radius = radius + radiusIncPixel ) {
i = 0; // depends on control dependency: [for], data = [none]
for( int incNun = 0; incNun < incDen; incNun++ ) {
double angle = (2 * Math.PI * (double) incNun) / (double) incDen;
int indexR = (radius - radiusMinPixel) / radiusIncPixel;
int rcos = (int) Math.round((double) radius * Math.cos(angle));
int rsin = (int) Math.round((double) radius * Math.sin(angle));
if ((i == 0) | (rcos != lut[0][i][indexR]) & (rsin != lut[1][i][indexR])) {
lut[0][i][indexR] = rcos; // depends on control dependency: [if], data = [none]
lut[1][i][indexR] = rsin; // depends on control dependency: [if], data = [none]
i++; // depends on control dependency: [if], data = [none]
}
}
}
return i;
} } |
public class class_name {
@Override
public void writeVectorInt(Vector<Integer> vector) {
log.debug("writeVectorInt: {}", vector);
writeAMF3();
buf.put(AMF3.TYPE_VECTOR_INT);
if (hasReference(vector)) {
putInteger(getReferenceId(vector) << 1);
return;
}
storeReference(vector);
putInteger(vector.size() << 1 | 1);
buf.put((byte) 0x00);
for (Integer v : vector) {
buf.putInt(v);
}
// debug
if (log.isDebugEnabled()) {
int pos = buf.position();
buf.position(0);
StringBuilder sb = new StringBuilder();
HexDump.dumpHex(sb, buf.array());
log.debug("\n{}", sb);
buf.position(pos);
}
} } | public class class_name {
@Override
public void writeVectorInt(Vector<Integer> vector) {
log.debug("writeVectorInt: {}", vector);
writeAMF3();
buf.put(AMF3.TYPE_VECTOR_INT);
if (hasReference(vector)) {
putInteger(getReferenceId(vector) << 1);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
storeReference(vector);
putInteger(vector.size() << 1 | 1);
buf.put((byte) 0x00);
for (Integer v : vector) {
buf.putInt(v);
// depends on control dependency: [for], data = [v]
}
// debug
if (log.isDebugEnabled()) {
int pos = buf.position();
buf.position(0);
// depends on control dependency: [if], data = [none]
StringBuilder sb = new StringBuilder();
HexDump.dumpHex(sb, buf.array());
// depends on control dependency: [if], data = [none]
log.debug("\n{}", sb);
// depends on control dependency: [if], data = [none]
buf.position(pos);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(KeysAndAttributes keysAndAttributes, ProtocolMarshaller protocolMarshaller) {
if (keysAndAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(keysAndAttributes.getKeys(), KEYS_BINDING);
protocolMarshaller.marshall(keysAndAttributes.getAttributesToGet(), ATTRIBUTESTOGET_BINDING);
protocolMarshaller.marshall(keysAndAttributes.getConsistentRead(), CONSISTENTREAD_BINDING);
protocolMarshaller.marshall(keysAndAttributes.getProjectionExpression(), PROJECTIONEXPRESSION_BINDING);
protocolMarshaller.marshall(keysAndAttributes.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(KeysAndAttributes keysAndAttributes, ProtocolMarshaller protocolMarshaller) {
if (keysAndAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(keysAndAttributes.getKeys(), KEYS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(keysAndAttributes.getAttributesToGet(), ATTRIBUTESTOGET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(keysAndAttributes.getConsistentRead(), CONSISTENTREAD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(keysAndAttributes.getProjectionExpression(), PROJECTIONEXPRESSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(keysAndAttributes.getExpressionAttributeNames(), EXPRESSIONATTRIBUTENAMES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void set(int row, int col, double val) {
checkIndices(row, col, true);
Entry e = new Entry(row, col);
// Spin waiting for the entry to be unlocked
while (lockedEntries.putIfAbsent(e, new Object()) != null)
;
boolean present = matrixEntries.containsKey(e);
if (val != 0) {
matrixEntries.put(e, val);
// Only invalidate the cache if the number of rows or columns
// containing data has changed
if (!present)
modifications.incrementAndGet();
}
else if (present) {
matrixEntries.remove(e);
modifications.incrementAndGet();
}
lockedEntries.remove(e);
} } | public class class_name {
public void set(int row, int col, double val) {
checkIndices(row, col, true);
Entry e = new Entry(row, col);
// Spin waiting for the entry to be unlocked
while (lockedEntries.putIfAbsent(e, new Object()) != null)
;
boolean present = matrixEntries.containsKey(e);
if (val != 0) {
matrixEntries.put(e, val); // depends on control dependency: [if], data = [none]
// Only invalidate the cache if the number of rows or columns
// containing data has changed
if (!present)
modifications.incrementAndGet();
}
else if (present) {
matrixEntries.remove(e); // depends on control dependency: [if], data = [none]
modifications.incrementAndGet(); // depends on control dependency: [if], data = [none]
}
lockedEntries.remove(e);
} } |
public class class_name {
public boolean drain(List<SourceRecord> records, int timeout) throws InterruptedException {
Preconditions.checkNotNull(records, "records cannot be null");
Preconditions.checkArgument(timeout >= 0, "timeout should be greater than or equal to 0.");
if (log.isDebugEnabled()) {
log.debug("determining size for this run. batchSize={}, records.size()={}", this.batchSize, records.size());
}
int count = Math.min(this.batchSize, this.size());
if (log.isDebugEnabled()) {
log.debug("Draining {} record(s).", count);
}
for (int i = 0; i < count; i++) {
SourceRecord record = this.poll();
if (null != record) {
records.add(record);
} else {
if (log.isDebugEnabled()) {
log.debug("Poll returned null. exiting");
break;
}
}
}
if (records.isEmpty() && timeout > 0) {
if (log.isDebugEnabled()) {
log.debug("Found no records, sleeping {} ms.", timeout);
}
Thread.sleep(timeout);
}
return !records.isEmpty();
} } | public class class_name {
public boolean drain(List<SourceRecord> records, int timeout) throws InterruptedException {
Preconditions.checkNotNull(records, "records cannot be null");
Preconditions.checkArgument(timeout >= 0, "timeout should be greater than or equal to 0.");
if (log.isDebugEnabled()) {
log.debug("determining size for this run. batchSize={}, records.size()={}", this.batchSize, records.size());
}
int count = Math.min(this.batchSize, this.size());
if (log.isDebugEnabled()) {
log.debug("Draining {} record(s).", count);
}
for (int i = 0; i < count; i++) {
SourceRecord record = this.poll();
if (null != record) {
records.add(record);
} else {
if (log.isDebugEnabled()) {
log.debug("Poll returned null. exiting");
break;
}
}
}
if (records.isEmpty() && timeout > 0) {
if (log.isDebugEnabled()) {
log.debug("Found no records, sleeping {} ms.", timeout); // depends on control dependency: [if], data = [none]
}
Thread.sleep(timeout);
}
return !records.isEmpty();
} } |
public class class_name {
private static boolean queryAdjacencyAndOrder(IBond bond1, IBond bond2, IBond queryBond1, IBond queryBond2) {
IAtom centralAtom = null;
IAtom centralQueryAtom = null;
if (bond1.contains(bond2.getBegin())) {
centralAtom = bond2.getBegin();
} else if (bond1.contains(bond2.getEnd())) {
centralAtom = bond2.getEnd();
}
if (queryBond1.contains(queryBond2.getBegin())) {
centralQueryAtom = queryBond2.getBegin();
} else if (queryBond1.contains(queryBond2.getEnd())) {
centralQueryAtom = queryBond2.getEnd();
}
if (centralAtom != null && centralQueryAtom != null && ((IQueryAtom) centralQueryAtom).matches(centralAtom)) {
IQueryAtom queryAtom1 = (IQueryAtom) queryBond1.getOther(centralQueryAtom);
IQueryAtom queryAtom2 = (IQueryAtom) queryBond2.getOther(centralQueryAtom);
IAtom atom1 = bond1.getOther(centralAtom);
IAtom atom2 = bond2.getOther(centralAtom);
if (queryAtom1.matches(atom1) && queryAtom2.matches(atom2) || queryAtom1.matches(atom2)
&& queryAtom2.matches(atom1)) {
return true;
} else {
return false;
}
} else {
return centralAtom == null && centralQueryAtom == null;
}
} } | public class class_name {
private static boolean queryAdjacencyAndOrder(IBond bond1, IBond bond2, IBond queryBond1, IBond queryBond2) {
IAtom centralAtom = null;
IAtom centralQueryAtom = null;
if (bond1.contains(bond2.getBegin())) {
centralAtom = bond2.getBegin(); // depends on control dependency: [if], data = [none]
} else if (bond1.contains(bond2.getEnd())) {
centralAtom = bond2.getEnd(); // depends on control dependency: [if], data = [none]
}
if (queryBond1.contains(queryBond2.getBegin())) {
centralQueryAtom = queryBond2.getBegin(); // depends on control dependency: [if], data = [none]
} else if (queryBond1.contains(queryBond2.getEnd())) {
centralQueryAtom = queryBond2.getEnd(); // depends on control dependency: [if], data = [none]
}
if (centralAtom != null && centralQueryAtom != null && ((IQueryAtom) centralQueryAtom).matches(centralAtom)) {
IQueryAtom queryAtom1 = (IQueryAtom) queryBond1.getOther(centralQueryAtom);
IQueryAtom queryAtom2 = (IQueryAtom) queryBond2.getOther(centralQueryAtom);
IAtom atom1 = bond1.getOther(centralAtom);
IAtom atom2 = bond2.getOther(centralAtom);
if (queryAtom1.matches(atom1) && queryAtom2.matches(atom2) || queryAtom1.matches(atom2)
&& queryAtom2.matches(atom1)) {
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} else {
return centralAtom == null && centralQueryAtom == null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static int earliestIndexOfAny(String s, Iterable<String> probes, int from) {
int earliestIdx = -1;
for (final String probe : probes) {
final int probeIdx = s.indexOf(probe, from);
// if we found something for this probe
if (probeIdx >= 0
// and either we haven't found anything else yet or
// this is earlier than anything we've found yet
&& (earliestIdx == -1 || probeIdx < earliestIdx)) {
// then this is our new earliest match
earliestIdx = probeIdx;
}
}
return earliestIdx;
} } | public class class_name {
public static int earliestIndexOfAny(String s, Iterable<String> probes, int from) {
int earliestIdx = -1;
for (final String probe : probes) {
final int probeIdx = s.indexOf(probe, from);
// if we found something for this probe
if (probeIdx >= 0
// and either we haven't found anything else yet or
// this is earlier than anything we've found yet
&& (earliestIdx == -1 || probeIdx < earliestIdx)) {
// then this is our new earliest match
earliestIdx = probeIdx; // depends on control dependency: [if], data = [none]
}
}
return earliestIdx;
} } |
public class class_name {
private SortedSet<Date> filterExceptions(SortedSet<Date> dates) {
SortedSet<Date> result = new TreeSet<Date>();
for (Date d : dates) {
if (!m_exceptions.contains(d)) {
result.add(d);
}
}
return result;
} } | public class class_name {
private SortedSet<Date> filterExceptions(SortedSet<Date> dates) {
SortedSet<Date> result = new TreeSet<Date>();
for (Date d : dates) {
if (!m_exceptions.contains(d)) {
result.add(d); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public void rewriteParseables() {
if (m_parseables.isEmpty()) {
return;
}
I_CmsReport report = getReport();
CmsObject cms = getCms();
cms.getRequestContext().setAttribute(CmsLogEntry.ATTR_LOG_ENTRY, Boolean.FALSE);
report.println(Messages.get().container(Messages.RPT_START_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
parseLinks(cms, report);
report.println(Messages.get().container(Messages.RPT_END_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
m_parseables = null;
} } | public class class_name {
public void rewriteParseables() {
if (m_parseables.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
I_CmsReport report = getReport();
CmsObject cms = getCms();
cms.getRequestContext().setAttribute(CmsLogEntry.ATTR_LOG_ENTRY, Boolean.FALSE);
report.println(Messages.get().container(Messages.RPT_START_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
parseLinks(cms, report);
report.println(Messages.get().container(Messages.RPT_END_PARSE_LINKS_0), I_CmsReport.FORMAT_HEADLINE);
m_parseables = null;
} } |
public class class_name {
public final void setToken(AnalyzedTokenReadings[] tokens, int index, int next) {
int idx = index;
if (index >= tokens.length) {
// TODO: hacky workaround, find a proper solution. See EnglishPatternRuleTest.testBug()
idx = tokens.length - 1;
}
setToken(tokens[idx]);
IncludeRange includeSkipped = match.getIncludeSkipped();
if (next > 1 && includeSkipped != IncludeRange.NONE) {
StringBuilder sb = new StringBuilder();
if (includeSkipped == IncludeRange.FOLLOWING) {
formattedToken = null;
}
for (int k = index + 1; k < index + next; k++) {
if (tokens[k].isWhitespaceBefore()
&& !(k == index + 1 && includeSkipped == IncludeRange.FOLLOWING)) {
sb.append(' ');
}
sb.append(tokens[k].getToken());
}
skippedTokens = sb.toString();
} else {
skippedTokens = "";
}
} } | public class class_name {
public final void setToken(AnalyzedTokenReadings[] tokens, int index, int next) {
int idx = index;
if (index >= tokens.length) {
// TODO: hacky workaround, find a proper solution. See EnglishPatternRuleTest.testBug()
idx = tokens.length - 1; // depends on control dependency: [if], data = [none]
}
setToken(tokens[idx]);
IncludeRange includeSkipped = match.getIncludeSkipped();
if (next > 1 && includeSkipped != IncludeRange.NONE) {
StringBuilder sb = new StringBuilder();
if (includeSkipped == IncludeRange.FOLLOWING) {
formattedToken = null; // depends on control dependency: [if], data = [none]
}
for (int k = index + 1; k < index + next; k++) {
if (tokens[k].isWhitespaceBefore()
&& !(k == index + 1 && includeSkipped == IncludeRange.FOLLOWING)) {
sb.append(' '); // depends on control dependency: [if], data = [none]
}
sb.append(tokens[k].getToken()); // depends on control dependency: [for], data = [k]
}
skippedTokens = sb.toString(); // depends on control dependency: [if], data = [none]
} else {
skippedTokens = ""; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public HttpClientBuilder ssl(String host) {
if (sslHostConfig != null) {
sslHostConfigs.put(secureHost, sslHostConfig);
}
secureHost = host;
sslHostConfig = new SslHostConfig();
return this;
} } | public class class_name {
public HttpClientBuilder ssl(String host) {
if (sslHostConfig != null) {
sslHostConfigs.put(secureHost, sslHostConfig); // depends on control dependency: [if], data = [none]
}
secureHost = host;
sslHostConfig = new SslHostConfig();
return this;
} } |
public class class_name {
static int compareLexical(BitStore a, BitStore b) {
int aSize = a.size();
int bSize = b.size();
int diff = a.size() - b.size();
ListIterator<Integer> as = a.ones().positions(aSize);
ListIterator<Integer> bs = b.ones().positions(bSize);
while (true) {
boolean ap = as.hasPrevious();
boolean bp = bs.hasPrevious();
if (ap && bp) {
int ai = as.previous();
int bi = bs.previous() + diff;
if (ai == bi) continue;
return ai > bi ? 1 : -1;
} else {
return bp ? -1 : 1;
}
}
} } | public class class_name {
static int compareLexical(BitStore a, BitStore b) {
int aSize = a.size();
int bSize = b.size();
int diff = a.size() - b.size();
ListIterator<Integer> as = a.ones().positions(aSize);
ListIterator<Integer> bs = b.ones().positions(bSize);
while (true) {
boolean ap = as.hasPrevious();
boolean bp = bs.hasPrevious();
if (ap && bp) {
int ai = as.previous();
int bi = bs.previous() + diff;
if (ai == bi) continue;
return ai > bi ? 1 : -1; // depends on control dependency: [if], data = [none]
} else {
return bp ? -1 : 1; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void registerCharsetMapping(String contentType, String charSet) {
if (knownCharsets.contains(contentType)) {
log.warn("{} is already registered; re-registering");
}
knownCharsets.put(contentType, charSet);
} } | public class class_name {
public void registerCharsetMapping(String contentType, String charSet) {
if (knownCharsets.contains(contentType)) {
log.warn("{} is already registered; re-registering"); // depends on control dependency: [if], data = [none]
}
knownCharsets.put(contentType, charSet);
} } |
public class class_name {
public Index getPrimaryKey() throws SQLException {
synchronized(getPrimaryKeyLock) {
if(!getPrimaryKeyCached) {
String pkName = null;
List<Column> columns = new AutoGrowArrayList<>();
try (ResultSet results = schema.getCatalog().getMetaData().getMetaData().getPrimaryKeys(schema.getCatalog().getName(), schema.getName(), name)) {
while(results.next()) {
String columnName = results.getString("COLUMN_NAME");
int keySeq = results.getInt("KEY_SEQ");
String newPkName = results.getString("PK_NAME");
if(newPkName!=null) {
if(pkName==null) pkName = newPkName;
else if(!newPkName.equals(pkName)) throw new SQLException("Mismatched PK_NAME values: "+newPkName+"!="+pkName);
}
if(columns.set(keySeq-1, getColumn(columnName))!=null) throw new SQLException("Duplicate key sequence: "+keySeq);
}
}
if(columns.isEmpty()) {
getPrimaryKeyCache = null;
getPrimaryKeyCached = true;
} else {
// Make sure no gaps in the key sequence
for(int i=0; i<columns.size(); i++) {
if(columns.get(i)==null) throw new SQLException("Missing key sequence in index: "+(i+1));
}
getPrimaryKeyCache = new Index(this, pkName, IndexType.PRIMARY_KEY, columns);
getPrimaryKeyCached = true;
}
}
return getPrimaryKeyCache;
}
} } | public class class_name {
public Index getPrimaryKey() throws SQLException {
synchronized(getPrimaryKeyLock) {
if(!getPrimaryKeyCached) {
String pkName = null;
List<Column> columns = new AutoGrowArrayList<>();
try (ResultSet results = schema.getCatalog().getMetaData().getMetaData().getPrimaryKeys(schema.getCatalog().getName(), schema.getName(), name)) {
while(results.next()) {
String columnName = results.getString("COLUMN_NAME");
int keySeq = results.getInt("KEY_SEQ");
String newPkName = results.getString("PK_NAME");
if(newPkName!=null) {
if(pkName==null) pkName = newPkName;
else if(!newPkName.equals(pkName)) throw new SQLException("Mismatched PK_NAME values: "+newPkName+"!="+pkName);
}
if(columns.set(keySeq-1, getColumn(columnName))!=null) throw new SQLException("Duplicate key sequence: "+keySeq);
}
}
if(columns.isEmpty()) {
getPrimaryKeyCache = null; // depends on control dependency: [if], data = [none]
getPrimaryKeyCached = true; // depends on control dependency: [if], data = [none]
} else {
// Make sure no gaps in the key sequence
for(int i=0; i<columns.size(); i++) {
if(columns.get(i)==null) throw new SQLException("Missing key sequence in index: "+(i+1));
}
getPrimaryKeyCache = new Index(this, pkName, IndexType.PRIMARY_KEY, columns); // depends on control dependency: [if], data = [none]
getPrimaryKeyCached = true; // depends on control dependency: [if], data = [none]
}
}
return getPrimaryKeyCache;
}
} } |
public class class_name {
private void exposeExpression(Node expressionRoot, Node subExpression) {
Node nonconditionalExpr = findNonconditionalParent(subExpression, expressionRoot);
// Before extraction, record whether there are side-effect
boolean hasFollowingSideEffects = NodeUtil.mayHaveSideEffects(nonconditionalExpr, compiler);
Node exprInjectionPoint = findInjectionPoint(nonconditionalExpr);
DecompositionState state = new DecompositionState();
state.sideEffects = hasFollowingSideEffects;
state.extractBeforeStatement = exprInjectionPoint;
// Extract expressions in the reverse order of their evaluation. This is roughly, traverse up
// the AST extracting any preceding expressions that may have side-effects or be side-effected.
Node lastExposedSubexpression = null;
Node expressionToExpose = nonconditionalExpr;
Node expressionParent = expressionToExpose.getParent();
while (expressionParent != expressionRoot) {
checkState(
!isConditionalOp(expressionParent) || expressionToExpose.isFirstChildOf(expressionParent),
expressionParent);
if (expressionParent.isAssign()) {
if (isSafeAssign(expressionParent, state.sideEffects)) {
// It is always safe to inline "foo()" for expressions such as
// "a = b = c = foo();"
// As the assignment is unaffected by side effect of "foo()"
// and the names assigned-to can not influence the state before
// the call to foo.
//
// This is not true of more complex LHS values, such as
// a.x = foo();
// next().x = foo();
// in these cases the checks below are necessary.
} else if (!expressionToExpose.isFirstChildOf(expressionParent)) {
// Alias "next()" in "next().foo"
Node left = expressionParent.getFirstChild();
switch (left.getToken()) {
case GETELEM:
decomposeSubExpressions(left.getLastChild(), null, state);
// Fall through.
case GETPROP:
decomposeSubExpressions(left.getFirstChild(), null, state);
break;
default:
throw new IllegalStateException("Expected a property access: " + left.toStringTree());
}
}
} else if (expressionParent.isCall() && NodeUtil.isGet(expressionParent.getFirstChild())) {
Node callee = expressionParent.getFirstChild();
decomposeSubExpressions(callee.getNext(), expressionToExpose, state);
// Now handle the call expression. We only have to do this if we arrived at decomposing this
// call through one of the arguments, rather than the callee; otherwise the callee would
// already be safe.
if (isExpressionTreeUnsafe(callee, state.sideEffects)
&& lastExposedSubexpression != callee.getFirstChild()) {
checkState(allowMethodCallDecomposing, "Object method calls can not be decomposed.");
// Either there were preexisting side-effects, or this node has side-effects.
state.sideEffects = true;
// Rewrite the call so "this" is preserved and continue walking up from there.
expressionParent = rewriteCallExpression(expressionParent, state);
}
} else {
decomposeSubExpressions(expressionParent.getFirstChild(), expressionToExpose, state);
}
lastExposedSubexpression = expressionToExpose;
expressionToExpose = expressionParent;
expressionParent = expressionToExpose.getParent();
}
// Now extract the expression that the decomposition is being performed to
// to allow to be moved. All expressions that need to be evaluated before
// this have been extracted, so add the expression statement after the
// other extracted expressions and the original statement (or replace
// the original statement.
if (nonconditionalExpr == subExpression) {
// Don't extract the call, as that introduces an extra constant VAR
// that will simply need to be inlined back. It will be handled as
// an EXPRESSION call site type.
// Node extractedCall = extractExpression(decomposition, expressionRoot);
} else {
Node parent = nonconditionalExpr.getParent();
boolean needResult = !parent.isExprResult();
extractConditional(nonconditionalExpr, exprInjectionPoint, needResult);
}
} } | public class class_name {
private void exposeExpression(Node expressionRoot, Node subExpression) {
Node nonconditionalExpr = findNonconditionalParent(subExpression, expressionRoot);
// Before extraction, record whether there are side-effect
boolean hasFollowingSideEffects = NodeUtil.mayHaveSideEffects(nonconditionalExpr, compiler);
Node exprInjectionPoint = findInjectionPoint(nonconditionalExpr);
DecompositionState state = new DecompositionState();
state.sideEffects = hasFollowingSideEffects;
state.extractBeforeStatement = exprInjectionPoint;
// Extract expressions in the reverse order of their evaluation. This is roughly, traverse up
// the AST extracting any preceding expressions that may have side-effects or be side-effected.
Node lastExposedSubexpression = null;
Node expressionToExpose = nonconditionalExpr;
Node expressionParent = expressionToExpose.getParent();
while (expressionParent != expressionRoot) {
checkState(
!isConditionalOp(expressionParent) || expressionToExpose.isFirstChildOf(expressionParent),
expressionParent); // depends on control dependency: [while], data = [none]
if (expressionParent.isAssign()) {
if (isSafeAssign(expressionParent, state.sideEffects)) {
// It is always safe to inline "foo()" for expressions such as
// "a = b = c = foo();"
// As the assignment is unaffected by side effect of "foo()"
// and the names assigned-to can not influence the state before
// the call to foo.
//
// This is not true of more complex LHS values, such as
// a.x = foo();
// next().x = foo();
// in these cases the checks below are necessary.
} else if (!expressionToExpose.isFirstChildOf(expressionParent)) {
// Alias "next()" in "next().foo"
Node left = expressionParent.getFirstChild();
switch (left.getToken()) {
case GETELEM:
decomposeSubExpressions(left.getLastChild(), null, state); // depends on control dependency: [if], data = [none]
// Fall through.
case GETPROP:
decomposeSubExpressions(left.getFirstChild(), null, state); // depends on control dependency: [if], data = [none]
break;
default:
throw new IllegalStateException("Expected a property access: " + left.toStringTree());
}
}
} else if (expressionParent.isCall() && NodeUtil.isGet(expressionParent.getFirstChild())) {
Node callee = expressionParent.getFirstChild();
decomposeSubExpressions(callee.getNext(), expressionToExpose, state);
// Now handle the call expression. We only have to do this if we arrived at decomposing this
// call through one of the arguments, rather than the callee; otherwise the callee would
// already be safe.
if (isExpressionTreeUnsafe(callee, state.sideEffects)
&& lastExposedSubexpression != callee.getFirstChild()) {
checkState(allowMethodCallDecomposing, "Object method calls can not be decomposed."); // depends on control dependency: [if], data = [none]
// Either there were preexisting side-effects, or this node has side-effects.
state.sideEffects = true; // depends on control dependency: [if], data = [none]
// Rewrite the call so "this" is preserved and continue walking up from there.
expressionParent = rewriteCallExpression(expressionParent, state); // depends on control dependency: [if], data = [none]
}
} else {
decomposeSubExpressions(expressionParent.getFirstChild(), expressionToExpose, state);
}
lastExposedSubexpression = expressionToExpose;
expressionToExpose = expressionParent;
expressionParent = expressionToExpose.getParent();
}
// Now extract the expression that the decomposition is being performed to
// to allow to be moved. All expressions that need to be evaluated before
// this have been extracted, so add the expression statement after the
// other extracted expressions and the original statement (or replace
// the original statement.
if (nonconditionalExpr == subExpression) {
// Don't extract the call, as that introduces an extra constant VAR
// that will simply need to be inlined back. It will be handled as
// an EXPRESSION call site type.
// Node extractedCall = extractExpression(decomposition, expressionRoot);
} else {
Node parent = nonconditionalExpr.getParent();
boolean needResult = !parent.isExprResult();
extractConditional(nonconditionalExpr, exprInjectionPoint, needResult);
}
} } |
public class class_name {
public void removeDependentVariables(Variable ... depVars) {
ArrayList<Variable> newDepVars = new ArrayList<Variable>();
for (Variable v : this.dependentVariables) {
boolean toRemove = false;
for (Variable v1 : depVars) {
if (v.equals(v1)) {
toRemove = true;
break;
}
}
if (!toRemove) newDepVars.add(v);
}
this.dependentVariables = newDepVars.toArray(new Variable[newDepVars.size()]);
} } | public class class_name {
public void removeDependentVariables(Variable ... depVars) {
ArrayList<Variable> newDepVars = new ArrayList<Variable>();
for (Variable v : this.dependentVariables) {
boolean toRemove = false;
for (Variable v1 : depVars) {
if (v.equals(v1)) {
toRemove = true;
// depends on control dependency: [if], data = [none]
break;
}
}
if (!toRemove) newDepVars.add(v);
}
this.dependentVariables = newDepVars.toArray(new Variable[newDepVars.size()]);
} } |
public class class_name {
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public static Searcher create(@NonNull final Searchable index, @NonNull String variant) {
Searcher instance = instances.get(variant);
if (instance == null || instance.getSearchable() != index) {
instance = new Searcher(index, variant);
instances.put(variant, instance);
}
return instance;
} } | public class class_name {
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public static Searcher create(@NonNull final Searchable index, @NonNull String variant) {
Searcher instance = instances.get(variant);
if (instance == null || instance.getSearchable() != index) {
instance = new Searcher(index, variant); // depends on control dependency: [if], data = [none]
instances.put(variant, instance); // depends on control dependency: [if], data = [none]
}
return instance;
} } |
public class class_name {
public CmsWorkplaceMessages getMessages(Locale locale) {
CmsWorkplaceMessages result = m_messages.get(locale);
if (result != null) {
// messages have already been read
return result;
}
// messages have not been read so far
synchronized (this) {
// check again
result = m_messages.get(locale);
if (result == null) {
result = new CmsWorkplaceMessages(locale);
m_messages.put(locale, result);
}
}
return result;
} } | public class class_name {
public CmsWorkplaceMessages getMessages(Locale locale) {
CmsWorkplaceMessages result = m_messages.get(locale);
if (result != null) {
// messages have already been read
return result; // depends on control dependency: [if], data = [none]
}
// messages have not been read so far
synchronized (this) {
// check again
result = m_messages.get(locale);
if (result == null) {
result = new CmsWorkplaceMessages(locale); // depends on control dependency: [if], data = [none]
m_messages.put(locale, result); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public static void init()
{
try
{
init("vdmj.properties", Properties.class);
} catch (Exception e)
{
System.err.println(e.getMessage());
}
InputStream fis = ConfigBase.class.getResourceAsStream("/"
+ "overture.properties");
if (fis != null)
{
try
{
java.util.Properties overtureProperties = new java.util.Properties();
overtureProperties.load(fis);
final String SYSTEM_KEY = "system.";
for (Entry<Object, Object> entry : overtureProperties.entrySet())
{
String key = entry.getKey().toString();
String value = entry.getValue().toString();
if (value.indexOf("/") != -1)
{
// assume that this is a file path and correct it
value = value.replace('/', File.separatorChar);
}
int index = key.indexOf(SYSTEM_KEY);
if (index == 0)
{
String newKey = key.substring(SYSTEM_KEY.length());
System.setProperty(newKey, value);
}
}
} catch (Exception e)
{
throw new RuntimeException(e);
}
}
} } | public class class_name {
public static void init()
{
try
{
init("vdmj.properties", Properties.class); // depends on control dependency: [try], data = [none]
} catch (Exception e)
{
System.err.println(e.getMessage());
} // depends on control dependency: [catch], data = [none]
InputStream fis = ConfigBase.class.getResourceAsStream("/"
+ "overture.properties");
if (fis != null)
{
try
{
java.util.Properties overtureProperties = new java.util.Properties();
overtureProperties.load(fis); // depends on control dependency: [try], data = [none]
final String SYSTEM_KEY = "system.";
for (Entry<Object, Object> entry : overtureProperties.entrySet())
{
String key = entry.getKey().toString();
String value = entry.getValue().toString();
if (value.indexOf("/") != -1)
{
// assume that this is a file path and correct it
value = value.replace('/', File.separatorChar); // depends on control dependency: [if], data = [none]
}
int index = key.indexOf(SYSTEM_KEY);
if (index == 0)
{
String newKey = key.substring(SYSTEM_KEY.length());
System.setProperty(newKey, value); // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e)
{
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
boolean matches(String value) {
if (pattern == null) {
return true;
}
return pattern.matcher(value).matches();
} } | public class class_name {
boolean matches(String value) {
if (pattern == null) {
return true; // depends on control dependency: [if], data = [none]
}
return pattern.matcher(value).matches();
} } |
public class class_name {
private Message unfragment(Message msg, FragHeader hdr) {
Address sender=msg.getSrc();
FragmentationTable frag_table=fragment_list.get(sender);
if(frag_table == null) {
frag_table=new FragmentationTable(sender);
try {
fragment_list.add(sender, frag_table);
}
catch(IllegalArgumentException x) { // the entry has already been added, probably in parallel from another thread
frag_table=fragment_list.get(sender);
}
}
num_received_frags++;
byte[] buf=frag_table.add(hdr.id, hdr.frag_id, hdr.num_frags, msg.getBuffer());
if(buf == null)
return null;
try {
DataInput in=new ByteArrayDataInputStream(buf);
Message assembled_msg=new Message(false);
assembled_msg.readFrom(in);
assembled_msg.setSrc(sender); // needed ? YES, because fragments have a null src !!
if(log.isTraceEnabled()) log.trace("assembled_msg is " + assembled_msg);
num_received_msgs++;
return assembled_msg;
}
catch(Exception e) {
log.error(Util.getMessage("FailedUnfragmentingAMessage"), e);
return null;
}
} } | public class class_name {
private Message unfragment(Message msg, FragHeader hdr) {
Address sender=msg.getSrc();
FragmentationTable frag_table=fragment_list.get(sender);
if(frag_table == null) {
frag_table=new FragmentationTable(sender); // depends on control dependency: [if], data = [none]
try {
fragment_list.add(sender, frag_table); // depends on control dependency: [try], data = [none]
}
catch(IllegalArgumentException x) { // the entry has already been added, probably in parallel from another thread
frag_table=fragment_list.get(sender);
} // depends on control dependency: [catch], data = [none]
}
num_received_frags++;
byte[] buf=frag_table.add(hdr.id, hdr.frag_id, hdr.num_frags, msg.getBuffer());
if(buf == null)
return null;
try {
DataInput in=new ByteArrayDataInputStream(buf);
Message assembled_msg=new Message(false);
assembled_msg.readFrom(in); // depends on control dependency: [try], data = [none]
assembled_msg.setSrc(sender); // needed ? YES, because fragments have a null src !! // depends on control dependency: [try], data = [none]
if(log.isTraceEnabled()) log.trace("assembled_msg is " + assembled_msg);
num_received_msgs++; // depends on control dependency: [try], data = [none]
return assembled_msg; // depends on control dependency: [try], data = [none]
}
catch(Exception e) {
log.error(Util.getMessage("FailedUnfragmentingAMessage"), e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static RoaringBitmap addOffset(final RoaringBitmap x, int offset) {
int container_offset = offset >>> 16;
int in_container_offset = offset % (1<<16);
if(in_container_offset == 0) {
RoaringBitmap answer = x.clone();
for(int pos = 0; pos < answer.highLowContainer.size(); pos++) {
int key = Util.toIntUnsigned(answer.highLowContainer.getKeyAtIndex(pos));
key += container_offset;
if(key > 0xFFFF) {
throw new IllegalArgumentException("Offset too large.");
}
answer.highLowContainer.keys[pos] = (short) key;
}
return answer;
} else {
RoaringBitmap answer = new RoaringBitmap();
for(int pos = 0; pos < x.highLowContainer.size(); pos++) {
int key = Util.toIntUnsigned(x.highLowContainer.getKeyAtIndex(pos));
key += container_offset;
if(key > 0xFFFF) {
throw new IllegalArgumentException("Offset too large.");
}
Container c = x.highLowContainer.getContainerAtIndex(pos);
Container[] offsetted = Util.addOffset(c,
(short)in_container_offset);
if( !offsetted[0].isEmpty()) {
int current_size = answer.highLowContainer.size();
int lastkey = 0;
if(current_size > 0) {
lastkey = answer.highLowContainer.getKeyAtIndex(
current_size - 1);
}
if((current_size > 0) && (lastkey == key)) {
Container prev = answer.highLowContainer
.getContainerAtIndex(current_size - 1);
Container orresult = prev.ior(offsetted[0]);
answer.highLowContainer.setContainerAtIndex(current_size - 1,
orresult);
} else {
answer.highLowContainer.append((short)key, offsetted[0]);
}
}
if( !offsetted[1].isEmpty()) {
if(key == 0xFFFF) {
throw new IllegalArgumentException("Offset too large.");
}
answer.highLowContainer.append((short)(key + 1), offsetted[1]);
}
}
answer.repairAfterLazy();
return answer;
}
} } | public class class_name {
public static RoaringBitmap addOffset(final RoaringBitmap x, int offset) {
int container_offset = offset >>> 16;
int in_container_offset = offset % (1<<16);
if(in_container_offset == 0) {
RoaringBitmap answer = x.clone();
for(int pos = 0; pos < answer.highLowContainer.size(); pos++) {
int key = Util.toIntUnsigned(answer.highLowContainer.getKeyAtIndex(pos));
key += container_offset; // depends on control dependency: [for], data = [none]
if(key > 0xFFFF) {
throw new IllegalArgumentException("Offset too large.");
}
answer.highLowContainer.keys[pos] = (short) key; // depends on control dependency: [for], data = [pos]
}
return answer; // depends on control dependency: [if], data = [none]
} else {
RoaringBitmap answer = new RoaringBitmap();
for(int pos = 0; pos < x.highLowContainer.size(); pos++) {
int key = Util.toIntUnsigned(x.highLowContainer.getKeyAtIndex(pos));
key += container_offset; // depends on control dependency: [for], data = [none]
if(key > 0xFFFF) {
throw new IllegalArgumentException("Offset too large.");
}
Container c = x.highLowContainer.getContainerAtIndex(pos);
Container[] offsetted = Util.addOffset(c,
(short)in_container_offset);
if( !offsetted[0].isEmpty()) {
int current_size = answer.highLowContainer.size();
int lastkey = 0;
if(current_size > 0) {
lastkey = answer.highLowContainer.getKeyAtIndex(
current_size - 1); // depends on control dependency: [if], data = [none]
}
if((current_size > 0) && (lastkey == key)) {
Container prev = answer.highLowContainer
.getContainerAtIndex(current_size - 1);
Container orresult = prev.ior(offsetted[0]);
answer.highLowContainer.setContainerAtIndex(current_size - 1,
orresult); // depends on control dependency: [if], data = [none]
} else {
answer.highLowContainer.append((short)key, offsetted[0]); // depends on control dependency: [if], data = [none]
}
}
if( !offsetted[1].isEmpty()) {
if(key == 0xFFFF) {
throw new IllegalArgumentException("Offset too large.");
}
answer.highLowContainer.append((short)(key + 1), offsetted[1]); // depends on control dependency: [if], data = [none]
}
}
answer.repairAfterLazy(); // depends on control dependency: [if], data = [none]
return answer; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Properties argsToProperties(String[] args, Map<String,Integer> flagsToNumArgs) {
Properties result = new Properties();
List<String> remainingArgs = new ArrayList<String>();
for (int i = 0; i < args.length; i++) {
String key = args[i];
if (key.length() > 0 && key.charAt(0) == '-') { // found a flag
if (key.charAt(1) == '-')
key = key.substring(2); // strip off 2 hyphens
else
key = key.substring(1); // strip off the hyphen
Integer maxFlagArgs = flagsToNumArgs.get(key);
int max = maxFlagArgs == null ? 1 : maxFlagArgs;
int min = maxFlagArgs == null ? 0 : maxFlagArgs;
List<String> flagArgs = new ArrayList<String>();
// cdm oct 2007: add length check to allow for empty string argument!
for (int j = 0; j < max && i + 1 < args.length && (j < min || args[i + 1].length() == 0 || args[i + 1].length() > 0 && args[i + 1].charAt(0) != '-'); i++, j++) {
flagArgs.add(args[i + 1]);
}
if (flagArgs.isEmpty()) {
result.setProperty(key, "true");
} else {
result.setProperty(key, join(flagArgs, " "));
if (key.equalsIgnoreCase(PROP) || key.equalsIgnoreCase(PROPS) || key.equalsIgnoreCase(PROPERTIES) || key.equalsIgnoreCase(ARGUMENTS) || key.equalsIgnoreCase(ARGS))
{
try {
InputStream is = new BufferedInputStream(new FileInputStream(result.getProperty(key)));
result.remove(key); // location of this line is critical
result.load(is);
// trim all values
for(Object propKey : result.keySet()){
String newVal = result.getProperty((String)propKey);
result.setProperty((String)propKey,newVal.trim());
}
is.close();
} catch (IOException e) {
result.remove(key);
System.err.println("argsToProperties could not read properties file: " + result.getProperty(key));
throw new RuntimeException(e);
}
}
}
} else {
remainingArgs.add(args[i]);
}
}
if (!remainingArgs.isEmpty()) {
result.setProperty("", join(remainingArgs, " "));
}
if (result.containsKey(PROP)) {
String file = result.getProperty(PROP);
result.remove(PROP);
Properties toAdd = argsToProperties(new String[]{"-prop", file});
for (Enumeration<?> e = toAdd.propertyNames(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
String val = toAdd.getProperty(key);
if (!result.containsKey(key)) {
result.setProperty(key, val);
}
}
}
return result;
} } | public class class_name {
public static Properties argsToProperties(String[] args, Map<String,Integer> flagsToNumArgs) {
Properties result = new Properties();
List<String> remainingArgs = new ArrayList<String>();
for (int i = 0; i < args.length; i++) {
String key = args[i];
if (key.length() > 0 && key.charAt(0) == '-') { // found a flag
if (key.charAt(1) == '-')
key = key.substring(2); // strip off 2 hyphens
else
key = key.substring(1); // strip off the hyphen
Integer maxFlagArgs = flagsToNumArgs.get(key);
int max = maxFlagArgs == null ? 1 : maxFlagArgs;
int min = maxFlagArgs == null ? 0 : maxFlagArgs;
List<String> flagArgs = new ArrayList<String>();
// cdm oct 2007: add length check to allow for empty string argument!
for (int j = 0; j < max && i + 1 < args.length && (j < min || args[i + 1].length() == 0 || args[i + 1].length() > 0 && args[i + 1].charAt(0) != '-'); i++, j++) {
flagArgs.add(args[i + 1]);
// depends on control dependency: [for], data = [none]
}
if (flagArgs.isEmpty()) {
result.setProperty(key, "true");
// depends on control dependency: [if], data = [none]
} else {
result.setProperty(key, join(flagArgs, " "));
// depends on control dependency: [if], data = [none]
if (key.equalsIgnoreCase(PROP) || key.equalsIgnoreCase(PROPS) || key.equalsIgnoreCase(PROPERTIES) || key.equalsIgnoreCase(ARGUMENTS) || key.equalsIgnoreCase(ARGS))
{
try {
InputStream is = new BufferedInputStream(new FileInputStream(result.getProperty(key)));
result.remove(key); // location of this line is critical
// depends on control dependency: [try], data = [none]
result.load(is);
// depends on control dependency: [try], data = [none]
// trim all values
for(Object propKey : result.keySet()){
String newVal = result.getProperty((String)propKey);
result.setProperty((String)propKey,newVal.trim());
// depends on control dependency: [for], data = [propKey]
}
is.close();
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
result.remove(key);
System.err.println("argsToProperties could not read properties file: " + result.getProperty(key));
throw new RuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
}
}
} else {
remainingArgs.add(args[i]);
// depends on control dependency: [if], data = [none]
}
}
if (!remainingArgs.isEmpty()) {
result.setProperty("", join(remainingArgs, " "));
// depends on control dependency: [if], data = [none]
}
if (result.containsKey(PROP)) {
String file = result.getProperty(PROP);
result.remove(PROP);
// depends on control dependency: [if], data = [none]
Properties toAdd = argsToProperties(new String[]{"-prop", file});
for (Enumeration<?> e = toAdd.propertyNames(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
String val = toAdd.getProperty(key);
if (!result.containsKey(key)) {
result.setProperty(key, val);
// depends on control dependency: [if], data = [none]
}
}
}
return result;
} } |
public class class_name {
public static Object getValue(Object exp, Map ctx, Object root, String path, int lineNumber) {
try {
OgnlContext context = new OgnlContext(null, null, new DefaultMemberAccess(true));
return Ognl.getValue(exp, context, root);
} catch (OgnlException ex) {
throw new OgnlRuntimeException(ex.getReason() == null ? ex : ex
.getReason(), path, lineNumber);
} catch (Exception ex) {
throw new OgnlRuntimeException(ex, path, lineNumber);
}
} } | public class class_name {
public static Object getValue(Object exp, Map ctx, Object root, String path, int lineNumber) {
try {
OgnlContext context = new OgnlContext(null, null, new DefaultMemberAccess(true));
return Ognl.getValue(exp, context, root);
// depends on control dependency: [try], data = [none]
} catch (OgnlException ex) {
throw new OgnlRuntimeException(ex.getReason() == null ? ex : ex
.getReason(), path, lineNumber);
} catch (Exception ex) {
// depends on control dependency: [catch], data = [none]
throw new OgnlRuntimeException(ex, path, lineNumber);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void ensureContentType(CDAEntry entry, CDAClient client) {
CDAContentType contentType = entry.contentType();
if (contentType != null) {
return;
}
String contentTypeId = extractNested(entry.attrs(), "contentType", "sys", "id");
try {
contentType = client.cacheTypeWithId(contentTypeId).blockingFirst();
} catch (CDAResourceNotFoundException e) {
throw new CDAContentTypeNotFoundException(entry.id(), CDAEntry.class, contentTypeId, e);
}
entry.setContentType(contentType);
} } | public class class_name {
public static void ensureContentType(CDAEntry entry, CDAClient client) {
CDAContentType contentType = entry.contentType();
if (contentType != null) {
return; // depends on control dependency: [if], data = [none]
}
String contentTypeId = extractNested(entry.attrs(), "contentType", "sys", "id");
try {
contentType = client.cacheTypeWithId(contentTypeId).blockingFirst(); // depends on control dependency: [try], data = [none]
} catch (CDAResourceNotFoundException e) {
throw new CDAContentTypeNotFoundException(entry.id(), CDAEntry.class, contentTypeId, e);
} // depends on control dependency: [catch], data = [none]
entry.setContentType(contentType);
} } |
public class class_name {
@SuppressWarnings("rawtypes")
private Map.Entry getMapEntry(Node node) {
Object value = null;
String keyName = node.getLocalName();
XmlMapEntry xmlMapEntry = this.mapSpecification.get(keyName);
switch (node.getNodeType()) {
case Node.ATTRIBUTE_NODE:
value = node.getNodeValue();
break;
case Node.ELEMENT_NODE: {
if (xmlMapEntry == null) {
value = new NodeArray(node.getChildNodes());
} else {
XmlMapFacet valueFacet = xmlMapEntry.getValue();
switch (valueFacet.getType()) {
case ELEMENT:
value = keyName;
break;
case CONTENT: {
NodeList nodeList = node.getChildNodes();
if (nodeList.getLength() > 0) {
value = new NodeArray(nodeList);
}
}
break;
case ATTRIBUTE: {
NamedNodeMap attributes = node.getAttributes();
Node attribute = attributes.getNamedItem(valueFacet.getName());
if (attribute != null) {
value = attribute.getNodeValue();
}
}
break;
default:
throw new IllegalStateException();
}
XmlMapFacet keyFacet = xmlMapEntry.getKey();
switch (keyFacet.getType()) {
case ELEMENT:
break;
case CONTENT: {
NodeList nodeList = node.getChildNodes();
if (nodeList.getLength() > 0) {
keyName = getStringValue((Node) nodeList.item(0));
} else {
keyName = null;
}
}
break;
case ATTRIBUTE: {
NamedNodeMap attributes = node.getAttributes();
Node attribute = attributes.getNamedItem(keyFacet.getName());
if (attribute != null) {
keyName = attribute.getNodeValue();
} else {
keyName = null;
}
break;
}
default:
throw new IllegalStateException();
}
}
}
}
if (keyName == null) {
return null;
} else {
final Object _key = keyName;
final Object _value = value;
return new Map.Entry() {
@Override
public Object getKey() {
return _key;
}
@Override
public Object getValue() {
return _value;
}
@Override
public Object setValue(Object object) {
return null;
}
};
}
} } | public class class_name {
@SuppressWarnings("rawtypes")
private Map.Entry getMapEntry(Node node) {
Object value = null;
String keyName = node.getLocalName();
XmlMapEntry xmlMapEntry = this.mapSpecification.get(keyName);
switch (node.getNodeType()) {
case Node.ATTRIBUTE_NODE:
value = node.getNodeValue();
break;
case Node.ELEMENT_NODE: {
if (xmlMapEntry == null) {
value = new NodeArray(node.getChildNodes()); // depends on control dependency: [if], data = [none]
} else {
XmlMapFacet valueFacet = xmlMapEntry.getValue();
switch (valueFacet.getType()) {
case ELEMENT:
value = keyName;
break;
case CONTENT: {
NodeList nodeList = node.getChildNodes();
if (nodeList.getLength() > 0) {
value = new NodeArray(nodeList); // depends on control dependency: [if], data = [none]
}
}
break;
case ATTRIBUTE: {
NamedNodeMap attributes = node.getAttributes();
Node attribute = attributes.getNamedItem(valueFacet.getName());
if (attribute != null) {
value = attribute.getNodeValue(); // depends on control dependency: [if], data = [none]
}
}
break;
default:
throw new IllegalStateException();
}
XmlMapFacet keyFacet = xmlMapEntry.getKey();
switch (keyFacet.getType()) {
case ELEMENT:
break;
case CONTENT: {
NodeList nodeList = node.getChildNodes();
if (nodeList.getLength() > 0) {
keyName = getStringValue((Node) nodeList.item(0));
} else {
keyName = null;
}
}
break;
case ATTRIBUTE: {
NamedNodeMap attributes = node.getAttributes();
Node attribute = attributes.getNamedItem(keyFacet.getName());
if (attribute != null) {
keyName = attribute.getNodeValue();
} else {
keyName = null;
}
break;
}
default:
throw new IllegalStateException();
}
}
}
}
if (keyName == null) {
return null;
} else {
final Object _key = keyName;
final Object _value = value;
return new Map.Entry() {
@Override
public Object getKey() {
return _key;
}
@Override
public Object getValue() {
return _value;
}
@Override
public Object setValue(Object object) {
return null;
}
};
}
} } |
public class class_name {
public void setMinMeasuredValueVisible(final boolean VISIBLE) {
if (null == minMeasuredValueVisible) {
_minMeasuredValueVisible = VISIBLE;
fireUpdateEvent(VISIBILITY_EVENT);
} else {
minMeasuredValueVisible.set(VISIBLE);
}
} } | public class class_name {
public void setMinMeasuredValueVisible(final boolean VISIBLE) {
if (null == minMeasuredValueVisible) {
_minMeasuredValueVisible = VISIBLE; // depends on control dependency: [if], data = [none]
fireUpdateEvent(VISIBILITY_EVENT); // depends on control dependency: [if], data = [none]
} else {
minMeasuredValueVisible.set(VISIBLE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Node getFinallyAtTarget(Node node) {
if (node == null) {
return null;
}
if (node.getType() == Token.FINALLY) {
return node;
}
if (node.getType() == Token.TARGET) {
Node fBlock = node.getNext();
if (fBlock != null && fBlock.getType() == Token.FINALLY) {
return fBlock;
}
}
throw Kit.codeBug("bad finally target");
} } | public class class_name {
private Node getFinallyAtTarget(Node node) {
if (node == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (node.getType() == Token.FINALLY) {
return node; // depends on control dependency: [if], data = [none]
}
if (node.getType() == Token.TARGET) {
Node fBlock = node.getNext();
if (fBlock != null && fBlock.getType() == Token.FINALLY) {
return fBlock; // depends on control dependency: [if], data = [none]
}
}
throw Kit.codeBug("bad finally target");
} } |
public class class_name {
public String getFirstSentence(String paragraph) {
if (paragraph == null || paragraph.length() == 0) {
return "";
}
BreakIterator sentenceBreaks = BreakIterator.getSentenceInstance();
sentenceBreaks.setText(paragraph);
int start = sentenceBreaks.first();
int end = sentenceBreaks.next();
String sentence = paragraph;
if (start >= 0 && end <= paragraph.length()) {
sentence = paragraph.substring(start, end);
}
return sentence.trim();
} } | public class class_name {
public String getFirstSentence(String paragraph) {
if (paragraph == null || paragraph.length() == 0) {
return ""; // depends on control dependency: [if], data = [none]
}
BreakIterator sentenceBreaks = BreakIterator.getSentenceInstance();
sentenceBreaks.setText(paragraph);
int start = sentenceBreaks.first();
int end = sentenceBreaks.next();
String sentence = paragraph;
if (start >= 0 && end <= paragraph.length()) {
sentence = paragraph.substring(start, end); // depends on control dependency: [if], data = [(start]
}
return sentence.trim();
} } |
public class class_name {
protected QualifiedName determineSequenceName(Properties params, JdbcEnvironment jdbcEnv) {
final String sequencePerEntitySuffix = ConfigurationHelper.getString( SequenceStyleGenerator.CONFIG_SEQUENCE_PER_ENTITY_SUFFIX, params, SequenceStyleGenerator.DEF_SEQUENCE_SUFFIX );
// JPA_ENTITY_NAME value honors <class ... entity-name="..."> (HBM) and @Entity#name (JPA) overrides.
final String defaultSequenceName = ConfigurationHelper.getBoolean( SequenceStyleGenerator.CONFIG_PREFER_SEQUENCE_PER_ENTITY, params, false )
? params.getProperty( JPA_ENTITY_NAME ) + sequencePerEntitySuffix
: SequenceStyleGenerator.DEF_SEQUENCE_NAME;
final String sequenceName = ConfigurationHelper.getString( SequenceStyleGenerator.SEQUENCE_PARAM, params, defaultSequenceName );
if ( sequenceName.contains( "." ) ) {
return QualifiedNameParser.INSTANCE.parse( sequenceName );
}
else {
final String schemaName = params.getProperty( PersistentIdentifierGenerator.SCHEMA );
if ( schemaName != null ) {
log.schemaOptionNotSupportedForSequenceGenerator( schemaName );
}
final String catalogName = params.getProperty( PersistentIdentifierGenerator.CATALOG );
if ( catalogName != null ) {
log.catalogOptionNotSupportedForSequenceGenerator( catalogName );
}
return new QualifiedNameParser.NameParts(
null,
null,
jdbcEnv.getIdentifierHelper().toIdentifier( sequenceName )
);
}
} } | public class class_name {
protected QualifiedName determineSequenceName(Properties params, JdbcEnvironment jdbcEnv) {
final String sequencePerEntitySuffix = ConfigurationHelper.getString( SequenceStyleGenerator.CONFIG_SEQUENCE_PER_ENTITY_SUFFIX, params, SequenceStyleGenerator.DEF_SEQUENCE_SUFFIX );
// JPA_ENTITY_NAME value honors <class ... entity-name="..."> (HBM) and @Entity#name (JPA) overrides.
final String defaultSequenceName = ConfigurationHelper.getBoolean( SequenceStyleGenerator.CONFIG_PREFER_SEQUENCE_PER_ENTITY, params, false )
? params.getProperty( JPA_ENTITY_NAME ) + sequencePerEntitySuffix
: SequenceStyleGenerator.DEF_SEQUENCE_NAME;
final String sequenceName = ConfigurationHelper.getString( SequenceStyleGenerator.SEQUENCE_PARAM, params, defaultSequenceName );
if ( sequenceName.contains( "." ) ) {
return QualifiedNameParser.INSTANCE.parse( sequenceName ); // depends on control dependency: [if], data = [none]
}
else {
final String schemaName = params.getProperty( PersistentIdentifierGenerator.SCHEMA );
if ( schemaName != null ) {
log.schemaOptionNotSupportedForSequenceGenerator( schemaName ); // depends on control dependency: [if], data = [( schemaName]
}
final String catalogName = params.getProperty( PersistentIdentifierGenerator.CATALOG );
if ( catalogName != null ) {
log.catalogOptionNotSupportedForSequenceGenerator( catalogName ); // depends on control dependency: [if], data = [( catalogName]
}
return new QualifiedNameParser.NameParts(
null,
null,
jdbcEnv.getIdentifierHelper().toIdentifier( sequenceName )
); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void addFieldRules( AnnotationInstance rulesContainerAnnotation, RuleInfo ruleInfo,
boolean applyToAllLocales )
{
//
// First parse the locale from the wrapper annotation. This will apply to all rules inside.
//
Locale locale = null;
if ( ! applyToAllLocales )
{
String language = CompilerUtils.getString( rulesContainerAnnotation, LANGUAGE_ATTR, true );
//
// If there's no language specified, then this rule will only apply for the default ruleset
// (i.e., if there are explicit rules for the requested locale, this rule will not be run).
//
if ( language != null )
{
String country = CompilerUtils.getString( rulesContainerAnnotation, COUNTRY_ATTR, true );
String variant = CompilerUtils.getString( rulesContainerAnnotation, VARIANT_ATTR, true );
language = language.trim();
if ( country != null ) country = country.trim();
if ( variant != null ) variant = variant.trim();
if ( country != null && variant != null ) locale = new Locale( language, country, variant );
else if ( country != null ) locale = new Locale( language, country );
else locale = new Locale( language );
}
}
Map valuesPresent = rulesContainerAnnotation.getElementValues();
for ( Iterator ii = valuesPresent.entrySet().iterator(); ii.hasNext(); )
{
Map.Entry entry = ( Map.Entry ) ii.next();
AnnotationValue value = ( AnnotationValue ) entry.getValue();
Object val = value.getValue();
if ( val instanceof AnnotationInstance )
{
addFieldRuleFromAnnotation( ruleInfo, ( AnnotationInstance ) val, locale, applyToAllLocales );
}
else if ( val instanceof List )
{
List annotations = CompilerUtils.getAnnotationArray( value );
for ( Iterator i3 = annotations.iterator(); i3.hasNext(); )
{
AnnotationInstance i = ( AnnotationInstance ) i3.next();
addFieldRuleFromAnnotation( ruleInfo, i, locale, applyToAllLocales );
}
}
}
setEmpty( false ); // this ValidationModel is only "empty" if there are no rules.
} } | public class class_name {
private void addFieldRules( AnnotationInstance rulesContainerAnnotation, RuleInfo ruleInfo,
boolean applyToAllLocales )
{
//
// First parse the locale from the wrapper annotation. This will apply to all rules inside.
//
Locale locale = null;
if ( ! applyToAllLocales )
{
String language = CompilerUtils.getString( rulesContainerAnnotation, LANGUAGE_ATTR, true );
//
// If there's no language specified, then this rule will only apply for the default ruleset
// (i.e., if there are explicit rules for the requested locale, this rule will not be run).
//
if ( language != null )
{
String country = CompilerUtils.getString( rulesContainerAnnotation, COUNTRY_ATTR, true );
String variant = CompilerUtils.getString( rulesContainerAnnotation, VARIANT_ATTR, true );
language = language.trim(); // depends on control dependency: [if], data = [none]
if ( country != null ) country = country.trim();
if ( variant != null ) variant = variant.trim();
if ( country != null && variant != null ) locale = new Locale( language, country, variant );
else if ( country != null ) locale = new Locale( language, country );
else locale = new Locale( language );
}
}
Map valuesPresent = rulesContainerAnnotation.getElementValues();
for ( Iterator ii = valuesPresent.entrySet().iterator(); ii.hasNext(); )
{
Map.Entry entry = ( Map.Entry ) ii.next();
AnnotationValue value = ( AnnotationValue ) entry.getValue();
Object val = value.getValue();
if ( val instanceof AnnotationInstance )
{
addFieldRuleFromAnnotation( ruleInfo, ( AnnotationInstance ) val, locale, applyToAllLocales ); // depends on control dependency: [if], data = [none]
}
else if ( val instanceof List )
{
List annotations = CompilerUtils.getAnnotationArray( value );
for ( Iterator i3 = annotations.iterator(); i3.hasNext(); )
{
AnnotationInstance i = ( AnnotationInstance ) i3.next();
addFieldRuleFromAnnotation( ruleInfo, i, locale, applyToAllLocales ); // depends on control dependency: [for], data = [none]
}
}
}
setEmpty( false ); // this ValidationModel is only "empty" if there are no rules.
} } |
public class class_name {
public static boolean waitForBundleStartup(BundleContext context, Bundle bundle, int secsToWait)
{
if ((bundle.getState() & Bundle.ACTIVE) == 0)
{ // Wait for it to start up!
if (((bundle.getState() & Bundle.RESOLVED) != 0) || ((bundle.getState() & Bundle.INSTALLED) != 0))
{
try {
bundle.start();
} catch (BundleException e) {
e.printStackTrace();
}
}
if ((bundle.getState() & Bundle.ACTIVE) == 0)
{ // Wait for it to start up!
Thread thread = Thread.currentThread();
BundleStartupListener bundleStartupListener = null;
context.addBundleListener(bundleStartupListener = new BundleStartupListener(thread, bundleContext, bundle));
// Wait 15 seconds for the ClassService to come up while the activator starts this service
synchronized (thread) {
try {
thread.wait((secsToWait == -1) ? DEFAULT_SERVICE_WAIT_SECS * 1000 : secsToWait * 1000); // Will notify me when it is up
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
context.removeBundleListener(bundleStartupListener);
}
}
return ((bundle.getState() & Bundle.ACTIVE) != 0);
} } | public class class_name {
public static boolean waitForBundleStartup(BundleContext context, Bundle bundle, int secsToWait)
{
if ((bundle.getState() & Bundle.ACTIVE) == 0)
{ // Wait for it to start up!
if (((bundle.getState() & Bundle.RESOLVED) != 0) || ((bundle.getState() & Bundle.INSTALLED) != 0))
{
try {
bundle.start(); // depends on control dependency: [try], data = [none]
} catch (BundleException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
if ((bundle.getState() & Bundle.ACTIVE) == 0)
{ // Wait for it to start up!
Thread thread = Thread.currentThread();
BundleStartupListener bundleStartupListener = null;
context.addBundleListener(bundleStartupListener = new BundleStartupListener(thread, bundleContext, bundle)); // depends on control dependency: [if], data = [none]
// Wait 15 seconds for the ClassService to come up while the activator starts this service
synchronized (thread) { // depends on control dependency: [if], data = [none]
try {
thread.wait((secsToWait == -1) ? DEFAULT_SERVICE_WAIT_SECS * 1000 : secsToWait * 1000); // Will notify me when it is up // depends on control dependency: [try], data = [none]
} catch (InterruptedException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
context.removeBundleListener(bundleStartupListener); // depends on control dependency: [if], data = [none]
}
}
return ((bundle.getState() & Bundle.ACTIVE) != 0);
} } |
public class class_name {
private boolean isPrivateIp(String address) {
InetAddress ip;
try {
ip = InetAddress.getByName(address);
} catch (UnknownHostException e) {
return false;
}
return ip.isLoopbackAddress() || ip.isLinkLocalAddress() || ip.isSiteLocalAddress();
} } | public class class_name {
private boolean isPrivateIp(String address) {
InetAddress ip;
try {
ip = InetAddress.getByName(address); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
return false;
} // depends on control dependency: [catch], data = [none]
return ip.isLoopbackAddress() || ip.isLinkLocalAddress() || ip.isSiteLocalAddress();
} } |
public class class_name {
boolean documentReference(String reference) {
if (!lazyInitDocumentation()) {
return true;
}
if (documentation.sees == null) {
documentation.sees = new ArrayList<>();
}
documentation.sees.add(reference);
return true;
} } | public class class_name {
boolean documentReference(String reference) {
if (!lazyInitDocumentation()) {
return true; // depends on control dependency: [if], data = [none]
}
if (documentation.sees == null) {
documentation.sees = new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
documentation.sees.add(reference);
return true;
} } |
public class class_name {
@Override
public void progressiveStop(CircularProgressDrawable.OnEndListener listener) {
if (!mParent.isRunning() || mEndAnimator.isRunning()) {
return;
}
mOnEndListener = listener;
mEndAnimator.addListener(new SimpleAnimatorListener() {
@Override
public void onPreAnimationEnd(Animator animation) {
mEndAnimator.removeListener(this);
CircularProgressDrawable.OnEndListener endListener = mOnEndListener;
mOnEndListener = null;
if (isStartedAndNotCancelled()) {
setEndRatio(0f);
mParent.stop();
if (endListener != null) {
endListener.onEnd(mParent);
}
}
}
});
mEndAnimator.start();
} } | public class class_name {
@Override
public void progressiveStop(CircularProgressDrawable.OnEndListener listener) {
if (!mParent.isRunning() || mEndAnimator.isRunning()) {
return; // depends on control dependency: [if], data = [none]
}
mOnEndListener = listener;
mEndAnimator.addListener(new SimpleAnimatorListener() {
@Override
public void onPreAnimationEnd(Animator animation) {
mEndAnimator.removeListener(this);
CircularProgressDrawable.OnEndListener endListener = mOnEndListener;
mOnEndListener = null;
if (isStartedAndNotCancelled()) {
setEndRatio(0f); // depends on control dependency: [if], data = [none]
mParent.stop(); // depends on control dependency: [if], data = [none]
if (endListener != null) {
endListener.onEnd(mParent); // depends on control dependency: [if], data = [none]
}
}
}
});
mEndAnimator.start();
} } |
public class class_name {
public CustomerArtifactPaths withIosPaths(String... iosPaths) {
if (this.iosPaths == null) {
setIosPaths(new java.util.ArrayList<String>(iosPaths.length));
}
for (String ele : iosPaths) {
this.iosPaths.add(ele);
}
return this;
} } | public class class_name {
public CustomerArtifactPaths withIosPaths(String... iosPaths) {
if (this.iosPaths == null) {
setIosPaths(new java.util.ArrayList<String>(iosPaths.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : iosPaths) {
this.iosPaths.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@UiHandler("m_submitButton")
public void onClickSubmit(ClickEvent event) {
String separator = ",";
String selectedValue = m_separator.getText().trim();
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(selectedValue)) {
separator = selectedValue;
}
m_separatorField.setValue(separator);
m_formPanel.submit();
} } | public class class_name {
@UiHandler("m_submitButton")
public void onClickSubmit(ClickEvent event) {
String separator = ",";
String selectedValue = m_separator.getText().trim();
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(selectedValue)) {
separator = selectedValue;
// depends on control dependency: [if], data = [none]
}
m_separatorField.setValue(separator);
m_formPanel.submit();
} } |
public class class_name {
@Override
public EClass getDatabaseInformationCategory() {
if (databaseInformationCategoryEClass == null) {
databaseInformationCategoryEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(27);
}
return databaseInformationCategoryEClass;
} } | public class class_name {
@Override
public EClass getDatabaseInformationCategory() {
if (databaseInformationCategoryEClass == null) {
databaseInformationCategoryEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(27);
// depends on control dependency: [if], data = [none]
}
return databaseInformationCategoryEClass;
} } |
public class class_name {
private void handleRemoteUser(final Object remoteUser) {
if (request != null) {
Principal userPrincipal = null;
if (remoteUser != null) {
// be defensive
if (!(remoteUser instanceof String)) {
final String message = "Attribute "
+ HttpContext.REMOTE_USER
+ " expected to be a String but was an ["
+ remoteUser.getClass() + "]";
LOG.error(message);
throw new IllegalArgumentException(message);
}
userPrincipal = new User((String) remoteUser);
}
getOsgiAuth().setUserPrincipal(userPrincipal);
} else {
LOG.warn("Remote user cannot be set to "
+ remoteUser
+ ". HttpService specific authentication is disabled because the ServletRequest object cannot be used: "
+ "Expected to be an instance of "
+ Request.class.getName() + " but got "
+ originalRequest.getClass().getName() + ".");
}
} } | public class class_name {
private void handleRemoteUser(final Object remoteUser) {
if (request != null) {
Principal userPrincipal = null;
if (remoteUser != null) {
// be defensive
if (!(remoteUser instanceof String)) {
final String message = "Attribute "
+ HttpContext.REMOTE_USER
+ " expected to be a String but was an ["
+ remoteUser.getClass() + "]";
LOG.error(message);
// depends on control dependency: [if], data = [none]
throw new IllegalArgumentException(message);
}
userPrincipal = new User((String) remoteUser);
// depends on control dependency: [if], data = [none]
}
getOsgiAuth().setUserPrincipal(userPrincipal);
// depends on control dependency: [if], data = [none]
} else {
LOG.warn("Remote user cannot be set to "
+ remoteUser
+ ". HttpService specific authentication is disabled because the ServletRequest object cannot be used: "
+ "Expected to be an instance of "
+ Request.class.getName() + " but got "
+ originalRequest.getClass().getName() + ".");
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public java.util.List<DBSubnetGroup> getDBSubnetGroups() {
if (dBSubnetGroups == null) {
dBSubnetGroups = new com.amazonaws.internal.SdkInternalList<DBSubnetGroup>();
}
return dBSubnetGroups;
} } | public class class_name {
public java.util.List<DBSubnetGroup> getDBSubnetGroups() {
if (dBSubnetGroups == null) {
dBSubnetGroups = new com.amazonaws.internal.SdkInternalList<DBSubnetGroup>(); // depends on control dependency: [if], data = [none]
}
return dBSubnetGroups;
} } |
public class class_name {
public MaterialSection setNotifications(int notifications) {
String textNotification;
textNotification = String.valueOf(notifications);
if(notifications < 1) {
textNotification = "";
}
if(notifications > 99) {
textNotification = "99+";
}
this.notifications.setText(textNotification);
numberNotifications = notifications;
return this;
} } | public class class_name {
public MaterialSection setNotifications(int notifications) {
String textNotification;
textNotification = String.valueOf(notifications);
if(notifications < 1) {
textNotification = ""; // depends on control dependency: [if], data = [none]
}
if(notifications > 99) {
textNotification = "99+"; // depends on control dependency: [if], data = [none]
}
this.notifications.setText(textNotification);
numberNotifications = notifications;
return this;
} } |
public class class_name {
public static Duration getLeadTimeDurationFromConfig(State state) {
String leadTimeProp = state.getProp(DATE_PARTITIONED_SOURCE_PARTITION_LEAD_TIME);
if (leadTimeProp == null || leadTimeProp.length() == 0) {
return DEFAULT_PARTITIONED_SOURCE_PARTITION_LEAD_TIME;
}
int leadTime = Integer.parseInt(leadTimeProp);
DatePartitionType leadTimeGranularity = DEFAULT_DATE_PARTITIONED_SOURCE_PARTITION_LEAD_TIME_GRANULARITY;
String leadTimeGranularityProp = state.getProp(DATE_PARTITIONED_SOURCE_PARTITION_LEAD_TIME_GRANULARITY);
if (leadTimeGranularityProp != null) {
leadTimeGranularity = DatePartitionType.valueOf(leadTimeGranularityProp);
}
return new Duration(leadTime * leadTimeGranularity.getUnitMilliseconds());
} } | public class class_name {
public static Duration getLeadTimeDurationFromConfig(State state) {
String leadTimeProp = state.getProp(DATE_PARTITIONED_SOURCE_PARTITION_LEAD_TIME);
if (leadTimeProp == null || leadTimeProp.length() == 0) {
return DEFAULT_PARTITIONED_SOURCE_PARTITION_LEAD_TIME; // depends on control dependency: [if], data = [none]
}
int leadTime = Integer.parseInt(leadTimeProp);
DatePartitionType leadTimeGranularity = DEFAULT_DATE_PARTITIONED_SOURCE_PARTITION_LEAD_TIME_GRANULARITY;
String leadTimeGranularityProp = state.getProp(DATE_PARTITIONED_SOURCE_PARTITION_LEAD_TIME_GRANULARITY);
if (leadTimeGranularityProp != null) {
leadTimeGranularity = DatePartitionType.valueOf(leadTimeGranularityProp); // depends on control dependency: [if], data = [(leadTimeGranularityProp]
}
return new Duration(leadTime * leadTimeGranularity.getUnitMilliseconds());
} } |
public class class_name {
protected long getUniqueLong(FieldDescriptor field) throws SequenceManagerException
{
boolean needsCommit = false;
long result = 0;
/*
arminw:
use the associated broker instance, check if broker was in tx or
we need to commit used connection.
*/
PersistenceBroker targetBroker = getBrokerForClass();
if(!targetBroker.isInTransaction())
{
targetBroker.beginTransaction();
needsCommit = true;
}
try
{
// lookup sequence name
String sequenceName = calculateSequenceName(field);
try
{
result = buildNextSequence(targetBroker, field.getClassDescriptor(), sequenceName);
/*
if 0 was returned we assume that the stored procedure
did not work properly.
*/
if (result == 0)
{
throw new SequenceManagerException("No incremented value retrieved");
}
}
catch (Exception e)
{
// maybe the sequence was not created
log.info("Could not grab next key, message was " + e.getMessage() +
" - try to write a new sequence entry to database");
try
{
// on create, make sure to get the max key for the table first
long maxKey = SequenceManagerHelper.getMaxForExtent(targetBroker, field);
createSequence(targetBroker, field, sequenceName, maxKey);
}
catch (Exception e1)
{
String eol = SystemUtils.LINE_SEPARATOR;
throw new SequenceManagerException(eol + "Could not grab next id, failed with " + eol +
e.getMessage() + eol + "Creation of new sequence failed with " +
eol + e1.getMessage() + eol, e1);
}
try
{
result = buildNextSequence(targetBroker, field.getClassDescriptor(), sequenceName);
}
catch (Exception e1)
{
throw new SequenceManagerException("Could not grab next id although a sequence seems to exist", e);
}
}
}
finally
{
if(targetBroker != null && needsCommit)
{
targetBroker.commitTransaction();
}
}
return result;
} } | public class class_name {
protected long getUniqueLong(FieldDescriptor field) throws SequenceManagerException
{
boolean needsCommit = false;
long result = 0;
/*
arminw:
use the associated broker instance, check if broker was in tx or
we need to commit used connection.
*/
PersistenceBroker targetBroker = getBrokerForClass();
if(!targetBroker.isInTransaction())
{
targetBroker.beginTransaction();
needsCommit = true;
}
try
{
// lookup sequence name
String sequenceName = calculateSequenceName(field);
try
{
result = buildNextSequence(targetBroker, field.getClassDescriptor(), sequenceName);
// depends on control dependency: [try], data = [none]
/*
if 0 was returned we assume that the stored procedure
did not work properly.
*/
if (result == 0)
{
throw new SequenceManagerException("No incremented value retrieved");
}
}
catch (Exception e)
{
// maybe the sequence was not created
log.info("Could not grab next key, message was " + e.getMessage() +
" - try to write a new sequence entry to database");
try
{
// on create, make sure to get the max key for the table first
long maxKey = SequenceManagerHelper.getMaxForExtent(targetBroker, field);
createSequence(targetBroker, field, sequenceName, maxKey);
}
catch (Exception e1)
{
String eol = SystemUtils.LINE_SEPARATOR;
throw new SequenceManagerException(eol + "Could not grab next id, failed with " + eol +
e.getMessage() + eol + "Creation of new sequence failed with " +
eol + e1.getMessage() + eol, e1);
}
// depends on control dependency: [catch], data = [none]
try
{
result = buildNextSequence(targetBroker, field.getClassDescriptor(), sequenceName);
// depends on control dependency: [try], data = [none]
}
catch (Exception e1)
{
throw new SequenceManagerException("Could not grab next id although a sequence seems to exist", e);
}
// depends on control dependency: [catch], data = [none]
}
}
finally
{
if(targetBroker != null && needsCommit)
{
targetBroker.commitTransaction();
}
}
return result;
} } |
public class class_name {
public final EObject ruleXFunctionTypeRef() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token otherlv_2=null;
Token otherlv_4=null;
Token otherlv_5=null;
EObject lv_paramTypes_1_0 = null;
EObject lv_paramTypes_3_0 = null;
EObject lv_returnType_6_0 = null;
enterRule();
try {
// InternalXbaseWithAnnotations.g:6013:2: ( ( (otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')' )? otherlv_5= '=>' ( (lv_returnType_6_0= ruleJvmTypeReference ) ) ) )
// InternalXbaseWithAnnotations.g:6014:2: ( (otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')' )? otherlv_5= '=>' ( (lv_returnType_6_0= ruleJvmTypeReference ) ) )
{
// InternalXbaseWithAnnotations.g:6014:2: ( (otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')' )? otherlv_5= '=>' ( (lv_returnType_6_0= ruleJvmTypeReference ) ) )
// InternalXbaseWithAnnotations.g:6015:3: (otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')' )? otherlv_5= '=>' ( (lv_returnType_6_0= ruleJvmTypeReference ) )
{
// InternalXbaseWithAnnotations.g:6015:3: (otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')' )?
int alt108=2;
int LA108_0 = input.LA(1);
if ( (LA108_0==14) ) {
alt108=1;
}
switch (alt108) {
case 1 :
// InternalXbaseWithAnnotations.g:6016:4: otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')'
{
otherlv_0=(Token)match(input,14,FOLLOW_74); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_0, grammarAccess.getXFunctionTypeRefAccess().getLeftParenthesisKeyword_0_0());
}
// InternalXbaseWithAnnotations.g:6020:4: ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )?
int alt107=2;
int LA107_0 = input.LA(1);
if ( (LA107_0==RULE_ID||LA107_0==14||LA107_0==39) ) {
alt107=1;
}
switch (alt107) {
case 1 :
// InternalXbaseWithAnnotations.g:6021:5: ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )*
{
// InternalXbaseWithAnnotations.g:6021:5: ( (lv_paramTypes_1_0= ruleJvmTypeReference ) )
// InternalXbaseWithAnnotations.g:6022:6: (lv_paramTypes_1_0= ruleJvmTypeReference )
{
// InternalXbaseWithAnnotations.g:6022:6: (lv_paramTypes_1_0= ruleJvmTypeReference )
// InternalXbaseWithAnnotations.g:6023:7: lv_paramTypes_1_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFunctionTypeRefAccess().getParamTypesJvmTypeReferenceParserRuleCall_0_1_0_0());
}
pushFollow(FOLLOW_6);
lv_paramTypes_1_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFunctionTypeRefRule());
}
add(
current,
"paramTypes",
lv_paramTypes_1_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference");
afterParserOrEnumRuleCall();
}
}
}
// InternalXbaseWithAnnotations.g:6040:5: (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )*
loop106:
do {
int alt106=2;
int LA106_0 = input.LA(1);
if ( (LA106_0==15) ) {
alt106=1;
}
switch (alt106) {
case 1 :
// InternalXbaseWithAnnotations.g:6041:6: otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) )
{
otherlv_2=(Token)match(input,15,FOLLOW_22); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXFunctionTypeRefAccess().getCommaKeyword_0_1_1_0());
}
// InternalXbaseWithAnnotations.g:6045:6: ( (lv_paramTypes_3_0= ruleJvmTypeReference ) )
// InternalXbaseWithAnnotations.g:6046:7: (lv_paramTypes_3_0= ruleJvmTypeReference )
{
// InternalXbaseWithAnnotations.g:6046:7: (lv_paramTypes_3_0= ruleJvmTypeReference )
// InternalXbaseWithAnnotations.g:6047:8: lv_paramTypes_3_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFunctionTypeRefAccess().getParamTypesJvmTypeReferenceParserRuleCall_0_1_1_1_0());
}
pushFollow(FOLLOW_6);
lv_paramTypes_3_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFunctionTypeRefRule());
}
add(
current,
"paramTypes",
lv_paramTypes_3_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference");
afterParserOrEnumRuleCall();
}
}
}
}
break;
default :
break loop106;
}
} while (true);
}
break;
}
otherlv_4=(Token)match(input,16,FOLLOW_75); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXFunctionTypeRefAccess().getRightParenthesisKeyword_0_2());
}
}
break;
}
otherlv_5=(Token)match(input,39,FOLLOW_22); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_5, grammarAccess.getXFunctionTypeRefAccess().getEqualsSignGreaterThanSignKeyword_1());
}
// InternalXbaseWithAnnotations.g:6075:3: ( (lv_returnType_6_0= ruleJvmTypeReference ) )
// InternalXbaseWithAnnotations.g:6076:4: (lv_returnType_6_0= ruleJvmTypeReference )
{
// InternalXbaseWithAnnotations.g:6076:4: (lv_returnType_6_0= ruleJvmTypeReference )
// InternalXbaseWithAnnotations.g:6077:5: lv_returnType_6_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFunctionTypeRefAccess().getReturnTypeJvmTypeReferenceParserRuleCall_2_0());
}
pushFollow(FOLLOW_2);
lv_returnType_6_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFunctionTypeRefRule());
}
set(
current,
"returnType",
lv_returnType_6_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference");
afterParserOrEnumRuleCall();
}
}
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleXFunctionTypeRef() throws RecognitionException {
EObject current = null;
Token otherlv_0=null;
Token otherlv_2=null;
Token otherlv_4=null;
Token otherlv_5=null;
EObject lv_paramTypes_1_0 = null;
EObject lv_paramTypes_3_0 = null;
EObject lv_returnType_6_0 = null;
enterRule();
try {
// InternalXbaseWithAnnotations.g:6013:2: ( ( (otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')' )? otherlv_5= '=>' ( (lv_returnType_6_0= ruleJvmTypeReference ) ) ) )
// InternalXbaseWithAnnotations.g:6014:2: ( (otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')' )? otherlv_5= '=>' ( (lv_returnType_6_0= ruleJvmTypeReference ) ) )
{
// InternalXbaseWithAnnotations.g:6014:2: ( (otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')' )? otherlv_5= '=>' ( (lv_returnType_6_0= ruleJvmTypeReference ) ) )
// InternalXbaseWithAnnotations.g:6015:3: (otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')' )? otherlv_5= '=>' ( (lv_returnType_6_0= ruleJvmTypeReference ) )
{
// InternalXbaseWithAnnotations.g:6015:3: (otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')' )?
int alt108=2;
int LA108_0 = input.LA(1);
if ( (LA108_0==14) ) {
alt108=1; // depends on control dependency: [if], data = [none]
}
switch (alt108) {
case 1 :
// InternalXbaseWithAnnotations.g:6016:4: otherlv_0= '(' ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )? otherlv_4= ')'
{
otherlv_0=(Token)match(input,14,FOLLOW_74); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_0, grammarAccess.getXFunctionTypeRefAccess().getLeftParenthesisKeyword_0_0()); // depends on control dependency: [if], data = [none]
}
// InternalXbaseWithAnnotations.g:6020:4: ( ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )* )?
int alt107=2;
int LA107_0 = input.LA(1);
if ( (LA107_0==RULE_ID||LA107_0==14||LA107_0==39) ) {
alt107=1; // depends on control dependency: [if], data = [none]
}
switch (alt107) {
case 1 :
// InternalXbaseWithAnnotations.g:6021:5: ( (lv_paramTypes_1_0= ruleJvmTypeReference ) ) (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )*
{
// InternalXbaseWithAnnotations.g:6021:5: ( (lv_paramTypes_1_0= ruleJvmTypeReference ) )
// InternalXbaseWithAnnotations.g:6022:6: (lv_paramTypes_1_0= ruleJvmTypeReference )
{
// InternalXbaseWithAnnotations.g:6022:6: (lv_paramTypes_1_0= ruleJvmTypeReference )
// InternalXbaseWithAnnotations.g:6023:7: lv_paramTypes_1_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFunctionTypeRefAccess().getParamTypesJvmTypeReferenceParserRuleCall_0_1_0_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_6);
lv_paramTypes_1_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFunctionTypeRefRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"paramTypes",
lv_paramTypes_1_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
// InternalXbaseWithAnnotations.g:6040:5: (otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) ) )*
loop106:
do {
int alt106=2;
int LA106_0 = input.LA(1);
if ( (LA106_0==15) ) {
alt106=1; // depends on control dependency: [if], data = [none]
}
switch (alt106) {
case 1 :
// InternalXbaseWithAnnotations.g:6041:6: otherlv_2= ',' ( (lv_paramTypes_3_0= ruleJvmTypeReference ) )
{
otherlv_2=(Token)match(input,15,FOLLOW_22); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXFunctionTypeRefAccess().getCommaKeyword_0_1_1_0()); // depends on control dependency: [if], data = [none]
}
// InternalXbaseWithAnnotations.g:6045:6: ( (lv_paramTypes_3_0= ruleJvmTypeReference ) )
// InternalXbaseWithAnnotations.g:6046:7: (lv_paramTypes_3_0= ruleJvmTypeReference )
{
// InternalXbaseWithAnnotations.g:6046:7: (lv_paramTypes_3_0= ruleJvmTypeReference )
// InternalXbaseWithAnnotations.g:6047:8: lv_paramTypes_3_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFunctionTypeRefAccess().getParamTypesJvmTypeReferenceParserRuleCall_0_1_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_6);
lv_paramTypes_3_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFunctionTypeRefRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"paramTypes",
lv_paramTypes_3_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
default :
break loop106;
}
} while (true);
}
break;
}
otherlv_4=(Token)match(input,16,FOLLOW_75); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXFunctionTypeRefAccess().getRightParenthesisKeyword_0_2()); // depends on control dependency: [if], data = [none]
}
}
break;
}
otherlv_5=(Token)match(input,39,FOLLOW_22); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_5, grammarAccess.getXFunctionTypeRefAccess().getEqualsSignGreaterThanSignKeyword_1()); // depends on control dependency: [if], data = [none]
}
// InternalXbaseWithAnnotations.g:6075:3: ( (lv_returnType_6_0= ruleJvmTypeReference ) )
// InternalXbaseWithAnnotations.g:6076:4: (lv_returnType_6_0= ruleJvmTypeReference )
{
// InternalXbaseWithAnnotations.g:6076:4: (lv_returnType_6_0= ruleJvmTypeReference )
// InternalXbaseWithAnnotations.g:6077:5: lv_returnType_6_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXFunctionTypeRefAccess().getReturnTypeJvmTypeReferenceParserRuleCall_2_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_2);
lv_returnType_6_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXFunctionTypeRefRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"returnType",
lv_returnType_6_0,
"org.eclipse.xtext.xbase.Xtype.JvmTypeReference");
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
public Message handleInputStream(byte commandByte, InputStream inputStream) {
// Firmata command bytes are limited to a 0xF0 mask, or bytes 0xF0-0xFF
// The extra data in the byte is for routing the command to various 'midi channels'
// or in our case Firmata device pins.
byte firmataCommandByte = commandByte < (byte) 0xF0 ? (byte) (commandByte & 0xF0) : commandByte;
MessageBuilder messageBuilder = messageBuilderMap.get(firmataCommandByte);
if (messageBuilder != null) {
// Pull out the pin identifier bits that were padded into the byte (if any)
byte channelByte = (byte) (commandByte & 0x0F);
Message message = messageBuilder.buildMessage(channelByte, inputStream);
if (message == null) {
log.error("Error building Firmata messageBuilder for command byte {}.",
FirmataHelper.bytesToHexString(commandByte));
} else {
return message;
}
} else {
log.warn("Dropped byte {}.", FirmataHelper.bytesToHexString(commandByte));
}
return null;
} } | public class class_name {
public Message handleInputStream(byte commandByte, InputStream inputStream) {
// Firmata command bytes are limited to a 0xF0 mask, or bytes 0xF0-0xFF
// The extra data in the byte is for routing the command to various 'midi channels'
// or in our case Firmata device pins.
byte firmataCommandByte = commandByte < (byte) 0xF0 ? (byte) (commandByte & 0xF0) : commandByte;
MessageBuilder messageBuilder = messageBuilderMap.get(firmataCommandByte);
if (messageBuilder != null) {
// Pull out the pin identifier bits that were padded into the byte (if any)
byte channelByte = (byte) (commandByte & 0x0F);
Message message = messageBuilder.buildMessage(channelByte, inputStream);
if (message == null) {
log.error("Error building Firmata messageBuilder for command byte {}.",
FirmataHelper.bytesToHexString(commandByte)); // depends on control dependency: [if], data = [none]
} else {
return message; // depends on control dependency: [if], data = [none]
}
} else {
log.warn("Dropped byte {}.", FirmataHelper.bytesToHexString(commandByte)); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
public void removeByLtD_S(Date displayDate, int status) {
for (CPDefinition cpDefinition : findByLtD_S(displayDate, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition);
}
} } | public class class_name {
@Override
public void removeByLtD_S(Date displayDate, int status) {
for (CPDefinition cpDefinition : findByLtD_S(displayDate, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinition); // depends on control dependency: [for], data = [cpDefinition]
}
} } |
public class class_name {
@Override
public DataResponse<List<Feature>> getFeatureEpicEstimates(ObjectId componentId, String teamId, String projectId,
Optional<String> agileType, Optional<String> estimateMetricType) {
Component component = componentRepository.findOne(componentId);
if ((component == null) || CollectionUtils.isEmpty(component.getCollectorItems())
|| CollectionUtils
.isEmpty(component.getCollectorItems().get(CollectorType.AgileTool))
|| (component.getCollectorItems().get(CollectorType.AgileTool).get(0) == null)) {
return getEmptyLegacyDataResponse();
}
CollectorItem item = component.getCollectorItems().get(CollectorType.AgileTool).get(0);
List<Feature> relevantFeatureEstimates = getFeaturesForCurrentSprints(teamId, projectId, item.getCollectorId(), agileType.isPresent()? agileType.get() : null, true);
// epicID : epic information (in the form of a Feature object)
Map<String, Feature> epicIDToEpicFeatureMap = new HashMap<>();
for (Feature tempRs : relevantFeatureEstimates) {
String epicID = tempRs.getsEpicID();
if (StringUtils.isEmpty(epicID))
continue;
Feature feature = epicIDToEpicFeatureMap.get(epicID);
if (feature == null) {
feature = new Feature();
feature.setId(null);
feature.setsEpicID(epicID);
feature.setsEpicNumber(tempRs.getsEpicNumber());
feature.setsEpicUrl(tempRs.getsEpicUrl());
feature.setsEpicName(tempRs.getsEpicName());
feature.setsEpicAssetState(tempRs.getsEpicAssetState());
feature.setsEstimate("0");
epicIDToEpicFeatureMap.put(epicID, feature);
}
// if estimateMetricType is hours accumulate time estimate in minutes for better precision ... divide by 60 later
int estimate = getEstimate(tempRs, estimateMetricType);
feature.setsEstimate(String.valueOf(Integer.valueOf(feature.getsEstimate()) + estimate));
}
if (isEstimateTime(estimateMetricType)) {
// time estimate is in minutes but we want to return in hours
for (Feature f : epicIDToEpicFeatureMap.values()) {
f.setsEstimate(String.valueOf(Integer.valueOf(f.getsEstimate()) / 60));
}
}
Collector collector = collectorRepository.findOne(item.getCollectorId());
return new DataResponse<>(new ArrayList<>(epicIDToEpicFeatureMap.values()), collector.getLastExecuted());
} } | public class class_name {
@Override
public DataResponse<List<Feature>> getFeatureEpicEstimates(ObjectId componentId, String teamId, String projectId,
Optional<String> agileType, Optional<String> estimateMetricType) {
Component component = componentRepository.findOne(componentId);
if ((component == null) || CollectionUtils.isEmpty(component.getCollectorItems())
|| CollectionUtils
.isEmpty(component.getCollectorItems().get(CollectorType.AgileTool))
|| (component.getCollectorItems().get(CollectorType.AgileTool).get(0) == null)) {
return getEmptyLegacyDataResponse(); // depends on control dependency: [if], data = [none]
}
CollectorItem item = component.getCollectorItems().get(CollectorType.AgileTool).get(0);
List<Feature> relevantFeatureEstimates = getFeaturesForCurrentSprints(teamId, projectId, item.getCollectorId(), agileType.isPresent()? agileType.get() : null, true);
// epicID : epic information (in the form of a Feature object)
Map<String, Feature> epicIDToEpicFeatureMap = new HashMap<>();
for (Feature tempRs : relevantFeatureEstimates) {
String epicID = tempRs.getsEpicID();
if (StringUtils.isEmpty(epicID))
continue;
Feature feature = epicIDToEpicFeatureMap.get(epicID);
if (feature == null) {
feature = new Feature(); // depends on control dependency: [if], data = [none]
feature.setId(null); // depends on control dependency: [if], data = [null)]
feature.setsEpicID(epicID); // depends on control dependency: [if], data = [none]
feature.setsEpicNumber(tempRs.getsEpicNumber()); // depends on control dependency: [if], data = [none]
feature.setsEpicUrl(tempRs.getsEpicUrl()); // depends on control dependency: [if], data = [none]
feature.setsEpicName(tempRs.getsEpicName()); // depends on control dependency: [if], data = [none]
feature.setsEpicAssetState(tempRs.getsEpicAssetState()); // depends on control dependency: [if], data = [none]
feature.setsEstimate("0"); // depends on control dependency: [if], data = [none]
epicIDToEpicFeatureMap.put(epicID, feature); // depends on control dependency: [if], data = [none]
}
// if estimateMetricType is hours accumulate time estimate in minutes for better precision ... divide by 60 later
int estimate = getEstimate(tempRs, estimateMetricType);
feature.setsEstimate(String.valueOf(Integer.valueOf(feature.getsEstimate()) + estimate)); // depends on control dependency: [for], data = [none]
}
if (isEstimateTime(estimateMetricType)) {
// time estimate is in minutes but we want to return in hours
for (Feature f : epicIDToEpicFeatureMap.values()) {
f.setsEstimate(String.valueOf(Integer.valueOf(f.getsEstimate()) / 60)); // depends on control dependency: [for], data = [f]
}
}
Collector collector = collectorRepository.findOne(item.getCollectorId());
return new DataResponse<>(new ArrayList<>(epicIDToEpicFeatureMap.values()), collector.getLastExecuted());
} } |
public class class_name {
public void free() {
if (handle != 0L) {
Log.d(LogDomain.REPLICATOR, "handle: " + handle);
Log.d(
LogDomain.REPLICATOR,
"replicatorContext: " + replicatorContext + " $" + replicatorContext.getClass());
Log.d(
LogDomain.REPLICATOR,
"socketFactoryContext: " + socketFactoryContext + " $" + socketFactoryContext.getClass());
free(handle, replicatorContext, socketFactoryContext);
handle = 0L;
}
if (replicatorContext != null) {
CONTEXT_TO_C4_REPLICATOR_MAP.remove(this.replicatorContext);
replicatorContext = null;
}
} } | public class class_name {
public void free() {
if (handle != 0L) {
Log.d(LogDomain.REPLICATOR, "handle: " + handle); // depends on control dependency: [if], data = [none]
Log.d(
LogDomain.REPLICATOR,
"replicatorContext: " + replicatorContext + " $" + replicatorContext.getClass()); // depends on control dependency: [if], data = [none]
Log.d(
LogDomain.REPLICATOR,
"socketFactoryContext: " + socketFactoryContext + " $" + socketFactoryContext.getClass()); // depends on control dependency: [if], data = [none]
free(handle, replicatorContext, socketFactoryContext); // depends on control dependency: [if], data = [(handle]
handle = 0L; // depends on control dependency: [if], data = [none]
}
if (replicatorContext != null) {
CONTEXT_TO_C4_REPLICATOR_MAP.remove(this.replicatorContext); // depends on control dependency: [if], data = [none]
replicatorContext = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getAbsolutePath() {
if (isAbsolute()) {
return path;
}
String userDir = System.getProperty("user.dir");
return path.isEmpty() ? userDir : join(userDir, path);
} } | public class class_name {
public String getAbsolutePath() {
if (isAbsolute()) {
return path; // depends on control dependency: [if], data = [none]
}
String userDir = System.getProperty("user.dir");
return path.isEmpty() ? userDir : join(userDir, path);
} } |
public class class_name {
public static String autoDetect(String absolutePath) {
String extension = null;
int index = absolutePath.lastIndexOf(".") + 1;
if (index >= 0 && index <= absolutePath.length()) {
extension = absolutePath.substring(index);
}
if (extension == null || extension.isEmpty()) {
return APPLICATION_OCTET_STREAM;
}
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
if (mimeType == null) {
// mp4 does not always get recognized automatically
if ("mp4".equalsIgnoreCase(extension))
return VIDEO_MPEG4;
return APPLICATION_OCTET_STREAM;
}
return mimeType;
} } | public class class_name {
public static String autoDetect(String absolutePath) {
String extension = null;
int index = absolutePath.lastIndexOf(".") + 1;
if (index >= 0 && index <= absolutePath.length()) {
extension = absolutePath.substring(index); // depends on control dependency: [if], data = [(index]
}
if (extension == null || extension.isEmpty()) {
return APPLICATION_OCTET_STREAM; // depends on control dependency: [if], data = [none]
}
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
if (mimeType == null) {
// mp4 does not always get recognized automatically
if ("mp4".equalsIgnoreCase(extension))
return VIDEO_MPEG4;
return APPLICATION_OCTET_STREAM; // depends on control dependency: [if], data = [none]
}
return mimeType;
} } |
public class class_name {
public static base_responses disable(nitro_service client, service resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
service disableresources[] = new service[resources.length];
for (int i=0;i<resources.length;i++){
disableresources[i] = new service();
disableresources[i].name = resources[i].name;
disableresources[i].delay = resources[i].delay;
disableresources[i].graceful = resources[i].graceful;
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} } | public class class_name {
public static base_responses disable(nitro_service client, service resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
service disableresources[] = new service[resources.length];
for (int i=0;i<resources.length;i++){
disableresources[i] = new service(); // depends on control dependency: [for], data = [i]
disableresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i]
disableresources[i].delay = resources[i].delay; // depends on control dependency: [for], data = [i]
disableresources[i].graceful = resources[i].graceful; // depends on control dependency: [for], data = [i]
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} } |
public class class_name {
public static Duration toDuration(String time) {
if (isBlank(time)) {
return Duration.ZERO;
}
return Duration.of(dehumanize(time), ChronoUnit.MILLIS);
} } | public class class_name {
public static Duration toDuration(String time) {
if (isBlank(time)) {
return Duration.ZERO; // depends on control dependency: [if], data = [none]
}
return Duration.of(dehumanize(time), ChronoUnit.MILLIS);
} } |
public class class_name {
public static String getIPAddr() {
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface interfaceN = (NetworkInterface) interfaces.nextElement();
Enumeration<InetAddress> ienum = interfaceN.getInetAddresses();
while (ienum.hasMoreElements()) {
InetAddress ipaddr = (InetAddress) ienum.nextElement();
if (ipaddr instanceof Inet4Address) {
if (ipaddr.getHostAddress().toString().startsWith("127") || ipaddr.getHostAddress().toString().startsWith("192")) {
continue;
} else {
return ipaddr.getHostAddress();
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
} } | public class class_name {
public static String getIPAddr() {
try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface interfaceN = (NetworkInterface) interfaces.nextElement();
Enumeration<InetAddress> ienum = interfaceN.getInetAddresses();
while (ienum.hasMoreElements()) {
InetAddress ipaddr = (InetAddress) ienum.nextElement();
if (ipaddr instanceof Inet4Address) {
if (ipaddr.getHostAddress().toString().startsWith("127") || ipaddr.getHostAddress().toString().startsWith("192")) {
continue;
} else {
return ipaddr.getHostAddress(); // depends on control dependency: [if], data = [none]
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public void setDirectoryConfigs(java.util.Collection<DirectoryConfig> directoryConfigs) {
if (directoryConfigs == null) {
this.directoryConfigs = null;
return;
}
this.directoryConfigs = new java.util.ArrayList<DirectoryConfig>(directoryConfigs);
} } | public class class_name {
public void setDirectoryConfigs(java.util.Collection<DirectoryConfig> directoryConfigs) {
if (directoryConfigs == null) {
this.directoryConfigs = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.directoryConfigs = new java.util.ArrayList<DirectoryConfig>(directoryConfigs);
} } |
public class class_name {
@Override
public int distributedProcess(ResponseBuilder rb) throws IOException {
// System.out.println(System.nanoTime() + " - "
// + Thread.currentThread().getId() + " - "
// + rb.req.getParams().getBool(ShardParams.IS_SHARD, false)
// + " DISTIRBUTEDPROCESS " + rb.stage + " " + rb.req.getParamString());
MtasSolrStatus solrStatus = Objects
.requireNonNull((MtasSolrStatus) rb.req.getContext().get(MtasSolrStatus.class), "couldn't find status");
solrStatus.setStage(rb.stage);
try {
if (rb.req.getParams().getBool(PARAM_MTAS, false)) {
if (rb.stage == STAGE_TERMVECTOR_MISSING_TOP || rb.stage == STAGE_TERMVECTOR_MISSING_KEY
|| rb.stage == STAGE_TERMVECTOR_FINISH) {
ComponentFields mtasFields = getMtasFields(rb);
searchTermvector.distributedProcess(rb, mtasFields);
} else if (rb.stage == STAGE_LIST) {
ComponentFields mtasFields = getMtasFields(rb);
searchList.distributedProcess(rb, mtasFields);
} else if (rb.stage == STAGE_PREFIX) {
ComponentFields mtasFields = getMtasFields(rb);
searchPrefix.distributedProcess(rb, mtasFields);
} else if (rb.stage == STAGE_STATS) {
ComponentFields mtasFields = getMtasFields(rb);
searchStats.distributedProcess(rb, mtasFields);
} else if (rb.stage == STAGE_FACET) {
ComponentFields mtasFields = getMtasFields(rb);
searchFacet.distributedProcess(rb, mtasFields);
} else if (rb.stage == STAGE_COLLECTION_INIT || rb.stage == STAGE_COLLECTION_FINISH) {
ComponentFields mtasFields = getMtasFields(rb);
searchCollection.distributedProcess(rb, mtasFields);
} else if (rb.stage == STAGE_GROUP) {
ComponentFields mtasFields = getMtasFields(rb);
searchGroup.distributedProcess(rb, mtasFields);
} else if (rb.stage == STAGE_DOCUMENT) {
ComponentFields mtasFields = getMtasFields(rb);
searchDocument.distributedProcess(rb, mtasFields);
}
// compute new stage and return if not finished
if (rb.stage >= ResponseBuilder.STAGE_EXECUTE_QUERY && rb.stage < ResponseBuilder.STAGE_GET_FIELDS) {
if (rb.stage < STAGE_TERMVECTOR_MISSING_TOP
&& rb.req.getParams().getBool(MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) {
return STAGE_TERMVECTOR_MISSING_TOP;
} else if (rb.stage < STAGE_TERMVECTOR_MISSING_KEY
&& rb.req.getParams().getBool(MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) {
return STAGE_TERMVECTOR_MISSING_KEY;
} else if (rb.stage < STAGE_TERMVECTOR_FINISH
&& rb.req.getParams().getBool(MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) {
return STAGE_TERMVECTOR_FINISH;
} else if (rb.stage < STAGE_LIST
&& rb.req.getParams().getBool(MtasSolrComponentList.PARAM_MTAS_LIST, false)) {
return STAGE_LIST;
} else if (rb.stage < STAGE_PREFIX
&& rb.req.getParams().getBool(MtasSolrComponentPrefix.PARAM_MTAS_PREFIX, false)) {
return STAGE_PREFIX;
} else if (rb.stage < STAGE_STATS
&& rb.req.getParams().getBool(MtasSolrComponentStats.PARAM_MTAS_STATS, false)) {
return STAGE_STATS;
} else if (rb.stage < STAGE_FACET
&& rb.req.getParams().getBool(MtasSolrComponentFacet.PARAM_MTAS_FACET, false)) {
return STAGE_FACET;
} else if (rb.stage < STAGE_GROUP
&& rb.req.getParams().getBool(MtasSolrComponentGroup.PARAM_MTAS_GROUP, false)) {
return STAGE_GROUP;
} else if (rb.stage < STAGE_COLLECTION_INIT
&& rb.req.getParams().getBool(MtasSolrComponentCollection.PARAM_MTAS_COLLECTION, false)) {
return STAGE_COLLECTION_INIT;
} else if (rb.stage < STAGE_COLLECTION_FINISH
&& rb.req.getParams().getBool(MtasSolrComponentCollection.PARAM_MTAS_COLLECTION, false)) {
return STAGE_COLLECTION_FINISH;
}
} else if (rb.stage >= ResponseBuilder.STAGE_GET_FIELDS && rb.stage < ResponseBuilder.STAGE_DONE) {
if (rb.stage < STAGE_DOCUMENT
&& rb.req.getParams().getBool(MtasSolrComponentDocument.PARAM_MTAS_DOCUMENT, false)) {
return STAGE_DOCUMENT;
}
}
}
} catch (ExitableDirectoryReader.ExitingReaderException e) {
solrStatus.setError(e.getMessage());
finishStatus(solrStatus);
} finally {
checkStatus(solrStatus);
}
return ResponseBuilder.STAGE_DONE;
} } | public class class_name {
@Override
public int distributedProcess(ResponseBuilder rb) throws IOException {
// System.out.println(System.nanoTime() + " - "
// + Thread.currentThread().getId() + " - "
// + rb.req.getParams().getBool(ShardParams.IS_SHARD, false)
// + " DISTIRBUTEDPROCESS " + rb.stage + " " + rb.req.getParamString());
MtasSolrStatus solrStatus = Objects
.requireNonNull((MtasSolrStatus) rb.req.getContext().get(MtasSolrStatus.class), "couldn't find status");
solrStatus.setStage(rb.stage);
try {
if (rb.req.getParams().getBool(PARAM_MTAS, false)) {
if (rb.stage == STAGE_TERMVECTOR_MISSING_TOP || rb.stage == STAGE_TERMVECTOR_MISSING_KEY
|| rb.stage == STAGE_TERMVECTOR_FINISH) {
ComponentFields mtasFields = getMtasFields(rb);
searchTermvector.distributedProcess(rb, mtasFields); // depends on control dependency: [if], data = [none]
} else if (rb.stage == STAGE_LIST) {
ComponentFields mtasFields = getMtasFields(rb);
searchList.distributedProcess(rb, mtasFields); // depends on control dependency: [if], data = [none]
} else if (rb.stage == STAGE_PREFIX) {
ComponentFields mtasFields = getMtasFields(rb);
searchPrefix.distributedProcess(rb, mtasFields); // depends on control dependency: [if], data = [none]
} else if (rb.stage == STAGE_STATS) {
ComponentFields mtasFields = getMtasFields(rb);
searchStats.distributedProcess(rb, mtasFields); // depends on control dependency: [if], data = [none]
} else if (rb.stage == STAGE_FACET) {
ComponentFields mtasFields = getMtasFields(rb);
searchFacet.distributedProcess(rb, mtasFields); // depends on control dependency: [if], data = [none]
} else if (rb.stage == STAGE_COLLECTION_INIT || rb.stage == STAGE_COLLECTION_FINISH) {
ComponentFields mtasFields = getMtasFields(rb);
searchCollection.distributedProcess(rb, mtasFields); // depends on control dependency: [if], data = [none]
} else if (rb.stage == STAGE_GROUP) {
ComponentFields mtasFields = getMtasFields(rb);
searchGroup.distributedProcess(rb, mtasFields); // depends on control dependency: [if], data = [none]
} else if (rb.stage == STAGE_DOCUMENT) {
ComponentFields mtasFields = getMtasFields(rb);
searchDocument.distributedProcess(rb, mtasFields); // depends on control dependency: [if], data = [none]
}
// compute new stage and return if not finished
if (rb.stage >= ResponseBuilder.STAGE_EXECUTE_QUERY && rb.stage < ResponseBuilder.STAGE_GET_FIELDS) {
if (rb.stage < STAGE_TERMVECTOR_MISSING_TOP
&& rb.req.getParams().getBool(MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) {
return STAGE_TERMVECTOR_MISSING_TOP; // depends on control dependency: [if], data = [STAGE_TERMVECTOR_MISSING_TOP]
} else if (rb.stage < STAGE_TERMVECTOR_MISSING_KEY
&& rb.req.getParams().getBool(MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) {
return STAGE_TERMVECTOR_MISSING_KEY; // depends on control dependency: [if], data = [STAGE_TERMVECTOR_MISSING_KEY]
} else if (rb.stage < STAGE_TERMVECTOR_FINISH
&& rb.req.getParams().getBool(MtasSolrComponentTermvector.PARAM_MTAS_TERMVECTOR, false)) {
return STAGE_TERMVECTOR_FINISH; // depends on control dependency: [if], data = [STAGE_TERMVECTOR_FINISH]
} else if (rb.stage < STAGE_LIST
&& rb.req.getParams().getBool(MtasSolrComponentList.PARAM_MTAS_LIST, false)) {
return STAGE_LIST; // depends on control dependency: [if], data = [STAGE_LIST]
} else if (rb.stage < STAGE_PREFIX
&& rb.req.getParams().getBool(MtasSolrComponentPrefix.PARAM_MTAS_PREFIX, false)) {
return STAGE_PREFIX; // depends on control dependency: [if], data = [STAGE_PREFIX]
} else if (rb.stage < STAGE_STATS
&& rb.req.getParams().getBool(MtasSolrComponentStats.PARAM_MTAS_STATS, false)) {
return STAGE_STATS; // depends on control dependency: [if], data = [STAGE_STATS]
} else if (rb.stage < STAGE_FACET
&& rb.req.getParams().getBool(MtasSolrComponentFacet.PARAM_MTAS_FACET, false)) {
return STAGE_FACET; // depends on control dependency: [if], data = [STAGE_FACET]
} else if (rb.stage < STAGE_GROUP
&& rb.req.getParams().getBool(MtasSolrComponentGroup.PARAM_MTAS_GROUP, false)) {
return STAGE_GROUP; // depends on control dependency: [if], data = [STAGE_GROUP]
} else if (rb.stage < STAGE_COLLECTION_INIT
&& rb.req.getParams().getBool(MtasSolrComponentCollection.PARAM_MTAS_COLLECTION, false)) {
return STAGE_COLLECTION_INIT; // depends on control dependency: [if], data = [STAGE_COLLECTION_INIT]
} else if (rb.stage < STAGE_COLLECTION_FINISH
&& rb.req.getParams().getBool(MtasSolrComponentCollection.PARAM_MTAS_COLLECTION, false)) {
return STAGE_COLLECTION_FINISH; // depends on control dependency: [if], data = [STAGE_COLLECTION_FINISH]
}
} else if (rb.stage >= ResponseBuilder.STAGE_GET_FIELDS && rb.stage < ResponseBuilder.STAGE_DONE) {
if (rb.stage < STAGE_DOCUMENT
&& rb.req.getParams().getBool(MtasSolrComponentDocument.PARAM_MTAS_DOCUMENT, false)) {
return STAGE_DOCUMENT; // depends on control dependency: [if], data = [STAGE_DOCUMENT]
}
}
}
} catch (ExitableDirectoryReader.ExitingReaderException e) {
solrStatus.setError(e.getMessage());
finishStatus(solrStatus);
} finally {
checkStatus(solrStatus);
}
return ResponseBuilder.STAGE_DONE;
} } |
public class class_name {
private static DateTime uniqueTimestamp() {
long currentMillis;
synchronized (FixedUidGenerator.class) {
currentMillis = System.currentTimeMillis();
// guarantee uniqueness by ensuring timestamp is always greater
// than the previous..
if (currentMillis < lastMillis) {
currentMillis = lastMillis;
}
if (currentMillis - lastMillis < Dates.MILLIS_PER_SECOND) {
currentMillis += Dates.MILLIS_PER_SECOND;
}
lastMillis = currentMillis;
}
final DateTime timestamp = new DateTime(currentMillis);
timestamp.setUtc(true);
return timestamp;
} } | public class class_name {
private static DateTime uniqueTimestamp() {
long currentMillis;
synchronized (FixedUidGenerator.class) {
currentMillis = System.currentTimeMillis();
// guarantee uniqueness by ensuring timestamp is always greater
// than the previous..
if (currentMillis < lastMillis) {
currentMillis = lastMillis; // depends on control dependency: [if], data = [none]
}
if (currentMillis - lastMillis < Dates.MILLIS_PER_SECOND) {
currentMillis += Dates.MILLIS_PER_SECOND; // depends on control dependency: [if], data = [none]
}
lastMillis = currentMillis;
}
final DateTime timestamp = new DateTime(currentMillis);
timestamp.setUtc(true);
return timestamp;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.